From 2080474c75b833d2d666291839d8893cc0999de2 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Mon, 24 Sep 2018 15:05:45 +0200 Subject: Migrate `src/test/ui/run-pass/*` back to `src/test/run-pass/`. Fix #54047 --- .../allocator/auxiliary/custom-as-global.rs | 26 + src/test/run-pass/allocator/auxiliary/custom.rs | 31 + src/test/run-pass/allocator/auxiliary/helper.rs | 19 + src/test/run-pass/allocator/custom.rs | 68 + src/test/run-pass/allocator/xcrate-use.rs | 45 + src/test/run-pass/allocator/xcrate-use2.rs | 58 + src/test/run-pass/array-slice-vec/arr_cycle.rs | 41 + .../array-slice-vec/array_const_index-1.rs | 21 + .../array-slice-vec/box-of-array-of-drop-1.rs | 57 + .../array-slice-vec/box-of-array-of-drop-2.rs | 57 + .../run-pass/array-slice-vec/cast-in-array-size.rs | 24 + .../array-slice-vec/check-static-mut-slices.rs | 24 + .../run-pass/array-slice-vec/check-static-slice.rs | 46 + .../array-slice-vec/copy-out-of-array-1.rs | 29 + .../array-slice-vec/destructure-array-1.rs | 37 + .../run-pass/array-slice-vec/empty-mutable-vec.rs | 18 + src/test/run-pass/array-slice-vec/estr-slice.rs | 60 + src/test/run-pass/array-slice-vec/evec-slice.rs | 56 + .../run-pass/array-slice-vec/fixed_length_copy.rs | 19 + .../run-pass/array-slice-vec/huge-largest-array.rs | 24 + .../run-pass/array-slice-vec/ivec-pass-by-value.rs | 14 + ...mutability-inherits-through-fixed-length-vec.rs | 29 + .../run-pass/array-slice-vec/mutable-alias-vec.rs | 25 + src/test/run-pass/array-slice-vec/nested-vec-1.rs | 18 + src/test/run-pass/array-slice-vec/nested-vec-2.rs | 25 + src/test/run-pass/array-slice-vec/nested-vec-3.rs | 64 + .../array-slice-vec/new-style-fixed-length-vec.rs | 17 + .../array-slice-vec/rcvr-borrowed-to-slice.rs | 43 + .../array-slice-vec/repeated-vector-syntax.rs | 23 + .../run-pass/array-slice-vec/show-boxed-slice.rs | 18 + src/test/run-pass/array-slice-vec/slice-2.rs | 72 + .../array-slice-vec/slice-of-zero-size-elements.rs | 63 + src/test/run-pass/array-slice-vec/slice-panic-1.rs | 36 + src/test/run-pass/array-slice-vec/slice-panic-2.rs | 40 + src/test/run-pass/array-slice-vec/slice.rs | 90 + .../array-slice-vec/slice_binary_search.rs | 31 + .../array-slice-vec/variance-vec-covariant.rs | 30 + src/test/run-pass/array-slice-vec/vec-concat.rs | 24 + src/test/run-pass/array-slice-vec/vec-dst.rs | 36 + .../run-pass/array-slice-vec/vec-fixed-length.rs | 34 + src/test/run-pass/array-slice-vec/vec-growth.rs | 26 + src/test/run-pass/array-slice-vec/vec-late-init.rs | 18 + .../run-pass/array-slice-vec/vec-macro-no-std.rs | 37 + .../run-pass/array-slice-vec/vec-macro-repeat.rs | 25 + .../array-slice-vec/vec-macro-rvalue-scope.rs | 21 + .../array-slice-vec/vec-macro-with-brackets.rs | 25 + .../vec-macro-with-trailing-comma.rs | 18 + .../array-slice-vec/vec-matching-autoslice.rs | 33 + .../run-pass/array-slice-vec/vec-matching-fixed.rs | 42 + .../run-pass/array-slice-vec/vec-matching-fold.rs | 58 + .../vec-matching-legal-tail-element-borrow.rs | 25 + src/test/run-pass/array-slice-vec/vec-matching.rs | 169 + src/test/run-pass/array-slice-vec/vec-push.rs | 13 + .../array-slice-vec/vec-repeat-with-cast.rs | 15 + .../run-pass/array-slice-vec/vec-slice-drop.rs | 41 + src/test/run-pass/array-slice-vec/vec-slice.rs | 19 + .../run-pass/array-slice-vec/vec-tail-matching.rs | 46 + src/test/run-pass/array-slice-vec/vec-to_str.rs | 22 + src/test/run-pass/array-slice-vec/vec.rs | 25 + src/test/run-pass/array-slice-vec/vec_cycle.rs | 49 + .../run-pass/array-slice-vec/vec_cycle_wrapped.rs | 60 + .../run-pass/array-slice-vec/vector-no-ann-2.rs | 17 + .../associated-const-const-eval.rs | 30 + .../associated-const-cross-crate-const-eval.rs | 38 + .../associated-const-cross-crate-defaults.rs | 32 + .../associated-const-cross-crate.rs | 27 + .../associated-const-in-global-const.rs | 23 + .../associated-const-inherent-impl.rs | 21 + .../associated-const-marks-live-code.rs | 25 + .../associated-const-match-patterns.rs | 78 + .../associated-const-outer-ty-refs.rs | 20 + .../associated-const-overwrite-default.rs | 23 + .../associated-const-public-impl.rs | 26 + .../associated-const-range-match-patterns.rs | 35 + .../associated-const-resolution-order.rs | 35 + .../associated-const-self-type.rs | 23 + .../associated-const-type-parameters.rs | 54 + .../associated-const-ufcs-infer-trait.rs | 23 + .../associated-const-use-default.rs | 21 + .../associated-const-use-impl-of-same-trait.rs | 35 + .../run-pass/associated-consts/associated-const.rs | 23 + .../auxiliary/associated-const-cc-lib.rs | 45 + .../associated-consts/auxiliary/empty-struct.rs | 19 + .../associated-types/associated-types-basic.rs | 24 + .../associated-types-binding-in-trait.rs | 46 + .../associated-types-binding-in-where-clause.rs | 48 + .../associated-types/associated-types-bound.rs | 53 + .../associated-types/associated-types-cc.rs | 27 + .../associated-types-conditional-dispatch.rs | 76 + .../associated-types-constant-type.rs | 41 + .../associated-types-doubleendediterator-object.rs | 30 + ...sociated-types-duplicate-binding-in-env-hrtb.rs | 26 + .../associated-types-duplicate-binding-in-env.rs | 30 + .../associated-types-enum-field-named.rs | 45 + .../associated-types-enum-field-numbered.rs | 45 + .../associated-types/associated-types-eq-obj.rs | 35 + .../associated-types-impl-redirect.rs | 58 + .../associated-types-in-bound-type-arg.rs | 27 + .../associated-types-in-default-method.rs | 37 + .../associated-types/associated-types-in-fn.rs | 38 + .../associated-types-in-impl-generics.rs | 46 + .../associated-types-in-inherent-method.rs | 40 + .../associated-types-issue-20220.rs | 38 + .../associated-types-issue-20371.rs | 19 + .../associated-types-issue-21212.rs | 31 + .../associated-types-iterator-binding.rs | 29 + .../associated-types/associated-types-method.rs | 37 + .../associated-types-nested-projections.rs | 53 + ...associated-types-normalize-in-bounds-binding.rs | 47 + .../associated-types-normalize-in-bounds-ufcs.rs | 44 + .../associated-types-normalize-in-bounds.rs | 44 + .../associated-types-normalize-unifield-struct.rs | 34 + ...s-project-from-type-param-via-bound-in-where.rs | 108 + ...ciated-types-projection-bound-in-supertraits.rs | 32 + ...ted-types-projection-from-known-type-in-impl.rs | 48 + .../associated-types-projection-in-object-type.rs | 48 + .../associated-types-projection-in-supertrait.rs | 54 + .../associated-types-projection-in-where-clause.rs | 39 + ...sociated-types-projection-to-unrelated-trait.rs | 45 + ...alified-path-with-trait-with-type-parameters.rs | 19 + .../associated-types-ref-from-struct.rs | 65 + .../associated-types-ref-in-struct-literal.rs | 33 + .../associated-types-region-erasure-issue-20582.rs | 30 + .../associated-types-resolve-lifetime.rs | 25 + .../associated-types/associated-types-return.rs | 56 + .../associated-types/associated-types-simple.rs | 34 + .../associated-types/associated-types-stream.rs | 49 + .../associated-types-struct-field-named.rs | 45 + .../associated-types-struct-field-numbered.rs | 42 + .../associated-types-sugar-path.rs | 48 + ...associated-types-where-clause-impl-ambiguity.rs | 54 + .../auxiliary/associated-types-cc-lib.rs | 26 + .../autoref-autoderef/auto-ref-bounded-ty-param.rs | 39 + .../autoref-autoderef/auto-ref-sliceable.rs | 29 + src/test/run-pass/autoref-autoderef/auto-ref.rs | 29 + .../autoderef-and-borrow-method-receiver.rs | 27 + .../autoref-autoderef/autoderef-method-on-trait.rs | 26 + .../autoref-autoderef/autoderef-method-priority.rs | 30 + .../autoderef-method-twice-but-not-thrice.rs | 26 + .../autoref-autoderef/autoderef-method-twice.rs | 26 + .../run-pass/autoref-autoderef/autoderef-method.rs | 26 + .../autoref-autoderef/autoderef-privacy.rs | 61 + .../autoref-intermediate-types-issue-3585.rs | 33 + src/test/run-pass/bench/issue-32062.rs | 60 + .../binding/allow_irrefutable_let_patterns.rs | 22 + .../binding/bind-field-short-with-modifiers.rs | 34 + .../run-pass/binding/borrowed-ptr-pattern-2.rs | 23 + .../run-pass/binding/borrowed-ptr-pattern-3.rs | 23 + .../binding/borrowed-ptr-pattern-infallible.rs | 18 + .../binding/borrowed-ptr-pattern-option.rs | 25 + src/test/run-pass/binding/borrowed-ptr-pattern.rs | 22 + .../run-pass/binding/empty-types-in-patterns.rs | 67 + .../binding/exhaustive-bool-match-sanity.rs | 32 + .../run-pass/binding/expr-match-generic-unique1.rs | 29 + .../run-pass/binding/expr-match-generic-unique2.rs | 27 + src/test/run-pass/binding/expr-match-generic.rs | 39 + src/test/run-pass/binding/expr-match-panic-all.rs | 24 + src/test/run-pass/binding/expr-match-panic.rs | 24 + src/test/run-pass/binding/expr-match-unique.rs | 20 + src/test/run-pass/binding/expr-match.rs | 55 + src/test/run-pass/binding/fat-arrow-match.rs | 26 + .../run-pass/binding/fn-pattern-expected-type-2.rs | 18 + .../run-pass/binding/fn-pattern-expected-type.rs | 19 + .../binding/func-arg-incomplete-pattern.rs | 33 + src/test/run-pass/binding/func-arg-ref-pattern.rs | 38 + src/test/run-pass/binding/func-arg-wild-pattern.rs | 22 + src/test/run-pass/binding/if-let.rs | 69 + .../binding/inconsistent-lifetime-mismatch.rs | 24 + .../binding/inferred-suffix-in-pattern-range.rs | 34 + .../run-pass/binding/irrefutable-slice-patterns.rs | 25 + src/test/run-pass/binding/let-assignability.rs | 22 + src/test/run-pass/binding/let-destruct-ref.rs | 17 + src/test/run-pass/binding/let-var-hygiene.rs | 21 + src/test/run-pass/binding/match-arm-statics.rs | 175 + src/test/run-pass/binding/match-beginning-vert.rs | 29 + src/test/run-pass/binding/match-borrowed_str.rs | 58 + src/test/run-pass/binding/match-bot-2.rs | 15 + src/test/run-pass/binding/match-bot.rs | 17 + .../run-pass/binding/match-byte-array-patterns.rs | 55 + src/test/run-pass/binding/match-enum-struct-0.rs | 26 + src/test/run-pass/binding/match-enum-struct-1.rs | 28 + .../run-pass/binding/match-implicit-copy-unique.rs | 27 + src/test/run-pass/binding/match-in-macro.rs | 27 + src/test/run-pass/binding/match-join.rs | 29 + src/test/run-pass/binding/match-larger-const.rs | 22 + .../run-pass/binding/match-naked-record-expr.rs | 22 + src/test/run-pass/binding/match-naked-record.rs | 22 + src/test/run-pass/binding/match-path.rs | 23 + .../run-pass/binding/match-pattern-bindings.rs | 31 + src/test/run-pass/binding/match-pattern-lit.rs | 25 + .../binding/match-pattern-no-type-params.rs | 23 + src/test/run-pass/binding/match-pattern-simple.rs | 18 + src/test/run-pass/binding/match-phi.rs | 27 + src/test/run-pass/binding/match-pipe-binding.rs | 71 + src/test/run-pass/binding/match-range-infer.rs | 27 + src/test/run-pass/binding/match-range-static.rs | 23 + src/test/run-pass/binding/match-range.rs | 61 + src/test/run-pass/binding/match-reassign.rs | 31 + .../binding/match-ref-binding-in-guard-3256.rs | 23 + .../binding/match-ref-binding-mut-option.rs | 20 + src/test/run-pass/binding/match-ref-binding-mut.rs | 28 + src/test/run-pass/binding/match-ref-binding.rs | 22 + src/test/run-pass/binding/match-ref-unsized.rs | 21 + .../run-pass/binding/match-static-const-rename.rs | 74 + src/test/run-pass/binding/match-str.rs | 34 + src/test/run-pass/binding/match-struct-0.rs | 31 + src/test/run-pass/binding/match-tag.rs | 39 + src/test/run-pass/binding/match-unique-bind.rs | 22 + src/test/run-pass/binding/match-unsized.rs | 19 + .../binding/match-value-binding-in-guard-3291.rs | 29 + src/test/run-pass/binding/match-var-hygiene.rs | 21 + .../run-pass/binding/match-vec-alternatives.rs | 91 + src/test/run-pass/binding/match-vec-rvalue.rs | 25 + src/test/run-pass/binding/match-with-ret-arm.rs | 22 + src/test/run-pass/binding/multi-let.rs | 17 + src/test/run-pass/binding/mut-in-ident-patterns.rs | 84 + .../run-pass/binding/nested-exhaustive-match.rs | 23 + src/test/run-pass/binding/nested-matchs.rs | 25 + src/test/run-pass/binding/nested-pattern.rs | 25 + src/test/run-pass/binding/nil-pattern.rs | 14 + src/test/run-pass/binding/nullary-or-pattern.rs | 23 + .../binding/optional_comma_in_match_arm.rs | 49 + src/test/run-pass/binding/or-pattern.rs | 24 + src/test/run-pass/binding/order-drop-with-match.rs | 67 + src/test/run-pass/binding/pat-ranges.rs | 24 + src/test/run-pass/binding/pat-tuple-1.rs | 103 + src/test/run-pass/binding/pat-tuple-2.rs | 33 + src/test/run-pass/binding/pat-tuple-3.rs | 39 + src/test/run-pass/binding/pat-tuple-4.rs | 67 + src/test/run-pass/binding/pat-tuple-5.rs | 39 + src/test/run-pass/binding/pat-tuple-6.rs | 55 + src/test/run-pass/binding/pat-tuple-7.rs | 17 + .../binding/pattern-bound-var-in-for-each.rs | 30 + src/test/run-pass/binding/pattern-in-closure.rs | 24 + .../binding/range-inclusive-pattern-precedence.rs | 33 + src/test/run-pass/binding/simple-generic-match.rs | 18 + src/test/run-pass/binding/use-uninit-match.rs | 26 + src/test/run-pass/binding/use-uninit-match2.rs | 26 + .../run-pass/binding/zero_sized_subslice_match.rs | 22 + .../borrowck/borrowck-assign-to-subfield.rs | 33 + .../borrowck/borrowck-assignment-to-static-mut.rs | 23 + .../run-pass/borrowck/borrowck-binding-mutbl.rs | 26 + .../borrowck/borrowck-borrow-from-expr-block.rs | 28 + .../borrowck-borrow-of-mut-base-ptr-safe.rs | 28 + .../run-pass/borrowck/borrowck-closures-two-imm.rs | 51 + .../borrowck/borrowck-field-sensitivity.rs | 274 ++ .../borrowck/borrowck-fixed-length-vecs.rs | 17 + .../borrowck/borrowck-freeze-frozen-mut.rs | 38 + src/test/run-pass/borrowck/borrowck-lend-args.rs | 30 + .../borrowck-macro-interaction-issue-6304.rs | 46 + .../borrowck/borrowck-move-by-capture-ok.rs | 18 + .../borrowck-multiple-borrows-interior-boxes.rs | 30 + src/test/run-pass/borrowck/borrowck-mut-uniq.rs | 43 + .../borrowck/borrowck-mut-vec-as-imm-slice.rs | 26 + src/test/run-pass/borrowck/borrowck-pat-enum.rs | 48 + .../borrowck/borrowck-pat-reassign-no-binding.rs | 24 + .../run-pass/borrowck/borrowck-rvalues-mutable.rs | 44 + .../borrowck/borrowck-scope-of-deref-issue-4666.rs | 52 + .../borrowck-slice-pattern-element-loan.rs | 34 + .../borrowck/borrowck-static-item-in-fn.rs | 18 + .../run-pass/borrowck/borrowck-trait-lifetime.rs | 27 + .../run-pass/borrowck/borrowck-uniq-via-ref.rs | 58 + .../run-pass/borrowck/borrowck-univariant-enum.rs | 35 + .../borrowck-unsafe-static-mutable-borrows.rs | 32 + .../borrowck/borrowck-unused-mut-locals.rs | 57 + .../run-pass/borrowck/borrowck-use-mut-borrow.rs | 61 + src/test/run-pass/borrowck/two-phase-baseline.rs | 20 + src/test/run-pass/borrowck/two-phase-bin-ops.rs | 49 + ...o-phase-control-flow-split-before-activation.rs | 29 + .../run-pass/cfg/auxiliary/cfg_inner_static.rs | 17 + .../auxiliary/crate-attributes-using-cfg_attr.rs | 16 + src/test/run-pass/cfg/cfg-attr-cfg.rs | 18 + src/test/run-pass/cfg/cfg-attr-crate.rs | 18 + src/test/run-pass/cfg/cfg-family.rs | 22 + src/test/run-pass/cfg/cfg-in-crate-1.rs | 15 + src/test/run-pass/cfg/cfg-macros-foo.rs | 36 + src/test/run-pass/cfg/cfg-macros-notfoo.rs | 36 + src/test/run-pass/cfg/cfg-match-arm.rs | 29 + src/test/run-pass/cfg/cfg-target-family.rs | 23 + src/test/run-pass/cfg/cfg-target-vendor.rs | 20 + src/test/run-pass/cfg/cfg_attr.rs | 60 + src/test/run-pass/cfg/cfg_inner_static.rs | 20 + src/test/run-pass/cfg/cfg_stmt_expr.rs | 99 + src/test/run-pass/cfg/cfgs-on-items.rs | 39 + src/test/run-pass/cfg/conditional-compile-arch.rs | 48 + src/test/run-pass/cfg/conditional-compile.rs | 158 + .../cfg/crate-attributes-using-cfg_attr.rs | 16 + src/test/run-pass/coerce/coerce-expect-unsized.rs | 53 + .../run-pass/coerce/coerce-overloaded-autoderef.rs | 76 + .../run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs | 26 + .../coerce/coerce-reborrow-imm-ptr-rcvr.rs | 28 + .../run-pass/coerce/coerce-reborrow-imm-vec-arg.rs | 28 + .../coerce/coerce-reborrow-imm-vec-rcvr.rs | 26 + .../run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs | 35 + .../coerce/coerce-reborrow-mut-ptr-rcvr.rs | 37 + .../run-pass/coerce/coerce-reborrow-mut-vec-arg.rs | 28 + .../coerce/coerce-reborrow-mut-vec-rcvr.rs | 24 + src/test/run-pass/coerce/coerce-unify-return.rs | 29 + src/test/run-pass/coerce/coerce-unify.rs | 78 + src/test/run-pass/coerce/coerce-unsize-subtype.rs | 49 + .../coherence/auxiliary/coherence_copy_like_lib.rs | 20 + .../run-pass/coherence/auxiliary/coherence_lib.rs | 25 + .../run-pass/coherence/coherence-bigint-int.rs | 23 + .../run-pass/coherence/coherence-bigint-vecint.rs | 23 + src/test/run-pass/coherence/coherence-blanket.rs | 25 + .../coherence/coherence-covered-type-parameter.rs | 23 + .../run-pass/coherence/coherence-impl-in-fn.rs | 23 + .../coherence/coherence-iterator-vec-any-elem.rs | 23 + .../run-pass/coherence/coherence-iterator-vec.rs | 23 + .../coherence/coherence-multidispatch-tuple.rs | 33 + .../coherence/coherence-negative-impls-safe.rs | 22 + .../coherence/coherence-rfc447-constrained.rs | 32 + src/test/run-pass/coherence/coherence-subtyping.rs | 49 + .../run-pass/coherence/coherence-where-clause.rs | 47 + src/test/run-pass/coherence/coherence_copy_like.rs | 28 + .../auxiliary/anon-extern-mod-cross-crate-1.rs | 19 + .../run-pass/consts/auxiliary/cci_borrow_lib.rs | 13 + src/test/run-pass/consts/auxiliary/cci_const.rs | 16 + .../run-pass/consts/auxiliary/cci_const_block.rs | 16 + src/test/run-pass/consts/auxiliary/const_fn_lib.rs | 16 + .../run-pass/consts/const-adt-align-mismatch.rs | 31 + src/test/run-pass/consts/const-autoderef.rs | 21 + src/test/run-pass/consts/const-big-enum.rs | 40 + src/test/run-pass/consts/const-binops.rs | 136 + .../consts/const-bitshift-rhs-inference.rs | 34 + .../run-pass/consts/const-block-cross-crate-fn.rs | 19 + .../consts/const-block-item-macro-codegen.rs | 49 + src/test/run-pass/consts/const-block-item.rs | 50 + src/test/run-pass/consts/const-block.rs | 55 + src/test/run-pass/consts/const-bound.rs | 29 + src/test/run-pass/consts/const-byte-str-cast.rs | 19 + src/test/run-pass/consts/const-cast-ptr-int.rs | 26 + src/test/run-pass/consts/const-cast.rs | 26 + src/test/run-pass/consts/const-const.rs | 19 + src/test/run-pass/consts/const-contents.rs | 29 + .../run-pass/consts/const-cross-crate-const.rs | 26 + .../run-pass/consts/const-cross-crate-extern.rs | 21 + src/test/run-pass/consts/const-deref.rs | 18 + src/test/run-pass/consts/const-endianess.rs | 33 + src/test/run-pass/consts/const-enum-byref-self.rs | 27 + src/test/run-pass/consts/const-enum-byref.rs | 25 + src/test/run-pass/consts/const-enum-cast.rs | 26 + src/test/run-pass/consts/const-enum-ptr.rs | 21 + src/test/run-pass/consts/const-enum-struct.rs | 21 + src/test/run-pass/consts/const-enum-struct2.rs | 21 + src/test/run-pass/consts/const-enum-structlike.rs | 25 + src/test/run-pass/consts/const-enum-tuple.rs | 20 + src/test/run-pass/consts/const-enum-tuple2.rs | 20 + src/test/run-pass/consts/const-enum-tuplestruct.rs | 21 + .../run-pass/consts/const-enum-tuplestruct2.rs | 21 + src/test/run-pass/consts/const-enum-vec-index.rs | 40 + src/test/run-pass/consts/const-enum-vec-ptr.rs | 25 + src/test/run-pass/consts/const-enum-vector.rs | 25 + src/test/run-pass/consts/const-err.rs | 29 + .../consts/const-expr-in-fixed-length-vec.rs | 22 + .../run-pass/consts/const-expr-in-vec-repeat.rs | 21 + src/test/run-pass/consts/const-extern-function.rs | 26 + .../run-pass/consts/const-fields-and-indexing.rs | 37 + src/test/run-pass/consts/const-fn-const-eval.rs | 20 + src/test/run-pass/consts/const-fn-feature-flags.rs | 24 + src/test/run-pass/consts/const-fn-method.rs | 27 + src/test/run-pass/consts/const-fn-nested.rs | 24 + .../run-pass/consts/const-fn-stability-calls.rs | 35 + src/test/run-pass/consts/const-fn-val.rs | 25 + src/test/run-pass/consts/const-fn.rs | 52 + .../run-pass/consts/const-index-feature-gate.rs | 16 + src/test/run-pass/consts/const-meth-pattern.rs | 30 + src/test/run-pass/consts/const-negation.rs | 45 + src/test/run-pass/consts/const-negative.rs | 19 + src/test/run-pass/consts/const-nullary-enum.rs | 32 + .../consts/const-nullary-univariant-enum.rs | 25 + src/test/run-pass/consts/const-pattern-variant.rs | 39 + src/test/run-pass/consts/const-rec-and-tup.rs | 29 + .../run-pass/consts/const-region-ptrs-noncopy.rs | 21 + src/test/run-pass/consts/const-region-ptrs.rs | 25 + src/test/run-pass/consts/const-repeated-values.rs | 20 + src/test/run-pass/consts/const-size_of-align_of.rs | 61 + src/test/run-pass/consts/const-str-ptr.rs | 26 + src/test/run-pass/consts/const-struct-offsets.rs | 27 + src/test/run-pass/consts/const-struct.rs | 42 + src/test/run-pass/consts/const-trait-to-trait.rs | 32 + src/test/run-pass/consts/const-tuple-struct.rs | 24 + src/test/run-pass/consts/const-typeid-of.rs | 44 + src/test/run-pass/consts/const-unit-struct.rs | 22 + src/test/run-pass/consts/const-unsafe-fn.rs | 32 + src/test/run-pass/consts/const-vec-of-fns.rs | 35 + src/test/run-pass/consts/const-vec-syntax.rs | 19 + src/test/run-pass/consts/const-vecs-and-slices.rs | 33 + src/test/run-pass/consts/const.rs | 16 + src/test/run-pass/consts/consts-in-patterns.rs | 29 + .../cross-crate/anon-extern-mod-cross-crate-2.rs | 24 + .../auxiliary/anon-extern-mod-cross-crate-1.rs | 19 + .../auxiliary/anon_trait_static_method_lib.rs | 19 + .../cross-crate/auxiliary/cci_borrow_lib.rs | 13 + .../cross-crate/auxiliary/cci_capture_clause.rs | 20 + .../run-pass/cross-crate/auxiliary/cci_const.rs | 16 + .../run-pass/cross-crate/auxiliary/cci_impl_lib.rs | 26 + .../run-pass/cross-crate/auxiliary/cci_iter_lib.rs | 21 + .../cross-crate/auxiliary/cci_nested_lib.rs | 62 + .../cross-crate/auxiliary/cci_no_inline_lib.rs | 22 + .../auxiliary/moves_based_on_type_lib.rs | 27 + .../cross-crate/auxiliary/newtype_struct_xc.rs | 13 + .../cross-crate/auxiliary/pub_static_array.rs | 11 + .../auxiliary/reexported_static_methods.rs | 53 + .../auxiliary/xcrate-trait-lifetime-param.rs | 13 + .../auxiliary/xcrate_address_insignificant.rs | 18 + .../auxiliary/xcrate_associated_type_defaults.rs | 22 + .../auxiliary/xcrate_generic_fn_nested_return.rs | 26 + .../auxiliary/xcrate_static_addresses.rs | 27 + .../cross-crate/auxiliary/xcrate_unit_struct.rs | 38 + src/test/run-pass/cross-crate/cci_borrow.rs | 24 + .../run-pass/cross-crate/cci_capture_clause.rs | 24 + src/test/run-pass/cross-crate/cci_impl_exe.rs | 28 + src/test/run-pass/cross-crate/cci_iter_exe.rs | 23 + src/test/run-pass/cross-crate/cci_nested_exe.rs | 30 + src/test/run-pass/cross-crate/cci_no_inline_exe.rs | 33 + .../run-pass/cross-crate/cross-crate-const-pat.rs | 24 + .../cross-crate/cross-crate-newtype-struct-pat.rs | 22 + .../cross-crate/moves-based-on-type-cross-crate.rs | 21 + .../reexported-static-methods-cross-crate.rs | 26 + .../cross-crate/static-array-across-crate.rs | 22 + .../cross-crate/xcrate-address-insignificant.rs | 19 + .../cross-crate/xcrate-associated-type-defaults.rs | 39 + .../cross-crate/xcrate-static-addresses.rs | 23 + .../cross-crate/xcrate-trait-lifetime-param.rs | 28 + .../run-pass/cross-crate/xcrate-unit-struct.rs | 40 + .../cross-crate/xcrate_generic_fn_nested_return.rs | 18 + src/test/run-pass/ctfe/assoc-const.rs | 30 + src/test/run-pass/ctfe/bswap-const.rs | 25 + .../ctfe/chained-constants-stackoverflow.rs | 366 ++ .../ctfe/const-block-non-item-statement-3.rs | 17 + .../ctfe/const-block-non-item-statement.rs | 19 + .../run-pass/ctfe/const-fn-destructuring-arg.rs | 25 + src/test/run-pass/ctfe/deref_in_pattern.rs | 22 + src/test/run-pass/ctfe/ice-48279.rs | 36 + src/test/run-pass/ctfe/issue-37550.rs | 20 + src/test/run-pass/ctfe/issue-broken-mir.rs | 20 + src/test/run-pass/ctfe/locals-in-const-fn.rs | 47 + src/test/run-pass/ctfe/match-const-fn-structs.rs | 33 + src/test/run-pass/ctfe/mozjs-error.rs | 40 + src/test/run-pass/ctfe/non-scalar-cast.rs | 19 + src/test/run-pass/ctfe/promotion.rs | 27 + src/test/run-pass/ctfe/references.rs | 36 + src/test/run-pass/ctfe/repeat_match.rs | 22 + src/test/run-pass/ctfe/return-in-const-fn.rs | 21 + src/test/run-pass/ctfe/signed_enum_discr.rs | 29 + src/test/run-pass/ctfe/transmute-const.rs | 24 + .../run-pass/ctfe/tuple-struct-constructors.rs | 20 + .../run-pass/deriving/auxiliary/derive-no-std.rs | 40 + src/test/run-pass/deriving/derive-no-std.rs | 23 + .../deriving/derive-partialord-correctness.rs | 19 + .../run-pass/deriving/deriving-associated-types.rs | 209 ++ src/test/run-pass/deriving/deriving-bounds.rs | 15 + src/test/run-pass/deriving/deriving-clone-array.rs | 19 + src/test/run-pass/deriving/deriving-clone-enum.rs | 23 + .../deriving/deriving-clone-generic-enum.rs | 23 + .../deriving/deriving-clone-generic-struct.rs | 23 + .../deriving-clone-generic-tuple-struct.rs | 19 + .../run-pass/deriving/deriving-clone-struct.rs | 36 + .../deriving/deriving-clone-tuple-struct.rs | 17 + .../run-pass/deriving/deriving-cmp-generic-enum.rs | 54 + .../deriving/deriving-cmp-generic-struct-enum.rs | 58 + .../deriving/deriving-cmp-generic-struct.rs | 50 + .../deriving/deriving-cmp-generic-tuple-struct.rs | 48 + .../run-pass/deriving/deriving-cmp-shortcircuit.rs | 47 + src/test/run-pass/deriving/deriving-copyclone.rs | 49 + src/test/run-pass/deriving/deriving-default-box.rs | 25 + .../deriving/deriving-enum-single-variant.rs | 22 + .../deriving/deriving-eq-ord-boxed-slice.rs | 25 + src/test/run-pass/deriving/deriving-hash.rs | 84 + src/test/run-pass/deriving/deriving-in-fn.rs | 20 + src/test/run-pass/deriving/deriving-in-macro.rs | 26 + .../run-pass/deriving/deriving-meta-multiple.rs | 34 + src/test/run-pass/deriving/deriving-meta.rs | 31 + .../deriving-self-lifetime-totalord-totaleq.rs | 26 + src/test/run-pass/deriving/deriving-show-2.rs | 63 + src/test/run-pass/deriving/deriving-show.rs | 44 + .../deriving/deriving-via-extension-c-enum.rs | 26 + .../deriving/deriving-via-extension-enum.rs | 25 + .../deriving/deriving-via-extension-hash-enum.rs | 26 + .../deriving/deriving-via-extension-hash-struct.rs | 21 + .../deriving-via-extension-struct-empty.rs | 18 + ...iving-via-extension-struct-like-enum-variant.rs | 22 + .../deriving-via-extension-struct-tuple.rs | 27 + .../deriving/deriving-via-extension-struct.rs | 26 + .../deriving/deriving-via-extension-type-params.rs | 26 + .../run-pass/deriving/deriving-with-repr-packed.rs | 46 + .../drop/auxiliary/dropck_eyepatch_extern_crate.rs | 60 + src/test/run-pass/drop/drop-on-empty-block-exit.rs | 22 + src/test/run-pass/drop/drop-on-ret.rs | 25 + src/test/run-pass/drop/drop-struct-as-object.rs | 47 + src/test/run-pass/drop/drop-trait-enum.rs | 102 + src/test/run-pass/drop/drop-trait-generic.rs | 24 + src/test/run-pass/drop/drop-trait.rs | 24 + src/test/run-pass/drop/drop-uninhabited-enum.rs | 22 + .../run-pass/drop/drop-with-type-ascription-1.rs | 18 + .../run-pass/drop/drop-with-type-ascription-2.rs | 18 + .../run-pass/drop/dropck-eyepatch-extern-crate.rs | 49 + src/test/run-pass/drop/dropck-eyepatch-reorder.rs | 89 + src/test/run-pass/drop/dropck-eyepatch.rs | 112 + src/test/run-pass/drop/dropck_legal_cycles.rs | 1193 +++++++ src/test/run-pass/drop/dynamic-drop.rs | 355 ++ src/test/run-pass/drop/no-drop-flag-size.rs | 24 + src/test/run-pass/drop/nondrop-cycle.rs | 41 + .../dynamically-sized-types/dst-coerce-custom.rs | 53 + .../dynamically-sized-types/dst-coerce-rc.rs | 51 + .../dynamically-sized-types/dst-coercions.rs | 37 + .../dynamically-sized-types/dst-deref-mut.rs | 45 + .../run-pass/dynamically-sized-types/dst-deref.rs | 40 + .../dynamically-sized-types/dst-field-align.rs | 76 + .../run-pass/dynamically-sized-types/dst-index.rs | 43 + .../dst-irrefutable-bind.rs | 37 + .../run-pass/dynamically-sized-types/dst-raw.rs | 148 + .../dynamically-sized-types/dst-struct-sole.rs | 86 + .../run-pass/dynamically-sized-types/dst-struct.rs | 132 + .../dynamically-sized-types/dst-trait-tuple.rs | 113 + .../run-pass/dynamically-sized-types/dst-trait.rs | 115 + .../dynamically-sized-types/dst-tuple-sole.rs | 89 + .../run-pass/dynamically-sized-types/dst-tuple.rs | 130 + .../extern/auxiliary/extern-crosscrate-source.rs | 41 + .../run-pass/extern/auxiliary/extern-take-value.rs | 15 + .../extern/auxiliary/extern_calling_convention.rs | 36 + .../extern/auxiliary/extern_mod_ordering_lib.rs | 15 + src/test/run-pass/extern/auxiliary/fat_drop.rs | 23 + src/test/run-pass/extern/extern-1.rs | 18 + src/test/run-pass/extern/extern-call-deep.rs | 48 + src/test/run-pass/extern/extern-call-deep2.rs | 53 + src/test/run-pass/extern/extern-call-direct.rs | 20 + src/test/run-pass/extern/extern-call-indirect.rs | 48 + src/test/run-pass/extern/extern-call-scrub.rs | 57 + .../extern/extern-calling-convention-test.rs | 22 + .../extern/extern-compare-with-return-type.rs | 35 + src/test/run-pass/extern/extern-crosscrate.rs | 31 + src/test/run-pass/extern/extern-foreign-crate.rs | 16 + src/test/run-pass/extern/extern-methods.rs | 40 + src/test/run-pass/extern/extern-mod-abi.rs | 18 + .../run-pass/extern/extern-mod-ordering-exe.rs | 22 + src/test/run-pass/extern/extern-pass-TwoU16s.rs | 35 + src/test/run-pass/extern/extern-pass-TwoU32s.rs | 35 + src/test/run-pass/extern/extern-pass-TwoU64s.rs | 35 + src/test/run-pass/extern/extern-pass-TwoU8s.rs | 35 + src/test/run-pass/extern/extern-pass-char.rs | 26 + src/test/run-pass/extern/extern-pass-double.rs | 23 + src/test/run-pass/extern/extern-pass-empty.rs | 65 + src/test/run-pass/extern/extern-pass-u32.rs | 26 + src/test/run-pass/extern/extern-pass-u64.rs | 26 + src/test/run-pass/extern/extern-prelude-core.rs | 28 + .../run-pass/extern/extern-prelude-core.stderr | 8 + .../extern/extern-prelude-no-speculative.rs | 22 + src/test/run-pass/extern/extern-prelude-std.rs | 23 + src/test/run-pass/extern/extern-prelude-std.stderr | 8 + src/test/run-pass/extern/extern-pub.rs | 19 + src/test/run-pass/extern/extern-return-TwoU16s.rs | 31 + src/test/run-pass/extern/extern-return-TwoU32s.rs | 31 + src/test/run-pass/extern/extern-return-TwoU64s.rs | 31 + src/test/run-pass/extern/extern-return-TwoU8s.rs | 31 + src/test/run-pass/extern/extern-rust.rs | 22 + src/test/run-pass/extern/extern-take-value.rs | 23 + src/test/run-pass/extern/extern-thiscall.rs | 36 + .../run-pass/extern/extern-types-inherent-impl.rs | 28 + .../extern/extern-types-manual-sync-send.rs | 29 + .../run-pass/extern/extern-types-pointer-cast.rs | 41 + .../run-pass/extern/extern-types-size_of_val.rs | 27 + .../run-pass/extern/extern-types-thin-pointer.rs | 52 + .../run-pass/extern/extern-types-trait-impl.rs | 36 + src/test/run-pass/extern/extern-vectorcall.rs | 36 + src/test/run-pass/extern/extern_fat_drop.rs | 23 + src/test/run-pass/for-loop-while/auto-loop.rs | 20 + src/test/run-pass/for-loop-while/break-value.rs | 16 + src/test/run-pass/for-loop-while/break.rs | 35 + src/test/run-pass/for-loop-while/for-destruct.rs | 19 + .../run-pass/for-loop-while/for-loop-goofiness.rs | 25 + .../for-loop-while/for-loop-has-unit-body.rs | 22 + .../for-loop-while/for-loop-into-iterator.rs | 29 + .../for-loop-lifetime-of-unbound-values.rs | 44 + src/test/run-pass/for-loop-while/for-loop-macro.rs | 21 + .../for-loop-while/for-loop-mut-ref-element.rs | 16 + .../run-pass/for-loop-while/for-loop-no-std.rs | 23 + src/test/run-pass/for-loop-while/for-loop-panic.rs | 14 + ...loop-unconstrained-element-type-i32-fallback.rs | 21 + .../foreach-external-iterators-break.rs | 23 + ...ach-external-iterators-hashmap-break-restart.rs | 43 + .../foreach-external-iterators-hashmap.rs | 29 + .../foreach-external-iterators-loop.rs | 23 + .../foreach-external-iterators-nested.rs | 25 + .../for-loop-while/foreach-external-iterators.rs | 20 + src/test/run-pass/for-loop-while/foreach-nested.rs | 26 + .../for-loop-while/foreach-put-structured.rs | 32 + .../for-loop-while/foreach-simple-outer-slot.rs | 26 + .../run-pass/for-loop-while/label_break_value.rs | 124 + src/test/run-pass/for-loop-while/labeled-break.rs | 32 + .../run-pass/for-loop-while/linear-for-loop.rs | 33 + .../liveness-assign-imm-local-after-loop.rs | 26 + .../run-pass/for-loop-while/liveness-loop-break.rs | 23 + .../for-loop-while/liveness-move-in-loop.rs | 29 + .../run-pass/for-loop-while/loop-break-cont-1.rs | 19 + .../run-pass/for-loop-while/loop-break-cont.rs | 49 + .../run-pass/for-loop-while/loop-break-value.rs | 147 + src/test/run-pass/for-loop-while/loop-diverges.rs | 23 + .../for-loop-while/loop-label-shadowing.rs | 21 + .../for-loop-while/loop-labeled-break-value.rs | 21 + .../loop-no-reinit-needed-post-bot.rs | 44 + src/test/run-pass/for-loop-while/loop-scope.rs | 18 + src/test/run-pass/for-loop-while/while-cont.rs | 21 + .../run-pass/for-loop-while/while-flow-graph.rs | 16 + src/test/run-pass/for-loop-while/while-label.rs | 24 + src/test/run-pass/for-loop-while/while-let.rs | 56 + .../for-loop-while/while-loop-constraints-2.rs | 24 + .../run-pass/for-loop-while/while-prelude-drop.rs | 34 + .../run-pass/for-loop-while/while-with-break.rs | 27 + src/test/run-pass/for-loop-while/while.rs | 23 + src/test/run-pass/foreign/auxiliary/fn-abi.rs | 12 + src/test/run-pass/foreign/auxiliary/foreign_lib.rs | 48 + .../run-pass/foreign/foreign-call-no-runtime.rs | 65 + src/test/run-pass/foreign/foreign-dupe.rs | 27 + src/test/run-pass/foreign/foreign-fn-linkname.rs | 39 + src/test/run-pass/foreign/foreign-fn-with-byval.rs | 42 + src/test/run-pass/foreign/foreign-int-types.rs | 23 + .../foreign/foreign-mod-src/compiletest-ignore-dir | 0 src/test/run-pass/foreign/foreign-mod-src/inner.rs | 24 + .../run-pass/foreign/foreign-mod-unused-const.rs | 21 + src/test/run-pass/foreign/foreign-no-abi.rs | 32 + .../foreign/foreign-src/compiletest-ignore-dir | 0 src/test/run-pass/foreign/foreign-src/foreign.rs | 19 + .../foreign/foreign-truncated-arguments.rs | 30 + src/test/run-pass/foreign/foreign2.rs | 39 + .../functions-closures/auxiliary/fn-abi.rs | 12 + .../call-closure-from-overloaded-op.rs | 19 + .../capture-clauses-boxed-closures.rs | 24 + .../capture-clauses-unboxed-closures.rs | 23 + .../run-pass/functions-closures/clone-closure.rs | 28 + .../closure-bounds-can-capture-chan.rs | 26 + .../closure-expected-type/README.md | 8 + .../expect-infer-supply-two-infers.rs | 27 + .../closure-expected-type/issue-38714.rs | 27 + .../supply-just-return-type.rs | 36 + .../closure-expected-type/supply-nothing.rs | 21 + .../functions-closures/closure-immediate.rs | 23 + .../functions-closures/closure-inference.rs | 21 + .../functions-closures/closure-inference2.rs | 19 + .../run-pass/functions-closures/closure-reform.rs | 65 + .../closure-returning-closure.rs | 15 + .../functions-closures/closure-to-fn-coercion.rs | 45 + .../closure_to_fn_coercion-expected-types.rs | 18 + .../run-pass/functions-closures/copy-closure.rs | 26 + src/test/run-pass/functions-closures/fn-abi.rs | 28 + .../run-pass/functions-closures/fn-bare-assign.rs | 27 + .../functions-closures/fn-bare-coerce-to-block.rs | 20 + .../run-pass/functions-closures/fn-bare-item.rs | 18 + .../run-pass/functions-closures/fn-bare-size.rs | 18 + .../run-pass/functions-closures/fn-bare-spawn.rs | 25 + .../run-pass/functions-closures/fn-coerce-field.rs | 22 + .../functions-closures/fn-item-type-cast.rs | 30 + .../functions-closures/fn-item-type-coerce.rs | 26 + .../functions-closures/fn-item-type-zero-sized.rs | 23 + src/test/run-pass/functions-closures/fn-lval.rs | 21 + .../run-pass/functions-closures/fn-type-infer.rs | 21 + .../implied-bounds-closure-arg-outlives.rs | 45 + .../nullable-pointer-opt-closures.rs | 44 + .../parallel-codegen-closures.rs | 37 + .../functions-closures/return-from-closure.rs | 43 + .../generator/auxiliary/xcrate-reachable.rs | 24 + src/test/run-pass/generator/auxiliary/xcrate.rs | 27 + src/test/run-pass/generator/borrow-in-tail-expr.rs | 21 + src/test/run-pass/generator/conditional-drop.rs | 67 + src/test/run-pass/generator/control-flow.rs | 58 + src/test/run-pass/generator/drop-env.rs | 72 + src/test/run-pass/generator/issue-44197.rs | 44 + src/test/run-pass/generator/issue-52398.rs | 37 + src/test/run-pass/generator/iterator-count.rs | 52 + .../run-pass/generator/live-upvar-across-yield.rs | 23 + src/test/run-pass/generator/match-bindings.rs | 32 + src/test/run-pass/generator/nested_generators.rs | 32 + src/test/run-pass/generator/panic-drops.rs | 66 + src/test/run-pass/generator/panic-safe.rs | 39 + src/test/run-pass/generator/reborrow-mut-upvar.rs | 26 + src/test/run-pass/generator/resume-after-return.rs | 37 + src/test/run-pass/generator/smoke.rs | 183 + src/test/run-pass/generator/static-generators.rs | 28 + .../generator/too-live-local-in-immovable-gen.rs | 30 + src/test/run-pass/generator/xcrate-reachable.rs | 23 + src/test/run-pass/generator/xcrate.rs | 39 + src/test/run-pass/generator/yield-in-args-rev.rs | 28 + src/test/run-pass/generator/yield-in-box.rs | 28 + .../run-pass/generator/yield-in-initializer.rs | 27 + src/test/run-pass/generator/yield-subtype.rs | 29 + .../generics/auxiliary/default_type_params_xc.rs | 15 + src/test/run-pass/generics/generic-alias-unique.rs | 21 + .../generic-default-type-params-cross-crate.rs | 27 + .../generics/generic-default-type-params.rs | 63 + src/test/run-pass/generics/generic-derived-type.rs | 31 + .../run-pass/generics/generic-exterior-unique.rs | 22 + .../run-pass/generics/generic-extern-mangle.rs | 19 + src/test/run-pass/generics/generic-fn-infer.rs | 20 + src/test/run-pass/generics/generic-fn-twice.rs | 21 + src/test/run-pass/generics/generic-fn-unique.rs | 16 + src/test/run-pass/generics/generic-fn.rs | 36 + src/test/run-pass/generics/generic-ivec-leak.rs | 15 + .../run-pass/generics/generic-newtype-struct.rs | 18 + src/test/run-pass/generics/generic-object.rs | 32 + .../run-pass/generics/generic-recursive-tag.rs | 23 + .../run-pass/generics/generic-static-methods.rs | 31 + .../run-pass/generics/generic-tag-corruption.rs | 20 + src/test/run-pass/generics/generic-tag-local.rs | 18 + src/test/run-pass/generics/generic-tag-match.rs | 22 + src/test/run-pass/generics/generic-tag-values.rs | 30 + src/test/run-pass/generics/generic-tag.rs | 24 + src/test/run-pass/generics/generic-temporary.rs | 26 + src/test/run-pass/generics/generic-tup.rs | 18 + src/test/run-pass/generics/generic-type-synonym.rs | 24 + src/test/run-pass/generics/generic-type.rs | 21 + src/test/run-pass/generics/generic-unique.rs | 21 + .../hrtb-binder-levels-in-object-types.rs | 37 + .../hrtb-debruijn-object-types-in-closures.rs | 25 + .../hrtb-fn-like-trait-object.rs | 37 + .../higher-rank-trait-bounds/hrtb-fn-like-trait.rs | 37 + .../higher-rank-trait-bounds/hrtb-opt-in-copy.rs | 38 + .../higher-rank-trait-bounds/hrtb-parse.rs | 46 + .../hrtb-precedence-of-plus-where-clause.rs | 33 + .../hrtb-precedence-of-plus.rs | 22 + .../hrtb-resolve-lifetime.rs | 23 + .../hrtb-trait-object-paren-notation.rs | 36 + .../hrtb-trait-object-passed-to-closure.rs | 34 + .../higher-rank-trait-bounds/hrtb-type-outlives.rs | 56 + .../hrtb-unboxed-closure-trait.rs | 21 + .../hygiene/auxiliary/legacy_interaction.rs | 20 + src/test/run-pass/hygiene/auxiliary/my_crate.rs | 12 + .../hygiene/auxiliary/unhygienic_example.rs | 38 + src/test/run-pass/hygiene/auxiliary/xcrate.rs | 39 + src/test/run-pass/hygiene/hygiene-dodging-1.rs | 23 + src/test/run-pass/hygiene/hygiene.rs | 124 + .../run-pass/hygiene/hygienic-labels-in-let.rs | 83 + .../run-pass/hygiene/hygienic-labels-in-let.stderr | 300 ++ src/test/run-pass/hygiene/hygienic-labels.rs | 62 + src/test/run-pass/hygiene/hygienic-labels.stderr | 299 ++ src/test/run-pass/hygiene/issue-44128.rs | 26 + src/test/run-pass/hygiene/issue-47311.rs | 27 + src/test/run-pass/hygiene/issue-47312.rs | 31 + src/test/run-pass/hygiene/items.rs | 37 + src/test/run-pass/hygiene/legacy_interaction.rs | 51 + src/test/run-pass/hygiene/lexical.rs | 34 + src/test/run-pass/hygiene/specialization.rs | 35 + src/test/run-pass/hygiene/trait_items.rs | 30 + src/test/run-pass/hygiene/ty_params.rs | 24 + .../run-pass/hygiene/wrap_unhygienic_example.rs | 44 + src/test/run-pass/hygiene/xcrate.rs | 22 + src/test/run-pass/impl-trait/auto-trait-leak.rs | 31 + src/test/run-pass/impl-trait/auxiliary/xcrate.rs | 33 + src/test/run-pass/impl-trait/bounds_regression.rs | 34 + src/test/run-pass/impl-trait/equality.rs | 58 + src/test/run-pass/impl-trait/example-calendar.rs | 894 +++++ src/test/run-pass/impl-trait/example-st.rs | 40 + .../run-pass/impl-trait/existential-minimal.rs | 15 + src/test/run-pass/impl-trait/issue-42479.rs | 27 + src/test/run-pass/impl-trait/issue-49376.rs | 31 + src/test/run-pass/impl-trait/lifetimes.rs | 128 + src/test/run-pass/impl-trait/nesting.rs | 24 + .../run-pass/impl-trait/universal_hrtb_anon.rs | 20 + .../run-pass/impl-trait/universal_hrtb_named.rs | 20 + .../impl-trait/universal_in_adt_in_parameters.rs | 32 + .../universal_in_impl_trait_in_parameters.rs | 40 + .../universal_in_trait_defn_parameters.rs | 28 + .../impl-trait/universal_multiple_bounds.rs | 23 + src/test/run-pass/impl-trait/xcrate.rs | 21 + src/test/run-pass/impl-trait/xcrate_simple.rs | 19 + .../auxiliary/crate_with_invalid_spans.rs | 30 + .../auxiliary/crate_with_invalid_spans_macros.rs | 17 + .../import-crate-with-invalid-spans/main.rs | 23 + src/test/run-pass/imports/import-from.rs | 21 + src/test/run-pass/imports/import-glob-0.rs | 38 + src/test/run-pass/imports/import-glob-1.rs | 35 + src/test/run-pass/imports/import-glob-crate.rs | 29 + src/test/run-pass/imports/import-in-block.rs | 23 + src/test/run-pass/imports/import-prefix-macro.rs | 36 + src/test/run-pass/imports/import-rename.rs | 22 + src/test/run-pass/imports/import-trailing-comma.rs | 23 + src/test/run-pass/imports/import.rs | 22 + src/test/run-pass/imports/import2.rs | 19 + src/test/run-pass/imports/import3.rs | 23 + src/test/run-pass/imports/import4.rs | 19 + src/test/run-pass/imports/import5.rs | 20 + src/test/run-pass/imports/import6.rs | 25 + src/test/run-pass/imports/import7.rs | 28 + src/test/run-pass/imports/import8.rs | 20 + src/test/run-pass/imports/imports.rs | 76 + .../run-pass/intrinsics/auxiliary/cci_intrinsic.rs | 24 + .../run-pass/intrinsics/intrinsic-alignment.rs | 84 + src/test/run-pass/intrinsics/intrinsic-assume.rs | 27 + .../run-pass/intrinsics/intrinsic-atomics-cc.rs | 22 + src/test/run-pass/intrinsics/intrinsic-atomics.rs | 113 + .../intrinsics/intrinsic-move-val-cleanups.rs | 198 ++ src/test/run-pass/intrinsics/intrinsic-move-val.rs | 92 + src/test/run-pass/intrinsics/intrinsic-uninit.rs | 23 + .../run-pass/intrinsics/intrinsic-unreachable.rs | 27 + src/test/run-pass/intrinsics/intrinsics-integer.rs | 180 + src/test/run-pass/intrinsics/intrinsics-math.rs | 70 + src/test/run-pass/issues/.gitattributes | 1 + src/test/run-pass/issues/auxiliary/cgu_test.rs | 16 + src/test/run-pass/issues/auxiliary/cgu_test_a.rs | 25 + src/test/run-pass/issues/auxiliary/cgu_test_b.rs | 25 + src/test/run-pass/issues/auxiliary/i8.rs | 13 + src/test/run-pass/issues/auxiliary/iss.rs | 22 + src/test/run-pass/issues/auxiliary/issue-10028.rs | 19 + src/test/run-pass/issues/auxiliary/issue-11224.rs | 26 + .../run-pass/issues/auxiliary/issue-11225-1.rs | 28 + .../run-pass/issues/auxiliary/issue-11225-2.rs | 38 + .../run-pass/issues/auxiliary/issue-11225-3.rs | 38 + src/test/run-pass/issues/auxiliary/issue-11508.rs | 20 + src/test/run-pass/issues/auxiliary/issue-11529.rs | 11 + .../run-pass/issues/auxiliary/issue-12133-dylib.rs | 11 + .../issues/auxiliary/issue-12133-dylib2.rs | 16 + .../run-pass/issues/auxiliary/issue-12133-rlib.rs | 13 + .../run-pass/issues/auxiliary/issue-12660-aux.rs | 21 + .../run-pass/issues/auxiliary/issue-13620-1.rs | 19 + .../run-pass/issues/auxiliary/issue-13620-2.rs | 13 + .../run-pass/issues/auxiliary/issue-13872-1.rs | 11 + .../run-pass/issues/auxiliary/issue-13872-2.rs | 13 + .../run-pass/issues/auxiliary/issue-13872-3.rs | 19 + .../run-pass/issues/auxiliary/issue-14344-1.rs | 15 + .../run-pass/issues/auxiliary/issue-14344-2.rs | 13 + src/test/run-pass/issues/auxiliary/issue-14421.rs | 35 + src/test/run-pass/issues/auxiliary/issue-14422.rs | 35 + src/test/run-pass/issues/auxiliary/issue-15562.rs | 15 + src/test/run-pass/issues/auxiliary/issue-16643.rs | 29 + src/test/run-pass/issues/auxiliary/issue-17662.rs | 22 + .../run-pass/issues/auxiliary/issue-17718-aux.rs | 21 + src/test/run-pass/issues/auxiliary/issue-18501.rs | 27 + src/test/run-pass/issues/auxiliary/issue-18514.rs | 27 + src/test/run-pass/issues/auxiliary/issue-18711.rs | 15 + .../run-pass/issues/auxiliary/issue-18913-1.rs | 16 + .../run-pass/issues/auxiliary/issue-18913-2.rs | 16 + .../run-pass/issues/auxiliary/issue-19340-1.rs | 13 + src/test/run-pass/issues/auxiliary/issue-2380.rs | 25 + src/test/run-pass/issues/auxiliary/issue-2414-a.rs | 22 + src/test/run-pass/issues/auxiliary/issue-2414-b.rs | 15 + .../run-pass/issues/auxiliary/issue-25185-1.rs | 18 + .../run-pass/issues/auxiliary/issue-25185-2.rs | 13 + src/test/run-pass/issues/auxiliary/issue-2526.rs | 54 + src/test/run-pass/issues/auxiliary/issue-25467.rs | 20 + src/test/run-pass/issues/auxiliary/issue-2631-a.rs | 24 + src/test/run-pass/issues/auxiliary/issue-29485.rs | 26 + src/test/run-pass/issues/auxiliary/issue-3012-1.rs | 30 + src/test/run-pass/issues/auxiliary/issue-36954.rs | 18 + src/test/run-pass/issues/auxiliary/issue-41394.rs | 26 + .../run-pass/issues/auxiliary/issue-4208-cc.rs | 20 + src/test/run-pass/issues/auxiliary/issue-4545.rs | 12 + .../run-pass/issues/auxiliary/issue-48984-aux.rs | 16 + src/test/run-pass/issues/auxiliary/issue-5518.rs | 14 + src/test/run-pass/issues/auxiliary/issue-5521.rs | 14 + src/test/run-pass/issues/auxiliary/issue-7178.rs | 17 + src/test/run-pass/issues/auxiliary/issue-7899.rs | 11 + src/test/run-pass/issues/auxiliary/issue-8044.rs | 25 + src/test/run-pass/issues/auxiliary/issue-8259.rs | 15 + src/test/run-pass/issues/auxiliary/issue-9906.rs | 25 + src/test/run-pass/issues/auxiliary/issue-9968.rs | 32 + src/test/run-pass/issues/auxiliary/issue13507.rs | 97 + src/test/run-pass/issues/auxiliary/issue2170lib.rs | 28 + .../run-pass/issues/auxiliary/issue34796aux.rs | 30 + .../run-pass/issues/auxiliary/issue_10031_aux.rs | 11 + .../run-pass/issues/auxiliary/issue_12612_1.rs | 13 + .../run-pass/issues/auxiliary/issue_12612_2.rs | 11 + src/test/run-pass/issues/auxiliary/issue_19293.rs | 14 + src/test/run-pass/issues/auxiliary/issue_20389.rs | 14 + src/test/run-pass/issues/auxiliary/issue_2316_a.rs | 13 + src/test/run-pass/issues/auxiliary/issue_2316_b.rs | 21 + src/test/run-pass/issues/auxiliary/issue_2472_b.rs | 24 + src/test/run-pass/issues/auxiliary/issue_2723_a.rs | 14 + src/test/run-pass/issues/auxiliary/issue_3136_a.rc | 13 + src/test/run-pass/issues/auxiliary/issue_3136_a.rs | 24 + src/test/run-pass/issues/auxiliary/issue_38190.rs | 12 + .../run-pass/issues/auxiliary/issue_38226_aux.rs | 33 + .../issues/auxiliary/issue_38715-modern.rs | 17 + src/test/run-pass/issues/auxiliary/issue_38715.rs | 17 + .../run-pass/issues/auxiliary/issue_3979_traits.rs | 25 + src/test/run-pass/issues/auxiliary/issue_39823.rs | 17 + src/test/run-pass/issues/auxiliary/issue_40469.rs | 11 + src/test/run-pass/issues/auxiliary/issue_41053.rs | 11 + .../run-pass/issues/auxiliary/issue_42007_s.rs | 14 + src/test/run-pass/issues/auxiliary/issue_8401.rs | 26 + src/test/run-pass/issues/auxiliary/issue_9123.rs | 19 + src/test/run-pass/issues/auxiliary/issue_9155.rs | 17 + src/test/run-pass/issues/auxiliary/issue_9188.rs | 23 + src/test/run-pass/issues/issue-10025.rs | 20 + src/test/run-pass/issues/issue-10028.rs | 30 + src/test/run-pass/issues/issue-10031.rs | 19 + src/test/run-pass/issues/issue-10228.rs | 28 + src/test/run-pass/issues/issue-10392.rs | 39 + src/test/run-pass/issues/issue-10396.rs | 23 + src/test/run-pass/issues/issue-10436.rs | 21 + src/test/run-pass/issues/issue-10456.rs | 35 + src/test/run-pass/issues/issue-10626.rs | 36 + src/test/run-pass/issues/issue-10638.rs | 21 + src/test/run-pass/issues/issue-10682.rs | 25 + src/test/run-pass/issues/issue-10683.rs | 21 + src/test/run-pass/issues/issue-10718.rs | 21 + src/test/run-pass/issues/issue-10734.rs | 46 + src/test/run-pass/issues/issue-10763.rs | 16 + src/test/run-pass/issues/issue-10764.rs | 14 + src/test/run-pass/issues/issue-10767.rs | 20 + src/test/run-pass/issues/issue-10802.rs | 55 + src/test/run-pass/issues/issue-10806.rs | 47 + src/test/run-pass/issues/issue-10853.rs | 25 + src/test/run-pass/issues/issue-10902.rs | 30 + src/test/run-pass/issues/issue-11047.rs | 36 + src/test/run-pass/issues/issue-11085.rs | 55 + src/test/run-pass/issues/issue-1112.rs | 46 + src/test/run-pass/issues/issue-11205.rs | 95 + src/test/run-pass/issues/issue-11224.rs | 18 + src/test/run-pass/issues/issue-11225-1.rs | 21 + src/test/run-pass/issues/issue-11225-2.rs | 21 + src/test/run-pass/issues/issue-11225-3.rs | 21 + src/test/run-pass/issues/issue-11267.rs | 29 + src/test/run-pass/issues/issue-11382.rs | 14 + src/test/run-pass/issues/issue-11384.rs | 20 + src/test/run-pass/issues/issue-11508.rs | 21 + src/test/run-pass/issues/issue-11529.rs | 21 + src/test/run-pass/issues/issue-11552.rs | 32 + src/test/run-pass/issues/issue-11577.rs | 28 + src/test/run-pass/issues/issue-11592.rs | 21 + src/test/run-pass/issues/issue-11612.rs | 33 + src/test/run-pass/issues/issue-11677.rs | 32 + src/test/run-pass/issues/issue-11709.rs | 47 + src/test/run-pass/issues/issue-11820.rs | 22 + src/test/run-pass/issues/issue-11869.rs | 26 + src/test/run-pass/issues/issue-11940.rs | 21 + src/test/run-pass/issues/issue-11958.rs | 20 + src/test/run-pass/issues/issue-12033.rs | 17 + src/test/run-pass/issues/issue-12133-1.rs | 20 + src/test/run-pass/issues/issue-12133-2.rs | 21 + src/test/run-pass/issues/issue-12133-3.rs | 23 + src/test/run-pass/issues/issue-12285.rs | 24 + src/test/run-pass/issues/issue-1251.rs | 27 + src/test/run-pass/issues/issue-1257.rs | 21 + src/test/run-pass/issues/issue-12582.rs | 31 + src/test/run-pass/issues/issue-12612.rs | 24 + src/test/run-pass/issues/issue-12660.rs | 24 + src/test/run-pass/issues/issue-12677.rs | 19 + src/test/run-pass/issues/issue-12699.rs | 19 + src/test/run-pass/issues/issue-12729.rs | 23 + src/test/run-pass/issues/issue-12744.rs | 15 + src/test/run-pass/issues/issue-12860.rs | 59 + src/test/run-pass/issues/issue-12909.rs | 29 + src/test/run-pass/issues/issue-13027.rs | 188 + src/test/run-pass/issues/issue-13105.rs | 19 + src/test/run-pass/issues/issue-13167.rs | 32 + src/test/run-pass/issues/issue-13204.rs | 34 + src/test/run-pass/issues/issue-13214.rs | 32 + .../issues/issue-13259-windows-tcb-trash.rs | 52 + src/test/run-pass/issues/issue-13264.rs | 84 + src/test/run-pass/issues/issue-13304.rs | 48 + src/test/run-pass/issues/issue-13323.rs | 69 + src/test/run-pass/issues/issue-13405.rs | 28 + src/test/run-pass/issues/issue-13434.rs | 31 + src/test/run-pass/issues/issue-13494.rs | 43 + src/test/run-pass/issues/issue-13507-2.rs | 45 + src/test/run-pass/issues/issue-13620.rs | 21 + src/test/run-pass/issues/issue-13655.rs | 42 + src/test/run-pass/issues/issue-13665.rs | 25 + src/test/run-pass/issues/issue-13703.rs | 16 + src/test/run-pass/issues/issue-13763.rs | 24 + src/test/run-pass/issues/issue-13775.rs | 19 + src/test/run-pass/issues/issue-13808.rs | 26 + src/test/run-pass/issues/issue-13837.rs | 22 + src/test/run-pass/issues/issue-13867.rs | 59 + src/test/run-pass/issues/issue-13872.rs | 22 + src/test/run-pass/issues/issue-13902.rs | 25 + src/test/run-pass/issues/issue-14082.rs | 30 + src/test/run-pass/issues/issue-14229.rs | 31 + src/test/run-pass/issues/issue-14254.rs | 103 + src/test/run-pass/issues/issue-14308.rs | 25 + src/test/run-pass/issues/issue-14330.rs | 16 + src/test/run-pass/issues/issue-14344.rs | 21 + src/test/run-pass/issues/issue-14382.rs | 25 + src/test/run-pass/issues/issue-14393.rs | 20 + src/test/run-pass/issues/issue-14399.rs | 30 + src/test/run-pass/issues/issue-14421.rs | 26 + src/test/run-pass/issues/issue-14422.rs | 26 + src/test/run-pass/issues/issue-14456.rs | 46 + src/test/run-pass/issues/issue-1451.rs | 36 + src/test/run-pass/issues/issue-14589.rs | 34 + src/test/run-pass/issues/issue-1460.rs | 17 + src/test/run-pass/issues/issue-14821.rs | 29 + src/test/run-pass/issues/issue-14837.rs | 21 + src/test/run-pass/issues/issue-14865.rs | 32 + src/test/run-pass/issues/issue-14875.rs | 45 + src/test/run-pass/issues/issue-14901.rs | 28 + src/test/run-pass/issues/issue-14919.rs | 63 + src/test/run-pass/issues/issue-14933.rs | 16 + src/test/run-pass/issues/issue-14936.rs | 57 + src/test/run-pass/issues/issue-14940.rs | 29 + src/test/run-pass/issues/issue-14958.rs | 41 + src/test/run-pass/issues/issue-14959.rs | 65 + src/test/run-pass/issues/issue-15043.rs | 24 + src/test/run-pass/issues/issue-15063.rs | 20 + src/test/run-pass/issues/issue-15080.rs | 33 + src/test/run-pass/issues/issue-15104.rs | 24 + src/test/run-pass/issues/issue-15108.rs | 14 + src/test/run-pass/issues/issue-15129.rs | 35 + src/test/run-pass/issues/issue-15155.rs | 31 + src/test/run-pass/issues/issue-15189.rs | 20 + src/test/run-pass/issues/issue-15221.rs | 25 + src/test/run-pass/issues/issue-15261.rs | 20 + src/test/run-pass/issues/issue-15444.rs | 33 + src/test/run-pass/issues/issue-15487.rs | 22 + src/test/run-pass/issues/issue-15523-big.rs | 49 + src/test/run-pass/issues/issue-15523.rs | 52 + src/test/run-pass/issues/issue-15562.rs | 29 + src/test/run-pass/issues/issue-15571.rs | 68 + src/test/run-pass/issues/issue-15673.rs | 19 + src/test/run-pass/issues/issue-15689-1.rs | 20 + src/test/run-pass/issues/issue-15689-2.rs | 19 + src/test/run-pass/issues/issue-15730.rs | 17 + src/test/run-pass/issues/issue-15734.rs | 68 + src/test/run-pass/issues/issue-15735.rs | 26 + src/test/run-pass/issues/issue-15763.rs | 98 + src/test/run-pass/issues/issue-15774.rs | 35 + src/test/run-pass/issues/issue-15793.rs | 36 + src/test/run-pass/issues/issue-15858.rs | 43 + .../issues/issue-15881-model-lexer-dotdotdot.rs | 47 + src/test/run-pass/issues/issue-16151.rs | 39 + src/test/run-pass/issues/issue-16256.rs | 17 + src/test/run-pass/issues/issue-16272.rs | 33 + src/test/run-pass/issues/issue-16278.rs | 21 + src/test/run-pass/issues/issue-16441.rs | 20 + src/test/run-pass/issues/issue-16452.rs | 19 + src/test/run-pass/issues/issue-16492.rs | 77 + src/test/run-pass/issues/issue-16530.rs | 25 + src/test/run-pass/issues/issue-16560.rs | 27 + src/test/run-pass/issues/issue-16596.rs | 31 + src/test/run-pass/issues/issue-16597-empty.rs | 15 + src/test/run-pass/issues/issue-16597.rs | 19 + src/test/run-pass/issues/issue-1660.rs | 18 + src/test/run-pass/issues/issue-16602-1.rs | 16 + src/test/run-pass/issues/issue-16602-2.rs | 22 + src/test/run-pass/issues/issue-16602-3.rs | 35 + src/test/run-pass/issues/issue-16643.rs | 20 + src/test/run-pass/issues/issue-16648.rs | 21 + src/test/run-pass/issues/issue-16668.rs | 29 + src/test/run-pass/issues/issue-16671.rs | 23 + src/test/run-pass/issues/issue-16739.rs | 60 + src/test/run-pass/issues/issue-16745.rs | 21 + src/test/run-pass/issues/issue-16774.rs | 56 + src/test/run-pass/issues/issue-16783.rs | 17 + src/test/run-pass/issues/issue-16819.rs | 21 + src/test/run-pass/issues/issue-16922.rs | 21 + src/test/run-pass/issues/issue-1696.rs | 18 + src/test/run-pass/issues/issue-1701.rs | 35 + src/test/run-pass/issues/issue-17068.rs | 22 + src/test/run-pass/issues/issue-17074.rs | 24 + src/test/run-pass/issues/issue-17121.rs | 41 + src/test/run-pass/issues/issue-17170.rs | 21 + src/test/run-pass/issues/issue-17216.rs | 30 + src/test/run-pass/issues/issue-17233.rs | 27 + src/test/run-pass/issues/issue-17302.rs | 36 + src/test/run-pass/issues/issue-17322.rs | 25 + src/test/run-pass/issues/issue-17336.rs | 18 + src/test/run-pass/issues/issue-17351.rs | 20 + src/test/run-pass/issues/issue-17361.rs | 19 + src/test/run-pass/issues/issue-17450.rs | 17 + src/test/run-pass/issues/issue-17503.rs | 20 + src/test/run-pass/issues/issue-17662.rs | 27 + .../run-pass/issues/issue-17718-borrow-interior.rs | 28 + .../issues/issue-17718-const-destructors.rs | 19 + .../run-pass/issues/issue-17718-parse-const.rs | 17 + .../issues/issue-17718-static-unsafe-interior.rs | 59 + src/test/run-pass/issues/issue-17718.rs | 84 + src/test/run-pass/issues/issue-17732.rs | 21 + src/test/run-pass/issues/issue-17734.rs | 25 + src/test/run-pass/issues/issue-17746.rs | 34 + src/test/run-pass/issues/issue-17756.rs | 17 + src/test/run-pass/issues/issue-17771.rs | 30 + src/test/run-pass/issues/issue-17816.rs | 19 + src/test/run-pass/issues/issue-17877.rs | 24 + src/test/run-pass/issues/issue-17897.rs | 18 + src/test/run-pass/issues/issue-17904.rs | 23 + src/test/run-pass/issues/issue-18060.rs | 18 + src/test/run-pass/issues/issue-18075.rs | 17 + src/test/run-pass/issues/issue-18083.rs | 33 + src/test/run-pass/issues/issue-18088.rs | 18 + src/test/run-pass/issues/issue-18110.rs | 16 + src/test/run-pass/issues/issue-18173.rs | 22 + src/test/run-pass/issues/issue-18188.rs | 32 + src/test/run-pass/issues/issue-1821.rs | 22 + src/test/run-pass/issues/issue-18232.rs | 32 + src/test/run-pass/issues/issue-18352.rs | 24 + src/test/run-pass/issues/issue-18353.rs | 24 + src/test/run-pass/issues/issue-18412.rs | 36 + src/test/run-pass/issues/issue-18425.rs | 19 + src/test/run-pass/issues/issue-18446.rs | 22 + src/test/run-pass/issues/issue-18464.rs | 22 + src/test/run-pass/issues/issue-18501.rs | 23 + src/test/run-pass/issues/issue-18514.rs | 26 + src/test/run-pass/issues/issue-18539.rs | 26 + src/test/run-pass/issues/issue-18652.rs | 20 + src/test/run-pass/issues/issue-18655.rs | 32 + src/test/run-pass/issues/issue-1866.rs | 36 + src/test/run-pass/issues/issue-18661.rs | 29 + src/test/run-pass/issues/issue-18685.rs | 31 + src/test/run-pass/issues/issue-18711.rs | 22 + src/test/run-pass/issues/issue-18738.rs | 26 + src/test/run-pass/issues/issue-18767.rs | 20 + .../run-pass/issues/issue-18804/auxiliary/lib.rs | 20 + src/test/run-pass/issues/issue-18804/main.rs | 24 + src/test/run-pass/issues/issue-18809.rs | 22 + src/test/run-pass/issues/issue-18845.rs | 26 + src/test/run-pass/issues/issue-18859.rs | 26 + src/test/run-pass/issues/issue-18906.rs | 39 + src/test/run-pass/issues/issue-18913.rs | 19 + src/test/run-pass/issues/issue-18937-1.rs | 31 + src/test/run-pass/issues/issue-18988.rs | 20 + src/test/run-pass/issues/issue-19001.rs | 20 + src/test/run-pass/issues/issue-19037.rs | 29 + src/test/run-pass/issues/issue-19081.rs | 24 + src/test/run-pass/issues/issue-19097.rs | 23 + src/test/run-pass/issues/issue-19098.rs | 22 + src/test/run-pass/issues/issue-19102.rs | 21 + src/test/run-pass/issues/issue-19127.rs | 19 + src/test/run-pass/issues/issue-19129-1.rs | 26 + src/test/run-pass/issues/issue-19129-2.rs | 20 + src/test/run-pass/issues/issue-19135.rs | 23 + src/test/run-pass/issues/issue-19244.rs | 44 + src/test/run-pass/issues/issue-19293.rs | 20 + src/test/run-pass/issues/issue-19340-1.rs | 26 + src/test/run-pass/issues/issue-19340-2.rs | 33 + src/test/run-pass/issues/issue-19358.rs | 30 + src/test/run-pass/issues/issue-19367.rs | 42 + src/test/run-pass/issues/issue-19398.rs | 22 + src/test/run-pass/issues/issue-19404.rs | 45 + src/test/run-pass/issues/issue-19479.rs | 29 + src/test/run-pass/issues/issue-19499.rs | 23 + src/test/run-pass/issues/issue-19631.rs | 25 + src/test/run-pass/issues/issue-19632.rs | 23 + src/test/run-pass/issues/issue-1974.rs | 21 + .../run-pass/issues/issue-19811-escape-unicode.rs | 19 + src/test/run-pass/issues/issue-19850.rs | 31 + src/test/run-pass/issues/issue-19982.rs | 33 + src/test/run-pass/issues/issue-20009.rs | 23 + src/test/run-pass/issues/issue-20055-box-trait.rs | 51 + .../issues/issue-20055-box-unsized-array.rs | 39 + src/test/run-pass/issues/issue-20091.rs | 34 + src/test/run-pass/issues/issue-20174.rs | 17 + src/test/run-pass/issues/issue-20186.rs | 24 + src/test/run-pass/issues/issue-20313.rs | 22 + src/test/run-pass/issues/issue-20343.rs | 41 + src/test/run-pass/issues/issue-20389.rs | 24 + src/test/run-pass/issues/issue-20396.rs | 26 + src/test/run-pass/issues/issue-20414.rs | 30 + src/test/run-pass/issues/issue-20427.rs | 95 + src/test/run-pass/issues/issue-20454.rs | 22 + src/test/run-pass/issues/issue-20544.rs | 28 + src/test/run-pass/issues/issue-20575.rs | 20 + src/test/run-pass/issues/issue-20616.rs | 53 + src/test/run-pass/issues/issue-2063-resource.rs | 23 + src/test/run-pass/issues/issue-2063.rs | 32 + src/test/run-pass/issues/issue-20644.rs | 43 + src/test/run-pass/issues/issue-20676.rs | 22 + src/test/run-pass/issues/issue-2074.rs | 26 + src/test/run-pass/issues/issue-20763-1.rs | 38 + src/test/run-pass/issues/issue-20763-2.rs | 33 + src/test/run-pass/issues/issue-20797.rs | 104 + src/test/run-pass/issues/issue-20803.rs | 20 + src/test/run-pass/issues/issue-20823.rs | 15 + src/test/run-pass/issues/issue-20825.rs | 20 + src/test/run-pass/issues/issue-20847.rs | 22 + src/test/run-pass/issues/issue-20953.rs | 20 + src/test/run-pass/issues/issue-21033.rs | 57 + src/test/run-pass/issues/issue-21058.rs | 31 + src/test/run-pass/issues/issue-21140.rs | 16 + src/test/run-pass/issues/issue-21174.rs | 21 + src/test/run-pass/issues/issue-21245.rs | 65 + src/test/run-pass/issues/issue-21291.rs | 20 + src/test/run-pass/issues/issue-21306.rs | 19 + src/test/run-pass/issues/issue-21361.rs | 21 + src/test/run-pass/issues/issue-21363.rs | 25 + src/test/run-pass/issues/issue-21384.rs | 31 + src/test/run-pass/issues/issue-21400.rs | 67 + src/test/run-pass/issues/issue-21402.rs | 21 + src/test/run-pass/issues/issue-21475.rs | 28 + src/test/run-pass/issues/issue-21486.rs | 86 + src/test/run-pass/issues/issue-21520.rs | 31 + src/test/run-pass/issues/issue-21562.rs | 28 + src/test/run-pass/issues/issue-21622.rs | 29 + src/test/run-pass/issues/issue-21634.rs | 30 + src/test/run-pass/issues/issue-21655.rs | 22 + src/test/run-pass/issues/issue-21721.rs | 19 + src/test/run-pass/issues/issue-21726.rs | 47 + src/test/run-pass/issues/issue-21891.rs | 21 + src/test/run-pass/issues/issue-2190-1.rs | 35 + src/test/run-pass/issues/issue-21909.rs | 25 + src/test/run-pass/issues/issue-21922.rs | 27 + src/test/run-pass/issues/issue-22008.rs | 19 + src/test/run-pass/issues/issue-22036.rs | 35 + src/test/run-pass/issues/issue-22066.rs | 22 + src/test/run-pass/issues/issue-2214.rs | 51 + src/test/run-pass/issues/issue-2216.rs | 33 + src/test/run-pass/issues/issue-22258.rs | 20 + src/test/run-pass/issues/issue-22346.rs | 20 + src/test/run-pass/issues/issue-22356.rs | 44 + src/test/run-pass/issues/issue-22375.rs | 14 + src/test/run-pass/issues/issue-22403.rs | 16 + src/test/run-pass/issues/issue-22426.rs | 19 + src/test/run-pass/issues/issue-22463.rs | 30 + src/test/run-pass/issues/issue-22471.rs | 16 + .../issues/issue-22536-copy-mustnt-zero.rs | 38 + src/test/run-pass/issues/issue-22546.rs | 61 + src/test/run-pass/issues/issue-22577.rs | 36 + src/test/run-pass/issues/issue-22629.rs | 23 + src/test/run-pass/issues/issue-22777.rs | 58 + src/test/run-pass/issues/issue-22781.rs | 24 + src/test/run-pass/issues/issue-22814.rs | 23 + src/test/run-pass/issues/issue-22828.rs | 32 + src/test/run-pass/issues/issue-2284.rs | 23 + src/test/run-pass/issues/issue-22864-1.rs | 17 + src/test/run-pass/issues/issue-22864-2.rs | 17 + src/test/run-pass/issues/issue-2288.rs | 45 + src/test/run-pass/issues/issue-22894.rs | 14 + src/test/run-pass/issues/issue-22992-2.rs | 28 + src/test/run-pass/issues/issue-22992.rs | 86 + src/test/run-pass/issues/issue-23036.rs | 21 + src/test/run-pass/issues/issue-2311-2.rs | 35 + src/test/run-pass/issues/issue-2311.rs | 21 + src/test/run-pass/issues/issue-2312.rs | 25 + src/test/run-pass/issues/issue-2316-c.rs | 22 + src/test/run-pass/issues/issue-23208.rs | 36 + src/test/run-pass/issues/issue-23261.rs | 71 + src/test/run-pass/issues/issue-23304-1.rs | 35 + src/test/run-pass/issues/issue-23304-2.rs | 23 + src/test/run-pass/issues/issue-23311.rs | 22 + src/test/run-pass/issues/issue-23336.rs | 21 + .../issues/issue-23338-ensure-param-drop-order.rs | 174 + .../issue-23338-params-outlive-temps-of-body.rs | 40 + src/test/run-pass/issues/issue-23406.rs | 24 + src/test/run-pass/issues/issue-23433.rs | 23 + src/test/run-pass/issues/issue-23442.rs | 32 + src/test/run-pass/issues/issue-23477.rs | 25 + src/test/run-pass/issues/issue-23485.rs | 59 + src/test/run-pass/issues/issue-23491.rs | 18 + src/test/run-pass/issues/issue-23550.rs | 32 + .../issues/issue-23611-enum-swap-in-drop.rs | 268 ++ src/test/run-pass/issues/issue-23649-1.rs | 22 + src/test/run-pass/issues/issue-23649-2.rs | 21 + src/test/run-pass/issues/issue-23649-3.rs | 15 + src/test/run-pass/issues/issue-23699.rs | 24 + src/test/run-pass/issues/issue-23781.rs | 39 + src/test/run-pass/issues/issue-2380-b.rs | 20 + src/test/run-pass/issues/issue-23808.rs | 68 + src/test/run-pass/issues/issue-23825.rs | 31 + src/test/run-pass/issues/issue-2383.rs | 19 + src/test/run-pass/issues/issue-23833.rs | 26 + src/test/run-pass/issues/issue-23891.rs | 21 + src/test/run-pass/issues/issue-23898.rs | 20 + src/test/run-pass/issues/issue-23958.rs | 23 + .../issues/issue-23968-const-not-overflow.rs | 22 + src/test/run-pass/issues/issue-23992.rs | 29 + src/test/run-pass/issues/issue-24085.rs | 28 + src/test/run-pass/issues/issue-24086.rs | 30 + src/test/run-pass/issues/issue-2414-c.rs | 19 + src/test/run-pass/issues/issue-24161.rs | 20 + src/test/run-pass/issues/issue-24227.rs | 28 + src/test/run-pass/issues/issue-2428.rs | 24 + src/test/run-pass/issues/issue-24308.rs | 27 + src/test/run-pass/issues/issue-24313.rs | 43 + src/test/run-pass/issues/issue-24353.rs | 17 + src/test/run-pass/issues/issue-24389.rs | 21 + src/test/run-pass/issues/issue-24434.rs | 17 + src/test/run-pass/issues/issue-2445-b.rs | 40 + src/test/run-pass/issues/issue-2445.rs | 38 + src/test/run-pass/issues/issue-24533.rs | 33 + ...ue-24535-allow-mutable-borrow-in-match-guard.rs | 69 + src/test/run-pass/issues/issue-24589.rs | 27 + src/test/run-pass/issues/issue-2463.rs | 34 + src/test/run-pass/issues/issue-2472.rs | 24 + src/test/run-pass/issues/issue-24779.rs | 14 + .../run-pass/issues/issue-24805-dropck-itemless.rs | 89 + src/test/run-pass/issues/issue-2487-a.rs | 41 + .../issues/issue-24945-repeat-dash-opts.rs | 19 + src/test/run-pass/issues/issue-24947.rs | 35 + src/test/run-pass/issues/issue-24954.rs | 23 + src/test/run-pass/issues/issue-2502.rs | 33 + src/test/run-pass/issues/issue-25089.rs | 43 + src/test/run-pass/issues/issue-25145.rs | 23 + src/test/run-pass/issues/issue-25180.rs | 16 + src/test/run-pass/issues/issue-25185.rs | 23 + src/test/run-pass/issues/issue-2526-a.rs | 21 + src/test/run-pass/issues/issue-25279.rs | 26 + src/test/run-pass/issues/issue-25339.rs | 39 + src/test/run-pass/issues/issue-25343.rs | 32 + src/test/run-pass/issues/issue-25394.rs | 15 + src/test/run-pass/issues/issue-25467.rs | 21 + src/test/run-pass/issues/issue-25497.rs | 29 + src/test/run-pass/issues/issue-2550.rs | 31 + src/test/run-pass/issues/issue-25515.rs | 30 + .../run-pass/issues/issue-25549-multiple-drop.rs | 42 + src/test/run-pass/issues/issue-25679.rs | 29 + src/test/run-pass/issues/issue-25693.rs | 31 + src/test/run-pass/issues/issue-25700-1.rs | 23 + src/test/run-pass/issues/issue-25700-2.rs | 32 + .../run-pass/issues/issue-25746-bool-transmute.rs | 21 + src/test/run-pass/issues/issue-25757.rs | 28 + src/test/run-pass/issues/issue-25810.rs | 38 + src/test/run-pass/issues/issue-25916.rs | 36 + src/test/run-pass/issues/issue-26095.rs | 32 + src/test/run-pass/issues/issue-2611-3.rs | 28 + src/test/run-pass/issues/issue-26127.rs | 22 + src/test/run-pass/issues/issue-26205.rs | 40 + src/test/run-pass/issues/issue-26251.rs | 23 + src/test/run-pass/issues/issue-2631-b.rs | 27 + src/test/run-pass/issues/issue-26322.rs | 40 + src/test/run-pass/issues/issue-2633-2.rs | 24 + src/test/run-pass/issues/issue-2633.rs | 40 + src/test/run-pass/issues/issue-2642.rs | 19 + src/test/run-pass/issues/issue-26468.rs | 39 + src/test/run-pass/issues/issue-26484.rs | 21 + src/test/run-pass/issues/issue-26641.rs | 16 + src/test/run-pass/issues/issue-26646.rs | 22 + src/test/run-pass/issues/issue-26655.rs | 35 + src/test/run-pass/issues/issue-26709.rs | 27 + src/test/run-pass/issues/issue-26802.rs | 24 + src/test/run-pass/issues/issue-26805.rs | 16 + src/test/run-pass/issues/issue-26873-multifile.rs | 18 + src/test/run-pass/issues/issue-26873-onefile.rs | 34 + src/test/run-pass/issues/issue-26905.rs | 32 + src/test/run-pass/issues/issue-26996.rs | 20 + src/test/run-pass/issues/issue-26997.rs | 23 + src/test/run-pass/issues/issue-27021.rs | 22 + .../issues/issue-27054-primitive-binary-ops.rs | 15 + src/test/run-pass/issues/issue-27060.rs | 43 + src/test/run-pass/issues/issue-2708.rs | 39 + src/test/run-pass/issues/issue-27105.rs | 25 + src/test/run-pass/issues/issue-2718.rs | 334 ++ src/test/run-pass/issues/issue-2723-b.rs | 21 + src/test/run-pass/issues/issue-27240.rs | 34 + src/test/run-pass/issues/issue-27268.rs | 14 + src/test/run-pass/issues/issue-27281.rs | 27 + src/test/run-pass/issues/issue-27320.rs | 25 + src/test/run-pass/issues/issue-2734.rs | 33 + src/test/run-pass/issues/issue-2735-2.rs | 37 + src/test/run-pass/issues/issue-2735-3.rs | 37 + src/test/run-pass/issues/issue-2735.rs | 33 + .../run-pass/issues/issue-27401-dropflag-reinit.rs | 37 + src/test/run-pass/issues/issue-2748-a.rs | 26 + src/test/run-pass/issues/issue-2748-b.rs | 21 + src/test/run-pass/issues/issue-27583.rs | 57 + src/test/run-pass/issues/issue-27639.rs | 20 + src/test/run-pass/issues/issue-27859.rs | 31 + src/test/run-pass/issues/issue-27889.rs | 31 + src/test/run-pass/issues/issue-27890.rs | 17 + src/test/run-pass/issues/issue-27901.rs | 21 + src/test/run-pass/issues/issue-27997.rs | 47 + src/test/run-pass/issues/issue-2804-2.rs | 21 + src/test/run-pass/issues/issue-28181.rs | 16 + src/test/run-pass/issues/issue-28279.rs | 30 + src/test/run-pass/issues/issue-28550.rs | 26 + src/test/run-pass/issues/issue-28561.rs | 121 + src/test/run-pass/issues/issue-28600.rs | 24 + src/test/run-pass/issues/issue-28676.rs | 44 + src/test/run-pass/issues/issue-28777.rs | 31 + src/test/run-pass/issues/issue-28822.rs | 17 + src/test/run-pass/issues/issue-28828.rs | 28 + src/test/run-pass/issues/issue-28839.rs | 25 + src/test/run-pass/issues/issue-28871.rs | 34 + src/test/run-pass/issues/issue-28936.rs | 37 + src/test/run-pass/issues/issue-2895.rs | 37 + src/test/run-pass/issues/issue-28950.rs | 32 + src/test/run-pass/issues/issue-28983.rs | 32 + src/test/run-pass/issues/issue-28999.rs | 21 + src/test/run-pass/issues/issue-29030.rs | 18 + src/test/run-pass/issues/issue-29037.rs | 33 + src/test/run-pass/issues/issue-2904.rs | 86 + src/test/run-pass/issues/issue-29048.rs | 22 + src/test/run-pass/issues/issue-29053.rs | 22 + src/test/run-pass/issues/issue-29071-2.rs | 41 + src/test/run-pass/issues/issue-29071.rs | 25 + src/test/run-pass/issues/issue-29092.rs | 36 + src/test/run-pass/issues/issue-29147.rs | 37 + src/test/run-pass/issues/issue-29166.rs | 31 + src/test/run-pass/issues/issue-29227.rs | 152 + src/test/run-pass/issues/issue-29276.rs | 14 + src/test/run-pass/issues/issue-2935.rs | 38 + src/test/run-pass/issues/issue-2936.rs | 41 + src/test/run-pass/issues/issue-29466.rs | 3608 ++++++++++++++++++++ src/test/run-pass/issues/issue-29485.rs | 27 + src/test/run-pass/issues/issue-29488.rs | 33 + src/test/run-pass/issues/issue-29516.rs | 29 + src/test/run-pass/issues/issue-29522.rs | 26 + src/test/run-pass/issues/issue-29540.rs | 502 +++ src/test/run-pass/issues/issue-29663.rs | 66 + src/test/run-pass/issues/issue-29668.rs | 26 + src/test/run-pass/issues/issue-29710.rs | 21 + src/test/run-pass/issues/issue-29740.rs | 326 ++ src/test/run-pass/issues/issue-29746.rs | 46 + src/test/run-pass/issues/issue-29844.rs | 34 + src/test/run-pass/issues/issue-2989.rs | 46 + src/test/run-pass/issues/issue-29914-2.rs | 16 + src/test/run-pass/issues/issue-29914-3.rs | 17 + src/test/run-pass/issues/issue-29914.rs | 20 + src/test/run-pass/issues/issue-29927.rs | 21 + src/test/run-pass/issues/issue-29948.rs | 50 + src/test/run-pass/issues/issue-30018-nopanic.rs | 112 + src/test/run-pass/issues/issue-30018-panic.rs | 35 + src/test/run-pass/issues/issue-30081.rs | 25 + src/test/run-pass/issues/issue-3012-2.rs | 23 + src/test/run-pass/issues/issue-30240.rs | 24 + src/test/run-pass/issues/issue-3026.rs | 23 + src/test/run-pass/issues/issue-3037.rs | 25 + src/test/run-pass/issues/issue-30371.rs | 19 + src/test/run-pass/issues/issue-30490.rs | 111 + src/test/run-pass/issues/issue-3052.rs | 22 + src/test/run-pass/issues/issue-30530.rs | 36 + src/test/run-pass/issues/issue-30615.rs | 15 + src/test/run-pass/issues/issue-30756.rs | 17 + src/test/run-pass/issues/issue-30891.rs | 20 + src/test/run-pass/issues/issue-3091.rs | 17 + src/test/run-pass/issues/issue-3109.rs | 14 + src/test/run-pass/issues/issue-3121.rs | 34 + src/test/run-pass/issues/issue-31260.rs | 24 + src/test/run-pass/issues/issue-31267-additional.rs | 30 + src/test/run-pass/issues/issue-31267.rs | 24 + src/test/run-pass/issues/issue-31299.rs | 44 + src/test/run-pass/issues/issue-3149.rs | 35 + src/test/run-pass/issues/issue-31597.rs | 38 + src/test/run-pass/issues/issue-31702.rs | 25 + src/test/run-pass/issues/issue-31776.rs | 65 + src/test/run-pass/issues/issue-32008.rs | 36 + src/test/run-pass/issues/issue-3211.rs | 17 + src/test/run-pass/issues/issue-3220.rs | 34 + src/test/run-pass/issues/issue-32292.rs | 19 + src/test/run-pass/issues/issue-32324.rs | 34 + src/test/run-pass/issues/issue-32389.rs | 21 + src/test/run-pass/issues/issue-32518.rs | 23 + src/test/run-pass/issues/issue-32805.rs | 20 + src/test/run-pass/issues/issue-3290.rs | 18 + src/test/run-pass/issues/issue-32947.rs | 34 + src/test/run-pass/issues/issue-33096.rs | 28 + src/test/run-pass/issues/issue-33185.rs | 27 + src/test/run-pass/issues/issue-33187.rs | 28 + src/test/run-pass/issues/issue-33202.rs | 19 + src/test/run-pass/issues/issue-33264.rs | 40 + src/test/run-pass/issues/issue-33287.rs | 19 + src/test/run-pass/issues/issue-333.rs | 17 + src/test/run-pass/issues/issue-33387.rs | 42 + src/test/run-pass/issues/issue-33461.rs | 37 + src/test/run-pass/issues/issue-33498.rs | 20 + src/test/run-pass/issues/issue-33537.rs | 25 + src/test/run-pass/issues/issue-33687.rs | 27 + src/test/run-pass/issues/issue-33770.rs | 104 + src/test/run-pass/issues/issue-3389.rs | 35 + src/test/run-pass/issues/issue-33903.rs | 20 + src/test/run-pass/issues/issue-33992.rs | 41 + src/test/run-pass/issues/issue-34053.rs | 40 + src/test/run-pass/issues/issue-34074.rs | 20 + src/test/run-pass/issues/issue-34194.rs | 21 + src/test/run-pass/issues/issue-3424.rs | 29 + src/test/run-pass/issues/issue-3429.rs | 18 + src/test/run-pass/issues/issue-34427.rs | 27 + src/test/run-pass/issues/issue-3447.rs | 42 + src/test/run-pass/issues/issue-34503.rs | 21 + src/test/run-pass/issues/issue-34569.rs | 27 + src/test/run-pass/issues/issue-34571.rs | 21 + src/test/run-pass/issues/issue-34751.rs | 20 + src/test/run-pass/issues/issue-34780.rs | 21 + src/test/run-pass/issues/issue-34784.rs | 29 + src/test/run-pass/issues/issue-34796.rs | 37 + src/test/run-pass/issues/issue-34798.rs | 35 + src/test/run-pass/issues/issue-34932.rs | 22 + src/test/run-pass/issues/issue-3500.rs | 20 + src/test/run-pass/issues/issue-35376.rs | 52 + src/test/run-pass/issues/issue-35423.rs | 19 + src/test/run-pass/issues/issue-35546.rs | 29 + src/test/run-pass/issues/issue-3556.rs | 45 + src/test/run-pass/issues/issue-3559.rs | 28 + src/test/run-pass/issues/issue-35600.rs | 25 + src/test/run-pass/issues/issue-3563-2.rs | 24 + src/test/run-pass/issues/issue-3563-3.rs | 189 + src/test/run-pass/issues/issue-3574.rs | 24 + src/test/run-pass/issues/issue-35815.rs | 24 + src/test/run-pass/issues/issue-36023.rs | 33 + .../issues/issue-36036-associated-type-layout.rs | 37 + src/test/run-pass/issues/issue-36053.rs | 32 + src/test/run-pass/issues/issue-36075.rs | 23 + src/test/run-pass/issues/issue-3609.rs | 37 + .../issues/issue-36139-normalize-closure-sig.rs | 29 + src/test/run-pass/issues/issue-36260.rs | 23 + .../run-pass/issues/issue-36278-prefix-nesting.rs | 29 + src/test/run-pass/issues/issue-36381.rs | 35 + src/test/run-pass/issues/issue-36401.rs | 26 + src/test/run-pass/issues/issue-36474.rs | 41 + src/test/run-pass/issues/issue-3656.rs | 39 + .../issues/issue-36744-bitcast-args-if-needed.rs | 33 + .../run-pass/issues/issue-36744-without-calls.rs | 23 + src/test/run-pass/issues/issue-36768.rs | 19 + .../run-pass/issues/issue-36786-resolve-call.rs | 18 + src/test/run-pass/issues/issue-36792.rs | 17 + src/test/run-pass/issues/issue-36816.rs | 17 + src/test/run-pass/issues/issue-3683.rs | 28 + src/test/run-pass/issues/issue-36856.rs | 25 + src/test/run-pass/issues/issue-36936.rs | 36 + src/test/run-pass/issues/issue-36954.rs | 18 + src/test/run-pass/issues/issue-3702.rs | 22 + src/test/run-pass/issues/issue-37109.rs | 26 + src/test/run-pass/issues/issue-37175.rs | 15 + src/test/run-pass/issues/issue-37222.rs | 26 + .../run-pass/issues/issue-37291/auxiliary/lib.rs | 52 + src/test/run-pass/issues/issue-37291/main.rs | 30 + src/test/run-pass/issues/issue-3743.rs | 65 + src/test/run-pass/issues/issue-3753.rs | 42 + src/test/run-pass/issues/issue-37598.rs | 22 + src/test/run-pass/issues/issue-37655.rs | 47 + src/test/run-pass/issues/issue-37686.rs | 17 + src/test/run-pass/issues/issue-37725.rs | 19 + src/test/run-pass/issues/issue-37733.rs | 16 + src/test/run-pass/issues/issue-3794.rs | 42 + src/test/run-pass/issues/issue-37991.rs | 28 + src/test/run-pass/issues/issue-38002.rs | 44 + src/test/run-pass/issues/issue-38033.rs | 89 + src/test/run-pass/issues/issue-38074.rs | 30 + src/test/run-pass/issues/issue-38091.rs | 30 + src/test/run-pass/issues/issue-38190.rs | 22 + src/test/run-pass/issues/issue-38226.rs | 25 + src/test/run-pass/issues/issue-38437.rs | 55 + src/test/run-pass/issues/issue-3847.rs | 23 + src/test/run-pass/issues/issue-38556.rs | 23 + src/test/run-pass/issues/issue-38715.rs | 25 + src/test/run-pass/issues/issue-38727.rs | 22 + src/test/run-pass/issues/issue-3874.rs | 21 + src/test/run-pass/issues/issue-38763.rs | 22 + src/test/run-pass/issues/issue-3878.rs | 20 + src/test/run-pass/issues/issue-3888-2.rs | 18 + src/test/run-pass/issues/issue-38942.rs | 27 + src/test/run-pass/issues/issue-3895.rs | 20 + src/test/run-pass/issues/issue-38987.rs | 14 + src/test/run-pass/issues/issue-3904.rs | 35 + src/test/run-pass/issues/issue-39089.rs | 14 + src/test/run-pass/issues/issue-39292.rs | 27 + src/test/run-pass/issues/issue-3935.rs | 23 + src/test/run-pass/issues/issue-39367.rs | 50 + src/test/run-pass/issues/issue-39467.rs | 20 + src/test/run-pass/issues/issue-39548.rs | 16 + src/test/run-pass/issues/issue-39709.rs | 15 + src/test/run-pass/issues/issue-39720.rs | 36 + src/test/run-pass/issues/issue-39720.stderr | 16 + src/test/run-pass/issues/issue-3979-2.rs | 28 + src/test/run-pass/issues/issue-3979-generics.rs | 45 + src/test/run-pass/issues/issue-3979-xcrate.rs | 34 + src/test/run-pass/issues/issue-3979.rs | 43 + src/test/run-pass/issues/issue-39808.rs | 27 + src/test/run-pass/issues/issue-39823.rs | 35 + src/test/run-pass/issues/issue-39827.rs | 44 + src/test/run-pass/issues/issue-3991.rs | 25 + src/test/run-pass/issues/issue-39984.rs | 22 + src/test/run-pass/issues/issue-40003.rs | 187 + src/test/run-pass/issues/issue-40085.rs | 23 + src/test/run-pass/issues/issue-40136.rs | 24 + src/test/run-pass/issues/issue-40235.rs | 17 + src/test/run-pass/issues/issue-4025.rs | 33 + src/test/run-pass/issues/issue-40408.rs | 17 + src/test/run-pass/issues/issue-40469.rs | 19 + src/test/run-pass/issues/issue-40770.rs | 20 + src/test/run-pass/issues/issue-40847.rs | 27 + src/test/run-pass/issues/issue-40883.rs | 102 + src/test/run-pass/issues/issue-40951.rs | 21 + src/test/run-pass/issues/issue-40962.rs | 21 + src/test/run-pass/issues/issue-41053.rs | 31 + src/test/run-pass/issues/issue-4107.rs | 35 + src/test/run-pass/issues/issue-41213.rs | 33 + src/test/run-pass/issues/issue-41272.rs | 30 + src/test/run-pass/issues/issue-41298.rs | 17 + src/test/run-pass/issues/issue-41394.rs | 18 + src/test/run-pass/issues/issue-41479.rs | 19 + src/test/run-pass/issues/issue-41498.rs | 27 + src/test/run-pass/issues/issue-41604.rs | 21 + src/test/run-pass/issues/issue-41628.rs | 17 + src/test/run-pass/issues/issue-41677.rs | 38 + src/test/run-pass/issues/issue-41696.rs | 61 + src/test/run-pass/issues/issue-41744.rs | 17 + src/test/run-pass/issues/issue-41803.rs | 31 + .../run-pass/issues/issue-41849-variance-req.rs | 44 + src/test/run-pass/issues/issue-41888.rs | 44 + .../issue-41936-variance-coerce-unsized-cycle.rs | 39 + src/test/run-pass/issues/issue-42007.rs | 20 + src/test/run-pass/issues/issue-4208.rs | 21 + src/test/run-pass/issues/issue-42148.rs | 16 + src/test/run-pass/issues/issue-42210.rs | 30 + src/test/run-pass/issues/issue-4228.rs | 26 + src/test/run-pass/issues/issue-42453.rs | 20 + src/test/run-pass/issues/issue-42463.rs | 42 + src/test/run-pass/issues/issue-42467.rs | 33 + src/test/run-pass/issues/issue-4252.rs | 43 + src/test/run-pass/issues/issue-42552.rs | 41 + src/test/run-pass/issues/issue-42679.rs | 32 + src/test/run-pass/issues/issue-42747.rs | 56 + src/test/run-pass/issues/issue-42956.rs | 35 + src/test/run-pass/issues/issue-43057.rs | 24 + src/test/run-pass/issues/issue-43132.rs | 75 + src/test/run-pass/issues/issue-43205.rs | 15 + src/test/run-pass/issues/issue-43291.rs | 19 + src/test/run-pass/issues/issue-4333.rs | 19 + src/test/run-pass/issues/issue-43357.rs | 20 + src/test/run-pass/issues/issue-43483.rs | 24 + src/test/run-pass/issues/issue-43692.rs | 15 + src/test/run-pass/issues/issue-43853.rs | 27 + src/test/run-pass/issues/issue-4387.rs | 16 + src/test/run-pass/issues/issue-43910.rs | 17 + src/test/run-pass/issues/issue-43923.rs | 20 + src/test/run-pass/issues/issue-44005.rs | 40 + src/test/run-pass/issues/issue-4401.rs | 17 + src/test/run-pass/issues/issue-44056.rs | 16 + src/test/run-pass/issues/issue-44247.rs | 28 + src/test/run-pass/issues/issue-44333.rs | 30 + src/test/run-pass/issues/issue-44373.rs | 21 + src/test/run-pass/issues/issue-44402.rs | 38 + src/test/run-pass/issues/issue-4446.rs | 25 + src/test/run-pass/issues/issue-4448.rs | 26 + src/test/run-pass/issues/issue-4464.rs | 16 + src/test/run-pass/issues/issue-44730.rs | 25 + src/test/run-pass/issues/issue-44851.rs | 25 + src/test/run-pass/issues/issue-45124.rs | 27 + src/test/run-pass/issues/issue-45152.rs | 32 + src/test/run-pass/issues/issue-4541.rs | 33 + src/test/run-pass/issues/issue-4542.rs | 23 + src/test/run-pass/issues/issue-45425.rs | 21 + src/test/run-pass/issues/issue-4545.rs | 17 + src/test/run-pass/issues/issue-45731.rs | 35 + src/test/run-pass/issues/issue-46069.rs | 33 + src/test/run-pass/issues/issue-46095.rs | 40 + src/test/run-pass/issues/issue-46519.rs | 38 + src/test/run-pass/issues/issue-46553.rs | 33 + src/test/run-pass/issues/issue-46845.rs | 42 + src/test/run-pass/issues/issue-46855.rs | 33 + .../issues/issue-46920-byte-array-patterns.rs | 38 + src/test/run-pass/issues/issue-46959.rs | 19 + src/test/run-pass/issues/issue-46964.rs | 29 + src/test/run-pass/issues/issue-47139-1.rs | 88 + src/test/run-pass/issues/issue-47139-2.rs | 76 + src/test/run-pass/issues/issue-4734.rs | 46 + src/test/run-pass/issues/issue-4735.rs | 29 + src/test/run-pass/issues/issue-47364.rs | 68 + src/test/run-pass/issues/issue-4759-1.rs | 14 + src/test/run-pass/issues/issue-4759.rs | 30 + src/test/run-pass/issues/issue-47638.rs | 19 + src/test/run-pass/issues/issue-47673.rs | 15 + src/test/run-pass/issues/issue-47703-1.rs | 34 + src/test/run-pass/issues/issue-47703-tuple.rs | 22 + src/test/run-pass/issues/issue-47703.rs | 29 + src/test/run-pass/issues/issue-47722.rs | 28 + src/test/run-pass/issues/issue-47789.rs | 22 + src/test/run-pass/issues/issue-48159.rs | 38 + src/test/run-pass/issues/issue-4830.rs | 20 + src/test/run-pass/issues/issue-48508-aux.rs | 17 + src/test/run-pass/issues/issue-48508.rs | 29 + src/test/run-pass/issues/issue-48551.rs | 44 + src/test/run-pass/issues/issue-4865-1.rs | 42 + src/test/run-pass/issues/issue-4865-2.rs | 34 + src/test/run-pass/issues/issue-4865-3.rs | 26 + src/test/run-pass/issues/issue-4875.rs | 24 + src/test/run-pass/issues/issue-48962.rs | 44 + src/test/run-pass/issues/issue-48984.rs | 18 + src/test/run-pass/issues/issue-49298.rs | 35 + src/test/run-pass/issues/issue-49556.rs | 23 + ...on-shorthand-field-patterns-in-pattern-macro.rs | 25 + src/test/run-pass/issues/issue-49632.rs | 18 + src/test/run-pass/issues/issue-49685.rs | 23 + src/test/run-pass/issues/issue-49854.rs | 19 + src/test/run-pass/issues/issue-49955-2.rs | 27 + src/test/run-pass/issues/issue-49955.rs | 31 + src/test/run-pass/issues/issue-49973.rs | 21 + .../issue-5008-borrowed-traitobject-method-call.rs | 44 + src/test/run-pass/issues/issue-50415.rs | 28 + src/test/run-pass/issues/issue-50442.rs | 22 + src/test/run-pass/issues/issue-5060.rs | 26 + src/test/run-pass/issues/issue-50689.rs | 18 + src/test/run-pass/issues/issue-50731.rs | 16 + src/test/run-pass/issues/issue-50811.rs | 66 + .../auxiliary/lib.rs | 24 + .../issues/issue-50865-private-impl-trait/main.rs | 26 + src/test/run-pass/issues/issue-51185.rs | 18 + src/test/run-pass/issues/issue-51345.rs | 18 + src/test/run-pass/issues/issue-51582.rs | 28 + src/test/run-pass/issues/issue-51655.rs | 24 + src/test/run-pass/issues/issue-51907.rs | 27 + src/test/run-pass/issues/issue-5192.rs | 50 + .../issues/issue-52140/auxiliary/some_crate.rs | 15 + src/test/run-pass/issues/issue-52140/main.rs | 23 + .../issues/issue-52141/auxiliary/some_crate.rs | 15 + src/test/run-pass/issues/issue-52141/main.rs | 26 + src/test/run-pass/issues/issue-52169.rs | 25 + src/test/run-pass/issues/issue-5239-2.rs | 19 + src/test/run-pass/issues/issue-5243.rs | 26 + src/test/run-pass/issues/issue-52557.rs | 39 + .../run-pass/issues/issue-52705/auxiliary/png2.rs | 13 + src/test/run-pass/issues/issue-52705/main.rs | 24 + src/test/run-pass/issues/issue-5280.rs | 27 + src/test/run-pass/issues/issue-5315.rs | 19 + .../issues/issue-5321-immediates-with-bare-self.rs | 25 + src/test/run-pass/issues/issue-53333.rs | 18 + src/test/run-pass/issues/issue-5353.rs | 27 + src/test/run-pass/issues/issue-5518.rs | 18 + src/test/run-pass/issues/issue-5521.rs | 26 + src/test/run-pass/issues/issue-5530.rs | 49 + src/test/run-pass/issues/issue-5550.rs | 18 + src/test/run-pass/issues/issue-5554.rs | 38 + src/test/run-pass/issues/issue-5572.rs | 16 + src/test/run-pass/issues/issue-5666.rs | 37 + src/test/run-pass/issues/issue-5688.rs | 30 + src/test/run-pass/issues/issue-5708.rs | 64 + src/test/run-pass/issues/issue-5718.rs | 36 + src/test/run-pass/issues/issue-5741.rs | 19 + src/test/run-pass/issues/issue-5754.rs | 25 + src/test/run-pass/issues/issue-5791.rs | 21 + src/test/run-pass/issues/issue-5884.rs | 29 + src/test/run-pass/issues/issue-5900.rs | 24 + src/test/run-pass/issues/issue-5917.rs | 19 + src/test/run-pass/issues/issue-5950.rs | 19 + src/test/run-pass/issues/issue-5988.rs | 34 + src/test/run-pass/issues/issue-5997.rs | 24 + src/test/run-pass/issues/issue-6117.rs | 21 + src/test/run-pass/issues/issue-6128.rs | 34 + src/test/run-pass/issues/issue-6130.rs | 20 + src/test/run-pass/issues/issue-6153.rs | 23 + src/test/run-pass/issues/issue-6157.rs | 33 + src/test/run-pass/issues/issue-6318.rs | 32 + src/test/run-pass/issues/issue-6334.rs | 56 + src/test/run-pass/issues/issue-6341.rs | 21 + src/test/run-pass/issues/issue-6344-let.rs | 25 + src/test/run-pass/issues/issue-6344-match.rs | 28 + src/test/run-pass/issues/issue-6449.rs | 53 + src/test/run-pass/issues/issue-6470.rs | 27 + src/test/run-pass/issues/issue-6557.rs | 19 + src/test/run-pass/issues/issue-6892.rs | 67 + src/test/run-pass/issues/issue-6898.rs | 43 + src/test/run-pass/issues/issue-6919.rs | 21 + src/test/run-pass/issues/issue-6991.rs | 17 + src/test/run-pass/issues/issue-7012.rs | 32 + src/test/run-pass/issues/issue-7178.rs | 20 + src/test/run-pass/issues/issue-7222.rs | 22 + src/test/run-pass/issues/issue-7268.rs | 19 + src/test/run-pass/issues/issue-7344.rs | 31 + .../issues/issue-7519-match-unit-in-arg.rs | 22 + src/test/run-pass/issues/issue-7563.rs | 37 + src/test/run-pass/issues/issue-7575.rs | 27 + src/test/run-pass/issues/issue-7607-2.rs | 25 + src/test/run-pass/issues/issue-7660.rs | 27 + src/test/run-pass/issues/issue-7663.rs | 42 + ...ssue-7673-cast-generically-implemented-trait.rs | 31 + src/test/run-pass/issues/issue-7784.rs | 41 + src/test/run-pass/issues/issue-7899.rs | 20 + src/test/run-pass/issues/issue-7911.rs | 47 + src/test/run-pass/issues/issue-8044.rs | 21 + ...71-default-method-self-inherit-builtin-trait.rs | 28 + src/test/run-pass/issues/issue-8248.rs | 25 + src/test/run-pass/issues/issue-8249.rs | 29 + src/test/run-pass/issues/issue-8259.rs | 21 + src/test/run-pass/issues/issue-8351-1.rs | 25 + src/test/run-pass/issues/issue-8351-2.rs | 25 + src/test/run-pass/issues/issue-8391.rs | 19 + src/test/run-pass/issues/issue-8398.rs | 22 + src/test/run-pass/issues/issue-8401.rs | 18 + src/test/run-pass/issues/issue-8460.rs | 60 + src/test/run-pass/issues/issue-8498.rs | 37 + src/test/run-pass/issues/issue-8506.rs | 24 + src/test/run-pass/issues/issue-8521.rs | 35 + src/test/run-pass/issues/issue-8578.rs | 29 + src/test/run-pass/issues/issue-868.rs | 27 + src/test/run-pass/issues/issue-8709.rs | 24 + src/test/run-pass/issues/issue-8783.rs | 33 + src/test/run-pass/issues/issue-8827.rs | 63 + src/test/run-pass/issues/issue-8851.rs | 39 + src/test/run-pass/issues/issue-8860.rs | 59 + src/test/run-pass/issues/issue-8898.rs | 28 + src/test/run-pass/issues/issue-9047.rs | 22 + src/test/run-pass/issues/issue-9110.rs | 26 + src/test/run-pass/issues/issue-9123.rs | 18 + src/test/run-pass/issues/issue-9129.rs | 44 + src/test/run-pass/issues/issue-9188.rs | 21 + src/test/run-pass/issues/issue-9243.rs | 25 + src/test/run-pass/issues/issue-9249.rs | 15 + src/test/run-pass/issues/issue-9259.rs | 25 + src/test/run-pass/issues/issue-9382.rs | 49 + .../issues/issue-9394-inherited-trait-calls.rs | 72 + src/test/run-pass/issues/issue-9396.rs | 32 + src/test/run-pass/issues/issue-9446.rs | 40 + src/test/run-pass/issues/issue-9719.rs | 50 + src/test/run-pass/issues/issue-9737.rs | 19 + src/test/run-pass/issues/issue-979.rs | 39 + src/test/run-pass/issues/issue-9837.rs | 21 + src/test/run-pass/issues/issue-9906.rs | 21 + src/test/run-pass/issues/issue-9918.rs | 15 + src/test/run-pass/issues/issue-9942.rs | 16 + src/test/run-pass/issues/issue-9951.rs | 31 + src/test/run-pass/issues/issue-9968.rs | 23 + src/test/run-pass/issues/issue2170exe.rs | 19 + .../auxiliary/issue24687_lib.rs | 20 + .../auxiliary/issue24687_mbcs_in_comments.rs | 37 + .../issues/issue24687-embed-debuginfo/main.rs | 23 + .../run-pass/issues/issue28498-must-work-ex1.rs | 28 + .../run-pass/issues/issue28498-must-work-ex2.rs | 31 + src/test/run-pass/issues/issue28498-ugeh-ex1.rs | 40 + .../issues/issue28498-ugeh-with-lifetime-param.rs | 51 + .../issues/issue28498-ugeh-with-passed-to-fn.rs | 59 + .../issues/issue28498-ugeh-with-trait-bound.rs | 54 + src/test/run-pass/issues/issue29927-1.rs | 21 + .../run-pass/issues/issue_26873_multifile/A/B.rs | 15 + .../run-pass/issues/issue_26873_multifile/A/C.rs | 17 + .../run-pass/issues/issue_26873_multifile/A/mod.rs | 16 + .../issue_26873_multifile/compiletest-ignore-dir | 0 .../run-pass/issues/issue_26873_multifile/mod.rs | 15 + src/test/run-pass/issues/issue_3136_b.rs | 17 + src/test/run-pass/issues/issue_9155.rs | 22 + .../into-iterator-type-inference-shift.rs | 42 + .../iterators/iter-cloned-type-inference.rs | 26 + src/test/run-pass/iterators/iter-range.rs | 24 + .../run-pass/iterators/iter-step-overflow-debug.rs | 31 + .../iterators/iter-step-overflow-ndebug.rs | 22 + .../run-pass/iterators/iter-sum-overflow-debug.rs | 37 + .../run-pass/iterators/iter-sum-overflow-ndebug.rs | 24 + .../iterators/iter-sum-overflow-overflow-checks.rs | 37 + src/test/run-pass/iterators/iter-zip.rs | 113 + .../run-pass/macros/assert-eq-macro-success.rs | 23 + .../run-pass/macros/assert-eq-macro-unsized.rs | 14 + .../run-pass/macros/assert-ne-macro-success.rs | 23 + .../run-pass/macros/assert-ne-macro-unsized.rs | 14 + .../macros/auxiliary/macro-comma-support.rs | 11 + .../macros/auxiliary/macro-include-items-expr.rs | 13 + .../macros/auxiliary/macro-include-items-item.rs | 13 + .../macros/auxiliary/macro_crate_def_only.rs | 14 + .../macros/auxiliary/macro_crate_nonterminal.rs | 22 + .../macros/auxiliary/macro_export_inner_module.rs | 16 + .../macros/auxiliary/macro_with_super_1.rs | 26 + src/test/run-pass/macros/auxiliary/two_macros.rs | 15 + .../run-pass/macros/auxiliary/unstable-macros.rs | 16 + .../run-pass/macros/auxiliary/use-macro-self.rs | 16 + src/test/run-pass/macros/colorful-write-macros.rs | 43 + .../run-pass/macros/conditional-debug-macro-on.rs | 18 + src/test/run-pass/macros/die-macro.rs | 25 + .../log_syntax-trace_macros-macro-locations.rs | 32 + .../log_syntax-trace_macros-macro-locations.stdout | 3 + src/test/run-pass/macros/macro-2.rs | 22 + src/test/run-pass/macros/macro-at-most-once-rep.rs | 44 + .../run-pass/macros/macro-attribute-expansion.rs | 26 + src/test/run-pass/macros/macro-attributes.rs | 34 + .../run-pass/macros/macro-block-nonterminal.rs | 21 + src/test/run-pass/macros/macro-comma-behavior.rs | 99 + src/test/run-pass/macros/macro-comma-support.rs | 360 ++ src/test/run-pass/macros/macro-crate-def-only.rs | 20 + .../macros/macro-crate-nonterminal-renamed.rs | 20 + .../run-pass/macros/macro-crate-nonterminal.rs | 20 + src/test/run-pass/macros/macro-crate-use.rs | 27 + src/test/run-pass/macros/macro-deep_expansion.rs | 27 + .../macros/macro-delimiter-significance.rs | 14 + src/test/run-pass/macros/macro-doc-comments.rs | 36 + src/test/run-pass/macros/macro-doc-escapes.rs | 26 + .../run-pass/macros/macro-doc-raw-str-hashes.rs | 40 + .../run-pass/macros/macro-export-inner-module.rs | 19 + src/test/run-pass/macros/macro-first-set.rs | 289 ++ src/test/run-pass/macros/macro-follow.rs | 193 ++ src/test/run-pass/macros/macro-followed-by-seq.rs | 23 + src/test/run-pass/macros/macro-include-items.rs | 23 + src/test/run-pass/macros/macro-interpolation.rs | 31 + ...ro-invocation-in-count-expr-fixed-array-type.rs | 20 + .../macros/macro-lifetime-used-with-bound.rs | 24 + .../macros/macro-lifetime-used-with-labels.rs | 46 + .../macros/macro-lifetime-used-with-labels.stderr | 11 + .../macros/macro-lifetime-used-with-static.rs | 24 + src/test/run-pass/macros/macro-lifetime.rs | 24 + src/test/run-pass/macros/macro-literal.rs | 144 + src/test/run-pass/macros/macro-meta-items.rs | 40 + .../run-pass/macros/macro-method-issue-4621.rs | 20 + src/test/run-pass/macros/macro-multiple-items.rs | 26 + src/test/run-pass/macros/macro-named-default.rs | 28 + .../macros/macro-nested_definition_issue-31946.rs | 19 + src/test/run-pass/macros/macro-nested_expr.rs | 33 + .../run-pass/macros/macro-nested_stmt_macros.rs | 33 + src/test/run-pass/macros/macro-nt-list.rs | 31 + src/test/run-pass/macros/macro-of-higher-order.rs | 32 + src/test/run-pass/macros/macro-pat-follow.rs | 41 + src/test/run-pass/macros/macro-pat-neg-lit.rs | 36 + src/test/run-pass/macros/macro-pat.rs | 75 + src/test/run-pass/macros/macro-path.rs | 28 + src/test/run-pass/macros/macro-pub-matcher.rs | 129 + .../run-pass/macros/macro-seq-followed-by-seq.rs | 27 + src/test/run-pass/macros/macro-stability.rs | 24 + src/test/run-pass/macros/macro-stmt.rs | 41 + .../macros/macro-stmt_macro_in_expr_macro.rs | 30 + .../run-pass/macros/macro-tt-followed-by-seq.rs | 37 + src/test/run-pass/macros/macro-use-all-and-none.rs | 21 + src/test/run-pass/macros/macro-use-all.rs | 20 + src/test/run-pass/macros/macro-use-both.rs | 20 + src/test/run-pass/macros/macro-use-one.rs | 19 + src/test/run-pass/macros/macro-with-attrs1.rs | 23 + src/test/run-pass/macros/macro-with-attrs2.rs | 21 + .../macros/macro-with-braces-in-expr-position.rs | 31 + src/test/run-pass/macros/macro_with_super_2.rs | 23 + src/test/run-pass/macros/macros-in-extern.rs | 40 + .../macros/parse-complex-macro-invoc-op.rs | 48 + .../run-pass/macros/paths-in-macro-invocations.rs | 45 + src/test/run-pass/macros/pub-item-inside-macro.rs | 28 + .../run-pass/macros/pub-method-inside-macro.rs | 32 + src/test/run-pass/macros/semi-after-macro-ty.rs | 18 + .../run-pass/macros/stmt_expr_attr_macro_parse.rs | 33 + src/test/run-pass/macros/syntax-extension-cfg.rs | 34 + .../includeme.fragment | 7 + .../macros/syntax-extension-source-utils.rs | 47 + src/test/run-pass/macros/try-macro.rs | 58 + src/test/run-pass/macros/two-macro-use.rs | 21 + src/test/run-pass/macros/type-macros-hlist.rs | 88 + src/test/run-pass/macros/type-macros-simple.rs | 38 + .../macros/typeck-macro-interaction-issue-8852.rs | 39 + src/test/run-pass/macros/use-macro-self.rs | 21 + .../run-pass/methods/auxiliary/method_self_arg1.rs | 47 + .../run-pass/methods/auxiliary/method_self_arg2.rs | 64 + .../method-argument-inference-associated-type.rs | 38 + src/test/run-pass/methods/method-attributes.rs | 40 + .../method-early-bound-lifetimes-on-self.rs | 41 + .../method-mut-self-modifies-mut-slice-lvalue.rs | 54 + .../methods/method-normalize-bounds-issue-20604.rs | 69 + src/test/run-pass/methods/method-projection.rs | 80 + .../methods/method-recursive-blanket-impl.rs | 49 + src/test/run-pass/methods/method-self-arg-aux1.rs | 30 + src/test/run-pass/methods/method-self-arg-aux2.rs | 34 + src/test/run-pass/methods/method-self-arg-trait.rs | 79 + src/test/run-pass/methods/method-self-arg.rs | 58 + .../methods/method-two-trait-defer-resolution-1.rs | 47 + .../methods/method-two-trait-defer-resolution-2.rs | 58 + ...od-two-traits-distinguished-via-where-clause.rs | 37 + src/test/run-pass/methods/method-where-clause.rs | 44 + .../run-pass/mir/auxiliary/mir_external_refs.rs | 28 + .../run-pass/mir/mir-inlining/ice-issue-45493.rs | 27 + .../run-pass/mir/mir-inlining/ice-issue-45885.rs | 39 + .../mir-inlining/no-trait-method-issue-40473.rs | 26 + .../run-pass/mir/mir-typeck-normalize-fn-sig.rs | 39 + src/test/run-pass/mir/mir_adt_construction.rs | 102 + src/test/run-pass/mir/mir_ascription_coercion.rs | 20 + src/test/run-pass/mir/mir_augmented_assignments.rs | 170 + src/test/run-pass/mir/mir_autoderef.rs | 38 + src/test/run-pass/mir/mir_boxing.rs | 20 + .../run-pass/mir/mir_build_match_comparisons.rs | 68 + .../run-pass/mir/mir_call_with_associated_type.rs | 26 + src/test/run-pass/mir/mir_calls_to_shims.rs | 59 + src/test/run-pass/mir/mir_cast_fn_ret.rs | 31 + src/test/run-pass/mir/mir_codegen_array.rs | 20 + src/test/run-pass/mir/mir_codegen_array_2.rs | 19 + .../run-pass/mir/mir_codegen_call_converging.rs | 27 + src/test/run-pass/mir/mir_codegen_calls.rs | 201 ++ .../run-pass/mir/mir_codegen_calls_variadic.rs | 32 + src/test/run-pass/mir/mir_codegen_critical_edge.rs | 53 + src/test/run-pass/mir/mir_codegen_spike1.rs | 22 + src/test/run-pass/mir/mir_codegen_switch.rs | 45 + src/test/run-pass/mir/mir_codegen_switchint.rs | 22 + src/test/run-pass/mir/mir_coercion_casts.rs | 20 + src/test/run-pass/mir/mir_coercions.rs | 81 + src/test/run-pass/mir/mir_constval_adts.rs | 45 + src/test/run-pass/mir/mir_drop_order.rs | 58 + src/test/run-pass/mir/mir_early_return_scope.rs | 38 + src/test/run-pass/mir/mir_fat_ptr.rs | 62 + src/test/run-pass/mir/mir_fat_ptr_drop.rs | 41 + src/test/run-pass/mir/mir_heavy_promoted.rs | 21 + src/test/run-pass/mir/mir_match_arm_guard.rs | 26 + src/test/run-pass/mir/mir_misc_casts.rs | 330 ++ src/test/run-pass/mir/mir_overflow_off.rs | 27 + src/test/run-pass/mir/mir_raw_fat_ptr.rs | 168 + src/test/run-pass/mir/mir_refs_correct.rs | 219 ++ src/test/run-pass/mir/mir_small_agg_arg.rs | 17 + src/test/run-pass/mir/mir_struct_with_assoc_ty.rs | 39 + src/test/run-pass/mir/mir_temp_promotions.rs | 20 + src/test/run-pass/mir/mir_void_return.rs | 22 + src/test/run-pass/mir/mir_void_return_2.rs | 20 + .../run-pass/modules/auxiliary/two_macros_2.rs | 13 + src/test/run-pass/modules/mod-inside-fn.rs | 23 + src/test/run-pass/modules/mod-view-items.rs | 24 + src/test/run-pass/modules/mod_dir_implicit.rs | 18 + .../mod_dir_implicit_aux/compiletest-ignore-dir | 0 .../run-pass/modules/mod_dir_implicit_aux/mod.rs | 12 + src/test/run-pass/modules/mod_dir_path.rs | 32 + src/test/run-pass/modules/mod_dir_path2.rs | 22 + src/test/run-pass/modules/mod_dir_path3.rs | 21 + src/test/run-pass/modules/mod_dir_path_multi.rs | 27 + src/test/run-pass/modules/mod_dir_recursive.rs | 24 + src/test/run-pass/modules/mod_dir_simple.rs | 20 + .../modules/mod_dir_simple/compiletest-ignore-dir | 0 .../modules/mod_dir_simple/load_another_mod.rs | 13 + src/test/run-pass/modules/mod_dir_simple/test.rs | 12 + src/test/run-pass/modules/mod_file.rs | 20 + src/test/run-pass/modules/mod_file_aux.rs | 14 + .../run-pass/modules/mod_file_with_path_attr.rs | 21 + .../compiletest-ignore-dir | 0 .../float-template/inst_f32.rs | 11 + .../float-template/inst_f64.rs | 11 + .../float-template/inst_float.rs | 11 + src/test/run-pass/moves/move-1-unique.rs | 34 + src/test/run-pass/moves/move-2-unique.rs | 20 + src/test/run-pass/moves/move-2.rs | 16 + src/test/run-pass/moves/move-3-unique.rs | 34 + src/test/run-pass/moves/move-4-unique.rs | 28 + src/test/run-pass/moves/move-4.rs | 28 + src/test/run-pass/moves/move-arg-2-unique.rs | 23 + src/test/run-pass/moves/move-arg-2.rs | 23 + src/test/run-pass/moves/move-arg.rs | 15 + src/test/run-pass/moves/move-nullary-fn.rs | 23 + src/test/run-pass/moves/move-out-of-field.rs | 37 + src/test/run-pass/moves/move-scalar.rs | 19 + .../moves/moves-based-on-type-capture-clause.rs | 21 + src/test/run-pass/nll/issue-47153-generic-const.rs | 29 + src/test/run-pass/nll/issue-47589.rs | 35 + src/test/run-pass/nll/issue-48623-closure.rs | 26 + src/test/run-pass/nll/issue-48623-generator.rs | 27 + src/test/run-pass/nll/issue-50343.rs | 19 + .../nll/issue-50461-used-mut-from-moves.rs | 27 + .../run-pass/nll/issue-53123-raw-pointer-cast.rs | 37 + src/test/run-pass/nll/mutating_references.rs | 36 + src/test/run-pass/nll/process_or_insert_default.rs | 39 + src/test/run-pass/nll/rc-loop.rs | 41 + src/test/run-pass/non_modrs_mods/foors_mod.rs | 14 + .../foors_mod/compiletest-ignore-dir | 0 .../non_modrs_mods/foors_mod/inner_foors_mod.rs | 11 + .../foors_mod/inner_foors_mod/innest.rs | 11 + .../foors_mod/inner_modrs_mod/innest.rs | 11 + .../foors_mod/inner_modrs_mod/mod.rs | 11 + .../modrs_mod/compiletest-ignore-dir | 0 .../non_modrs_mods/modrs_mod/inner_foors_mod.rs | 11 + .../modrs_mod/inner_foors_mod/innest.rs | 11 + .../modrs_mod/inner_modrs_mod/innest.rs | 11 + .../modrs_mod/inner_modrs_mod/mod.rs | 11 + src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs | 12 + .../some_crazy_attr_mod_dir/arbitrary_name.rs | 11 + .../some_crazy_attr_mod_dir/compiletest-ignore-dir | 0 .../inner_modrs_mod/innest.rs | 11 + .../some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs | 11 + src/test/run-pass/numbers-arithmetic/arith-0.rs | 18 + src/test/run-pass/numbers-arithmetic/arith-1.rs | 34 + src/test/run-pass/numbers-arithmetic/arith-2.rs | 19 + .../run-pass/numbers-arithmetic/arith-unsigned.rs | 36 + src/test/run-pass/numbers-arithmetic/div-mod.rs | 29 + .../float-int-invalid-const-cast.rs | 63 + .../numbers-arithmetic/float-literal-inference.rs | 23 + src/test/run-pass/numbers-arithmetic/float-nan.rs | 93 + .../run-pass/numbers-arithmetic/float-signature.rs | 19 + src/test/run-pass/numbers-arithmetic/float.rs | 19 + src/test/run-pass/numbers-arithmetic/float2.rs | 36 + src/test/run-pass/numbers-arithmetic/float_math.rs | 31 + src/test/run-pass/numbers-arithmetic/floatlits.rs | 22 + src/test/run-pass/numbers-arithmetic/i128-ffi.rs | 41 + src/test/run-pass/numbers-arithmetic/i128.rs | 121 + src/test/run-pass/numbers-arithmetic/i32-sub.rs | 16 + src/test/run-pass/numbers-arithmetic/i8-incr.rs | 22 + .../numbers-arithmetic/int-abs-overflow.rs | 23 + src/test/run-pass/numbers-arithmetic/int.rs | 17 + .../numbers-arithmetic/integer-literal-radix.rs | 29 + .../integer-literal-suffix-inference-2.rs | 19 + .../integer-literal-suffix-inference-3.rs | 14 + .../integer-literal-suffix-inference.rs | 70 + .../next-power-of-two-overflow-debug.rs | 37 + .../next-power-of-two-overflow-ndebug.rs | 24 + .../run-pass/numbers-arithmetic/num-wrapping.rs | 456 +++ .../numeric-method-autoexport.rs | 35 + .../numbers-arithmetic/promoted_overflow_opt.rs | 19 + .../numbers-arithmetic/saturating-float-casts.rs | 145 + .../run-pass/numbers-arithmetic/shift-near-oflo.rs | 110 + .../numbers-arithmetic/shift-various-types.rs | 58 + src/test/run-pass/numbers-arithmetic/shift.rs | 86 + .../numbers-arithmetic/signed-shift-const-eval.rs | 18 + .../run-pass/numbers-arithmetic/u128-as-f32.rs | 59 + src/test/run-pass/numbers-arithmetic/u128.rs | 132 + src/test/run-pass/numbers-arithmetic/u32-decr.rs | 20 + .../run-pass/numbers-arithmetic/u8-incr-decr.rs | 29 + src/test/run-pass/numbers-arithmetic/u8-incr.rs | 25 + src/test/run-pass/numbers-arithmetic/uint.rs | 17 + .../auxiliary/overloaded_autoderef_xc.rs | 40 + .../overloaded/overloaded-autoderef-count.rs | 84 + .../overloaded/overloaded-autoderef-indexing.rs | 30 + .../overloaded/overloaded-autoderef-order.rs | 81 + .../overloaded/overloaded-autoderef-vtable.rs | 48 + .../overloaded/overloaded-autoderef-xcrate.rs | 19 + .../run-pass/overloaded/overloaded-autoderef.rs | 54 + .../overloaded/overloaded-calls-object-one-arg.rs | 23 + .../overloaded/overloaded-calls-object-two-args.rs | 23 + .../overloaded-calls-object-zero-args.rs | 23 + .../overloaded/overloaded-calls-param-vtables.rs | 42 + .../run-pass/overloaded/overloaded-calls-simple.rs | 88 + .../overloaded/overloaded-calls-zero-args.rs | 40 + .../run-pass/overloaded/overloaded-deref-count.rs | 88 + src/test/run-pass/overloaded/overloaded-deref.rs | 53 + .../overloaded/overloaded-index-assoc-list.rs | 58 + .../overloaded/overloaded-index-autoderef.rs | 87 + .../overloaded/overloaded-index-in-field.rs | 56 + src/test/run-pass/overloaded/overloaded-index.rs | 74 + .../overloaded_deref_with_ref_pattern.rs | 103 + ...overloaded_deref_with_ref_pattern_issue15609.rs | 45 + src/test/run-pass/packed/auxiliary/packed.rs | 31 + .../packed/packed-struct-borrow-element.rs | 46 + .../run-pass/packed/packed-struct-drop-aligned.rs | 43 + .../packed/packed-struct-generic-layout.rs | 41 + .../run-pass/packed/packed-struct-generic-size.rs | 56 + .../packed/packed-struct-generic-size.stderr | 36 + src/test/run-pass/packed/packed-struct-layout.rs | 37 + src/test/run-pass/packed/packed-struct-match.rs | 56 + .../packed/packed-struct-optimized-enum.rs | 46 + src/test/run-pass/packed/packed-struct-size-xc.rs | 30 + src/test/run-pass/packed/packed-struct-size.rs | 169 + src/test/run-pass/packed/packed-struct-vec.rs | 131 + .../run-pass/packed/packed-tuple-struct-layout.rs | 31 + .../run-pass/packed/packed-tuple-struct-size.rs | 90 + .../abort-link-to-unwinding-crates.rs | 50 + src/test/run-pass/panic-runtime/abort.rs | 53 + .../auxiliary/exit-success-if-unwind.rs | 26 + src/test/run-pass/panic-runtime/link-to-abort.rs | 21 + src/test/run-pass/panic-runtime/link-to-unwind.rs | 20 + src/test/run-pass/panic-runtime/lto-abort.rs | 43 + src/test/run-pass/panic-runtime/lto-unwind.rs | 45 + src/test/run-pass/panics/panic-handler-chain.rs | 39 + .../run-pass/panics/panic-handler-flail-wildly.rs | 63 + .../run-pass/panics/panic-handler-set-twice.rs | 33 + .../run-pass/panics/panic-in-dtor-drops-fields.rs | 46 + .../run-pass/panics/panic-recover-propagate.rs | 36 + src/test/run-pass/panics/panic-safe.rs | 61 + .../privacy/auxiliary/priv-impl-prim-ty.rs | 19 + .../run-pass/privacy/auxiliary/privacy_reexport.rs | 16 + .../privacy/auxiliary/pub_use_mods_xcrate.rs | 20 + .../run-pass/privacy/auxiliary/pub_use_xcrate1.rs | 13 + .../run-pass/privacy/auxiliary/pub_use_xcrate2.rs | 13 + src/test/run-pass/privacy/priv-impl-prim-ty.rs | 21 + src/test/run-pass/privacy/privacy-ns.rs | 124 + src/test/run-pass/privacy/privacy-reexport.rs | 23 + src/test/run-pass/privacy/privacy1.rs | 32 + src/test/run-pass/privacy/private-class-field.rs | 35 + src/test/run-pass/privacy/private-method.rs | 43 + src/test/run-pass/privacy/pub-extern-privacy.rs | 28 + src/test/run-pass/privacy/pub-use-xcrate.rs | 25 + .../run-pass/privacy/pub_use_mods_xcrate_exe.rs | 21 + src/test/run-pass/process/process-envs.rs | 62 + src/test/run-pass/process/process-exit.rs | 35 + .../run-pass/process/process-remove-from-env.rs | 56 + src/test/run-pass/process/process-sigpipe.rs | 45 + .../run-pass/process/process-spawn-nonexistent.rs | 24 + .../process/process-spawn-with-unicode-params.rs | 86 + .../process/process-status-inherits-stdin.rs | 45 + .../regions-addr-of-interior-of-unique-box.rs | 32 + src/test/run-pass/regions/regions-addr-of-ret.rs | 19 + .../regions/regions-assoc-type-region-bound.rs | 31 + .../regions/regions-assoc-type-static-bound.rs | 28 + src/test/run-pass/regions/regions-borrow-at.rs | 23 + .../run-pass/regions/regions-borrow-evec-fixed.rs | 20 + .../run-pass/regions/regions-borrow-evec-uniq.rs | 26 + src/test/run-pass/regions/regions-borrow-uniq.rs | 22 + src/test/run-pass/regions/regions-bot.rs | 20 + .../regions/regions-bound-lists-feature-gate-2.rs | 23 + .../regions/regions-bound-lists-feature-gate.rs | 26 + ...gions-close-over-type-parameter-successfully.rs | 33 + src/test/run-pass/regions/regions-copy-closure.rs | 31 + .../run-pass/regions/regions-creating-enums2.rs | 26 + .../run-pass/regions/regions-creating-enums5.rs | 26 + .../run-pass/regions/regions-debruijn-of-object.rs | 30 + .../run-pass/regions/regions-dependent-addr-of.rs | 123 + .../run-pass/regions/regions-dependent-autofn.rs | 25 + .../regions/regions-dependent-autoslice.rs | 24 + .../run-pass/regions/regions-dependent-let-ref.rs | 22 + .../regions-early-bound-lifetime-in-assoc-fn.rs | 44 + .../regions/regions-early-bound-trait-param.rs | 144 + .../regions-early-bound-used-in-bound-method.rs | 40 + .../regions/regions-early-bound-used-in-bound.rs | 38 + .../regions-early-bound-used-in-type-param.rs | 38 + .../regions/regions-escape-into-other-fn.rs | 20 + src/test/run-pass/regions/regions-expl-self.rs | 24 + .../run-pass/regions/regions-fn-subtyping-2.rs | 29 + src/test/run-pass/regions/regions-fn-subtyping.rs | 38 + ...-region-outlives-static-outlives-free-region.rs | 26 + .../regions/regions-infer-borrow-scope-addr-of.rs | 33 + .../regions/regions-infer-borrow-scope-view.rs | 21 + .../regions-infer-borrow-scope-within-loop-ok.rs | 23 + .../run-pass/regions/regions-infer-borrow-scope.rs | 24 + src/test/run-pass/regions/regions-infer-call-2.rs | 25 + src/test/run-pass/regions/regions-infer-call.rs | 21 + .../regions-infer-contravariance-due-to-ret.rs | 32 + .../regions-infer-reborrow-ref-mut-recurse.rs | 27 + .../regions-infer-region-in-fn-but-not-type.rs | 27 + .../regions/regions-infer-static-from-proc.rs | 28 + src/test/run-pass/regions/regions-issue-21422.rs | 28 + src/test/run-pass/regions/regions-issue-22246.rs | 38 + .../regions/regions-lifetime-nonfree-late-bound.rs | 45 + ...gions-lifetime-static-items-enclosing-scopes.rs | 29 + src/test/run-pass/regions/regions-link-fn-args.rs | 25 + .../run-pass/regions/regions-lub-ref-ref-rc.rs | 37 + src/test/run-pass/regions/regions-mock-codegen.rs | 65 + .../regions-no-bound-in-argument-cleanup.rs | 34 + .../regions-no-variance-from-fn-generics.rs | 53 + .../run-pass/regions/regions-nullary-variant.rs | 24 + src/test/run-pass/regions/regions-params.rs | 28 + .../regions/regions-reassign-let-bound-pointer.rs | 26 + .../regions-reassign-match-bound-pointer.rs | 29 + src/test/run-pass/regions/regions-refcell.rs | 55 + ...d-regions-on-closures-to-inference-variables.rs | 68 + .../regions/regions-return-interior-of-option.rs | 34 + .../regions/regions-scope-chain-example.rs | 51 + src/test/run-pass/regions/regions-self-impls.rs | 30 + src/test/run-pass/regions/regions-self-in-enums.rs | 26 + src/test/run-pass/regions/regions-simple.rs | 17 + src/test/run-pass/regions/regions-static-bound.rs | 29 + .../run-pass/regions/regions-static-closure.rs | 29 + .../run-pass/regions/regions-trait-object-1.rs | 45 + ...ons-variance-contravariant-use-contravariant.rs | 35 + .../regions-variance-covariant-use-covariant.rs | 32 + src/test/run-pass/rfcs/rfc-1014-2.rs | 39 + src/test/run-pass/rfcs/rfc-1014.rs | 42 + .../run-pass/rfcs/rfc-1789-as-cell/from-mut.rs | 22 + .../termination-trait-for-box-dyn-error.rs | 16 + .../termination-trait-for-empty.rs | 12 + .../termination-trait-for-exitcode.rs | 18 + .../termination-trait-for-impl-termination.rs | 14 + .../termination-trait-for-result-box-error_ok.rs | 16 + .../termination-trait-for-result.rs | 16 + .../termination-trait-for-str.rs | 14 + .../rfcs/rfc-2005-default-binding-mode/box.rs | 27 + .../rfcs/rfc-2005-default-binding-mode/constref.rs | 50 + .../rfcs/rfc-2005-default-binding-mode/enum.rs | 55 + .../rfcs/rfc-2005-default-binding-mode/for.rs | 30 + .../rfcs/rfc-2005-default-binding-mode/general.rs | 258 ++ .../rfcs/rfc-2005-default-binding-mode/lit.rs | 43 + .../rfcs/rfc-2005-default-binding-mode/range.rs | 19 + .../rfc-2005-default-binding-mode/ref-region.rs | 26 + .../rfc-2005-default-binding-mode/reset-mode.rs | 24 + .../rfcs/rfc-2005-default-binding-mode/slice.rs | 36 + .../rfcs/rfc-2005-default-binding-mode/struct.rs | 32 + .../rfc-2005-default-binding-mode/tuple-struct.rs | 28 + .../rfcs/rfc-2005-default-binding-mode/tuple.rs | 22 + .../rfc-2008-non-exhaustive/auxiliary/enums.rs | 20 + .../rfc-2008-non-exhaustive/auxiliary/structs.rs | 24 + .../rfc-2008-non-exhaustive/auxiliary/variants.rs | 19 + .../run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs | 63 + .../rfc-2008-non-exhaustive/enums_same_crate.rs | 29 + .../rfcs/rfc-2008-non-exhaustive/structs.rs | 28 + .../rfc-2008-non-exhaustive/structs_same_crate.rs | 41 + .../rfcs/rfc-2008-non-exhaustive/variants.rs | 32 + .../rfc-2008-non-exhaustive/variants_same_crate.rs | 35 + .../rfc-2126-crate-paths/crate-path-absolute.rs | 52 + .../crate-path-absolute.stderr | 8 + .../crate-path-visibility-ambiguity.rs | 25 + .../crate-path-visibility-ambiguity.stderr | 8 + .../auxiliary/xcrate.rs | 17 + .../rfcs/rfc-2126-extern-absolute-paths/basic.rs | 32 + .../rfcs/rfc-2126-extern-absolute-paths/extern.rs | 37 + .../rfcs/rfc-2126-extern-absolute-paths/test.rs | 20 + .../rfc-2126-extern-absolute-paths/whitelisted.rs | 24 + .../run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs | 25 + .../rfcs/rfc-2151-raw-identifiers/basic.rs | 30 + .../rfcs/rfc-2151-raw-identifiers/items.rs | 42 + .../rfcs/rfc-2151-raw-identifiers/macros.rs | 48 + .../rfcs/rfc-2175-or-if-while-let/basic.rs | 31 + .../run-pass/rfcs/rfc-2302-self-struct-ctor.rs | 129 + ...-2421-unreserve-pure-offsetof-sizeof-alignof.rs | 23 + .../rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs | 33 + src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs | 27 + src/test/run-pass/rfcs/rfc1623.rs | 84 + .../run-pass/rfcs/rfc1717/auxiliary/clibrary.rs | 15 + src/test/run-pass/rfcs/rfc1717/library-override.rs | 24 + src/test/run-pass/rfcs/rfc1857-drop-order.rs | 234 ++ .../arbitrary_self_types_raw_pointer_struct.rs | 38 + .../self/arbitrary_self_types_raw_pointer_trait.rs | 71 + .../run-pass/self/arbitrary_self_types_silly.rs | 31 + .../run-pass/self/arbitrary_self_types_struct.rs | 35 + .../run-pass/self/arbitrary_self_types_trait.rs | 30 + .../self/arbitrary_self_types_unsized_struct.rs | 27 + .../self/auxiliary/explicit_self_xcrate.rs | 25 + .../run-pass/self/builtin-superkinds-self-type.rs | 30 + .../run-pass/self/by-value-self-in-mut-slot.rs | 32 + src/test/run-pass/self/explicit-self-closures.rs | 26 + src/test/run-pass/self/explicit-self-generic.rs | 38 + .../run-pass/self/explicit-self-objects-uniq.rs | 32 + src/test/run-pass/self/explicit-self.rs | 82 + src/test/run-pass/self/explicit_self_xcrate_exe.rs | 22 + src/test/run-pass/self/move-self.rs | 29 + .../self/object-safety-sized-self-by-value-self.rs | 48 + .../object-safety-sized-self-generic-method.rs | 48 + .../self/object-safety-sized-self-return-Self.rs | 49 + src/test/run-pass/self/self-impl.rs | 78 + .../self/self-in-mut-slot-default-method.rs | 46 + .../self/self-in-mut-slot-immediate-value.rs | 33 + src/test/run-pass/self/self-in-typedefs.rs | 43 + src/test/run-pass/self/self-re-assign.rs | 27 + src/test/run-pass/self/self-shadowing-import.rs | 26 + src/test/run-pass/self/self-type-param.rs | 28 + src/test/run-pass/self/string-self-append.rs | 24 + src/test/run-pass/self/ufcs-explicit-self.rs | 59 + src/test/run-pass/self/uniq-self-in-mut-slot.rs | 33 + src/test/run-pass/self/where-for-self.rs | 61 + .../sepcomp/auxiliary/sepcomp-extern-lib.rs | 14 + .../run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs | 16 + src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs | 31 + src/test/run-pass/sepcomp/sepcomp-cci.rs | 44 + src/test/run-pass/sepcomp/sepcomp-extern.rs | 44 + src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs | 43 + src/test/run-pass/sepcomp/sepcomp-fns.rs | 41 + src/test/run-pass/sepcomp/sepcomp-lib-lto.rs | 28 + src/test/run-pass/sepcomp/sepcomp-lib.rs | 26 + src/test/run-pass/sepcomp/sepcomp-statics.rs | 41 + src/test/run-pass/sepcomp/sepcomp-unwind.rs | 44 + src/test/run-pass/simd/simd-generics.rs | 49 + .../run-pass/simd/simd-intrinsic-float-math.rs | 113 + .../run-pass/simd/simd-intrinsic-float-minmax.rs | 64 + .../simd/simd-intrinsic-generic-arithmetic.rs | 130 + .../run-pass/simd/simd-intrinsic-generic-cast.rs | 130 + .../simd/simd-intrinsic-generic-comparison.rs | 116 + .../simd/simd-intrinsic-generic-elements.rs | 135 + .../run-pass/simd/simd-intrinsic-generic-gather.rs | 152 + .../simd/simd-intrinsic-generic-reduction.rs | 174 + .../run-pass/simd/simd-intrinsic-generic-select.rs | 149 + src/test/run-pass/simd/simd-size-align.rs | 74 + .../run-pass/simd/simd-target-feature-mixup.rs | 193 ++ src/test/run-pass/simd/simd-type.rs | 25 + src/test/run-pass/simd/simd-upgraded.rs | 34 + src/test/run-pass/specialization/README.md | 37 + .../specialization/assoc-ty-graph-cycle.rs | 35 + .../auxiliary/cross_crates_defaults.rs | 49 + .../run-pass/specialization/auxiliary/go_trait.rs | 53 + .../auxiliary/specialization_cross_crate.rs | 82 + .../specialization/cross-crate-defaults.rs | 51 + .../defaultimpl/allowed-cross-crate.rs | 33 + .../defaultimpl/auxiliary/go_trait.rs | 53 + .../specialization/defaultimpl/out-of-order.rs | 29 + .../defaultimpl/overlap-projection.rs | 35 + .../specialization/defaultimpl/projection.rs | 51 + .../specialization-trait-item-not-implemented.rs | 44 + .../specialization-allowed-cross-crate.rs | 33 + .../specialization/specialization-assoc-fns.rs | 39 + .../specialization/specialization-basics.rs | 108 + .../specialization-cross-crate-no-gate.rs | 31 + .../specialization/specialization-cross-crate.rs | 60 + .../specialization-default-methods.rs | 96 + .../specialization/specialization-on-projection.rs | 33 + .../specialization/specialization-out-of-order.rs | 29 + .../specialization-overlap-projection.rs | 35 + .../specialization-projection-alias.rs | 34 + .../specialization/specialization-projection.rs | 51 + .../specialization/specialization-super-traits.rs | 27 + ...ization-translate-projections-with-lifetimes.rs | 43 + ...ialization-translate-projections-with-params.rs | 42 + .../specialization-translate-projections.rs | 43 + .../auxiliary/static-function-pointer-aux.rs | 15 + .../statics/auxiliary/static-methods-crate.rs | 39 + .../statics/auxiliary/static_fn_inline_xc_aux.rs | 23 + .../statics/auxiliary/static_fn_trait_xc_aux.rs | 21 + .../run-pass/statics/auxiliary/static_mut_xc.rs | 11 + src/test/run-pass/statics/static-fn-inline-xc.rs | 22 + src/test/run-pass/statics/static-fn-trait-xc.rs | 22 + .../run-pass/statics/static-function-pointer-xc.rs | 27 + .../run-pass/statics/static-function-pointer.rs | 26 + src/test/run-pass/statics/static-impl.rs | 76 + .../static-method-in-trait-with-tps-intracrate.rs | 37 + src/test/run-pass/statics/static-method-xcrate.rs | 23 + .../run-pass/statics/static-methods-in-traits.rs | 36 + .../run-pass/statics/static-methods-in-traits2.rs | 32 + src/test/run-pass/statics/static-mut-foreign.rs | 51 + src/test/run-pass/statics/static-mut-xc.rs | 49 + src/test/run-pass/statics/static-recursive.rs | 46 + src/test/run-pass/structs-enums/align-struct.rs | 255 ++ .../run-pass/structs-enums/auxiliary/cci_class.rs | 24 + .../structs-enums/auxiliary/cci_class_2.rs | 29 + .../structs-enums/auxiliary/cci_class_3.rs | 29 + .../structs-enums/auxiliary/cci_class_4.rs | 51 + .../structs-enums/auxiliary/cci_class_6.rs | 35 + .../structs-enums/auxiliary/cci_class_cast.rs | 60 + .../structs-enums/auxiliary/cci_class_trait.rs | 15 + .../structs-enums/auxiliary/empty-struct.rs | 19 + .../auxiliary/namespaced_enum_emulate_flat.rs | 35 + .../structs-enums/auxiliary/namespaced_enums.rs | 20 + .../structs-enums/auxiliary/newtype_struct_xc.rs | 13 + .../auxiliary/struct_destructuring_cross_crate.rs | 16 + .../auxiliary/struct_variant_xc_aux.rs | 18 + .../auxiliary/xcrate_struct_aliases.rs | 16 + .../run-pass/structs-enums/borrow-tuple-fields.rs | 48 + .../run-pass/structs-enums/class-attributes-1.rs | 30 + .../run-pass/structs-enums/class-attributes-2.rs | 42 + .../class-cast-to-trait-cross-crate-2.rs | 30 + .../class-cast-to-trait-multiple-types.rs | 103 + .../run-pass/structs-enums/class-cast-to-trait.rs | 68 + src/test/run-pass/structs-enums/class-dtor.rs | 34 + src/test/run-pass/structs-enums/class-exports.rs | 40 + .../class-impl-very-parameterized-trait.rs | 116 + .../class-implement-trait-cross-crate.rs | 68 + .../structs-enums/class-implement-traits.rs | 73 + .../structs-enums/class-method-cross-crate.rs | 23 + .../structs-enums/class-methods-cross-crate.rs | 24 + src/test/run-pass/structs-enums/class-methods.rs | 40 + .../class-poly-methods-cross-crate.rs | 26 + .../run-pass/structs-enums/class-poly-methods.rs | 46 + .../run-pass/structs-enums/class-separate-impl.rs | 74 + src/test/run-pass/structs-enums/class-str-field.rs | 30 + src/test/run-pass/structs-enums/class-typarams.rs | 41 + .../run-pass/structs-enums/classes-cross-crate.rs | 23 + .../structs-enums/classes-self-referential.rs | 29 + .../structs-enums/classes-simple-cross-crate.rs | 22 + .../structs-enums/classes-simple-method.rs | 37 + src/test/run-pass/structs-enums/classes-simple.rs | 32 + src/test/run-pass/structs-enums/classes.rs | 60 + .../structs-enums/codegen-tag-static-padding.rs | 69 + .../structs-enums/compare-generic-enums.rs | 26 + .../structs-enums/discrim-explicit-23030.rs | 157 + .../run-pass/structs-enums/empty-struct-braces.rs | 222 ++ src/test/run-pass/structs-enums/empty-tag.rs | 31 + src/test/run-pass/structs-enums/enum-alignment.rs | 33 + .../structs-enums/enum-clike-ffi-as-int.rs | 42 + src/test/run-pass/structs-enums/enum-discr.rs | 32 + .../structs-enums/enum-discrim-autosizing.rs | 62 + .../structs-enums/enum-discrim-manual-sizing.rs | 120 + .../structs-enums/enum-discrim-range-overflow.rs | 36 + .../structs-enums/enum-discrim-width-stuff.rs | 54 + .../run-pass/structs-enums/enum-disr-val-pretty.rs | 27 + .../structs-enums/enum-export-inheritance.rs | 24 + .../structs-enums/enum-layout-optimization.rs | 60 + .../enum-non-c-like-repr-c-and-int.rs | 178 + .../structs-enums/enum-non-c-like-repr-c.rs | 178 + .../structs-enums/enum-non-c-like-repr-int.rs | 174 + .../structs-enums/enum-null-pointer-opt.rs | 74 + .../enum-nullable-const-null-with-fields.rs | 23 + .../enum-nullable-simplifycfg-misopt.rs | 27 + .../run-pass/structs-enums/enum-univariant-repr.rs | 61 + src/test/run-pass/structs-enums/enum-variants.rs | 26 + .../run-pass/structs-enums/enum-vec-initializer.rs | 27 + .../run-pass/structs-enums/export-abstract-tag.rs | 25 + .../run-pass/structs-enums/export-tag-variant.rs | 19 + src/test/run-pass/structs-enums/expr-if-struct.rs | 42 + .../run-pass/structs-enums/expr-match-struct.rs | 41 + .../structs-enums/field-destruction-order.rs | 56 + src/test/run-pass/structs-enums/foreign-struct.rs | 28 + .../structs-enums/functional-struct-upd.rs | 22 + src/test/run-pass/structs-enums/ivec-tag.rs | 31 + .../module-qualified-struct-destructure.rs | 24 + .../namespaced-enum-emulate-flat-xc.rs | 35 + .../structs-enums/namespaced-enum-emulate-flat.rs | 53 + .../namespaced-enum-glob-import-xcrate.rs | 36 + .../structs-enums/namespaced-enum-glob-import.rs | 44 + .../structs-enums/namespaced-enums-xcrate.rs | 26 + .../run-pass/structs-enums/namespaced-enums.rs | 26 + .../structs-enums/nested-enum-same-names.rs | 36 + .../structs-enums/newtype-struct-drop-run.rs | 31 + .../structs-enums/newtype-struct-with-dtor.rs | 28 + .../run-pass/structs-enums/newtype-struct-xc-2.rs | 25 + .../run-pass/structs-enums/newtype-struct-xc.rs | 20 + src/test/run-pass/structs-enums/nonzero-enum.rs | 39 + src/test/run-pass/structs-enums/numeric-fields.rs | 22 + .../object-lifetime-default-from-ref-struct.rs | 68 + .../object-lifetime-default-from-rptr-struct.rs | 47 + src/test/run-pass/structs-enums/rec-align-u32.rs | 64 + src/test/run-pass/structs-enums/rec-align-u64.rs | 109 + src/test/run-pass/structs-enums/rec-auto.rs | 24 + src/test/run-pass/structs-enums/rec-extend.rs | 28 + src/test/run-pass/structs-enums/rec-tup.rs | 41 + src/test/run-pass/structs-enums/rec.rs | 34 + src/test/run-pass/structs-enums/record-pat.rs | 29 + .../run-pass/structs-enums/resource-in-struct.rs | 47 + .../run-pass/structs-enums/simple-generic-tag.rs | 20 + .../structs-enums/simple-match-generic-tag.rs | 22 + .../structs-enums/small-enum-range-edge.rs | 37 + .../structs-enums/small-enums-with-fields.rs | 43 + .../structs-enums/struct-aliases-xcrate.rs | 34 + src/test/run-pass/structs-enums/struct-aliases.rs | 74 + .../struct-destructuring-cross-crate.rs | 22 + .../structs-enums/struct-field-shorthand.rs | 36 + .../structs-enums/struct-like-variant-construct.rs | 27 + .../structs-enums/struct-like-variant-match.rs | 43 + .../struct-lit-functional-no-fields.rs | 36 + .../run-pass/structs-enums/struct-literal-dtor.rs | 28 + .../structs-enums/struct-new-as-field-name.rs | 20 + .../structs-enums/struct-order-of-eval-1.rs | 25 + .../structs-enums/struct-order-of-eval-2.rs | 25 + .../structs-enums/struct-order-of-eval-3.rs | 47 + .../structs-enums/struct-order-of-eval-4.rs | 44 + .../structs-enums/struct-partial-move-1.rs | 31 + .../structs-enums/struct-partial-move-2.rs | 38 + .../structs-enums/struct-path-associated-type.rs | 36 + .../run-pass/structs-enums/struct-path-self.rs | 55 + .../structs-enums/struct-pattern-matching.rs | 28 + src/test/run-pass/structs-enums/struct-return.rs | 73 + .../struct-variant-field-visibility.rs | 26 + .../run-pass/structs-enums/struct_variant_xc.rs | 21 + .../structs-enums/struct_variant_xc_match.rs | 24 + .../run-pass/structs-enums/tag-align-dyn-u64.rs | 38 + .../structs-enums/tag-align-dyn-variants.rs | 76 + src/test/run-pass/structs-enums/tag-align-shape.rs | 30 + src/test/run-pass/structs-enums/tag-align-u64.rs | 38 + .../run-pass/structs-enums/tag-disr-val-shape.rs | 29 + src/test/run-pass/structs-enums/tag-exports.rs | 30 + src/test/run-pass/structs-enums/tag-in-block.rs | 24 + .../tag-variant-disr-type-mismatch.rs | 21 + .../run-pass/structs-enums/tag-variant-disr-val.rs | 76 + src/test/run-pass/structs-enums/tag.rs | 39 + .../structs-enums/tuple-struct-construct.rs | 18 + .../tuple-struct-constructor-pointer.rs | 22 + .../structs-enums/tuple-struct-destructuring.rs | 20 + .../structs-enums/tuple-struct-matching.rs | 23 + .../run-pass/structs-enums/tuple-struct-trivial.rs | 17 + .../structs-enums/uninstantiable-struct.rs | 14 + .../structs-enums/unit-like-struct-drop-run.rs | 36 + .../run-pass/structs-enums/unit-like-struct.rs | 19 + .../structs-enums/variant-structs-trivial.rs | 19 + src/test/run-pass/thinlto/all-crates.rs | 18 + src/test/run-pass/thinlto/auxiliary/dylib.rs | 16 + .../run-pass/thinlto/auxiliary/msvc-imp-present.rs | 21 + .../thinlto/auxiliary/thin-lto-inlines-aux.rs | 17 + src/test/run-pass/thinlto/dylib-works.rs | 19 + src/test/run-pass/thinlto/msvc-imp-present.rs | 32 + src/test/run-pass/thinlto/thin-lto-inlines.rs | 40 + src/test/run-pass/thinlto/thin-lto-inlines2.rs | 39 + src/test/run-pass/thinlto/weak-works.rs | 38 + .../auxiliary/thread-local-extern-static.rs | 20 + src/test/run-pass/threads-sendsync/comm.rs | 31 + .../threads-sendsync/send-is-not-static-par-for.rs | 43 + .../run-pass/threads-sendsync/send-resource.rs | 47 + .../threads-sendsync/send-type-inference.rs | 26 + .../run-pass/threads-sendsync/send_str_hashmap.rs | 63 + .../run-pass/threads-sendsync/send_str_treemap.rs | 68 + .../run-pass/threads-sendsync/sendable-class.rs | 35 + .../run-pass/threads-sendsync/sendfn-is-a-block.rs | 21 + .../threads-sendsync/sendfn-spawn-with-fn-arg.rs | 33 + src/test/run-pass/threads-sendsync/spawn-fn.rs | 34 + src/test/run-pass/threads-sendsync/spawn-types.rs | 35 + src/test/run-pass/threads-sendsync/spawn.rs | 20 + src/test/run-pass/threads-sendsync/spawn2.rs | 41 + .../threads-sendsync/spawning-with-debug.rs | 23 + .../threads-sendsync/std-sync-right-kind-impls.rs | 26 + .../run-pass/threads-sendsync/sync-send-atomics.rs | 24 + .../run-pass/threads-sendsync/sync-send-in-std.rs | 34 + .../sync-send-iterators-in-libcollections.rs | 80 + .../sync-send-iterators-in-libcore.rs | 117 + src/test/run-pass/threads-sendsync/task-comm-0.rs | 39 + src/test/run-pass/threads-sendsync/task-comm-1.rs | 23 + src/test/run-pass/threads-sendsync/task-comm-10.rs | 41 + src/test/run-pass/threads-sendsync/task-comm-11.rs | 30 + src/test/run-pass/threads-sendsync/task-comm-12.rs | 37 + src/test/run-pass/threads-sendsync/task-comm-13.rs | 27 + src/test/run-pass/threads-sendsync/task-comm-14.rs | 45 + src/test/run-pass/threads-sendsync/task-comm-15.rs | 37 + src/test/run-pass/threads-sendsync/task-comm-16.rs | 119 + src/test/run-pass/threads-sendsync/task-comm-17.rs | 26 + src/test/run-pass/threads-sendsync/task-comm-3.rs | 72 + src/test/run-pass/threads-sendsync/task-comm-4.rs | 54 + src/test/run-pass/threads-sendsync/task-comm-5.rs | 27 + src/test/run-pass/threads-sendsync/task-comm-6.rs | 50 + src/test/run-pass/threads-sendsync/task-comm-7.rs | 67 + src/test/run-pass/threads-sendsync/task-comm-9.rs | 44 + .../threads-sendsync/task-comm-chan-nil.rs | 23 + src/test/run-pass/threads-sendsync/task-life-0.rs | 23 + .../threads-sendsync/task-spawn-move-and-copy.rs | 34 + src/test/run-pass/threads-sendsync/task-stderr.rs | 42 + .../threads-sendsync/thread-local-extern-static.rs | 37 + .../threads-sendsync/thread-local-syntax.rs | 32 + src/test/run-pass/threads-sendsync/threads.rs | 25 + .../tls-dtors-are-run-in-a-static-binary.rs | 32 + .../run-pass/threads-sendsync/tls-init-on-init.rs | 54 + src/test/run-pass/threads-sendsync/tls-try-with.rs | 40 + .../run-pass/traits/anon-trait-static-method.rs | 25 + .../traits/anon_trait_static_method_exe.rs | 22 + src/test/run-pass/traits/assignability-trait.rs | 57 + .../traits/astconv-cycle-between-trait-and-type.rs | 39 + .../run-pass/traits/augmented-assignments-trait.rs | 22 + src/test/run-pass/traits/auto-traits.rs | 40 + .../auxiliary/anon_trait_static_method_lib.rs | 19 + src/test/run-pass/traits/auxiliary/go_trait.rs | 53 + .../auxiliary/trait_default_method_xc_aux.rs | 50 + .../auxiliary/trait_default_method_xc_aux_2.rs | 27 + .../auxiliary/trait_inheritance_auto_xc_2_aux.rs | 19 + .../auxiliary/trait_inheritance_auto_xc_aux.rs | 17 + .../auxiliary/trait_inheritance_overloading_xc.rs | 48 + .../run-pass/traits/auxiliary/trait_safety_lib.rs | 19 + .../run-pass/traits/auxiliary/trait_xc_call_aux.rs | 22 + src/test/run-pass/traits/auxiliary/traitimpl.rs | 17 + .../run-pass/traits/conservative_impl_trait.rs | 18 + src/test/run-pass/traits/cycle-trait-type-trait.rs | 34 + .../traits/default-method-supertrait-vtable.rs | 38 + src/test/run-pass/traits/dyn-trait.rs | 27 + src/test/run-pass/traits/fmt-pointer-trait.rs | 34 + src/test/run-pass/traits/impl-implicit-trait.rs | 35 + .../traits/impl-inherent-prefer-over-trait.rs | 40 + .../traits/infer-from-object-trait-issue-26952.rs | 34 + .../run-pass/traits/inherent-trait-method-order.rs | 35 + .../traits/kindck-owned-trait-contains-1.rs | 33 + src/test/run-pass/traits/multiple-trait-bounds.rs | 19 + .../run-pass/traits/object-one-type-two-traits.rs | 41 + .../overlap-permitted-for-marker-traits-neg.rs | 21 + .../traits/overlap-permitted-for-marker-traits.rs | 37 + .../traits/parameterized-trait-with-bounds.rs | 31 + .../run-pass/traits/supertrait-default-generics.rs | 48 + src/test/run-pass/traits/syntax-trait-polarity.rs | 30 + src/test/run-pass/traits/trait-bounds-basic.rs | 34 + .../trait-bounds-impl-comparison-duplicates.rs | 26 + src/test/run-pass/traits/trait-bounds-in-arc.rs | 118 + .../traits/trait-bounds-on-structs-and-enums.rs | 29 + src/test/run-pass/traits/trait-bounds-recursion.rs | 30 + src/test/run-pass/traits/trait-bounds.rs | 39 + .../run-pass/traits/trait-cache-issue-18209.rs | 30 + src/test/run-pass/traits/trait-coercion-generic.rs | 34 + src/test/run-pass/traits/trait-coercion.rs | 43 + .../run-pass/traits/trait-composition-trivial.rs | 22 + src/test/run-pass/traits/trait-copy-guessing.rs | 47 + .../traits/trait-default-method-bound-subst.rs | 28 + .../traits/trait-default-method-bound-subst2.rs | 26 + .../traits/trait-default-method-bound-subst3.rs | 27 + .../traits/trait-default-method-bound-subst4.rs | 28 + .../run-pass/traits/trait-default-method-bound.rs | 26 + .../run-pass/traits/trait-default-method-xc-2.rs | 36 + .../run-pass/traits/trait-default-method-xc.rs | 90 + ...t-false-ambiguity-where-clause-builtin-bound.rs | 26 + src/test/run-pass/traits/trait-generic.rs | 55 + src/test/run-pass/traits/trait-impl-2.rs | 28 + src/test/run-pass/traits/trait-impl.rs | 51 + .../run-pass/traits/trait-inheritance-auto-xc-2.rs | 33 + .../run-pass/traits/trait-inheritance-auto-xc.rs | 34 + src/test/run-pass/traits/trait-inheritance-auto.rs | 38 + .../trait-inheritance-call-bound-inherited.rs | 29 + .../trait-inheritance-call-bound-inherited2.rs | 32 + ...-inheritance-cast-without-call-to-supertrait.rs | 42 + src/test/run-pass/traits/trait-inheritance-cast.rs | 42 + .../trait-inheritance-cross-trait-call-xc.rs | 30 + .../traits/trait-inheritance-cross-trait-call.rs | 28 + .../run-pass/traits/trait-inheritance-diamond.rs | 37 + .../trait-inheritance-multiple-inheritors.rs | 32 + .../traits/trait-inheritance-multiple-params.rs | 35 + src/test/run-pass/traits/trait-inheritance-num.rs | 21 + src/test/run-pass/traits/trait-inheritance-num0.rs | 33 + src/test/run-pass/traits/trait-inheritance-num1.rs | 24 + src/test/run-pass/traits/trait-inheritance-num2.rs | 96 + src/test/run-pass/traits/trait-inheritance-num3.rs | 29 + src/test/run-pass/traits/trait-inheritance-num5.rs | 36 + .../traits/trait-inheritance-overloading-simple.rs | 36 + .../traits/trait-inheritance-overloading-xc-exe.rs | 30 + .../traits/trait-inheritance-overloading.rs | 57 + .../traits/trait-inheritance-self-in-supertype.rs | 72 + src/test/run-pass/traits/trait-inheritance-self.rs | 39 + .../run-pass/traits/trait-inheritance-simple.rs | 33 + .../run-pass/traits/trait-inheritance-static.rs | 36 + .../run-pass/traits/trait-inheritance-static2.rs | 39 + .../run-pass/traits/trait-inheritance-subst.rs | 37 + .../run-pass/traits/trait-inheritance-subst2.rs | 47 + .../traits/trait-inheritance-visibility.rs | 30 + src/test/run-pass/traits/trait-inheritance2.rs | 35 + .../run-pass/traits/trait-item-inside-macro.rs | 40 + .../run-pass/traits/trait-object-auto-dedup.rs | 54 + src/test/run-pass/traits/trait-object-exclusion.rs | 29 + src/test/run-pass/traits/trait-object-generics.rs | 53 + .../run-pass/traits/trait-object-lifetime-first.rs | 23 + .../traits/trait-object-with-lifetime-bound.rs | 44 + .../run-pass/traits/trait-region-pointer-simple.rs | 31 + src/test/run-pass/traits/trait-safety-ok-cc.rs | 34 + src/test/run-pass/traits/trait-safety-ok.rs | 28 + .../traits/trait-static-method-overwriting.rs | 43 + src/test/run-pass/traits/trait-to-str.rs | 46 + .../run-pass/traits/trait-where-clause-vs-impl.rs | 53 + .../run-pass/traits/trait-with-bounds-default.rs | 42 + .../traits/traits-assoc-type-in-supertrait.rs | 33 + .../run-pass/traits/traits-conditional-dispatch.rs | 45 + .../run-pass/traits/traits-conditional-model-fn.rs | 69 + .../run-pass/traits/traits-default-method-macro.rs | 30 + .../run-pass/traits/traits-default-method-mut.rs | 20 + .../run-pass/traits/traits-default-method-self.rs | 28 + .../traits/traits-default-method-trivial.rs | 31 + .../traits/traits-elaborate-type-region.rs | 59 + .../traits-impl-object-overlap-issue-23853.rs | 28 + src/test/run-pass/traits/traits-issue-22019.rs | 44 + src/test/run-pass/traits/traits-issue-22110.rs | 37 + src/test/run-pass/traits/traits-issue-22655.rs | 32 + src/test/run-pass/traits/traits-issue-23003.rs | 42 + src/test/run-pass/traits/traits-issue-26339.rs | 41 + .../traits-multidispatch-infer-convert-target.rs | 47 + src/test/run-pass/traits/traits-negative-impls.rs | 30 + .../run-pass/traits/traits-repeated-supertrait.rs | 58 + src/test/run-pass/traits/ufcs-trait-object.rs | 27 + src/test/run-pass/traits/use-trait-before-def.rs | 20 + .../auxiliary/unboxed-closures-cross-crate.rs | 26 + .../unboxed-closures-all-traits.rs | 31 + .../unboxed-closures-blanket-fn-mut.rs | 36 + .../unboxed-closures-blanket-fn.rs | 36 + .../unboxed-closures/unboxed-closures-boxed.rs | 26 + .../unboxed-closures/unboxed-closures-by-ref.rs | 34 + .../unboxed-closures-call-fn-autoderef.rs | 27 + .../unboxed-closures-call-sugar-autoderef.rs | 25 + ...unboxed-closures-call-sugar-object-autoderef.rs | 25 + .../unboxed-closures-call-sugar-object.rs | 23 + .../unboxed-closures-counter-not-moved.rs | 37 + .../unboxed-closures-cross-crate.rs | 24 + .../unboxed-closures-direct-sugary-call.rs | 17 + .../unboxed-closures/unboxed-closures-drop.rs | 125 + .../unboxed-closures-extern-fn-hr.rs | 41 + .../unboxed-closures/unboxed-closures-extern-fn.rs | 37 + .../unboxed-closures-fn-as-fnmut-and-fnonce.rs | 54 + .../unboxed-closures-fnmut-as-fnonce.rs | 43 + .../unboxed-closures/unboxed-closures-generic.rs | 23 + ...closures-infer-arg-types-from-expected-bound.rs | 33 + ...es-infer-arg-types-from-expected-object-type.rs | 29 + ...r-arg-types-w-bound-regs-from-expected-bound.rs | 33 + .../unboxed-closures-infer-explicit-call-early.rs | 18 + .../unboxed-closures-infer-fnmut-calling-fnmut.rs | 29 + .../unboxed-closures-infer-fnmut-move.rs | 26 + .../unboxed-closures-infer-fnmut.rs | 25 + .../unboxed-closures-infer-fnonce-move.rs | 35 + .../unboxed-closures-infer-fnonce.rs | 35 + .../unboxed-closures-infer-kind.rs | 37 + .../unboxed-closures-infer-recursive-fn.rs | 55 + .../unboxed-closures-infer-upvar.rs | 23 + .../unboxed-closures-manual-impl.rs | 41 + .../unboxed-closures-monomorphization.rs | 36 + ...ed-closures-move-from-projection-issue-30046.rs | 36 + .../unboxed-closures-move-mutable.rs | 40 + ...-closures-move-some-upvars-in-by-ref-closure.rs | 33 + .../unboxed-closures/unboxed-closures-prelude.rs | 28 + .../unboxed-closures/unboxed-closures-simple.rs | 18 + .../unboxed-closures-single-word-env.rs | 32 + .../unboxed-closures-static-call-fn-once.rs | 17 + .../unboxed-closures-sugar-object.rs | 35 + .../unboxed-closures-unique-type-id.rs | 35 + .../unboxed-closures/unboxed-closures-zero-args.rs | 17 + src/test/run-pass/uniform-paths/basic-nested.rs | 70 + src/test/run-pass/uniform-paths/basic.rs | 44 + src/test/run-pass/uniform-paths/macros-nested.rs | 65 + src/test/run-pass/uniform-paths/macros.rs | 48 + src/test/run-pass/uniform-paths/same-crate.rs | 111 + src/test/run-pass/union/auxiliary/union.rs | 14 + src/test/run-pass/union/union-align.rs | 72 + src/test/run-pass/union/union-backcomp.rs | 33 + src/test/run-pass/union/union-basic.rs | 68 + src/test/run-pass/union/union-c-interop.rs | 47 + src/test/run-pass/union/union-const-codegen.rs | 27 + src/test/run-pass/union/union-const-eval-field.rs | 55 + src/test/run-pass/union/union-derive.rs | 50 + src/test/run-pass/union/union-drop-assign.rs | 47 + src/test/run-pass/union/union-drop.rs | 68 + src/test/run-pass/union/union-generic.rs | 46 + src/test/run-pass/union/union-inherent-method.rs | 24 + src/test/run-pass/union/union-macro.rs | 33 + src/test/run-pass/union/union-nodrop.rs | 71 + src/test/run-pass/union/union-overwrite.rs | 83 + src/test/run-pass/union/union-packed.rs | 181 + src/test/run-pass/union/union-pat-refutability.rs | 63 + src/test/run-pass/union/union-trait-impl.rs | 27 + src/test/run-pass/union/union-transmute.rs | 38 + .../run-pass/union/union-with-drop-fields-lint.rs | 42 + src/test/run-pass/unique/unique-assign-copy.rs | 23 + src/test/run-pass/unique/unique-assign-drop.rs | 21 + src/test/run-pass/unique/unique-assign-generic.rs | 22 + src/test/run-pass/unique/unique-assign.rs | 18 + src/test/run-pass/unique/unique-autoderef-field.rs | 21 + src/test/run-pass/unique/unique-autoderef-index.rs | 17 + src/test/run-pass/unique/unique-cmp.rs | 21 + src/test/run-pass/unique/unique-containing-tag.rs | 36 + src/test/run-pass/unique/unique-create.rs | 22 + src/test/run-pass/unique/unique-decl-init-copy.rs | 22 + src/test/run-pass/unique/unique-decl-init.rs | 18 + src/test/run-pass/unique/unique-decl-move.rs | 18 + src/test/run-pass/unique/unique-decl.rs | 20 + src/test/run-pass/unique/unique-deref.rs | 17 + src/test/run-pass/unique/unique-destructure.rs | 20 + src/test/run-pass/unique/unique-drop-complex.rs | 18 + src/test/run-pass/unique/unique-ffi-symbols.rs | 26 + src/test/run-pass/unique/unique-fn-arg-move.rs | 21 + src/test/run-pass/unique/unique-fn-arg-mut.rs | 22 + src/test/run-pass/unique/unique-fn-arg.rs | 22 + src/test/run-pass/unique/unique-fn-ret.rs | 20 + src/test/run-pass/unique/unique-generic-assign.rs | 20 + src/test/run-pass/unique/unique-in-tag.rs | 31 + src/test/run-pass/unique/unique-in-vec-copy.rs | 26 + src/test/run-pass/unique/unique-in-vec.rs | 17 + src/test/run-pass/unique/unique-init.rs | 18 + src/test/run-pass/unique/unique-kinds.rs | 75 + src/test/run-pass/unique/unique-log.rs | 17 + src/test/run-pass/unique/unique-match-discrim.rs | 21 + src/test/run-pass/unique/unique-move-drop.rs | 21 + src/test/run-pass/unique/unique-move-temp.rs | 18 + src/test/run-pass/unique/unique-move.rs | 19 + src/test/run-pass/unique/unique-mutable.rs | 18 + src/test/run-pass/unique/unique-object-move.rs | 29 + src/test/run-pass/unique/unique-pat-2.rs | 27 + src/test/run-pass/unique/unique-pat-3.rs | 26 + src/test/run-pass/unique/unique-pat.rs | 25 + src/test/run-pass/unique/unique-rec.rs | 20 + src/test/run-pass/unique/unique-send-2.rs | 44 + src/test/run-pass/unique/unique-send.rs | 21 + src/test/run-pass/unique/unique-swap.rs | 22 + .../unsized-locals/reference-unsized-locals.rs | 19 + .../unsized-locals/simple-unsized-locals.rs | 18 + src/test/run-pass/unsized-locals/unsized-exprs.rs | 47 + .../run-pass/unsized-locals/unsized-parameters.rs | 22 + .../where-clauses/auxiliary/where_clauses_xc.rs | 29 + .../where-clause-bounds-inconsistency.rs | 33 + .../where-clause-early-bound-lifetimes.rs | 28 + .../where-clause-method-substituion.rs | 32 + .../where-clauses/where-clause-region-outlives.rs | 20 + .../where-clauses/where-clauses-cross-crate.rs | 23 + .../where-clauses/where-clauses-lifetimes.rs | 18 + .../run-pass/where-clauses/where-clauses-method.rs | 30 + .../where-clauses-unboxed-closures.rs | 26 + src/test/run-pass/where-clauses/where-clauses.rs | 37 + .../zero-sized/zero-size-type-destructors.rs | 31 + .../zero-sized/zero-sized-binary-heap-push.rs | 29 + .../zero-sized/zero-sized-btreemap-insert.rs | 33 + .../zero-sized/zero-sized-linkedlist-push.rs | 39 + .../run-pass/zero-sized/zero-sized-tuple-struct.rs | 22 + .../zero-sized/zero-sized-vec-deque-push.rs | 42 + .../run-pass/zero-sized/zero-sized-vec-push.rs | 29 + .../allocator/auxiliary/custom-as-global.rs | 26 - src/test/ui/run-pass/allocator/auxiliary/custom.rs | 31 - src/test/ui/run-pass/allocator/auxiliary/helper.rs | 19 - src/test/ui/run-pass/allocator/custom.rs | 68 - src/test/ui/run-pass/allocator/xcrate-use.rs | 45 - src/test/ui/run-pass/allocator/xcrate-use2.rs | 58 - src/test/ui/run-pass/array-slice-vec/arr_cycle.rs | 41 - .../array-slice-vec/array_const_index-1.rs | 21 - .../array-slice-vec/box-of-array-of-drop-1.rs | 57 - .../array-slice-vec/box-of-array-of-drop-2.rs | 57 - .../run-pass/array-slice-vec/cast-in-array-size.rs | 24 - .../array-slice-vec/check-static-mut-slices.rs | 24 - .../run-pass/array-slice-vec/check-static-slice.rs | 46 - .../array-slice-vec/copy-out-of-array-1.rs | 29 - .../array-slice-vec/destructure-array-1.rs | 37 - .../run-pass/array-slice-vec/empty-mutable-vec.rs | 18 - src/test/ui/run-pass/array-slice-vec/estr-slice.rs | 60 - src/test/ui/run-pass/array-slice-vec/evec-slice.rs | 56 - .../run-pass/array-slice-vec/fixed_length_copy.rs | 19 - .../run-pass/array-slice-vec/huge-largest-array.rs | 24 - .../run-pass/array-slice-vec/ivec-pass-by-value.rs | 14 - ...mutability-inherits-through-fixed-length-vec.rs | 29 - .../run-pass/array-slice-vec/mutable-alias-vec.rs | 25 - .../ui/run-pass/array-slice-vec/nested-vec-1.rs | 18 - .../ui/run-pass/array-slice-vec/nested-vec-2.rs | 25 - .../ui/run-pass/array-slice-vec/nested-vec-3.rs | 64 - .../array-slice-vec/new-style-fixed-length-vec.rs | 17 - .../array-slice-vec/rcvr-borrowed-to-slice.rs | 43 - .../array-slice-vec/repeated-vector-syntax.rs | 23 - .../run-pass/array-slice-vec/show-boxed-slice.rs | 18 - src/test/ui/run-pass/array-slice-vec/slice-2.rs | 72 - .../array-slice-vec/slice-of-zero-size-elements.rs | 63 - .../ui/run-pass/array-slice-vec/slice-panic-1.rs | 36 - .../ui/run-pass/array-slice-vec/slice-panic-2.rs | 40 - src/test/ui/run-pass/array-slice-vec/slice.rs | 90 - .../array-slice-vec/slice_binary_search.rs | 31 - .../array-slice-vec/variance-vec-covariant.rs | 30 - src/test/ui/run-pass/array-slice-vec/vec-concat.rs | 24 - src/test/ui/run-pass/array-slice-vec/vec-dst.rs | 36 - .../run-pass/array-slice-vec/vec-fixed-length.rs | 34 - src/test/ui/run-pass/array-slice-vec/vec-growth.rs | 26 - .../ui/run-pass/array-slice-vec/vec-late-init.rs | 18 - .../run-pass/array-slice-vec/vec-macro-no-std.rs | 37 - .../run-pass/array-slice-vec/vec-macro-repeat.rs | 25 - .../array-slice-vec/vec-macro-rvalue-scope.rs | 21 - .../array-slice-vec/vec-macro-with-brackets.rs | 25 - .../vec-macro-with-trailing-comma.rs | 18 - .../array-slice-vec/vec-matching-autoslice.rs | 33 - .../run-pass/array-slice-vec/vec-matching-fixed.rs | 42 - .../run-pass/array-slice-vec/vec-matching-fold.rs | 58 - .../vec-matching-legal-tail-element-borrow.rs | 25 - .../ui/run-pass/array-slice-vec/vec-matching.rs | 169 - src/test/ui/run-pass/array-slice-vec/vec-push.rs | 13 - .../array-slice-vec/vec-repeat-with-cast.rs | 15 - .../ui/run-pass/array-slice-vec/vec-slice-drop.rs | 41 - src/test/ui/run-pass/array-slice-vec/vec-slice.rs | 19 - .../run-pass/array-slice-vec/vec-tail-matching.rs | 46 - src/test/ui/run-pass/array-slice-vec/vec-to_str.rs | 22 - src/test/ui/run-pass/array-slice-vec/vec.rs | 25 - src/test/ui/run-pass/array-slice-vec/vec_cycle.rs | 49 - .../run-pass/array-slice-vec/vec_cycle_wrapped.rs | 60 - .../ui/run-pass/array-slice-vec/vector-no-ann-2.rs | 17 - .../associated-const-const-eval.rs | 30 - .../associated-const-cross-crate-const-eval.rs | 38 - .../associated-const-cross-crate-defaults.rs | 32 - .../associated-const-cross-crate.rs | 27 - .../associated-const-in-global-const.rs | 23 - .../associated-const-inherent-impl.rs | 21 - .../associated-const-marks-live-code.rs | 25 - .../associated-const-match-patterns.rs | 78 - .../associated-const-outer-ty-refs.rs | 20 - .../associated-const-overwrite-default.rs | 23 - .../associated-const-public-impl.rs | 26 - .../associated-const-range-match-patterns.rs | 35 - .../associated-const-resolution-order.rs | 35 - .../associated-const-self-type.rs | 23 - .../associated-const-type-parameters.rs | 54 - .../associated-const-ufcs-infer-trait.rs | 23 - .../associated-const-use-default.rs | 21 - .../associated-const-use-impl-of-same-trait.rs | 35 - .../run-pass/associated-consts/associated-const.rs | 23 - .../auxiliary/associated-const-cc-lib.rs | 45 - .../associated-consts/auxiliary/empty-struct.rs | 19 - .../associated-types/associated-types-basic.rs | 24 - .../associated-types-binding-in-trait.rs | 46 - .../associated-types-binding-in-where-clause.rs | 48 - .../associated-types/associated-types-bound.rs | 53 - .../associated-types/associated-types-cc.rs | 27 - .../associated-types-conditional-dispatch.rs | 76 - .../associated-types-constant-type.rs | 41 - .../associated-types-doubleendediterator-object.rs | 30 - ...sociated-types-duplicate-binding-in-env-hrtb.rs | 26 - .../associated-types-duplicate-binding-in-env.rs | 30 - .../associated-types-enum-field-named.rs | 45 - .../associated-types-enum-field-numbered.rs | 45 - .../associated-types/associated-types-eq-obj.rs | 35 - .../associated-types-impl-redirect.rs | 58 - .../associated-types-in-bound-type-arg.rs | 27 - .../associated-types-in-default-method.rs | 37 - .../associated-types/associated-types-in-fn.rs | 38 - .../associated-types-in-impl-generics.rs | 46 - .../associated-types-in-inherent-method.rs | 40 - .../associated-types-issue-20220.rs | 38 - .../associated-types-issue-20371.rs | 19 - .../associated-types-issue-21212.rs | 31 - .../associated-types-iterator-binding.rs | 29 - .../associated-types/associated-types-method.rs | 37 - .../associated-types-nested-projections.rs | 53 - ...associated-types-normalize-in-bounds-binding.rs | 47 - .../associated-types-normalize-in-bounds-ufcs.rs | 44 - .../associated-types-normalize-in-bounds.rs | 44 - .../associated-types-normalize-unifield-struct.rs | 34 - ...s-project-from-type-param-via-bound-in-where.rs | 108 - ...ciated-types-projection-bound-in-supertraits.rs | 32 - ...ted-types-projection-from-known-type-in-impl.rs | 48 - .../associated-types-projection-in-object-type.rs | 48 - .../associated-types-projection-in-supertrait.rs | 54 - .../associated-types-projection-in-where-clause.rs | 39 - ...sociated-types-projection-to-unrelated-trait.rs | 45 - ...alified-path-with-trait-with-type-parameters.rs | 19 - .../associated-types-ref-from-struct.rs | 65 - .../associated-types-ref-in-struct-literal.rs | 33 - .../associated-types-region-erasure-issue-20582.rs | 30 - .../associated-types-resolve-lifetime.rs | 25 - .../associated-types/associated-types-return.rs | 56 - .../associated-types/associated-types-simple.rs | 34 - .../associated-types/associated-types-stream.rs | 49 - .../associated-types-struct-field-named.rs | 45 - .../associated-types-struct-field-numbered.rs | 42 - .../associated-types-sugar-path.rs | 48 - ...associated-types-where-clause-impl-ambiguity.rs | 54 - .../auxiliary/associated-types-cc-lib.rs | 26 - .../autoref-autoderef/auto-ref-bounded-ty-param.rs | 39 - .../autoref-autoderef/auto-ref-sliceable.rs | 29 - src/test/ui/run-pass/autoref-autoderef/auto-ref.rs | 29 - .../autoderef-and-borrow-method-receiver.rs | 27 - .../autoref-autoderef/autoderef-method-on-trait.rs | 26 - .../autoref-autoderef/autoderef-method-priority.rs | 30 - .../autoderef-method-twice-but-not-thrice.rs | 26 - .../autoref-autoderef/autoderef-method-twice.rs | 26 - .../run-pass/autoref-autoderef/autoderef-method.rs | 26 - .../autoref-autoderef/autoderef-privacy.rs | 61 - .../autoref-intermediate-types-issue-3585.rs | 33 - src/test/ui/run-pass/bench/issue-32062.rs | 60 - .../binding/allow_irrefutable_let_patterns.rs | 22 - .../binding/bind-field-short-with-modifiers.rs | 34 - .../ui/run-pass/binding/borrowed-ptr-pattern-2.rs | 23 - .../ui/run-pass/binding/borrowed-ptr-pattern-3.rs | 23 - .../binding/borrowed-ptr-pattern-infallible.rs | 18 - .../binding/borrowed-ptr-pattern-option.rs | 25 - .../ui/run-pass/binding/borrowed-ptr-pattern.rs | 22 - .../ui/run-pass/binding/empty-types-in-patterns.rs | 67 - .../binding/exhaustive-bool-match-sanity.rs | 32 - .../run-pass/binding/expr-match-generic-unique1.rs | 29 - .../run-pass/binding/expr-match-generic-unique2.rs | 27 - src/test/ui/run-pass/binding/expr-match-generic.rs | 39 - .../ui/run-pass/binding/expr-match-panic-all.rs | 24 - src/test/ui/run-pass/binding/expr-match-panic.rs | 24 - src/test/ui/run-pass/binding/expr-match-unique.rs | 20 - src/test/ui/run-pass/binding/expr-match.rs | 55 - src/test/ui/run-pass/binding/fat-arrow-match.rs | 26 - .../run-pass/binding/fn-pattern-expected-type-2.rs | 18 - .../run-pass/binding/fn-pattern-expected-type.rs | 19 - .../binding/func-arg-incomplete-pattern.rs | 33 - .../ui/run-pass/binding/func-arg-ref-pattern.rs | 38 - .../ui/run-pass/binding/func-arg-wild-pattern.rs | 22 - src/test/ui/run-pass/binding/if-let.rs | 69 - .../binding/inconsistent-lifetime-mismatch.rs | 24 - .../binding/inferred-suffix-in-pattern-range.rs | 34 - .../run-pass/binding/irrefutable-slice-patterns.rs | 25 - src/test/ui/run-pass/binding/let-assignability.rs | 22 - src/test/ui/run-pass/binding/let-destruct-ref.rs | 17 - src/test/ui/run-pass/binding/let-var-hygiene.rs | 21 - src/test/ui/run-pass/binding/match-arm-statics.rs | 175 - .../ui/run-pass/binding/match-beginning-vert.rs | 29 - src/test/ui/run-pass/binding/match-borrowed_str.rs | 58 - src/test/ui/run-pass/binding/match-bot-2.rs | 15 - src/test/ui/run-pass/binding/match-bot.rs | 17 - .../run-pass/binding/match-byte-array-patterns.rs | 55 - .../ui/run-pass/binding/match-enum-struct-0.rs | 26 - .../ui/run-pass/binding/match-enum-struct-1.rs | 28 - .../run-pass/binding/match-implicit-copy-unique.rs | 27 - src/test/ui/run-pass/binding/match-in-macro.rs | 27 - src/test/ui/run-pass/binding/match-join.rs | 29 - src/test/ui/run-pass/binding/match-larger-const.rs | 22 - .../ui/run-pass/binding/match-naked-record-expr.rs | 22 - src/test/ui/run-pass/binding/match-naked-record.rs | 22 - src/test/ui/run-pass/binding/match-path.rs | 23 - .../ui/run-pass/binding/match-pattern-bindings.rs | 31 - src/test/ui/run-pass/binding/match-pattern-lit.rs | 25 - .../binding/match-pattern-no-type-params.rs | 23 - .../ui/run-pass/binding/match-pattern-simple.rs | 18 - src/test/ui/run-pass/binding/match-phi.rs | 27 - src/test/ui/run-pass/binding/match-pipe-binding.rs | 71 - src/test/ui/run-pass/binding/match-range-infer.rs | 27 - src/test/ui/run-pass/binding/match-range-static.rs | 23 - src/test/ui/run-pass/binding/match-range.rs | 61 - src/test/ui/run-pass/binding/match-reassign.rs | 31 - .../binding/match-ref-binding-in-guard-3256.rs | 23 - .../binding/match-ref-binding-mut-option.rs | 20 - .../ui/run-pass/binding/match-ref-binding-mut.rs | 28 - src/test/ui/run-pass/binding/match-ref-binding.rs | 22 - src/test/ui/run-pass/binding/match-ref-unsized.rs | 21 - .../run-pass/binding/match-static-const-rename.rs | 74 - src/test/ui/run-pass/binding/match-str.rs | 34 - src/test/ui/run-pass/binding/match-struct-0.rs | 31 - src/test/ui/run-pass/binding/match-tag.rs | 39 - src/test/ui/run-pass/binding/match-unique-bind.rs | 22 - src/test/ui/run-pass/binding/match-unsized.rs | 19 - .../binding/match-value-binding-in-guard-3291.rs | 29 - src/test/ui/run-pass/binding/match-var-hygiene.rs | 21 - .../ui/run-pass/binding/match-vec-alternatives.rs | 91 - src/test/ui/run-pass/binding/match-vec-rvalue.rs | 25 - src/test/ui/run-pass/binding/match-with-ret-arm.rs | 22 - src/test/ui/run-pass/binding/multi-let.rs | 17 - .../ui/run-pass/binding/mut-in-ident-patterns.rs | 84 - .../ui/run-pass/binding/nested-exhaustive-match.rs | 23 - src/test/ui/run-pass/binding/nested-matchs.rs | 25 - src/test/ui/run-pass/binding/nested-pattern.rs | 25 - src/test/ui/run-pass/binding/nil-pattern.rs | 14 - src/test/ui/run-pass/binding/nullary-or-pattern.rs | 23 - .../binding/optional_comma_in_match_arm.rs | 49 - src/test/ui/run-pass/binding/or-pattern.rs | 24 - .../ui/run-pass/binding/order-drop-with-match.rs | 67 - src/test/ui/run-pass/binding/pat-ranges.rs | 24 - src/test/ui/run-pass/binding/pat-tuple-1.rs | 103 - src/test/ui/run-pass/binding/pat-tuple-2.rs | 33 - src/test/ui/run-pass/binding/pat-tuple-3.rs | 39 - src/test/ui/run-pass/binding/pat-tuple-4.rs | 67 - src/test/ui/run-pass/binding/pat-tuple-5.rs | 39 - src/test/ui/run-pass/binding/pat-tuple-6.rs | 55 - src/test/ui/run-pass/binding/pat-tuple-7.rs | 17 - .../binding/pattern-bound-var-in-for-each.rs | 30 - src/test/ui/run-pass/binding/pattern-in-closure.rs | 24 - .../binding/range-inclusive-pattern-precedence.rs | 33 - .../ui/run-pass/binding/simple-generic-match.rs | 18 - src/test/ui/run-pass/binding/use-uninit-match.rs | 26 - src/test/ui/run-pass/binding/use-uninit-match2.rs | 26 - .../run-pass/binding/zero_sized_subslice_match.rs | 22 - .../borrowck/borrowck-assign-to-subfield.rs | 33 - .../borrowck/borrowck-assignment-to-static-mut.rs | 23 - .../ui/run-pass/borrowck/borrowck-binding-mutbl.rs | 26 - .../borrowck/borrowck-borrow-from-expr-block.rs | 28 - .../borrowck-borrow-of-mut-base-ptr-safe.rs | 28 - .../run-pass/borrowck/borrowck-closures-two-imm.rs | 51 - .../borrowck/borrowck-field-sensitivity.rs | 274 -- .../borrowck/borrowck-fixed-length-vecs.rs | 17 - .../borrowck/borrowck-freeze-frozen-mut.rs | 38 - .../ui/run-pass/borrowck/borrowck-lend-args.rs | 30 - .../borrowck-macro-interaction-issue-6304.rs | 46 - .../borrowck/borrowck-move-by-capture-ok.rs | 18 - .../borrowck-multiple-borrows-interior-boxes.rs | 30 - src/test/ui/run-pass/borrowck/borrowck-mut-uniq.rs | 43 - .../borrowck/borrowck-mut-vec-as-imm-slice.rs | 26 - src/test/ui/run-pass/borrowck/borrowck-pat-enum.rs | 48 - .../borrowck/borrowck-pat-reassign-no-binding.rs | 24 - .../run-pass/borrowck/borrowck-rvalues-mutable.rs | 44 - .../borrowck/borrowck-scope-of-deref-issue-4666.rs | 52 - .../borrowck-slice-pattern-element-loan.rs | 34 - .../borrowck/borrowck-static-item-in-fn.rs | 18 - .../run-pass/borrowck/borrowck-trait-lifetime.rs | 27 - .../ui/run-pass/borrowck/borrowck-uniq-via-ref.rs | 58 - .../run-pass/borrowck/borrowck-univariant-enum.rs | 35 - .../borrowck-unsafe-static-mutable-borrows.rs | 32 - .../borrowck/borrowck-unused-mut-locals.rs | 57 - .../run-pass/borrowck/borrowck-use-mut-borrow.rs | 61 - .../ui/run-pass/borrowck/two-phase-baseline.rs | 20 - src/test/ui/run-pass/borrowck/two-phase-bin-ops.rs | 49 - ...o-phase-control-flow-split-before-activation.rs | 29 - .../ui/run-pass/cfg/auxiliary/cfg_inner_static.rs | 17 - .../auxiliary/crate-attributes-using-cfg_attr.rs | 16 - src/test/ui/run-pass/cfg/cfg-attr-cfg.rs | 18 - src/test/ui/run-pass/cfg/cfg-attr-crate.rs | 18 - src/test/ui/run-pass/cfg/cfg-family.rs | 22 - src/test/ui/run-pass/cfg/cfg-in-crate-1.rs | 15 - src/test/ui/run-pass/cfg/cfg-macros-foo.rs | 36 - src/test/ui/run-pass/cfg/cfg-macros-notfoo.rs | 36 - src/test/ui/run-pass/cfg/cfg-match-arm.rs | 29 - src/test/ui/run-pass/cfg/cfg-target-family.rs | 23 - src/test/ui/run-pass/cfg/cfg-target-vendor.rs | 20 - src/test/ui/run-pass/cfg/cfg_attr.rs | 60 - src/test/ui/run-pass/cfg/cfg_inner_static.rs | 20 - src/test/ui/run-pass/cfg/cfg_stmt_expr.rs | 99 - src/test/ui/run-pass/cfg/cfgs-on-items.rs | 39 - .../ui/run-pass/cfg/conditional-compile-arch.rs | 48 - src/test/ui/run-pass/cfg/conditional-compile.rs | 158 - .../cfg/crate-attributes-using-cfg_attr.rs | 16 - .../ui/run-pass/coerce/coerce-expect-unsized.rs | 53 - .../run-pass/coerce/coerce-overloaded-autoderef.rs | 76 - .../run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs | 26 - .../coerce/coerce-reborrow-imm-ptr-rcvr.rs | 28 - .../run-pass/coerce/coerce-reborrow-imm-vec-arg.rs | 28 - .../coerce/coerce-reborrow-imm-vec-rcvr.rs | 26 - .../run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs | 35 - .../coerce/coerce-reborrow-mut-ptr-rcvr.rs | 37 - .../run-pass/coerce/coerce-reborrow-mut-vec-arg.rs | 28 - .../coerce/coerce-reborrow-mut-vec-rcvr.rs | 24 - src/test/ui/run-pass/coerce/coerce-unify-return.rs | 29 - src/test/ui/run-pass/coerce/coerce-unify.rs | 78 - .../ui/run-pass/coerce/coerce-unsize-subtype.rs | 49 - .../coherence/auxiliary/coherence_copy_like_lib.rs | 20 - .../run-pass/coherence/auxiliary/coherence_lib.rs | 25 - .../ui/run-pass/coherence/coherence-bigint-int.rs | 23 - .../run-pass/coherence/coherence-bigint-vecint.rs | 23 - .../ui/run-pass/coherence/coherence-blanket.rs | 25 - .../coherence/coherence-covered-type-parameter.rs | 23 - .../ui/run-pass/coherence/coherence-impl-in-fn.rs | 23 - .../coherence/coherence-iterator-vec-any-elem.rs | 23 - .../run-pass/coherence/coherence-iterator-vec.rs | 23 - .../coherence/coherence-multidispatch-tuple.rs | 33 - .../coherence/coherence-negative-impls-safe.rs | 22 - .../coherence/coherence-rfc447-constrained.rs | 32 - .../ui/run-pass/coherence/coherence-subtyping.rs | 49 - .../run-pass/coherence/coherence-where-clause.rs | 47 - .../ui/run-pass/coherence/coherence_copy_like.rs | 28 - .../auxiliary/anon-extern-mod-cross-crate-1.rs | 19 - .../ui/run-pass/consts/auxiliary/cci_borrow_lib.rs | 13 - src/test/ui/run-pass/consts/auxiliary/cci_const.rs | 16 - .../run-pass/consts/auxiliary/cci_const_block.rs | 16 - .../ui/run-pass/consts/auxiliary/const_fn_lib.rs | 16 - .../ui/run-pass/consts/const-adt-align-mismatch.rs | 31 - src/test/ui/run-pass/consts/const-autoderef.rs | 21 - src/test/ui/run-pass/consts/const-big-enum.rs | 40 - src/test/ui/run-pass/consts/const-binops.rs | 136 - .../consts/const-bitshift-rhs-inference.rs | 34 - .../run-pass/consts/const-block-cross-crate-fn.rs | 19 - .../consts/const-block-item-macro-codegen.rs | 49 - src/test/ui/run-pass/consts/const-block-item.rs | 50 - src/test/ui/run-pass/consts/const-block.rs | 55 - src/test/ui/run-pass/consts/const-bound.rs | 29 - src/test/ui/run-pass/consts/const-byte-str-cast.rs | 19 - src/test/ui/run-pass/consts/const-cast-ptr-int.rs | 26 - src/test/ui/run-pass/consts/const-cast.rs | 26 - src/test/ui/run-pass/consts/const-const.rs | 19 - src/test/ui/run-pass/consts/const-contents.rs | 29 - .../ui/run-pass/consts/const-cross-crate-const.rs | 26 - .../ui/run-pass/consts/const-cross-crate-extern.rs | 21 - src/test/ui/run-pass/consts/const-deref.rs | 18 - src/test/ui/run-pass/consts/const-endianess.rs | 33 - .../ui/run-pass/consts/const-enum-byref-self.rs | 27 - src/test/ui/run-pass/consts/const-enum-byref.rs | 25 - src/test/ui/run-pass/consts/const-enum-cast.rs | 26 - src/test/ui/run-pass/consts/const-enum-ptr.rs | 21 - src/test/ui/run-pass/consts/const-enum-struct.rs | 21 - src/test/ui/run-pass/consts/const-enum-struct2.rs | 21 - .../ui/run-pass/consts/const-enum-structlike.rs | 25 - src/test/ui/run-pass/consts/const-enum-tuple.rs | 20 - src/test/ui/run-pass/consts/const-enum-tuple2.rs | 20 - .../ui/run-pass/consts/const-enum-tuplestruct.rs | 21 - .../ui/run-pass/consts/const-enum-tuplestruct2.rs | 21 - .../ui/run-pass/consts/const-enum-vec-index.rs | 40 - src/test/ui/run-pass/consts/const-enum-vec-ptr.rs | 25 - src/test/ui/run-pass/consts/const-enum-vector.rs | 25 - src/test/ui/run-pass/consts/const-err.rs | 29 - .../consts/const-expr-in-fixed-length-vec.rs | 22 - .../ui/run-pass/consts/const-expr-in-vec-repeat.rs | 21 - .../ui/run-pass/consts/const-extern-function.rs | 26 - .../run-pass/consts/const-fields-and-indexing.rs | 37 - src/test/ui/run-pass/consts/const-fn-const-eval.rs | 20 - .../ui/run-pass/consts/const-fn-feature-flags.rs | 24 - src/test/ui/run-pass/consts/const-fn-method.rs | 27 - src/test/ui/run-pass/consts/const-fn-nested.rs | 24 - .../ui/run-pass/consts/const-fn-stability-calls.rs | 35 - src/test/ui/run-pass/consts/const-fn-val.rs | 25 - src/test/ui/run-pass/consts/const-fn.rs | 52 - .../ui/run-pass/consts/const-index-feature-gate.rs | 16 - src/test/ui/run-pass/consts/const-meth-pattern.rs | 30 - src/test/ui/run-pass/consts/const-negation.rs | 45 - src/test/ui/run-pass/consts/const-negative.rs | 19 - src/test/ui/run-pass/consts/const-nullary-enum.rs | 32 - .../consts/const-nullary-univariant-enum.rs | 25 - .../ui/run-pass/consts/const-pattern-variant.rs | 39 - src/test/ui/run-pass/consts/const-rec-and-tup.rs | 29 - .../run-pass/consts/const-region-ptrs-noncopy.rs | 21 - src/test/ui/run-pass/consts/const-region-ptrs.rs | 25 - .../ui/run-pass/consts/const-repeated-values.rs | 20 - .../ui/run-pass/consts/const-size_of-align_of.rs | 61 - src/test/ui/run-pass/consts/const-str-ptr.rs | 26 - .../ui/run-pass/consts/const-struct-offsets.rs | 27 - src/test/ui/run-pass/consts/const-struct.rs | 42 - .../ui/run-pass/consts/const-trait-to-trait.rs | 32 - src/test/ui/run-pass/consts/const-tuple-struct.rs | 24 - src/test/ui/run-pass/consts/const-typeid-of.rs | 44 - src/test/ui/run-pass/consts/const-unit-struct.rs | 22 - src/test/ui/run-pass/consts/const-unsafe-fn.rs | 32 - src/test/ui/run-pass/consts/const-vec-of-fns.rs | 35 - src/test/ui/run-pass/consts/const-vec-syntax.rs | 19 - .../ui/run-pass/consts/const-vecs-and-slices.rs | 33 - src/test/ui/run-pass/consts/const.rs | 16 - src/test/ui/run-pass/consts/consts-in-patterns.rs | 29 - .../cross-crate/anon-extern-mod-cross-crate-2.rs | 24 - .../auxiliary/anon-extern-mod-cross-crate-1.rs | 19 - .../auxiliary/anon_trait_static_method_lib.rs | 19 - .../cross-crate/auxiliary/cci_borrow_lib.rs | 13 - .../cross-crate/auxiliary/cci_capture_clause.rs | 20 - .../ui/run-pass/cross-crate/auxiliary/cci_const.rs | 16 - .../run-pass/cross-crate/auxiliary/cci_impl_lib.rs | 26 - .../run-pass/cross-crate/auxiliary/cci_iter_lib.rs | 21 - .../cross-crate/auxiliary/cci_nested_lib.rs | 62 - .../cross-crate/auxiliary/cci_no_inline_lib.rs | 22 - .../auxiliary/moves_based_on_type_lib.rs | 27 - .../cross-crate/auxiliary/newtype_struct_xc.rs | 13 - .../cross-crate/auxiliary/pub_static_array.rs | 11 - .../auxiliary/reexported_static_methods.rs | 53 - .../auxiliary/xcrate-trait-lifetime-param.rs | 13 - .../auxiliary/xcrate_address_insignificant.rs | 18 - .../auxiliary/xcrate_associated_type_defaults.rs | 22 - .../auxiliary/xcrate_generic_fn_nested_return.rs | 26 - .../auxiliary/xcrate_static_addresses.rs | 27 - .../cross-crate/auxiliary/xcrate_unit_struct.rs | 38 - src/test/ui/run-pass/cross-crate/cci_borrow.rs | 24 - .../ui/run-pass/cross-crate/cci_capture_clause.rs | 24 - src/test/ui/run-pass/cross-crate/cci_impl_exe.rs | 28 - src/test/ui/run-pass/cross-crate/cci_iter_exe.rs | 23 - src/test/ui/run-pass/cross-crate/cci_nested_exe.rs | 30 - .../ui/run-pass/cross-crate/cci_no_inline_exe.rs | 33 - .../run-pass/cross-crate/cross-crate-const-pat.rs | 24 - .../cross-crate/cross-crate-newtype-struct-pat.rs | 22 - .../cross-crate/moves-based-on-type-cross-crate.rs | 21 - .../reexported-static-methods-cross-crate.rs | 26 - .../cross-crate/static-array-across-crate.rs | 22 - .../cross-crate/xcrate-address-insignificant.rs | 19 - .../cross-crate/xcrate-associated-type-defaults.rs | 39 - .../cross-crate/xcrate-static-addresses.rs | 23 - .../cross-crate/xcrate-trait-lifetime-param.rs | 28 - .../ui/run-pass/cross-crate/xcrate-unit-struct.rs | 40 - .../cross-crate/xcrate_generic_fn_nested_return.rs | 18 - src/test/ui/run-pass/ctfe/assoc-const.rs | 30 - src/test/ui/run-pass/ctfe/bswap-const.rs | 25 - .../ctfe/chained-constants-stackoverflow.rs | 366 -- .../ctfe/const-block-non-item-statement-3.rs | 17 - .../ctfe/const-block-non-item-statement.rs | 19 - .../ui/run-pass/ctfe/const-fn-destructuring-arg.rs | 25 - src/test/ui/run-pass/ctfe/deref_in_pattern.rs | 22 - src/test/ui/run-pass/ctfe/ice-48279.rs | 36 - src/test/ui/run-pass/ctfe/issue-37550.rs | 20 - src/test/ui/run-pass/ctfe/issue-broken-mir.rs | 20 - src/test/ui/run-pass/ctfe/locals-in-const-fn.rs | 47 - .../ui/run-pass/ctfe/match-const-fn-structs.rs | 33 - src/test/ui/run-pass/ctfe/mozjs-error.rs | 40 - src/test/ui/run-pass/ctfe/non-scalar-cast.rs | 19 - src/test/ui/run-pass/ctfe/promotion.rs | 27 - src/test/ui/run-pass/ctfe/references.rs | 36 - src/test/ui/run-pass/ctfe/repeat_match.rs | 22 - src/test/ui/run-pass/ctfe/return-in-const-fn.rs | 21 - src/test/ui/run-pass/ctfe/signed_enum_discr.rs | 29 - src/test/ui/run-pass/ctfe/transmute-const.rs | 24 - .../ui/run-pass/ctfe/tuple-struct-constructors.rs | 20 - .../run-pass/deriving/auxiliary/derive-no-std.rs | 40 - src/test/ui/run-pass/deriving/derive-no-std.rs | 23 - .../deriving/derive-partialord-correctness.rs | 19 - .../run-pass/deriving/deriving-associated-types.rs | 209 -- src/test/ui/run-pass/deriving/deriving-bounds.rs | 15 - .../ui/run-pass/deriving/deriving-clone-array.rs | 19 - .../ui/run-pass/deriving/deriving-clone-enum.rs | 23 - .../deriving/deriving-clone-generic-enum.rs | 23 - .../deriving/deriving-clone-generic-struct.rs | 23 - .../deriving-clone-generic-tuple-struct.rs | 19 - .../ui/run-pass/deriving/deriving-clone-struct.rs | 36 - .../deriving/deriving-clone-tuple-struct.rs | 17 - .../run-pass/deriving/deriving-cmp-generic-enum.rs | 54 - .../deriving/deriving-cmp-generic-struct-enum.rs | 58 - .../deriving/deriving-cmp-generic-struct.rs | 50 - .../deriving/deriving-cmp-generic-tuple-struct.rs | 48 - .../run-pass/deriving/deriving-cmp-shortcircuit.rs | 47 - .../ui/run-pass/deriving/deriving-copyclone.rs | 49 - .../ui/run-pass/deriving/deriving-default-box.rs | 25 - .../deriving/deriving-enum-single-variant.rs | 22 - .../deriving/deriving-eq-ord-boxed-slice.rs | 25 - src/test/ui/run-pass/deriving/deriving-hash.rs | 84 - src/test/ui/run-pass/deriving/deriving-in-fn.rs | 20 - src/test/ui/run-pass/deriving/deriving-in-macro.rs | 26 - .../ui/run-pass/deriving/deriving-meta-multiple.rs | 34 - src/test/ui/run-pass/deriving/deriving-meta.rs | 31 - .../deriving-self-lifetime-totalord-totaleq.rs | 26 - src/test/ui/run-pass/deriving/deriving-show-2.rs | 63 - src/test/ui/run-pass/deriving/deriving-show.rs | 44 - .../deriving/deriving-via-extension-c-enum.rs | 26 - .../deriving/deriving-via-extension-enum.rs | 25 - .../deriving/deriving-via-extension-hash-enum.rs | 26 - .../deriving/deriving-via-extension-hash-struct.rs | 21 - .../deriving-via-extension-struct-empty.rs | 18 - ...iving-via-extension-struct-like-enum-variant.rs | 22 - .../deriving-via-extension-struct-tuple.rs | 27 - .../deriving/deriving-via-extension-struct.rs | 26 - .../deriving/deriving-via-extension-type-params.rs | 26 - .../run-pass/deriving/deriving-with-repr-packed.rs | 46 - .../drop/auxiliary/dropck_eyepatch_extern_crate.rs | 60 - .../ui/run-pass/drop/drop-on-empty-block-exit.rs | 22 - src/test/ui/run-pass/drop/drop-on-ret.rs | 25 - src/test/ui/run-pass/drop/drop-struct-as-object.rs | 47 - src/test/ui/run-pass/drop/drop-trait-enum.rs | 102 - src/test/ui/run-pass/drop/drop-trait-generic.rs | 24 - src/test/ui/run-pass/drop/drop-trait.rs | 24 - src/test/ui/run-pass/drop/drop-uninhabited-enum.rs | 22 - .../run-pass/drop/drop-with-type-ascription-1.rs | 18 - .../run-pass/drop/drop-with-type-ascription-2.rs | 18 - .../run-pass/drop/dropck-eyepatch-extern-crate.rs | 49 - .../ui/run-pass/drop/dropck-eyepatch-reorder.rs | 89 - src/test/ui/run-pass/drop/dropck-eyepatch.rs | 112 - src/test/ui/run-pass/drop/dropck_legal_cycles.rs | 1193 ------- src/test/ui/run-pass/drop/dynamic-drop.rs | 355 -- src/test/ui/run-pass/drop/no-drop-flag-size.rs | 24 - src/test/ui/run-pass/drop/nondrop-cycle.rs | 41 - .../dynamically-sized-types/dst-coerce-custom.rs | 53 - .../dynamically-sized-types/dst-coerce-rc.rs | 51 - .../dynamically-sized-types/dst-coercions.rs | 37 - .../dynamically-sized-types/dst-deref-mut.rs | 45 - .../run-pass/dynamically-sized-types/dst-deref.rs | 40 - .../dynamically-sized-types/dst-field-align.rs | 76 - .../run-pass/dynamically-sized-types/dst-index.rs | 43 - .../dst-irrefutable-bind.rs | 37 - .../ui/run-pass/dynamically-sized-types/dst-raw.rs | 148 - .../dynamically-sized-types/dst-struct-sole.rs | 86 - .../run-pass/dynamically-sized-types/dst-struct.rs | 132 - .../dynamically-sized-types/dst-trait-tuple.rs | 113 - .../run-pass/dynamically-sized-types/dst-trait.rs | 115 - .../dynamically-sized-types/dst-tuple-sole.rs | 89 - .../run-pass/dynamically-sized-types/dst-tuple.rs | 130 - .../extern/auxiliary/extern-crosscrate-source.rs | 41 - .../run-pass/extern/auxiliary/extern-take-value.rs | 15 - .../extern/auxiliary/extern_calling_convention.rs | 36 - .../extern/auxiliary/extern_mod_ordering_lib.rs | 15 - src/test/ui/run-pass/extern/auxiliary/fat_drop.rs | 23 - src/test/ui/run-pass/extern/extern-1.rs | 18 - src/test/ui/run-pass/extern/extern-call-deep.rs | 48 - src/test/ui/run-pass/extern/extern-call-deep2.rs | 53 - src/test/ui/run-pass/extern/extern-call-direct.rs | 20 - .../ui/run-pass/extern/extern-call-indirect.rs | 48 - src/test/ui/run-pass/extern/extern-call-scrub.rs | 57 - .../extern/extern-calling-convention-test.rs | 22 - .../extern/extern-compare-with-return-type.rs | 35 - src/test/ui/run-pass/extern/extern-crosscrate.rs | 31 - .../ui/run-pass/extern/extern-foreign-crate.rs | 16 - src/test/ui/run-pass/extern/extern-methods.rs | 40 - src/test/ui/run-pass/extern/extern-mod-abi.rs | 18 - .../ui/run-pass/extern/extern-mod-ordering-exe.rs | 22 - src/test/ui/run-pass/extern/extern-pass-TwoU16s.rs | 35 - src/test/ui/run-pass/extern/extern-pass-TwoU32s.rs | 35 - src/test/ui/run-pass/extern/extern-pass-TwoU64s.rs | 35 - src/test/ui/run-pass/extern/extern-pass-TwoU8s.rs | 35 - src/test/ui/run-pass/extern/extern-pass-char.rs | 26 - src/test/ui/run-pass/extern/extern-pass-double.rs | 23 - src/test/ui/run-pass/extern/extern-pass-empty.rs | 65 - src/test/ui/run-pass/extern/extern-pass-u32.rs | 26 - src/test/ui/run-pass/extern/extern-pass-u64.rs | 26 - src/test/ui/run-pass/extern/extern-prelude-core.rs | 28 - .../ui/run-pass/extern/extern-prelude-core.stderr | 8 - .../extern/extern-prelude-no-speculative.rs | 22 - src/test/ui/run-pass/extern/extern-prelude-std.rs | 23 - .../ui/run-pass/extern/extern-prelude-std.stderr | 8 - src/test/ui/run-pass/extern/extern-pub.rs | 19 - .../ui/run-pass/extern/extern-return-TwoU16s.rs | 31 - .../ui/run-pass/extern/extern-return-TwoU32s.rs | 31 - .../ui/run-pass/extern/extern-return-TwoU64s.rs | 31 - .../ui/run-pass/extern/extern-return-TwoU8s.rs | 31 - src/test/ui/run-pass/extern/extern-rust.rs | 22 - src/test/ui/run-pass/extern/extern-take-value.rs | 23 - src/test/ui/run-pass/extern/extern-thiscall.rs | 36 - .../run-pass/extern/extern-types-inherent-impl.rs | 28 - .../extern/extern-types-manual-sync-send.rs | 29 - .../run-pass/extern/extern-types-pointer-cast.rs | 41 - .../ui/run-pass/extern/extern-types-size_of_val.rs | 27 - .../run-pass/extern/extern-types-thin-pointer.rs | 52 - .../ui/run-pass/extern/extern-types-trait-impl.rs | 36 - src/test/ui/run-pass/extern/extern-vectorcall.rs | 36 - src/test/ui/run-pass/extern/extern_fat_drop.rs | 23 - src/test/ui/run-pass/for-loop-while/auto-loop.rs | 20 - src/test/ui/run-pass/for-loop-while/break-value.rs | 16 - src/test/ui/run-pass/for-loop-while/break.rs | 35 - .../ui/run-pass/for-loop-while/for-destruct.rs | 19 - .../run-pass/for-loop-while/for-loop-goofiness.rs | 25 - .../for-loop-while/for-loop-has-unit-body.rs | 22 - .../for-loop-while/for-loop-into-iterator.rs | 29 - .../for-loop-lifetime-of-unbound-values.rs | 44 - .../ui/run-pass/for-loop-while/for-loop-macro.rs | 21 - .../for-loop-while/for-loop-mut-ref-element.rs | 16 - .../ui/run-pass/for-loop-while/for-loop-no-std.rs | 23 - .../ui/run-pass/for-loop-while/for-loop-panic.rs | 14 - ...loop-unconstrained-element-type-i32-fallback.rs | 21 - .../foreach-external-iterators-break.rs | 23 - ...ach-external-iterators-hashmap-break-restart.rs | 43 - .../foreach-external-iterators-hashmap.rs | 29 - .../foreach-external-iterators-loop.rs | 23 - .../foreach-external-iterators-nested.rs | 25 - .../for-loop-while/foreach-external-iterators.rs | 20 - .../ui/run-pass/for-loop-while/foreach-nested.rs | 26 - .../for-loop-while/foreach-put-structured.rs | 32 - .../for-loop-while/foreach-simple-outer-slot.rs | 26 - .../run-pass/for-loop-while/label_break_value.rs | 124 - .../ui/run-pass/for-loop-while/labeled-break.rs | 32 - .../ui/run-pass/for-loop-while/linear-for-loop.rs | 33 - .../liveness-assign-imm-local-after-loop.rs | 26 - .../run-pass/for-loop-while/liveness-loop-break.rs | 23 - .../for-loop-while/liveness-move-in-loop.rs | 29 - .../run-pass/for-loop-while/loop-break-cont-1.rs | 19 - .../ui/run-pass/for-loop-while/loop-break-cont.rs | 49 - .../ui/run-pass/for-loop-while/loop-break-value.rs | 147 - .../ui/run-pass/for-loop-while/loop-diverges.rs | 23 - .../for-loop-while/loop-label-shadowing.rs | 21 - .../for-loop-while/loop-labeled-break-value.rs | 21 - .../loop-no-reinit-needed-post-bot.rs | 44 - src/test/ui/run-pass/for-loop-while/loop-scope.rs | 18 - src/test/ui/run-pass/for-loop-while/while-cont.rs | 21 - .../ui/run-pass/for-loop-while/while-flow-graph.rs | 16 - src/test/ui/run-pass/for-loop-while/while-label.rs | 24 - src/test/ui/run-pass/for-loop-while/while-let.rs | 56 - .../for-loop-while/while-loop-constraints-2.rs | 24 - .../run-pass/for-loop-while/while-prelude-drop.rs | 34 - .../ui/run-pass/for-loop-while/while-with-break.rs | 27 - src/test/ui/run-pass/for-loop-while/while.rs | 23 - src/test/ui/run-pass/foreign/auxiliary/fn-abi.rs | 12 - .../ui/run-pass/foreign/auxiliary/foreign_lib.rs | 48 - .../ui/run-pass/foreign/foreign-call-no-runtime.rs | 65 - src/test/ui/run-pass/foreign/foreign-dupe.rs | 27 - .../ui/run-pass/foreign/foreign-fn-linkname.rs | 39 - .../ui/run-pass/foreign/foreign-fn-with-byval.rs | 42 - src/test/ui/run-pass/foreign/foreign-int-types.rs | 23 - .../foreign/foreign-mod-src/compiletest-ignore-dir | 0 .../ui/run-pass/foreign/foreign-mod-src/inner.rs | 24 - .../run-pass/foreign/foreign-mod-unused-const.rs | 21 - src/test/ui/run-pass/foreign/foreign-no-abi.rs | 32 - .../foreign/foreign-src/compiletest-ignore-dir | 0 .../ui/run-pass/foreign/foreign-src/foreign.rs | 19 - .../foreign/foreign-truncated-arguments.rs | 30 - src/test/ui/run-pass/foreign/foreign2.rs | 39 - .../functions-closures/auxiliary/fn-abi.rs | 12 - .../call-closure-from-overloaded-op.rs | 19 - .../capture-clauses-boxed-closures.rs | 24 - .../capture-clauses-unboxed-closures.rs | 23 - .../run-pass/functions-closures/clone-closure.rs | 28 - .../closure-bounds-can-capture-chan.rs | 26 - .../closure-expected-type/README.md | 8 - .../expect-infer-supply-two-infers.rs | 27 - .../closure-expected-type/issue-38714.rs | 27 - .../supply-just-return-type.rs | 36 - .../closure-expected-type/supply-nothing.rs | 21 - .../functions-closures/closure-immediate.rs | 23 - .../functions-closures/closure-inference.rs | 21 - .../functions-closures/closure-inference2.rs | 19 - .../run-pass/functions-closures/closure-reform.rs | 65 - .../closure-returning-closure.rs | 15 - .../functions-closures/closure-to-fn-coercion.rs | 45 - .../closure_to_fn_coercion-expected-types.rs | 18 - .../ui/run-pass/functions-closures/copy-closure.rs | 26 - src/test/ui/run-pass/functions-closures/fn-abi.rs | 28 - .../run-pass/functions-closures/fn-bare-assign.rs | 27 - .../functions-closures/fn-bare-coerce-to-block.rs | 20 - .../ui/run-pass/functions-closures/fn-bare-item.rs | 18 - .../ui/run-pass/functions-closures/fn-bare-size.rs | 18 - .../run-pass/functions-closures/fn-bare-spawn.rs | 25 - .../run-pass/functions-closures/fn-coerce-field.rs | 22 - .../functions-closures/fn-item-type-cast.rs | 30 - .../functions-closures/fn-item-type-coerce.rs | 26 - .../functions-closures/fn-item-type-zero-sized.rs | 23 - src/test/ui/run-pass/functions-closures/fn-lval.rs | 21 - .../run-pass/functions-closures/fn-type-infer.rs | 21 - .../implied-bounds-closure-arg-outlives.rs | 45 - .../nullable-pointer-opt-closures.rs | 44 - .../parallel-codegen-closures.rs | 37 - .../functions-closures/return-from-closure.rs | 43 - .../generator/auxiliary/xcrate-reachable.rs | 24 - src/test/ui/run-pass/generator/auxiliary/xcrate.rs | 27 - .../ui/run-pass/generator/borrow-in-tail-expr.rs | 21 - src/test/ui/run-pass/generator/conditional-drop.rs | 67 - src/test/ui/run-pass/generator/control-flow.rs | 58 - src/test/ui/run-pass/generator/drop-env.rs | 72 - src/test/ui/run-pass/generator/issue-44197.rs | 44 - src/test/ui/run-pass/generator/issue-52398.rs | 37 - src/test/ui/run-pass/generator/iterator-count.rs | 52 - .../run-pass/generator/live-upvar-across-yield.rs | 23 - src/test/ui/run-pass/generator/match-bindings.rs | 32 - .../ui/run-pass/generator/nested_generators.rs | 32 - src/test/ui/run-pass/generator/panic-drops.rs | 66 - src/test/ui/run-pass/generator/panic-safe.rs | 39 - .../ui/run-pass/generator/reborrow-mut-upvar.rs | 26 - .../ui/run-pass/generator/resume-after-return.rs | 37 - src/test/ui/run-pass/generator/smoke.rs | 183 - .../ui/run-pass/generator/static-generators.rs | 28 - .../generator/too-live-local-in-immovable-gen.rs | 30 - src/test/ui/run-pass/generator/xcrate-reachable.rs | 23 - src/test/ui/run-pass/generator/xcrate.rs | 39 - .../ui/run-pass/generator/yield-in-args-rev.rs | 28 - src/test/ui/run-pass/generator/yield-in-box.rs | 28 - .../ui/run-pass/generator/yield-in-initializer.rs | 27 - src/test/ui/run-pass/generator/yield-subtype.rs | 29 - .../generics/auxiliary/default_type_params_xc.rs | 15 - .../ui/run-pass/generics/generic-alias-unique.rs | 21 - .../generic-default-type-params-cross-crate.rs | 27 - .../generics/generic-default-type-params.rs | 63 - .../ui/run-pass/generics/generic-derived-type.rs | 31 - .../run-pass/generics/generic-exterior-unique.rs | 22 - .../ui/run-pass/generics/generic-extern-mangle.rs | 19 - src/test/ui/run-pass/generics/generic-fn-infer.rs | 20 - src/test/ui/run-pass/generics/generic-fn-twice.rs | 21 - src/test/ui/run-pass/generics/generic-fn-unique.rs | 16 - src/test/ui/run-pass/generics/generic-fn.rs | 36 - src/test/ui/run-pass/generics/generic-ivec-leak.rs | 15 - .../ui/run-pass/generics/generic-newtype-struct.rs | 18 - src/test/ui/run-pass/generics/generic-object.rs | 32 - .../ui/run-pass/generics/generic-recursive-tag.rs | 23 - .../ui/run-pass/generics/generic-static-methods.rs | 31 - .../ui/run-pass/generics/generic-tag-corruption.rs | 20 - src/test/ui/run-pass/generics/generic-tag-local.rs | 18 - src/test/ui/run-pass/generics/generic-tag-match.rs | 22 - .../ui/run-pass/generics/generic-tag-values.rs | 30 - src/test/ui/run-pass/generics/generic-tag.rs | 24 - src/test/ui/run-pass/generics/generic-temporary.rs | 26 - src/test/ui/run-pass/generics/generic-tup.rs | 18 - .../ui/run-pass/generics/generic-type-synonym.rs | 24 - src/test/ui/run-pass/generics/generic-type.rs | 21 - src/test/ui/run-pass/generics/generic-unique.rs | 21 - .../hrtb-binder-levels-in-object-types.rs | 37 - .../hrtb-debruijn-object-types-in-closures.rs | 25 - .../hrtb-fn-like-trait-object.rs | 37 - .../higher-rank-trait-bounds/hrtb-fn-like-trait.rs | 37 - .../higher-rank-trait-bounds/hrtb-opt-in-copy.rs | 38 - .../higher-rank-trait-bounds/hrtb-parse.rs | 46 - .../hrtb-precedence-of-plus-where-clause.rs | 33 - .../hrtb-precedence-of-plus.rs | 22 - .../hrtb-resolve-lifetime.rs | 23 - .../hrtb-trait-object-paren-notation.rs | 36 - .../hrtb-trait-object-passed-to-closure.rs | 34 - .../higher-rank-trait-bounds/hrtb-type-outlives.rs | 56 - .../hrtb-unboxed-closure-trait.rs | 21 - .../hygiene/auxiliary/legacy_interaction.rs | 20 - src/test/ui/run-pass/hygiene/auxiliary/my_crate.rs | 12 - .../hygiene/auxiliary/unhygienic_example.rs | 38 - src/test/ui/run-pass/hygiene/auxiliary/xcrate.rs | 39 - src/test/ui/run-pass/hygiene/hygiene-dodging-1.rs | 23 - src/test/ui/run-pass/hygiene/hygiene.rs | 124 - .../ui/run-pass/hygiene/hygienic-labels-in-let.rs | 83 - .../run-pass/hygiene/hygienic-labels-in-let.stderr | 300 -- src/test/ui/run-pass/hygiene/hygienic-labels.rs | 62 - .../ui/run-pass/hygiene/hygienic-labels.stderr | 299 -- src/test/ui/run-pass/hygiene/issue-44128.rs | 26 - src/test/ui/run-pass/hygiene/issue-47311.rs | 27 - src/test/ui/run-pass/hygiene/issue-47312.rs | 31 - src/test/ui/run-pass/hygiene/items.rs | 37 - src/test/ui/run-pass/hygiene/legacy_interaction.rs | 51 - src/test/ui/run-pass/hygiene/lexical.rs | 34 - src/test/ui/run-pass/hygiene/specialization.rs | 35 - src/test/ui/run-pass/hygiene/trait_items.rs | 30 - src/test/ui/run-pass/hygiene/ty_params.rs | 24 - .../ui/run-pass/hygiene/wrap_unhygienic_example.rs | 44 - src/test/ui/run-pass/hygiene/xcrate.rs | 22 - src/test/ui/run-pass/impl-trait/auto-trait-leak.rs | 31 - .../ui/run-pass/impl-trait/auxiliary/xcrate.rs | 33 - .../ui/run-pass/impl-trait/bounds_regression.rs | 34 - src/test/ui/run-pass/impl-trait/equality.rs | 58 - .../ui/run-pass/impl-trait/example-calendar.rs | 894 ----- src/test/ui/run-pass/impl-trait/example-st.rs | 40 - .../ui/run-pass/impl-trait/existential-minimal.rs | 15 - src/test/ui/run-pass/impl-trait/issue-42479.rs | 27 - src/test/ui/run-pass/impl-trait/issue-49376.rs | 31 - src/test/ui/run-pass/impl-trait/lifetimes.rs | 128 - src/test/ui/run-pass/impl-trait/nesting.rs | 24 - .../ui/run-pass/impl-trait/universal_hrtb_anon.rs | 20 - .../ui/run-pass/impl-trait/universal_hrtb_named.rs | 20 - .../impl-trait/universal_in_adt_in_parameters.rs | 32 - .../universal_in_impl_trait_in_parameters.rs | 40 - .../universal_in_trait_defn_parameters.rs | 28 - .../impl-trait/universal_multiple_bounds.rs | 23 - src/test/ui/run-pass/impl-trait/xcrate.rs | 21 - src/test/ui/run-pass/impl-trait/xcrate_simple.rs | 19 - .../auxiliary/crate_with_invalid_spans.rs | 30 - .../auxiliary/crate_with_invalid_spans_macros.rs | 17 - .../import-crate-with-invalid-spans/main.rs | 23 - src/test/ui/run-pass/imports/import-from.rs | 21 - src/test/ui/run-pass/imports/import-glob-0.rs | 38 - src/test/ui/run-pass/imports/import-glob-1.rs | 35 - src/test/ui/run-pass/imports/import-glob-crate.rs | 29 - src/test/ui/run-pass/imports/import-in-block.rs | 23 - .../ui/run-pass/imports/import-prefix-macro.rs | 36 - src/test/ui/run-pass/imports/import-rename.rs | 22 - .../ui/run-pass/imports/import-trailing-comma.rs | 23 - src/test/ui/run-pass/imports/import.rs | 22 - src/test/ui/run-pass/imports/import2.rs | 19 - src/test/ui/run-pass/imports/import3.rs | 23 - src/test/ui/run-pass/imports/import4.rs | 19 - src/test/ui/run-pass/imports/import5.rs | 20 - src/test/ui/run-pass/imports/import6.rs | 25 - src/test/ui/run-pass/imports/import7.rs | 28 - src/test/ui/run-pass/imports/import8.rs | 20 - src/test/ui/run-pass/imports/imports.rs | 76 - .../run-pass/intrinsics/auxiliary/cci_intrinsic.rs | 24 - .../ui/run-pass/intrinsics/intrinsic-alignment.rs | 84 - .../ui/run-pass/intrinsics/intrinsic-assume.rs | 27 - .../ui/run-pass/intrinsics/intrinsic-atomics-cc.rs | 22 - .../ui/run-pass/intrinsics/intrinsic-atomics.rs | 113 - .../intrinsics/intrinsic-move-val-cleanups.rs | 198 -- .../ui/run-pass/intrinsics/intrinsic-move-val.rs | 92 - .../ui/run-pass/intrinsics/intrinsic-uninit.rs | 23 - .../run-pass/intrinsics/intrinsic-unreachable.rs | 27 - .../ui/run-pass/intrinsics/intrinsics-integer.rs | 180 - src/test/ui/run-pass/intrinsics/intrinsics-math.rs | 70 - src/test/ui/run-pass/issues/.gitattributes | 1 - src/test/ui/run-pass/issues/auxiliary/cgu_test.rs | 16 - .../ui/run-pass/issues/auxiliary/cgu_test_a.rs | 25 - .../ui/run-pass/issues/auxiliary/cgu_test_b.rs | 25 - src/test/ui/run-pass/issues/auxiliary/i8.rs | 13 - src/test/ui/run-pass/issues/auxiliary/iss.rs | 22 - .../ui/run-pass/issues/auxiliary/issue-10028.rs | 19 - .../ui/run-pass/issues/auxiliary/issue-11224.rs | 26 - .../ui/run-pass/issues/auxiliary/issue-11225-1.rs | 28 - .../ui/run-pass/issues/auxiliary/issue-11225-2.rs | 38 - .../ui/run-pass/issues/auxiliary/issue-11225-3.rs | 38 - .../ui/run-pass/issues/auxiliary/issue-11508.rs | 20 - .../ui/run-pass/issues/auxiliary/issue-11529.rs | 11 - .../run-pass/issues/auxiliary/issue-12133-dylib.rs | 11 - .../issues/auxiliary/issue-12133-dylib2.rs | 16 - .../run-pass/issues/auxiliary/issue-12133-rlib.rs | 13 - .../run-pass/issues/auxiliary/issue-12660-aux.rs | 21 - .../ui/run-pass/issues/auxiliary/issue-13620-1.rs | 19 - .../ui/run-pass/issues/auxiliary/issue-13620-2.rs | 13 - .../ui/run-pass/issues/auxiliary/issue-13872-1.rs | 11 - .../ui/run-pass/issues/auxiliary/issue-13872-2.rs | 13 - .../ui/run-pass/issues/auxiliary/issue-13872-3.rs | 19 - .../ui/run-pass/issues/auxiliary/issue-14344-1.rs | 15 - .../ui/run-pass/issues/auxiliary/issue-14344-2.rs | 13 - .../ui/run-pass/issues/auxiliary/issue-14421.rs | 35 - .../ui/run-pass/issues/auxiliary/issue-14422.rs | 35 - .../ui/run-pass/issues/auxiliary/issue-15562.rs | 15 - .../ui/run-pass/issues/auxiliary/issue-16643.rs | 29 - .../ui/run-pass/issues/auxiliary/issue-17662.rs | 22 - .../run-pass/issues/auxiliary/issue-17718-aux.rs | 21 - .../ui/run-pass/issues/auxiliary/issue-18501.rs | 27 - .../ui/run-pass/issues/auxiliary/issue-18514.rs | 27 - .../ui/run-pass/issues/auxiliary/issue-18711.rs | 15 - .../ui/run-pass/issues/auxiliary/issue-18913-1.rs | 16 - .../ui/run-pass/issues/auxiliary/issue-18913-2.rs | 16 - .../ui/run-pass/issues/auxiliary/issue-19340-1.rs | 13 - .../ui/run-pass/issues/auxiliary/issue-2380.rs | 25 - .../ui/run-pass/issues/auxiliary/issue-2414-a.rs | 22 - .../ui/run-pass/issues/auxiliary/issue-2414-b.rs | 15 - .../ui/run-pass/issues/auxiliary/issue-25185-1.rs | 18 - .../ui/run-pass/issues/auxiliary/issue-25185-2.rs | 13 - .../ui/run-pass/issues/auxiliary/issue-2526.rs | 54 - .../ui/run-pass/issues/auxiliary/issue-25467.rs | 20 - .../ui/run-pass/issues/auxiliary/issue-2631-a.rs | 24 - .../ui/run-pass/issues/auxiliary/issue-29485.rs | 26 - .../ui/run-pass/issues/auxiliary/issue-3012-1.rs | 30 - .../ui/run-pass/issues/auxiliary/issue-36954.rs | 18 - .../ui/run-pass/issues/auxiliary/issue-41394.rs | 26 - .../ui/run-pass/issues/auxiliary/issue-4208-cc.rs | 20 - .../ui/run-pass/issues/auxiliary/issue-4545.rs | 12 - .../run-pass/issues/auxiliary/issue-48984-aux.rs | 16 - .../ui/run-pass/issues/auxiliary/issue-5518.rs | 14 - .../ui/run-pass/issues/auxiliary/issue-5521.rs | 14 - .../ui/run-pass/issues/auxiliary/issue-7178.rs | 17 - .../ui/run-pass/issues/auxiliary/issue-7899.rs | 11 - .../ui/run-pass/issues/auxiliary/issue-8044.rs | 25 - .../ui/run-pass/issues/auxiliary/issue-8259.rs | 15 - .../ui/run-pass/issues/auxiliary/issue-9906.rs | 25 - .../ui/run-pass/issues/auxiliary/issue-9968.rs | 32 - .../ui/run-pass/issues/auxiliary/issue13507.rs | 97 - .../ui/run-pass/issues/auxiliary/issue2170lib.rs | 28 - .../ui/run-pass/issues/auxiliary/issue34796aux.rs | 30 - .../run-pass/issues/auxiliary/issue_10031_aux.rs | 11 - .../ui/run-pass/issues/auxiliary/issue_12612_1.rs | 13 - .../ui/run-pass/issues/auxiliary/issue_12612_2.rs | 11 - .../ui/run-pass/issues/auxiliary/issue_19293.rs | 14 - .../ui/run-pass/issues/auxiliary/issue_20389.rs | 14 - .../ui/run-pass/issues/auxiliary/issue_2316_a.rs | 13 - .../ui/run-pass/issues/auxiliary/issue_2316_b.rs | 21 - .../ui/run-pass/issues/auxiliary/issue_2472_b.rs | 24 - .../ui/run-pass/issues/auxiliary/issue_2723_a.rs | 14 - .../ui/run-pass/issues/auxiliary/issue_3136_a.rc | 13 - .../ui/run-pass/issues/auxiliary/issue_3136_a.rs | 24 - .../ui/run-pass/issues/auxiliary/issue_38190.rs | 12 - .../run-pass/issues/auxiliary/issue_38226_aux.rs | 33 - .../issues/auxiliary/issue_38715-modern.rs | 17 - .../ui/run-pass/issues/auxiliary/issue_38715.rs | 17 - .../run-pass/issues/auxiliary/issue_3979_traits.rs | 25 - .../ui/run-pass/issues/auxiliary/issue_39823.rs | 17 - .../ui/run-pass/issues/auxiliary/issue_40469.rs | 11 - .../ui/run-pass/issues/auxiliary/issue_41053.rs | 11 - .../ui/run-pass/issues/auxiliary/issue_42007_s.rs | 14 - .../ui/run-pass/issues/auxiliary/issue_8401.rs | 26 - .../ui/run-pass/issues/auxiliary/issue_9123.rs | 19 - .../ui/run-pass/issues/auxiliary/issue_9155.rs | 17 - .../ui/run-pass/issues/auxiliary/issue_9188.rs | 23 - src/test/ui/run-pass/issues/issue-10025.rs | 20 - src/test/ui/run-pass/issues/issue-10028.rs | 30 - src/test/ui/run-pass/issues/issue-10031.rs | 19 - src/test/ui/run-pass/issues/issue-10228.rs | 28 - src/test/ui/run-pass/issues/issue-10392.rs | 39 - src/test/ui/run-pass/issues/issue-10396.rs | 23 - src/test/ui/run-pass/issues/issue-10436.rs | 21 - src/test/ui/run-pass/issues/issue-10456.rs | 35 - src/test/ui/run-pass/issues/issue-10626.rs | 36 - src/test/ui/run-pass/issues/issue-10638.rs | 21 - src/test/ui/run-pass/issues/issue-10682.rs | 25 - src/test/ui/run-pass/issues/issue-10683.rs | 21 - src/test/ui/run-pass/issues/issue-10718.rs | 21 - src/test/ui/run-pass/issues/issue-10734.rs | 46 - src/test/ui/run-pass/issues/issue-10763.rs | 16 - src/test/ui/run-pass/issues/issue-10764.rs | 14 - src/test/ui/run-pass/issues/issue-10767.rs | 20 - src/test/ui/run-pass/issues/issue-10802.rs | 55 - src/test/ui/run-pass/issues/issue-10806.rs | 47 - src/test/ui/run-pass/issues/issue-10853.rs | 25 - src/test/ui/run-pass/issues/issue-10902.rs | 30 - src/test/ui/run-pass/issues/issue-11047.rs | 36 - src/test/ui/run-pass/issues/issue-11085.rs | 55 - src/test/ui/run-pass/issues/issue-1112.rs | 46 - src/test/ui/run-pass/issues/issue-11205.rs | 95 - src/test/ui/run-pass/issues/issue-11224.rs | 18 - src/test/ui/run-pass/issues/issue-11225-1.rs | 21 - src/test/ui/run-pass/issues/issue-11225-2.rs | 21 - src/test/ui/run-pass/issues/issue-11225-3.rs | 21 - src/test/ui/run-pass/issues/issue-11267.rs | 29 - src/test/ui/run-pass/issues/issue-11382.rs | 14 - src/test/ui/run-pass/issues/issue-11384.rs | 20 - src/test/ui/run-pass/issues/issue-11508.rs | 21 - src/test/ui/run-pass/issues/issue-11529.rs | 21 - src/test/ui/run-pass/issues/issue-11552.rs | 32 - src/test/ui/run-pass/issues/issue-11577.rs | 28 - src/test/ui/run-pass/issues/issue-11592.rs | 21 - src/test/ui/run-pass/issues/issue-11612.rs | 33 - src/test/ui/run-pass/issues/issue-11677.rs | 32 - src/test/ui/run-pass/issues/issue-11709.rs | 47 - src/test/ui/run-pass/issues/issue-11820.rs | 22 - src/test/ui/run-pass/issues/issue-11869.rs | 26 - src/test/ui/run-pass/issues/issue-11940.rs | 21 - src/test/ui/run-pass/issues/issue-11958.rs | 20 - src/test/ui/run-pass/issues/issue-12033.rs | 17 - src/test/ui/run-pass/issues/issue-12133-1.rs | 20 - src/test/ui/run-pass/issues/issue-12133-2.rs | 21 - src/test/ui/run-pass/issues/issue-12133-3.rs | 23 - src/test/ui/run-pass/issues/issue-12285.rs | 24 - src/test/ui/run-pass/issues/issue-1251.rs | 27 - src/test/ui/run-pass/issues/issue-1257.rs | 21 - src/test/ui/run-pass/issues/issue-12582.rs | 31 - src/test/ui/run-pass/issues/issue-12612.rs | 24 - src/test/ui/run-pass/issues/issue-12660.rs | 24 - src/test/ui/run-pass/issues/issue-12677.rs | 19 - src/test/ui/run-pass/issues/issue-12699.rs | 19 - src/test/ui/run-pass/issues/issue-12729.rs | 23 - src/test/ui/run-pass/issues/issue-12744.rs | 15 - src/test/ui/run-pass/issues/issue-12860.rs | 59 - src/test/ui/run-pass/issues/issue-12909.rs | 29 - src/test/ui/run-pass/issues/issue-13027.rs | 188 - src/test/ui/run-pass/issues/issue-13105.rs | 19 - src/test/ui/run-pass/issues/issue-13167.rs | 32 - src/test/ui/run-pass/issues/issue-13204.rs | 34 - src/test/ui/run-pass/issues/issue-13214.rs | 32 - .../issues/issue-13259-windows-tcb-trash.rs | 52 - src/test/ui/run-pass/issues/issue-13264.rs | 84 - src/test/ui/run-pass/issues/issue-13304.rs | 48 - src/test/ui/run-pass/issues/issue-13323.rs | 69 - src/test/ui/run-pass/issues/issue-13405.rs | 28 - src/test/ui/run-pass/issues/issue-13434.rs | 31 - src/test/ui/run-pass/issues/issue-13494.rs | 43 - src/test/ui/run-pass/issues/issue-13507-2.rs | 45 - src/test/ui/run-pass/issues/issue-13620.rs | 21 - src/test/ui/run-pass/issues/issue-13655.rs | 42 - src/test/ui/run-pass/issues/issue-13665.rs | 25 - src/test/ui/run-pass/issues/issue-13703.rs | 16 - src/test/ui/run-pass/issues/issue-13763.rs | 24 - src/test/ui/run-pass/issues/issue-13775.rs | 19 - src/test/ui/run-pass/issues/issue-13808.rs | 26 - src/test/ui/run-pass/issues/issue-13837.rs | 22 - src/test/ui/run-pass/issues/issue-13867.rs | 59 - src/test/ui/run-pass/issues/issue-13872.rs | 22 - src/test/ui/run-pass/issues/issue-13902.rs | 25 - src/test/ui/run-pass/issues/issue-14082.rs | 30 - src/test/ui/run-pass/issues/issue-14229.rs | 31 - src/test/ui/run-pass/issues/issue-14254.rs | 103 - src/test/ui/run-pass/issues/issue-14308.rs | 25 - src/test/ui/run-pass/issues/issue-14330.rs | 16 - src/test/ui/run-pass/issues/issue-14344.rs | 21 - src/test/ui/run-pass/issues/issue-14382.rs | 25 - src/test/ui/run-pass/issues/issue-14393.rs | 20 - src/test/ui/run-pass/issues/issue-14399.rs | 30 - src/test/ui/run-pass/issues/issue-14421.rs | 26 - src/test/ui/run-pass/issues/issue-14422.rs | 26 - src/test/ui/run-pass/issues/issue-14456.rs | 46 - src/test/ui/run-pass/issues/issue-1451.rs | 36 - src/test/ui/run-pass/issues/issue-14589.rs | 34 - src/test/ui/run-pass/issues/issue-1460.rs | 17 - src/test/ui/run-pass/issues/issue-14821.rs | 29 - src/test/ui/run-pass/issues/issue-14837.rs | 21 - src/test/ui/run-pass/issues/issue-14865.rs | 32 - src/test/ui/run-pass/issues/issue-14875.rs | 45 - src/test/ui/run-pass/issues/issue-14901.rs | 28 - src/test/ui/run-pass/issues/issue-14919.rs | 63 - src/test/ui/run-pass/issues/issue-14933.rs | 16 - src/test/ui/run-pass/issues/issue-14936.rs | 57 - src/test/ui/run-pass/issues/issue-14940.rs | 29 - src/test/ui/run-pass/issues/issue-14958.rs | 41 - src/test/ui/run-pass/issues/issue-14959.rs | 65 - src/test/ui/run-pass/issues/issue-15043.rs | 24 - src/test/ui/run-pass/issues/issue-15063.rs | 20 - src/test/ui/run-pass/issues/issue-15080.rs | 33 - src/test/ui/run-pass/issues/issue-15104.rs | 24 - src/test/ui/run-pass/issues/issue-15108.rs | 14 - src/test/ui/run-pass/issues/issue-15129.rs | 35 - src/test/ui/run-pass/issues/issue-15155.rs | 31 - src/test/ui/run-pass/issues/issue-15189.rs | 20 - src/test/ui/run-pass/issues/issue-15221.rs | 25 - src/test/ui/run-pass/issues/issue-15261.rs | 20 - src/test/ui/run-pass/issues/issue-15444.rs | 33 - src/test/ui/run-pass/issues/issue-15487.rs | 22 - src/test/ui/run-pass/issues/issue-15523-big.rs | 49 - src/test/ui/run-pass/issues/issue-15523.rs | 52 - src/test/ui/run-pass/issues/issue-15562.rs | 29 - src/test/ui/run-pass/issues/issue-15571.rs | 68 - src/test/ui/run-pass/issues/issue-15673.rs | 19 - src/test/ui/run-pass/issues/issue-15689-1.rs | 20 - src/test/ui/run-pass/issues/issue-15689-2.rs | 19 - src/test/ui/run-pass/issues/issue-15730.rs | 17 - src/test/ui/run-pass/issues/issue-15734.rs | 68 - src/test/ui/run-pass/issues/issue-15735.rs | 26 - src/test/ui/run-pass/issues/issue-15763.rs | 98 - src/test/ui/run-pass/issues/issue-15774.rs | 35 - src/test/ui/run-pass/issues/issue-15793.rs | 36 - src/test/ui/run-pass/issues/issue-15858.rs | 43 - .../issues/issue-15881-model-lexer-dotdotdot.rs | 47 - src/test/ui/run-pass/issues/issue-16151.rs | 39 - src/test/ui/run-pass/issues/issue-16256.rs | 17 - src/test/ui/run-pass/issues/issue-16272.rs | 33 - src/test/ui/run-pass/issues/issue-16278.rs | 21 - src/test/ui/run-pass/issues/issue-16441.rs | 20 - src/test/ui/run-pass/issues/issue-16452.rs | 19 - src/test/ui/run-pass/issues/issue-16492.rs | 77 - src/test/ui/run-pass/issues/issue-16530.rs | 25 - src/test/ui/run-pass/issues/issue-16560.rs | 27 - src/test/ui/run-pass/issues/issue-16596.rs | 31 - src/test/ui/run-pass/issues/issue-16597-empty.rs | 15 - src/test/ui/run-pass/issues/issue-16597.rs | 19 - src/test/ui/run-pass/issues/issue-1660.rs | 18 - src/test/ui/run-pass/issues/issue-16602-1.rs | 16 - src/test/ui/run-pass/issues/issue-16602-2.rs | 22 - src/test/ui/run-pass/issues/issue-16602-3.rs | 35 - src/test/ui/run-pass/issues/issue-16643.rs | 20 - src/test/ui/run-pass/issues/issue-16648.rs | 21 - src/test/ui/run-pass/issues/issue-16668.rs | 29 - src/test/ui/run-pass/issues/issue-16671.rs | 23 - src/test/ui/run-pass/issues/issue-16739.rs | 60 - src/test/ui/run-pass/issues/issue-16745.rs | 21 - src/test/ui/run-pass/issues/issue-16774.rs | 56 - src/test/ui/run-pass/issues/issue-16783.rs | 17 - src/test/ui/run-pass/issues/issue-16819.rs | 21 - src/test/ui/run-pass/issues/issue-16922.rs | 21 - src/test/ui/run-pass/issues/issue-1696.rs | 18 - src/test/ui/run-pass/issues/issue-1701.rs | 35 - src/test/ui/run-pass/issues/issue-17068.rs | 22 - src/test/ui/run-pass/issues/issue-17074.rs | 24 - src/test/ui/run-pass/issues/issue-17121.rs | 41 - src/test/ui/run-pass/issues/issue-17170.rs | 21 - src/test/ui/run-pass/issues/issue-17216.rs | 30 - src/test/ui/run-pass/issues/issue-17233.rs | 27 - src/test/ui/run-pass/issues/issue-17302.rs | 36 - src/test/ui/run-pass/issues/issue-17322.rs | 25 - src/test/ui/run-pass/issues/issue-17336.rs | 18 - src/test/ui/run-pass/issues/issue-17351.rs | 20 - src/test/ui/run-pass/issues/issue-17361.rs | 19 - src/test/ui/run-pass/issues/issue-17450.rs | 17 - src/test/ui/run-pass/issues/issue-17503.rs | 20 - src/test/ui/run-pass/issues/issue-17662.rs | 27 - .../run-pass/issues/issue-17718-borrow-interior.rs | 28 - .../issues/issue-17718-const-destructors.rs | 19 - .../ui/run-pass/issues/issue-17718-parse-const.rs | 17 - .../issues/issue-17718-static-unsafe-interior.rs | 59 - src/test/ui/run-pass/issues/issue-17718.rs | 84 - src/test/ui/run-pass/issues/issue-17732.rs | 21 - src/test/ui/run-pass/issues/issue-17734.rs | 25 - src/test/ui/run-pass/issues/issue-17746.rs | 34 - src/test/ui/run-pass/issues/issue-17756.rs | 17 - src/test/ui/run-pass/issues/issue-17771.rs | 30 - src/test/ui/run-pass/issues/issue-17816.rs | 19 - src/test/ui/run-pass/issues/issue-17877.rs | 24 - src/test/ui/run-pass/issues/issue-17897.rs | 18 - src/test/ui/run-pass/issues/issue-17904.rs | 23 - src/test/ui/run-pass/issues/issue-18060.rs | 18 - src/test/ui/run-pass/issues/issue-18075.rs | 17 - src/test/ui/run-pass/issues/issue-18083.rs | 33 - src/test/ui/run-pass/issues/issue-18088.rs | 18 - src/test/ui/run-pass/issues/issue-18110.rs | 16 - src/test/ui/run-pass/issues/issue-18173.rs | 22 - src/test/ui/run-pass/issues/issue-18188.rs | 32 - src/test/ui/run-pass/issues/issue-1821.rs | 22 - src/test/ui/run-pass/issues/issue-18232.rs | 32 - src/test/ui/run-pass/issues/issue-18352.rs | 24 - src/test/ui/run-pass/issues/issue-18353.rs | 24 - src/test/ui/run-pass/issues/issue-18412.rs | 36 - src/test/ui/run-pass/issues/issue-18425.rs | 19 - src/test/ui/run-pass/issues/issue-18446.rs | 22 - src/test/ui/run-pass/issues/issue-18464.rs | 22 - src/test/ui/run-pass/issues/issue-18501.rs | 23 - src/test/ui/run-pass/issues/issue-18514.rs | 26 - src/test/ui/run-pass/issues/issue-18539.rs | 26 - src/test/ui/run-pass/issues/issue-18652.rs | 20 - src/test/ui/run-pass/issues/issue-18655.rs | 32 - src/test/ui/run-pass/issues/issue-1866.rs | 36 - src/test/ui/run-pass/issues/issue-18661.rs | 29 - src/test/ui/run-pass/issues/issue-18685.rs | 31 - src/test/ui/run-pass/issues/issue-18711.rs | 22 - src/test/ui/run-pass/issues/issue-18738.rs | 26 - src/test/ui/run-pass/issues/issue-18767.rs | 20 - .../run-pass/issues/issue-18804/auxiliary/lib.rs | 20 - src/test/ui/run-pass/issues/issue-18804/main.rs | 24 - src/test/ui/run-pass/issues/issue-18809.rs | 22 - src/test/ui/run-pass/issues/issue-18845.rs | 26 - src/test/ui/run-pass/issues/issue-18859.rs | 26 - src/test/ui/run-pass/issues/issue-18906.rs | 39 - src/test/ui/run-pass/issues/issue-18913.rs | 19 - src/test/ui/run-pass/issues/issue-18937-1.rs | 31 - src/test/ui/run-pass/issues/issue-18988.rs | 20 - src/test/ui/run-pass/issues/issue-19001.rs | 20 - src/test/ui/run-pass/issues/issue-19037.rs | 29 - src/test/ui/run-pass/issues/issue-19081.rs | 24 - src/test/ui/run-pass/issues/issue-19097.rs | 23 - src/test/ui/run-pass/issues/issue-19098.rs | 22 - src/test/ui/run-pass/issues/issue-19102.rs | 21 - src/test/ui/run-pass/issues/issue-19127.rs | 19 - src/test/ui/run-pass/issues/issue-19129-1.rs | 26 - src/test/ui/run-pass/issues/issue-19129-2.rs | 20 - src/test/ui/run-pass/issues/issue-19135.rs | 23 - src/test/ui/run-pass/issues/issue-19244.rs | 44 - src/test/ui/run-pass/issues/issue-19293.rs | 20 - src/test/ui/run-pass/issues/issue-19340-1.rs | 26 - src/test/ui/run-pass/issues/issue-19340-2.rs | 33 - src/test/ui/run-pass/issues/issue-19358.rs | 30 - src/test/ui/run-pass/issues/issue-19367.rs | 42 - src/test/ui/run-pass/issues/issue-19398.rs | 22 - src/test/ui/run-pass/issues/issue-19404.rs | 45 - src/test/ui/run-pass/issues/issue-19479.rs | 29 - src/test/ui/run-pass/issues/issue-19499.rs | 23 - src/test/ui/run-pass/issues/issue-19631.rs | 25 - src/test/ui/run-pass/issues/issue-19632.rs | 23 - src/test/ui/run-pass/issues/issue-1974.rs | 21 - .../run-pass/issues/issue-19811-escape-unicode.rs | 19 - src/test/ui/run-pass/issues/issue-19850.rs | 31 - src/test/ui/run-pass/issues/issue-19982.rs | 33 - src/test/ui/run-pass/issues/issue-20009.rs | 23 - .../ui/run-pass/issues/issue-20055-box-trait.rs | 51 - .../issues/issue-20055-box-unsized-array.rs | 39 - src/test/ui/run-pass/issues/issue-20091.rs | 34 - src/test/ui/run-pass/issues/issue-20174.rs | 17 - src/test/ui/run-pass/issues/issue-20186.rs | 24 - src/test/ui/run-pass/issues/issue-20313.rs | 22 - src/test/ui/run-pass/issues/issue-20343.rs | 41 - src/test/ui/run-pass/issues/issue-20389.rs | 24 - src/test/ui/run-pass/issues/issue-20396.rs | 26 - src/test/ui/run-pass/issues/issue-20414.rs | 30 - src/test/ui/run-pass/issues/issue-20427.rs | 95 - src/test/ui/run-pass/issues/issue-20454.rs | 22 - src/test/ui/run-pass/issues/issue-20544.rs | 28 - src/test/ui/run-pass/issues/issue-20575.rs | 20 - src/test/ui/run-pass/issues/issue-20616.rs | 53 - src/test/ui/run-pass/issues/issue-2063-resource.rs | 23 - src/test/ui/run-pass/issues/issue-2063.rs | 32 - src/test/ui/run-pass/issues/issue-20644.rs | 43 - src/test/ui/run-pass/issues/issue-20676.rs | 22 - src/test/ui/run-pass/issues/issue-2074.rs | 26 - src/test/ui/run-pass/issues/issue-20763-1.rs | 38 - src/test/ui/run-pass/issues/issue-20763-2.rs | 33 - src/test/ui/run-pass/issues/issue-20797.rs | 104 - src/test/ui/run-pass/issues/issue-20803.rs | 20 - src/test/ui/run-pass/issues/issue-20823.rs | 15 - src/test/ui/run-pass/issues/issue-20825.rs | 20 - src/test/ui/run-pass/issues/issue-20847.rs | 22 - src/test/ui/run-pass/issues/issue-20953.rs | 20 - src/test/ui/run-pass/issues/issue-21033.rs | 57 - src/test/ui/run-pass/issues/issue-21058.rs | 31 - src/test/ui/run-pass/issues/issue-21140.rs | 16 - src/test/ui/run-pass/issues/issue-21174.rs | 21 - src/test/ui/run-pass/issues/issue-21245.rs | 65 - src/test/ui/run-pass/issues/issue-21291.rs | 20 - src/test/ui/run-pass/issues/issue-21306.rs | 19 - src/test/ui/run-pass/issues/issue-21361.rs | 21 - src/test/ui/run-pass/issues/issue-21363.rs | 25 - src/test/ui/run-pass/issues/issue-21384.rs | 31 - src/test/ui/run-pass/issues/issue-21400.rs | 67 - src/test/ui/run-pass/issues/issue-21402.rs | 21 - src/test/ui/run-pass/issues/issue-21475.rs | 28 - src/test/ui/run-pass/issues/issue-21486.rs | 86 - src/test/ui/run-pass/issues/issue-21520.rs | 31 - src/test/ui/run-pass/issues/issue-21562.rs | 28 - src/test/ui/run-pass/issues/issue-21622.rs | 29 - src/test/ui/run-pass/issues/issue-21634.rs | 30 - src/test/ui/run-pass/issues/issue-21655.rs | 22 - src/test/ui/run-pass/issues/issue-21721.rs | 19 - src/test/ui/run-pass/issues/issue-21726.rs | 47 - src/test/ui/run-pass/issues/issue-21891.rs | 21 - src/test/ui/run-pass/issues/issue-2190-1.rs | 35 - src/test/ui/run-pass/issues/issue-21909.rs | 25 - src/test/ui/run-pass/issues/issue-21922.rs | 27 - src/test/ui/run-pass/issues/issue-22008.rs | 19 - src/test/ui/run-pass/issues/issue-22036.rs | 35 - src/test/ui/run-pass/issues/issue-22066.rs | 22 - src/test/ui/run-pass/issues/issue-2214.rs | 51 - src/test/ui/run-pass/issues/issue-2216.rs | 33 - src/test/ui/run-pass/issues/issue-22258.rs | 20 - src/test/ui/run-pass/issues/issue-22346.rs | 20 - src/test/ui/run-pass/issues/issue-22356.rs | 44 - src/test/ui/run-pass/issues/issue-22375.rs | 14 - src/test/ui/run-pass/issues/issue-22403.rs | 16 - src/test/ui/run-pass/issues/issue-22426.rs | 19 - src/test/ui/run-pass/issues/issue-22463.rs | 30 - src/test/ui/run-pass/issues/issue-22471.rs | 16 - .../issues/issue-22536-copy-mustnt-zero.rs | 38 - src/test/ui/run-pass/issues/issue-22546.rs | 61 - src/test/ui/run-pass/issues/issue-22577.rs | 36 - src/test/ui/run-pass/issues/issue-22629.rs | 23 - src/test/ui/run-pass/issues/issue-22777.rs | 58 - src/test/ui/run-pass/issues/issue-22781.rs | 24 - src/test/ui/run-pass/issues/issue-22814.rs | 23 - src/test/ui/run-pass/issues/issue-22828.rs | 32 - src/test/ui/run-pass/issues/issue-2284.rs | 23 - src/test/ui/run-pass/issues/issue-22864-1.rs | 17 - src/test/ui/run-pass/issues/issue-22864-2.rs | 17 - src/test/ui/run-pass/issues/issue-2288.rs | 45 - src/test/ui/run-pass/issues/issue-22894.rs | 14 - src/test/ui/run-pass/issues/issue-22992-2.rs | 28 - src/test/ui/run-pass/issues/issue-22992.rs | 86 - src/test/ui/run-pass/issues/issue-23036.rs | 21 - src/test/ui/run-pass/issues/issue-2311-2.rs | 35 - src/test/ui/run-pass/issues/issue-2311.rs | 21 - src/test/ui/run-pass/issues/issue-2312.rs | 25 - src/test/ui/run-pass/issues/issue-2316-c.rs | 22 - src/test/ui/run-pass/issues/issue-23208.rs | 36 - src/test/ui/run-pass/issues/issue-23261.rs | 71 - src/test/ui/run-pass/issues/issue-23304-1.rs | 35 - src/test/ui/run-pass/issues/issue-23304-2.rs | 23 - src/test/ui/run-pass/issues/issue-23311.rs | 22 - src/test/ui/run-pass/issues/issue-23336.rs | 21 - .../issues/issue-23338-ensure-param-drop-order.rs | 174 - .../issue-23338-params-outlive-temps-of-body.rs | 40 - src/test/ui/run-pass/issues/issue-23406.rs | 24 - src/test/ui/run-pass/issues/issue-23433.rs | 23 - src/test/ui/run-pass/issues/issue-23442.rs | 32 - src/test/ui/run-pass/issues/issue-23477.rs | 25 - src/test/ui/run-pass/issues/issue-23485.rs | 59 - src/test/ui/run-pass/issues/issue-23491.rs | 18 - src/test/ui/run-pass/issues/issue-23550.rs | 32 - .../issues/issue-23611-enum-swap-in-drop.rs | 268 -- src/test/ui/run-pass/issues/issue-23649-1.rs | 22 - src/test/ui/run-pass/issues/issue-23649-2.rs | 21 - src/test/ui/run-pass/issues/issue-23649-3.rs | 15 - src/test/ui/run-pass/issues/issue-23699.rs | 24 - src/test/ui/run-pass/issues/issue-23781.rs | 39 - src/test/ui/run-pass/issues/issue-2380-b.rs | 20 - src/test/ui/run-pass/issues/issue-23808.rs | 68 - src/test/ui/run-pass/issues/issue-23825.rs | 31 - src/test/ui/run-pass/issues/issue-2383.rs | 19 - src/test/ui/run-pass/issues/issue-23833.rs | 26 - src/test/ui/run-pass/issues/issue-23891.rs | 21 - src/test/ui/run-pass/issues/issue-23898.rs | 20 - src/test/ui/run-pass/issues/issue-23958.rs | 23 - .../issues/issue-23968-const-not-overflow.rs | 22 - src/test/ui/run-pass/issues/issue-23992.rs | 29 - src/test/ui/run-pass/issues/issue-24085.rs | 28 - src/test/ui/run-pass/issues/issue-24086.rs | 30 - src/test/ui/run-pass/issues/issue-2414-c.rs | 19 - src/test/ui/run-pass/issues/issue-24161.rs | 20 - src/test/ui/run-pass/issues/issue-24227.rs | 28 - src/test/ui/run-pass/issues/issue-2428.rs | 24 - src/test/ui/run-pass/issues/issue-24308.rs | 27 - src/test/ui/run-pass/issues/issue-24313.rs | 43 - src/test/ui/run-pass/issues/issue-24353.rs | 17 - src/test/ui/run-pass/issues/issue-24389.rs | 21 - src/test/ui/run-pass/issues/issue-24434.rs | 17 - src/test/ui/run-pass/issues/issue-2445-b.rs | 40 - src/test/ui/run-pass/issues/issue-2445.rs | 38 - src/test/ui/run-pass/issues/issue-24533.rs | 33 - ...ue-24535-allow-mutable-borrow-in-match-guard.rs | 69 - src/test/ui/run-pass/issues/issue-24589.rs | 27 - src/test/ui/run-pass/issues/issue-2463.rs | 34 - src/test/ui/run-pass/issues/issue-2472.rs | 24 - src/test/ui/run-pass/issues/issue-24779.rs | 14 - .../run-pass/issues/issue-24805-dropck-itemless.rs | 89 - src/test/ui/run-pass/issues/issue-2487-a.rs | 41 - .../issues/issue-24945-repeat-dash-opts.rs | 19 - src/test/ui/run-pass/issues/issue-24947.rs | 35 - src/test/ui/run-pass/issues/issue-24954.rs | 23 - src/test/ui/run-pass/issues/issue-2502.rs | 33 - src/test/ui/run-pass/issues/issue-25089.rs | 43 - src/test/ui/run-pass/issues/issue-25145.rs | 23 - src/test/ui/run-pass/issues/issue-25180.rs | 16 - src/test/ui/run-pass/issues/issue-25185.rs | 23 - src/test/ui/run-pass/issues/issue-2526-a.rs | 21 - src/test/ui/run-pass/issues/issue-25279.rs | 26 - src/test/ui/run-pass/issues/issue-25339.rs | 39 - src/test/ui/run-pass/issues/issue-25343.rs | 32 - src/test/ui/run-pass/issues/issue-25394.rs | 15 - src/test/ui/run-pass/issues/issue-25467.rs | 21 - src/test/ui/run-pass/issues/issue-25497.rs | 29 - src/test/ui/run-pass/issues/issue-2550.rs | 31 - src/test/ui/run-pass/issues/issue-25515.rs | 30 - .../run-pass/issues/issue-25549-multiple-drop.rs | 42 - src/test/ui/run-pass/issues/issue-25679.rs | 29 - src/test/ui/run-pass/issues/issue-25693.rs | 31 - src/test/ui/run-pass/issues/issue-25700-1.rs | 23 - src/test/ui/run-pass/issues/issue-25700-2.rs | 32 - .../run-pass/issues/issue-25746-bool-transmute.rs | 21 - src/test/ui/run-pass/issues/issue-25757.rs | 28 - src/test/ui/run-pass/issues/issue-25810.rs | 38 - src/test/ui/run-pass/issues/issue-25916.rs | 36 - src/test/ui/run-pass/issues/issue-26095.rs | 32 - src/test/ui/run-pass/issues/issue-2611-3.rs | 28 - src/test/ui/run-pass/issues/issue-26127.rs | 22 - src/test/ui/run-pass/issues/issue-26205.rs | 40 - src/test/ui/run-pass/issues/issue-26251.rs | 23 - src/test/ui/run-pass/issues/issue-2631-b.rs | 27 - src/test/ui/run-pass/issues/issue-26322.rs | 40 - src/test/ui/run-pass/issues/issue-2633-2.rs | 24 - src/test/ui/run-pass/issues/issue-2633.rs | 40 - src/test/ui/run-pass/issues/issue-2642.rs | 19 - src/test/ui/run-pass/issues/issue-26468.rs | 39 - src/test/ui/run-pass/issues/issue-26484.rs | 21 - src/test/ui/run-pass/issues/issue-26641.rs | 16 - src/test/ui/run-pass/issues/issue-26646.rs | 22 - src/test/ui/run-pass/issues/issue-26655.rs | 35 - src/test/ui/run-pass/issues/issue-26709.rs | 27 - src/test/ui/run-pass/issues/issue-26802.rs | 24 - src/test/ui/run-pass/issues/issue-26805.rs | 16 - .../ui/run-pass/issues/issue-26873-multifile.rs | 18 - src/test/ui/run-pass/issues/issue-26873-onefile.rs | 34 - src/test/ui/run-pass/issues/issue-26905.rs | 32 - src/test/ui/run-pass/issues/issue-26996.rs | 20 - src/test/ui/run-pass/issues/issue-26997.rs | 23 - src/test/ui/run-pass/issues/issue-27021.rs | 22 - .../issues/issue-27054-primitive-binary-ops.rs | 15 - src/test/ui/run-pass/issues/issue-27060.rs | 43 - src/test/ui/run-pass/issues/issue-2708.rs | 39 - src/test/ui/run-pass/issues/issue-27105.rs | 25 - src/test/ui/run-pass/issues/issue-2718.rs | 334 -- src/test/ui/run-pass/issues/issue-2723-b.rs | 21 - src/test/ui/run-pass/issues/issue-27240.rs | 34 - src/test/ui/run-pass/issues/issue-27268.rs | 14 - src/test/ui/run-pass/issues/issue-27281.rs | 27 - src/test/ui/run-pass/issues/issue-27320.rs | 25 - src/test/ui/run-pass/issues/issue-2734.rs | 33 - src/test/ui/run-pass/issues/issue-2735-2.rs | 37 - src/test/ui/run-pass/issues/issue-2735-3.rs | 37 - src/test/ui/run-pass/issues/issue-2735.rs | 33 - .../run-pass/issues/issue-27401-dropflag-reinit.rs | 37 - src/test/ui/run-pass/issues/issue-2748-a.rs | 26 - src/test/ui/run-pass/issues/issue-2748-b.rs | 21 - src/test/ui/run-pass/issues/issue-27583.rs | 57 - src/test/ui/run-pass/issues/issue-27639.rs | 20 - src/test/ui/run-pass/issues/issue-27859.rs | 31 - src/test/ui/run-pass/issues/issue-27889.rs | 31 - src/test/ui/run-pass/issues/issue-27890.rs | 17 - src/test/ui/run-pass/issues/issue-27901.rs | 21 - src/test/ui/run-pass/issues/issue-27997.rs | 47 - src/test/ui/run-pass/issues/issue-2804-2.rs | 21 - src/test/ui/run-pass/issues/issue-28181.rs | 16 - src/test/ui/run-pass/issues/issue-28279.rs | 30 - src/test/ui/run-pass/issues/issue-28550.rs | 26 - src/test/ui/run-pass/issues/issue-28561.rs | 121 - src/test/ui/run-pass/issues/issue-28600.rs | 24 - src/test/ui/run-pass/issues/issue-28676.rs | 44 - src/test/ui/run-pass/issues/issue-28777.rs | 31 - src/test/ui/run-pass/issues/issue-28822.rs | 17 - src/test/ui/run-pass/issues/issue-28828.rs | 28 - src/test/ui/run-pass/issues/issue-28839.rs | 25 - src/test/ui/run-pass/issues/issue-28871.rs | 34 - src/test/ui/run-pass/issues/issue-28936.rs | 37 - src/test/ui/run-pass/issues/issue-2895.rs | 37 - src/test/ui/run-pass/issues/issue-28950.rs | 32 - src/test/ui/run-pass/issues/issue-28983.rs | 32 - src/test/ui/run-pass/issues/issue-28999.rs | 21 - src/test/ui/run-pass/issues/issue-29030.rs | 18 - src/test/ui/run-pass/issues/issue-29037.rs | 33 - src/test/ui/run-pass/issues/issue-2904.rs | 86 - src/test/ui/run-pass/issues/issue-29048.rs | 22 - src/test/ui/run-pass/issues/issue-29053.rs | 22 - src/test/ui/run-pass/issues/issue-29071-2.rs | 41 - src/test/ui/run-pass/issues/issue-29071.rs | 25 - src/test/ui/run-pass/issues/issue-29092.rs | 36 - src/test/ui/run-pass/issues/issue-29147.rs | 37 - src/test/ui/run-pass/issues/issue-29166.rs | 31 - src/test/ui/run-pass/issues/issue-29227.rs | 152 - src/test/ui/run-pass/issues/issue-29276.rs | 14 - src/test/ui/run-pass/issues/issue-2935.rs | 38 - src/test/ui/run-pass/issues/issue-2936.rs | 41 - src/test/ui/run-pass/issues/issue-29466.rs | 3608 -------------------- src/test/ui/run-pass/issues/issue-29485.rs | 27 - src/test/ui/run-pass/issues/issue-29488.rs | 33 - src/test/ui/run-pass/issues/issue-29516.rs | 29 - src/test/ui/run-pass/issues/issue-29522.rs | 26 - src/test/ui/run-pass/issues/issue-29540.rs | 502 --- src/test/ui/run-pass/issues/issue-29663.rs | 66 - src/test/ui/run-pass/issues/issue-29668.rs | 26 - src/test/ui/run-pass/issues/issue-29710.rs | 21 - src/test/ui/run-pass/issues/issue-29740.rs | 326 -- src/test/ui/run-pass/issues/issue-29746.rs | 46 - src/test/ui/run-pass/issues/issue-29844.rs | 34 - src/test/ui/run-pass/issues/issue-2989.rs | 46 - src/test/ui/run-pass/issues/issue-29914-2.rs | 16 - src/test/ui/run-pass/issues/issue-29914-3.rs | 17 - src/test/ui/run-pass/issues/issue-29914.rs | 20 - src/test/ui/run-pass/issues/issue-29927.rs | 21 - src/test/ui/run-pass/issues/issue-29948.rs | 50 - src/test/ui/run-pass/issues/issue-30018-nopanic.rs | 112 - src/test/ui/run-pass/issues/issue-30018-panic.rs | 35 - src/test/ui/run-pass/issues/issue-30081.rs | 25 - src/test/ui/run-pass/issues/issue-3012-2.rs | 23 - src/test/ui/run-pass/issues/issue-30240.rs | 24 - src/test/ui/run-pass/issues/issue-3026.rs | 23 - src/test/ui/run-pass/issues/issue-3037.rs | 25 - src/test/ui/run-pass/issues/issue-30371.rs | 19 - src/test/ui/run-pass/issues/issue-30490.rs | 111 - src/test/ui/run-pass/issues/issue-3052.rs | 22 - src/test/ui/run-pass/issues/issue-30530.rs | 36 - src/test/ui/run-pass/issues/issue-30615.rs | 15 - src/test/ui/run-pass/issues/issue-30756.rs | 17 - src/test/ui/run-pass/issues/issue-30891.rs | 20 - src/test/ui/run-pass/issues/issue-3091.rs | 17 - src/test/ui/run-pass/issues/issue-3109.rs | 14 - src/test/ui/run-pass/issues/issue-3121.rs | 34 - src/test/ui/run-pass/issues/issue-31260.rs | 24 - .../ui/run-pass/issues/issue-31267-additional.rs | 30 - src/test/ui/run-pass/issues/issue-31267.rs | 24 - src/test/ui/run-pass/issues/issue-31299.rs | 44 - src/test/ui/run-pass/issues/issue-3149.rs | 35 - src/test/ui/run-pass/issues/issue-31597.rs | 38 - src/test/ui/run-pass/issues/issue-31702.rs | 25 - src/test/ui/run-pass/issues/issue-31776.rs | 65 - src/test/ui/run-pass/issues/issue-32008.rs | 36 - src/test/ui/run-pass/issues/issue-3211.rs | 17 - src/test/ui/run-pass/issues/issue-3220.rs | 34 - src/test/ui/run-pass/issues/issue-32292.rs | 19 - src/test/ui/run-pass/issues/issue-32324.rs | 34 - src/test/ui/run-pass/issues/issue-32389.rs | 21 - src/test/ui/run-pass/issues/issue-32518.rs | 23 - src/test/ui/run-pass/issues/issue-32805.rs | 20 - src/test/ui/run-pass/issues/issue-3290.rs | 18 - src/test/ui/run-pass/issues/issue-32947.rs | 34 - src/test/ui/run-pass/issues/issue-33096.rs | 28 - src/test/ui/run-pass/issues/issue-33185.rs | 27 - src/test/ui/run-pass/issues/issue-33187.rs | 28 - src/test/ui/run-pass/issues/issue-33202.rs | 19 - src/test/ui/run-pass/issues/issue-33264.rs | 40 - src/test/ui/run-pass/issues/issue-33287.rs | 19 - src/test/ui/run-pass/issues/issue-333.rs | 17 - src/test/ui/run-pass/issues/issue-33387.rs | 42 - src/test/ui/run-pass/issues/issue-33461.rs | 37 - src/test/ui/run-pass/issues/issue-33498.rs | 20 - src/test/ui/run-pass/issues/issue-33537.rs | 25 - src/test/ui/run-pass/issues/issue-33687.rs | 27 - src/test/ui/run-pass/issues/issue-33770.rs | 104 - src/test/ui/run-pass/issues/issue-3389.rs | 35 - src/test/ui/run-pass/issues/issue-33903.rs | 20 - src/test/ui/run-pass/issues/issue-33992.rs | 41 - src/test/ui/run-pass/issues/issue-34053.rs | 40 - src/test/ui/run-pass/issues/issue-34074.rs | 20 - src/test/ui/run-pass/issues/issue-34194.rs | 21 - src/test/ui/run-pass/issues/issue-3424.rs | 29 - src/test/ui/run-pass/issues/issue-3429.rs | 18 - src/test/ui/run-pass/issues/issue-34427.rs | 27 - src/test/ui/run-pass/issues/issue-3447.rs | 42 - src/test/ui/run-pass/issues/issue-34503.rs | 21 - src/test/ui/run-pass/issues/issue-34569.rs | 27 - src/test/ui/run-pass/issues/issue-34571.rs | 21 - src/test/ui/run-pass/issues/issue-34751.rs | 20 - src/test/ui/run-pass/issues/issue-34780.rs | 21 - src/test/ui/run-pass/issues/issue-34784.rs | 29 - src/test/ui/run-pass/issues/issue-34796.rs | 37 - src/test/ui/run-pass/issues/issue-34798.rs | 35 - src/test/ui/run-pass/issues/issue-34932.rs | 22 - src/test/ui/run-pass/issues/issue-3500.rs | 20 - src/test/ui/run-pass/issues/issue-35376.rs | 52 - src/test/ui/run-pass/issues/issue-35423.rs | 19 - src/test/ui/run-pass/issues/issue-35546.rs | 29 - src/test/ui/run-pass/issues/issue-3556.rs | 45 - src/test/ui/run-pass/issues/issue-3559.rs | 28 - src/test/ui/run-pass/issues/issue-35600.rs | 25 - src/test/ui/run-pass/issues/issue-3563-2.rs | 24 - src/test/ui/run-pass/issues/issue-3563-3.rs | 189 - src/test/ui/run-pass/issues/issue-3574.rs | 24 - src/test/ui/run-pass/issues/issue-35815.rs | 24 - src/test/ui/run-pass/issues/issue-36023.rs | 33 - .../issues/issue-36036-associated-type-layout.rs | 37 - src/test/ui/run-pass/issues/issue-36053.rs | 32 - src/test/ui/run-pass/issues/issue-36075.rs | 23 - src/test/ui/run-pass/issues/issue-3609.rs | 37 - .../issues/issue-36139-normalize-closure-sig.rs | 29 - src/test/ui/run-pass/issues/issue-36260.rs | 23 - .../run-pass/issues/issue-36278-prefix-nesting.rs | 29 - src/test/ui/run-pass/issues/issue-36381.rs | 35 - src/test/ui/run-pass/issues/issue-36401.rs | 26 - src/test/ui/run-pass/issues/issue-36474.rs | 41 - src/test/ui/run-pass/issues/issue-3656.rs | 39 - .../issues/issue-36744-bitcast-args-if-needed.rs | 33 - .../run-pass/issues/issue-36744-without-calls.rs | 23 - src/test/ui/run-pass/issues/issue-36768.rs | 19 - .../ui/run-pass/issues/issue-36786-resolve-call.rs | 18 - src/test/ui/run-pass/issues/issue-36792.rs | 17 - src/test/ui/run-pass/issues/issue-36816.rs | 17 - src/test/ui/run-pass/issues/issue-3683.rs | 28 - src/test/ui/run-pass/issues/issue-36856.rs | 25 - src/test/ui/run-pass/issues/issue-36936.rs | 36 - src/test/ui/run-pass/issues/issue-36954.rs | 18 - src/test/ui/run-pass/issues/issue-3702.rs | 22 - src/test/ui/run-pass/issues/issue-37109.rs | 26 - src/test/ui/run-pass/issues/issue-37175.rs | 15 - src/test/ui/run-pass/issues/issue-37222.rs | 26 - .../run-pass/issues/issue-37291/auxiliary/lib.rs | 52 - src/test/ui/run-pass/issues/issue-37291/main.rs | 30 - src/test/ui/run-pass/issues/issue-3743.rs | 65 - src/test/ui/run-pass/issues/issue-3753.rs | 42 - src/test/ui/run-pass/issues/issue-37598.rs | 22 - src/test/ui/run-pass/issues/issue-37655.rs | 47 - src/test/ui/run-pass/issues/issue-37686.rs | 17 - src/test/ui/run-pass/issues/issue-37725.rs | 19 - src/test/ui/run-pass/issues/issue-37733.rs | 16 - src/test/ui/run-pass/issues/issue-3794.rs | 42 - src/test/ui/run-pass/issues/issue-37991.rs | 28 - src/test/ui/run-pass/issues/issue-38002.rs | 44 - src/test/ui/run-pass/issues/issue-38033.rs | 89 - src/test/ui/run-pass/issues/issue-38074.rs | 30 - src/test/ui/run-pass/issues/issue-38091.rs | 30 - src/test/ui/run-pass/issues/issue-38190.rs | 22 - src/test/ui/run-pass/issues/issue-38226.rs | 25 - src/test/ui/run-pass/issues/issue-38437.rs | 55 - src/test/ui/run-pass/issues/issue-3847.rs | 23 - src/test/ui/run-pass/issues/issue-38556.rs | 23 - src/test/ui/run-pass/issues/issue-38715.rs | 25 - src/test/ui/run-pass/issues/issue-38727.rs | 22 - src/test/ui/run-pass/issues/issue-3874.rs | 21 - src/test/ui/run-pass/issues/issue-38763.rs | 22 - src/test/ui/run-pass/issues/issue-3878.rs | 20 - src/test/ui/run-pass/issues/issue-3888-2.rs | 18 - src/test/ui/run-pass/issues/issue-38942.rs | 27 - src/test/ui/run-pass/issues/issue-3895.rs | 20 - src/test/ui/run-pass/issues/issue-38987.rs | 14 - src/test/ui/run-pass/issues/issue-3904.rs | 35 - src/test/ui/run-pass/issues/issue-39089.rs | 14 - src/test/ui/run-pass/issues/issue-39292.rs | 27 - src/test/ui/run-pass/issues/issue-3935.rs | 23 - src/test/ui/run-pass/issues/issue-39367.rs | 50 - src/test/ui/run-pass/issues/issue-39467.rs | 20 - src/test/ui/run-pass/issues/issue-39548.rs | 16 - src/test/ui/run-pass/issues/issue-39709.rs | 15 - src/test/ui/run-pass/issues/issue-39720.rs | 36 - src/test/ui/run-pass/issues/issue-39720.stderr | 16 - src/test/ui/run-pass/issues/issue-3979-2.rs | 28 - src/test/ui/run-pass/issues/issue-3979-generics.rs | 45 - src/test/ui/run-pass/issues/issue-3979-xcrate.rs | 34 - src/test/ui/run-pass/issues/issue-3979.rs | 43 - src/test/ui/run-pass/issues/issue-39808.rs | 27 - src/test/ui/run-pass/issues/issue-39823.rs | 35 - src/test/ui/run-pass/issues/issue-39827.rs | 44 - src/test/ui/run-pass/issues/issue-3991.rs | 25 - src/test/ui/run-pass/issues/issue-39984.rs | 22 - src/test/ui/run-pass/issues/issue-40003.rs | 187 - src/test/ui/run-pass/issues/issue-40085.rs | 23 - src/test/ui/run-pass/issues/issue-40136.rs | 24 - src/test/ui/run-pass/issues/issue-40235.rs | 17 - src/test/ui/run-pass/issues/issue-4025.rs | 33 - src/test/ui/run-pass/issues/issue-40408.rs | 17 - src/test/ui/run-pass/issues/issue-40469.rs | 19 - src/test/ui/run-pass/issues/issue-40770.rs | 20 - src/test/ui/run-pass/issues/issue-40847.rs | 27 - src/test/ui/run-pass/issues/issue-40883.rs | 102 - src/test/ui/run-pass/issues/issue-40951.rs | 21 - src/test/ui/run-pass/issues/issue-40962.rs | 21 - src/test/ui/run-pass/issues/issue-41053.rs | 31 - src/test/ui/run-pass/issues/issue-4107.rs | 35 - src/test/ui/run-pass/issues/issue-41213.rs | 33 - src/test/ui/run-pass/issues/issue-41272.rs | 30 - src/test/ui/run-pass/issues/issue-41298.rs | 17 - src/test/ui/run-pass/issues/issue-41394.rs | 18 - src/test/ui/run-pass/issues/issue-41479.rs | 19 - src/test/ui/run-pass/issues/issue-41498.rs | 27 - src/test/ui/run-pass/issues/issue-41604.rs | 21 - src/test/ui/run-pass/issues/issue-41628.rs | 17 - src/test/ui/run-pass/issues/issue-41677.rs | 38 - src/test/ui/run-pass/issues/issue-41696.rs | 61 - src/test/ui/run-pass/issues/issue-41744.rs | 17 - src/test/ui/run-pass/issues/issue-41803.rs | 31 - .../ui/run-pass/issues/issue-41849-variance-req.rs | 44 - src/test/ui/run-pass/issues/issue-41888.rs | 44 - .../issue-41936-variance-coerce-unsized-cycle.rs | 39 - src/test/ui/run-pass/issues/issue-42007.rs | 20 - src/test/ui/run-pass/issues/issue-4208.rs | 21 - src/test/ui/run-pass/issues/issue-42148.rs | 16 - src/test/ui/run-pass/issues/issue-42210.rs | 30 - src/test/ui/run-pass/issues/issue-4228.rs | 26 - src/test/ui/run-pass/issues/issue-42453.rs | 20 - src/test/ui/run-pass/issues/issue-42463.rs | 42 - src/test/ui/run-pass/issues/issue-42467.rs | 33 - src/test/ui/run-pass/issues/issue-4252.rs | 43 - src/test/ui/run-pass/issues/issue-42552.rs | 41 - src/test/ui/run-pass/issues/issue-42679.rs | 32 - src/test/ui/run-pass/issues/issue-42747.rs | 56 - src/test/ui/run-pass/issues/issue-42956.rs | 35 - src/test/ui/run-pass/issues/issue-43057.rs | 24 - src/test/ui/run-pass/issues/issue-43132.rs | 75 - src/test/ui/run-pass/issues/issue-43205.rs | 15 - src/test/ui/run-pass/issues/issue-43291.rs | 19 - src/test/ui/run-pass/issues/issue-4333.rs | 19 - src/test/ui/run-pass/issues/issue-43357.rs | 20 - src/test/ui/run-pass/issues/issue-43483.rs | 24 - src/test/ui/run-pass/issues/issue-43692.rs | 15 - src/test/ui/run-pass/issues/issue-43853.rs | 27 - src/test/ui/run-pass/issues/issue-4387.rs | 16 - src/test/ui/run-pass/issues/issue-43910.rs | 17 - src/test/ui/run-pass/issues/issue-43923.rs | 20 - src/test/ui/run-pass/issues/issue-44005.rs | 40 - src/test/ui/run-pass/issues/issue-4401.rs | 17 - src/test/ui/run-pass/issues/issue-44056.rs | 16 - src/test/ui/run-pass/issues/issue-44247.rs | 28 - src/test/ui/run-pass/issues/issue-44333.rs | 30 - src/test/ui/run-pass/issues/issue-44373.rs | 21 - src/test/ui/run-pass/issues/issue-44402.rs | 38 - src/test/ui/run-pass/issues/issue-4446.rs | 25 - src/test/ui/run-pass/issues/issue-4448.rs | 26 - src/test/ui/run-pass/issues/issue-4464.rs | 16 - src/test/ui/run-pass/issues/issue-44730.rs | 25 - src/test/ui/run-pass/issues/issue-44851.rs | 25 - src/test/ui/run-pass/issues/issue-45124.rs | 27 - src/test/ui/run-pass/issues/issue-45152.rs | 32 - src/test/ui/run-pass/issues/issue-4541.rs | 33 - src/test/ui/run-pass/issues/issue-4542.rs | 23 - src/test/ui/run-pass/issues/issue-45425.rs | 21 - src/test/ui/run-pass/issues/issue-4545.rs | 17 - src/test/ui/run-pass/issues/issue-45731.rs | 35 - src/test/ui/run-pass/issues/issue-46069.rs | 33 - src/test/ui/run-pass/issues/issue-46095.rs | 40 - src/test/ui/run-pass/issues/issue-46519.rs | 38 - src/test/ui/run-pass/issues/issue-46553.rs | 33 - src/test/ui/run-pass/issues/issue-46845.rs | 42 - src/test/ui/run-pass/issues/issue-46855.rs | 33 - .../issues/issue-46920-byte-array-patterns.rs | 38 - src/test/ui/run-pass/issues/issue-46959.rs | 19 - src/test/ui/run-pass/issues/issue-46964.rs | 29 - src/test/ui/run-pass/issues/issue-47139-1.rs | 88 - src/test/ui/run-pass/issues/issue-47139-2.rs | 76 - src/test/ui/run-pass/issues/issue-4734.rs | 46 - src/test/ui/run-pass/issues/issue-4735.rs | 29 - src/test/ui/run-pass/issues/issue-47364.rs | 68 - src/test/ui/run-pass/issues/issue-4759-1.rs | 14 - src/test/ui/run-pass/issues/issue-4759.rs | 30 - src/test/ui/run-pass/issues/issue-47638.rs | 19 - src/test/ui/run-pass/issues/issue-47673.rs | 15 - src/test/ui/run-pass/issues/issue-47703-1.rs | 34 - src/test/ui/run-pass/issues/issue-47703-tuple.rs | 22 - src/test/ui/run-pass/issues/issue-47703.rs | 29 - src/test/ui/run-pass/issues/issue-47722.rs | 28 - src/test/ui/run-pass/issues/issue-47789.rs | 22 - src/test/ui/run-pass/issues/issue-48159.rs | 38 - src/test/ui/run-pass/issues/issue-4830.rs | 20 - src/test/ui/run-pass/issues/issue-48508-aux.rs | 17 - src/test/ui/run-pass/issues/issue-48508.rs | 29 - src/test/ui/run-pass/issues/issue-48551.rs | 44 - src/test/ui/run-pass/issues/issue-4865-1.rs | 42 - src/test/ui/run-pass/issues/issue-4865-2.rs | 34 - src/test/ui/run-pass/issues/issue-4865-3.rs | 26 - src/test/ui/run-pass/issues/issue-4875.rs | 24 - src/test/ui/run-pass/issues/issue-48962.rs | 44 - src/test/ui/run-pass/issues/issue-48984.rs | 18 - src/test/ui/run-pass/issues/issue-49298.rs | 35 - src/test/ui/run-pass/issues/issue-49556.rs | 23 - ...on-shorthand-field-patterns-in-pattern-macro.rs | 25 - src/test/ui/run-pass/issues/issue-49632.rs | 18 - src/test/ui/run-pass/issues/issue-49685.rs | 23 - src/test/ui/run-pass/issues/issue-49854.rs | 19 - src/test/ui/run-pass/issues/issue-49955-2.rs | 27 - src/test/ui/run-pass/issues/issue-49955.rs | 31 - src/test/ui/run-pass/issues/issue-49973.rs | 21 - .../issue-5008-borrowed-traitobject-method-call.rs | 44 - src/test/ui/run-pass/issues/issue-50415.rs | 28 - src/test/ui/run-pass/issues/issue-50442.rs | 22 - src/test/ui/run-pass/issues/issue-5060.rs | 26 - src/test/ui/run-pass/issues/issue-50689.rs | 18 - src/test/ui/run-pass/issues/issue-50731.rs | 16 - src/test/ui/run-pass/issues/issue-50811.rs | 66 - .../auxiliary/lib.rs | 24 - .../issues/issue-50865-private-impl-trait/main.rs | 26 - src/test/ui/run-pass/issues/issue-51185.rs | 18 - src/test/ui/run-pass/issues/issue-51345.rs | 18 - src/test/ui/run-pass/issues/issue-51582.rs | 28 - src/test/ui/run-pass/issues/issue-51655.rs | 24 - src/test/ui/run-pass/issues/issue-51907.rs | 27 - src/test/ui/run-pass/issues/issue-5192.rs | 50 - .../issues/issue-52140/auxiliary/some_crate.rs | 15 - src/test/ui/run-pass/issues/issue-52140/main.rs | 23 - .../issues/issue-52141/auxiliary/some_crate.rs | 15 - src/test/ui/run-pass/issues/issue-52141/main.rs | 26 - src/test/ui/run-pass/issues/issue-52169.rs | 25 - src/test/ui/run-pass/issues/issue-5239-2.rs | 19 - src/test/ui/run-pass/issues/issue-5243.rs | 26 - src/test/ui/run-pass/issues/issue-52557.rs | 39 - .../run-pass/issues/issue-52705/auxiliary/png2.rs | 13 - src/test/ui/run-pass/issues/issue-52705/main.rs | 24 - src/test/ui/run-pass/issues/issue-5280.rs | 27 - src/test/ui/run-pass/issues/issue-5315.rs | 19 - .../issues/issue-5321-immediates-with-bare-self.rs | 25 - src/test/ui/run-pass/issues/issue-53333.rs | 18 - src/test/ui/run-pass/issues/issue-5353.rs | 27 - src/test/ui/run-pass/issues/issue-5518.rs | 18 - src/test/ui/run-pass/issues/issue-5521.rs | 26 - src/test/ui/run-pass/issues/issue-5530.rs | 49 - src/test/ui/run-pass/issues/issue-5550.rs | 18 - src/test/ui/run-pass/issues/issue-5554.rs | 38 - src/test/ui/run-pass/issues/issue-5572.rs | 16 - src/test/ui/run-pass/issues/issue-5666.rs | 37 - src/test/ui/run-pass/issues/issue-5688.rs | 30 - src/test/ui/run-pass/issues/issue-5708.rs | 64 - src/test/ui/run-pass/issues/issue-5718.rs | 36 - src/test/ui/run-pass/issues/issue-5741.rs | 19 - src/test/ui/run-pass/issues/issue-5754.rs | 25 - src/test/ui/run-pass/issues/issue-5791.rs | 21 - src/test/ui/run-pass/issues/issue-5884.rs | 29 - src/test/ui/run-pass/issues/issue-5900.rs | 24 - src/test/ui/run-pass/issues/issue-5917.rs | 19 - src/test/ui/run-pass/issues/issue-5950.rs | 19 - src/test/ui/run-pass/issues/issue-5988.rs | 34 - src/test/ui/run-pass/issues/issue-5997.rs | 24 - src/test/ui/run-pass/issues/issue-6117.rs | 21 - src/test/ui/run-pass/issues/issue-6128.rs | 34 - src/test/ui/run-pass/issues/issue-6130.rs | 20 - src/test/ui/run-pass/issues/issue-6153.rs | 23 - src/test/ui/run-pass/issues/issue-6157.rs | 33 - src/test/ui/run-pass/issues/issue-6318.rs | 32 - src/test/ui/run-pass/issues/issue-6334.rs | 56 - src/test/ui/run-pass/issues/issue-6341.rs | 21 - src/test/ui/run-pass/issues/issue-6344-let.rs | 25 - src/test/ui/run-pass/issues/issue-6344-match.rs | 28 - src/test/ui/run-pass/issues/issue-6449.rs | 53 - src/test/ui/run-pass/issues/issue-6470.rs | 27 - src/test/ui/run-pass/issues/issue-6557.rs | 19 - src/test/ui/run-pass/issues/issue-6892.rs | 67 - src/test/ui/run-pass/issues/issue-6898.rs | 43 - src/test/ui/run-pass/issues/issue-6919.rs | 21 - src/test/ui/run-pass/issues/issue-6991.rs | 17 - src/test/ui/run-pass/issues/issue-7012.rs | 32 - src/test/ui/run-pass/issues/issue-7178.rs | 20 - src/test/ui/run-pass/issues/issue-7222.rs | 22 - src/test/ui/run-pass/issues/issue-7268.rs | 19 - src/test/ui/run-pass/issues/issue-7344.rs | 31 - .../issues/issue-7519-match-unit-in-arg.rs | 22 - src/test/ui/run-pass/issues/issue-7563.rs | 37 - src/test/ui/run-pass/issues/issue-7575.rs | 27 - src/test/ui/run-pass/issues/issue-7607-2.rs | 25 - src/test/ui/run-pass/issues/issue-7660.rs | 27 - src/test/ui/run-pass/issues/issue-7663.rs | 42 - ...ssue-7673-cast-generically-implemented-trait.rs | 31 - src/test/ui/run-pass/issues/issue-7784.rs | 41 - src/test/ui/run-pass/issues/issue-7899.rs | 20 - src/test/ui/run-pass/issues/issue-7911.rs | 47 - src/test/ui/run-pass/issues/issue-8044.rs | 21 - ...71-default-method-self-inherit-builtin-trait.rs | 28 - src/test/ui/run-pass/issues/issue-8248.rs | 25 - src/test/ui/run-pass/issues/issue-8249.rs | 29 - src/test/ui/run-pass/issues/issue-8259.rs | 21 - src/test/ui/run-pass/issues/issue-8351-1.rs | 25 - src/test/ui/run-pass/issues/issue-8351-2.rs | 25 - src/test/ui/run-pass/issues/issue-8391.rs | 19 - src/test/ui/run-pass/issues/issue-8398.rs | 22 - src/test/ui/run-pass/issues/issue-8401.rs | 18 - src/test/ui/run-pass/issues/issue-8460.rs | 60 - src/test/ui/run-pass/issues/issue-8498.rs | 37 - src/test/ui/run-pass/issues/issue-8506.rs | 24 - src/test/ui/run-pass/issues/issue-8521.rs | 35 - src/test/ui/run-pass/issues/issue-8578.rs | 29 - src/test/ui/run-pass/issues/issue-868.rs | 27 - src/test/ui/run-pass/issues/issue-8709.rs | 24 - src/test/ui/run-pass/issues/issue-8783.rs | 33 - src/test/ui/run-pass/issues/issue-8827.rs | 63 - src/test/ui/run-pass/issues/issue-8851.rs | 39 - src/test/ui/run-pass/issues/issue-8860.rs | 59 - src/test/ui/run-pass/issues/issue-8898.rs | 28 - src/test/ui/run-pass/issues/issue-9047.rs | 22 - src/test/ui/run-pass/issues/issue-9110.rs | 26 - src/test/ui/run-pass/issues/issue-9123.rs | 18 - src/test/ui/run-pass/issues/issue-9129.rs | 44 - src/test/ui/run-pass/issues/issue-9188.rs | 21 - src/test/ui/run-pass/issues/issue-9243.rs | 25 - src/test/ui/run-pass/issues/issue-9249.rs | 15 - src/test/ui/run-pass/issues/issue-9259.rs | 25 - src/test/ui/run-pass/issues/issue-9382.rs | 49 - .../issues/issue-9394-inherited-trait-calls.rs | 72 - src/test/ui/run-pass/issues/issue-9396.rs | 32 - src/test/ui/run-pass/issues/issue-9446.rs | 40 - src/test/ui/run-pass/issues/issue-9719.rs | 50 - src/test/ui/run-pass/issues/issue-9737.rs | 19 - src/test/ui/run-pass/issues/issue-979.rs | 39 - src/test/ui/run-pass/issues/issue-9837.rs | 21 - src/test/ui/run-pass/issues/issue-9906.rs | 21 - src/test/ui/run-pass/issues/issue-9918.rs | 15 - src/test/ui/run-pass/issues/issue-9942.rs | 16 - src/test/ui/run-pass/issues/issue-9951.rs | 31 - src/test/ui/run-pass/issues/issue-9968.rs | 23 - src/test/ui/run-pass/issues/issue2170exe.rs | 19 - .../auxiliary/issue24687_lib.rs | 20 - .../auxiliary/issue24687_mbcs_in_comments.rs | 37 - .../issues/issue24687-embed-debuginfo/main.rs | 23 - .../ui/run-pass/issues/issue28498-must-work-ex1.rs | 28 - .../ui/run-pass/issues/issue28498-must-work-ex2.rs | 31 - src/test/ui/run-pass/issues/issue28498-ugeh-ex1.rs | 40 - .../issues/issue28498-ugeh-with-lifetime-param.rs | 51 - .../issues/issue28498-ugeh-with-passed-to-fn.rs | 59 - .../issues/issue28498-ugeh-with-trait-bound.rs | 54 - src/test/ui/run-pass/issues/issue29927-1.rs | 21 - .../run-pass/issues/issue_26873_multifile/A/B.rs | 15 - .../run-pass/issues/issue_26873_multifile/A/C.rs | 17 - .../run-pass/issues/issue_26873_multifile/A/mod.rs | 16 - .../issue_26873_multifile/compiletest-ignore-dir | 0 .../run-pass/issues/issue_26873_multifile/mod.rs | 15 - src/test/ui/run-pass/issues/issue_3136_b.rs | 17 - src/test/ui/run-pass/issues/issue_9155.rs | 22 - .../into-iterator-type-inference-shift.rs | 42 - .../iterators/iter-cloned-type-inference.rs | 26 - src/test/ui/run-pass/iterators/iter-range.rs | 24 - .../run-pass/iterators/iter-step-overflow-debug.rs | 31 - .../iterators/iter-step-overflow-ndebug.rs | 22 - .../run-pass/iterators/iter-sum-overflow-debug.rs | 37 - .../run-pass/iterators/iter-sum-overflow-ndebug.rs | 24 - .../iterators/iter-sum-overflow-overflow-checks.rs | 37 - src/test/ui/run-pass/iterators/iter-zip.rs | 113 - .../ui/run-pass/macros/assert-eq-macro-success.rs | 23 - .../ui/run-pass/macros/assert-eq-macro-unsized.rs | 14 - .../ui/run-pass/macros/assert-ne-macro-success.rs | 23 - .../ui/run-pass/macros/assert-ne-macro-unsized.rs | 14 - .../macros/auxiliary/macro-comma-support.rs | 11 - .../macros/auxiliary/macro-include-items-expr.rs | 13 - .../macros/auxiliary/macro-include-items-item.rs | 13 - .../macros/auxiliary/macro_crate_def_only.rs | 14 - .../macros/auxiliary/macro_crate_nonterminal.rs | 22 - .../macros/auxiliary/macro_export_inner_module.rs | 16 - .../macros/auxiliary/macro_with_super_1.rs | 26 - .../ui/run-pass/macros/auxiliary/two_macros.rs | 15 - .../run-pass/macros/auxiliary/unstable-macros.rs | 16 - .../ui/run-pass/macros/auxiliary/use-macro-self.rs | 16 - .../ui/run-pass/macros/colorful-write-macros.rs | 43 - .../run-pass/macros/conditional-debug-macro-on.rs | 18 - src/test/ui/run-pass/macros/die-macro.rs | 25 - .../log_syntax-trace_macros-macro-locations.rs | 32 - .../log_syntax-trace_macros-macro-locations.stdout | 3 - src/test/ui/run-pass/macros/macro-2.rs | 22 - .../ui/run-pass/macros/macro-at-most-once-rep.rs | 44 - .../run-pass/macros/macro-attribute-expansion.rs | 26 - src/test/ui/run-pass/macros/macro-attributes.rs | 34 - .../ui/run-pass/macros/macro-block-nonterminal.rs | 21 - .../ui/run-pass/macros/macro-comma-behavior.rs | 99 - src/test/ui/run-pass/macros/macro-comma-support.rs | 360 -- .../ui/run-pass/macros/macro-crate-def-only.rs | 20 - .../macros/macro-crate-nonterminal-renamed.rs | 20 - .../ui/run-pass/macros/macro-crate-nonterminal.rs | 20 - src/test/ui/run-pass/macros/macro-crate-use.rs | 27 - .../ui/run-pass/macros/macro-deep_expansion.rs | 27 - .../macros/macro-delimiter-significance.rs | 14 - src/test/ui/run-pass/macros/macro-doc-comments.rs | 36 - src/test/ui/run-pass/macros/macro-doc-escapes.rs | 26 - .../ui/run-pass/macros/macro-doc-raw-str-hashes.rs | 40 - .../run-pass/macros/macro-export-inner-module.rs | 19 - src/test/ui/run-pass/macros/macro-first-set.rs | 289 -- src/test/ui/run-pass/macros/macro-follow.rs | 193 -- .../ui/run-pass/macros/macro-followed-by-seq.rs | 23 - src/test/ui/run-pass/macros/macro-include-items.rs | 23 - src/test/ui/run-pass/macros/macro-interpolation.rs | 31 - ...ro-invocation-in-count-expr-fixed-array-type.rs | 20 - .../macros/macro-lifetime-used-with-bound.rs | 24 - .../macros/macro-lifetime-used-with-labels.rs | 46 - .../macros/macro-lifetime-used-with-labels.stderr | 11 - .../macros/macro-lifetime-used-with-static.rs | 24 - src/test/ui/run-pass/macros/macro-lifetime.rs | 24 - src/test/ui/run-pass/macros/macro-literal.rs | 144 - src/test/ui/run-pass/macros/macro-meta-items.rs | 40 - .../ui/run-pass/macros/macro-method-issue-4621.rs | 20 - .../ui/run-pass/macros/macro-multiple-items.rs | 26 - src/test/ui/run-pass/macros/macro-named-default.rs | 28 - .../macros/macro-nested_definition_issue-31946.rs | 19 - src/test/ui/run-pass/macros/macro-nested_expr.rs | 33 - .../ui/run-pass/macros/macro-nested_stmt_macros.rs | 33 - src/test/ui/run-pass/macros/macro-nt-list.rs | 31 - .../ui/run-pass/macros/macro-of-higher-order.rs | 32 - src/test/ui/run-pass/macros/macro-pat-follow.rs | 41 - src/test/ui/run-pass/macros/macro-pat-neg-lit.rs | 36 - src/test/ui/run-pass/macros/macro-pat.rs | 75 - src/test/ui/run-pass/macros/macro-path.rs | 28 - src/test/ui/run-pass/macros/macro-pub-matcher.rs | 129 - .../run-pass/macros/macro-seq-followed-by-seq.rs | 27 - src/test/ui/run-pass/macros/macro-stability.rs | 24 - src/test/ui/run-pass/macros/macro-stmt.rs | 41 - .../macros/macro-stmt_macro_in_expr_macro.rs | 30 - .../ui/run-pass/macros/macro-tt-followed-by-seq.rs | 37 - .../ui/run-pass/macros/macro-use-all-and-none.rs | 21 - src/test/ui/run-pass/macros/macro-use-all.rs | 20 - src/test/ui/run-pass/macros/macro-use-both.rs | 20 - src/test/ui/run-pass/macros/macro-use-one.rs | 19 - src/test/ui/run-pass/macros/macro-with-attrs1.rs | 23 - src/test/ui/run-pass/macros/macro-with-attrs2.rs | 21 - .../macros/macro-with-braces-in-expr-position.rs | 31 - src/test/ui/run-pass/macros/macro_with_super_2.rs | 23 - src/test/ui/run-pass/macros/macros-in-extern.rs | 40 - .../macros/parse-complex-macro-invoc-op.rs | 48 - .../run-pass/macros/paths-in-macro-invocations.rs | 45 - .../ui/run-pass/macros/pub-item-inside-macro.rs | 28 - .../ui/run-pass/macros/pub-method-inside-macro.rs | 32 - src/test/ui/run-pass/macros/semi-after-macro-ty.rs | 18 - .../run-pass/macros/stmt_expr_attr_macro_parse.rs | 33 - .../ui/run-pass/macros/syntax-extension-cfg.rs | 34 - .../includeme.fragment | 7 - .../macros/syntax-extension-source-utils.rs | 47 - src/test/ui/run-pass/macros/try-macro.rs | 58 - src/test/ui/run-pass/macros/two-macro-use.rs | 21 - src/test/ui/run-pass/macros/type-macros-hlist.rs | 88 - src/test/ui/run-pass/macros/type-macros-simple.rs | 38 - .../macros/typeck-macro-interaction-issue-8852.rs | 39 - src/test/ui/run-pass/macros/use-macro-self.rs | 21 - .../run-pass/methods/auxiliary/method_self_arg1.rs | 47 - .../run-pass/methods/auxiliary/method_self_arg2.rs | 64 - .../method-argument-inference-associated-type.rs | 38 - src/test/ui/run-pass/methods/method-attributes.rs | 40 - .../method-early-bound-lifetimes-on-self.rs | 41 - .../method-mut-self-modifies-mut-slice-lvalue.rs | 54 - .../methods/method-normalize-bounds-issue-20604.rs | 69 - src/test/ui/run-pass/methods/method-projection.rs | 80 - .../methods/method-recursive-blanket-impl.rs | 49 - .../ui/run-pass/methods/method-self-arg-aux1.rs | 30 - .../ui/run-pass/methods/method-self-arg-aux2.rs | 34 - .../ui/run-pass/methods/method-self-arg-trait.rs | 79 - src/test/ui/run-pass/methods/method-self-arg.rs | 58 - .../methods/method-two-trait-defer-resolution-1.rs | 47 - .../methods/method-two-trait-defer-resolution-2.rs | 58 - ...od-two-traits-distinguished-via-where-clause.rs | 37 - .../ui/run-pass/methods/method-where-clause.rs | 44 - .../ui/run-pass/mir/auxiliary/mir_external_refs.rs | 28 - .../run-pass/mir/mir-inlining/ice-issue-45493.rs | 27 - .../run-pass/mir/mir-inlining/ice-issue-45885.rs | 39 - .../mir-inlining/no-trait-method-issue-40473.rs | 26 - .../ui/run-pass/mir/mir-typeck-normalize-fn-sig.rs | 39 - src/test/ui/run-pass/mir/mir_adt_construction.rs | 102 - .../ui/run-pass/mir/mir_ascription_coercion.rs | 20 - .../ui/run-pass/mir/mir_augmented_assignments.rs | 170 - src/test/ui/run-pass/mir/mir_autoderef.rs | 38 - src/test/ui/run-pass/mir/mir_boxing.rs | 20 - .../ui/run-pass/mir/mir_build_match_comparisons.rs | 68 - .../run-pass/mir/mir_call_with_associated_type.rs | 26 - src/test/ui/run-pass/mir/mir_calls_to_shims.rs | 59 - src/test/ui/run-pass/mir/mir_cast_fn_ret.rs | 31 - src/test/ui/run-pass/mir/mir_codegen_array.rs | 20 - src/test/ui/run-pass/mir/mir_codegen_array_2.rs | 19 - .../ui/run-pass/mir/mir_codegen_call_converging.rs | 27 - src/test/ui/run-pass/mir/mir_codegen_calls.rs | 201 -- .../ui/run-pass/mir/mir_codegen_calls_variadic.rs | 32 - .../ui/run-pass/mir/mir_codegen_critical_edge.rs | 53 - src/test/ui/run-pass/mir/mir_codegen_spike1.rs | 22 - src/test/ui/run-pass/mir/mir_codegen_switch.rs | 45 - src/test/ui/run-pass/mir/mir_codegen_switchint.rs | 22 - src/test/ui/run-pass/mir/mir_coercion_casts.rs | 20 - src/test/ui/run-pass/mir/mir_coercions.rs | 81 - src/test/ui/run-pass/mir/mir_constval_adts.rs | 45 - src/test/ui/run-pass/mir/mir_drop_order.rs | 58 - src/test/ui/run-pass/mir/mir_early_return_scope.rs | 38 - src/test/ui/run-pass/mir/mir_fat_ptr.rs | 62 - src/test/ui/run-pass/mir/mir_fat_ptr_drop.rs | 41 - src/test/ui/run-pass/mir/mir_heavy_promoted.rs | 21 - src/test/ui/run-pass/mir/mir_match_arm_guard.rs | 26 - src/test/ui/run-pass/mir/mir_misc_casts.rs | 330 -- src/test/ui/run-pass/mir/mir_overflow_off.rs | 27 - src/test/ui/run-pass/mir/mir_raw_fat_ptr.rs | 168 - src/test/ui/run-pass/mir/mir_refs_correct.rs | 219 -- src/test/ui/run-pass/mir/mir_small_agg_arg.rs | 17 - .../ui/run-pass/mir/mir_struct_with_assoc_ty.rs | 39 - src/test/ui/run-pass/mir/mir_temp_promotions.rs | 20 - src/test/ui/run-pass/mir/mir_void_return.rs | 22 - src/test/ui/run-pass/mir/mir_void_return_2.rs | 20 - .../ui/run-pass/modules/auxiliary/two_macros_2.rs | 13 - src/test/ui/run-pass/modules/mod-inside-fn.rs | 23 - src/test/ui/run-pass/modules/mod-view-items.rs | 24 - src/test/ui/run-pass/modules/mod_dir_implicit.rs | 18 - .../mod_dir_implicit_aux/compiletest-ignore-dir | 0 .../run-pass/modules/mod_dir_implicit_aux/mod.rs | 12 - src/test/ui/run-pass/modules/mod_dir_path.rs | 32 - src/test/ui/run-pass/modules/mod_dir_path2.rs | 22 - src/test/ui/run-pass/modules/mod_dir_path3.rs | 21 - src/test/ui/run-pass/modules/mod_dir_path_multi.rs | 27 - src/test/ui/run-pass/modules/mod_dir_recursive.rs | 24 - src/test/ui/run-pass/modules/mod_dir_simple.rs | 20 - .../modules/mod_dir_simple/compiletest-ignore-dir | 0 .../modules/mod_dir_simple/load_another_mod.rs | 13 - .../ui/run-pass/modules/mod_dir_simple/test.rs | 12 - src/test/ui/run-pass/modules/mod_file.rs | 20 - src/test/ui/run-pass/modules/mod_file_aux.rs | 14 - .../ui/run-pass/modules/mod_file_with_path_attr.rs | 21 - .../compiletest-ignore-dir | 0 .../float-template/inst_f32.rs | 11 - .../float-template/inst_f64.rs | 11 - .../float-template/inst_float.rs | 11 - src/test/ui/run-pass/moves/move-1-unique.rs | 34 - src/test/ui/run-pass/moves/move-2-unique.rs | 20 - src/test/ui/run-pass/moves/move-2.rs | 16 - src/test/ui/run-pass/moves/move-3-unique.rs | 34 - src/test/ui/run-pass/moves/move-4-unique.rs | 28 - src/test/ui/run-pass/moves/move-4.rs | 28 - src/test/ui/run-pass/moves/move-arg-2-unique.rs | 23 - src/test/ui/run-pass/moves/move-arg-2.rs | 23 - src/test/ui/run-pass/moves/move-arg.rs | 15 - src/test/ui/run-pass/moves/move-nullary-fn.rs | 23 - src/test/ui/run-pass/moves/move-out-of-field.rs | 37 - src/test/ui/run-pass/moves/move-scalar.rs | 19 - .../moves/moves-based-on-type-capture-clause.rs | 21 - .../ui/run-pass/nll/issue-47153-generic-const.rs | 29 - src/test/ui/run-pass/nll/issue-47589.rs | 35 - src/test/ui/run-pass/nll/issue-48623-closure.rs | 26 - src/test/ui/run-pass/nll/issue-48623-generator.rs | 27 - src/test/ui/run-pass/nll/issue-50343.rs | 19 - .../nll/issue-50461-used-mut-from-moves.rs | 27 - .../run-pass/nll/issue-53123-raw-pointer-cast.rs | 37 - src/test/ui/run-pass/nll/mutating_references.rs | 36 - .../ui/run-pass/nll/process_or_insert_default.rs | 39 - src/test/ui/run-pass/nll/rc-loop.rs | 41 - src/test/ui/run-pass/non_modrs_mods/foors_mod.rs | 14 - .../foors_mod/compiletest-ignore-dir | 0 .../non_modrs_mods/foors_mod/inner_foors_mod.rs | 11 - .../foors_mod/inner_foors_mod/innest.rs | 11 - .../foors_mod/inner_modrs_mod/innest.rs | 11 - .../foors_mod/inner_modrs_mod/mod.rs | 11 - .../modrs_mod/compiletest-ignore-dir | 0 .../non_modrs_mods/modrs_mod/inner_foors_mod.rs | 11 - .../modrs_mod/inner_foors_mod/innest.rs | 11 - .../modrs_mod/inner_modrs_mod/innest.rs | 11 - .../modrs_mod/inner_modrs_mod/mod.rs | 11 - .../ui/run-pass/non_modrs_mods/modrs_mod/mod.rs | 12 - .../some_crazy_attr_mod_dir/arbitrary_name.rs | 11 - .../some_crazy_attr_mod_dir/compiletest-ignore-dir | 0 .../inner_modrs_mod/innest.rs | 11 - .../some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs | 11 - src/test/ui/run-pass/numbers-arithmetic/arith-0.rs | 18 - src/test/ui/run-pass/numbers-arithmetic/arith-1.rs | 34 - src/test/ui/run-pass/numbers-arithmetic/arith-2.rs | 19 - .../run-pass/numbers-arithmetic/arith-unsigned.rs | 36 - src/test/ui/run-pass/numbers-arithmetic/div-mod.rs | 29 - .../float-int-invalid-const-cast.rs | 63 - .../numbers-arithmetic/float-literal-inference.rs | 23 - .../ui/run-pass/numbers-arithmetic/float-nan.rs | 93 - .../run-pass/numbers-arithmetic/float-signature.rs | 19 - src/test/ui/run-pass/numbers-arithmetic/float.rs | 19 - src/test/ui/run-pass/numbers-arithmetic/float2.rs | 36 - .../ui/run-pass/numbers-arithmetic/float_math.rs | 31 - .../ui/run-pass/numbers-arithmetic/floatlits.rs | 22 - .../ui/run-pass/numbers-arithmetic/i128-ffi.rs | 41 - src/test/ui/run-pass/numbers-arithmetic/i128.rs | 121 - src/test/ui/run-pass/numbers-arithmetic/i32-sub.rs | 16 - src/test/ui/run-pass/numbers-arithmetic/i8-incr.rs | 22 - .../numbers-arithmetic/int-abs-overflow.rs | 23 - src/test/ui/run-pass/numbers-arithmetic/int.rs | 17 - .../numbers-arithmetic/integer-literal-radix.rs | 29 - .../integer-literal-suffix-inference-2.rs | 19 - .../integer-literal-suffix-inference-3.rs | 14 - .../integer-literal-suffix-inference.rs | 70 - .../next-power-of-two-overflow-debug.rs | 37 - .../next-power-of-two-overflow-ndebug.rs | 24 - .../ui/run-pass/numbers-arithmetic/num-wrapping.rs | 456 --- .../numeric-method-autoexport.rs | 35 - .../numbers-arithmetic/promoted_overflow_opt.rs | 19 - .../numbers-arithmetic/saturating-float-casts.rs | 145 - .../run-pass/numbers-arithmetic/shift-near-oflo.rs | 110 - .../numbers-arithmetic/shift-various-types.rs | 58 - src/test/ui/run-pass/numbers-arithmetic/shift.rs | 86 - .../numbers-arithmetic/signed-shift-const-eval.rs | 18 - .../ui/run-pass/numbers-arithmetic/u128-as-f32.rs | 59 - src/test/ui/run-pass/numbers-arithmetic/u128.rs | 132 - .../ui/run-pass/numbers-arithmetic/u32-decr.rs | 20 - .../ui/run-pass/numbers-arithmetic/u8-incr-decr.rs | 29 - src/test/ui/run-pass/numbers-arithmetic/u8-incr.rs | 25 - src/test/ui/run-pass/numbers-arithmetic/uint.rs | 17 - .../auxiliary/overloaded_autoderef_xc.rs | 40 - .../overloaded/overloaded-autoderef-count.rs | 84 - .../overloaded/overloaded-autoderef-indexing.rs | 30 - .../overloaded/overloaded-autoderef-order.rs | 81 - .../overloaded/overloaded-autoderef-vtable.rs | 48 - .../overloaded/overloaded-autoderef-xcrate.rs | 19 - .../ui/run-pass/overloaded/overloaded-autoderef.rs | 54 - .../overloaded/overloaded-calls-object-one-arg.rs | 23 - .../overloaded/overloaded-calls-object-two-args.rs | 23 - .../overloaded-calls-object-zero-args.rs | 23 - .../overloaded/overloaded-calls-param-vtables.rs | 42 - .../run-pass/overloaded/overloaded-calls-simple.rs | 88 - .../overloaded/overloaded-calls-zero-args.rs | 40 - .../run-pass/overloaded/overloaded-deref-count.rs | 88 - .../ui/run-pass/overloaded/overloaded-deref.rs | 53 - .../overloaded/overloaded-index-assoc-list.rs | 58 - .../overloaded/overloaded-index-autoderef.rs | 87 - .../overloaded/overloaded-index-in-field.rs | 56 - .../ui/run-pass/overloaded/overloaded-index.rs | 74 - .../overloaded_deref_with_ref_pattern.rs | 103 - ...overloaded_deref_with_ref_pattern_issue15609.rs | 45 - src/test/ui/run-pass/packed/auxiliary/packed.rs | 31 - .../packed/packed-struct-borrow-element.rs | 46 - .../run-pass/packed/packed-struct-drop-aligned.rs | 43 - .../packed/packed-struct-generic-layout.rs | 41 - .../run-pass/packed/packed-struct-generic-size.rs | 56 - .../packed/packed-struct-generic-size.stderr | 36 - .../ui/run-pass/packed/packed-struct-layout.rs | 37 - src/test/ui/run-pass/packed/packed-struct-match.rs | 56 - .../packed/packed-struct-optimized-enum.rs | 46 - .../ui/run-pass/packed/packed-struct-size-xc.rs | 30 - src/test/ui/run-pass/packed/packed-struct-size.rs | 169 - src/test/ui/run-pass/packed/packed-struct-vec.rs | 131 - .../run-pass/packed/packed-tuple-struct-layout.rs | 31 - .../ui/run-pass/packed/packed-tuple-struct-size.rs | 90 - .../abort-link-to-unwinding-crates.rs | 50 - src/test/ui/run-pass/panic-runtime/abort.rs | 53 - .../auxiliary/exit-success-if-unwind.rs | 26 - .../ui/run-pass/panic-runtime/link-to-abort.rs | 21 - .../ui/run-pass/panic-runtime/link-to-unwind.rs | 20 - src/test/ui/run-pass/panic-runtime/lto-abort.rs | 43 - src/test/ui/run-pass/panic-runtime/lto-unwind.rs | 45 - src/test/ui/run-pass/panics/panic-handler-chain.rs | 39 - .../run-pass/panics/panic-handler-flail-wildly.rs | 63 - .../ui/run-pass/panics/panic-handler-set-twice.rs | 33 - .../run-pass/panics/panic-in-dtor-drops-fields.rs | 46 - .../ui/run-pass/panics/panic-recover-propagate.rs | 36 - src/test/ui/run-pass/panics/panic-safe.rs | 61 - .../privacy/auxiliary/priv-impl-prim-ty.rs | 19 - .../run-pass/privacy/auxiliary/privacy_reexport.rs | 16 - .../privacy/auxiliary/pub_use_mods_xcrate.rs | 20 - .../run-pass/privacy/auxiliary/pub_use_xcrate1.rs | 13 - .../run-pass/privacy/auxiliary/pub_use_xcrate2.rs | 13 - src/test/ui/run-pass/privacy/priv-impl-prim-ty.rs | 21 - src/test/ui/run-pass/privacy/privacy-ns.rs | 124 - src/test/ui/run-pass/privacy/privacy-reexport.rs | 23 - src/test/ui/run-pass/privacy/privacy1.rs | 32 - .../ui/run-pass/privacy/private-class-field.rs | 35 - src/test/ui/run-pass/privacy/private-method.rs | 43 - src/test/ui/run-pass/privacy/pub-extern-privacy.rs | 28 - src/test/ui/run-pass/privacy/pub-use-xcrate.rs | 25 - .../ui/run-pass/privacy/pub_use_mods_xcrate_exe.rs | 21 - src/test/ui/run-pass/process/process-envs.rs | 62 - src/test/ui/run-pass/process/process-exit.rs | 35 - .../ui/run-pass/process/process-remove-from-env.rs | 56 - src/test/ui/run-pass/process/process-sigpipe.rs | 45 - .../run-pass/process/process-spawn-nonexistent.rs | 24 - .../process/process-spawn-with-unicode-params.rs | 86 - .../process/process-status-inherits-stdin.rs | 45 - .../regions-addr-of-interior-of-unique-box.rs | 32 - .../ui/run-pass/regions/regions-addr-of-ret.rs | 19 - .../regions/regions-assoc-type-region-bound.rs | 31 - .../regions/regions-assoc-type-static-bound.rs | 28 - src/test/ui/run-pass/regions/regions-borrow-at.rs | 23 - .../run-pass/regions/regions-borrow-evec-fixed.rs | 20 - .../run-pass/regions/regions-borrow-evec-uniq.rs | 26 - .../ui/run-pass/regions/regions-borrow-uniq.rs | 22 - src/test/ui/run-pass/regions/regions-bot.rs | 20 - .../regions/regions-bound-lists-feature-gate-2.rs | 23 - .../regions/regions-bound-lists-feature-gate.rs | 26 - ...gions-close-over-type-parameter-successfully.rs | 33 - .../ui/run-pass/regions/regions-copy-closure.rs | 31 - .../ui/run-pass/regions/regions-creating-enums2.rs | 26 - .../ui/run-pass/regions/regions-creating-enums5.rs | 26 - .../run-pass/regions/regions-debruijn-of-object.rs | 30 - .../run-pass/regions/regions-dependent-addr-of.rs | 123 - .../run-pass/regions/regions-dependent-autofn.rs | 25 - .../regions/regions-dependent-autoslice.rs | 24 - .../run-pass/regions/regions-dependent-let-ref.rs | 22 - .../regions-early-bound-lifetime-in-assoc-fn.rs | 44 - .../regions/regions-early-bound-trait-param.rs | 144 - .../regions-early-bound-used-in-bound-method.rs | 40 - .../regions/regions-early-bound-used-in-bound.rs | 38 - .../regions-early-bound-used-in-type-param.rs | 38 - .../regions/regions-escape-into-other-fn.rs | 20 - src/test/ui/run-pass/regions/regions-expl-self.rs | 24 - .../ui/run-pass/regions/regions-fn-subtyping-2.rs | 29 - .../ui/run-pass/regions/regions-fn-subtyping.rs | 38 - ...-region-outlives-static-outlives-free-region.rs | 26 - .../regions/regions-infer-borrow-scope-addr-of.rs | 33 - .../regions/regions-infer-borrow-scope-view.rs | 21 - .../regions-infer-borrow-scope-within-loop-ok.rs | 23 - .../run-pass/regions/regions-infer-borrow-scope.rs | 24 - .../ui/run-pass/regions/regions-infer-call-2.rs | 25 - src/test/ui/run-pass/regions/regions-infer-call.rs | 21 - .../regions-infer-contravariance-due-to-ret.rs | 32 - .../regions-infer-reborrow-ref-mut-recurse.rs | 27 - .../regions-infer-region-in-fn-but-not-type.rs | 27 - .../regions/regions-infer-static-from-proc.rs | 28 - .../ui/run-pass/regions/regions-issue-21422.rs | 28 - .../ui/run-pass/regions/regions-issue-22246.rs | 38 - .../regions/regions-lifetime-nonfree-late-bound.rs | 45 - ...gions-lifetime-static-items-enclosing-scopes.rs | 29 - .../ui/run-pass/regions/regions-link-fn-args.rs | 25 - .../ui/run-pass/regions/regions-lub-ref-ref-rc.rs | 37 - .../ui/run-pass/regions/regions-mock-codegen.rs | 65 - .../regions-no-bound-in-argument-cleanup.rs | 34 - .../regions-no-variance-from-fn-generics.rs | 53 - .../ui/run-pass/regions/regions-nullary-variant.rs | 24 - src/test/ui/run-pass/regions/regions-params.rs | 28 - .../regions/regions-reassign-let-bound-pointer.rs | 26 - .../regions-reassign-match-bound-pointer.rs | 29 - src/test/ui/run-pass/regions/regions-refcell.rs | 55 - ...d-regions-on-closures-to-inference-variables.rs | 68 - .../regions/regions-return-interior-of-option.rs | 34 - .../regions/regions-scope-chain-example.rs | 51 - src/test/ui/run-pass/regions/regions-self-impls.rs | 30 - .../ui/run-pass/regions/regions-self-in-enums.rs | 26 - src/test/ui/run-pass/regions/regions-simple.rs | 17 - .../ui/run-pass/regions/regions-static-bound.rs | 29 - .../ui/run-pass/regions/regions-static-closure.rs | 29 - .../ui/run-pass/regions/regions-trait-object-1.rs | 45 - ...ons-variance-contravariant-use-contravariant.rs | 35 - .../regions-variance-covariant-use-covariant.rs | 32 - src/test/ui/run-pass/rfcs/rfc-1014-2.rs | 39 - src/test/ui/run-pass/rfcs/rfc-1014.rs | 42 - .../ui/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs | 22 - .../termination-trait-for-box-dyn-error.rs | 16 - .../termination-trait-for-empty.rs | 12 - .../termination-trait-for-exitcode.rs | 18 - .../termination-trait-for-impl-termination.rs | 14 - .../termination-trait-for-result-box-error_ok.rs | 16 - .../termination-trait-for-result.rs | 16 - .../termination-trait-for-str.rs | 14 - .../rfcs/rfc-2005-default-binding-mode/box.rs | 27 - .../rfcs/rfc-2005-default-binding-mode/constref.rs | 50 - .../rfcs/rfc-2005-default-binding-mode/enum.rs | 55 - .../rfcs/rfc-2005-default-binding-mode/for.rs | 30 - .../rfcs/rfc-2005-default-binding-mode/general.rs | 258 -- .../rfcs/rfc-2005-default-binding-mode/lit.rs | 43 - .../rfcs/rfc-2005-default-binding-mode/range.rs | 19 - .../rfc-2005-default-binding-mode/ref-region.rs | 26 - .../rfc-2005-default-binding-mode/reset-mode.rs | 24 - .../rfcs/rfc-2005-default-binding-mode/slice.rs | 36 - .../rfcs/rfc-2005-default-binding-mode/struct.rs | 32 - .../rfc-2005-default-binding-mode/tuple-struct.rs | 28 - .../rfcs/rfc-2005-default-binding-mode/tuple.rs | 22 - .../rfc-2008-non-exhaustive/auxiliary/enums.rs | 20 - .../rfc-2008-non-exhaustive/auxiliary/structs.rs | 24 - .../rfc-2008-non-exhaustive/auxiliary/variants.rs | 19 - .../run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs | 63 - .../rfc-2008-non-exhaustive/enums_same_crate.rs | 29 - .../rfcs/rfc-2008-non-exhaustive/structs.rs | 28 - .../rfc-2008-non-exhaustive/structs_same_crate.rs | 41 - .../rfcs/rfc-2008-non-exhaustive/variants.rs | 32 - .../rfc-2008-non-exhaustive/variants_same_crate.rs | 35 - .../rfc-2126-crate-paths/crate-path-absolute.rs | 52 - .../crate-path-absolute.stderr | 8 - .../crate-path-visibility-ambiguity.rs | 25 - .../crate-path-visibility-ambiguity.stderr | 8 - .../auxiliary/xcrate.rs | 17 - .../rfcs/rfc-2126-extern-absolute-paths/basic.rs | 32 - .../rfcs/rfc-2126-extern-absolute-paths/extern.rs | 37 - .../rfcs/rfc-2126-extern-absolute-paths/test.rs | 20 - .../rfc-2126-extern-absolute-paths/whitelisted.rs | 24 - .../run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs | 25 - .../rfcs/rfc-2151-raw-identifiers/basic.rs | 30 - .../rfcs/rfc-2151-raw-identifiers/items.rs | 42 - .../rfcs/rfc-2151-raw-identifiers/macros.rs | 48 - .../rfcs/rfc-2175-or-if-while-let/basic.rs | 31 - .../ui/run-pass/rfcs/rfc-2302-self-struct-ctor.rs | 129 - ...-2421-unreserve-pure-offsetof-sizeof-alignof.rs | 23 - .../rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs | 33 - .../ui/run-pass/rfcs/rfc1445/eq-allows-match.rs | 27 - src/test/ui/run-pass/rfcs/rfc1623.rs | 84 - .../ui/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs | 15 - .../ui/run-pass/rfcs/rfc1717/library-override.rs | 24 - src/test/ui/run-pass/rfcs/rfc1857-drop-order.rs | 234 -- .../arbitrary_self_types_raw_pointer_struct.rs | 38 - .../self/arbitrary_self_types_raw_pointer_trait.rs | 71 - .../ui/run-pass/self/arbitrary_self_types_silly.rs | 31 - .../run-pass/self/arbitrary_self_types_struct.rs | 35 - .../ui/run-pass/self/arbitrary_self_types_trait.rs | 30 - .../self/arbitrary_self_types_unsized_struct.rs | 27 - .../self/auxiliary/explicit_self_xcrate.rs | 25 - .../run-pass/self/builtin-superkinds-self-type.rs | 30 - .../ui/run-pass/self/by-value-self-in-mut-slot.rs | 32 - .../ui/run-pass/self/explicit-self-closures.rs | 26 - src/test/ui/run-pass/self/explicit-self-generic.rs | 38 - .../ui/run-pass/self/explicit-self-objects-uniq.rs | 32 - src/test/ui/run-pass/self/explicit-self.rs | 82 - .../ui/run-pass/self/explicit_self_xcrate_exe.rs | 22 - src/test/ui/run-pass/self/move-self.rs | 29 - .../self/object-safety-sized-self-by-value-self.rs | 48 - .../object-safety-sized-self-generic-method.rs | 48 - .../self/object-safety-sized-self-return-Self.rs | 49 - src/test/ui/run-pass/self/self-impl.rs | 78 - .../self/self-in-mut-slot-default-method.rs | 46 - .../self/self-in-mut-slot-immediate-value.rs | 33 - src/test/ui/run-pass/self/self-in-typedefs.rs | 43 - src/test/ui/run-pass/self/self-re-assign.rs | 27 - src/test/ui/run-pass/self/self-shadowing-import.rs | 26 - src/test/ui/run-pass/self/self-type-param.rs | 28 - src/test/ui/run-pass/self/string-self-append.rs | 24 - src/test/ui/run-pass/self/ufcs-explicit-self.rs | 59 - src/test/ui/run-pass/self/uniq-self-in-mut-slot.rs | 33 - src/test/ui/run-pass/self/where-for-self.rs | 61 - .../sepcomp/auxiliary/sepcomp-extern-lib.rs | 14 - .../run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs | 16 - .../ui/run-pass/sepcomp/auxiliary/sepcomp_lib.rs | 31 - src/test/ui/run-pass/sepcomp/sepcomp-cci.rs | 44 - src/test/ui/run-pass/sepcomp/sepcomp-extern.rs | 44 - .../ui/run-pass/sepcomp/sepcomp-fns-backwards.rs | 43 - src/test/ui/run-pass/sepcomp/sepcomp-fns.rs | 41 - src/test/ui/run-pass/sepcomp/sepcomp-lib-lto.rs | 28 - src/test/ui/run-pass/sepcomp/sepcomp-lib.rs | 26 - src/test/ui/run-pass/sepcomp/sepcomp-statics.rs | 41 - src/test/ui/run-pass/sepcomp/sepcomp-unwind.rs | 44 - src/test/ui/run-pass/simd/simd-generics.rs | 49 - .../ui/run-pass/simd/simd-intrinsic-float-math.rs | 113 - .../run-pass/simd/simd-intrinsic-float-minmax.rs | 64 - .../simd/simd-intrinsic-generic-arithmetic.rs | 130 - .../run-pass/simd/simd-intrinsic-generic-cast.rs | 130 - .../simd/simd-intrinsic-generic-comparison.rs | 116 - .../simd/simd-intrinsic-generic-elements.rs | 135 - .../run-pass/simd/simd-intrinsic-generic-gather.rs | 152 - .../simd/simd-intrinsic-generic-reduction.rs | 174 - .../run-pass/simd/simd-intrinsic-generic-select.rs | 149 - src/test/ui/run-pass/simd/simd-size-align.rs | 74 - .../ui/run-pass/simd/simd-target-feature-mixup.rs | 193 -- src/test/ui/run-pass/simd/simd-type.rs | 25 - src/test/ui/run-pass/simd/simd-upgraded.rs | 34 - src/test/ui/run-pass/specialization/README.md | 37 - .../specialization/assoc-ty-graph-cycle.rs | 35 - .../auxiliary/cross_crates_defaults.rs | 49 - .../run-pass/specialization/auxiliary/go_trait.rs | 53 - .../auxiliary/specialization_cross_crate.rs | 82 - .../specialization/cross-crate-defaults.rs | 51 - .../defaultimpl/allowed-cross-crate.rs | 33 - .../defaultimpl/auxiliary/go_trait.rs | 53 - .../specialization/defaultimpl/out-of-order.rs | 29 - .../defaultimpl/overlap-projection.rs | 35 - .../specialization/defaultimpl/projection.rs | 51 - .../specialization-trait-item-not-implemented.rs | 44 - .../specialization-allowed-cross-crate.rs | 33 - .../specialization/specialization-assoc-fns.rs | 39 - .../specialization/specialization-basics.rs | 108 - .../specialization-cross-crate-no-gate.rs | 31 - .../specialization/specialization-cross-crate.rs | 60 - .../specialization-default-methods.rs | 96 - .../specialization/specialization-on-projection.rs | 33 - .../specialization/specialization-out-of-order.rs | 29 - .../specialization-overlap-projection.rs | 35 - .../specialization-projection-alias.rs | 34 - .../specialization/specialization-projection.rs | 51 - .../specialization/specialization-super-traits.rs | 27 - ...ization-translate-projections-with-lifetimes.rs | 43 - ...ialization-translate-projections-with-params.rs | 42 - .../specialization-translate-projections.rs | 43 - .../auxiliary/static-function-pointer-aux.rs | 15 - .../statics/auxiliary/static-methods-crate.rs | 39 - .../statics/auxiliary/static_fn_inline_xc_aux.rs | 23 - .../statics/auxiliary/static_fn_trait_xc_aux.rs | 21 - .../ui/run-pass/statics/auxiliary/static_mut_xc.rs | 11 - .../ui/run-pass/statics/static-fn-inline-xc.rs | 22 - src/test/ui/run-pass/statics/static-fn-trait-xc.rs | 22 - .../run-pass/statics/static-function-pointer-xc.rs | 27 - .../ui/run-pass/statics/static-function-pointer.rs | 26 - src/test/ui/run-pass/statics/static-impl.rs | 76 - .../static-method-in-trait-with-tps-intracrate.rs | 37 - .../ui/run-pass/statics/static-method-xcrate.rs | 23 - .../run-pass/statics/static-methods-in-traits.rs | 36 - .../run-pass/statics/static-methods-in-traits2.rs | 32 - src/test/ui/run-pass/statics/static-mut-foreign.rs | 51 - src/test/ui/run-pass/statics/static-mut-xc.rs | 49 - src/test/ui/run-pass/statics/static-recursive.rs | 46 - src/test/ui/run-pass/structs-enums/align-struct.rs | 255 -- .../run-pass/structs-enums/auxiliary/cci_class.rs | 24 - .../structs-enums/auxiliary/cci_class_2.rs | 29 - .../structs-enums/auxiliary/cci_class_3.rs | 29 - .../structs-enums/auxiliary/cci_class_4.rs | 51 - .../structs-enums/auxiliary/cci_class_6.rs | 35 - .../structs-enums/auxiliary/cci_class_cast.rs | 60 - .../structs-enums/auxiliary/cci_class_trait.rs | 15 - .../structs-enums/auxiliary/empty-struct.rs | 19 - .../auxiliary/namespaced_enum_emulate_flat.rs | 35 - .../structs-enums/auxiliary/namespaced_enums.rs | 20 - .../structs-enums/auxiliary/newtype_struct_xc.rs | 13 - .../auxiliary/struct_destructuring_cross_crate.rs | 16 - .../auxiliary/struct_variant_xc_aux.rs | 18 - .../auxiliary/xcrate_struct_aliases.rs | 16 - .../run-pass/structs-enums/borrow-tuple-fields.rs | 48 - .../run-pass/structs-enums/class-attributes-1.rs | 30 - .../run-pass/structs-enums/class-attributes-2.rs | 42 - .../class-cast-to-trait-cross-crate-2.rs | 30 - .../class-cast-to-trait-multiple-types.rs | 103 - .../run-pass/structs-enums/class-cast-to-trait.rs | 68 - src/test/ui/run-pass/structs-enums/class-dtor.rs | 34 - .../ui/run-pass/structs-enums/class-exports.rs | 40 - .../class-impl-very-parameterized-trait.rs | 116 - .../class-implement-trait-cross-crate.rs | 68 - .../structs-enums/class-implement-traits.rs | 73 - .../structs-enums/class-method-cross-crate.rs | 23 - .../structs-enums/class-methods-cross-crate.rs | 24 - .../ui/run-pass/structs-enums/class-methods.rs | 40 - .../class-poly-methods-cross-crate.rs | 26 - .../run-pass/structs-enums/class-poly-methods.rs | 46 - .../run-pass/structs-enums/class-separate-impl.rs | 74 - .../ui/run-pass/structs-enums/class-str-field.rs | 30 - .../ui/run-pass/structs-enums/class-typarams.rs | 41 - .../run-pass/structs-enums/classes-cross-crate.rs | 23 - .../structs-enums/classes-self-referential.rs | 29 - .../structs-enums/classes-simple-cross-crate.rs | 22 - .../structs-enums/classes-simple-method.rs | 37 - .../ui/run-pass/structs-enums/classes-simple.rs | 32 - src/test/ui/run-pass/structs-enums/classes.rs | 60 - .../structs-enums/codegen-tag-static-padding.rs | 69 - .../structs-enums/compare-generic-enums.rs | 26 - .../structs-enums/discrim-explicit-23030.rs | 157 - .../run-pass/structs-enums/empty-struct-braces.rs | 222 -- src/test/ui/run-pass/structs-enums/empty-tag.rs | 31 - .../ui/run-pass/structs-enums/enum-alignment.rs | 33 - .../structs-enums/enum-clike-ffi-as-int.rs | 42 - src/test/ui/run-pass/structs-enums/enum-discr.rs | 32 - .../structs-enums/enum-discrim-autosizing.rs | 62 - .../structs-enums/enum-discrim-manual-sizing.rs | 120 - .../structs-enums/enum-discrim-range-overflow.rs | 36 - .../structs-enums/enum-discrim-width-stuff.rs | 54 - .../run-pass/structs-enums/enum-disr-val-pretty.rs | 27 - .../structs-enums/enum-export-inheritance.rs | 24 - .../structs-enums/enum-layout-optimization.rs | 60 - .../enum-non-c-like-repr-c-and-int.rs | 178 - .../structs-enums/enum-non-c-like-repr-c.rs | 178 - .../structs-enums/enum-non-c-like-repr-int.rs | 174 - .../structs-enums/enum-null-pointer-opt.rs | 74 - .../enum-nullable-const-null-with-fields.rs | 23 - .../enum-nullable-simplifycfg-misopt.rs | 27 - .../run-pass/structs-enums/enum-univariant-repr.rs | 61 - .../ui/run-pass/structs-enums/enum-variants.rs | 26 - .../run-pass/structs-enums/enum-vec-initializer.rs | 27 - .../run-pass/structs-enums/export-abstract-tag.rs | 25 - .../run-pass/structs-enums/export-tag-variant.rs | 19 - .../ui/run-pass/structs-enums/expr-if-struct.rs | 42 - .../ui/run-pass/structs-enums/expr-match-struct.rs | 41 - .../structs-enums/field-destruction-order.rs | 56 - .../ui/run-pass/structs-enums/foreign-struct.rs | 28 - .../structs-enums/functional-struct-upd.rs | 22 - src/test/ui/run-pass/structs-enums/ivec-tag.rs | 31 - .../module-qualified-struct-destructure.rs | 24 - .../namespaced-enum-emulate-flat-xc.rs | 35 - .../structs-enums/namespaced-enum-emulate-flat.rs | 53 - .../namespaced-enum-glob-import-xcrate.rs | 36 - .../structs-enums/namespaced-enum-glob-import.rs | 44 - .../structs-enums/namespaced-enums-xcrate.rs | 26 - .../ui/run-pass/structs-enums/namespaced-enums.rs | 26 - .../structs-enums/nested-enum-same-names.rs | 36 - .../structs-enums/newtype-struct-drop-run.rs | 31 - .../structs-enums/newtype-struct-with-dtor.rs | 28 - .../run-pass/structs-enums/newtype-struct-xc-2.rs | 25 - .../ui/run-pass/structs-enums/newtype-struct-xc.rs | 20 - src/test/ui/run-pass/structs-enums/nonzero-enum.rs | 39 - .../ui/run-pass/structs-enums/numeric-fields.rs | 22 - .../object-lifetime-default-from-ref-struct.rs | 68 - .../object-lifetime-default-from-rptr-struct.rs | 47 - .../ui/run-pass/structs-enums/rec-align-u32.rs | 64 - .../ui/run-pass/structs-enums/rec-align-u64.rs | 109 - src/test/ui/run-pass/structs-enums/rec-auto.rs | 24 - src/test/ui/run-pass/structs-enums/rec-extend.rs | 28 - src/test/ui/run-pass/structs-enums/rec-tup.rs | 41 - src/test/ui/run-pass/structs-enums/rec.rs | 34 - src/test/ui/run-pass/structs-enums/record-pat.rs | 29 - .../run-pass/structs-enums/resource-in-struct.rs | 47 - .../run-pass/structs-enums/simple-generic-tag.rs | 20 - .../structs-enums/simple-match-generic-tag.rs | 22 - .../structs-enums/small-enum-range-edge.rs | 37 - .../structs-enums/small-enums-with-fields.rs | 43 - .../structs-enums/struct-aliases-xcrate.rs | 34 - .../ui/run-pass/structs-enums/struct-aliases.rs | 74 - .../struct-destructuring-cross-crate.rs | 22 - .../structs-enums/struct-field-shorthand.rs | 36 - .../structs-enums/struct-like-variant-construct.rs | 27 - .../structs-enums/struct-like-variant-match.rs | 43 - .../struct-lit-functional-no-fields.rs | 36 - .../run-pass/structs-enums/struct-literal-dtor.rs | 28 - .../structs-enums/struct-new-as-field-name.rs | 20 - .../structs-enums/struct-order-of-eval-1.rs | 25 - .../structs-enums/struct-order-of-eval-2.rs | 25 - .../structs-enums/struct-order-of-eval-3.rs | 47 - .../structs-enums/struct-order-of-eval-4.rs | 44 - .../structs-enums/struct-partial-move-1.rs | 31 - .../structs-enums/struct-partial-move-2.rs | 38 - .../structs-enums/struct-path-associated-type.rs | 36 - .../ui/run-pass/structs-enums/struct-path-self.rs | 55 - .../structs-enums/struct-pattern-matching.rs | 28 - .../ui/run-pass/structs-enums/struct-return.rs | 73 - .../struct-variant-field-visibility.rs | 26 - .../ui/run-pass/structs-enums/struct_variant_xc.rs | 21 - .../structs-enums/struct_variant_xc_match.rs | 24 - .../ui/run-pass/structs-enums/tag-align-dyn-u64.rs | 38 - .../structs-enums/tag-align-dyn-variants.rs | 76 - .../ui/run-pass/structs-enums/tag-align-shape.rs | 30 - .../ui/run-pass/structs-enums/tag-align-u64.rs | 38 - .../run-pass/structs-enums/tag-disr-val-shape.rs | 29 - src/test/ui/run-pass/structs-enums/tag-exports.rs | 30 - src/test/ui/run-pass/structs-enums/tag-in-block.rs | 24 - .../tag-variant-disr-type-mismatch.rs | 21 - .../run-pass/structs-enums/tag-variant-disr-val.rs | 76 - src/test/ui/run-pass/structs-enums/tag.rs | 39 - .../structs-enums/tuple-struct-construct.rs | 18 - .../tuple-struct-constructor-pointer.rs | 22 - .../structs-enums/tuple-struct-destructuring.rs | 20 - .../structs-enums/tuple-struct-matching.rs | 23 - .../run-pass/structs-enums/tuple-struct-trivial.rs | 17 - .../structs-enums/uninstantiable-struct.rs | 14 - .../structs-enums/unit-like-struct-drop-run.rs | 36 - .../ui/run-pass/structs-enums/unit-like-struct.rs | 19 - .../structs-enums/variant-structs-trivial.rs | 19 - src/test/ui/run-pass/thinlto/all-crates.rs | 18 - src/test/ui/run-pass/thinlto/auxiliary/dylib.rs | 16 - .../run-pass/thinlto/auxiliary/msvc-imp-present.rs | 21 - .../thinlto/auxiliary/thin-lto-inlines-aux.rs | 17 - src/test/ui/run-pass/thinlto/dylib-works.rs | 19 - src/test/ui/run-pass/thinlto/msvc-imp-present.rs | 32 - src/test/ui/run-pass/thinlto/thin-lto-inlines.rs | 40 - src/test/ui/run-pass/thinlto/thin-lto-inlines2.rs | 39 - src/test/ui/run-pass/thinlto/weak-works.rs | 38 - .../auxiliary/thread-local-extern-static.rs | 20 - src/test/ui/run-pass/threads-sendsync/comm.rs | 31 - .../threads-sendsync/send-is-not-static-par-for.rs | 43 - .../ui/run-pass/threads-sendsync/send-resource.rs | 47 - .../threads-sendsync/send-type-inference.rs | 26 - .../run-pass/threads-sendsync/send_str_hashmap.rs | 63 - .../run-pass/threads-sendsync/send_str_treemap.rs | 68 - .../ui/run-pass/threads-sendsync/sendable-class.rs | 35 - .../run-pass/threads-sendsync/sendfn-is-a-block.rs | 21 - .../threads-sendsync/sendfn-spawn-with-fn-arg.rs | 33 - src/test/ui/run-pass/threads-sendsync/spawn-fn.rs | 34 - .../ui/run-pass/threads-sendsync/spawn-types.rs | 35 - src/test/ui/run-pass/threads-sendsync/spawn.rs | 20 - src/test/ui/run-pass/threads-sendsync/spawn2.rs | 41 - .../threads-sendsync/spawning-with-debug.rs | 23 - .../threads-sendsync/std-sync-right-kind-impls.rs | 26 - .../run-pass/threads-sendsync/sync-send-atomics.rs | 24 - .../run-pass/threads-sendsync/sync-send-in-std.rs | 34 - .../sync-send-iterators-in-libcollections.rs | 80 - .../sync-send-iterators-in-libcore.rs | 117 - .../ui/run-pass/threads-sendsync/task-comm-0.rs | 39 - .../ui/run-pass/threads-sendsync/task-comm-1.rs | 23 - .../ui/run-pass/threads-sendsync/task-comm-10.rs | 41 - .../ui/run-pass/threads-sendsync/task-comm-11.rs | 30 - .../ui/run-pass/threads-sendsync/task-comm-12.rs | 37 - .../ui/run-pass/threads-sendsync/task-comm-13.rs | 27 - .../ui/run-pass/threads-sendsync/task-comm-14.rs | 45 - .../ui/run-pass/threads-sendsync/task-comm-15.rs | 37 - .../ui/run-pass/threads-sendsync/task-comm-16.rs | 119 - .../ui/run-pass/threads-sendsync/task-comm-17.rs | 26 - .../ui/run-pass/threads-sendsync/task-comm-3.rs | 72 - .../ui/run-pass/threads-sendsync/task-comm-4.rs | 54 - .../ui/run-pass/threads-sendsync/task-comm-5.rs | 27 - .../ui/run-pass/threads-sendsync/task-comm-6.rs | 50 - .../ui/run-pass/threads-sendsync/task-comm-7.rs | 67 - .../ui/run-pass/threads-sendsync/task-comm-9.rs | 44 - .../threads-sendsync/task-comm-chan-nil.rs | 23 - .../ui/run-pass/threads-sendsync/task-life-0.rs | 23 - .../threads-sendsync/task-spawn-move-and-copy.rs | 34 - .../ui/run-pass/threads-sendsync/task-stderr.rs | 42 - .../threads-sendsync/thread-local-extern-static.rs | 37 - .../threads-sendsync/thread-local-syntax.rs | 32 - src/test/ui/run-pass/threads-sendsync/threads.rs | 25 - .../tls-dtors-are-run-in-a-static-binary.rs | 32 - .../run-pass/threads-sendsync/tls-init-on-init.rs | 54 - .../ui/run-pass/threads-sendsync/tls-try-with.rs | 40 - .../ui/run-pass/traits/anon-trait-static-method.rs | 25 - .../traits/anon_trait_static_method_exe.rs | 22 - src/test/ui/run-pass/traits/assignability-trait.rs | 57 - .../traits/astconv-cycle-between-trait-and-type.rs | 39 - .../run-pass/traits/augmented-assignments-trait.rs | 22 - src/test/ui/run-pass/traits/auto-traits.rs | 40 - .../auxiliary/anon_trait_static_method_lib.rs | 19 - src/test/ui/run-pass/traits/auxiliary/go_trait.rs | 53 - .../auxiliary/trait_default_method_xc_aux.rs | 50 - .../auxiliary/trait_default_method_xc_aux_2.rs | 27 - .../auxiliary/trait_inheritance_auto_xc_2_aux.rs | 19 - .../auxiliary/trait_inheritance_auto_xc_aux.rs | 17 - .../auxiliary/trait_inheritance_overloading_xc.rs | 48 - .../run-pass/traits/auxiliary/trait_safety_lib.rs | 19 - .../run-pass/traits/auxiliary/trait_xc_call_aux.rs | 22 - src/test/ui/run-pass/traits/auxiliary/traitimpl.rs | 17 - .../ui/run-pass/traits/conservative_impl_trait.rs | 18 - .../ui/run-pass/traits/cycle-trait-type-trait.rs | 34 - .../traits/default-method-supertrait-vtable.rs | 38 - src/test/ui/run-pass/traits/dyn-trait.rs | 27 - src/test/ui/run-pass/traits/fmt-pointer-trait.rs | 34 - src/test/ui/run-pass/traits/impl-implicit-trait.rs | 35 - .../traits/impl-inherent-prefer-over-trait.rs | 40 - .../traits/infer-from-object-trait-issue-26952.rs | 34 - .../run-pass/traits/inherent-trait-method-order.rs | 35 - .../traits/kindck-owned-trait-contains-1.rs | 33 - .../ui/run-pass/traits/multiple-trait-bounds.rs | 19 - .../run-pass/traits/object-one-type-two-traits.rs | 41 - .../overlap-permitted-for-marker-traits-neg.rs | 21 - .../traits/overlap-permitted-for-marker-traits.rs | 37 - .../traits/parameterized-trait-with-bounds.rs | 31 - .../run-pass/traits/supertrait-default-generics.rs | 48 - .../ui/run-pass/traits/syntax-trait-polarity.rs | 30 - src/test/ui/run-pass/traits/trait-bounds-basic.rs | 34 - .../trait-bounds-impl-comparison-duplicates.rs | 26 - src/test/ui/run-pass/traits/trait-bounds-in-arc.rs | 118 - .../traits/trait-bounds-on-structs-and-enums.rs | 29 - .../ui/run-pass/traits/trait-bounds-recursion.rs | 30 - src/test/ui/run-pass/traits/trait-bounds.rs | 39 - .../ui/run-pass/traits/trait-cache-issue-18209.rs | 30 - .../ui/run-pass/traits/trait-coercion-generic.rs | 34 - src/test/ui/run-pass/traits/trait-coercion.rs | 43 - .../run-pass/traits/trait-composition-trivial.rs | 22 - src/test/ui/run-pass/traits/trait-copy-guessing.rs | 47 - .../traits/trait-default-method-bound-subst.rs | 28 - .../traits/trait-default-method-bound-subst2.rs | 26 - .../traits/trait-default-method-bound-subst3.rs | 27 - .../traits/trait-default-method-bound-subst4.rs | 28 - .../run-pass/traits/trait-default-method-bound.rs | 26 - .../run-pass/traits/trait-default-method-xc-2.rs | 36 - .../ui/run-pass/traits/trait-default-method-xc.rs | 90 - ...t-false-ambiguity-where-clause-builtin-bound.rs | 26 - src/test/ui/run-pass/traits/trait-generic.rs | 55 - src/test/ui/run-pass/traits/trait-impl-2.rs | 28 - src/test/ui/run-pass/traits/trait-impl.rs | 51 - .../run-pass/traits/trait-inheritance-auto-xc-2.rs | 33 - .../run-pass/traits/trait-inheritance-auto-xc.rs | 34 - .../ui/run-pass/traits/trait-inheritance-auto.rs | 38 - .../trait-inheritance-call-bound-inherited.rs | 29 - .../trait-inheritance-call-bound-inherited2.rs | 32 - ...-inheritance-cast-without-call-to-supertrait.rs | 42 - .../ui/run-pass/traits/trait-inheritance-cast.rs | 42 - .../trait-inheritance-cross-trait-call-xc.rs | 30 - .../traits/trait-inheritance-cross-trait-call.rs | 28 - .../run-pass/traits/trait-inheritance-diamond.rs | 37 - .../trait-inheritance-multiple-inheritors.rs | 32 - .../traits/trait-inheritance-multiple-params.rs | 35 - .../ui/run-pass/traits/trait-inheritance-num.rs | 21 - .../ui/run-pass/traits/trait-inheritance-num0.rs | 33 - .../ui/run-pass/traits/trait-inheritance-num1.rs | 24 - .../ui/run-pass/traits/trait-inheritance-num2.rs | 96 - .../ui/run-pass/traits/trait-inheritance-num3.rs | 29 - .../ui/run-pass/traits/trait-inheritance-num5.rs | 36 - .../traits/trait-inheritance-overloading-simple.rs | 36 - .../traits/trait-inheritance-overloading-xc-exe.rs | 30 - .../traits/trait-inheritance-overloading.rs | 57 - .../traits/trait-inheritance-self-in-supertype.rs | 72 - .../ui/run-pass/traits/trait-inheritance-self.rs | 39 - .../ui/run-pass/traits/trait-inheritance-simple.rs | 33 - .../ui/run-pass/traits/trait-inheritance-static.rs | 36 - .../run-pass/traits/trait-inheritance-static2.rs | 39 - .../ui/run-pass/traits/trait-inheritance-subst.rs | 37 - .../ui/run-pass/traits/trait-inheritance-subst2.rs | 47 - .../traits/trait-inheritance-visibility.rs | 30 - src/test/ui/run-pass/traits/trait-inheritance2.rs | 35 - .../ui/run-pass/traits/trait-item-inside-macro.rs | 40 - .../ui/run-pass/traits/trait-object-auto-dedup.rs | 54 - .../ui/run-pass/traits/trait-object-exclusion.rs | 29 - .../ui/run-pass/traits/trait-object-generics.rs | 53 - .../run-pass/traits/trait-object-lifetime-first.rs | 23 - .../traits/trait-object-with-lifetime-bound.rs | 44 - .../run-pass/traits/trait-region-pointer-simple.rs | 31 - src/test/ui/run-pass/traits/trait-safety-ok-cc.rs | 34 - src/test/ui/run-pass/traits/trait-safety-ok.rs | 28 - .../traits/trait-static-method-overwriting.rs | 43 - src/test/ui/run-pass/traits/trait-to-str.rs | 46 - .../run-pass/traits/trait-where-clause-vs-impl.rs | 53 - .../run-pass/traits/trait-with-bounds-default.rs | 42 - .../traits/traits-assoc-type-in-supertrait.rs | 33 - .../run-pass/traits/traits-conditional-dispatch.rs | 45 - .../run-pass/traits/traits-conditional-model-fn.rs | 69 - .../run-pass/traits/traits-default-method-macro.rs | 30 - .../run-pass/traits/traits-default-method-mut.rs | 20 - .../run-pass/traits/traits-default-method-self.rs | 28 - .../traits/traits-default-method-trivial.rs | 31 - .../traits/traits-elaborate-type-region.rs | 59 - .../traits-impl-object-overlap-issue-23853.rs | 28 - src/test/ui/run-pass/traits/traits-issue-22019.rs | 44 - src/test/ui/run-pass/traits/traits-issue-22110.rs | 37 - src/test/ui/run-pass/traits/traits-issue-22655.rs | 32 - src/test/ui/run-pass/traits/traits-issue-23003.rs | 42 - src/test/ui/run-pass/traits/traits-issue-26339.rs | 41 - .../traits-multidispatch-infer-convert-target.rs | 47 - .../ui/run-pass/traits/traits-negative-impls.rs | 30 - .../run-pass/traits/traits-repeated-supertrait.rs | 58 - src/test/ui/run-pass/traits/ufcs-trait-object.rs | 27 - .../ui/run-pass/traits/use-trait-before-def.rs | 20 - .../auxiliary/unboxed-closures-cross-crate.rs | 26 - .../unboxed-closures-all-traits.rs | 31 - .../unboxed-closures-blanket-fn-mut.rs | 36 - .../unboxed-closures-blanket-fn.rs | 36 - .../unboxed-closures/unboxed-closures-boxed.rs | 26 - .../unboxed-closures/unboxed-closures-by-ref.rs | 34 - .../unboxed-closures-call-fn-autoderef.rs | 27 - .../unboxed-closures-call-sugar-autoderef.rs | 25 - ...unboxed-closures-call-sugar-object-autoderef.rs | 25 - .../unboxed-closures-call-sugar-object.rs | 23 - .../unboxed-closures-counter-not-moved.rs | 37 - .../unboxed-closures-cross-crate.rs | 24 - .../unboxed-closures-direct-sugary-call.rs | 17 - .../unboxed-closures/unboxed-closures-drop.rs | 125 - .../unboxed-closures-extern-fn-hr.rs | 41 - .../unboxed-closures/unboxed-closures-extern-fn.rs | 37 - .../unboxed-closures-fn-as-fnmut-and-fnonce.rs | 54 - .../unboxed-closures-fnmut-as-fnonce.rs | 43 - .../unboxed-closures/unboxed-closures-generic.rs | 23 - ...closures-infer-arg-types-from-expected-bound.rs | 33 - ...es-infer-arg-types-from-expected-object-type.rs | 29 - ...r-arg-types-w-bound-regs-from-expected-bound.rs | 33 - .../unboxed-closures-infer-explicit-call-early.rs | 18 - .../unboxed-closures-infer-fnmut-calling-fnmut.rs | 29 - .../unboxed-closures-infer-fnmut-move.rs | 26 - .../unboxed-closures-infer-fnmut.rs | 25 - .../unboxed-closures-infer-fnonce-move.rs | 35 - .../unboxed-closures-infer-fnonce.rs | 35 - .../unboxed-closures-infer-kind.rs | 37 - .../unboxed-closures-infer-recursive-fn.rs | 55 - .../unboxed-closures-infer-upvar.rs | 23 - .../unboxed-closures-manual-impl.rs | 41 - .../unboxed-closures-monomorphization.rs | 36 - ...ed-closures-move-from-projection-issue-30046.rs | 36 - .../unboxed-closures-move-mutable.rs | 40 - ...-closures-move-some-upvars-in-by-ref-closure.rs | 33 - .../unboxed-closures/unboxed-closures-prelude.rs | 28 - .../unboxed-closures/unboxed-closures-simple.rs | 18 - .../unboxed-closures-single-word-env.rs | 32 - .../unboxed-closures-static-call-fn-once.rs | 17 - .../unboxed-closures-sugar-object.rs | 35 - .../unboxed-closures-unique-type-id.rs | 35 - .../unboxed-closures/unboxed-closures-zero-args.rs | 17 - src/test/ui/run-pass/uniform-paths/basic-nested.rs | 70 - src/test/ui/run-pass/uniform-paths/basic.rs | 44 - .../ui/run-pass/uniform-paths/macros-nested.rs | 65 - src/test/ui/run-pass/uniform-paths/macros.rs | 48 - src/test/ui/run-pass/uniform-paths/same-crate.rs | 111 - src/test/ui/run-pass/union/auxiliary/union.rs | 14 - src/test/ui/run-pass/union/union-align.rs | 72 - src/test/ui/run-pass/union/union-backcomp.rs | 33 - src/test/ui/run-pass/union/union-basic.rs | 68 - src/test/ui/run-pass/union/union-c-interop.rs | 47 - src/test/ui/run-pass/union/union-const-codegen.rs | 27 - .../ui/run-pass/union/union-const-eval-field.rs | 55 - src/test/ui/run-pass/union/union-derive.rs | 50 - src/test/ui/run-pass/union/union-drop-assign.rs | 47 - src/test/ui/run-pass/union/union-drop.rs | 68 - src/test/ui/run-pass/union/union-generic.rs | 46 - .../ui/run-pass/union/union-inherent-method.rs | 24 - src/test/ui/run-pass/union/union-macro.rs | 33 - src/test/ui/run-pass/union/union-nodrop.rs | 71 - src/test/ui/run-pass/union/union-overwrite.rs | 83 - src/test/ui/run-pass/union/union-packed.rs | 181 - .../ui/run-pass/union/union-pat-refutability.rs | 63 - src/test/ui/run-pass/union/union-trait-impl.rs | 27 - src/test/ui/run-pass/union/union-transmute.rs | 38 - .../run-pass/union/union-with-drop-fields-lint.rs | 42 - src/test/ui/run-pass/unique/unique-assign-copy.rs | 23 - src/test/ui/run-pass/unique/unique-assign-drop.rs | 21 - .../ui/run-pass/unique/unique-assign-generic.rs | 22 - src/test/ui/run-pass/unique/unique-assign.rs | 18 - .../ui/run-pass/unique/unique-autoderef-field.rs | 21 - .../ui/run-pass/unique/unique-autoderef-index.rs | 17 - src/test/ui/run-pass/unique/unique-cmp.rs | 21 - .../ui/run-pass/unique/unique-containing-tag.rs | 36 - src/test/ui/run-pass/unique/unique-create.rs | 22 - .../ui/run-pass/unique/unique-decl-init-copy.rs | 22 - src/test/ui/run-pass/unique/unique-decl-init.rs | 18 - src/test/ui/run-pass/unique/unique-decl-move.rs | 18 - src/test/ui/run-pass/unique/unique-decl.rs | 20 - src/test/ui/run-pass/unique/unique-deref.rs | 17 - src/test/ui/run-pass/unique/unique-destructure.rs | 20 - src/test/ui/run-pass/unique/unique-drop-complex.rs | 18 - src/test/ui/run-pass/unique/unique-ffi-symbols.rs | 26 - src/test/ui/run-pass/unique/unique-fn-arg-move.rs | 21 - src/test/ui/run-pass/unique/unique-fn-arg-mut.rs | 22 - src/test/ui/run-pass/unique/unique-fn-arg.rs | 22 - src/test/ui/run-pass/unique/unique-fn-ret.rs | 20 - .../ui/run-pass/unique/unique-generic-assign.rs | 20 - src/test/ui/run-pass/unique/unique-in-tag.rs | 31 - src/test/ui/run-pass/unique/unique-in-vec-copy.rs | 26 - src/test/ui/run-pass/unique/unique-in-vec.rs | 17 - src/test/ui/run-pass/unique/unique-init.rs | 18 - src/test/ui/run-pass/unique/unique-kinds.rs | 75 - src/test/ui/run-pass/unique/unique-log.rs | 17 - .../ui/run-pass/unique/unique-match-discrim.rs | 21 - src/test/ui/run-pass/unique/unique-move-drop.rs | 21 - src/test/ui/run-pass/unique/unique-move-temp.rs | 18 - src/test/ui/run-pass/unique/unique-move.rs | 19 - src/test/ui/run-pass/unique/unique-mutable.rs | 18 - src/test/ui/run-pass/unique/unique-object-move.rs | 29 - src/test/ui/run-pass/unique/unique-pat-2.rs | 27 - src/test/ui/run-pass/unique/unique-pat-3.rs | 26 - src/test/ui/run-pass/unique/unique-pat.rs | 25 - src/test/ui/run-pass/unique/unique-rec.rs | 20 - src/test/ui/run-pass/unique/unique-send-2.rs | 44 - src/test/ui/run-pass/unique/unique-send.rs | 21 - src/test/ui/run-pass/unique/unique-swap.rs | 22 - .../unsized-locals/reference-unsized-locals.rs | 19 - .../unsized-locals/simple-unsized-locals.rs | 18 - .../ui/run-pass/unsized-locals/unsized-exprs.rs | 47 - .../run-pass/unsized-locals/unsized-parameters.rs | 22 - .../where-clauses/auxiliary/where_clauses_xc.rs | 29 - .../where-clause-bounds-inconsistency.rs | 33 - .../where-clause-early-bound-lifetimes.rs | 28 - .../where-clause-method-substituion.rs | 32 - .../where-clauses/where-clause-region-outlives.rs | 20 - .../where-clauses/where-clauses-cross-crate.rs | 23 - .../where-clauses/where-clauses-lifetimes.rs | 18 - .../run-pass/where-clauses/where-clauses-method.rs | 30 - .../where-clauses-unboxed-closures.rs | 26 - .../ui/run-pass/where-clauses/where-clauses.rs | 37 - .../zero-sized/zero-size-type-destructors.rs | 31 - .../zero-sized/zero-sized-binary-heap-push.rs | 29 - .../zero-sized/zero-sized-btreemap-insert.rs | 33 - .../zero-sized/zero-sized-linkedlist-push.rs | 39 - .../run-pass/zero-sized/zero-sized-tuple-struct.rs | 22 - .../zero-sized/zero-sized-vec-deque-push.rs | 42 - .../ui/run-pass/zero-sized/zero-sized-vec-push.rs | 29 - 5590 files changed, 106225 insertions(+), 106225 deletions(-) create mode 100644 src/test/run-pass/allocator/auxiliary/custom-as-global.rs create mode 100644 src/test/run-pass/allocator/auxiliary/custom.rs create mode 100644 src/test/run-pass/allocator/auxiliary/helper.rs create mode 100644 src/test/run-pass/allocator/custom.rs create mode 100644 src/test/run-pass/allocator/xcrate-use.rs create mode 100644 src/test/run-pass/allocator/xcrate-use2.rs create mode 100644 src/test/run-pass/array-slice-vec/arr_cycle.rs create mode 100644 src/test/run-pass/array-slice-vec/array_const_index-1.rs create mode 100644 src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs create mode 100644 src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs create mode 100644 src/test/run-pass/array-slice-vec/cast-in-array-size.rs create mode 100644 src/test/run-pass/array-slice-vec/check-static-mut-slices.rs create mode 100644 src/test/run-pass/array-slice-vec/check-static-slice.rs create mode 100644 src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs create mode 100644 src/test/run-pass/array-slice-vec/destructure-array-1.rs create mode 100644 src/test/run-pass/array-slice-vec/empty-mutable-vec.rs create mode 100644 src/test/run-pass/array-slice-vec/estr-slice.rs create mode 100644 src/test/run-pass/array-slice-vec/evec-slice.rs create mode 100644 src/test/run-pass/array-slice-vec/fixed_length_copy.rs create mode 100644 src/test/run-pass/array-slice-vec/huge-largest-array.rs create mode 100644 src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs create mode 100644 src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs create mode 100644 src/test/run-pass/array-slice-vec/mutable-alias-vec.rs create mode 100644 src/test/run-pass/array-slice-vec/nested-vec-1.rs create mode 100644 src/test/run-pass/array-slice-vec/nested-vec-2.rs create mode 100644 src/test/run-pass/array-slice-vec/nested-vec-3.rs create mode 100644 src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs create mode 100644 src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs create mode 100644 src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs create mode 100644 src/test/run-pass/array-slice-vec/show-boxed-slice.rs create mode 100644 src/test/run-pass/array-slice-vec/slice-2.rs create mode 100644 src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs create mode 100644 src/test/run-pass/array-slice-vec/slice-panic-1.rs create mode 100644 src/test/run-pass/array-slice-vec/slice-panic-2.rs create mode 100644 src/test/run-pass/array-slice-vec/slice.rs create mode 100644 src/test/run-pass/array-slice-vec/slice_binary_search.rs create mode 100644 src/test/run-pass/array-slice-vec/variance-vec-covariant.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-concat.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-dst.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-fixed-length.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-growth.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-late-init.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-macro-no-std.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-macro-repeat.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-matching-fixed.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-matching-fold.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-matching.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-push.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-slice-drop.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-slice.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-tail-matching.rs create mode 100644 src/test/run-pass/array-slice-vec/vec-to_str.rs create mode 100644 src/test/run-pass/array-slice-vec/vec.rs create mode 100644 src/test/run-pass/array-slice-vec/vec_cycle.rs create mode 100644 src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs create mode 100644 src/test/run-pass/array-slice-vec/vector-no-ann-2.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-const-eval.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-cross-crate.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-in-global-const.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-inherent-impl.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-marks-live-code.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-match-patterns.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-overwrite-default.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-public-impl.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-resolution-order.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-self-type.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-type-parameters.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-use-default.rs create mode 100644 src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs create mode 100644 src/test/run-pass/associated-consts/associated-const.rs create mode 100644 src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs create mode 100644 src/test/run-pass/associated-consts/auxiliary/empty-struct.rs create mode 100644 src/test/run-pass/associated-types/associated-types-basic.rs create mode 100644 src/test/run-pass/associated-types/associated-types-binding-in-trait.rs create mode 100644 src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs create mode 100644 src/test/run-pass/associated-types/associated-types-bound.rs create mode 100644 src/test/run-pass/associated-types/associated-types-cc.rs create mode 100644 src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs create mode 100644 src/test/run-pass/associated-types/associated-types-constant-type.rs create mode 100644 src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs create mode 100644 src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs create mode 100644 src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs create mode 100644 src/test/run-pass/associated-types/associated-types-enum-field-named.rs create mode 100644 src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs create mode 100644 src/test/run-pass/associated-types/associated-types-eq-obj.rs create mode 100644 src/test/run-pass/associated-types/associated-types-impl-redirect.rs create mode 100644 src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs create mode 100644 src/test/run-pass/associated-types/associated-types-in-default-method.rs create mode 100644 src/test/run-pass/associated-types/associated-types-in-fn.rs create mode 100644 src/test/run-pass/associated-types/associated-types-in-impl-generics.rs create mode 100644 src/test/run-pass/associated-types/associated-types-in-inherent-method.rs create mode 100644 src/test/run-pass/associated-types/associated-types-issue-20220.rs create mode 100644 src/test/run-pass/associated-types/associated-types-issue-20371.rs create mode 100644 src/test/run-pass/associated-types/associated-types-issue-21212.rs create mode 100644 src/test/run-pass/associated-types/associated-types-iterator-binding.rs create mode 100644 src/test/run-pass/associated-types/associated-types-method.rs create mode 100644 src/test/run-pass/associated-types/associated-types-nested-projections.rs create mode 100644 src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs create mode 100644 src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs create mode 100644 src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs create mode 100644 src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs create mode 100644 src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs create mode 100644 src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs create mode 100644 src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs create mode 100644 src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs create mode 100644 src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs create mode 100644 src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs create mode 100644 src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs create mode 100644 src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs create mode 100644 src/test/run-pass/associated-types/associated-types-ref-from-struct.rs create mode 100644 src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs create mode 100644 src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs create mode 100644 src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs create mode 100644 src/test/run-pass/associated-types/associated-types-return.rs create mode 100644 src/test/run-pass/associated-types/associated-types-simple.rs create mode 100644 src/test/run-pass/associated-types/associated-types-stream.rs create mode 100644 src/test/run-pass/associated-types/associated-types-struct-field-named.rs create mode 100644 src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs create mode 100644 src/test/run-pass/associated-types/associated-types-sugar-path.rs create mode 100644 src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs create mode 100644 src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs create mode 100644 src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs create mode 100644 src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs create mode 100644 src/test/run-pass/autoref-autoderef/auto-ref.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-method.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoderef-privacy.rs create mode 100644 src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs create mode 100644 src/test/run-pass/bench/issue-32062.rs create mode 100644 src/test/run-pass/binding/allow_irrefutable_let_patterns.rs create mode 100644 src/test/run-pass/binding/bind-field-short-with-modifiers.rs create mode 100644 src/test/run-pass/binding/borrowed-ptr-pattern-2.rs create mode 100644 src/test/run-pass/binding/borrowed-ptr-pattern-3.rs create mode 100644 src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs create mode 100644 src/test/run-pass/binding/borrowed-ptr-pattern-option.rs create mode 100644 src/test/run-pass/binding/borrowed-ptr-pattern.rs create mode 100644 src/test/run-pass/binding/empty-types-in-patterns.rs create mode 100644 src/test/run-pass/binding/exhaustive-bool-match-sanity.rs create mode 100644 src/test/run-pass/binding/expr-match-generic-unique1.rs create mode 100644 src/test/run-pass/binding/expr-match-generic-unique2.rs create mode 100644 src/test/run-pass/binding/expr-match-generic.rs create mode 100644 src/test/run-pass/binding/expr-match-panic-all.rs create mode 100644 src/test/run-pass/binding/expr-match-panic.rs create mode 100644 src/test/run-pass/binding/expr-match-unique.rs create mode 100644 src/test/run-pass/binding/expr-match.rs create mode 100644 src/test/run-pass/binding/fat-arrow-match.rs create mode 100644 src/test/run-pass/binding/fn-pattern-expected-type-2.rs create mode 100644 src/test/run-pass/binding/fn-pattern-expected-type.rs create mode 100644 src/test/run-pass/binding/func-arg-incomplete-pattern.rs create mode 100644 src/test/run-pass/binding/func-arg-ref-pattern.rs create mode 100644 src/test/run-pass/binding/func-arg-wild-pattern.rs create mode 100644 src/test/run-pass/binding/if-let.rs create mode 100644 src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs create mode 100644 src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs create mode 100644 src/test/run-pass/binding/irrefutable-slice-patterns.rs create mode 100644 src/test/run-pass/binding/let-assignability.rs create mode 100644 src/test/run-pass/binding/let-destruct-ref.rs create mode 100644 src/test/run-pass/binding/let-var-hygiene.rs create mode 100644 src/test/run-pass/binding/match-arm-statics.rs create mode 100644 src/test/run-pass/binding/match-beginning-vert.rs create mode 100644 src/test/run-pass/binding/match-borrowed_str.rs create mode 100644 src/test/run-pass/binding/match-bot-2.rs create mode 100644 src/test/run-pass/binding/match-bot.rs create mode 100644 src/test/run-pass/binding/match-byte-array-patterns.rs create mode 100644 src/test/run-pass/binding/match-enum-struct-0.rs create mode 100644 src/test/run-pass/binding/match-enum-struct-1.rs create mode 100644 src/test/run-pass/binding/match-implicit-copy-unique.rs create mode 100644 src/test/run-pass/binding/match-in-macro.rs create mode 100644 src/test/run-pass/binding/match-join.rs create mode 100644 src/test/run-pass/binding/match-larger-const.rs create mode 100644 src/test/run-pass/binding/match-naked-record-expr.rs create mode 100644 src/test/run-pass/binding/match-naked-record.rs create mode 100644 src/test/run-pass/binding/match-path.rs create mode 100644 src/test/run-pass/binding/match-pattern-bindings.rs create mode 100644 src/test/run-pass/binding/match-pattern-lit.rs create mode 100644 src/test/run-pass/binding/match-pattern-no-type-params.rs create mode 100644 src/test/run-pass/binding/match-pattern-simple.rs create mode 100644 src/test/run-pass/binding/match-phi.rs create mode 100644 src/test/run-pass/binding/match-pipe-binding.rs create mode 100644 src/test/run-pass/binding/match-range-infer.rs create mode 100644 src/test/run-pass/binding/match-range-static.rs create mode 100644 src/test/run-pass/binding/match-range.rs create mode 100644 src/test/run-pass/binding/match-reassign.rs create mode 100644 src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs create mode 100644 src/test/run-pass/binding/match-ref-binding-mut-option.rs create mode 100644 src/test/run-pass/binding/match-ref-binding-mut.rs create mode 100644 src/test/run-pass/binding/match-ref-binding.rs create mode 100644 src/test/run-pass/binding/match-ref-unsized.rs create mode 100644 src/test/run-pass/binding/match-static-const-rename.rs create mode 100644 src/test/run-pass/binding/match-str.rs create mode 100644 src/test/run-pass/binding/match-struct-0.rs create mode 100644 src/test/run-pass/binding/match-tag.rs create mode 100644 src/test/run-pass/binding/match-unique-bind.rs create mode 100644 src/test/run-pass/binding/match-unsized.rs create mode 100644 src/test/run-pass/binding/match-value-binding-in-guard-3291.rs create mode 100644 src/test/run-pass/binding/match-var-hygiene.rs create mode 100644 src/test/run-pass/binding/match-vec-alternatives.rs create mode 100644 src/test/run-pass/binding/match-vec-rvalue.rs create mode 100644 src/test/run-pass/binding/match-with-ret-arm.rs create mode 100644 src/test/run-pass/binding/multi-let.rs create mode 100644 src/test/run-pass/binding/mut-in-ident-patterns.rs create mode 100644 src/test/run-pass/binding/nested-exhaustive-match.rs create mode 100644 src/test/run-pass/binding/nested-matchs.rs create mode 100644 src/test/run-pass/binding/nested-pattern.rs create mode 100644 src/test/run-pass/binding/nil-pattern.rs create mode 100644 src/test/run-pass/binding/nullary-or-pattern.rs create mode 100644 src/test/run-pass/binding/optional_comma_in_match_arm.rs create mode 100644 src/test/run-pass/binding/or-pattern.rs create mode 100644 src/test/run-pass/binding/order-drop-with-match.rs create mode 100644 src/test/run-pass/binding/pat-ranges.rs create mode 100644 src/test/run-pass/binding/pat-tuple-1.rs create mode 100644 src/test/run-pass/binding/pat-tuple-2.rs create mode 100644 src/test/run-pass/binding/pat-tuple-3.rs create mode 100644 src/test/run-pass/binding/pat-tuple-4.rs create mode 100644 src/test/run-pass/binding/pat-tuple-5.rs create mode 100644 src/test/run-pass/binding/pat-tuple-6.rs create mode 100644 src/test/run-pass/binding/pat-tuple-7.rs create mode 100644 src/test/run-pass/binding/pattern-bound-var-in-for-each.rs create mode 100644 src/test/run-pass/binding/pattern-in-closure.rs create mode 100644 src/test/run-pass/binding/range-inclusive-pattern-precedence.rs create mode 100644 src/test/run-pass/binding/simple-generic-match.rs create mode 100644 src/test/run-pass/binding/use-uninit-match.rs create mode 100644 src/test/run-pass/binding/use-uninit-match2.rs create mode 100644 src/test/run-pass/binding/zero_sized_subslice_match.rs create mode 100644 src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs create mode 100644 src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs create mode 100644 src/test/run-pass/borrowck/borrowck-binding-mutbl.rs create mode 100644 src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs create mode 100644 src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs create mode 100644 src/test/run-pass/borrowck/borrowck-closures-two-imm.rs create mode 100644 src/test/run-pass/borrowck/borrowck-field-sensitivity.rs create mode 100644 src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs create mode 100644 src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs create mode 100644 src/test/run-pass/borrowck/borrowck-lend-args.rs create mode 100644 src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs create mode 100644 src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs create mode 100644 src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs create mode 100644 src/test/run-pass/borrowck/borrowck-mut-uniq.rs create mode 100644 src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs create mode 100644 src/test/run-pass/borrowck/borrowck-pat-enum.rs create mode 100644 src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs create mode 100644 src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs create mode 100644 src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs create mode 100644 src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs create mode 100644 src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs create mode 100644 src/test/run-pass/borrowck/borrowck-trait-lifetime.rs create mode 100644 src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs create mode 100644 src/test/run-pass/borrowck/borrowck-univariant-enum.rs create mode 100644 src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs create mode 100644 src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs create mode 100644 src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs create mode 100644 src/test/run-pass/borrowck/two-phase-baseline.rs create mode 100644 src/test/run-pass/borrowck/two-phase-bin-ops.rs create mode 100644 src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs create mode 100644 src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs create mode 100644 src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs create mode 100644 src/test/run-pass/cfg/cfg-attr-cfg.rs create mode 100644 src/test/run-pass/cfg/cfg-attr-crate.rs create mode 100644 src/test/run-pass/cfg/cfg-family.rs create mode 100644 src/test/run-pass/cfg/cfg-in-crate-1.rs create mode 100644 src/test/run-pass/cfg/cfg-macros-foo.rs create mode 100644 src/test/run-pass/cfg/cfg-macros-notfoo.rs create mode 100644 src/test/run-pass/cfg/cfg-match-arm.rs create mode 100644 src/test/run-pass/cfg/cfg-target-family.rs create mode 100644 src/test/run-pass/cfg/cfg-target-vendor.rs create mode 100644 src/test/run-pass/cfg/cfg_attr.rs create mode 100644 src/test/run-pass/cfg/cfg_inner_static.rs create mode 100644 src/test/run-pass/cfg/cfg_stmt_expr.rs create mode 100644 src/test/run-pass/cfg/cfgs-on-items.rs create mode 100644 src/test/run-pass/cfg/conditional-compile-arch.rs create mode 100644 src/test/run-pass/cfg/conditional-compile.rs create mode 100644 src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs create mode 100644 src/test/run-pass/coerce/coerce-expect-unsized.rs create mode 100644 src/test/run-pass/coerce/coerce-overloaded-autoderef.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs create mode 100644 src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs create mode 100644 src/test/run-pass/coerce/coerce-unify-return.rs create mode 100644 src/test/run-pass/coerce/coerce-unify.rs create mode 100644 src/test/run-pass/coerce/coerce-unsize-subtype.rs create mode 100644 src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs create mode 100644 src/test/run-pass/coherence/auxiliary/coherence_lib.rs create mode 100644 src/test/run-pass/coherence/coherence-bigint-int.rs create mode 100644 src/test/run-pass/coherence/coherence-bigint-vecint.rs create mode 100644 src/test/run-pass/coherence/coherence-blanket.rs create mode 100644 src/test/run-pass/coherence/coherence-covered-type-parameter.rs create mode 100644 src/test/run-pass/coherence/coherence-impl-in-fn.rs create mode 100644 src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs create mode 100644 src/test/run-pass/coherence/coherence-iterator-vec.rs create mode 100644 src/test/run-pass/coherence/coherence-multidispatch-tuple.rs create mode 100644 src/test/run-pass/coherence/coherence-negative-impls-safe.rs create mode 100644 src/test/run-pass/coherence/coherence-rfc447-constrained.rs create mode 100644 src/test/run-pass/coherence/coherence-subtyping.rs create mode 100644 src/test/run-pass/coherence/coherence-where-clause.rs create mode 100644 src/test/run-pass/coherence/coherence_copy_like.rs create mode 100644 src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs create mode 100644 src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs create mode 100644 src/test/run-pass/consts/auxiliary/cci_const.rs create mode 100644 src/test/run-pass/consts/auxiliary/cci_const_block.rs create mode 100644 src/test/run-pass/consts/auxiliary/const_fn_lib.rs create mode 100644 src/test/run-pass/consts/const-adt-align-mismatch.rs create mode 100644 src/test/run-pass/consts/const-autoderef.rs create mode 100644 src/test/run-pass/consts/const-big-enum.rs create mode 100644 src/test/run-pass/consts/const-binops.rs create mode 100644 src/test/run-pass/consts/const-bitshift-rhs-inference.rs create mode 100644 src/test/run-pass/consts/const-block-cross-crate-fn.rs create mode 100644 src/test/run-pass/consts/const-block-item-macro-codegen.rs create mode 100644 src/test/run-pass/consts/const-block-item.rs create mode 100644 src/test/run-pass/consts/const-block.rs create mode 100644 src/test/run-pass/consts/const-bound.rs create mode 100644 src/test/run-pass/consts/const-byte-str-cast.rs create mode 100644 src/test/run-pass/consts/const-cast-ptr-int.rs create mode 100644 src/test/run-pass/consts/const-cast.rs create mode 100644 src/test/run-pass/consts/const-const.rs create mode 100644 src/test/run-pass/consts/const-contents.rs create mode 100644 src/test/run-pass/consts/const-cross-crate-const.rs create mode 100644 src/test/run-pass/consts/const-cross-crate-extern.rs create mode 100644 src/test/run-pass/consts/const-deref.rs create mode 100644 src/test/run-pass/consts/const-endianess.rs create mode 100644 src/test/run-pass/consts/const-enum-byref-self.rs create mode 100644 src/test/run-pass/consts/const-enum-byref.rs create mode 100644 src/test/run-pass/consts/const-enum-cast.rs create mode 100644 src/test/run-pass/consts/const-enum-ptr.rs create mode 100644 src/test/run-pass/consts/const-enum-struct.rs create mode 100644 src/test/run-pass/consts/const-enum-struct2.rs create mode 100644 src/test/run-pass/consts/const-enum-structlike.rs create mode 100644 src/test/run-pass/consts/const-enum-tuple.rs create mode 100644 src/test/run-pass/consts/const-enum-tuple2.rs create mode 100644 src/test/run-pass/consts/const-enum-tuplestruct.rs create mode 100644 src/test/run-pass/consts/const-enum-tuplestruct2.rs create mode 100644 src/test/run-pass/consts/const-enum-vec-index.rs create mode 100644 src/test/run-pass/consts/const-enum-vec-ptr.rs create mode 100644 src/test/run-pass/consts/const-enum-vector.rs create mode 100644 src/test/run-pass/consts/const-err.rs create mode 100644 src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs create mode 100644 src/test/run-pass/consts/const-expr-in-vec-repeat.rs create mode 100644 src/test/run-pass/consts/const-extern-function.rs create mode 100644 src/test/run-pass/consts/const-fields-and-indexing.rs create mode 100644 src/test/run-pass/consts/const-fn-const-eval.rs create mode 100644 src/test/run-pass/consts/const-fn-feature-flags.rs create mode 100644 src/test/run-pass/consts/const-fn-method.rs create mode 100644 src/test/run-pass/consts/const-fn-nested.rs create mode 100644 src/test/run-pass/consts/const-fn-stability-calls.rs create mode 100644 src/test/run-pass/consts/const-fn-val.rs create mode 100644 src/test/run-pass/consts/const-fn.rs create mode 100644 src/test/run-pass/consts/const-index-feature-gate.rs create mode 100644 src/test/run-pass/consts/const-meth-pattern.rs create mode 100644 src/test/run-pass/consts/const-negation.rs create mode 100644 src/test/run-pass/consts/const-negative.rs create mode 100644 src/test/run-pass/consts/const-nullary-enum.rs create mode 100644 src/test/run-pass/consts/const-nullary-univariant-enum.rs create mode 100644 src/test/run-pass/consts/const-pattern-variant.rs create mode 100644 src/test/run-pass/consts/const-rec-and-tup.rs create mode 100644 src/test/run-pass/consts/const-region-ptrs-noncopy.rs create mode 100644 src/test/run-pass/consts/const-region-ptrs.rs create mode 100644 src/test/run-pass/consts/const-repeated-values.rs create mode 100644 src/test/run-pass/consts/const-size_of-align_of.rs create mode 100644 src/test/run-pass/consts/const-str-ptr.rs create mode 100644 src/test/run-pass/consts/const-struct-offsets.rs create mode 100644 src/test/run-pass/consts/const-struct.rs create mode 100644 src/test/run-pass/consts/const-trait-to-trait.rs create mode 100644 src/test/run-pass/consts/const-tuple-struct.rs create mode 100644 src/test/run-pass/consts/const-typeid-of.rs create mode 100644 src/test/run-pass/consts/const-unit-struct.rs create mode 100644 src/test/run-pass/consts/const-unsafe-fn.rs create mode 100644 src/test/run-pass/consts/const-vec-of-fns.rs create mode 100644 src/test/run-pass/consts/const-vec-syntax.rs create mode 100644 src/test/run-pass/consts/const-vecs-and-slices.rs create mode 100644 src/test/run-pass/consts/const.rs create mode 100644 src/test/run-pass/consts/consts-in-patterns.rs create mode 100644 src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_const.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs create mode 100644 src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs create mode 100644 src/test/run-pass/cross-crate/cci_borrow.rs create mode 100644 src/test/run-pass/cross-crate/cci_capture_clause.rs create mode 100644 src/test/run-pass/cross-crate/cci_impl_exe.rs create mode 100644 src/test/run-pass/cross-crate/cci_iter_exe.rs create mode 100644 src/test/run-pass/cross-crate/cci_nested_exe.rs create mode 100644 src/test/run-pass/cross-crate/cci_no_inline_exe.rs create mode 100644 src/test/run-pass/cross-crate/cross-crate-const-pat.rs create mode 100644 src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs create mode 100644 src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs create mode 100644 src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs create mode 100644 src/test/run-pass/cross-crate/static-array-across-crate.rs create mode 100644 src/test/run-pass/cross-crate/xcrate-address-insignificant.rs create mode 100644 src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs create mode 100644 src/test/run-pass/cross-crate/xcrate-static-addresses.rs create mode 100644 src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs create mode 100644 src/test/run-pass/cross-crate/xcrate-unit-struct.rs create mode 100644 src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs create mode 100644 src/test/run-pass/ctfe/assoc-const.rs create mode 100644 src/test/run-pass/ctfe/bswap-const.rs create mode 100644 src/test/run-pass/ctfe/chained-constants-stackoverflow.rs create mode 100644 src/test/run-pass/ctfe/const-block-non-item-statement-3.rs create mode 100644 src/test/run-pass/ctfe/const-block-non-item-statement.rs create mode 100644 src/test/run-pass/ctfe/const-fn-destructuring-arg.rs create mode 100644 src/test/run-pass/ctfe/deref_in_pattern.rs create mode 100644 src/test/run-pass/ctfe/ice-48279.rs create mode 100644 src/test/run-pass/ctfe/issue-37550.rs create mode 100644 src/test/run-pass/ctfe/issue-broken-mir.rs create mode 100644 src/test/run-pass/ctfe/locals-in-const-fn.rs create mode 100644 src/test/run-pass/ctfe/match-const-fn-structs.rs create mode 100644 src/test/run-pass/ctfe/mozjs-error.rs create mode 100644 src/test/run-pass/ctfe/non-scalar-cast.rs create mode 100644 src/test/run-pass/ctfe/promotion.rs create mode 100644 src/test/run-pass/ctfe/references.rs create mode 100644 src/test/run-pass/ctfe/repeat_match.rs create mode 100644 src/test/run-pass/ctfe/return-in-const-fn.rs create mode 100644 src/test/run-pass/ctfe/signed_enum_discr.rs create mode 100644 src/test/run-pass/ctfe/transmute-const.rs create mode 100644 src/test/run-pass/ctfe/tuple-struct-constructors.rs create mode 100644 src/test/run-pass/deriving/auxiliary/derive-no-std.rs create mode 100644 src/test/run-pass/deriving/derive-no-std.rs create mode 100644 src/test/run-pass/deriving/derive-partialord-correctness.rs create mode 100644 src/test/run-pass/deriving/deriving-associated-types.rs create mode 100644 src/test/run-pass/deriving/deriving-bounds.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-array.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-generic-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-generic-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-clone-tuple-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-cmp-generic-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-cmp-generic-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs create mode 100644 src/test/run-pass/deriving/deriving-copyclone.rs create mode 100644 src/test/run-pass/deriving/deriving-default-box.rs create mode 100644 src/test/run-pass/deriving/deriving-enum-single-variant.rs create mode 100644 src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs create mode 100644 src/test/run-pass/deriving/deriving-hash.rs create mode 100644 src/test/run-pass/deriving/deriving-in-fn.rs create mode 100644 src/test/run-pass/deriving/deriving-in-macro.rs create mode 100644 src/test/run-pass/deriving/deriving-meta-multiple.rs create mode 100644 src/test/run-pass/deriving/deriving-meta.rs create mode 100644 src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs create mode 100644 src/test/run-pass/deriving/deriving-show-2.rs create mode 100644 src/test/run-pass/deriving/deriving-show.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-c-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-struct.rs create mode 100644 src/test/run-pass/deriving/deriving-via-extension-type-params.rs create mode 100644 src/test/run-pass/deriving/deriving-with-repr-packed.rs create mode 100644 src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs create mode 100644 src/test/run-pass/drop/drop-on-empty-block-exit.rs create mode 100644 src/test/run-pass/drop/drop-on-ret.rs create mode 100644 src/test/run-pass/drop/drop-struct-as-object.rs create mode 100644 src/test/run-pass/drop/drop-trait-enum.rs create mode 100644 src/test/run-pass/drop/drop-trait-generic.rs create mode 100644 src/test/run-pass/drop/drop-trait.rs create mode 100644 src/test/run-pass/drop/drop-uninhabited-enum.rs create mode 100644 src/test/run-pass/drop/drop-with-type-ascription-1.rs create mode 100644 src/test/run-pass/drop/drop-with-type-ascription-2.rs create mode 100644 src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs create mode 100644 src/test/run-pass/drop/dropck-eyepatch-reorder.rs create mode 100644 src/test/run-pass/drop/dropck-eyepatch.rs create mode 100644 src/test/run-pass/drop/dropck_legal_cycles.rs create mode 100644 src/test/run-pass/drop/dynamic-drop.rs create mode 100644 src/test/run-pass/drop/no-drop-flag-size.rs create mode 100644 src/test/run-pass/drop/nondrop-cycle.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-coercions.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-deref.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-field-align.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-index.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-raw.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-struct.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-trait.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs create mode 100644 src/test/run-pass/dynamically-sized-types/dst-tuple.rs create mode 100644 src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs create mode 100644 src/test/run-pass/extern/auxiliary/extern-take-value.rs create mode 100644 src/test/run-pass/extern/auxiliary/extern_calling_convention.rs create mode 100644 src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs create mode 100644 src/test/run-pass/extern/auxiliary/fat_drop.rs create mode 100644 src/test/run-pass/extern/extern-1.rs create mode 100644 src/test/run-pass/extern/extern-call-deep.rs create mode 100644 src/test/run-pass/extern/extern-call-deep2.rs create mode 100644 src/test/run-pass/extern/extern-call-direct.rs create mode 100644 src/test/run-pass/extern/extern-call-indirect.rs create mode 100644 src/test/run-pass/extern/extern-call-scrub.rs create mode 100644 src/test/run-pass/extern/extern-calling-convention-test.rs create mode 100644 src/test/run-pass/extern/extern-compare-with-return-type.rs create mode 100644 src/test/run-pass/extern/extern-crosscrate.rs create mode 100644 src/test/run-pass/extern/extern-foreign-crate.rs create mode 100644 src/test/run-pass/extern/extern-methods.rs create mode 100644 src/test/run-pass/extern/extern-mod-abi.rs create mode 100644 src/test/run-pass/extern/extern-mod-ordering-exe.rs create mode 100644 src/test/run-pass/extern/extern-pass-TwoU16s.rs create mode 100644 src/test/run-pass/extern/extern-pass-TwoU32s.rs create mode 100644 src/test/run-pass/extern/extern-pass-TwoU64s.rs create mode 100644 src/test/run-pass/extern/extern-pass-TwoU8s.rs create mode 100644 src/test/run-pass/extern/extern-pass-char.rs create mode 100644 src/test/run-pass/extern/extern-pass-double.rs create mode 100644 src/test/run-pass/extern/extern-pass-empty.rs create mode 100644 src/test/run-pass/extern/extern-pass-u32.rs create mode 100644 src/test/run-pass/extern/extern-pass-u64.rs create mode 100644 src/test/run-pass/extern/extern-prelude-core.rs create mode 100644 src/test/run-pass/extern/extern-prelude-core.stderr create mode 100644 src/test/run-pass/extern/extern-prelude-no-speculative.rs create mode 100644 src/test/run-pass/extern/extern-prelude-std.rs create mode 100644 src/test/run-pass/extern/extern-prelude-std.stderr create mode 100644 src/test/run-pass/extern/extern-pub.rs create mode 100644 src/test/run-pass/extern/extern-return-TwoU16s.rs create mode 100644 src/test/run-pass/extern/extern-return-TwoU32s.rs create mode 100644 src/test/run-pass/extern/extern-return-TwoU64s.rs create mode 100644 src/test/run-pass/extern/extern-return-TwoU8s.rs create mode 100644 src/test/run-pass/extern/extern-rust.rs create mode 100644 src/test/run-pass/extern/extern-take-value.rs create mode 100644 src/test/run-pass/extern/extern-thiscall.rs create mode 100644 src/test/run-pass/extern/extern-types-inherent-impl.rs create mode 100644 src/test/run-pass/extern/extern-types-manual-sync-send.rs create mode 100644 src/test/run-pass/extern/extern-types-pointer-cast.rs create mode 100644 src/test/run-pass/extern/extern-types-size_of_val.rs create mode 100644 src/test/run-pass/extern/extern-types-thin-pointer.rs create mode 100644 src/test/run-pass/extern/extern-types-trait-impl.rs create mode 100644 src/test/run-pass/extern/extern-vectorcall.rs create mode 100644 src/test/run-pass/extern/extern_fat_drop.rs create mode 100644 src/test/run-pass/for-loop-while/auto-loop.rs create mode 100644 src/test/run-pass/for-loop-while/break-value.rs create mode 100644 src/test/run-pass/for-loop-while/break.rs create mode 100644 src/test/run-pass/for-loop-while/for-destruct.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-goofiness.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-into-iterator.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-macro.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-no-std.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-panic.rs create mode 100644 src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-external-iterators.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-nested.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-put-structured.rs create mode 100644 src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs create mode 100644 src/test/run-pass/for-loop-while/label_break_value.rs create mode 100644 src/test/run-pass/for-loop-while/labeled-break.rs create mode 100644 src/test/run-pass/for-loop-while/linear-for-loop.rs create mode 100644 src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs create mode 100644 src/test/run-pass/for-loop-while/liveness-loop-break.rs create mode 100644 src/test/run-pass/for-loop-while/liveness-move-in-loop.rs create mode 100644 src/test/run-pass/for-loop-while/loop-break-cont-1.rs create mode 100644 src/test/run-pass/for-loop-while/loop-break-cont.rs create mode 100644 src/test/run-pass/for-loop-while/loop-break-value.rs create mode 100644 src/test/run-pass/for-loop-while/loop-diverges.rs create mode 100644 src/test/run-pass/for-loop-while/loop-label-shadowing.rs create mode 100644 src/test/run-pass/for-loop-while/loop-labeled-break-value.rs create mode 100644 src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs create mode 100644 src/test/run-pass/for-loop-while/loop-scope.rs create mode 100644 src/test/run-pass/for-loop-while/while-cont.rs create mode 100644 src/test/run-pass/for-loop-while/while-flow-graph.rs create mode 100644 src/test/run-pass/for-loop-while/while-label.rs create mode 100644 src/test/run-pass/for-loop-while/while-let.rs create mode 100644 src/test/run-pass/for-loop-while/while-loop-constraints-2.rs create mode 100644 src/test/run-pass/for-loop-while/while-prelude-drop.rs create mode 100644 src/test/run-pass/for-loop-while/while-with-break.rs create mode 100644 src/test/run-pass/for-loop-while/while.rs create mode 100644 src/test/run-pass/foreign/auxiliary/fn-abi.rs create mode 100644 src/test/run-pass/foreign/auxiliary/foreign_lib.rs create mode 100644 src/test/run-pass/foreign/foreign-call-no-runtime.rs create mode 100644 src/test/run-pass/foreign/foreign-dupe.rs create mode 100644 src/test/run-pass/foreign/foreign-fn-linkname.rs create mode 100644 src/test/run-pass/foreign/foreign-fn-with-byval.rs create mode 100644 src/test/run-pass/foreign/foreign-int-types.rs create mode 100644 src/test/run-pass/foreign/foreign-mod-src/compiletest-ignore-dir create mode 100644 src/test/run-pass/foreign/foreign-mod-src/inner.rs create mode 100644 src/test/run-pass/foreign/foreign-mod-unused-const.rs create mode 100644 src/test/run-pass/foreign/foreign-no-abi.rs create mode 100644 src/test/run-pass/foreign/foreign-src/compiletest-ignore-dir create mode 100644 src/test/run-pass/foreign/foreign-src/foreign.rs create mode 100644 src/test/run-pass/foreign/foreign-truncated-arguments.rs create mode 100644 src/test/run-pass/foreign/foreign2.rs create mode 100644 src/test/run-pass/functions-closures/auxiliary/fn-abi.rs create mode 100644 src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs create mode 100644 src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs create mode 100644 src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs create mode 100644 src/test/run-pass/functions-closures/clone-closure.rs create mode 100644 src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs create mode 100644 src/test/run-pass/functions-closures/closure-expected-type/README.md create mode 100644 src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs create mode 100644 src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs create mode 100644 src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs create mode 100644 src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs create mode 100644 src/test/run-pass/functions-closures/closure-immediate.rs create mode 100644 src/test/run-pass/functions-closures/closure-inference.rs create mode 100644 src/test/run-pass/functions-closures/closure-inference2.rs create mode 100644 src/test/run-pass/functions-closures/closure-reform.rs create mode 100644 src/test/run-pass/functions-closures/closure-returning-closure.rs create mode 100644 src/test/run-pass/functions-closures/closure-to-fn-coercion.rs create mode 100644 src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs create mode 100644 src/test/run-pass/functions-closures/copy-closure.rs create mode 100644 src/test/run-pass/functions-closures/fn-abi.rs create mode 100644 src/test/run-pass/functions-closures/fn-bare-assign.rs create mode 100644 src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs create mode 100644 src/test/run-pass/functions-closures/fn-bare-item.rs create mode 100644 src/test/run-pass/functions-closures/fn-bare-size.rs create mode 100644 src/test/run-pass/functions-closures/fn-bare-spawn.rs create mode 100644 src/test/run-pass/functions-closures/fn-coerce-field.rs create mode 100644 src/test/run-pass/functions-closures/fn-item-type-cast.rs create mode 100644 src/test/run-pass/functions-closures/fn-item-type-coerce.rs create mode 100644 src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs create mode 100644 src/test/run-pass/functions-closures/fn-lval.rs create mode 100644 src/test/run-pass/functions-closures/fn-type-infer.rs create mode 100644 src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs create mode 100644 src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs create mode 100644 src/test/run-pass/functions-closures/parallel-codegen-closures.rs create mode 100644 src/test/run-pass/functions-closures/return-from-closure.rs create mode 100644 src/test/run-pass/generator/auxiliary/xcrate-reachable.rs create mode 100644 src/test/run-pass/generator/auxiliary/xcrate.rs create mode 100644 src/test/run-pass/generator/borrow-in-tail-expr.rs create mode 100644 src/test/run-pass/generator/conditional-drop.rs create mode 100644 src/test/run-pass/generator/control-flow.rs create mode 100644 src/test/run-pass/generator/drop-env.rs create mode 100644 src/test/run-pass/generator/issue-44197.rs create mode 100644 src/test/run-pass/generator/issue-52398.rs create mode 100644 src/test/run-pass/generator/iterator-count.rs create mode 100644 src/test/run-pass/generator/live-upvar-across-yield.rs create mode 100644 src/test/run-pass/generator/match-bindings.rs create mode 100644 src/test/run-pass/generator/nested_generators.rs create mode 100644 src/test/run-pass/generator/panic-drops.rs create mode 100644 src/test/run-pass/generator/panic-safe.rs create mode 100644 src/test/run-pass/generator/reborrow-mut-upvar.rs create mode 100644 src/test/run-pass/generator/resume-after-return.rs create mode 100644 src/test/run-pass/generator/smoke.rs create mode 100644 src/test/run-pass/generator/static-generators.rs create mode 100644 src/test/run-pass/generator/too-live-local-in-immovable-gen.rs create mode 100644 src/test/run-pass/generator/xcrate-reachable.rs create mode 100644 src/test/run-pass/generator/xcrate.rs create mode 100644 src/test/run-pass/generator/yield-in-args-rev.rs create mode 100644 src/test/run-pass/generator/yield-in-box.rs create mode 100644 src/test/run-pass/generator/yield-in-initializer.rs create mode 100644 src/test/run-pass/generator/yield-subtype.rs create mode 100644 src/test/run-pass/generics/auxiliary/default_type_params_xc.rs create mode 100644 src/test/run-pass/generics/generic-alias-unique.rs create mode 100644 src/test/run-pass/generics/generic-default-type-params-cross-crate.rs create mode 100644 src/test/run-pass/generics/generic-default-type-params.rs create mode 100644 src/test/run-pass/generics/generic-derived-type.rs create mode 100644 src/test/run-pass/generics/generic-exterior-unique.rs create mode 100644 src/test/run-pass/generics/generic-extern-mangle.rs create mode 100644 src/test/run-pass/generics/generic-fn-infer.rs create mode 100644 src/test/run-pass/generics/generic-fn-twice.rs create mode 100644 src/test/run-pass/generics/generic-fn-unique.rs create mode 100644 src/test/run-pass/generics/generic-fn.rs create mode 100644 src/test/run-pass/generics/generic-ivec-leak.rs create mode 100644 src/test/run-pass/generics/generic-newtype-struct.rs create mode 100644 src/test/run-pass/generics/generic-object.rs create mode 100644 src/test/run-pass/generics/generic-recursive-tag.rs create mode 100644 src/test/run-pass/generics/generic-static-methods.rs create mode 100644 src/test/run-pass/generics/generic-tag-corruption.rs create mode 100644 src/test/run-pass/generics/generic-tag-local.rs create mode 100644 src/test/run-pass/generics/generic-tag-match.rs create mode 100644 src/test/run-pass/generics/generic-tag-values.rs create mode 100644 src/test/run-pass/generics/generic-tag.rs create mode 100644 src/test/run-pass/generics/generic-temporary.rs create mode 100644 src/test/run-pass/generics/generic-tup.rs create mode 100644 src/test/run-pass/generics/generic-type-synonym.rs create mode 100644 src/test/run-pass/generics/generic-type.rs create mode 100644 src/test/run-pass/generics/generic-unique.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs create mode 100644 src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs create mode 100644 src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs create mode 100644 src/test/run-pass/hygiene/auxiliary/my_crate.rs create mode 100644 src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs create mode 100644 src/test/run-pass/hygiene/auxiliary/xcrate.rs create mode 100644 src/test/run-pass/hygiene/hygiene-dodging-1.rs create mode 100644 src/test/run-pass/hygiene/hygiene.rs create mode 100644 src/test/run-pass/hygiene/hygienic-labels-in-let.rs create mode 100644 src/test/run-pass/hygiene/hygienic-labels-in-let.stderr create mode 100644 src/test/run-pass/hygiene/hygienic-labels.rs create mode 100644 src/test/run-pass/hygiene/hygienic-labels.stderr create mode 100644 src/test/run-pass/hygiene/issue-44128.rs create mode 100644 src/test/run-pass/hygiene/issue-47311.rs create mode 100644 src/test/run-pass/hygiene/issue-47312.rs create mode 100644 src/test/run-pass/hygiene/items.rs create mode 100644 src/test/run-pass/hygiene/legacy_interaction.rs create mode 100644 src/test/run-pass/hygiene/lexical.rs create mode 100644 src/test/run-pass/hygiene/specialization.rs create mode 100644 src/test/run-pass/hygiene/trait_items.rs create mode 100644 src/test/run-pass/hygiene/ty_params.rs create mode 100644 src/test/run-pass/hygiene/wrap_unhygienic_example.rs create mode 100644 src/test/run-pass/hygiene/xcrate.rs create mode 100644 src/test/run-pass/impl-trait/auto-trait-leak.rs create mode 100644 src/test/run-pass/impl-trait/auxiliary/xcrate.rs create mode 100644 src/test/run-pass/impl-trait/bounds_regression.rs create mode 100644 src/test/run-pass/impl-trait/equality.rs create mode 100644 src/test/run-pass/impl-trait/example-calendar.rs create mode 100644 src/test/run-pass/impl-trait/example-st.rs create mode 100644 src/test/run-pass/impl-trait/existential-minimal.rs create mode 100644 src/test/run-pass/impl-trait/issue-42479.rs create mode 100644 src/test/run-pass/impl-trait/issue-49376.rs create mode 100644 src/test/run-pass/impl-trait/lifetimes.rs create mode 100644 src/test/run-pass/impl-trait/nesting.rs create mode 100644 src/test/run-pass/impl-trait/universal_hrtb_anon.rs create mode 100644 src/test/run-pass/impl-trait/universal_hrtb_named.rs create mode 100644 src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs create mode 100644 src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs create mode 100644 src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs create mode 100644 src/test/run-pass/impl-trait/universal_multiple_bounds.rs create mode 100644 src/test/run-pass/impl-trait/xcrate.rs create mode 100644 src/test/run-pass/impl-trait/xcrate_simple.rs create mode 100644 src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs create mode 100644 src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs create mode 100644 src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs create mode 100644 src/test/run-pass/imports/import-from.rs create mode 100644 src/test/run-pass/imports/import-glob-0.rs create mode 100644 src/test/run-pass/imports/import-glob-1.rs create mode 100644 src/test/run-pass/imports/import-glob-crate.rs create mode 100644 src/test/run-pass/imports/import-in-block.rs create mode 100644 src/test/run-pass/imports/import-prefix-macro.rs create mode 100644 src/test/run-pass/imports/import-rename.rs create mode 100644 src/test/run-pass/imports/import-trailing-comma.rs create mode 100644 src/test/run-pass/imports/import.rs create mode 100644 src/test/run-pass/imports/import2.rs create mode 100644 src/test/run-pass/imports/import3.rs create mode 100644 src/test/run-pass/imports/import4.rs create mode 100644 src/test/run-pass/imports/import5.rs create mode 100644 src/test/run-pass/imports/import6.rs create mode 100644 src/test/run-pass/imports/import7.rs create mode 100644 src/test/run-pass/imports/import8.rs create mode 100644 src/test/run-pass/imports/imports.rs create mode 100644 src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-alignment.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-assume.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-atomics.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-move-val.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-uninit.rs create mode 100644 src/test/run-pass/intrinsics/intrinsic-unreachable.rs create mode 100644 src/test/run-pass/intrinsics/intrinsics-integer.rs create mode 100644 src/test/run-pass/intrinsics/intrinsics-math.rs create mode 100644 src/test/run-pass/issues/.gitattributes create mode 100644 src/test/run-pass/issues/auxiliary/cgu_test.rs create mode 100644 src/test/run-pass/issues/auxiliary/cgu_test_a.rs create mode 100644 src/test/run-pass/issues/auxiliary/cgu_test_b.rs create mode 100644 src/test/run-pass/issues/auxiliary/i8.rs create mode 100644 src/test/run-pass/issues/auxiliary/iss.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-10028.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-11224.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-11225-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-11225-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-11225-3.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-11508.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-11529.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-12660-aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-13620-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-13620-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-13872-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-13872-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-13872-3.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-14344-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-14344-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-14421.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-14422.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-15562.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-16643.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-17662.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-17718-aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-18501.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-18514.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-18711.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-18913-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-18913-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-19340-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2380.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2414-a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2414-b.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-25185-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-25185-2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2526.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-25467.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-2631-a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-29485.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-3012-1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-36954.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-41394.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-4208-cc.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-4545.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-48984-aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-5518.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-5521.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-7178.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-7899.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-8044.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-8259.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-9906.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue-9968.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue13507.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue2170lib.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue34796aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_10031_aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_12612_1.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_12612_2.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_19293.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_20389.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_2316_a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_2316_b.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_2472_b.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_2723_a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_3136_a.rc create mode 100644 src/test/run-pass/issues/auxiliary/issue_3136_a.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_38190.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_38226_aux.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_38715-modern.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_38715.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_3979_traits.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_39823.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_40469.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_41053.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_42007_s.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_8401.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_9123.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_9155.rs create mode 100644 src/test/run-pass/issues/auxiliary/issue_9188.rs create mode 100644 src/test/run-pass/issues/issue-10025.rs create mode 100644 src/test/run-pass/issues/issue-10028.rs create mode 100644 src/test/run-pass/issues/issue-10031.rs create mode 100644 src/test/run-pass/issues/issue-10228.rs create mode 100644 src/test/run-pass/issues/issue-10392.rs create mode 100644 src/test/run-pass/issues/issue-10396.rs create mode 100644 src/test/run-pass/issues/issue-10436.rs create mode 100644 src/test/run-pass/issues/issue-10456.rs create mode 100644 src/test/run-pass/issues/issue-10626.rs create mode 100644 src/test/run-pass/issues/issue-10638.rs create mode 100644 src/test/run-pass/issues/issue-10682.rs create mode 100644 src/test/run-pass/issues/issue-10683.rs create mode 100644 src/test/run-pass/issues/issue-10718.rs create mode 100644 src/test/run-pass/issues/issue-10734.rs create mode 100644 src/test/run-pass/issues/issue-10763.rs create mode 100644 src/test/run-pass/issues/issue-10764.rs create mode 100644 src/test/run-pass/issues/issue-10767.rs create mode 100644 src/test/run-pass/issues/issue-10802.rs create mode 100644 src/test/run-pass/issues/issue-10806.rs create mode 100644 src/test/run-pass/issues/issue-10853.rs create mode 100644 src/test/run-pass/issues/issue-10902.rs create mode 100644 src/test/run-pass/issues/issue-11047.rs create mode 100644 src/test/run-pass/issues/issue-11085.rs create mode 100644 src/test/run-pass/issues/issue-1112.rs create mode 100644 src/test/run-pass/issues/issue-11205.rs create mode 100644 src/test/run-pass/issues/issue-11224.rs create mode 100644 src/test/run-pass/issues/issue-11225-1.rs create mode 100644 src/test/run-pass/issues/issue-11225-2.rs create mode 100644 src/test/run-pass/issues/issue-11225-3.rs create mode 100644 src/test/run-pass/issues/issue-11267.rs create mode 100644 src/test/run-pass/issues/issue-11382.rs create mode 100644 src/test/run-pass/issues/issue-11384.rs create mode 100644 src/test/run-pass/issues/issue-11508.rs create mode 100644 src/test/run-pass/issues/issue-11529.rs create mode 100644 src/test/run-pass/issues/issue-11552.rs create mode 100644 src/test/run-pass/issues/issue-11577.rs create mode 100644 src/test/run-pass/issues/issue-11592.rs create mode 100644 src/test/run-pass/issues/issue-11612.rs create mode 100644 src/test/run-pass/issues/issue-11677.rs create mode 100644 src/test/run-pass/issues/issue-11709.rs create mode 100644 src/test/run-pass/issues/issue-11820.rs create mode 100644 src/test/run-pass/issues/issue-11869.rs create mode 100644 src/test/run-pass/issues/issue-11940.rs create mode 100644 src/test/run-pass/issues/issue-11958.rs create mode 100644 src/test/run-pass/issues/issue-12033.rs create mode 100644 src/test/run-pass/issues/issue-12133-1.rs create mode 100644 src/test/run-pass/issues/issue-12133-2.rs create mode 100644 src/test/run-pass/issues/issue-12133-3.rs create mode 100644 src/test/run-pass/issues/issue-12285.rs create mode 100644 src/test/run-pass/issues/issue-1251.rs create mode 100644 src/test/run-pass/issues/issue-1257.rs create mode 100644 src/test/run-pass/issues/issue-12582.rs create mode 100644 src/test/run-pass/issues/issue-12612.rs create mode 100644 src/test/run-pass/issues/issue-12660.rs create mode 100644 src/test/run-pass/issues/issue-12677.rs create mode 100644 src/test/run-pass/issues/issue-12699.rs create mode 100644 src/test/run-pass/issues/issue-12729.rs create mode 100644 src/test/run-pass/issues/issue-12744.rs create mode 100644 src/test/run-pass/issues/issue-12860.rs create mode 100644 src/test/run-pass/issues/issue-12909.rs create mode 100644 src/test/run-pass/issues/issue-13027.rs create mode 100644 src/test/run-pass/issues/issue-13105.rs create mode 100644 src/test/run-pass/issues/issue-13167.rs create mode 100644 src/test/run-pass/issues/issue-13204.rs create mode 100644 src/test/run-pass/issues/issue-13214.rs create mode 100644 src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs create mode 100644 src/test/run-pass/issues/issue-13264.rs create mode 100644 src/test/run-pass/issues/issue-13304.rs create mode 100644 src/test/run-pass/issues/issue-13323.rs create mode 100644 src/test/run-pass/issues/issue-13405.rs create mode 100644 src/test/run-pass/issues/issue-13434.rs create mode 100644 src/test/run-pass/issues/issue-13494.rs create mode 100644 src/test/run-pass/issues/issue-13507-2.rs create mode 100644 src/test/run-pass/issues/issue-13620.rs create mode 100644 src/test/run-pass/issues/issue-13655.rs create mode 100644 src/test/run-pass/issues/issue-13665.rs create mode 100644 src/test/run-pass/issues/issue-13703.rs create mode 100644 src/test/run-pass/issues/issue-13763.rs create mode 100644 src/test/run-pass/issues/issue-13775.rs create mode 100644 src/test/run-pass/issues/issue-13808.rs create mode 100644 src/test/run-pass/issues/issue-13837.rs create mode 100644 src/test/run-pass/issues/issue-13867.rs create mode 100644 src/test/run-pass/issues/issue-13872.rs create mode 100644 src/test/run-pass/issues/issue-13902.rs create mode 100644 src/test/run-pass/issues/issue-14082.rs create mode 100644 src/test/run-pass/issues/issue-14229.rs create mode 100644 src/test/run-pass/issues/issue-14254.rs create mode 100644 src/test/run-pass/issues/issue-14308.rs create mode 100644 src/test/run-pass/issues/issue-14330.rs create mode 100644 src/test/run-pass/issues/issue-14344.rs create mode 100644 src/test/run-pass/issues/issue-14382.rs create mode 100644 src/test/run-pass/issues/issue-14393.rs create mode 100644 src/test/run-pass/issues/issue-14399.rs create mode 100644 src/test/run-pass/issues/issue-14421.rs create mode 100644 src/test/run-pass/issues/issue-14422.rs create mode 100644 src/test/run-pass/issues/issue-14456.rs create mode 100644 src/test/run-pass/issues/issue-1451.rs create mode 100644 src/test/run-pass/issues/issue-14589.rs create mode 100644 src/test/run-pass/issues/issue-1460.rs create mode 100644 src/test/run-pass/issues/issue-14821.rs create mode 100644 src/test/run-pass/issues/issue-14837.rs create mode 100644 src/test/run-pass/issues/issue-14865.rs create mode 100644 src/test/run-pass/issues/issue-14875.rs create mode 100644 src/test/run-pass/issues/issue-14901.rs create mode 100644 src/test/run-pass/issues/issue-14919.rs create mode 100644 src/test/run-pass/issues/issue-14933.rs create mode 100644 src/test/run-pass/issues/issue-14936.rs create mode 100644 src/test/run-pass/issues/issue-14940.rs create mode 100644 src/test/run-pass/issues/issue-14958.rs create mode 100644 src/test/run-pass/issues/issue-14959.rs create mode 100644 src/test/run-pass/issues/issue-15043.rs create mode 100644 src/test/run-pass/issues/issue-15063.rs create mode 100644 src/test/run-pass/issues/issue-15080.rs create mode 100644 src/test/run-pass/issues/issue-15104.rs create mode 100644 src/test/run-pass/issues/issue-15108.rs create mode 100644 src/test/run-pass/issues/issue-15129.rs create mode 100644 src/test/run-pass/issues/issue-15155.rs create mode 100644 src/test/run-pass/issues/issue-15189.rs create mode 100644 src/test/run-pass/issues/issue-15221.rs create mode 100644 src/test/run-pass/issues/issue-15261.rs create mode 100644 src/test/run-pass/issues/issue-15444.rs create mode 100644 src/test/run-pass/issues/issue-15487.rs create mode 100644 src/test/run-pass/issues/issue-15523-big.rs create mode 100644 src/test/run-pass/issues/issue-15523.rs create mode 100644 src/test/run-pass/issues/issue-15562.rs create mode 100644 src/test/run-pass/issues/issue-15571.rs create mode 100644 src/test/run-pass/issues/issue-15673.rs create mode 100644 src/test/run-pass/issues/issue-15689-1.rs create mode 100644 src/test/run-pass/issues/issue-15689-2.rs create mode 100644 src/test/run-pass/issues/issue-15730.rs create mode 100644 src/test/run-pass/issues/issue-15734.rs create mode 100644 src/test/run-pass/issues/issue-15735.rs create mode 100644 src/test/run-pass/issues/issue-15763.rs create mode 100644 src/test/run-pass/issues/issue-15774.rs create mode 100644 src/test/run-pass/issues/issue-15793.rs create mode 100644 src/test/run-pass/issues/issue-15858.rs create mode 100644 src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs create mode 100644 src/test/run-pass/issues/issue-16151.rs create mode 100644 src/test/run-pass/issues/issue-16256.rs create mode 100644 src/test/run-pass/issues/issue-16272.rs create mode 100644 src/test/run-pass/issues/issue-16278.rs create mode 100644 src/test/run-pass/issues/issue-16441.rs create mode 100644 src/test/run-pass/issues/issue-16452.rs create mode 100644 src/test/run-pass/issues/issue-16492.rs create mode 100644 src/test/run-pass/issues/issue-16530.rs create mode 100644 src/test/run-pass/issues/issue-16560.rs create mode 100644 src/test/run-pass/issues/issue-16596.rs create mode 100644 src/test/run-pass/issues/issue-16597-empty.rs create mode 100644 src/test/run-pass/issues/issue-16597.rs create mode 100644 src/test/run-pass/issues/issue-1660.rs create mode 100644 src/test/run-pass/issues/issue-16602-1.rs create mode 100644 src/test/run-pass/issues/issue-16602-2.rs create mode 100644 src/test/run-pass/issues/issue-16602-3.rs create mode 100644 src/test/run-pass/issues/issue-16643.rs create mode 100644 src/test/run-pass/issues/issue-16648.rs create mode 100644 src/test/run-pass/issues/issue-16668.rs create mode 100644 src/test/run-pass/issues/issue-16671.rs create mode 100644 src/test/run-pass/issues/issue-16739.rs create mode 100644 src/test/run-pass/issues/issue-16745.rs create mode 100644 src/test/run-pass/issues/issue-16774.rs create mode 100644 src/test/run-pass/issues/issue-16783.rs create mode 100644 src/test/run-pass/issues/issue-16819.rs create mode 100644 src/test/run-pass/issues/issue-16922.rs create mode 100644 src/test/run-pass/issues/issue-1696.rs create mode 100644 src/test/run-pass/issues/issue-1701.rs create mode 100644 src/test/run-pass/issues/issue-17068.rs create mode 100644 src/test/run-pass/issues/issue-17074.rs create mode 100644 src/test/run-pass/issues/issue-17121.rs create mode 100644 src/test/run-pass/issues/issue-17170.rs create mode 100644 src/test/run-pass/issues/issue-17216.rs create mode 100644 src/test/run-pass/issues/issue-17233.rs create mode 100644 src/test/run-pass/issues/issue-17302.rs create mode 100644 src/test/run-pass/issues/issue-17322.rs create mode 100644 src/test/run-pass/issues/issue-17336.rs create mode 100644 src/test/run-pass/issues/issue-17351.rs create mode 100644 src/test/run-pass/issues/issue-17361.rs create mode 100644 src/test/run-pass/issues/issue-17450.rs create mode 100644 src/test/run-pass/issues/issue-17503.rs create mode 100644 src/test/run-pass/issues/issue-17662.rs create mode 100644 src/test/run-pass/issues/issue-17718-borrow-interior.rs create mode 100644 src/test/run-pass/issues/issue-17718-const-destructors.rs create mode 100644 src/test/run-pass/issues/issue-17718-parse-const.rs create mode 100644 src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs create mode 100644 src/test/run-pass/issues/issue-17718.rs create mode 100644 src/test/run-pass/issues/issue-17732.rs create mode 100644 src/test/run-pass/issues/issue-17734.rs create mode 100644 src/test/run-pass/issues/issue-17746.rs create mode 100644 src/test/run-pass/issues/issue-17756.rs create mode 100644 src/test/run-pass/issues/issue-17771.rs create mode 100644 src/test/run-pass/issues/issue-17816.rs create mode 100644 src/test/run-pass/issues/issue-17877.rs create mode 100644 src/test/run-pass/issues/issue-17897.rs create mode 100644 src/test/run-pass/issues/issue-17904.rs create mode 100644 src/test/run-pass/issues/issue-18060.rs create mode 100644 src/test/run-pass/issues/issue-18075.rs create mode 100644 src/test/run-pass/issues/issue-18083.rs create mode 100644 src/test/run-pass/issues/issue-18088.rs create mode 100644 src/test/run-pass/issues/issue-18110.rs create mode 100644 src/test/run-pass/issues/issue-18173.rs create mode 100644 src/test/run-pass/issues/issue-18188.rs create mode 100644 src/test/run-pass/issues/issue-1821.rs create mode 100644 src/test/run-pass/issues/issue-18232.rs create mode 100644 src/test/run-pass/issues/issue-18352.rs create mode 100644 src/test/run-pass/issues/issue-18353.rs create mode 100644 src/test/run-pass/issues/issue-18412.rs create mode 100644 src/test/run-pass/issues/issue-18425.rs create mode 100644 src/test/run-pass/issues/issue-18446.rs create mode 100644 src/test/run-pass/issues/issue-18464.rs create mode 100644 src/test/run-pass/issues/issue-18501.rs create mode 100644 src/test/run-pass/issues/issue-18514.rs create mode 100644 src/test/run-pass/issues/issue-18539.rs create mode 100644 src/test/run-pass/issues/issue-18652.rs create mode 100644 src/test/run-pass/issues/issue-18655.rs create mode 100644 src/test/run-pass/issues/issue-1866.rs create mode 100644 src/test/run-pass/issues/issue-18661.rs create mode 100644 src/test/run-pass/issues/issue-18685.rs create mode 100644 src/test/run-pass/issues/issue-18711.rs create mode 100644 src/test/run-pass/issues/issue-18738.rs create mode 100644 src/test/run-pass/issues/issue-18767.rs create mode 100644 src/test/run-pass/issues/issue-18804/auxiliary/lib.rs create mode 100644 src/test/run-pass/issues/issue-18804/main.rs create mode 100644 src/test/run-pass/issues/issue-18809.rs create mode 100644 src/test/run-pass/issues/issue-18845.rs create mode 100644 src/test/run-pass/issues/issue-18859.rs create mode 100644 src/test/run-pass/issues/issue-18906.rs create mode 100644 src/test/run-pass/issues/issue-18913.rs create mode 100644 src/test/run-pass/issues/issue-18937-1.rs create mode 100644 src/test/run-pass/issues/issue-18988.rs create mode 100644 src/test/run-pass/issues/issue-19001.rs create mode 100644 src/test/run-pass/issues/issue-19037.rs create mode 100644 src/test/run-pass/issues/issue-19081.rs create mode 100644 src/test/run-pass/issues/issue-19097.rs create mode 100644 src/test/run-pass/issues/issue-19098.rs create mode 100644 src/test/run-pass/issues/issue-19102.rs create mode 100644 src/test/run-pass/issues/issue-19127.rs create mode 100644 src/test/run-pass/issues/issue-19129-1.rs create mode 100644 src/test/run-pass/issues/issue-19129-2.rs create mode 100644 src/test/run-pass/issues/issue-19135.rs create mode 100644 src/test/run-pass/issues/issue-19244.rs create mode 100644 src/test/run-pass/issues/issue-19293.rs create mode 100644 src/test/run-pass/issues/issue-19340-1.rs create mode 100644 src/test/run-pass/issues/issue-19340-2.rs create mode 100644 src/test/run-pass/issues/issue-19358.rs create mode 100644 src/test/run-pass/issues/issue-19367.rs create mode 100644 src/test/run-pass/issues/issue-19398.rs create mode 100644 src/test/run-pass/issues/issue-19404.rs create mode 100644 src/test/run-pass/issues/issue-19479.rs create mode 100644 src/test/run-pass/issues/issue-19499.rs create mode 100644 src/test/run-pass/issues/issue-19631.rs create mode 100644 src/test/run-pass/issues/issue-19632.rs create mode 100644 src/test/run-pass/issues/issue-1974.rs create mode 100644 src/test/run-pass/issues/issue-19811-escape-unicode.rs create mode 100644 src/test/run-pass/issues/issue-19850.rs create mode 100644 src/test/run-pass/issues/issue-19982.rs create mode 100644 src/test/run-pass/issues/issue-20009.rs create mode 100644 src/test/run-pass/issues/issue-20055-box-trait.rs create mode 100644 src/test/run-pass/issues/issue-20055-box-unsized-array.rs create mode 100644 src/test/run-pass/issues/issue-20091.rs create mode 100644 src/test/run-pass/issues/issue-20174.rs create mode 100644 src/test/run-pass/issues/issue-20186.rs create mode 100644 src/test/run-pass/issues/issue-20313.rs create mode 100644 src/test/run-pass/issues/issue-20343.rs create mode 100644 src/test/run-pass/issues/issue-20389.rs create mode 100644 src/test/run-pass/issues/issue-20396.rs create mode 100644 src/test/run-pass/issues/issue-20414.rs create mode 100644 src/test/run-pass/issues/issue-20427.rs create mode 100644 src/test/run-pass/issues/issue-20454.rs create mode 100644 src/test/run-pass/issues/issue-20544.rs create mode 100644 src/test/run-pass/issues/issue-20575.rs create mode 100644 src/test/run-pass/issues/issue-20616.rs create mode 100644 src/test/run-pass/issues/issue-2063-resource.rs create mode 100644 src/test/run-pass/issues/issue-2063.rs create mode 100644 src/test/run-pass/issues/issue-20644.rs create mode 100644 src/test/run-pass/issues/issue-20676.rs create mode 100644 src/test/run-pass/issues/issue-2074.rs create mode 100644 src/test/run-pass/issues/issue-20763-1.rs create mode 100644 src/test/run-pass/issues/issue-20763-2.rs create mode 100644 src/test/run-pass/issues/issue-20797.rs create mode 100644 src/test/run-pass/issues/issue-20803.rs create mode 100644 src/test/run-pass/issues/issue-20823.rs create mode 100644 src/test/run-pass/issues/issue-20825.rs create mode 100644 src/test/run-pass/issues/issue-20847.rs create mode 100644 src/test/run-pass/issues/issue-20953.rs create mode 100644 src/test/run-pass/issues/issue-21033.rs create mode 100644 src/test/run-pass/issues/issue-21058.rs create mode 100644 src/test/run-pass/issues/issue-21140.rs create mode 100644 src/test/run-pass/issues/issue-21174.rs create mode 100644 src/test/run-pass/issues/issue-21245.rs create mode 100644 src/test/run-pass/issues/issue-21291.rs create mode 100644 src/test/run-pass/issues/issue-21306.rs create mode 100644 src/test/run-pass/issues/issue-21361.rs create mode 100644 src/test/run-pass/issues/issue-21363.rs create mode 100644 src/test/run-pass/issues/issue-21384.rs create mode 100644 src/test/run-pass/issues/issue-21400.rs create mode 100644 src/test/run-pass/issues/issue-21402.rs create mode 100644 src/test/run-pass/issues/issue-21475.rs create mode 100644 src/test/run-pass/issues/issue-21486.rs create mode 100644 src/test/run-pass/issues/issue-21520.rs create mode 100644 src/test/run-pass/issues/issue-21562.rs create mode 100644 src/test/run-pass/issues/issue-21622.rs create mode 100644 src/test/run-pass/issues/issue-21634.rs create mode 100644 src/test/run-pass/issues/issue-21655.rs create mode 100644 src/test/run-pass/issues/issue-21721.rs create mode 100644 src/test/run-pass/issues/issue-21726.rs create mode 100644 src/test/run-pass/issues/issue-21891.rs create mode 100644 src/test/run-pass/issues/issue-2190-1.rs create mode 100644 src/test/run-pass/issues/issue-21909.rs create mode 100644 src/test/run-pass/issues/issue-21922.rs create mode 100644 src/test/run-pass/issues/issue-22008.rs create mode 100644 src/test/run-pass/issues/issue-22036.rs create mode 100644 src/test/run-pass/issues/issue-22066.rs create mode 100644 src/test/run-pass/issues/issue-2214.rs create mode 100644 src/test/run-pass/issues/issue-2216.rs create mode 100644 src/test/run-pass/issues/issue-22258.rs create mode 100644 src/test/run-pass/issues/issue-22346.rs create mode 100644 src/test/run-pass/issues/issue-22356.rs create mode 100644 src/test/run-pass/issues/issue-22375.rs create mode 100644 src/test/run-pass/issues/issue-22403.rs create mode 100644 src/test/run-pass/issues/issue-22426.rs create mode 100644 src/test/run-pass/issues/issue-22463.rs create mode 100644 src/test/run-pass/issues/issue-22471.rs create mode 100644 src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs create mode 100644 src/test/run-pass/issues/issue-22546.rs create mode 100644 src/test/run-pass/issues/issue-22577.rs create mode 100644 src/test/run-pass/issues/issue-22629.rs create mode 100644 src/test/run-pass/issues/issue-22777.rs create mode 100644 src/test/run-pass/issues/issue-22781.rs create mode 100644 src/test/run-pass/issues/issue-22814.rs create mode 100644 src/test/run-pass/issues/issue-22828.rs create mode 100644 src/test/run-pass/issues/issue-2284.rs create mode 100644 src/test/run-pass/issues/issue-22864-1.rs create mode 100644 src/test/run-pass/issues/issue-22864-2.rs create mode 100644 src/test/run-pass/issues/issue-2288.rs create mode 100644 src/test/run-pass/issues/issue-22894.rs create mode 100644 src/test/run-pass/issues/issue-22992-2.rs create mode 100644 src/test/run-pass/issues/issue-22992.rs create mode 100644 src/test/run-pass/issues/issue-23036.rs create mode 100644 src/test/run-pass/issues/issue-2311-2.rs create mode 100644 src/test/run-pass/issues/issue-2311.rs create mode 100644 src/test/run-pass/issues/issue-2312.rs create mode 100644 src/test/run-pass/issues/issue-2316-c.rs create mode 100644 src/test/run-pass/issues/issue-23208.rs create mode 100644 src/test/run-pass/issues/issue-23261.rs create mode 100644 src/test/run-pass/issues/issue-23304-1.rs create mode 100644 src/test/run-pass/issues/issue-23304-2.rs create mode 100644 src/test/run-pass/issues/issue-23311.rs create mode 100644 src/test/run-pass/issues/issue-23336.rs create mode 100644 src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs create mode 100644 src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs create mode 100644 src/test/run-pass/issues/issue-23406.rs create mode 100644 src/test/run-pass/issues/issue-23433.rs create mode 100644 src/test/run-pass/issues/issue-23442.rs create mode 100644 src/test/run-pass/issues/issue-23477.rs create mode 100644 src/test/run-pass/issues/issue-23485.rs create mode 100644 src/test/run-pass/issues/issue-23491.rs create mode 100644 src/test/run-pass/issues/issue-23550.rs create mode 100644 src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs create mode 100644 src/test/run-pass/issues/issue-23649-1.rs create mode 100644 src/test/run-pass/issues/issue-23649-2.rs create mode 100644 src/test/run-pass/issues/issue-23649-3.rs create mode 100644 src/test/run-pass/issues/issue-23699.rs create mode 100644 src/test/run-pass/issues/issue-23781.rs create mode 100644 src/test/run-pass/issues/issue-2380-b.rs create mode 100644 src/test/run-pass/issues/issue-23808.rs create mode 100644 src/test/run-pass/issues/issue-23825.rs create mode 100644 src/test/run-pass/issues/issue-2383.rs create mode 100644 src/test/run-pass/issues/issue-23833.rs create mode 100644 src/test/run-pass/issues/issue-23891.rs create mode 100644 src/test/run-pass/issues/issue-23898.rs create mode 100644 src/test/run-pass/issues/issue-23958.rs create mode 100644 src/test/run-pass/issues/issue-23968-const-not-overflow.rs create mode 100644 src/test/run-pass/issues/issue-23992.rs create mode 100644 src/test/run-pass/issues/issue-24085.rs create mode 100644 src/test/run-pass/issues/issue-24086.rs create mode 100644 src/test/run-pass/issues/issue-2414-c.rs create mode 100644 src/test/run-pass/issues/issue-24161.rs create mode 100644 src/test/run-pass/issues/issue-24227.rs create mode 100644 src/test/run-pass/issues/issue-2428.rs create mode 100644 src/test/run-pass/issues/issue-24308.rs create mode 100644 src/test/run-pass/issues/issue-24313.rs create mode 100644 src/test/run-pass/issues/issue-24353.rs create mode 100644 src/test/run-pass/issues/issue-24389.rs create mode 100644 src/test/run-pass/issues/issue-24434.rs create mode 100644 src/test/run-pass/issues/issue-2445-b.rs create mode 100644 src/test/run-pass/issues/issue-2445.rs create mode 100644 src/test/run-pass/issues/issue-24533.rs create mode 100644 src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs create mode 100644 src/test/run-pass/issues/issue-24589.rs create mode 100644 src/test/run-pass/issues/issue-2463.rs create mode 100644 src/test/run-pass/issues/issue-2472.rs create mode 100644 src/test/run-pass/issues/issue-24779.rs create mode 100644 src/test/run-pass/issues/issue-24805-dropck-itemless.rs create mode 100644 src/test/run-pass/issues/issue-2487-a.rs create mode 100644 src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs create mode 100644 src/test/run-pass/issues/issue-24947.rs create mode 100644 src/test/run-pass/issues/issue-24954.rs create mode 100644 src/test/run-pass/issues/issue-2502.rs create mode 100644 src/test/run-pass/issues/issue-25089.rs create mode 100644 src/test/run-pass/issues/issue-25145.rs create mode 100644 src/test/run-pass/issues/issue-25180.rs create mode 100644 src/test/run-pass/issues/issue-25185.rs create mode 100644 src/test/run-pass/issues/issue-2526-a.rs create mode 100644 src/test/run-pass/issues/issue-25279.rs create mode 100644 src/test/run-pass/issues/issue-25339.rs create mode 100644 src/test/run-pass/issues/issue-25343.rs create mode 100644 src/test/run-pass/issues/issue-25394.rs create mode 100644 src/test/run-pass/issues/issue-25467.rs create mode 100644 src/test/run-pass/issues/issue-25497.rs create mode 100644 src/test/run-pass/issues/issue-2550.rs create mode 100644 src/test/run-pass/issues/issue-25515.rs create mode 100644 src/test/run-pass/issues/issue-25549-multiple-drop.rs create mode 100644 src/test/run-pass/issues/issue-25679.rs create mode 100644 src/test/run-pass/issues/issue-25693.rs create mode 100644 src/test/run-pass/issues/issue-25700-1.rs create mode 100644 src/test/run-pass/issues/issue-25700-2.rs create mode 100644 src/test/run-pass/issues/issue-25746-bool-transmute.rs create mode 100644 src/test/run-pass/issues/issue-25757.rs create mode 100644 src/test/run-pass/issues/issue-25810.rs create mode 100644 src/test/run-pass/issues/issue-25916.rs create mode 100644 src/test/run-pass/issues/issue-26095.rs create mode 100644 src/test/run-pass/issues/issue-2611-3.rs create mode 100644 src/test/run-pass/issues/issue-26127.rs create mode 100644 src/test/run-pass/issues/issue-26205.rs create mode 100644 src/test/run-pass/issues/issue-26251.rs create mode 100644 src/test/run-pass/issues/issue-2631-b.rs create mode 100644 src/test/run-pass/issues/issue-26322.rs create mode 100644 src/test/run-pass/issues/issue-2633-2.rs create mode 100644 src/test/run-pass/issues/issue-2633.rs create mode 100644 src/test/run-pass/issues/issue-2642.rs create mode 100644 src/test/run-pass/issues/issue-26468.rs create mode 100644 src/test/run-pass/issues/issue-26484.rs create mode 100644 src/test/run-pass/issues/issue-26641.rs create mode 100644 src/test/run-pass/issues/issue-26646.rs create mode 100644 src/test/run-pass/issues/issue-26655.rs create mode 100644 src/test/run-pass/issues/issue-26709.rs create mode 100644 src/test/run-pass/issues/issue-26802.rs create mode 100644 src/test/run-pass/issues/issue-26805.rs create mode 100644 src/test/run-pass/issues/issue-26873-multifile.rs create mode 100644 src/test/run-pass/issues/issue-26873-onefile.rs create mode 100644 src/test/run-pass/issues/issue-26905.rs create mode 100644 src/test/run-pass/issues/issue-26996.rs create mode 100644 src/test/run-pass/issues/issue-26997.rs create mode 100644 src/test/run-pass/issues/issue-27021.rs create mode 100644 src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs create mode 100644 src/test/run-pass/issues/issue-27060.rs create mode 100644 src/test/run-pass/issues/issue-2708.rs create mode 100644 src/test/run-pass/issues/issue-27105.rs create mode 100644 src/test/run-pass/issues/issue-2718.rs create mode 100644 src/test/run-pass/issues/issue-2723-b.rs create mode 100644 src/test/run-pass/issues/issue-27240.rs create mode 100644 src/test/run-pass/issues/issue-27268.rs create mode 100644 src/test/run-pass/issues/issue-27281.rs create mode 100644 src/test/run-pass/issues/issue-27320.rs create mode 100644 src/test/run-pass/issues/issue-2734.rs create mode 100644 src/test/run-pass/issues/issue-2735-2.rs create mode 100644 src/test/run-pass/issues/issue-2735-3.rs create mode 100644 src/test/run-pass/issues/issue-2735.rs create mode 100644 src/test/run-pass/issues/issue-27401-dropflag-reinit.rs create mode 100644 src/test/run-pass/issues/issue-2748-a.rs create mode 100644 src/test/run-pass/issues/issue-2748-b.rs create mode 100644 src/test/run-pass/issues/issue-27583.rs create mode 100644 src/test/run-pass/issues/issue-27639.rs create mode 100644 src/test/run-pass/issues/issue-27859.rs create mode 100644 src/test/run-pass/issues/issue-27889.rs create mode 100644 src/test/run-pass/issues/issue-27890.rs create mode 100644 src/test/run-pass/issues/issue-27901.rs create mode 100644 src/test/run-pass/issues/issue-27997.rs create mode 100644 src/test/run-pass/issues/issue-2804-2.rs create mode 100644 src/test/run-pass/issues/issue-28181.rs create mode 100644 src/test/run-pass/issues/issue-28279.rs create mode 100644 src/test/run-pass/issues/issue-28550.rs create mode 100644 src/test/run-pass/issues/issue-28561.rs create mode 100644 src/test/run-pass/issues/issue-28600.rs create mode 100644 src/test/run-pass/issues/issue-28676.rs create mode 100644 src/test/run-pass/issues/issue-28777.rs create mode 100644 src/test/run-pass/issues/issue-28822.rs create mode 100644 src/test/run-pass/issues/issue-28828.rs create mode 100644 src/test/run-pass/issues/issue-28839.rs create mode 100644 src/test/run-pass/issues/issue-28871.rs create mode 100644 src/test/run-pass/issues/issue-28936.rs create mode 100644 src/test/run-pass/issues/issue-2895.rs create mode 100644 src/test/run-pass/issues/issue-28950.rs create mode 100644 src/test/run-pass/issues/issue-28983.rs create mode 100644 src/test/run-pass/issues/issue-28999.rs create mode 100644 src/test/run-pass/issues/issue-29030.rs create mode 100644 src/test/run-pass/issues/issue-29037.rs create mode 100644 src/test/run-pass/issues/issue-2904.rs create mode 100644 src/test/run-pass/issues/issue-29048.rs create mode 100644 src/test/run-pass/issues/issue-29053.rs create mode 100644 src/test/run-pass/issues/issue-29071-2.rs create mode 100644 src/test/run-pass/issues/issue-29071.rs create mode 100644 src/test/run-pass/issues/issue-29092.rs create mode 100644 src/test/run-pass/issues/issue-29147.rs create mode 100644 src/test/run-pass/issues/issue-29166.rs create mode 100644 src/test/run-pass/issues/issue-29227.rs create mode 100644 src/test/run-pass/issues/issue-29276.rs create mode 100644 src/test/run-pass/issues/issue-2935.rs create mode 100644 src/test/run-pass/issues/issue-2936.rs create mode 100644 src/test/run-pass/issues/issue-29466.rs create mode 100644 src/test/run-pass/issues/issue-29485.rs create mode 100644 src/test/run-pass/issues/issue-29488.rs create mode 100644 src/test/run-pass/issues/issue-29516.rs create mode 100644 src/test/run-pass/issues/issue-29522.rs create mode 100644 src/test/run-pass/issues/issue-29540.rs create mode 100644 src/test/run-pass/issues/issue-29663.rs create mode 100644 src/test/run-pass/issues/issue-29668.rs create mode 100644 src/test/run-pass/issues/issue-29710.rs create mode 100644 src/test/run-pass/issues/issue-29740.rs create mode 100644 src/test/run-pass/issues/issue-29746.rs create mode 100644 src/test/run-pass/issues/issue-29844.rs create mode 100644 src/test/run-pass/issues/issue-2989.rs create mode 100644 src/test/run-pass/issues/issue-29914-2.rs create mode 100644 src/test/run-pass/issues/issue-29914-3.rs create mode 100644 src/test/run-pass/issues/issue-29914.rs create mode 100644 src/test/run-pass/issues/issue-29927.rs create mode 100644 src/test/run-pass/issues/issue-29948.rs create mode 100644 src/test/run-pass/issues/issue-30018-nopanic.rs create mode 100644 src/test/run-pass/issues/issue-30018-panic.rs create mode 100644 src/test/run-pass/issues/issue-30081.rs create mode 100644 src/test/run-pass/issues/issue-3012-2.rs create mode 100644 src/test/run-pass/issues/issue-30240.rs create mode 100644 src/test/run-pass/issues/issue-3026.rs create mode 100644 src/test/run-pass/issues/issue-3037.rs create mode 100644 src/test/run-pass/issues/issue-30371.rs create mode 100644 src/test/run-pass/issues/issue-30490.rs create mode 100644 src/test/run-pass/issues/issue-3052.rs create mode 100644 src/test/run-pass/issues/issue-30530.rs create mode 100644 src/test/run-pass/issues/issue-30615.rs create mode 100644 src/test/run-pass/issues/issue-30756.rs create mode 100644 src/test/run-pass/issues/issue-30891.rs create mode 100644 src/test/run-pass/issues/issue-3091.rs create mode 100644 src/test/run-pass/issues/issue-3109.rs create mode 100644 src/test/run-pass/issues/issue-3121.rs create mode 100644 src/test/run-pass/issues/issue-31260.rs create mode 100644 src/test/run-pass/issues/issue-31267-additional.rs create mode 100644 src/test/run-pass/issues/issue-31267.rs create mode 100644 src/test/run-pass/issues/issue-31299.rs create mode 100644 src/test/run-pass/issues/issue-3149.rs create mode 100644 src/test/run-pass/issues/issue-31597.rs create mode 100644 src/test/run-pass/issues/issue-31702.rs create mode 100644 src/test/run-pass/issues/issue-31776.rs create mode 100644 src/test/run-pass/issues/issue-32008.rs create mode 100644 src/test/run-pass/issues/issue-3211.rs create mode 100644 src/test/run-pass/issues/issue-3220.rs create mode 100644 src/test/run-pass/issues/issue-32292.rs create mode 100644 src/test/run-pass/issues/issue-32324.rs create mode 100644 src/test/run-pass/issues/issue-32389.rs create mode 100644 src/test/run-pass/issues/issue-32518.rs create mode 100644 src/test/run-pass/issues/issue-32805.rs create mode 100644 src/test/run-pass/issues/issue-3290.rs create mode 100644 src/test/run-pass/issues/issue-32947.rs create mode 100644 src/test/run-pass/issues/issue-33096.rs create mode 100644 src/test/run-pass/issues/issue-33185.rs create mode 100644 src/test/run-pass/issues/issue-33187.rs create mode 100644 src/test/run-pass/issues/issue-33202.rs create mode 100644 src/test/run-pass/issues/issue-33264.rs create mode 100644 src/test/run-pass/issues/issue-33287.rs create mode 100644 src/test/run-pass/issues/issue-333.rs create mode 100644 src/test/run-pass/issues/issue-33387.rs create mode 100644 src/test/run-pass/issues/issue-33461.rs create mode 100644 src/test/run-pass/issues/issue-33498.rs create mode 100644 src/test/run-pass/issues/issue-33537.rs create mode 100644 src/test/run-pass/issues/issue-33687.rs create mode 100644 src/test/run-pass/issues/issue-33770.rs create mode 100644 src/test/run-pass/issues/issue-3389.rs create mode 100644 src/test/run-pass/issues/issue-33903.rs create mode 100644 src/test/run-pass/issues/issue-33992.rs create mode 100644 src/test/run-pass/issues/issue-34053.rs create mode 100644 src/test/run-pass/issues/issue-34074.rs create mode 100644 src/test/run-pass/issues/issue-34194.rs create mode 100644 src/test/run-pass/issues/issue-3424.rs create mode 100644 src/test/run-pass/issues/issue-3429.rs create mode 100644 src/test/run-pass/issues/issue-34427.rs create mode 100644 src/test/run-pass/issues/issue-3447.rs create mode 100644 src/test/run-pass/issues/issue-34503.rs create mode 100644 src/test/run-pass/issues/issue-34569.rs create mode 100644 src/test/run-pass/issues/issue-34571.rs create mode 100644 src/test/run-pass/issues/issue-34751.rs create mode 100644 src/test/run-pass/issues/issue-34780.rs create mode 100644 src/test/run-pass/issues/issue-34784.rs create mode 100644 src/test/run-pass/issues/issue-34796.rs create mode 100644 src/test/run-pass/issues/issue-34798.rs create mode 100644 src/test/run-pass/issues/issue-34932.rs create mode 100644 src/test/run-pass/issues/issue-3500.rs create mode 100644 src/test/run-pass/issues/issue-35376.rs create mode 100644 src/test/run-pass/issues/issue-35423.rs create mode 100644 src/test/run-pass/issues/issue-35546.rs create mode 100644 src/test/run-pass/issues/issue-3556.rs create mode 100644 src/test/run-pass/issues/issue-3559.rs create mode 100644 src/test/run-pass/issues/issue-35600.rs create mode 100644 src/test/run-pass/issues/issue-3563-2.rs create mode 100644 src/test/run-pass/issues/issue-3563-3.rs create mode 100644 src/test/run-pass/issues/issue-3574.rs create mode 100644 src/test/run-pass/issues/issue-35815.rs create mode 100644 src/test/run-pass/issues/issue-36023.rs create mode 100644 src/test/run-pass/issues/issue-36036-associated-type-layout.rs create mode 100644 src/test/run-pass/issues/issue-36053.rs create mode 100644 src/test/run-pass/issues/issue-36075.rs create mode 100644 src/test/run-pass/issues/issue-3609.rs create mode 100644 src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs create mode 100644 src/test/run-pass/issues/issue-36260.rs create mode 100644 src/test/run-pass/issues/issue-36278-prefix-nesting.rs create mode 100644 src/test/run-pass/issues/issue-36381.rs create mode 100644 src/test/run-pass/issues/issue-36401.rs create mode 100644 src/test/run-pass/issues/issue-36474.rs create mode 100644 src/test/run-pass/issues/issue-3656.rs create mode 100644 src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs create mode 100644 src/test/run-pass/issues/issue-36744-without-calls.rs create mode 100644 src/test/run-pass/issues/issue-36768.rs create mode 100644 src/test/run-pass/issues/issue-36786-resolve-call.rs create mode 100644 src/test/run-pass/issues/issue-36792.rs create mode 100644 src/test/run-pass/issues/issue-36816.rs create mode 100644 src/test/run-pass/issues/issue-3683.rs create mode 100644 src/test/run-pass/issues/issue-36856.rs create mode 100644 src/test/run-pass/issues/issue-36936.rs create mode 100644 src/test/run-pass/issues/issue-36954.rs create mode 100644 src/test/run-pass/issues/issue-3702.rs create mode 100644 src/test/run-pass/issues/issue-37109.rs create mode 100644 src/test/run-pass/issues/issue-37175.rs create mode 100644 src/test/run-pass/issues/issue-37222.rs create mode 100644 src/test/run-pass/issues/issue-37291/auxiliary/lib.rs create mode 100644 src/test/run-pass/issues/issue-37291/main.rs create mode 100644 src/test/run-pass/issues/issue-3743.rs create mode 100644 src/test/run-pass/issues/issue-3753.rs create mode 100644 src/test/run-pass/issues/issue-37598.rs create mode 100644 src/test/run-pass/issues/issue-37655.rs create mode 100644 src/test/run-pass/issues/issue-37686.rs create mode 100644 src/test/run-pass/issues/issue-37725.rs create mode 100644 src/test/run-pass/issues/issue-37733.rs create mode 100644 src/test/run-pass/issues/issue-3794.rs create mode 100644 src/test/run-pass/issues/issue-37991.rs create mode 100644 src/test/run-pass/issues/issue-38002.rs create mode 100644 src/test/run-pass/issues/issue-38033.rs create mode 100644 src/test/run-pass/issues/issue-38074.rs create mode 100644 src/test/run-pass/issues/issue-38091.rs create mode 100644 src/test/run-pass/issues/issue-38190.rs create mode 100644 src/test/run-pass/issues/issue-38226.rs create mode 100644 src/test/run-pass/issues/issue-38437.rs create mode 100644 src/test/run-pass/issues/issue-3847.rs create mode 100644 src/test/run-pass/issues/issue-38556.rs create mode 100644 src/test/run-pass/issues/issue-38715.rs create mode 100644 src/test/run-pass/issues/issue-38727.rs create mode 100644 src/test/run-pass/issues/issue-3874.rs create mode 100644 src/test/run-pass/issues/issue-38763.rs create mode 100644 src/test/run-pass/issues/issue-3878.rs create mode 100644 src/test/run-pass/issues/issue-3888-2.rs create mode 100644 src/test/run-pass/issues/issue-38942.rs create mode 100644 src/test/run-pass/issues/issue-3895.rs create mode 100644 src/test/run-pass/issues/issue-38987.rs create mode 100644 src/test/run-pass/issues/issue-3904.rs create mode 100644 src/test/run-pass/issues/issue-39089.rs create mode 100644 src/test/run-pass/issues/issue-39292.rs create mode 100644 src/test/run-pass/issues/issue-3935.rs create mode 100644 src/test/run-pass/issues/issue-39367.rs create mode 100644 src/test/run-pass/issues/issue-39467.rs create mode 100644 src/test/run-pass/issues/issue-39548.rs create mode 100644 src/test/run-pass/issues/issue-39709.rs create mode 100644 src/test/run-pass/issues/issue-39720.rs create mode 100644 src/test/run-pass/issues/issue-39720.stderr create mode 100644 src/test/run-pass/issues/issue-3979-2.rs create mode 100644 src/test/run-pass/issues/issue-3979-generics.rs create mode 100644 src/test/run-pass/issues/issue-3979-xcrate.rs create mode 100644 src/test/run-pass/issues/issue-3979.rs create mode 100644 src/test/run-pass/issues/issue-39808.rs create mode 100644 src/test/run-pass/issues/issue-39823.rs create mode 100644 src/test/run-pass/issues/issue-39827.rs create mode 100644 src/test/run-pass/issues/issue-3991.rs create mode 100644 src/test/run-pass/issues/issue-39984.rs create mode 100644 src/test/run-pass/issues/issue-40003.rs create mode 100644 src/test/run-pass/issues/issue-40085.rs create mode 100644 src/test/run-pass/issues/issue-40136.rs create mode 100644 src/test/run-pass/issues/issue-40235.rs create mode 100644 src/test/run-pass/issues/issue-4025.rs create mode 100644 src/test/run-pass/issues/issue-40408.rs create mode 100644 src/test/run-pass/issues/issue-40469.rs create mode 100644 src/test/run-pass/issues/issue-40770.rs create mode 100644 src/test/run-pass/issues/issue-40847.rs create mode 100644 src/test/run-pass/issues/issue-40883.rs create mode 100644 src/test/run-pass/issues/issue-40951.rs create mode 100644 src/test/run-pass/issues/issue-40962.rs create mode 100644 src/test/run-pass/issues/issue-41053.rs create mode 100644 src/test/run-pass/issues/issue-4107.rs create mode 100644 src/test/run-pass/issues/issue-41213.rs create mode 100644 src/test/run-pass/issues/issue-41272.rs create mode 100644 src/test/run-pass/issues/issue-41298.rs create mode 100644 src/test/run-pass/issues/issue-41394.rs create mode 100644 src/test/run-pass/issues/issue-41479.rs create mode 100644 src/test/run-pass/issues/issue-41498.rs create mode 100644 src/test/run-pass/issues/issue-41604.rs create mode 100644 src/test/run-pass/issues/issue-41628.rs create mode 100644 src/test/run-pass/issues/issue-41677.rs create mode 100644 src/test/run-pass/issues/issue-41696.rs create mode 100644 src/test/run-pass/issues/issue-41744.rs create mode 100644 src/test/run-pass/issues/issue-41803.rs create mode 100644 src/test/run-pass/issues/issue-41849-variance-req.rs create mode 100644 src/test/run-pass/issues/issue-41888.rs create mode 100644 src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs create mode 100644 src/test/run-pass/issues/issue-42007.rs create mode 100644 src/test/run-pass/issues/issue-4208.rs create mode 100644 src/test/run-pass/issues/issue-42148.rs create mode 100644 src/test/run-pass/issues/issue-42210.rs create mode 100644 src/test/run-pass/issues/issue-4228.rs create mode 100644 src/test/run-pass/issues/issue-42453.rs create mode 100644 src/test/run-pass/issues/issue-42463.rs create mode 100644 src/test/run-pass/issues/issue-42467.rs create mode 100644 src/test/run-pass/issues/issue-4252.rs create mode 100644 src/test/run-pass/issues/issue-42552.rs create mode 100644 src/test/run-pass/issues/issue-42679.rs create mode 100644 src/test/run-pass/issues/issue-42747.rs create mode 100644 src/test/run-pass/issues/issue-42956.rs create mode 100644 src/test/run-pass/issues/issue-43057.rs create mode 100644 src/test/run-pass/issues/issue-43132.rs create mode 100644 src/test/run-pass/issues/issue-43205.rs create mode 100644 src/test/run-pass/issues/issue-43291.rs create mode 100644 src/test/run-pass/issues/issue-4333.rs create mode 100644 src/test/run-pass/issues/issue-43357.rs create mode 100644 src/test/run-pass/issues/issue-43483.rs create mode 100644 src/test/run-pass/issues/issue-43692.rs create mode 100644 src/test/run-pass/issues/issue-43853.rs create mode 100644 src/test/run-pass/issues/issue-4387.rs create mode 100644 src/test/run-pass/issues/issue-43910.rs create mode 100644 src/test/run-pass/issues/issue-43923.rs create mode 100644 src/test/run-pass/issues/issue-44005.rs create mode 100644 src/test/run-pass/issues/issue-4401.rs create mode 100644 src/test/run-pass/issues/issue-44056.rs create mode 100644 src/test/run-pass/issues/issue-44247.rs create mode 100644 src/test/run-pass/issues/issue-44333.rs create mode 100644 src/test/run-pass/issues/issue-44373.rs create mode 100644 src/test/run-pass/issues/issue-44402.rs create mode 100644 src/test/run-pass/issues/issue-4446.rs create mode 100644 src/test/run-pass/issues/issue-4448.rs create mode 100644 src/test/run-pass/issues/issue-4464.rs create mode 100644 src/test/run-pass/issues/issue-44730.rs create mode 100644 src/test/run-pass/issues/issue-44851.rs create mode 100644 src/test/run-pass/issues/issue-45124.rs create mode 100644 src/test/run-pass/issues/issue-45152.rs create mode 100644 src/test/run-pass/issues/issue-4541.rs create mode 100644 src/test/run-pass/issues/issue-4542.rs create mode 100644 src/test/run-pass/issues/issue-45425.rs create mode 100644 src/test/run-pass/issues/issue-4545.rs create mode 100644 src/test/run-pass/issues/issue-45731.rs create mode 100644 src/test/run-pass/issues/issue-46069.rs create mode 100644 src/test/run-pass/issues/issue-46095.rs create mode 100644 src/test/run-pass/issues/issue-46519.rs create mode 100644 src/test/run-pass/issues/issue-46553.rs create mode 100644 src/test/run-pass/issues/issue-46845.rs create mode 100644 src/test/run-pass/issues/issue-46855.rs create mode 100644 src/test/run-pass/issues/issue-46920-byte-array-patterns.rs create mode 100644 src/test/run-pass/issues/issue-46959.rs create mode 100644 src/test/run-pass/issues/issue-46964.rs create mode 100644 src/test/run-pass/issues/issue-47139-1.rs create mode 100644 src/test/run-pass/issues/issue-47139-2.rs create mode 100644 src/test/run-pass/issues/issue-4734.rs create mode 100644 src/test/run-pass/issues/issue-4735.rs create mode 100644 src/test/run-pass/issues/issue-47364.rs create mode 100644 src/test/run-pass/issues/issue-4759-1.rs create mode 100644 src/test/run-pass/issues/issue-4759.rs create mode 100644 src/test/run-pass/issues/issue-47638.rs create mode 100644 src/test/run-pass/issues/issue-47673.rs create mode 100644 src/test/run-pass/issues/issue-47703-1.rs create mode 100644 src/test/run-pass/issues/issue-47703-tuple.rs create mode 100644 src/test/run-pass/issues/issue-47703.rs create mode 100644 src/test/run-pass/issues/issue-47722.rs create mode 100644 src/test/run-pass/issues/issue-47789.rs create mode 100644 src/test/run-pass/issues/issue-48159.rs create mode 100644 src/test/run-pass/issues/issue-4830.rs create mode 100644 src/test/run-pass/issues/issue-48508-aux.rs create mode 100644 src/test/run-pass/issues/issue-48508.rs create mode 100644 src/test/run-pass/issues/issue-48551.rs create mode 100644 src/test/run-pass/issues/issue-4865-1.rs create mode 100644 src/test/run-pass/issues/issue-4865-2.rs create mode 100644 src/test/run-pass/issues/issue-4865-3.rs create mode 100644 src/test/run-pass/issues/issue-4875.rs create mode 100644 src/test/run-pass/issues/issue-48962.rs create mode 100644 src/test/run-pass/issues/issue-48984.rs create mode 100644 src/test/run-pass/issues/issue-49298.rs create mode 100644 src/test/run-pass/issues/issue-49556.rs create mode 100644 src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs create mode 100644 src/test/run-pass/issues/issue-49632.rs create mode 100644 src/test/run-pass/issues/issue-49685.rs create mode 100644 src/test/run-pass/issues/issue-49854.rs create mode 100644 src/test/run-pass/issues/issue-49955-2.rs create mode 100644 src/test/run-pass/issues/issue-49955.rs create mode 100644 src/test/run-pass/issues/issue-49973.rs create mode 100644 src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs create mode 100644 src/test/run-pass/issues/issue-50415.rs create mode 100644 src/test/run-pass/issues/issue-50442.rs create mode 100644 src/test/run-pass/issues/issue-5060.rs create mode 100644 src/test/run-pass/issues/issue-50689.rs create mode 100644 src/test/run-pass/issues/issue-50731.rs create mode 100644 src/test/run-pass/issues/issue-50811.rs create mode 100644 src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs create mode 100644 src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs create mode 100644 src/test/run-pass/issues/issue-51185.rs create mode 100644 src/test/run-pass/issues/issue-51345.rs create mode 100644 src/test/run-pass/issues/issue-51582.rs create mode 100644 src/test/run-pass/issues/issue-51655.rs create mode 100644 src/test/run-pass/issues/issue-51907.rs create mode 100644 src/test/run-pass/issues/issue-5192.rs create mode 100644 src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs create mode 100644 src/test/run-pass/issues/issue-52140/main.rs create mode 100644 src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs create mode 100644 src/test/run-pass/issues/issue-52141/main.rs create mode 100644 src/test/run-pass/issues/issue-52169.rs create mode 100644 src/test/run-pass/issues/issue-5239-2.rs create mode 100644 src/test/run-pass/issues/issue-5243.rs create mode 100644 src/test/run-pass/issues/issue-52557.rs create mode 100644 src/test/run-pass/issues/issue-52705/auxiliary/png2.rs create mode 100644 src/test/run-pass/issues/issue-52705/main.rs create mode 100644 src/test/run-pass/issues/issue-5280.rs create mode 100644 src/test/run-pass/issues/issue-5315.rs create mode 100644 src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs create mode 100644 src/test/run-pass/issues/issue-53333.rs create mode 100644 src/test/run-pass/issues/issue-5353.rs create mode 100644 src/test/run-pass/issues/issue-5518.rs create mode 100644 src/test/run-pass/issues/issue-5521.rs create mode 100644 src/test/run-pass/issues/issue-5530.rs create mode 100644 src/test/run-pass/issues/issue-5550.rs create mode 100644 src/test/run-pass/issues/issue-5554.rs create mode 100644 src/test/run-pass/issues/issue-5572.rs create mode 100644 src/test/run-pass/issues/issue-5666.rs create mode 100644 src/test/run-pass/issues/issue-5688.rs create mode 100644 src/test/run-pass/issues/issue-5708.rs create mode 100644 src/test/run-pass/issues/issue-5718.rs create mode 100644 src/test/run-pass/issues/issue-5741.rs create mode 100644 src/test/run-pass/issues/issue-5754.rs create mode 100644 src/test/run-pass/issues/issue-5791.rs create mode 100644 src/test/run-pass/issues/issue-5884.rs create mode 100644 src/test/run-pass/issues/issue-5900.rs create mode 100644 src/test/run-pass/issues/issue-5917.rs create mode 100644 src/test/run-pass/issues/issue-5950.rs create mode 100644 src/test/run-pass/issues/issue-5988.rs create mode 100644 src/test/run-pass/issues/issue-5997.rs create mode 100644 src/test/run-pass/issues/issue-6117.rs create mode 100644 src/test/run-pass/issues/issue-6128.rs create mode 100644 src/test/run-pass/issues/issue-6130.rs create mode 100644 src/test/run-pass/issues/issue-6153.rs create mode 100644 src/test/run-pass/issues/issue-6157.rs create mode 100644 src/test/run-pass/issues/issue-6318.rs create mode 100644 src/test/run-pass/issues/issue-6334.rs create mode 100644 src/test/run-pass/issues/issue-6341.rs create mode 100644 src/test/run-pass/issues/issue-6344-let.rs create mode 100644 src/test/run-pass/issues/issue-6344-match.rs create mode 100644 src/test/run-pass/issues/issue-6449.rs create mode 100644 src/test/run-pass/issues/issue-6470.rs create mode 100644 src/test/run-pass/issues/issue-6557.rs create mode 100644 src/test/run-pass/issues/issue-6892.rs create mode 100644 src/test/run-pass/issues/issue-6898.rs create mode 100644 src/test/run-pass/issues/issue-6919.rs create mode 100644 src/test/run-pass/issues/issue-6991.rs create mode 100644 src/test/run-pass/issues/issue-7012.rs create mode 100644 src/test/run-pass/issues/issue-7178.rs create mode 100644 src/test/run-pass/issues/issue-7222.rs create mode 100644 src/test/run-pass/issues/issue-7268.rs create mode 100644 src/test/run-pass/issues/issue-7344.rs create mode 100644 src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs create mode 100644 src/test/run-pass/issues/issue-7563.rs create mode 100644 src/test/run-pass/issues/issue-7575.rs create mode 100644 src/test/run-pass/issues/issue-7607-2.rs create mode 100644 src/test/run-pass/issues/issue-7660.rs create mode 100644 src/test/run-pass/issues/issue-7663.rs create mode 100644 src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs create mode 100644 src/test/run-pass/issues/issue-7784.rs create mode 100644 src/test/run-pass/issues/issue-7899.rs create mode 100644 src/test/run-pass/issues/issue-7911.rs create mode 100644 src/test/run-pass/issues/issue-8044.rs create mode 100644 src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs create mode 100644 src/test/run-pass/issues/issue-8248.rs create mode 100644 src/test/run-pass/issues/issue-8249.rs create mode 100644 src/test/run-pass/issues/issue-8259.rs create mode 100644 src/test/run-pass/issues/issue-8351-1.rs create mode 100644 src/test/run-pass/issues/issue-8351-2.rs create mode 100644 src/test/run-pass/issues/issue-8391.rs create mode 100644 src/test/run-pass/issues/issue-8398.rs create mode 100644 src/test/run-pass/issues/issue-8401.rs create mode 100644 src/test/run-pass/issues/issue-8460.rs create mode 100644 src/test/run-pass/issues/issue-8498.rs create mode 100644 src/test/run-pass/issues/issue-8506.rs create mode 100644 src/test/run-pass/issues/issue-8521.rs create mode 100644 src/test/run-pass/issues/issue-8578.rs create mode 100644 src/test/run-pass/issues/issue-868.rs create mode 100644 src/test/run-pass/issues/issue-8709.rs create mode 100644 src/test/run-pass/issues/issue-8783.rs create mode 100644 src/test/run-pass/issues/issue-8827.rs create mode 100644 src/test/run-pass/issues/issue-8851.rs create mode 100644 src/test/run-pass/issues/issue-8860.rs create mode 100644 src/test/run-pass/issues/issue-8898.rs create mode 100644 src/test/run-pass/issues/issue-9047.rs create mode 100644 src/test/run-pass/issues/issue-9110.rs create mode 100644 src/test/run-pass/issues/issue-9123.rs create mode 100644 src/test/run-pass/issues/issue-9129.rs create mode 100644 src/test/run-pass/issues/issue-9188.rs create mode 100644 src/test/run-pass/issues/issue-9243.rs create mode 100644 src/test/run-pass/issues/issue-9249.rs create mode 100644 src/test/run-pass/issues/issue-9259.rs create mode 100644 src/test/run-pass/issues/issue-9382.rs create mode 100644 src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs create mode 100644 src/test/run-pass/issues/issue-9396.rs create mode 100644 src/test/run-pass/issues/issue-9446.rs create mode 100644 src/test/run-pass/issues/issue-9719.rs create mode 100644 src/test/run-pass/issues/issue-9737.rs create mode 100644 src/test/run-pass/issues/issue-979.rs create mode 100644 src/test/run-pass/issues/issue-9837.rs create mode 100644 src/test/run-pass/issues/issue-9906.rs create mode 100644 src/test/run-pass/issues/issue-9918.rs create mode 100644 src/test/run-pass/issues/issue-9942.rs create mode 100644 src/test/run-pass/issues/issue-9951.rs create mode 100644 src/test/run-pass/issues/issue-9968.rs create mode 100644 src/test/run-pass/issues/issue2170exe.rs create mode 100644 src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs create mode 100644 src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs create mode 100644 src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs create mode 100644 src/test/run-pass/issues/issue28498-must-work-ex1.rs create mode 100644 src/test/run-pass/issues/issue28498-must-work-ex2.rs create mode 100644 src/test/run-pass/issues/issue28498-ugeh-ex1.rs create mode 100644 src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs create mode 100644 src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs create mode 100644 src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs create mode 100644 src/test/run-pass/issues/issue29927-1.rs create mode 100644 src/test/run-pass/issues/issue_26873_multifile/A/B.rs create mode 100644 src/test/run-pass/issues/issue_26873_multifile/A/C.rs create mode 100644 src/test/run-pass/issues/issue_26873_multifile/A/mod.rs create mode 100644 src/test/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir create mode 100644 src/test/run-pass/issues/issue_26873_multifile/mod.rs create mode 100644 src/test/run-pass/issues/issue_3136_b.rs create mode 100644 src/test/run-pass/issues/issue_9155.rs create mode 100644 src/test/run-pass/iterators/into-iterator-type-inference-shift.rs create mode 100644 src/test/run-pass/iterators/iter-cloned-type-inference.rs create mode 100644 src/test/run-pass/iterators/iter-range.rs create mode 100644 src/test/run-pass/iterators/iter-step-overflow-debug.rs create mode 100644 src/test/run-pass/iterators/iter-step-overflow-ndebug.rs create mode 100644 src/test/run-pass/iterators/iter-sum-overflow-debug.rs create mode 100644 src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs create mode 100644 src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs create mode 100644 src/test/run-pass/iterators/iter-zip.rs create mode 100644 src/test/run-pass/macros/assert-eq-macro-success.rs create mode 100644 src/test/run-pass/macros/assert-eq-macro-unsized.rs create mode 100644 src/test/run-pass/macros/assert-ne-macro-success.rs create mode 100644 src/test/run-pass/macros/assert-ne-macro-unsized.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro-comma-support.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro-include-items-item.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs create mode 100644 src/test/run-pass/macros/auxiliary/macro_with_super_1.rs create mode 100644 src/test/run-pass/macros/auxiliary/two_macros.rs create mode 100644 src/test/run-pass/macros/auxiliary/unstable-macros.rs create mode 100644 src/test/run-pass/macros/auxiliary/use-macro-self.rs create mode 100644 src/test/run-pass/macros/colorful-write-macros.rs create mode 100644 src/test/run-pass/macros/conditional-debug-macro-on.rs create mode 100644 src/test/run-pass/macros/die-macro.rs create mode 100644 src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs create mode 100644 src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout create mode 100644 src/test/run-pass/macros/macro-2.rs create mode 100644 src/test/run-pass/macros/macro-at-most-once-rep.rs create mode 100644 src/test/run-pass/macros/macro-attribute-expansion.rs create mode 100644 src/test/run-pass/macros/macro-attributes.rs create mode 100644 src/test/run-pass/macros/macro-block-nonterminal.rs create mode 100644 src/test/run-pass/macros/macro-comma-behavior.rs create mode 100644 src/test/run-pass/macros/macro-comma-support.rs create mode 100644 src/test/run-pass/macros/macro-crate-def-only.rs create mode 100644 src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs create mode 100644 src/test/run-pass/macros/macro-crate-nonterminal.rs create mode 100644 src/test/run-pass/macros/macro-crate-use.rs create mode 100644 src/test/run-pass/macros/macro-deep_expansion.rs create mode 100644 src/test/run-pass/macros/macro-delimiter-significance.rs create mode 100644 src/test/run-pass/macros/macro-doc-comments.rs create mode 100644 src/test/run-pass/macros/macro-doc-escapes.rs create mode 100644 src/test/run-pass/macros/macro-doc-raw-str-hashes.rs create mode 100644 src/test/run-pass/macros/macro-export-inner-module.rs create mode 100644 src/test/run-pass/macros/macro-first-set.rs create mode 100644 src/test/run-pass/macros/macro-follow.rs create mode 100644 src/test/run-pass/macros/macro-followed-by-seq.rs create mode 100644 src/test/run-pass/macros/macro-include-items.rs create mode 100644 src/test/run-pass/macros/macro-interpolation.rs create mode 100644 src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs create mode 100644 src/test/run-pass/macros/macro-lifetime-used-with-bound.rs create mode 100644 src/test/run-pass/macros/macro-lifetime-used-with-labels.rs create mode 100644 src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr create mode 100644 src/test/run-pass/macros/macro-lifetime-used-with-static.rs create mode 100644 src/test/run-pass/macros/macro-lifetime.rs create mode 100644 src/test/run-pass/macros/macro-literal.rs create mode 100644 src/test/run-pass/macros/macro-meta-items.rs create mode 100644 src/test/run-pass/macros/macro-method-issue-4621.rs create mode 100644 src/test/run-pass/macros/macro-multiple-items.rs create mode 100644 src/test/run-pass/macros/macro-named-default.rs create mode 100644 src/test/run-pass/macros/macro-nested_definition_issue-31946.rs create mode 100644 src/test/run-pass/macros/macro-nested_expr.rs create mode 100644 src/test/run-pass/macros/macro-nested_stmt_macros.rs create mode 100644 src/test/run-pass/macros/macro-nt-list.rs create mode 100644 src/test/run-pass/macros/macro-of-higher-order.rs create mode 100644 src/test/run-pass/macros/macro-pat-follow.rs create mode 100644 src/test/run-pass/macros/macro-pat-neg-lit.rs create mode 100644 src/test/run-pass/macros/macro-pat.rs create mode 100644 src/test/run-pass/macros/macro-path.rs create mode 100644 src/test/run-pass/macros/macro-pub-matcher.rs create mode 100644 src/test/run-pass/macros/macro-seq-followed-by-seq.rs create mode 100644 src/test/run-pass/macros/macro-stability.rs create mode 100644 src/test/run-pass/macros/macro-stmt.rs create mode 100644 src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs create mode 100644 src/test/run-pass/macros/macro-tt-followed-by-seq.rs create mode 100644 src/test/run-pass/macros/macro-use-all-and-none.rs create mode 100644 src/test/run-pass/macros/macro-use-all.rs create mode 100644 src/test/run-pass/macros/macro-use-both.rs create mode 100644 src/test/run-pass/macros/macro-use-one.rs create mode 100644 src/test/run-pass/macros/macro-with-attrs1.rs create mode 100644 src/test/run-pass/macros/macro-with-attrs2.rs create mode 100644 src/test/run-pass/macros/macro-with-braces-in-expr-position.rs create mode 100644 src/test/run-pass/macros/macro_with_super_2.rs create mode 100644 src/test/run-pass/macros/macros-in-extern.rs create mode 100644 src/test/run-pass/macros/parse-complex-macro-invoc-op.rs create mode 100644 src/test/run-pass/macros/paths-in-macro-invocations.rs create mode 100644 src/test/run-pass/macros/pub-item-inside-macro.rs create mode 100644 src/test/run-pass/macros/pub-method-inside-macro.rs create mode 100644 src/test/run-pass/macros/semi-after-macro-ty.rs create mode 100644 src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs create mode 100644 src/test/run-pass/macros/syntax-extension-cfg.rs create mode 100644 src/test/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment create mode 100644 src/test/run-pass/macros/syntax-extension-source-utils.rs create mode 100644 src/test/run-pass/macros/try-macro.rs create mode 100644 src/test/run-pass/macros/two-macro-use.rs create mode 100644 src/test/run-pass/macros/type-macros-hlist.rs create mode 100644 src/test/run-pass/macros/type-macros-simple.rs create mode 100644 src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs create mode 100644 src/test/run-pass/macros/use-macro-self.rs create mode 100644 src/test/run-pass/methods/auxiliary/method_self_arg1.rs create mode 100644 src/test/run-pass/methods/auxiliary/method_self_arg2.rs create mode 100644 src/test/run-pass/methods/method-argument-inference-associated-type.rs create mode 100644 src/test/run-pass/methods/method-attributes.rs create mode 100644 src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs create mode 100644 src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs create mode 100644 src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs create mode 100644 src/test/run-pass/methods/method-projection.rs create mode 100644 src/test/run-pass/methods/method-recursive-blanket-impl.rs create mode 100644 src/test/run-pass/methods/method-self-arg-aux1.rs create mode 100644 src/test/run-pass/methods/method-self-arg-aux2.rs create mode 100644 src/test/run-pass/methods/method-self-arg-trait.rs create mode 100644 src/test/run-pass/methods/method-self-arg.rs create mode 100644 src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs create mode 100644 src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs create mode 100644 src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs create mode 100644 src/test/run-pass/methods/method-where-clause.rs create mode 100644 src/test/run-pass/mir/auxiliary/mir_external_refs.rs create mode 100644 src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs create mode 100644 src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs create mode 100644 src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs create mode 100644 src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs create mode 100644 src/test/run-pass/mir/mir_adt_construction.rs create mode 100644 src/test/run-pass/mir/mir_ascription_coercion.rs create mode 100644 src/test/run-pass/mir/mir_augmented_assignments.rs create mode 100644 src/test/run-pass/mir/mir_autoderef.rs create mode 100644 src/test/run-pass/mir/mir_boxing.rs create mode 100644 src/test/run-pass/mir/mir_build_match_comparisons.rs create mode 100644 src/test/run-pass/mir/mir_call_with_associated_type.rs create mode 100644 src/test/run-pass/mir/mir_calls_to_shims.rs create mode 100644 src/test/run-pass/mir/mir_cast_fn_ret.rs create mode 100644 src/test/run-pass/mir/mir_codegen_array.rs create mode 100644 src/test/run-pass/mir/mir_codegen_array_2.rs create mode 100644 src/test/run-pass/mir/mir_codegen_call_converging.rs create mode 100644 src/test/run-pass/mir/mir_codegen_calls.rs create mode 100644 src/test/run-pass/mir/mir_codegen_calls_variadic.rs create mode 100644 src/test/run-pass/mir/mir_codegen_critical_edge.rs create mode 100644 src/test/run-pass/mir/mir_codegen_spike1.rs create mode 100644 src/test/run-pass/mir/mir_codegen_switch.rs create mode 100644 src/test/run-pass/mir/mir_codegen_switchint.rs create mode 100644 src/test/run-pass/mir/mir_coercion_casts.rs create mode 100644 src/test/run-pass/mir/mir_coercions.rs create mode 100644 src/test/run-pass/mir/mir_constval_adts.rs create mode 100644 src/test/run-pass/mir/mir_drop_order.rs create mode 100644 src/test/run-pass/mir/mir_early_return_scope.rs create mode 100644 src/test/run-pass/mir/mir_fat_ptr.rs create mode 100644 src/test/run-pass/mir/mir_fat_ptr_drop.rs create mode 100644 src/test/run-pass/mir/mir_heavy_promoted.rs create mode 100644 src/test/run-pass/mir/mir_match_arm_guard.rs create mode 100644 src/test/run-pass/mir/mir_misc_casts.rs create mode 100644 src/test/run-pass/mir/mir_overflow_off.rs create mode 100644 src/test/run-pass/mir/mir_raw_fat_ptr.rs create mode 100644 src/test/run-pass/mir/mir_refs_correct.rs create mode 100644 src/test/run-pass/mir/mir_small_agg_arg.rs create mode 100644 src/test/run-pass/mir/mir_struct_with_assoc_ty.rs create mode 100644 src/test/run-pass/mir/mir_temp_promotions.rs create mode 100644 src/test/run-pass/mir/mir_void_return.rs create mode 100644 src/test/run-pass/mir/mir_void_return_2.rs create mode 100644 src/test/run-pass/modules/auxiliary/two_macros_2.rs create mode 100644 src/test/run-pass/modules/mod-inside-fn.rs create mode 100644 src/test/run-pass/modules/mod-view-items.rs create mode 100644 src/test/run-pass/modules/mod_dir_implicit.rs create mode 100644 src/test/run-pass/modules/mod_dir_implicit_aux/compiletest-ignore-dir create mode 100644 src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs create mode 100644 src/test/run-pass/modules/mod_dir_path.rs create mode 100644 src/test/run-pass/modules/mod_dir_path2.rs create mode 100644 src/test/run-pass/modules/mod_dir_path3.rs create mode 100644 src/test/run-pass/modules/mod_dir_path_multi.rs create mode 100644 src/test/run-pass/modules/mod_dir_recursive.rs create mode 100644 src/test/run-pass/modules/mod_dir_simple.rs create mode 100644 src/test/run-pass/modules/mod_dir_simple/compiletest-ignore-dir create mode 100644 src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs create mode 100644 src/test/run-pass/modules/mod_dir_simple/test.rs create mode 100644 src/test/run-pass/modules/mod_file.rs create mode 100644 src/test/run-pass/modules/mod_file_aux.rs create mode 100644 src/test/run-pass/modules/mod_file_with_path_attr.rs create mode 100644 src/test/run-pass/modules/module-polymorphism3-files/compiletest-ignore-dir create mode 100644 src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs create mode 100644 src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs create mode 100644 src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs create mode 100644 src/test/run-pass/moves/move-1-unique.rs create mode 100644 src/test/run-pass/moves/move-2-unique.rs create mode 100644 src/test/run-pass/moves/move-2.rs create mode 100644 src/test/run-pass/moves/move-3-unique.rs create mode 100644 src/test/run-pass/moves/move-4-unique.rs create mode 100644 src/test/run-pass/moves/move-4.rs create mode 100644 src/test/run-pass/moves/move-arg-2-unique.rs create mode 100644 src/test/run-pass/moves/move-arg-2.rs create mode 100644 src/test/run-pass/moves/move-arg.rs create mode 100644 src/test/run-pass/moves/move-nullary-fn.rs create mode 100644 src/test/run-pass/moves/move-out-of-field.rs create mode 100644 src/test/run-pass/moves/move-scalar.rs create mode 100644 src/test/run-pass/moves/moves-based-on-type-capture-clause.rs create mode 100644 src/test/run-pass/nll/issue-47153-generic-const.rs create mode 100644 src/test/run-pass/nll/issue-47589.rs create mode 100644 src/test/run-pass/nll/issue-48623-closure.rs create mode 100644 src/test/run-pass/nll/issue-48623-generator.rs create mode 100644 src/test/run-pass/nll/issue-50343.rs create mode 100644 src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs create mode 100644 src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs create mode 100644 src/test/run-pass/nll/mutating_references.rs create mode 100644 src/test/run-pass/nll/process_or_insert_default.rs create mode 100644 src/test/run-pass/nll/rc-loop.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs create mode 100644 src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs create mode 100644 src/test/run-pass/numbers-arithmetic/arith-0.rs create mode 100644 src/test/run-pass/numbers-arithmetic/arith-1.rs create mode 100644 src/test/run-pass/numbers-arithmetic/arith-2.rs create mode 100644 src/test/run-pass/numbers-arithmetic/arith-unsigned.rs create mode 100644 src/test/run-pass/numbers-arithmetic/div-mod.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float-literal-inference.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float-nan.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float-signature.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float2.rs create mode 100644 src/test/run-pass/numbers-arithmetic/float_math.rs create mode 100644 src/test/run-pass/numbers-arithmetic/floatlits.rs create mode 100644 src/test/run-pass/numbers-arithmetic/i128-ffi.rs create mode 100644 src/test/run-pass/numbers-arithmetic/i128.rs create mode 100644 src/test/run-pass/numbers-arithmetic/i32-sub.rs create mode 100644 src/test/run-pass/numbers-arithmetic/i8-incr.rs create mode 100644 src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs create mode 100644 src/test/run-pass/numbers-arithmetic/int.rs create mode 100644 src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs create mode 100644 src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs create mode 100644 src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs create mode 100644 src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs create mode 100644 src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs create mode 100644 src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs create mode 100644 src/test/run-pass/numbers-arithmetic/num-wrapping.rs create mode 100644 src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs create mode 100644 src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs create mode 100644 src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs create mode 100644 src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs create mode 100644 src/test/run-pass/numbers-arithmetic/shift-various-types.rs create mode 100644 src/test/run-pass/numbers-arithmetic/shift.rs create mode 100644 src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs create mode 100644 src/test/run-pass/numbers-arithmetic/u128-as-f32.rs create mode 100644 src/test/run-pass/numbers-arithmetic/u128.rs create mode 100644 src/test/run-pass/numbers-arithmetic/u32-decr.rs create mode 100644 src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs create mode 100644 src/test/run-pass/numbers-arithmetic/u8-incr.rs create mode 100644 src/test/run-pass/numbers-arithmetic/uint.rs create mode 100644 src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs create mode 100644 src/test/run-pass/overloaded/overloaded-autoderef-count.rs create mode 100644 src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs create mode 100644 src/test/run-pass/overloaded/overloaded-autoderef-order.rs create mode 100644 src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs create mode 100644 src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs create mode 100644 src/test/run-pass/overloaded/overloaded-autoderef.rs create mode 100644 src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs create mode 100644 src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs create mode 100644 src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs create mode 100644 src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs create mode 100644 src/test/run-pass/overloaded/overloaded-calls-simple.rs create mode 100644 src/test/run-pass/overloaded/overloaded-calls-zero-args.rs create mode 100644 src/test/run-pass/overloaded/overloaded-deref-count.rs create mode 100644 src/test/run-pass/overloaded/overloaded-deref.rs create mode 100644 src/test/run-pass/overloaded/overloaded-index-assoc-list.rs create mode 100644 src/test/run-pass/overloaded/overloaded-index-autoderef.rs create mode 100644 src/test/run-pass/overloaded/overloaded-index-in-field.rs create mode 100644 src/test/run-pass/overloaded/overloaded-index.rs create mode 100644 src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs create mode 100644 src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs create mode 100644 src/test/run-pass/packed/auxiliary/packed.rs create mode 100644 src/test/run-pass/packed/packed-struct-borrow-element.rs create mode 100644 src/test/run-pass/packed/packed-struct-drop-aligned.rs create mode 100644 src/test/run-pass/packed/packed-struct-generic-layout.rs create mode 100644 src/test/run-pass/packed/packed-struct-generic-size.rs create mode 100644 src/test/run-pass/packed/packed-struct-generic-size.stderr create mode 100644 src/test/run-pass/packed/packed-struct-layout.rs create mode 100644 src/test/run-pass/packed/packed-struct-match.rs create mode 100644 src/test/run-pass/packed/packed-struct-optimized-enum.rs create mode 100644 src/test/run-pass/packed/packed-struct-size-xc.rs create mode 100644 src/test/run-pass/packed/packed-struct-size.rs create mode 100644 src/test/run-pass/packed/packed-struct-vec.rs create mode 100644 src/test/run-pass/packed/packed-tuple-struct-layout.rs create mode 100644 src/test/run-pass/packed/packed-tuple-struct-size.rs create mode 100644 src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs create mode 100644 src/test/run-pass/panic-runtime/abort.rs create mode 100644 src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs create mode 100644 src/test/run-pass/panic-runtime/link-to-abort.rs create mode 100644 src/test/run-pass/panic-runtime/link-to-unwind.rs create mode 100644 src/test/run-pass/panic-runtime/lto-abort.rs create mode 100644 src/test/run-pass/panic-runtime/lto-unwind.rs create mode 100644 src/test/run-pass/panics/panic-handler-chain.rs create mode 100644 src/test/run-pass/panics/panic-handler-flail-wildly.rs create mode 100644 src/test/run-pass/panics/panic-handler-set-twice.rs create mode 100644 src/test/run-pass/panics/panic-in-dtor-drops-fields.rs create mode 100644 src/test/run-pass/panics/panic-recover-propagate.rs create mode 100644 src/test/run-pass/panics/panic-safe.rs create mode 100644 src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs create mode 100644 src/test/run-pass/privacy/auxiliary/privacy_reexport.rs create mode 100644 src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs create mode 100644 src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs create mode 100644 src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs create mode 100644 src/test/run-pass/privacy/priv-impl-prim-ty.rs create mode 100644 src/test/run-pass/privacy/privacy-ns.rs create mode 100644 src/test/run-pass/privacy/privacy-reexport.rs create mode 100644 src/test/run-pass/privacy/privacy1.rs create mode 100644 src/test/run-pass/privacy/private-class-field.rs create mode 100644 src/test/run-pass/privacy/private-method.rs create mode 100644 src/test/run-pass/privacy/pub-extern-privacy.rs create mode 100644 src/test/run-pass/privacy/pub-use-xcrate.rs create mode 100644 src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs create mode 100644 src/test/run-pass/process/process-envs.rs create mode 100644 src/test/run-pass/process/process-exit.rs create mode 100644 src/test/run-pass/process/process-remove-from-env.rs create mode 100644 src/test/run-pass/process/process-sigpipe.rs create mode 100644 src/test/run-pass/process/process-spawn-nonexistent.rs create mode 100644 src/test/run-pass/process/process-spawn-with-unicode-params.rs create mode 100644 src/test/run-pass/process/process-status-inherits-stdin.rs create mode 100644 src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs create mode 100644 src/test/run-pass/regions/regions-addr-of-ret.rs create mode 100644 src/test/run-pass/regions/regions-assoc-type-region-bound.rs create mode 100644 src/test/run-pass/regions/regions-assoc-type-static-bound.rs create mode 100644 src/test/run-pass/regions/regions-borrow-at.rs create mode 100644 src/test/run-pass/regions/regions-borrow-evec-fixed.rs create mode 100644 src/test/run-pass/regions/regions-borrow-evec-uniq.rs create mode 100644 src/test/run-pass/regions/regions-borrow-uniq.rs create mode 100644 src/test/run-pass/regions/regions-bot.rs create mode 100644 src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs create mode 100644 src/test/run-pass/regions/regions-bound-lists-feature-gate.rs create mode 100644 src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs create mode 100644 src/test/run-pass/regions/regions-copy-closure.rs create mode 100644 src/test/run-pass/regions/regions-creating-enums2.rs create mode 100644 src/test/run-pass/regions/regions-creating-enums5.rs create mode 100644 src/test/run-pass/regions/regions-debruijn-of-object.rs create mode 100644 src/test/run-pass/regions/regions-dependent-addr-of.rs create mode 100644 src/test/run-pass/regions/regions-dependent-autofn.rs create mode 100644 src/test/run-pass/regions/regions-dependent-autoslice.rs create mode 100644 src/test/run-pass/regions/regions-dependent-let-ref.rs create mode 100644 src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs create mode 100644 src/test/run-pass/regions/regions-early-bound-trait-param.rs create mode 100644 src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs create mode 100644 src/test/run-pass/regions/regions-early-bound-used-in-bound.rs create mode 100644 src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs create mode 100644 src/test/run-pass/regions/regions-escape-into-other-fn.rs create mode 100644 src/test/run-pass/regions/regions-expl-self.rs create mode 100644 src/test/run-pass/regions/regions-fn-subtyping-2.rs create mode 100644 src/test/run-pass/regions/regions-fn-subtyping.rs create mode 100644 src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs create mode 100644 src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs create mode 100644 src/test/run-pass/regions/regions-infer-borrow-scope-view.rs create mode 100644 src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs create mode 100644 src/test/run-pass/regions/regions-infer-borrow-scope.rs create mode 100644 src/test/run-pass/regions/regions-infer-call-2.rs create mode 100644 src/test/run-pass/regions/regions-infer-call.rs create mode 100644 src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs create mode 100644 src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs create mode 100644 src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs create mode 100644 src/test/run-pass/regions/regions-infer-static-from-proc.rs create mode 100644 src/test/run-pass/regions/regions-issue-21422.rs create mode 100644 src/test/run-pass/regions/regions-issue-22246.rs create mode 100644 src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs create mode 100644 src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs create mode 100644 src/test/run-pass/regions/regions-link-fn-args.rs create mode 100644 src/test/run-pass/regions/regions-lub-ref-ref-rc.rs create mode 100644 src/test/run-pass/regions/regions-mock-codegen.rs create mode 100644 src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs create mode 100644 src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs create mode 100644 src/test/run-pass/regions/regions-nullary-variant.rs create mode 100644 src/test/run-pass/regions/regions-params.rs create mode 100644 src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs create mode 100644 src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs create mode 100644 src/test/run-pass/regions/regions-refcell.rs create mode 100644 src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs create mode 100644 src/test/run-pass/regions/regions-return-interior-of-option.rs create mode 100644 src/test/run-pass/regions/regions-scope-chain-example.rs create mode 100644 src/test/run-pass/regions/regions-self-impls.rs create mode 100644 src/test/run-pass/regions/regions-self-in-enums.rs create mode 100644 src/test/run-pass/regions/regions-simple.rs create mode 100644 src/test/run-pass/regions/regions-static-bound.rs create mode 100644 src/test/run-pass/regions/regions-static-closure.rs create mode 100644 src/test/run-pass/regions/regions-trait-object-1.rs create mode 100644 src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs create mode 100644 src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs create mode 100644 src/test/run-pass/rfcs/rfc-1014-2.rs create mode 100644 src/test/run-pass/rfcs/rfc-1014.rs create mode 100644 src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs create mode 100644 src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs create mode 100644 src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs create mode 100644 src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr create mode 100644 src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr create mode 100644 src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs create mode 100644 src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs create mode 100644 src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs create mode 100644 src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs create mode 100644 src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs create mode 100644 src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs create mode 100644 src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs create mode 100644 src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs create mode 100644 src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs create mode 100644 src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs create mode 100644 src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs create mode 100644 src/test/run-pass/rfcs/rfc1623.rs create mode 100644 src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs create mode 100644 src/test/run-pass/rfcs/rfc1717/library-override.rs create mode 100644 src/test/run-pass/rfcs/rfc1857-drop-order.rs create mode 100644 src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs create mode 100644 src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs create mode 100644 src/test/run-pass/self/arbitrary_self_types_silly.rs create mode 100644 src/test/run-pass/self/arbitrary_self_types_struct.rs create mode 100644 src/test/run-pass/self/arbitrary_self_types_trait.rs create mode 100644 src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs create mode 100644 src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs create mode 100644 src/test/run-pass/self/builtin-superkinds-self-type.rs create mode 100644 src/test/run-pass/self/by-value-self-in-mut-slot.rs create mode 100644 src/test/run-pass/self/explicit-self-closures.rs create mode 100644 src/test/run-pass/self/explicit-self-generic.rs create mode 100644 src/test/run-pass/self/explicit-self-objects-uniq.rs create mode 100644 src/test/run-pass/self/explicit-self.rs create mode 100644 src/test/run-pass/self/explicit_self_xcrate_exe.rs create mode 100644 src/test/run-pass/self/move-self.rs create mode 100644 src/test/run-pass/self/object-safety-sized-self-by-value-self.rs create mode 100644 src/test/run-pass/self/object-safety-sized-self-generic-method.rs create mode 100644 src/test/run-pass/self/object-safety-sized-self-return-Self.rs create mode 100644 src/test/run-pass/self/self-impl.rs create mode 100644 src/test/run-pass/self/self-in-mut-slot-default-method.rs create mode 100644 src/test/run-pass/self/self-in-mut-slot-immediate-value.rs create mode 100644 src/test/run-pass/self/self-in-typedefs.rs create mode 100644 src/test/run-pass/self/self-re-assign.rs create mode 100644 src/test/run-pass/self/self-shadowing-import.rs create mode 100644 src/test/run-pass/self/self-type-param.rs create mode 100644 src/test/run-pass/self/string-self-append.rs create mode 100644 src/test/run-pass/self/ufcs-explicit-self.rs create mode 100644 src/test/run-pass/self/uniq-self-in-mut-slot.rs create mode 100644 src/test/run-pass/self/where-for-self.rs create mode 100644 src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs create mode 100644 src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs create mode 100644 src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-cci.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-extern.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-fns.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-lib-lto.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-lib.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-statics.rs create mode 100644 src/test/run-pass/sepcomp/sepcomp-unwind.rs create mode 100644 src/test/run-pass/simd/simd-generics.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-float-math.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-float-minmax.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-cast.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-elements.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-gather.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs create mode 100644 src/test/run-pass/simd/simd-intrinsic-generic-select.rs create mode 100644 src/test/run-pass/simd/simd-size-align.rs create mode 100644 src/test/run-pass/simd/simd-target-feature-mixup.rs create mode 100644 src/test/run-pass/simd/simd-type.rs create mode 100644 src/test/run-pass/simd/simd-upgraded.rs create mode 100644 src/test/run-pass/specialization/README.md create mode 100644 src/test/run-pass/specialization/assoc-ty-graph-cycle.rs create mode 100644 src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs create mode 100644 src/test/run-pass/specialization/auxiliary/go_trait.rs create mode 100644 src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs create mode 100644 src/test/run-pass/specialization/cross-crate-defaults.rs create mode 100644 src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs create mode 100644 src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs create mode 100644 src/test/run-pass/specialization/defaultimpl/out-of-order.rs create mode 100644 src/test/run-pass/specialization/defaultimpl/overlap-projection.rs create mode 100644 src/test/run-pass/specialization/defaultimpl/projection.rs create mode 100644 src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs create mode 100644 src/test/run-pass/specialization/specialization-allowed-cross-crate.rs create mode 100644 src/test/run-pass/specialization/specialization-assoc-fns.rs create mode 100644 src/test/run-pass/specialization/specialization-basics.rs create mode 100644 src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs create mode 100644 src/test/run-pass/specialization/specialization-cross-crate.rs create mode 100644 src/test/run-pass/specialization/specialization-default-methods.rs create mode 100644 src/test/run-pass/specialization/specialization-on-projection.rs create mode 100644 src/test/run-pass/specialization/specialization-out-of-order.rs create mode 100644 src/test/run-pass/specialization/specialization-overlap-projection.rs create mode 100644 src/test/run-pass/specialization/specialization-projection-alias.rs create mode 100644 src/test/run-pass/specialization/specialization-projection.rs create mode 100644 src/test/run-pass/specialization/specialization-super-traits.rs create mode 100644 src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs create mode 100644 src/test/run-pass/specialization/specialization-translate-projections-with-params.rs create mode 100644 src/test/run-pass/specialization/specialization-translate-projections.rs create mode 100644 src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs create mode 100644 src/test/run-pass/statics/auxiliary/static-methods-crate.rs create mode 100644 src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs create mode 100644 src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs create mode 100644 src/test/run-pass/statics/auxiliary/static_mut_xc.rs create mode 100644 src/test/run-pass/statics/static-fn-inline-xc.rs create mode 100644 src/test/run-pass/statics/static-fn-trait-xc.rs create mode 100644 src/test/run-pass/statics/static-function-pointer-xc.rs create mode 100644 src/test/run-pass/statics/static-function-pointer.rs create mode 100644 src/test/run-pass/statics/static-impl.rs create mode 100644 src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs create mode 100644 src/test/run-pass/statics/static-method-xcrate.rs create mode 100644 src/test/run-pass/statics/static-methods-in-traits.rs create mode 100644 src/test/run-pass/statics/static-methods-in-traits2.rs create mode 100644 src/test/run-pass/statics/static-mut-foreign.rs create mode 100644 src/test/run-pass/statics/static-mut-xc.rs create mode 100644 src/test/run-pass/statics/static-recursive.rs create mode 100644 src/test/run-pass/structs-enums/align-struct.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/empty-struct.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs create mode 100644 src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs create mode 100644 src/test/run-pass/structs-enums/borrow-tuple-fields.rs create mode 100644 src/test/run-pass/structs-enums/class-attributes-1.rs create mode 100644 src/test/run-pass/structs-enums/class-attributes-2.rs create mode 100644 src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs create mode 100644 src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs create mode 100644 src/test/run-pass/structs-enums/class-cast-to-trait.rs create mode 100644 src/test/run-pass/structs-enums/class-dtor.rs create mode 100644 src/test/run-pass/structs-enums/class-exports.rs create mode 100644 src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs create mode 100644 src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/class-implement-traits.rs create mode 100644 src/test/run-pass/structs-enums/class-method-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/class-methods-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/class-methods.rs create mode 100644 src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/class-poly-methods.rs create mode 100644 src/test/run-pass/structs-enums/class-separate-impl.rs create mode 100644 src/test/run-pass/structs-enums/class-str-field.rs create mode 100644 src/test/run-pass/structs-enums/class-typarams.rs create mode 100644 src/test/run-pass/structs-enums/classes-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/classes-self-referential.rs create mode 100644 src/test/run-pass/structs-enums/classes-simple-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/classes-simple-method.rs create mode 100644 src/test/run-pass/structs-enums/classes-simple.rs create mode 100644 src/test/run-pass/structs-enums/classes.rs create mode 100644 src/test/run-pass/structs-enums/codegen-tag-static-padding.rs create mode 100644 src/test/run-pass/structs-enums/compare-generic-enums.rs create mode 100644 src/test/run-pass/structs-enums/discrim-explicit-23030.rs create mode 100644 src/test/run-pass/structs-enums/empty-struct-braces.rs create mode 100644 src/test/run-pass/structs-enums/empty-tag.rs create mode 100644 src/test/run-pass/structs-enums/enum-alignment.rs create mode 100644 src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs create mode 100644 src/test/run-pass/structs-enums/enum-discr.rs create mode 100644 src/test/run-pass/structs-enums/enum-discrim-autosizing.rs create mode 100644 src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs create mode 100644 src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs create mode 100644 src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs create mode 100644 src/test/run-pass/structs-enums/enum-disr-val-pretty.rs create mode 100644 src/test/run-pass/structs-enums/enum-export-inheritance.rs create mode 100644 src/test/run-pass/structs-enums/enum-layout-optimization.rs create mode 100644 src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs create mode 100644 src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs create mode 100644 src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs create mode 100644 src/test/run-pass/structs-enums/enum-null-pointer-opt.rs create mode 100644 src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs create mode 100644 src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs create mode 100644 src/test/run-pass/structs-enums/enum-univariant-repr.rs create mode 100644 src/test/run-pass/structs-enums/enum-variants.rs create mode 100644 src/test/run-pass/structs-enums/enum-vec-initializer.rs create mode 100644 src/test/run-pass/structs-enums/export-abstract-tag.rs create mode 100644 src/test/run-pass/structs-enums/export-tag-variant.rs create mode 100644 src/test/run-pass/structs-enums/expr-if-struct.rs create mode 100644 src/test/run-pass/structs-enums/expr-match-struct.rs create mode 100644 src/test/run-pass/structs-enums/field-destruction-order.rs create mode 100644 src/test/run-pass/structs-enums/foreign-struct.rs create mode 100644 src/test/run-pass/structs-enums/functional-struct-upd.rs create mode 100644 src/test/run-pass/structs-enums/ivec-tag.rs create mode 100644 src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs create mode 100644 src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs create mode 100644 src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs create mode 100644 src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs create mode 100644 src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs create mode 100644 src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs create mode 100644 src/test/run-pass/structs-enums/namespaced-enums.rs create mode 100644 src/test/run-pass/structs-enums/nested-enum-same-names.rs create mode 100644 src/test/run-pass/structs-enums/newtype-struct-drop-run.rs create mode 100644 src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs create mode 100644 src/test/run-pass/structs-enums/newtype-struct-xc-2.rs create mode 100644 src/test/run-pass/structs-enums/newtype-struct-xc.rs create mode 100644 src/test/run-pass/structs-enums/nonzero-enum.rs create mode 100644 src/test/run-pass/structs-enums/numeric-fields.rs create mode 100644 src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs create mode 100644 src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs create mode 100644 src/test/run-pass/structs-enums/rec-align-u32.rs create mode 100644 src/test/run-pass/structs-enums/rec-align-u64.rs create mode 100644 src/test/run-pass/structs-enums/rec-auto.rs create mode 100644 src/test/run-pass/structs-enums/rec-extend.rs create mode 100644 src/test/run-pass/structs-enums/rec-tup.rs create mode 100644 src/test/run-pass/structs-enums/rec.rs create mode 100644 src/test/run-pass/structs-enums/record-pat.rs create mode 100644 src/test/run-pass/structs-enums/resource-in-struct.rs create mode 100644 src/test/run-pass/structs-enums/simple-generic-tag.rs create mode 100644 src/test/run-pass/structs-enums/simple-match-generic-tag.rs create mode 100644 src/test/run-pass/structs-enums/small-enum-range-edge.rs create mode 100644 src/test/run-pass/structs-enums/small-enums-with-fields.rs create mode 100644 src/test/run-pass/structs-enums/struct-aliases-xcrate.rs create mode 100644 src/test/run-pass/structs-enums/struct-aliases.rs create mode 100644 src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs create mode 100644 src/test/run-pass/structs-enums/struct-field-shorthand.rs create mode 100644 src/test/run-pass/structs-enums/struct-like-variant-construct.rs create mode 100644 src/test/run-pass/structs-enums/struct-like-variant-match.rs create mode 100644 src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs create mode 100644 src/test/run-pass/structs-enums/struct-literal-dtor.rs create mode 100644 src/test/run-pass/structs-enums/struct-new-as-field-name.rs create mode 100644 src/test/run-pass/structs-enums/struct-order-of-eval-1.rs create mode 100644 src/test/run-pass/structs-enums/struct-order-of-eval-2.rs create mode 100644 src/test/run-pass/structs-enums/struct-order-of-eval-3.rs create mode 100644 src/test/run-pass/structs-enums/struct-order-of-eval-4.rs create mode 100644 src/test/run-pass/structs-enums/struct-partial-move-1.rs create mode 100644 src/test/run-pass/structs-enums/struct-partial-move-2.rs create mode 100644 src/test/run-pass/structs-enums/struct-path-associated-type.rs create mode 100644 src/test/run-pass/structs-enums/struct-path-self.rs create mode 100644 src/test/run-pass/structs-enums/struct-pattern-matching.rs create mode 100644 src/test/run-pass/structs-enums/struct-return.rs create mode 100644 src/test/run-pass/structs-enums/struct-variant-field-visibility.rs create mode 100644 src/test/run-pass/structs-enums/struct_variant_xc.rs create mode 100644 src/test/run-pass/structs-enums/struct_variant_xc_match.rs create mode 100644 src/test/run-pass/structs-enums/tag-align-dyn-u64.rs create mode 100644 src/test/run-pass/structs-enums/tag-align-dyn-variants.rs create mode 100644 src/test/run-pass/structs-enums/tag-align-shape.rs create mode 100644 src/test/run-pass/structs-enums/tag-align-u64.rs create mode 100644 src/test/run-pass/structs-enums/tag-disr-val-shape.rs create mode 100644 src/test/run-pass/structs-enums/tag-exports.rs create mode 100644 src/test/run-pass/structs-enums/tag-in-block.rs create mode 100644 src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs create mode 100644 src/test/run-pass/structs-enums/tag-variant-disr-val.rs create mode 100644 src/test/run-pass/structs-enums/tag.rs create mode 100644 src/test/run-pass/structs-enums/tuple-struct-construct.rs create mode 100644 src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs create mode 100644 src/test/run-pass/structs-enums/tuple-struct-destructuring.rs create mode 100644 src/test/run-pass/structs-enums/tuple-struct-matching.rs create mode 100644 src/test/run-pass/structs-enums/tuple-struct-trivial.rs create mode 100644 src/test/run-pass/structs-enums/uninstantiable-struct.rs create mode 100644 src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs create mode 100644 src/test/run-pass/structs-enums/unit-like-struct.rs create mode 100644 src/test/run-pass/structs-enums/variant-structs-trivial.rs create mode 100644 src/test/run-pass/thinlto/all-crates.rs create mode 100644 src/test/run-pass/thinlto/auxiliary/dylib.rs create mode 100644 src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs create mode 100644 src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs create mode 100644 src/test/run-pass/thinlto/dylib-works.rs create mode 100644 src/test/run-pass/thinlto/msvc-imp-present.rs create mode 100644 src/test/run-pass/thinlto/thin-lto-inlines.rs create mode 100644 src/test/run-pass/thinlto/thin-lto-inlines2.rs create mode 100644 src/test/run-pass/thinlto/weak-works.rs create mode 100644 src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs create mode 100644 src/test/run-pass/threads-sendsync/comm.rs create mode 100644 src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs create mode 100644 src/test/run-pass/threads-sendsync/send-resource.rs create mode 100644 src/test/run-pass/threads-sendsync/send-type-inference.rs create mode 100644 src/test/run-pass/threads-sendsync/send_str_hashmap.rs create mode 100644 src/test/run-pass/threads-sendsync/send_str_treemap.rs create mode 100644 src/test/run-pass/threads-sendsync/sendable-class.rs create mode 100644 src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs create mode 100644 src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs create mode 100644 src/test/run-pass/threads-sendsync/spawn-fn.rs create mode 100644 src/test/run-pass/threads-sendsync/spawn-types.rs create mode 100644 src/test/run-pass/threads-sendsync/spawn.rs create mode 100644 src/test/run-pass/threads-sendsync/spawn2.rs create mode 100644 src/test/run-pass/threads-sendsync/spawning-with-debug.rs create mode 100644 src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs create mode 100644 src/test/run-pass/threads-sendsync/sync-send-atomics.rs create mode 100644 src/test/run-pass/threads-sendsync/sync-send-in-std.rs create mode 100644 src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs create mode 100644 src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-0.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-1.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-10.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-11.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-12.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-13.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-14.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-15.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-16.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-17.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-3.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-4.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-5.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-6.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-7.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-9.rs create mode 100644 src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs create mode 100644 src/test/run-pass/threads-sendsync/task-life-0.rs create mode 100644 src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs create mode 100644 src/test/run-pass/threads-sendsync/task-stderr.rs create mode 100644 src/test/run-pass/threads-sendsync/thread-local-extern-static.rs create mode 100644 src/test/run-pass/threads-sendsync/thread-local-syntax.rs create mode 100644 src/test/run-pass/threads-sendsync/threads.rs create mode 100644 src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs create mode 100644 src/test/run-pass/threads-sendsync/tls-init-on-init.rs create mode 100644 src/test/run-pass/threads-sendsync/tls-try-with.rs create mode 100644 src/test/run-pass/traits/anon-trait-static-method.rs create mode 100644 src/test/run-pass/traits/anon_trait_static_method_exe.rs create mode 100644 src/test/run-pass/traits/assignability-trait.rs create mode 100644 src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs create mode 100644 src/test/run-pass/traits/augmented-assignments-trait.rs create mode 100644 src/test/run-pass/traits/auto-traits.rs create mode 100644 src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs create mode 100644 src/test/run-pass/traits/auxiliary/go_trait.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_safety_lib.rs create mode 100644 src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs create mode 100644 src/test/run-pass/traits/auxiliary/traitimpl.rs create mode 100644 src/test/run-pass/traits/conservative_impl_trait.rs create mode 100644 src/test/run-pass/traits/cycle-trait-type-trait.rs create mode 100644 src/test/run-pass/traits/default-method-supertrait-vtable.rs create mode 100644 src/test/run-pass/traits/dyn-trait.rs create mode 100644 src/test/run-pass/traits/fmt-pointer-trait.rs create mode 100644 src/test/run-pass/traits/impl-implicit-trait.rs create mode 100644 src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs create mode 100644 src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs create mode 100644 src/test/run-pass/traits/inherent-trait-method-order.rs create mode 100644 src/test/run-pass/traits/kindck-owned-trait-contains-1.rs create mode 100644 src/test/run-pass/traits/multiple-trait-bounds.rs create mode 100644 src/test/run-pass/traits/object-one-type-two-traits.rs create mode 100644 src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs create mode 100644 src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs create mode 100644 src/test/run-pass/traits/parameterized-trait-with-bounds.rs create mode 100644 src/test/run-pass/traits/supertrait-default-generics.rs create mode 100644 src/test/run-pass/traits/syntax-trait-polarity.rs create mode 100644 src/test/run-pass/traits/trait-bounds-basic.rs create mode 100644 src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs create mode 100644 src/test/run-pass/traits/trait-bounds-in-arc.rs create mode 100644 src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs create mode 100644 src/test/run-pass/traits/trait-bounds-recursion.rs create mode 100644 src/test/run-pass/traits/trait-bounds.rs create mode 100644 src/test/run-pass/traits/trait-cache-issue-18209.rs create mode 100644 src/test/run-pass/traits/trait-coercion-generic.rs create mode 100644 src/test/run-pass/traits/trait-coercion.rs create mode 100644 src/test/run-pass/traits/trait-composition-trivial.rs create mode 100644 src/test/run-pass/traits/trait-copy-guessing.rs create mode 100644 src/test/run-pass/traits/trait-default-method-bound-subst.rs create mode 100644 src/test/run-pass/traits/trait-default-method-bound-subst2.rs create mode 100644 src/test/run-pass/traits/trait-default-method-bound-subst3.rs create mode 100644 src/test/run-pass/traits/trait-default-method-bound-subst4.rs create mode 100644 src/test/run-pass/traits/trait-default-method-bound.rs create mode 100644 src/test/run-pass/traits/trait-default-method-xc-2.rs create mode 100644 src/test/run-pass/traits/trait-default-method-xc.rs create mode 100644 src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs create mode 100644 src/test/run-pass/traits/trait-generic.rs create mode 100644 src/test/run-pass/traits/trait-impl-2.rs create mode 100644 src/test/run-pass/traits/trait-impl.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-auto-xc.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-auto.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-cast.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-diamond.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-multiple-params.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-num.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-num0.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-num1.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-num2.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-num3.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-num5.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-overloading-simple.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-overloading.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-self.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-simple.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-static.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-static2.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-subst.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-subst2.rs create mode 100644 src/test/run-pass/traits/trait-inheritance-visibility.rs create mode 100644 src/test/run-pass/traits/trait-inheritance2.rs create mode 100644 src/test/run-pass/traits/trait-item-inside-macro.rs create mode 100644 src/test/run-pass/traits/trait-object-auto-dedup.rs create mode 100644 src/test/run-pass/traits/trait-object-exclusion.rs create mode 100644 src/test/run-pass/traits/trait-object-generics.rs create mode 100644 src/test/run-pass/traits/trait-object-lifetime-first.rs create mode 100644 src/test/run-pass/traits/trait-object-with-lifetime-bound.rs create mode 100644 src/test/run-pass/traits/trait-region-pointer-simple.rs create mode 100644 src/test/run-pass/traits/trait-safety-ok-cc.rs create mode 100644 src/test/run-pass/traits/trait-safety-ok.rs create mode 100644 src/test/run-pass/traits/trait-static-method-overwriting.rs create mode 100644 src/test/run-pass/traits/trait-to-str.rs create mode 100644 src/test/run-pass/traits/trait-where-clause-vs-impl.rs create mode 100644 src/test/run-pass/traits/trait-with-bounds-default.rs create mode 100644 src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs create mode 100644 src/test/run-pass/traits/traits-conditional-dispatch.rs create mode 100644 src/test/run-pass/traits/traits-conditional-model-fn.rs create mode 100644 src/test/run-pass/traits/traits-default-method-macro.rs create mode 100644 src/test/run-pass/traits/traits-default-method-mut.rs create mode 100644 src/test/run-pass/traits/traits-default-method-self.rs create mode 100644 src/test/run-pass/traits/traits-default-method-trivial.rs create mode 100644 src/test/run-pass/traits/traits-elaborate-type-region.rs create mode 100644 src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs create mode 100644 src/test/run-pass/traits/traits-issue-22019.rs create mode 100644 src/test/run-pass/traits/traits-issue-22110.rs create mode 100644 src/test/run-pass/traits/traits-issue-22655.rs create mode 100644 src/test/run-pass/traits/traits-issue-23003.rs create mode 100644 src/test/run-pass/traits/traits-issue-26339.rs create mode 100644 src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs create mode 100644 src/test/run-pass/traits/traits-negative-impls.rs create mode 100644 src/test/run-pass/traits/traits-repeated-supertrait.rs create mode 100644 src/test/run-pass/traits/ufcs-trait-object.rs create mode 100644 src/test/run-pass/traits/use-trait-before-def.rs create mode 100644 src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs create mode 100644 src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs create mode 100644 src/test/run-pass/uniform-paths/basic-nested.rs create mode 100644 src/test/run-pass/uniform-paths/basic.rs create mode 100644 src/test/run-pass/uniform-paths/macros-nested.rs create mode 100644 src/test/run-pass/uniform-paths/macros.rs create mode 100644 src/test/run-pass/uniform-paths/same-crate.rs create mode 100644 src/test/run-pass/union/auxiliary/union.rs create mode 100644 src/test/run-pass/union/union-align.rs create mode 100644 src/test/run-pass/union/union-backcomp.rs create mode 100644 src/test/run-pass/union/union-basic.rs create mode 100644 src/test/run-pass/union/union-c-interop.rs create mode 100644 src/test/run-pass/union/union-const-codegen.rs create mode 100644 src/test/run-pass/union/union-const-eval-field.rs create mode 100644 src/test/run-pass/union/union-derive.rs create mode 100644 src/test/run-pass/union/union-drop-assign.rs create mode 100644 src/test/run-pass/union/union-drop.rs create mode 100644 src/test/run-pass/union/union-generic.rs create mode 100644 src/test/run-pass/union/union-inherent-method.rs create mode 100644 src/test/run-pass/union/union-macro.rs create mode 100644 src/test/run-pass/union/union-nodrop.rs create mode 100644 src/test/run-pass/union/union-overwrite.rs create mode 100644 src/test/run-pass/union/union-packed.rs create mode 100644 src/test/run-pass/union/union-pat-refutability.rs create mode 100644 src/test/run-pass/union/union-trait-impl.rs create mode 100644 src/test/run-pass/union/union-transmute.rs create mode 100644 src/test/run-pass/union/union-with-drop-fields-lint.rs create mode 100644 src/test/run-pass/unique/unique-assign-copy.rs create mode 100644 src/test/run-pass/unique/unique-assign-drop.rs create mode 100644 src/test/run-pass/unique/unique-assign-generic.rs create mode 100644 src/test/run-pass/unique/unique-assign.rs create mode 100644 src/test/run-pass/unique/unique-autoderef-field.rs create mode 100644 src/test/run-pass/unique/unique-autoderef-index.rs create mode 100644 src/test/run-pass/unique/unique-cmp.rs create mode 100644 src/test/run-pass/unique/unique-containing-tag.rs create mode 100644 src/test/run-pass/unique/unique-create.rs create mode 100644 src/test/run-pass/unique/unique-decl-init-copy.rs create mode 100644 src/test/run-pass/unique/unique-decl-init.rs create mode 100644 src/test/run-pass/unique/unique-decl-move.rs create mode 100644 src/test/run-pass/unique/unique-decl.rs create mode 100644 src/test/run-pass/unique/unique-deref.rs create mode 100644 src/test/run-pass/unique/unique-destructure.rs create mode 100644 src/test/run-pass/unique/unique-drop-complex.rs create mode 100644 src/test/run-pass/unique/unique-ffi-symbols.rs create mode 100644 src/test/run-pass/unique/unique-fn-arg-move.rs create mode 100644 src/test/run-pass/unique/unique-fn-arg-mut.rs create mode 100644 src/test/run-pass/unique/unique-fn-arg.rs create mode 100644 src/test/run-pass/unique/unique-fn-ret.rs create mode 100644 src/test/run-pass/unique/unique-generic-assign.rs create mode 100644 src/test/run-pass/unique/unique-in-tag.rs create mode 100644 src/test/run-pass/unique/unique-in-vec-copy.rs create mode 100644 src/test/run-pass/unique/unique-in-vec.rs create mode 100644 src/test/run-pass/unique/unique-init.rs create mode 100644 src/test/run-pass/unique/unique-kinds.rs create mode 100644 src/test/run-pass/unique/unique-log.rs create mode 100644 src/test/run-pass/unique/unique-match-discrim.rs create mode 100644 src/test/run-pass/unique/unique-move-drop.rs create mode 100644 src/test/run-pass/unique/unique-move-temp.rs create mode 100644 src/test/run-pass/unique/unique-move.rs create mode 100644 src/test/run-pass/unique/unique-mutable.rs create mode 100644 src/test/run-pass/unique/unique-object-move.rs create mode 100644 src/test/run-pass/unique/unique-pat-2.rs create mode 100644 src/test/run-pass/unique/unique-pat-3.rs create mode 100644 src/test/run-pass/unique/unique-pat.rs create mode 100644 src/test/run-pass/unique/unique-rec.rs create mode 100644 src/test/run-pass/unique/unique-send-2.rs create mode 100644 src/test/run-pass/unique/unique-send.rs create mode 100644 src/test/run-pass/unique/unique-swap.rs create mode 100644 src/test/run-pass/unsized-locals/reference-unsized-locals.rs create mode 100644 src/test/run-pass/unsized-locals/simple-unsized-locals.rs create mode 100644 src/test/run-pass/unsized-locals/unsized-exprs.rs create mode 100644 src/test/run-pass/unsized-locals/unsized-parameters.rs create mode 100644 src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs create mode 100644 src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs create mode 100644 src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs create mode 100644 src/test/run-pass/where-clauses/where-clause-method-substituion.rs create mode 100644 src/test/run-pass/where-clauses/where-clause-region-outlives.rs create mode 100644 src/test/run-pass/where-clauses/where-clauses-cross-crate.rs create mode 100644 src/test/run-pass/where-clauses/where-clauses-lifetimes.rs create mode 100644 src/test/run-pass/where-clauses/where-clauses-method.rs create mode 100644 src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs create mode 100644 src/test/run-pass/where-clauses/where-clauses.rs create mode 100644 src/test/run-pass/zero-sized/zero-size-type-destructors.rs create mode 100644 src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs create mode 100644 src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs create mode 100644 src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs create mode 100644 src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs create mode 100644 src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs create mode 100644 src/test/run-pass/zero-sized/zero-sized-vec-push.rs delete mode 100644 src/test/ui/run-pass/allocator/auxiliary/custom-as-global.rs delete mode 100644 src/test/ui/run-pass/allocator/auxiliary/custom.rs delete mode 100644 src/test/ui/run-pass/allocator/auxiliary/helper.rs delete mode 100644 src/test/ui/run-pass/allocator/custom.rs delete mode 100644 src/test/ui/run-pass/allocator/xcrate-use.rs delete mode 100644 src/test/ui/run-pass/allocator/xcrate-use2.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/arr_cycle.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/array_const_index-1.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-1.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-2.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/cast-in-array-size.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/check-static-mut-slices.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/check-static-slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/copy-out-of-array-1.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/destructure-array-1.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/empty-mutable-vec.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/estr-slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/evec-slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/fixed_length_copy.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/huge-largest-array.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/ivec-pass-by-value.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/mutable-alias-vec.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/nested-vec-1.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/nested-vec-2.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/nested-vec-3.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/new-style-fixed-length-vec.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/repeated-vector-syntax.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/show-boxed-slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/slice-2.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/slice-of-zero-size-elements.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/slice-panic-1.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/slice-panic-2.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/slice_binary_search.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/variance-vec-covariant.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-concat.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-dst.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-fixed-length.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-growth.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-late-init.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-macro-no-std.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-macro-repeat.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-macro-with-brackets.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-matching-autoslice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-matching-fixed.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-matching-fold.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-matching.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-push.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-repeat-with-cast.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-slice-drop.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-slice.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-tail-matching.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec-to_str.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec_cycle.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vec_cycle_wrapped.rs delete mode 100644 src/test/ui/run-pass/array-slice-vec/vector-no-ann-2.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-const-eval.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-cross-crate-defaults.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-cross-crate.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-in-global-const.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-inherent-impl.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-marks-live-code.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-match-patterns.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-outer-ty-refs.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-overwrite-default.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-public-impl.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-range-match-patterns.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-resolution-order.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-self-type.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-type-parameters.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-use-default.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs delete mode 100644 src/test/ui/run-pass/associated-consts/associated-const.rs delete mode 100644 src/test/ui/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs delete mode 100644 src/test/ui/run-pass/associated-consts/auxiliary/empty-struct.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-basic.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-binding-in-trait.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-binding-in-where-clause.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-bound.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-cc.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-conditional-dispatch.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-constant-type.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-doubleendediterator-object.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-enum-field-named.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-enum-field-numbered.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-eq-obj.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-impl-redirect.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-in-bound-type-arg.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-in-default-method.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-in-fn.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-in-impl-generics.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-in-inherent-method.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-issue-20220.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-issue-20371.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-issue-21212.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-iterator-binding.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-method.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-nested-projections.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-normalize-unifield-struct.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-projection-in-object-type.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-projection-in-supertrait.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-projection-in-where-clause.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-ref-from-struct.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-ref-in-struct-literal.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-resolve-lifetime.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-return.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-simple.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-stream.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-struct-field-named.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-struct-field-numbered.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-sugar-path.rs delete mode 100644 src/test/ui/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs delete mode 100644 src/test/ui/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/auto-ref-sliceable.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/auto-ref.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-method-on-trait.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-method-priority.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-method.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoderef-privacy.rs delete mode 100644 src/test/ui/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs delete mode 100644 src/test/ui/run-pass/bench/issue-32062.rs delete mode 100644 src/test/ui/run-pass/binding/allow_irrefutable_let_patterns.rs delete mode 100644 src/test/ui/run-pass/binding/bind-field-short-with-modifiers.rs delete mode 100644 src/test/ui/run-pass/binding/borrowed-ptr-pattern-2.rs delete mode 100644 src/test/ui/run-pass/binding/borrowed-ptr-pattern-3.rs delete mode 100644 src/test/ui/run-pass/binding/borrowed-ptr-pattern-infallible.rs delete mode 100644 src/test/ui/run-pass/binding/borrowed-ptr-pattern-option.rs delete mode 100644 src/test/ui/run-pass/binding/borrowed-ptr-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/empty-types-in-patterns.rs delete mode 100644 src/test/ui/run-pass/binding/exhaustive-bool-match-sanity.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match-generic-unique1.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match-generic-unique2.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match-generic.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match-panic-all.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match-panic.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match-unique.rs delete mode 100644 src/test/ui/run-pass/binding/expr-match.rs delete mode 100644 src/test/ui/run-pass/binding/fat-arrow-match.rs delete mode 100644 src/test/ui/run-pass/binding/fn-pattern-expected-type-2.rs delete mode 100644 src/test/ui/run-pass/binding/fn-pattern-expected-type.rs delete mode 100644 src/test/ui/run-pass/binding/func-arg-incomplete-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/func-arg-ref-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/func-arg-wild-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/if-let.rs delete mode 100644 src/test/ui/run-pass/binding/inconsistent-lifetime-mismatch.rs delete mode 100644 src/test/ui/run-pass/binding/inferred-suffix-in-pattern-range.rs delete mode 100644 src/test/ui/run-pass/binding/irrefutable-slice-patterns.rs delete mode 100644 src/test/ui/run-pass/binding/let-assignability.rs delete mode 100644 src/test/ui/run-pass/binding/let-destruct-ref.rs delete mode 100644 src/test/ui/run-pass/binding/let-var-hygiene.rs delete mode 100644 src/test/ui/run-pass/binding/match-arm-statics.rs delete mode 100644 src/test/ui/run-pass/binding/match-beginning-vert.rs delete mode 100644 src/test/ui/run-pass/binding/match-borrowed_str.rs delete mode 100644 src/test/ui/run-pass/binding/match-bot-2.rs delete mode 100644 src/test/ui/run-pass/binding/match-bot.rs delete mode 100644 src/test/ui/run-pass/binding/match-byte-array-patterns.rs delete mode 100644 src/test/ui/run-pass/binding/match-enum-struct-0.rs delete mode 100644 src/test/ui/run-pass/binding/match-enum-struct-1.rs delete mode 100644 src/test/ui/run-pass/binding/match-implicit-copy-unique.rs delete mode 100644 src/test/ui/run-pass/binding/match-in-macro.rs delete mode 100644 src/test/ui/run-pass/binding/match-join.rs delete mode 100644 src/test/ui/run-pass/binding/match-larger-const.rs delete mode 100644 src/test/ui/run-pass/binding/match-naked-record-expr.rs delete mode 100644 src/test/ui/run-pass/binding/match-naked-record.rs delete mode 100644 src/test/ui/run-pass/binding/match-path.rs delete mode 100644 src/test/ui/run-pass/binding/match-pattern-bindings.rs delete mode 100644 src/test/ui/run-pass/binding/match-pattern-lit.rs delete mode 100644 src/test/ui/run-pass/binding/match-pattern-no-type-params.rs delete mode 100644 src/test/ui/run-pass/binding/match-pattern-simple.rs delete mode 100644 src/test/ui/run-pass/binding/match-phi.rs delete mode 100644 src/test/ui/run-pass/binding/match-pipe-binding.rs delete mode 100644 src/test/ui/run-pass/binding/match-range-infer.rs delete mode 100644 src/test/ui/run-pass/binding/match-range-static.rs delete mode 100644 src/test/ui/run-pass/binding/match-range.rs delete mode 100644 src/test/ui/run-pass/binding/match-reassign.rs delete mode 100644 src/test/ui/run-pass/binding/match-ref-binding-in-guard-3256.rs delete mode 100644 src/test/ui/run-pass/binding/match-ref-binding-mut-option.rs delete mode 100644 src/test/ui/run-pass/binding/match-ref-binding-mut.rs delete mode 100644 src/test/ui/run-pass/binding/match-ref-binding.rs delete mode 100644 src/test/ui/run-pass/binding/match-ref-unsized.rs delete mode 100644 src/test/ui/run-pass/binding/match-static-const-rename.rs delete mode 100644 src/test/ui/run-pass/binding/match-str.rs delete mode 100644 src/test/ui/run-pass/binding/match-struct-0.rs delete mode 100644 src/test/ui/run-pass/binding/match-tag.rs delete mode 100644 src/test/ui/run-pass/binding/match-unique-bind.rs delete mode 100644 src/test/ui/run-pass/binding/match-unsized.rs delete mode 100644 src/test/ui/run-pass/binding/match-value-binding-in-guard-3291.rs delete mode 100644 src/test/ui/run-pass/binding/match-var-hygiene.rs delete mode 100644 src/test/ui/run-pass/binding/match-vec-alternatives.rs delete mode 100644 src/test/ui/run-pass/binding/match-vec-rvalue.rs delete mode 100644 src/test/ui/run-pass/binding/match-with-ret-arm.rs delete mode 100644 src/test/ui/run-pass/binding/multi-let.rs delete mode 100644 src/test/ui/run-pass/binding/mut-in-ident-patterns.rs delete mode 100644 src/test/ui/run-pass/binding/nested-exhaustive-match.rs delete mode 100644 src/test/ui/run-pass/binding/nested-matchs.rs delete mode 100644 src/test/ui/run-pass/binding/nested-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/nil-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/nullary-or-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/optional_comma_in_match_arm.rs delete mode 100644 src/test/ui/run-pass/binding/or-pattern.rs delete mode 100644 src/test/ui/run-pass/binding/order-drop-with-match.rs delete mode 100644 src/test/ui/run-pass/binding/pat-ranges.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-1.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-2.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-3.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-4.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-5.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-6.rs delete mode 100644 src/test/ui/run-pass/binding/pat-tuple-7.rs delete mode 100644 src/test/ui/run-pass/binding/pattern-bound-var-in-for-each.rs delete mode 100644 src/test/ui/run-pass/binding/pattern-in-closure.rs delete mode 100644 src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs delete mode 100644 src/test/ui/run-pass/binding/simple-generic-match.rs delete mode 100644 src/test/ui/run-pass/binding/use-uninit-match.rs delete mode 100644 src/test/ui/run-pass/binding/use-uninit-match2.rs delete mode 100644 src/test/ui/run-pass/binding/zero_sized_subslice_match.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-assign-to-subfield.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-assignment-to-static-mut.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-binding-mutbl.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-borrow-from-expr-block.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-closures-two-imm.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-field-sensitivity.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-fixed-length-vecs.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-freeze-frozen-mut.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-lend-args.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-move-by-capture-ok.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-mut-uniq.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-pat-enum.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-rvalues-mutable.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-static-item-in-fn.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-trait-lifetime.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-uniq-via-ref.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-univariant-enum.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-unused-mut-locals.rs delete mode 100644 src/test/ui/run-pass/borrowck/borrowck-use-mut-borrow.rs delete mode 100644 src/test/ui/run-pass/borrowck/two-phase-baseline.rs delete mode 100644 src/test/ui/run-pass/borrowck/two-phase-bin-ops.rs delete mode 100644 src/test/ui/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs delete mode 100644 src/test/ui/run-pass/cfg/auxiliary/cfg_inner_static.rs delete mode 100644 src/test/ui/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-attr-cfg.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-attr-crate.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-family.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-in-crate-1.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-macros-foo.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-macros-notfoo.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-match-arm.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-target-family.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg-target-vendor.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg_attr.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg_inner_static.rs delete mode 100644 src/test/ui/run-pass/cfg/cfg_stmt_expr.rs delete mode 100644 src/test/ui/run-pass/cfg/cfgs-on-items.rs delete mode 100644 src/test/ui/run-pass/cfg/conditional-compile-arch.rs delete mode 100644 src/test/ui/run-pass/cfg/conditional-compile.rs delete mode 100644 src/test/ui/run-pass/cfg/crate-attributes-using-cfg_attr.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-expect-unsized.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-overloaded-autoderef.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-unify-return.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-unify.rs delete mode 100644 src/test/ui/run-pass/coerce/coerce-unsize-subtype.rs delete mode 100644 src/test/ui/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs delete mode 100644 src/test/ui/run-pass/coherence/auxiliary/coherence_lib.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-bigint-int.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-bigint-vecint.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-blanket.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-covered-type-parameter.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-impl-in-fn.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-iterator-vec-any-elem.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-iterator-vec.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-multidispatch-tuple.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-negative-impls-safe.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-rfc447-constrained.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-subtyping.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence-where-clause.rs delete mode 100644 src/test/ui/run-pass/coherence/coherence_copy_like.rs delete mode 100644 src/test/ui/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs delete mode 100644 src/test/ui/run-pass/consts/auxiliary/cci_borrow_lib.rs delete mode 100644 src/test/ui/run-pass/consts/auxiliary/cci_const.rs delete mode 100644 src/test/ui/run-pass/consts/auxiliary/cci_const_block.rs delete mode 100644 src/test/ui/run-pass/consts/auxiliary/const_fn_lib.rs delete mode 100644 src/test/ui/run-pass/consts/const-adt-align-mismatch.rs delete mode 100644 src/test/ui/run-pass/consts/const-autoderef.rs delete mode 100644 src/test/ui/run-pass/consts/const-big-enum.rs delete mode 100644 src/test/ui/run-pass/consts/const-binops.rs delete mode 100644 src/test/ui/run-pass/consts/const-bitshift-rhs-inference.rs delete mode 100644 src/test/ui/run-pass/consts/const-block-cross-crate-fn.rs delete mode 100644 src/test/ui/run-pass/consts/const-block-item-macro-codegen.rs delete mode 100644 src/test/ui/run-pass/consts/const-block-item.rs delete mode 100644 src/test/ui/run-pass/consts/const-block.rs delete mode 100644 src/test/ui/run-pass/consts/const-bound.rs delete mode 100644 src/test/ui/run-pass/consts/const-byte-str-cast.rs delete mode 100644 src/test/ui/run-pass/consts/const-cast-ptr-int.rs delete mode 100644 src/test/ui/run-pass/consts/const-cast.rs delete mode 100644 src/test/ui/run-pass/consts/const-const.rs delete mode 100644 src/test/ui/run-pass/consts/const-contents.rs delete mode 100644 src/test/ui/run-pass/consts/const-cross-crate-const.rs delete mode 100644 src/test/ui/run-pass/consts/const-cross-crate-extern.rs delete mode 100644 src/test/ui/run-pass/consts/const-deref.rs delete mode 100644 src/test/ui/run-pass/consts/const-endianess.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-byref-self.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-byref.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-cast.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-ptr.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-struct.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-struct2.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-structlike.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-tuple.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-tuple2.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-tuplestruct.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-tuplestruct2.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-vec-index.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-vec-ptr.rs delete mode 100644 src/test/ui/run-pass/consts/const-enum-vector.rs delete mode 100644 src/test/ui/run-pass/consts/const-err.rs delete mode 100644 src/test/ui/run-pass/consts/const-expr-in-fixed-length-vec.rs delete mode 100644 src/test/ui/run-pass/consts/const-expr-in-vec-repeat.rs delete mode 100644 src/test/ui/run-pass/consts/const-extern-function.rs delete mode 100644 src/test/ui/run-pass/consts/const-fields-and-indexing.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn-const-eval.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn-feature-flags.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn-method.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn-nested.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn-stability-calls.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn-val.rs delete mode 100644 src/test/ui/run-pass/consts/const-fn.rs delete mode 100644 src/test/ui/run-pass/consts/const-index-feature-gate.rs delete mode 100644 src/test/ui/run-pass/consts/const-meth-pattern.rs delete mode 100644 src/test/ui/run-pass/consts/const-negation.rs delete mode 100644 src/test/ui/run-pass/consts/const-negative.rs delete mode 100644 src/test/ui/run-pass/consts/const-nullary-enum.rs delete mode 100644 src/test/ui/run-pass/consts/const-nullary-univariant-enum.rs delete mode 100644 src/test/ui/run-pass/consts/const-pattern-variant.rs delete mode 100644 src/test/ui/run-pass/consts/const-rec-and-tup.rs delete mode 100644 src/test/ui/run-pass/consts/const-region-ptrs-noncopy.rs delete mode 100644 src/test/ui/run-pass/consts/const-region-ptrs.rs delete mode 100644 src/test/ui/run-pass/consts/const-repeated-values.rs delete mode 100644 src/test/ui/run-pass/consts/const-size_of-align_of.rs delete mode 100644 src/test/ui/run-pass/consts/const-str-ptr.rs delete mode 100644 src/test/ui/run-pass/consts/const-struct-offsets.rs delete mode 100644 src/test/ui/run-pass/consts/const-struct.rs delete mode 100644 src/test/ui/run-pass/consts/const-trait-to-trait.rs delete mode 100644 src/test/ui/run-pass/consts/const-tuple-struct.rs delete mode 100644 src/test/ui/run-pass/consts/const-typeid-of.rs delete mode 100644 src/test/ui/run-pass/consts/const-unit-struct.rs delete mode 100644 src/test/ui/run-pass/consts/const-unsafe-fn.rs delete mode 100644 src/test/ui/run-pass/consts/const-vec-of-fns.rs delete mode 100644 src/test/ui/run-pass/consts/const-vec-syntax.rs delete mode 100644 src/test/ui/run-pass/consts/const-vecs-and-slices.rs delete mode 100644 src/test/ui/run-pass/consts/const.rs delete mode 100644 src/test/ui/run-pass/consts/consts-in-patterns.rs delete mode 100644 src/test/ui/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_capture_clause.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_const.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_impl_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_iter_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_nested_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/pub_static_array.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/reexported_static_methods.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs delete mode 100644 src/test/ui/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cci_borrow.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cci_capture_clause.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cci_impl_exe.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cci_iter_exe.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cci_nested_exe.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cci_no_inline_exe.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cross-crate-const-pat.rs delete mode 100644 src/test/ui/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs delete mode 100644 src/test/ui/run-pass/cross-crate/moves-based-on-type-cross-crate.rs delete mode 100644 src/test/ui/run-pass/cross-crate/reexported-static-methods-cross-crate.rs delete mode 100644 src/test/ui/run-pass/cross-crate/static-array-across-crate.rs delete mode 100644 src/test/ui/run-pass/cross-crate/xcrate-address-insignificant.rs delete mode 100644 src/test/ui/run-pass/cross-crate/xcrate-associated-type-defaults.rs delete mode 100644 src/test/ui/run-pass/cross-crate/xcrate-static-addresses.rs delete mode 100644 src/test/ui/run-pass/cross-crate/xcrate-trait-lifetime-param.rs delete mode 100644 src/test/ui/run-pass/cross-crate/xcrate-unit-struct.rs delete mode 100644 src/test/ui/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs delete mode 100644 src/test/ui/run-pass/ctfe/assoc-const.rs delete mode 100644 src/test/ui/run-pass/ctfe/bswap-const.rs delete mode 100644 src/test/ui/run-pass/ctfe/chained-constants-stackoverflow.rs delete mode 100644 src/test/ui/run-pass/ctfe/const-block-non-item-statement-3.rs delete mode 100644 src/test/ui/run-pass/ctfe/const-block-non-item-statement.rs delete mode 100644 src/test/ui/run-pass/ctfe/const-fn-destructuring-arg.rs delete mode 100644 src/test/ui/run-pass/ctfe/deref_in_pattern.rs delete mode 100644 src/test/ui/run-pass/ctfe/ice-48279.rs delete mode 100644 src/test/ui/run-pass/ctfe/issue-37550.rs delete mode 100644 src/test/ui/run-pass/ctfe/issue-broken-mir.rs delete mode 100644 src/test/ui/run-pass/ctfe/locals-in-const-fn.rs delete mode 100644 src/test/ui/run-pass/ctfe/match-const-fn-structs.rs delete mode 100644 src/test/ui/run-pass/ctfe/mozjs-error.rs delete mode 100644 src/test/ui/run-pass/ctfe/non-scalar-cast.rs delete mode 100644 src/test/ui/run-pass/ctfe/promotion.rs delete mode 100644 src/test/ui/run-pass/ctfe/references.rs delete mode 100644 src/test/ui/run-pass/ctfe/repeat_match.rs delete mode 100644 src/test/ui/run-pass/ctfe/return-in-const-fn.rs delete mode 100644 src/test/ui/run-pass/ctfe/signed_enum_discr.rs delete mode 100644 src/test/ui/run-pass/ctfe/transmute-const.rs delete mode 100644 src/test/ui/run-pass/ctfe/tuple-struct-constructors.rs delete mode 100644 src/test/ui/run-pass/deriving/auxiliary/derive-no-std.rs delete mode 100644 src/test/ui/run-pass/deriving/derive-no-std.rs delete mode 100644 src/test/ui/run-pass/deriving/derive-partialord-correctness.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-associated-types.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-bounds.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-array.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-generic-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-generic-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-generic-tuple-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-clone-tuple-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-cmp-generic-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-cmp-generic-struct-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-cmp-generic-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-cmp-shortcircuit.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-copyclone.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-default-box.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-enum-single-variant.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-eq-ord-boxed-slice.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-hash.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-in-fn.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-in-macro.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-meta-multiple.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-meta.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-show-2.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-show.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-c-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-hash-enum.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-hash-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-struct-empty.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-struct-tuple.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-struct.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-via-extension-type-params.rs delete mode 100644 src/test/ui/run-pass/deriving/deriving-with-repr-packed.rs delete mode 100644 src/test/ui/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs delete mode 100644 src/test/ui/run-pass/drop/drop-on-empty-block-exit.rs delete mode 100644 src/test/ui/run-pass/drop/drop-on-ret.rs delete mode 100644 src/test/ui/run-pass/drop/drop-struct-as-object.rs delete mode 100644 src/test/ui/run-pass/drop/drop-trait-enum.rs delete mode 100644 src/test/ui/run-pass/drop/drop-trait-generic.rs delete mode 100644 src/test/ui/run-pass/drop/drop-trait.rs delete mode 100644 src/test/ui/run-pass/drop/drop-uninhabited-enum.rs delete mode 100644 src/test/ui/run-pass/drop/drop-with-type-ascription-1.rs delete mode 100644 src/test/ui/run-pass/drop/drop-with-type-ascription-2.rs delete mode 100644 src/test/ui/run-pass/drop/dropck-eyepatch-extern-crate.rs delete mode 100644 src/test/ui/run-pass/drop/dropck-eyepatch-reorder.rs delete mode 100644 src/test/ui/run-pass/drop/dropck-eyepatch.rs delete mode 100644 src/test/ui/run-pass/drop/dropck_legal_cycles.rs delete mode 100644 src/test/ui/run-pass/drop/dynamic-drop.rs delete mode 100644 src/test/ui/run-pass/drop/no-drop-flag-size.rs delete mode 100644 src/test/ui/run-pass/drop/nondrop-cycle.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-coerce-custom.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-coerce-rc.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-coercions.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-deref-mut.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-deref.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-field-align.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-index.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-raw.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-struct-sole.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-struct.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-trait-tuple.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-trait.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-tuple-sole.rs delete mode 100644 src/test/ui/run-pass/dynamically-sized-types/dst-tuple.rs delete mode 100644 src/test/ui/run-pass/extern/auxiliary/extern-crosscrate-source.rs delete mode 100644 src/test/ui/run-pass/extern/auxiliary/extern-take-value.rs delete mode 100644 src/test/ui/run-pass/extern/auxiliary/extern_calling_convention.rs delete mode 100644 src/test/ui/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs delete mode 100644 src/test/ui/run-pass/extern/auxiliary/fat_drop.rs delete mode 100644 src/test/ui/run-pass/extern/extern-1.rs delete mode 100644 src/test/ui/run-pass/extern/extern-call-deep.rs delete mode 100644 src/test/ui/run-pass/extern/extern-call-deep2.rs delete mode 100644 src/test/ui/run-pass/extern/extern-call-direct.rs delete mode 100644 src/test/ui/run-pass/extern/extern-call-indirect.rs delete mode 100644 src/test/ui/run-pass/extern/extern-call-scrub.rs delete mode 100644 src/test/ui/run-pass/extern/extern-calling-convention-test.rs delete mode 100644 src/test/ui/run-pass/extern/extern-compare-with-return-type.rs delete mode 100644 src/test/ui/run-pass/extern/extern-crosscrate.rs delete mode 100644 src/test/ui/run-pass/extern/extern-foreign-crate.rs delete mode 100644 src/test/ui/run-pass/extern/extern-methods.rs delete mode 100644 src/test/ui/run-pass/extern/extern-mod-abi.rs delete mode 100644 src/test/ui/run-pass/extern/extern-mod-ordering-exe.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-TwoU16s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-TwoU32s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-TwoU64s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-TwoU8s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-char.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-double.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-empty.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-u32.rs delete mode 100644 src/test/ui/run-pass/extern/extern-pass-u64.rs delete mode 100644 src/test/ui/run-pass/extern/extern-prelude-core.rs delete mode 100644 src/test/ui/run-pass/extern/extern-prelude-core.stderr delete mode 100644 src/test/ui/run-pass/extern/extern-prelude-no-speculative.rs delete mode 100644 src/test/ui/run-pass/extern/extern-prelude-std.rs delete mode 100644 src/test/ui/run-pass/extern/extern-prelude-std.stderr delete mode 100644 src/test/ui/run-pass/extern/extern-pub.rs delete mode 100644 src/test/ui/run-pass/extern/extern-return-TwoU16s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-return-TwoU32s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-return-TwoU64s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-return-TwoU8s.rs delete mode 100644 src/test/ui/run-pass/extern/extern-rust.rs delete mode 100644 src/test/ui/run-pass/extern/extern-take-value.rs delete mode 100644 src/test/ui/run-pass/extern/extern-thiscall.rs delete mode 100644 src/test/ui/run-pass/extern/extern-types-inherent-impl.rs delete mode 100644 src/test/ui/run-pass/extern/extern-types-manual-sync-send.rs delete mode 100644 src/test/ui/run-pass/extern/extern-types-pointer-cast.rs delete mode 100644 src/test/ui/run-pass/extern/extern-types-size_of_val.rs delete mode 100644 src/test/ui/run-pass/extern/extern-types-thin-pointer.rs delete mode 100644 src/test/ui/run-pass/extern/extern-types-trait-impl.rs delete mode 100644 src/test/ui/run-pass/extern/extern-vectorcall.rs delete mode 100644 src/test/ui/run-pass/extern/extern_fat_drop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/auto-loop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/break-value.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/break.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-destruct.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-goofiness.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-has-unit-body.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-into-iterator.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-macro.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-mut-ref-element.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-no-std.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-panic.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-external-iterators-break.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-external-iterators-loop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-external-iterators-nested.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-external-iterators.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-nested.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-put-structured.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/foreach-simple-outer-slot.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/label_break_value.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/labeled-break.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/linear-for-loop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/liveness-loop-break.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/liveness-move-in-loop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-break-cont-1.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-break-cont.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-break-value.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-diverges.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-label-shadowing.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-labeled-break-value.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/loop-scope.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-cont.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-flow-graph.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-label.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-let.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-loop-constraints-2.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-prelude-drop.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while-with-break.rs delete mode 100644 src/test/ui/run-pass/for-loop-while/while.rs delete mode 100644 src/test/ui/run-pass/foreign/auxiliary/fn-abi.rs delete mode 100644 src/test/ui/run-pass/foreign/auxiliary/foreign_lib.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-call-no-runtime.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-dupe.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-fn-linkname.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-fn-with-byval.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-int-types.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-mod-src/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/foreign/foreign-mod-src/inner.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-mod-unused-const.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-no-abi.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-src/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/foreign/foreign-src/foreign.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign-truncated-arguments.rs delete mode 100644 src/test/ui/run-pass/foreign/foreign2.rs delete mode 100644 src/test/ui/run-pass/functions-closures/auxiliary/fn-abi.rs delete mode 100644 src/test/ui/run-pass/functions-closures/call-closure-from-overloaded-op.rs delete mode 100644 src/test/ui/run-pass/functions-closures/capture-clauses-boxed-closures.rs delete mode 100644 src/test/ui/run-pass/functions-closures/capture-clauses-unboxed-closures.rs delete mode 100644 src/test/ui/run-pass/functions-closures/clone-closure.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-bounds-can-capture-chan.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-expected-type/README.md delete mode 100644 src/test/ui/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-expected-type/issue-38714.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-expected-type/supply-nothing.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-immediate.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-inference.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-inference2.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-reform.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-returning-closure.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure-to-fn-coercion.rs delete mode 100644 src/test/ui/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs delete mode 100644 src/test/ui/run-pass/functions-closures/copy-closure.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-abi.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-bare-assign.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-bare-coerce-to-block.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-bare-item.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-bare-size.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-bare-spawn.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-coerce-field.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-item-type-cast.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-item-type-coerce.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-item-type-zero-sized.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-lval.rs delete mode 100644 src/test/ui/run-pass/functions-closures/fn-type-infer.rs delete mode 100644 src/test/ui/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs delete mode 100644 src/test/ui/run-pass/functions-closures/nullable-pointer-opt-closures.rs delete mode 100644 src/test/ui/run-pass/functions-closures/parallel-codegen-closures.rs delete mode 100644 src/test/ui/run-pass/functions-closures/return-from-closure.rs delete mode 100644 src/test/ui/run-pass/generator/auxiliary/xcrate-reachable.rs delete mode 100644 src/test/ui/run-pass/generator/auxiliary/xcrate.rs delete mode 100644 src/test/ui/run-pass/generator/borrow-in-tail-expr.rs delete mode 100644 src/test/ui/run-pass/generator/conditional-drop.rs delete mode 100644 src/test/ui/run-pass/generator/control-flow.rs delete mode 100644 src/test/ui/run-pass/generator/drop-env.rs delete mode 100644 src/test/ui/run-pass/generator/issue-44197.rs delete mode 100644 src/test/ui/run-pass/generator/issue-52398.rs delete mode 100644 src/test/ui/run-pass/generator/iterator-count.rs delete mode 100644 src/test/ui/run-pass/generator/live-upvar-across-yield.rs delete mode 100644 src/test/ui/run-pass/generator/match-bindings.rs delete mode 100644 src/test/ui/run-pass/generator/nested_generators.rs delete mode 100644 src/test/ui/run-pass/generator/panic-drops.rs delete mode 100644 src/test/ui/run-pass/generator/panic-safe.rs delete mode 100644 src/test/ui/run-pass/generator/reborrow-mut-upvar.rs delete mode 100644 src/test/ui/run-pass/generator/resume-after-return.rs delete mode 100644 src/test/ui/run-pass/generator/smoke.rs delete mode 100644 src/test/ui/run-pass/generator/static-generators.rs delete mode 100644 src/test/ui/run-pass/generator/too-live-local-in-immovable-gen.rs delete mode 100644 src/test/ui/run-pass/generator/xcrate-reachable.rs delete mode 100644 src/test/ui/run-pass/generator/xcrate.rs delete mode 100644 src/test/ui/run-pass/generator/yield-in-args-rev.rs delete mode 100644 src/test/ui/run-pass/generator/yield-in-box.rs delete mode 100644 src/test/ui/run-pass/generator/yield-in-initializer.rs delete mode 100644 src/test/ui/run-pass/generator/yield-subtype.rs delete mode 100644 src/test/ui/run-pass/generics/auxiliary/default_type_params_xc.rs delete mode 100644 src/test/ui/run-pass/generics/generic-alias-unique.rs delete mode 100644 src/test/ui/run-pass/generics/generic-default-type-params-cross-crate.rs delete mode 100644 src/test/ui/run-pass/generics/generic-default-type-params.rs delete mode 100644 src/test/ui/run-pass/generics/generic-derived-type.rs delete mode 100644 src/test/ui/run-pass/generics/generic-exterior-unique.rs delete mode 100644 src/test/ui/run-pass/generics/generic-extern-mangle.rs delete mode 100644 src/test/ui/run-pass/generics/generic-fn-infer.rs delete mode 100644 src/test/ui/run-pass/generics/generic-fn-twice.rs delete mode 100644 src/test/ui/run-pass/generics/generic-fn-unique.rs delete mode 100644 src/test/ui/run-pass/generics/generic-fn.rs delete mode 100644 src/test/ui/run-pass/generics/generic-ivec-leak.rs delete mode 100644 src/test/ui/run-pass/generics/generic-newtype-struct.rs delete mode 100644 src/test/ui/run-pass/generics/generic-object.rs delete mode 100644 src/test/ui/run-pass/generics/generic-recursive-tag.rs delete mode 100644 src/test/ui/run-pass/generics/generic-static-methods.rs delete mode 100644 src/test/ui/run-pass/generics/generic-tag-corruption.rs delete mode 100644 src/test/ui/run-pass/generics/generic-tag-local.rs delete mode 100644 src/test/ui/run-pass/generics/generic-tag-match.rs delete mode 100644 src/test/ui/run-pass/generics/generic-tag-values.rs delete mode 100644 src/test/ui/run-pass/generics/generic-tag.rs delete mode 100644 src/test/ui/run-pass/generics/generic-temporary.rs delete mode 100644 src/test/ui/run-pass/generics/generic-tup.rs delete mode 100644 src/test/ui/run-pass/generics/generic-type-synonym.rs delete mode 100644 src/test/ui/run-pass/generics/generic-type.rs delete mode 100644 src/test/ui/run-pass/generics/generic-unique.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-parse.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs delete mode 100644 src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs delete mode 100644 src/test/ui/run-pass/hygiene/auxiliary/legacy_interaction.rs delete mode 100644 src/test/ui/run-pass/hygiene/auxiliary/my_crate.rs delete mode 100644 src/test/ui/run-pass/hygiene/auxiliary/unhygienic_example.rs delete mode 100644 src/test/ui/run-pass/hygiene/auxiliary/xcrate.rs delete mode 100644 src/test/ui/run-pass/hygiene/hygiene-dodging-1.rs delete mode 100644 src/test/ui/run-pass/hygiene/hygiene.rs delete mode 100644 src/test/ui/run-pass/hygiene/hygienic-labels-in-let.rs delete mode 100644 src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr delete mode 100644 src/test/ui/run-pass/hygiene/hygienic-labels.rs delete mode 100644 src/test/ui/run-pass/hygiene/hygienic-labels.stderr delete mode 100644 src/test/ui/run-pass/hygiene/issue-44128.rs delete mode 100644 src/test/ui/run-pass/hygiene/issue-47311.rs delete mode 100644 src/test/ui/run-pass/hygiene/issue-47312.rs delete mode 100644 src/test/ui/run-pass/hygiene/items.rs delete mode 100644 src/test/ui/run-pass/hygiene/legacy_interaction.rs delete mode 100644 src/test/ui/run-pass/hygiene/lexical.rs delete mode 100644 src/test/ui/run-pass/hygiene/specialization.rs delete mode 100644 src/test/ui/run-pass/hygiene/trait_items.rs delete mode 100644 src/test/ui/run-pass/hygiene/ty_params.rs delete mode 100644 src/test/ui/run-pass/hygiene/wrap_unhygienic_example.rs delete mode 100644 src/test/ui/run-pass/hygiene/xcrate.rs delete mode 100644 src/test/ui/run-pass/impl-trait/auto-trait-leak.rs delete mode 100644 src/test/ui/run-pass/impl-trait/auxiliary/xcrate.rs delete mode 100644 src/test/ui/run-pass/impl-trait/bounds_regression.rs delete mode 100644 src/test/ui/run-pass/impl-trait/equality.rs delete mode 100644 src/test/ui/run-pass/impl-trait/example-calendar.rs delete mode 100644 src/test/ui/run-pass/impl-trait/example-st.rs delete mode 100644 src/test/ui/run-pass/impl-trait/existential-minimal.rs delete mode 100644 src/test/ui/run-pass/impl-trait/issue-42479.rs delete mode 100644 src/test/ui/run-pass/impl-trait/issue-49376.rs delete mode 100644 src/test/ui/run-pass/impl-trait/lifetimes.rs delete mode 100644 src/test/ui/run-pass/impl-trait/nesting.rs delete mode 100644 src/test/ui/run-pass/impl-trait/universal_hrtb_anon.rs delete mode 100644 src/test/ui/run-pass/impl-trait/universal_hrtb_named.rs delete mode 100644 src/test/ui/run-pass/impl-trait/universal_in_adt_in_parameters.rs delete mode 100644 src/test/ui/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs delete mode 100644 src/test/ui/run-pass/impl-trait/universal_in_trait_defn_parameters.rs delete mode 100644 src/test/ui/run-pass/impl-trait/universal_multiple_bounds.rs delete mode 100644 src/test/ui/run-pass/impl-trait/xcrate.rs delete mode 100644 src/test/ui/run-pass/impl-trait/xcrate_simple.rs delete mode 100644 src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs delete mode 100644 src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs delete mode 100644 src/test/ui/run-pass/imports/import-crate-with-invalid-spans/main.rs delete mode 100644 src/test/ui/run-pass/imports/import-from.rs delete mode 100644 src/test/ui/run-pass/imports/import-glob-0.rs delete mode 100644 src/test/ui/run-pass/imports/import-glob-1.rs delete mode 100644 src/test/ui/run-pass/imports/import-glob-crate.rs delete mode 100644 src/test/ui/run-pass/imports/import-in-block.rs delete mode 100644 src/test/ui/run-pass/imports/import-prefix-macro.rs delete mode 100644 src/test/ui/run-pass/imports/import-rename.rs delete mode 100644 src/test/ui/run-pass/imports/import-trailing-comma.rs delete mode 100644 src/test/ui/run-pass/imports/import.rs delete mode 100644 src/test/ui/run-pass/imports/import2.rs delete mode 100644 src/test/ui/run-pass/imports/import3.rs delete mode 100644 src/test/ui/run-pass/imports/import4.rs delete mode 100644 src/test/ui/run-pass/imports/import5.rs delete mode 100644 src/test/ui/run-pass/imports/import6.rs delete mode 100644 src/test/ui/run-pass/imports/import7.rs delete mode 100644 src/test/ui/run-pass/imports/import8.rs delete mode 100644 src/test/ui/run-pass/imports/imports.rs delete mode 100644 src/test/ui/run-pass/intrinsics/auxiliary/cci_intrinsic.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-alignment.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-assume.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-atomics-cc.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-atomics.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-move-val-cleanups.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-move-val.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-uninit.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsic-unreachable.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsics-integer.rs delete mode 100644 src/test/ui/run-pass/intrinsics/intrinsics-math.rs delete mode 100644 src/test/ui/run-pass/issues/.gitattributes delete mode 100644 src/test/ui/run-pass/issues/auxiliary/cgu_test.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/cgu_test_a.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/cgu_test_b.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/i8.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/iss.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-10028.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-11224.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-11225-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-11225-2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-11225-3.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-11508.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-11529.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-12133-rlib.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-12660-aux.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-13620-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-13620-2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-13872-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-13872-2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-13872-3.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-14344-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-14344-2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-14421.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-14422.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-15562.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-16643.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-17662.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-17718-aux.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-18501.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-18514.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-18711.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-18913-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-18913-2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-19340-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-2380.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-2414-a.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-2414-b.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-25185-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-25185-2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-2526.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-25467.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-2631-a.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-29485.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-3012-1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-36954.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-41394.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-4208-cc.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-4545.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-48984-aux.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-5518.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-5521.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-7178.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-7899.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-8044.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-8259.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-9906.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue-9968.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue13507.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue2170lib.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue34796aux.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_10031_aux.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_12612_1.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_12612_2.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_19293.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_20389.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_2316_a.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_2316_b.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_2472_b.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_2723_a.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rc delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_38190.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_38226_aux.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_38715-modern.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_38715.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_3979_traits.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_39823.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_40469.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_41053.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_42007_s.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_8401.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_9123.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_9155.rs delete mode 100644 src/test/ui/run-pass/issues/auxiliary/issue_9188.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10025.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10028.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10031.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10228.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10392.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10396.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10436.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10456.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10626.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10638.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10682.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10683.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10718.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10734.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10763.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10764.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10767.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10802.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10806.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10853.rs delete mode 100644 src/test/ui/run-pass/issues/issue-10902.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11047.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11085.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1112.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11205.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11224.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11225-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11225-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11225-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11267.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11382.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11384.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11508.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11529.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11552.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11577.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11592.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11612.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11677.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11709.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11820.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11869.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11940.rs delete mode 100644 src/test/ui/run-pass/issues/issue-11958.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12033.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12133-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12133-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12133-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12285.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1251.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1257.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12582.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12612.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12660.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12677.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12699.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12729.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12744.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12860.rs delete mode 100644 src/test/ui/run-pass/issues/issue-12909.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13027.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13105.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13167.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13204.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13214.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13259-windows-tcb-trash.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13264.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13304.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13323.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13405.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13434.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13494.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13507-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13620.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13655.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13665.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13703.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13763.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13775.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13808.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13837.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13867.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13872.rs delete mode 100644 src/test/ui/run-pass/issues/issue-13902.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14082.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14229.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14254.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14308.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14330.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14344.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14382.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14393.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14399.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14421.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14422.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14456.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1451.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14589.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1460.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14821.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14837.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14865.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14875.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14901.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14919.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14933.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14936.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14940.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14958.rs delete mode 100644 src/test/ui/run-pass/issues/issue-14959.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15043.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15063.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15080.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15104.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15108.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15129.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15155.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15189.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15221.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15261.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15444.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15487.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15523-big.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15523.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15562.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15571.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15673.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15689-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15689-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15730.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15734.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15735.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15763.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15774.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15793.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15858.rs delete mode 100644 src/test/ui/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16151.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16256.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16272.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16278.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16441.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16452.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16492.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16530.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16560.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16596.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16597-empty.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16597.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1660.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16602-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16602-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16602-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16643.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16648.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16668.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16671.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16739.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16745.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16774.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16783.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16819.rs delete mode 100644 src/test/ui/run-pass/issues/issue-16922.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1696.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1701.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17068.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17074.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17121.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17170.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17216.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17233.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17302.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17322.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17336.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17351.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17361.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17450.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17503.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17662.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17718-borrow-interior.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17718-const-destructors.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17718-parse-const.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17718-static-unsafe-interior.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17718.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17732.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17734.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17746.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17756.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17771.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17816.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17877.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17897.rs delete mode 100644 src/test/ui/run-pass/issues/issue-17904.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18060.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18075.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18083.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18088.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18110.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18173.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18188.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1821.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18232.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18352.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18353.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18412.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18425.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18446.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18464.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18501.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18514.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18539.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18652.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18655.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1866.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18661.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18685.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18711.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18738.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18767.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18804/auxiliary/lib.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18804/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18809.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18845.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18859.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18906.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18913.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18937-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-18988.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19001.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19037.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19081.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19097.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19098.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19102.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19127.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19129-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19129-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19135.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19244.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19293.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19340-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19340-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19358.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19367.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19398.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19404.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19479.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19499.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19631.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19632.rs delete mode 100644 src/test/ui/run-pass/issues/issue-1974.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19811-escape-unicode.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19850.rs delete mode 100644 src/test/ui/run-pass/issues/issue-19982.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20009.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20055-box-trait.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20055-box-unsized-array.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20091.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20174.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20186.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20313.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20343.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20389.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20396.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20414.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20427.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20454.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20544.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20575.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20616.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2063-resource.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2063.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20644.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20676.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2074.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20763-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20763-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20797.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20803.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20823.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20825.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20847.rs delete mode 100644 src/test/ui/run-pass/issues/issue-20953.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21033.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21058.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21140.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21174.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21245.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21291.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21306.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21361.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21363.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21384.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21400.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21402.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21475.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21486.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21520.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21562.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21622.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21634.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21655.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21721.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21726.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21891.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2190-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21909.rs delete mode 100644 src/test/ui/run-pass/issues/issue-21922.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22008.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22036.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22066.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2214.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2216.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22258.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22346.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22356.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22375.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22403.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22426.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22463.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22471.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22536-copy-mustnt-zero.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22546.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22577.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22629.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22777.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22781.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22814.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22828.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2284.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22864-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22864-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2288.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22894.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22992-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-22992.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23036.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2311-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2311.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2312.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2316-c.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23208.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23261.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23304-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23304-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23311.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23336.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23338-ensure-param-drop-order.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23406.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23433.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23442.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23477.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23485.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23491.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23550.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23611-enum-swap-in-drop.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23649-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23649-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23649-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23699.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23781.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2380-b.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23808.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23825.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2383.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23833.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23891.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23898.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23958.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23968-const-not-overflow.rs delete mode 100644 src/test/ui/run-pass/issues/issue-23992.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24085.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24086.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2414-c.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24161.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24227.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2428.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24308.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24313.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24353.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24389.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24434.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2445-b.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2445.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24533.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24589.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2463.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2472.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24779.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24805-dropck-itemless.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2487-a.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24945-repeat-dash-opts.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24947.rs delete mode 100644 src/test/ui/run-pass/issues/issue-24954.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2502.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25089.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25145.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25180.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25185.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2526-a.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25279.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25339.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25343.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25394.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25467.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25497.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2550.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25515.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25549-multiple-drop.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25679.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25693.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25700-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25700-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25746-bool-transmute.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25757.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25810.rs delete mode 100644 src/test/ui/run-pass/issues/issue-25916.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26095.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2611-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26127.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26205.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26251.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2631-b.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26322.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2633-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2633.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2642.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26468.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26484.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26641.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26646.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26655.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26709.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26802.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26805.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26873-multifile.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26873-onefile.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26905.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26996.rs delete mode 100644 src/test/ui/run-pass/issues/issue-26997.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27021.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27054-primitive-binary-ops.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27060.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2708.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27105.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2718.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2723-b.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27240.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27268.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27281.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27320.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2734.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2735-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2735-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2735.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27401-dropflag-reinit.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2748-a.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2748-b.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27583.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27639.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27859.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27889.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27890.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27901.rs delete mode 100644 src/test/ui/run-pass/issues/issue-27997.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2804-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28181.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28279.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28550.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28561.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28600.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28676.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28777.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28822.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28828.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28839.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28871.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28936.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2895.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28950.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28983.rs delete mode 100644 src/test/ui/run-pass/issues/issue-28999.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29030.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29037.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2904.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29048.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29053.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29071-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29071.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29092.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29147.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29166.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29227.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29276.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2935.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2936.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29466.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29485.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29488.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29516.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29522.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29540.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29663.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29668.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29710.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29740.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29746.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29844.rs delete mode 100644 src/test/ui/run-pass/issues/issue-2989.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29914-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29914-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29914.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29927.rs delete mode 100644 src/test/ui/run-pass/issues/issue-29948.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30018-nopanic.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30018-panic.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30081.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3012-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30240.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3026.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3037.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30371.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30490.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3052.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30530.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30615.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30756.rs delete mode 100644 src/test/ui/run-pass/issues/issue-30891.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3091.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3109.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3121.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31260.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31267-additional.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31267.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31299.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3149.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31597.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31702.rs delete mode 100644 src/test/ui/run-pass/issues/issue-31776.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32008.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3211.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3220.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32292.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32324.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32389.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32518.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32805.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3290.rs delete mode 100644 src/test/ui/run-pass/issues/issue-32947.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33096.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33185.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33187.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33202.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33264.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33287.rs delete mode 100644 src/test/ui/run-pass/issues/issue-333.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33387.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33461.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33498.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33537.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33687.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33770.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3389.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33903.rs delete mode 100644 src/test/ui/run-pass/issues/issue-33992.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34053.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34074.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34194.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3424.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3429.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34427.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3447.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34503.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34569.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34571.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34751.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34780.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34784.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34796.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34798.rs delete mode 100644 src/test/ui/run-pass/issues/issue-34932.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3500.rs delete mode 100644 src/test/ui/run-pass/issues/issue-35376.rs delete mode 100644 src/test/ui/run-pass/issues/issue-35423.rs delete mode 100644 src/test/ui/run-pass/issues/issue-35546.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3556.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3559.rs delete mode 100644 src/test/ui/run-pass/issues/issue-35600.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3563-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3563-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3574.rs delete mode 100644 src/test/ui/run-pass/issues/issue-35815.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36023.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36036-associated-type-layout.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36053.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36075.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3609.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36139-normalize-closure-sig.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36260.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36278-prefix-nesting.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36381.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36401.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36474.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3656.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36744-bitcast-args-if-needed.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36744-without-calls.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36768.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36786-resolve-call.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36792.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36816.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3683.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36856.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36936.rs delete mode 100644 src/test/ui/run-pass/issues/issue-36954.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3702.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37109.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37175.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37222.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37291/auxiliary/lib.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37291/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3743.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3753.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37598.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37655.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37686.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37725.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37733.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3794.rs delete mode 100644 src/test/ui/run-pass/issues/issue-37991.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38002.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38033.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38074.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38091.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38190.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38226.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38437.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3847.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38556.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38715.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38727.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3874.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38763.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3878.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3888-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38942.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3895.rs delete mode 100644 src/test/ui/run-pass/issues/issue-38987.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3904.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39089.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39292.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3935.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39367.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39467.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39548.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39709.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39720.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39720.stderr delete mode 100644 src/test/ui/run-pass/issues/issue-3979-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3979-generics.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3979-xcrate.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3979.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39808.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39823.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39827.rs delete mode 100644 src/test/ui/run-pass/issues/issue-3991.rs delete mode 100644 src/test/ui/run-pass/issues/issue-39984.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40003.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40085.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40136.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40235.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4025.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40408.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40469.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40770.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40847.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40883.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40951.rs delete mode 100644 src/test/ui/run-pass/issues/issue-40962.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41053.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4107.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41213.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41272.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41298.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41394.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41479.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41498.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41604.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41628.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41677.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41696.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41744.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41803.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41849-variance-req.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41888.rs delete mode 100644 src/test/ui/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42007.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4208.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42148.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42210.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4228.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42453.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42463.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42467.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4252.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42552.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42679.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42747.rs delete mode 100644 src/test/ui/run-pass/issues/issue-42956.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43057.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43132.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43205.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43291.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4333.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43357.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43483.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43692.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43853.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4387.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43910.rs delete mode 100644 src/test/ui/run-pass/issues/issue-43923.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44005.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4401.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44056.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44247.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44333.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44373.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44402.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4446.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4448.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4464.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44730.rs delete mode 100644 src/test/ui/run-pass/issues/issue-44851.rs delete mode 100644 src/test/ui/run-pass/issues/issue-45124.rs delete mode 100644 src/test/ui/run-pass/issues/issue-45152.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4541.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4542.rs delete mode 100644 src/test/ui/run-pass/issues/issue-45425.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4545.rs delete mode 100644 src/test/ui/run-pass/issues/issue-45731.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46069.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46095.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46519.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46553.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46845.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46855.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46920-byte-array-patterns.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46959.rs delete mode 100644 src/test/ui/run-pass/issues/issue-46964.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47139-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47139-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4734.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4735.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47364.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4759-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4759.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47638.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47673.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47703-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47703-tuple.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47703.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47722.rs delete mode 100644 src/test/ui/run-pass/issues/issue-47789.rs delete mode 100644 src/test/ui/run-pass/issues/issue-48159.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4830.rs delete mode 100644 src/test/ui/run-pass/issues/issue-48508-aux.rs delete mode 100644 src/test/ui/run-pass/issues/issue-48508.rs delete mode 100644 src/test/ui/run-pass/issues/issue-48551.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4865-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4865-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4865-3.rs delete mode 100644 src/test/ui/run-pass/issues/issue-4875.rs delete mode 100644 src/test/ui/run-pass/issues/issue-48962.rs delete mode 100644 src/test/ui/run-pass/issues/issue-48984.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49298.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49556.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49632.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49685.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49854.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49955-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49955.rs delete mode 100644 src/test/ui/run-pass/issues/issue-49973.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50415.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50442.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5060.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50689.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50731.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50811.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs delete mode 100644 src/test/ui/run-pass/issues/issue-50865-private-impl-trait/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue-51185.rs delete mode 100644 src/test/ui/run-pass/issues/issue-51345.rs delete mode 100644 src/test/ui/run-pass/issues/issue-51582.rs delete mode 100644 src/test/ui/run-pass/issues/issue-51655.rs delete mode 100644 src/test/ui/run-pass/issues/issue-51907.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5192.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52140/auxiliary/some_crate.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52140/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52141/auxiliary/some_crate.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52141/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52169.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5239-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5243.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52557.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52705/auxiliary/png2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-52705/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5280.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5315.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5321-immediates-with-bare-self.rs delete mode 100644 src/test/ui/run-pass/issues/issue-53333.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5353.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5518.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5521.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5530.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5550.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5554.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5572.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5666.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5688.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5708.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5718.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5741.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5754.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5791.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5884.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5900.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5917.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5950.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5988.rs delete mode 100644 src/test/ui/run-pass/issues/issue-5997.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6117.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6128.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6130.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6153.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6157.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6318.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6334.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6341.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6344-let.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6344-match.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6449.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6470.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6557.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6892.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6898.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6919.rs delete mode 100644 src/test/ui/run-pass/issues/issue-6991.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7012.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7178.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7222.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7268.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7344.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7519-match-unit-in-arg.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7563.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7575.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7607-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7660.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7663.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7784.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7899.rs delete mode 100644 src/test/ui/run-pass/issues/issue-7911.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8044.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8248.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8249.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8259.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8351-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8351-2.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8391.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8398.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8401.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8460.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8498.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8506.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8521.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8578.rs delete mode 100644 src/test/ui/run-pass/issues/issue-868.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8709.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8783.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8827.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8851.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8860.rs delete mode 100644 src/test/ui/run-pass/issues/issue-8898.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9047.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9110.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9123.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9129.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9188.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9243.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9249.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9259.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9382.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9394-inherited-trait-calls.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9396.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9446.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9719.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9737.rs delete mode 100644 src/test/ui/run-pass/issues/issue-979.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9837.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9906.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9918.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9942.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9951.rs delete mode 100644 src/test/ui/run-pass/issues/issue-9968.rs delete mode 100644 src/test/ui/run-pass/issues/issue2170exe.rs delete mode 100644 src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs delete mode 100644 src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs delete mode 100644 src/test/ui/run-pass/issues/issue24687-embed-debuginfo/main.rs delete mode 100644 src/test/ui/run-pass/issues/issue28498-must-work-ex1.rs delete mode 100644 src/test/ui/run-pass/issues/issue28498-must-work-ex2.rs delete mode 100644 src/test/ui/run-pass/issues/issue28498-ugeh-ex1.rs delete mode 100644 src/test/ui/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs delete mode 100644 src/test/ui/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs delete mode 100644 src/test/ui/run-pass/issues/issue28498-ugeh-with-trait-bound.rs delete mode 100644 src/test/ui/run-pass/issues/issue29927-1.rs delete mode 100644 src/test/ui/run-pass/issues/issue_26873_multifile/A/B.rs delete mode 100644 src/test/ui/run-pass/issues/issue_26873_multifile/A/C.rs delete mode 100644 src/test/ui/run-pass/issues/issue_26873_multifile/A/mod.rs delete mode 100644 src/test/ui/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/issues/issue_26873_multifile/mod.rs delete mode 100644 src/test/ui/run-pass/issues/issue_3136_b.rs delete mode 100644 src/test/ui/run-pass/issues/issue_9155.rs delete mode 100644 src/test/ui/run-pass/iterators/into-iterator-type-inference-shift.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-cloned-type-inference.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-range.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-step-overflow-debug.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-step-overflow-ndebug.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-sum-overflow-debug.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-sum-overflow-ndebug.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-sum-overflow-overflow-checks.rs delete mode 100644 src/test/ui/run-pass/iterators/iter-zip.rs delete mode 100644 src/test/ui/run-pass/macros/assert-eq-macro-success.rs delete mode 100644 src/test/ui/run-pass/macros/assert-eq-macro-unsized.rs delete mode 100644 src/test/ui/run-pass/macros/assert-ne-macro-success.rs delete mode 100644 src/test/ui/run-pass/macros/assert-ne-macro-unsized.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro-comma-support.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro-include-items-expr.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro-include-items-item.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro_crate_def_only.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro_crate_nonterminal.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro_export_inner_module.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/macro_with_super_1.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/two_macros.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/unstable-macros.rs delete mode 100644 src/test/ui/run-pass/macros/auxiliary/use-macro-self.rs delete mode 100644 src/test/ui/run-pass/macros/colorful-write-macros.rs delete mode 100644 src/test/ui/run-pass/macros/conditional-debug-macro-on.rs delete mode 100644 src/test/ui/run-pass/macros/die-macro.rs delete mode 100644 src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.rs delete mode 100644 src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout delete mode 100644 src/test/ui/run-pass/macros/macro-2.rs delete mode 100644 src/test/ui/run-pass/macros/macro-at-most-once-rep.rs delete mode 100644 src/test/ui/run-pass/macros/macro-attribute-expansion.rs delete mode 100644 src/test/ui/run-pass/macros/macro-attributes.rs delete mode 100644 src/test/ui/run-pass/macros/macro-block-nonterminal.rs delete mode 100644 src/test/ui/run-pass/macros/macro-comma-behavior.rs delete mode 100644 src/test/ui/run-pass/macros/macro-comma-support.rs delete mode 100644 src/test/ui/run-pass/macros/macro-crate-def-only.rs delete mode 100644 src/test/ui/run-pass/macros/macro-crate-nonterminal-renamed.rs delete mode 100644 src/test/ui/run-pass/macros/macro-crate-nonterminal.rs delete mode 100644 src/test/ui/run-pass/macros/macro-crate-use.rs delete mode 100644 src/test/ui/run-pass/macros/macro-deep_expansion.rs delete mode 100644 src/test/ui/run-pass/macros/macro-delimiter-significance.rs delete mode 100644 src/test/ui/run-pass/macros/macro-doc-comments.rs delete mode 100644 src/test/ui/run-pass/macros/macro-doc-escapes.rs delete mode 100644 src/test/ui/run-pass/macros/macro-doc-raw-str-hashes.rs delete mode 100644 src/test/ui/run-pass/macros/macro-export-inner-module.rs delete mode 100644 src/test/ui/run-pass/macros/macro-first-set.rs delete mode 100644 src/test/ui/run-pass/macros/macro-follow.rs delete mode 100644 src/test/ui/run-pass/macros/macro-followed-by-seq.rs delete mode 100644 src/test/ui/run-pass/macros/macro-include-items.rs delete mode 100644 src/test/ui/run-pass/macros/macro-interpolation.rs delete mode 100644 src/test/ui/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs delete mode 100644 src/test/ui/run-pass/macros/macro-lifetime-used-with-bound.rs delete mode 100644 src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.rs delete mode 100644 src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr delete mode 100644 src/test/ui/run-pass/macros/macro-lifetime-used-with-static.rs delete mode 100644 src/test/ui/run-pass/macros/macro-lifetime.rs delete mode 100644 src/test/ui/run-pass/macros/macro-literal.rs delete mode 100644 src/test/ui/run-pass/macros/macro-meta-items.rs delete mode 100644 src/test/ui/run-pass/macros/macro-method-issue-4621.rs delete mode 100644 src/test/ui/run-pass/macros/macro-multiple-items.rs delete mode 100644 src/test/ui/run-pass/macros/macro-named-default.rs delete mode 100644 src/test/ui/run-pass/macros/macro-nested_definition_issue-31946.rs delete mode 100644 src/test/ui/run-pass/macros/macro-nested_expr.rs delete mode 100644 src/test/ui/run-pass/macros/macro-nested_stmt_macros.rs delete mode 100644 src/test/ui/run-pass/macros/macro-nt-list.rs delete mode 100644 src/test/ui/run-pass/macros/macro-of-higher-order.rs delete mode 100644 src/test/ui/run-pass/macros/macro-pat-follow.rs delete mode 100644 src/test/ui/run-pass/macros/macro-pat-neg-lit.rs delete mode 100644 src/test/ui/run-pass/macros/macro-pat.rs delete mode 100644 src/test/ui/run-pass/macros/macro-path.rs delete mode 100644 src/test/ui/run-pass/macros/macro-pub-matcher.rs delete mode 100644 src/test/ui/run-pass/macros/macro-seq-followed-by-seq.rs delete mode 100644 src/test/ui/run-pass/macros/macro-stability.rs delete mode 100644 src/test/ui/run-pass/macros/macro-stmt.rs delete mode 100644 src/test/ui/run-pass/macros/macro-stmt_macro_in_expr_macro.rs delete mode 100644 src/test/ui/run-pass/macros/macro-tt-followed-by-seq.rs delete mode 100644 src/test/ui/run-pass/macros/macro-use-all-and-none.rs delete mode 100644 src/test/ui/run-pass/macros/macro-use-all.rs delete mode 100644 src/test/ui/run-pass/macros/macro-use-both.rs delete mode 100644 src/test/ui/run-pass/macros/macro-use-one.rs delete mode 100644 src/test/ui/run-pass/macros/macro-with-attrs1.rs delete mode 100644 src/test/ui/run-pass/macros/macro-with-attrs2.rs delete mode 100644 src/test/ui/run-pass/macros/macro-with-braces-in-expr-position.rs delete mode 100644 src/test/ui/run-pass/macros/macro_with_super_2.rs delete mode 100644 src/test/ui/run-pass/macros/macros-in-extern.rs delete mode 100644 src/test/ui/run-pass/macros/parse-complex-macro-invoc-op.rs delete mode 100644 src/test/ui/run-pass/macros/paths-in-macro-invocations.rs delete mode 100644 src/test/ui/run-pass/macros/pub-item-inside-macro.rs delete mode 100644 src/test/ui/run-pass/macros/pub-method-inside-macro.rs delete mode 100644 src/test/ui/run-pass/macros/semi-after-macro-ty.rs delete mode 100644 src/test/ui/run-pass/macros/stmt_expr_attr_macro_parse.rs delete mode 100644 src/test/ui/run-pass/macros/syntax-extension-cfg.rs delete mode 100644 src/test/ui/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment delete mode 100644 src/test/ui/run-pass/macros/syntax-extension-source-utils.rs delete mode 100644 src/test/ui/run-pass/macros/try-macro.rs delete mode 100644 src/test/ui/run-pass/macros/two-macro-use.rs delete mode 100644 src/test/ui/run-pass/macros/type-macros-hlist.rs delete mode 100644 src/test/ui/run-pass/macros/type-macros-simple.rs delete mode 100644 src/test/ui/run-pass/macros/typeck-macro-interaction-issue-8852.rs delete mode 100644 src/test/ui/run-pass/macros/use-macro-self.rs delete mode 100644 src/test/ui/run-pass/methods/auxiliary/method_self_arg1.rs delete mode 100644 src/test/ui/run-pass/methods/auxiliary/method_self_arg2.rs delete mode 100644 src/test/ui/run-pass/methods/method-argument-inference-associated-type.rs delete mode 100644 src/test/ui/run-pass/methods/method-attributes.rs delete mode 100644 src/test/ui/run-pass/methods/method-early-bound-lifetimes-on-self.rs delete mode 100644 src/test/ui/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs delete mode 100644 src/test/ui/run-pass/methods/method-normalize-bounds-issue-20604.rs delete mode 100644 src/test/ui/run-pass/methods/method-projection.rs delete mode 100644 src/test/ui/run-pass/methods/method-recursive-blanket-impl.rs delete mode 100644 src/test/ui/run-pass/methods/method-self-arg-aux1.rs delete mode 100644 src/test/ui/run-pass/methods/method-self-arg-aux2.rs delete mode 100644 src/test/ui/run-pass/methods/method-self-arg-trait.rs delete mode 100644 src/test/ui/run-pass/methods/method-self-arg.rs delete mode 100644 src/test/ui/run-pass/methods/method-two-trait-defer-resolution-1.rs delete mode 100644 src/test/ui/run-pass/methods/method-two-trait-defer-resolution-2.rs delete mode 100644 src/test/ui/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs delete mode 100644 src/test/ui/run-pass/methods/method-where-clause.rs delete mode 100644 src/test/ui/run-pass/mir/auxiliary/mir_external_refs.rs delete mode 100644 src/test/ui/run-pass/mir/mir-inlining/ice-issue-45493.rs delete mode 100644 src/test/ui/run-pass/mir/mir-inlining/ice-issue-45885.rs delete mode 100644 src/test/ui/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs delete mode 100644 src/test/ui/run-pass/mir/mir-typeck-normalize-fn-sig.rs delete mode 100644 src/test/ui/run-pass/mir/mir_adt_construction.rs delete mode 100644 src/test/ui/run-pass/mir/mir_ascription_coercion.rs delete mode 100644 src/test/ui/run-pass/mir/mir_augmented_assignments.rs delete mode 100644 src/test/ui/run-pass/mir/mir_autoderef.rs delete mode 100644 src/test/ui/run-pass/mir/mir_boxing.rs delete mode 100644 src/test/ui/run-pass/mir/mir_build_match_comparisons.rs delete mode 100644 src/test/ui/run-pass/mir/mir_call_with_associated_type.rs delete mode 100644 src/test/ui/run-pass/mir/mir_calls_to_shims.rs delete mode 100644 src/test/ui/run-pass/mir/mir_cast_fn_ret.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_array.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_array_2.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_call_converging.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_calls.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_calls_variadic.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_critical_edge.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_spike1.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_switch.rs delete mode 100644 src/test/ui/run-pass/mir/mir_codegen_switchint.rs delete mode 100644 src/test/ui/run-pass/mir/mir_coercion_casts.rs delete mode 100644 src/test/ui/run-pass/mir/mir_coercions.rs delete mode 100644 src/test/ui/run-pass/mir/mir_constval_adts.rs delete mode 100644 src/test/ui/run-pass/mir/mir_drop_order.rs delete mode 100644 src/test/ui/run-pass/mir/mir_early_return_scope.rs delete mode 100644 src/test/ui/run-pass/mir/mir_fat_ptr.rs delete mode 100644 src/test/ui/run-pass/mir/mir_fat_ptr_drop.rs delete mode 100644 src/test/ui/run-pass/mir/mir_heavy_promoted.rs delete mode 100644 src/test/ui/run-pass/mir/mir_match_arm_guard.rs delete mode 100644 src/test/ui/run-pass/mir/mir_misc_casts.rs delete mode 100644 src/test/ui/run-pass/mir/mir_overflow_off.rs delete mode 100644 src/test/ui/run-pass/mir/mir_raw_fat_ptr.rs delete mode 100644 src/test/ui/run-pass/mir/mir_refs_correct.rs delete mode 100644 src/test/ui/run-pass/mir/mir_small_agg_arg.rs delete mode 100644 src/test/ui/run-pass/mir/mir_struct_with_assoc_ty.rs delete mode 100644 src/test/ui/run-pass/mir/mir_temp_promotions.rs delete mode 100644 src/test/ui/run-pass/mir/mir_void_return.rs delete mode 100644 src/test/ui/run-pass/mir/mir_void_return_2.rs delete mode 100644 src/test/ui/run-pass/modules/auxiliary/two_macros_2.rs delete mode 100644 src/test/ui/run-pass/modules/mod-inside-fn.rs delete mode 100644 src/test/ui/run-pass/modules/mod-view-items.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_implicit.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_implicit_aux/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/modules/mod_dir_implicit_aux/mod.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_path.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_path2.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_path3.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_path_multi.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_recursive.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_simple.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_simple/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/modules/mod_dir_simple/load_another_mod.rs delete mode 100644 src/test/ui/run-pass/modules/mod_dir_simple/test.rs delete mode 100644 src/test/ui/run-pass/modules/mod_file.rs delete mode 100644 src/test/ui/run-pass/modules/mod_file_aux.rs delete mode 100644 src/test/ui/run-pass/modules/mod_file_with_path_attr.rs delete mode 100644 src/test/ui/run-pass/modules/module-polymorphism3-files/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs delete mode 100644 src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs delete mode 100644 src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs delete mode 100644 src/test/ui/run-pass/moves/move-1-unique.rs delete mode 100644 src/test/ui/run-pass/moves/move-2-unique.rs delete mode 100644 src/test/ui/run-pass/moves/move-2.rs delete mode 100644 src/test/ui/run-pass/moves/move-3-unique.rs delete mode 100644 src/test/ui/run-pass/moves/move-4-unique.rs delete mode 100644 src/test/ui/run-pass/moves/move-4.rs delete mode 100644 src/test/ui/run-pass/moves/move-arg-2-unique.rs delete mode 100644 src/test/ui/run-pass/moves/move-arg-2.rs delete mode 100644 src/test/ui/run-pass/moves/move-arg.rs delete mode 100644 src/test/ui/run-pass/moves/move-nullary-fn.rs delete mode 100644 src/test/ui/run-pass/moves/move-out-of-field.rs delete mode 100644 src/test/ui/run-pass/moves/move-scalar.rs delete mode 100644 src/test/ui/run-pass/moves/moves-based-on-type-capture-clause.rs delete mode 100644 src/test/ui/run-pass/nll/issue-47153-generic-const.rs delete mode 100644 src/test/ui/run-pass/nll/issue-47589.rs delete mode 100644 src/test/ui/run-pass/nll/issue-48623-closure.rs delete mode 100644 src/test/ui/run-pass/nll/issue-48623-generator.rs delete mode 100644 src/test/ui/run-pass/nll/issue-50343.rs delete mode 100644 src/test/ui/run-pass/nll/issue-50461-used-mut-from-moves.rs delete mode 100644 src/test/ui/run-pass/nll/issue-53123-raw-pointer-cast.rs delete mode 100644 src/test/ui/run-pass/nll/mutating_references.rs delete mode 100644 src/test/ui/run-pass/nll/process_or_insert_default.rs delete mode 100644 src/test/ui/run-pass/nll/rc-loop.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/foors_mod.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/modrs_mod/mod.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir delete mode 100644 src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs delete mode 100644 src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/arith-0.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/arith-1.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/arith-2.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/arith-unsigned.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/div-mod.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float-literal-inference.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float-nan.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float-signature.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float2.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/float_math.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/floatlits.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/i128-ffi.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/i128.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/i32-sub.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/i8-incr.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/int-abs-overflow.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/int.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/integer-literal-radix.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/num-wrapping.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/numeric-method-autoexport.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/promoted_overflow_opt.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/saturating-float-casts.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/shift-near-oflo.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/shift-various-types.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/shift.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/signed-shift-const-eval.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/u128-as-f32.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/u128.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/u32-decr.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/u8-incr-decr.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/u8-incr.rs delete mode 100644 src/test/ui/run-pass/numbers-arithmetic/uint.rs delete mode 100644 src/test/ui/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-autoderef-count.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-autoderef-indexing.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-autoderef-order.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-autoderef-vtable.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-autoderef-xcrate.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-autoderef.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-calls-object-one-arg.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-calls-object-two-args.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-calls-object-zero-args.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-calls-param-vtables.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-calls-simple.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-calls-zero-args.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-deref-count.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-deref.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-index-assoc-list.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-index-autoderef.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-index-in-field.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded-index.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs delete mode 100644 src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs delete mode 100644 src/test/ui/run-pass/packed/auxiliary/packed.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-borrow-element.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-drop-aligned.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-generic-layout.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-generic-size.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-generic-size.stderr delete mode 100644 src/test/ui/run-pass/packed/packed-struct-layout.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-match.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-optimized-enum.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-size-xc.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-size.rs delete mode 100644 src/test/ui/run-pass/packed/packed-struct-vec.rs delete mode 100644 src/test/ui/run-pass/packed/packed-tuple-struct-layout.rs delete mode 100644 src/test/ui/run-pass/packed/packed-tuple-struct-size.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/abort.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/link-to-abort.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/link-to-unwind.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/lto-abort.rs delete mode 100644 src/test/ui/run-pass/panic-runtime/lto-unwind.rs delete mode 100644 src/test/ui/run-pass/panics/panic-handler-chain.rs delete mode 100644 src/test/ui/run-pass/panics/panic-handler-flail-wildly.rs delete mode 100644 src/test/ui/run-pass/panics/panic-handler-set-twice.rs delete mode 100644 src/test/ui/run-pass/panics/panic-in-dtor-drops-fields.rs delete mode 100644 src/test/ui/run-pass/panics/panic-recover-propagate.rs delete mode 100644 src/test/ui/run-pass/panics/panic-safe.rs delete mode 100644 src/test/ui/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs delete mode 100644 src/test/ui/run-pass/privacy/auxiliary/privacy_reexport.rs delete mode 100644 src/test/ui/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs delete mode 100644 src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate1.rs delete mode 100644 src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate2.rs delete mode 100644 src/test/ui/run-pass/privacy/priv-impl-prim-ty.rs delete mode 100644 src/test/ui/run-pass/privacy/privacy-ns.rs delete mode 100644 src/test/ui/run-pass/privacy/privacy-reexport.rs delete mode 100644 src/test/ui/run-pass/privacy/privacy1.rs delete mode 100644 src/test/ui/run-pass/privacy/private-class-field.rs delete mode 100644 src/test/ui/run-pass/privacy/private-method.rs delete mode 100644 src/test/ui/run-pass/privacy/pub-extern-privacy.rs delete mode 100644 src/test/ui/run-pass/privacy/pub-use-xcrate.rs delete mode 100644 src/test/ui/run-pass/privacy/pub_use_mods_xcrate_exe.rs delete mode 100644 src/test/ui/run-pass/process/process-envs.rs delete mode 100644 src/test/ui/run-pass/process/process-exit.rs delete mode 100644 src/test/ui/run-pass/process/process-remove-from-env.rs delete mode 100644 src/test/ui/run-pass/process/process-sigpipe.rs delete mode 100644 src/test/ui/run-pass/process/process-spawn-nonexistent.rs delete mode 100644 src/test/ui/run-pass/process/process-spawn-with-unicode-params.rs delete mode 100644 src/test/ui/run-pass/process/process-status-inherits-stdin.rs delete mode 100644 src/test/ui/run-pass/regions/regions-addr-of-interior-of-unique-box.rs delete mode 100644 src/test/ui/run-pass/regions/regions-addr-of-ret.rs delete mode 100644 src/test/ui/run-pass/regions/regions-assoc-type-region-bound.rs delete mode 100644 src/test/ui/run-pass/regions/regions-assoc-type-static-bound.rs delete mode 100644 src/test/ui/run-pass/regions/regions-borrow-at.rs delete mode 100644 src/test/ui/run-pass/regions/regions-borrow-evec-fixed.rs delete mode 100644 src/test/ui/run-pass/regions/regions-borrow-evec-uniq.rs delete mode 100644 src/test/ui/run-pass/regions/regions-borrow-uniq.rs delete mode 100644 src/test/ui/run-pass/regions/regions-bot.rs delete mode 100644 src/test/ui/run-pass/regions/regions-bound-lists-feature-gate-2.rs delete mode 100644 src/test/ui/run-pass/regions/regions-bound-lists-feature-gate.rs delete mode 100644 src/test/ui/run-pass/regions/regions-close-over-type-parameter-successfully.rs delete mode 100644 src/test/ui/run-pass/regions/regions-copy-closure.rs delete mode 100644 src/test/ui/run-pass/regions/regions-creating-enums2.rs delete mode 100644 src/test/ui/run-pass/regions/regions-creating-enums5.rs delete mode 100644 src/test/ui/run-pass/regions/regions-debruijn-of-object.rs delete mode 100644 src/test/ui/run-pass/regions/regions-dependent-addr-of.rs delete mode 100644 src/test/ui/run-pass/regions/regions-dependent-autofn.rs delete mode 100644 src/test/ui/run-pass/regions/regions-dependent-autoslice.rs delete mode 100644 src/test/ui/run-pass/regions/regions-dependent-let-ref.rs delete mode 100644 src/test/ui/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs delete mode 100644 src/test/ui/run-pass/regions/regions-early-bound-trait-param.rs delete mode 100644 src/test/ui/run-pass/regions/regions-early-bound-used-in-bound-method.rs delete mode 100644 src/test/ui/run-pass/regions/regions-early-bound-used-in-bound.rs delete mode 100644 src/test/ui/run-pass/regions/regions-early-bound-used-in-type-param.rs delete mode 100644 src/test/ui/run-pass/regions/regions-escape-into-other-fn.rs delete mode 100644 src/test/ui/run-pass/regions/regions-expl-self.rs delete mode 100644 src/test/ui/run-pass/regions/regions-fn-subtyping-2.rs delete mode 100644 src/test/ui/run-pass/regions/regions-fn-subtyping.rs delete mode 100644 src/test/ui/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-borrow-scope-addr-of.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-borrow-scope-view.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-borrow-scope.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-call-2.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-call.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-contravariance-due-to-ret.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs delete mode 100644 src/test/ui/run-pass/regions/regions-infer-static-from-proc.rs delete mode 100644 src/test/ui/run-pass/regions/regions-issue-21422.rs delete mode 100644 src/test/ui/run-pass/regions/regions-issue-22246.rs delete mode 100644 src/test/ui/run-pass/regions/regions-lifetime-nonfree-late-bound.rs delete mode 100644 src/test/ui/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs delete mode 100644 src/test/ui/run-pass/regions/regions-link-fn-args.rs delete mode 100644 src/test/ui/run-pass/regions/regions-lub-ref-ref-rc.rs delete mode 100644 src/test/ui/run-pass/regions/regions-mock-codegen.rs delete mode 100644 src/test/ui/run-pass/regions/regions-no-bound-in-argument-cleanup.rs delete mode 100644 src/test/ui/run-pass/regions/regions-no-variance-from-fn-generics.rs delete mode 100644 src/test/ui/run-pass/regions/regions-nullary-variant.rs delete mode 100644 src/test/ui/run-pass/regions/regions-params.rs delete mode 100644 src/test/ui/run-pass/regions/regions-reassign-let-bound-pointer.rs delete mode 100644 src/test/ui/run-pass/regions/regions-reassign-match-bound-pointer.rs delete mode 100644 src/test/ui/run-pass/regions/regions-refcell.rs delete mode 100644 src/test/ui/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs delete mode 100644 src/test/ui/run-pass/regions/regions-return-interior-of-option.rs delete mode 100644 src/test/ui/run-pass/regions/regions-scope-chain-example.rs delete mode 100644 src/test/ui/run-pass/regions/regions-self-impls.rs delete mode 100644 src/test/ui/run-pass/regions/regions-self-in-enums.rs delete mode 100644 src/test/ui/run-pass/regions/regions-simple.rs delete mode 100644 src/test/ui/run-pass/regions/regions-static-bound.rs delete mode 100644 src/test/ui/run-pass/regions/regions-static-closure.rs delete mode 100644 src/test/ui/run-pass/regions/regions-trait-object-1.rs delete mode 100644 src/test/ui/run-pass/regions/regions-variance-contravariant-use-contravariant.rs delete mode 100644 src/test/ui/run-pass/regions/regions-variance-covariant-use-covariant.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1014-2.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1014.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2302-self-struct-ctor.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc1623.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc1717/library-override.rs delete mode 100644 src/test/ui/run-pass/rfcs/rfc1857-drop-order.rs delete mode 100644 src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs delete mode 100644 src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs delete mode 100644 src/test/ui/run-pass/self/arbitrary_self_types_silly.rs delete mode 100644 src/test/ui/run-pass/self/arbitrary_self_types_struct.rs delete mode 100644 src/test/ui/run-pass/self/arbitrary_self_types_trait.rs delete mode 100644 src/test/ui/run-pass/self/arbitrary_self_types_unsized_struct.rs delete mode 100644 src/test/ui/run-pass/self/auxiliary/explicit_self_xcrate.rs delete mode 100644 src/test/ui/run-pass/self/builtin-superkinds-self-type.rs delete mode 100644 src/test/ui/run-pass/self/by-value-self-in-mut-slot.rs delete mode 100644 src/test/ui/run-pass/self/explicit-self-closures.rs delete mode 100644 src/test/ui/run-pass/self/explicit-self-generic.rs delete mode 100644 src/test/ui/run-pass/self/explicit-self-objects-uniq.rs delete mode 100644 src/test/ui/run-pass/self/explicit-self.rs delete mode 100644 src/test/ui/run-pass/self/explicit_self_xcrate_exe.rs delete mode 100644 src/test/ui/run-pass/self/move-self.rs delete mode 100644 src/test/ui/run-pass/self/object-safety-sized-self-by-value-self.rs delete mode 100644 src/test/ui/run-pass/self/object-safety-sized-self-generic-method.rs delete mode 100644 src/test/ui/run-pass/self/object-safety-sized-self-return-Self.rs delete mode 100644 src/test/ui/run-pass/self/self-impl.rs delete mode 100644 src/test/ui/run-pass/self/self-in-mut-slot-default-method.rs delete mode 100644 src/test/ui/run-pass/self/self-in-mut-slot-immediate-value.rs delete mode 100644 src/test/ui/run-pass/self/self-in-typedefs.rs delete mode 100644 src/test/ui/run-pass/self/self-re-assign.rs delete mode 100644 src/test/ui/run-pass/self/self-shadowing-import.rs delete mode 100644 src/test/ui/run-pass/self/self-type-param.rs delete mode 100644 src/test/ui/run-pass/self/string-self-append.rs delete mode 100644 src/test/ui/run-pass/self/ufcs-explicit-self.rs delete mode 100644 src/test/ui/run-pass/self/uniq-self-in-mut-slot.rs delete mode 100644 src/test/ui/run-pass/self/where-for-self.rs delete mode 100644 src/test/ui/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs delete mode 100644 src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs delete mode 100644 src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_lib.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-cci.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-extern.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-fns-backwards.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-fns.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-lib-lto.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-lib.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-statics.rs delete mode 100644 src/test/ui/run-pass/sepcomp/sepcomp-unwind.rs delete mode 100644 src/test/ui/run-pass/simd/simd-generics.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-float-math.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-float-minmax.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-arithmetic.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-cast.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-comparison.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-elements.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-gather.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-reduction.rs delete mode 100644 src/test/ui/run-pass/simd/simd-intrinsic-generic-select.rs delete mode 100644 src/test/ui/run-pass/simd/simd-size-align.rs delete mode 100644 src/test/ui/run-pass/simd/simd-target-feature-mixup.rs delete mode 100644 src/test/ui/run-pass/simd/simd-type.rs delete mode 100644 src/test/ui/run-pass/simd/simd-upgraded.rs delete mode 100644 src/test/ui/run-pass/specialization/README.md delete mode 100644 src/test/ui/run-pass/specialization/assoc-ty-graph-cycle.rs delete mode 100644 src/test/ui/run-pass/specialization/auxiliary/cross_crates_defaults.rs delete mode 100644 src/test/ui/run-pass/specialization/auxiliary/go_trait.rs delete mode 100644 src/test/ui/run-pass/specialization/auxiliary/specialization_cross_crate.rs delete mode 100644 src/test/ui/run-pass/specialization/cross-crate-defaults.rs delete mode 100644 src/test/ui/run-pass/specialization/defaultimpl/allowed-cross-crate.rs delete mode 100644 src/test/ui/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs delete mode 100644 src/test/ui/run-pass/specialization/defaultimpl/out-of-order.rs delete mode 100644 src/test/ui/run-pass/specialization/defaultimpl/overlap-projection.rs delete mode 100644 src/test/ui/run-pass/specialization/defaultimpl/projection.rs delete mode 100644 src/test/ui/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-allowed-cross-crate.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-assoc-fns.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-basics.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-cross-crate-no-gate.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-cross-crate.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-default-methods.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-on-projection.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-out-of-order.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-overlap-projection.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-projection-alias.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-projection.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-super-traits.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-translate-projections-with-params.rs delete mode 100644 src/test/ui/run-pass/specialization/specialization-translate-projections.rs delete mode 100644 src/test/ui/run-pass/statics/auxiliary/static-function-pointer-aux.rs delete mode 100644 src/test/ui/run-pass/statics/auxiliary/static-methods-crate.rs delete mode 100644 src/test/ui/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs delete mode 100644 src/test/ui/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs delete mode 100644 src/test/ui/run-pass/statics/auxiliary/static_mut_xc.rs delete mode 100644 src/test/ui/run-pass/statics/static-fn-inline-xc.rs delete mode 100644 src/test/ui/run-pass/statics/static-fn-trait-xc.rs delete mode 100644 src/test/ui/run-pass/statics/static-function-pointer-xc.rs delete mode 100644 src/test/ui/run-pass/statics/static-function-pointer.rs delete mode 100644 src/test/ui/run-pass/statics/static-impl.rs delete mode 100644 src/test/ui/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs delete mode 100644 src/test/ui/run-pass/statics/static-method-xcrate.rs delete mode 100644 src/test/ui/run-pass/statics/static-methods-in-traits.rs delete mode 100644 src/test/ui/run-pass/statics/static-methods-in-traits2.rs delete mode 100644 src/test/ui/run-pass/statics/static-mut-foreign.rs delete mode 100644 src/test/ui/run-pass/statics/static-mut-xc.rs delete mode 100644 src/test/ui/run-pass/statics/static-recursive.rs delete mode 100644 src/test/ui/run-pass/structs-enums/align-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class_2.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class_3.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class_4.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class_6.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class_cast.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/cci_class_trait.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/empty-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enums.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs delete mode 100644 src/test/ui/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs delete mode 100644 src/test/ui/run-pass/structs-enums/borrow-tuple-fields.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-attributes-1.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-attributes-2.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-cast-to-trait.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-dtor.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-exports.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-impl-very-parameterized-trait.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-implement-trait-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-implement-traits.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-method-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-methods-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-methods.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-poly-methods-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-poly-methods.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-separate-impl.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-str-field.rs delete mode 100644 src/test/ui/run-pass/structs-enums/class-typarams.rs delete mode 100644 src/test/ui/run-pass/structs-enums/classes-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/classes-self-referential.rs delete mode 100644 src/test/ui/run-pass/structs-enums/classes-simple-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/classes-simple-method.rs delete mode 100644 src/test/ui/run-pass/structs-enums/classes-simple.rs delete mode 100644 src/test/ui/run-pass/structs-enums/classes.rs delete mode 100644 src/test/ui/run-pass/structs-enums/codegen-tag-static-padding.rs delete mode 100644 src/test/ui/run-pass/structs-enums/compare-generic-enums.rs delete mode 100644 src/test/ui/run-pass/structs-enums/discrim-explicit-23030.rs delete mode 100644 src/test/ui/run-pass/structs-enums/empty-struct-braces.rs delete mode 100644 src/test/ui/run-pass/structs-enums/empty-tag.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-alignment.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-clike-ffi-as-int.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-discr.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-discrim-autosizing.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-discrim-manual-sizing.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-discrim-range-overflow.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-discrim-width-stuff.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-disr-val-pretty.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-export-inheritance.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-layout-optimization.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-int.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-null-pointer-opt.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-univariant-repr.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-variants.rs delete mode 100644 src/test/ui/run-pass/structs-enums/enum-vec-initializer.rs delete mode 100644 src/test/ui/run-pass/structs-enums/export-abstract-tag.rs delete mode 100644 src/test/ui/run-pass/structs-enums/export-tag-variant.rs delete mode 100644 src/test/ui/run-pass/structs-enums/expr-if-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/expr-match-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/field-destruction-order.rs delete mode 100644 src/test/ui/run-pass/structs-enums/foreign-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/functional-struct-upd.rs delete mode 100644 src/test/ui/run-pass/structs-enums/ivec-tag.rs delete mode 100644 src/test/ui/run-pass/structs-enums/module-qualified-struct-destructure.rs delete mode 100644 src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs delete mode 100644 src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat.rs delete mode 100644 src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import.rs delete mode 100644 src/test/ui/run-pass/structs-enums/namespaced-enums-xcrate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/namespaced-enums.rs delete mode 100644 src/test/ui/run-pass/structs-enums/nested-enum-same-names.rs delete mode 100644 src/test/ui/run-pass/structs-enums/newtype-struct-drop-run.rs delete mode 100644 src/test/ui/run-pass/structs-enums/newtype-struct-with-dtor.rs delete mode 100644 src/test/ui/run-pass/structs-enums/newtype-struct-xc-2.rs delete mode 100644 src/test/ui/run-pass/structs-enums/newtype-struct-xc.rs delete mode 100644 src/test/ui/run-pass/structs-enums/nonzero-enum.rs delete mode 100644 src/test/ui/run-pass/structs-enums/numeric-fields.rs delete mode 100644 src/test/ui/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/rec-align-u32.rs delete mode 100644 src/test/ui/run-pass/structs-enums/rec-align-u64.rs delete mode 100644 src/test/ui/run-pass/structs-enums/rec-auto.rs delete mode 100644 src/test/ui/run-pass/structs-enums/rec-extend.rs delete mode 100644 src/test/ui/run-pass/structs-enums/rec-tup.rs delete mode 100644 src/test/ui/run-pass/structs-enums/rec.rs delete mode 100644 src/test/ui/run-pass/structs-enums/record-pat.rs delete mode 100644 src/test/ui/run-pass/structs-enums/resource-in-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/simple-generic-tag.rs delete mode 100644 src/test/ui/run-pass/structs-enums/simple-match-generic-tag.rs delete mode 100644 src/test/ui/run-pass/structs-enums/small-enum-range-edge.rs delete mode 100644 src/test/ui/run-pass/structs-enums/small-enums-with-fields.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-aliases-xcrate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-aliases.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-destructuring-cross-crate.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-field-shorthand.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-like-variant-construct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-like-variant-match.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-lit-functional-no-fields.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-literal-dtor.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-new-as-field-name.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-order-of-eval-1.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-order-of-eval-2.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-order-of-eval-3.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-order-of-eval-4.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-partial-move-1.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-partial-move-2.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-path-associated-type.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-path-self.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-pattern-matching.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-return.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct-variant-field-visibility.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct_variant_xc.rs delete mode 100644 src/test/ui/run-pass/structs-enums/struct_variant_xc_match.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-align-dyn-u64.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-align-dyn-variants.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-align-shape.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-align-u64.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-disr-val-shape.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-exports.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-in-block.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag-variant-disr-val.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tag.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tuple-struct-construct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tuple-struct-constructor-pointer.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tuple-struct-destructuring.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tuple-struct-matching.rs delete mode 100644 src/test/ui/run-pass/structs-enums/tuple-struct-trivial.rs delete mode 100644 src/test/ui/run-pass/structs-enums/uninstantiable-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/unit-like-struct-drop-run.rs delete mode 100644 src/test/ui/run-pass/structs-enums/unit-like-struct.rs delete mode 100644 src/test/ui/run-pass/structs-enums/variant-structs-trivial.rs delete mode 100644 src/test/ui/run-pass/thinlto/all-crates.rs delete mode 100644 src/test/ui/run-pass/thinlto/auxiliary/dylib.rs delete mode 100644 src/test/ui/run-pass/thinlto/auxiliary/msvc-imp-present.rs delete mode 100644 src/test/ui/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs delete mode 100644 src/test/ui/run-pass/thinlto/dylib-works.rs delete mode 100644 src/test/ui/run-pass/thinlto/msvc-imp-present.rs delete mode 100644 src/test/ui/run-pass/thinlto/thin-lto-inlines.rs delete mode 100644 src/test/ui/run-pass/thinlto/thin-lto-inlines2.rs delete mode 100644 src/test/ui/run-pass/thinlto/weak-works.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/comm.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/send-is-not-static-par-for.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/send-resource.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/send-type-inference.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/send_str_hashmap.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/send_str_treemap.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sendable-class.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sendfn-is-a-block.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/spawn-fn.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/spawn-types.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/spawn.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/spawn2.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/spawning-with-debug.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/std-sync-right-kind-impls.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sync-send-atomics.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-0.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-1.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-10.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-11.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-12.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-13.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-14.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-15.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-16.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-17.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-3.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-4.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-5.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-6.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-7.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-9.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-comm-chan-nil.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-life-0.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-spawn-move-and-copy.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/task-stderr.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/thread-local-extern-static.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/thread-local-syntax.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/threads.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/tls-init-on-init.rs delete mode 100644 src/test/ui/run-pass/threads-sendsync/tls-try-with.rs delete mode 100644 src/test/ui/run-pass/traits/anon-trait-static-method.rs delete mode 100644 src/test/ui/run-pass/traits/anon_trait_static_method_exe.rs delete mode 100644 src/test/ui/run-pass/traits/assignability-trait.rs delete mode 100644 src/test/ui/run-pass/traits/astconv-cycle-between-trait-and-type.rs delete mode 100644 src/test/ui/run-pass/traits/augmented-assignments-trait.rs delete mode 100644 src/test/ui/run-pass/traits/auto-traits.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/go_trait.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_safety_lib.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/trait_xc_call_aux.rs delete mode 100644 src/test/ui/run-pass/traits/auxiliary/traitimpl.rs delete mode 100644 src/test/ui/run-pass/traits/conservative_impl_trait.rs delete mode 100644 src/test/ui/run-pass/traits/cycle-trait-type-trait.rs delete mode 100644 src/test/ui/run-pass/traits/default-method-supertrait-vtable.rs delete mode 100644 src/test/ui/run-pass/traits/dyn-trait.rs delete mode 100644 src/test/ui/run-pass/traits/fmt-pointer-trait.rs delete mode 100644 src/test/ui/run-pass/traits/impl-implicit-trait.rs delete mode 100644 src/test/ui/run-pass/traits/impl-inherent-prefer-over-trait.rs delete mode 100644 src/test/ui/run-pass/traits/infer-from-object-trait-issue-26952.rs delete mode 100644 src/test/ui/run-pass/traits/inherent-trait-method-order.rs delete mode 100644 src/test/ui/run-pass/traits/kindck-owned-trait-contains-1.rs delete mode 100644 src/test/ui/run-pass/traits/multiple-trait-bounds.rs delete mode 100644 src/test/ui/run-pass/traits/object-one-type-two-traits.rs delete mode 100644 src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs delete mode 100644 src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits.rs delete mode 100644 src/test/ui/run-pass/traits/parameterized-trait-with-bounds.rs delete mode 100644 src/test/ui/run-pass/traits/supertrait-default-generics.rs delete mode 100644 src/test/ui/run-pass/traits/syntax-trait-polarity.rs delete mode 100644 src/test/ui/run-pass/traits/trait-bounds-basic.rs delete mode 100644 src/test/ui/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs delete mode 100644 src/test/ui/run-pass/traits/trait-bounds-in-arc.rs delete mode 100644 src/test/ui/run-pass/traits/trait-bounds-on-structs-and-enums.rs delete mode 100644 src/test/ui/run-pass/traits/trait-bounds-recursion.rs delete mode 100644 src/test/ui/run-pass/traits/trait-bounds.rs delete mode 100644 src/test/ui/run-pass/traits/trait-cache-issue-18209.rs delete mode 100644 src/test/ui/run-pass/traits/trait-coercion-generic.rs delete mode 100644 src/test/ui/run-pass/traits/trait-coercion.rs delete mode 100644 src/test/ui/run-pass/traits/trait-composition-trivial.rs delete mode 100644 src/test/ui/run-pass/traits/trait-copy-guessing.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-bound-subst.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-bound-subst2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-bound-subst3.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-bound-subst4.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-bound.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-xc-2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-default-method-xc.rs delete mode 100644 src/test/ui/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs delete mode 100644 src/test/ui/run-pass/traits/trait-generic.rs delete mode 100644 src/test/ui/run-pass/traits/trait-impl-2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-impl.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-auto-xc-2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-auto-xc.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-auto.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-cast.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-diamond.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-multiple-inheritors.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-multiple-params.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-num.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-num0.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-num1.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-num2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-num3.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-num5.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-overloading-simple.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-overloading-xc-exe.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-overloading.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-self-in-supertype.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-self.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-simple.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-static.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-static2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-subst.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-subst2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance-visibility.rs delete mode 100644 src/test/ui/run-pass/traits/trait-inheritance2.rs delete mode 100644 src/test/ui/run-pass/traits/trait-item-inside-macro.rs delete mode 100644 src/test/ui/run-pass/traits/trait-object-auto-dedup.rs delete mode 100644 src/test/ui/run-pass/traits/trait-object-exclusion.rs delete mode 100644 src/test/ui/run-pass/traits/trait-object-generics.rs delete mode 100644 src/test/ui/run-pass/traits/trait-object-lifetime-first.rs delete mode 100644 src/test/ui/run-pass/traits/trait-object-with-lifetime-bound.rs delete mode 100644 src/test/ui/run-pass/traits/trait-region-pointer-simple.rs delete mode 100644 src/test/ui/run-pass/traits/trait-safety-ok-cc.rs delete mode 100644 src/test/ui/run-pass/traits/trait-safety-ok.rs delete mode 100644 src/test/ui/run-pass/traits/trait-static-method-overwriting.rs delete mode 100644 src/test/ui/run-pass/traits/trait-to-str.rs delete mode 100644 src/test/ui/run-pass/traits/trait-where-clause-vs-impl.rs delete mode 100644 src/test/ui/run-pass/traits/trait-with-bounds-default.rs delete mode 100644 src/test/ui/run-pass/traits/traits-assoc-type-in-supertrait.rs delete mode 100644 src/test/ui/run-pass/traits/traits-conditional-dispatch.rs delete mode 100644 src/test/ui/run-pass/traits/traits-conditional-model-fn.rs delete mode 100644 src/test/ui/run-pass/traits/traits-default-method-macro.rs delete mode 100644 src/test/ui/run-pass/traits/traits-default-method-mut.rs delete mode 100644 src/test/ui/run-pass/traits/traits-default-method-self.rs delete mode 100644 src/test/ui/run-pass/traits/traits-default-method-trivial.rs delete mode 100644 src/test/ui/run-pass/traits/traits-elaborate-type-region.rs delete mode 100644 src/test/ui/run-pass/traits/traits-impl-object-overlap-issue-23853.rs delete mode 100644 src/test/ui/run-pass/traits/traits-issue-22019.rs delete mode 100644 src/test/ui/run-pass/traits/traits-issue-22110.rs delete mode 100644 src/test/ui/run-pass/traits/traits-issue-22655.rs delete mode 100644 src/test/ui/run-pass/traits/traits-issue-23003.rs delete mode 100644 src/test/ui/run-pass/traits/traits-issue-26339.rs delete mode 100644 src/test/ui/run-pass/traits/traits-multidispatch-infer-convert-target.rs delete mode 100644 src/test/ui/run-pass/traits/traits-negative-impls.rs delete mode 100644 src/test/ui/run-pass/traits/traits-repeated-supertrait.rs delete mode 100644 src/test/ui/run-pass/traits/ufcs-trait-object.rs delete mode 100644 src/test/ui/run-pass/traits/use-trait-before-def.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-all-traits.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-boxed.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-by-ref.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-drop.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-generic.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-prelude.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-simple.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs delete mode 100644 src/test/ui/run-pass/unboxed-closures/unboxed-closures-zero-args.rs delete mode 100644 src/test/ui/run-pass/uniform-paths/basic-nested.rs delete mode 100644 src/test/ui/run-pass/uniform-paths/basic.rs delete mode 100644 src/test/ui/run-pass/uniform-paths/macros-nested.rs delete mode 100644 src/test/ui/run-pass/uniform-paths/macros.rs delete mode 100644 src/test/ui/run-pass/uniform-paths/same-crate.rs delete mode 100644 src/test/ui/run-pass/union/auxiliary/union.rs delete mode 100644 src/test/ui/run-pass/union/union-align.rs delete mode 100644 src/test/ui/run-pass/union/union-backcomp.rs delete mode 100644 src/test/ui/run-pass/union/union-basic.rs delete mode 100644 src/test/ui/run-pass/union/union-c-interop.rs delete mode 100644 src/test/ui/run-pass/union/union-const-codegen.rs delete mode 100644 src/test/ui/run-pass/union/union-const-eval-field.rs delete mode 100644 src/test/ui/run-pass/union/union-derive.rs delete mode 100644 src/test/ui/run-pass/union/union-drop-assign.rs delete mode 100644 src/test/ui/run-pass/union/union-drop.rs delete mode 100644 src/test/ui/run-pass/union/union-generic.rs delete mode 100644 src/test/ui/run-pass/union/union-inherent-method.rs delete mode 100644 src/test/ui/run-pass/union/union-macro.rs delete mode 100644 src/test/ui/run-pass/union/union-nodrop.rs delete mode 100644 src/test/ui/run-pass/union/union-overwrite.rs delete mode 100644 src/test/ui/run-pass/union/union-packed.rs delete mode 100644 src/test/ui/run-pass/union/union-pat-refutability.rs delete mode 100644 src/test/ui/run-pass/union/union-trait-impl.rs delete mode 100644 src/test/ui/run-pass/union/union-transmute.rs delete mode 100644 src/test/ui/run-pass/union/union-with-drop-fields-lint.rs delete mode 100644 src/test/ui/run-pass/unique/unique-assign-copy.rs delete mode 100644 src/test/ui/run-pass/unique/unique-assign-drop.rs delete mode 100644 src/test/ui/run-pass/unique/unique-assign-generic.rs delete mode 100644 src/test/ui/run-pass/unique/unique-assign.rs delete mode 100644 src/test/ui/run-pass/unique/unique-autoderef-field.rs delete mode 100644 src/test/ui/run-pass/unique/unique-autoderef-index.rs delete mode 100644 src/test/ui/run-pass/unique/unique-cmp.rs delete mode 100644 src/test/ui/run-pass/unique/unique-containing-tag.rs delete mode 100644 src/test/ui/run-pass/unique/unique-create.rs delete mode 100644 src/test/ui/run-pass/unique/unique-decl-init-copy.rs delete mode 100644 src/test/ui/run-pass/unique/unique-decl-init.rs delete mode 100644 src/test/ui/run-pass/unique/unique-decl-move.rs delete mode 100644 src/test/ui/run-pass/unique/unique-decl.rs delete mode 100644 src/test/ui/run-pass/unique/unique-deref.rs delete mode 100644 src/test/ui/run-pass/unique/unique-destructure.rs delete mode 100644 src/test/ui/run-pass/unique/unique-drop-complex.rs delete mode 100644 src/test/ui/run-pass/unique/unique-ffi-symbols.rs delete mode 100644 src/test/ui/run-pass/unique/unique-fn-arg-move.rs delete mode 100644 src/test/ui/run-pass/unique/unique-fn-arg-mut.rs delete mode 100644 src/test/ui/run-pass/unique/unique-fn-arg.rs delete mode 100644 src/test/ui/run-pass/unique/unique-fn-ret.rs delete mode 100644 src/test/ui/run-pass/unique/unique-generic-assign.rs delete mode 100644 src/test/ui/run-pass/unique/unique-in-tag.rs delete mode 100644 src/test/ui/run-pass/unique/unique-in-vec-copy.rs delete mode 100644 src/test/ui/run-pass/unique/unique-in-vec.rs delete mode 100644 src/test/ui/run-pass/unique/unique-init.rs delete mode 100644 src/test/ui/run-pass/unique/unique-kinds.rs delete mode 100644 src/test/ui/run-pass/unique/unique-log.rs delete mode 100644 src/test/ui/run-pass/unique/unique-match-discrim.rs delete mode 100644 src/test/ui/run-pass/unique/unique-move-drop.rs delete mode 100644 src/test/ui/run-pass/unique/unique-move-temp.rs delete mode 100644 src/test/ui/run-pass/unique/unique-move.rs delete mode 100644 src/test/ui/run-pass/unique/unique-mutable.rs delete mode 100644 src/test/ui/run-pass/unique/unique-object-move.rs delete mode 100644 src/test/ui/run-pass/unique/unique-pat-2.rs delete mode 100644 src/test/ui/run-pass/unique/unique-pat-3.rs delete mode 100644 src/test/ui/run-pass/unique/unique-pat.rs delete mode 100644 src/test/ui/run-pass/unique/unique-rec.rs delete mode 100644 src/test/ui/run-pass/unique/unique-send-2.rs delete mode 100644 src/test/ui/run-pass/unique/unique-send.rs delete mode 100644 src/test/ui/run-pass/unique/unique-swap.rs delete mode 100644 src/test/ui/run-pass/unsized-locals/reference-unsized-locals.rs delete mode 100644 src/test/ui/run-pass/unsized-locals/simple-unsized-locals.rs delete mode 100644 src/test/ui/run-pass/unsized-locals/unsized-exprs.rs delete mode 100644 src/test/ui/run-pass/unsized-locals/unsized-parameters.rs delete mode 100644 src/test/ui/run-pass/where-clauses/auxiliary/where_clauses_xc.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clause-bounds-inconsistency.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clause-method-substituion.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clause-region-outlives.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clauses-cross-crate.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clauses-lifetimes.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clauses-method.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clauses-unboxed-closures.rs delete mode 100644 src/test/ui/run-pass/where-clauses/where-clauses.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-size-type-destructors.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-sized-binary-heap-push.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-sized-btreemap-insert.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-sized-linkedlist-push.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-sized-tuple-struct.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-sized-vec-deque-push.rs delete mode 100644 src/test/ui/run-pass/zero-sized/zero-sized-vec-push.rs (limited to 'src') diff --git a/src/test/run-pass/allocator/auxiliary/custom-as-global.rs b/src/test/run-pass/allocator/auxiliary/custom-as-global.rs new file mode 100644 index 00000000000..a3f05a01c5a --- /dev/null +++ b/src/test/run-pass/allocator/auxiliary/custom-as-global.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] + +extern crate custom; + +use std::sync::atomic::{ATOMIC_USIZE_INIT, Ordering}; + +use custom::A; + +#[global_allocator] +static ALLOCATOR: A = A(ATOMIC_USIZE_INIT); + +pub fn get() -> usize { + ALLOCATOR.0.load(Ordering::SeqCst) +} diff --git a/src/test/run-pass/allocator/auxiliary/custom.rs b/src/test/run-pass/allocator/auxiliary/custom.rs new file mode 100644 index 00000000000..b17464e0419 --- /dev/null +++ b/src/test/run-pass/allocator/auxiliary/custom.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![feature(allocator_api)] +#![crate_type = "rlib"] + +use std::alloc::{GlobalAlloc, System, Layout}; +use std::sync::atomic::{AtomicUsize, Ordering}; + +pub struct A(pub AtomicUsize); + +unsafe impl GlobalAlloc for A { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + self.0.fetch_add(1, Ordering::SeqCst); + System.alloc(layout) + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + self.0.fetch_add(1, Ordering::SeqCst); + System.dealloc(ptr, layout) + } +} diff --git a/src/test/run-pass/allocator/auxiliary/helper.rs b/src/test/run-pass/allocator/auxiliary/helper.rs new file mode 100644 index 00000000000..e75a432710d --- /dev/null +++ b/src/test/run-pass/allocator/auxiliary/helper.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] + +use std::fmt; + +pub fn work_with(p: &fmt::Debug) { + drop(p); +} diff --git a/src/test/run-pass/allocator/custom.rs b/src/test/run-pass/allocator/custom.rs new file mode 100644 index 00000000000..9617f7d4685 --- /dev/null +++ b/src/test/run-pass/allocator/custom.rs @@ -0,0 +1,68 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:helper.rs +// no-prefer-dynamic + +#![feature(allocator_api)] + +extern crate helper; + +use std::alloc::{self, Global, Alloc, System, Layout}; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; + +static HITS: AtomicUsize = ATOMIC_USIZE_INIT; + +struct A; + +unsafe impl alloc::GlobalAlloc for A { + unsafe fn alloc(&self, layout: Layout) -> *mut u8 { + HITS.fetch_add(1, Ordering::SeqCst); + System.alloc(layout) + } + + unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { + HITS.fetch_add(1, Ordering::SeqCst); + System.dealloc(ptr, layout) + } +} + +#[global_allocator] +static GLOBAL: A = A; + +fn main() { + println!("hello!"); + + let n = HITS.load(Ordering::SeqCst); + assert!(n > 0); + unsafe { + let layout = Layout::from_size_align(4, 2).unwrap(); + + let ptr = Global.alloc(layout.clone()).unwrap(); + helper::work_with(&ptr); + assert_eq!(HITS.load(Ordering::SeqCst), n + 1); + Global.dealloc(ptr, layout.clone()); + assert_eq!(HITS.load(Ordering::SeqCst), n + 2); + + let s = String::with_capacity(10); + helper::work_with(&s); + assert_eq!(HITS.load(Ordering::SeqCst), n + 3); + drop(s); + assert_eq!(HITS.load(Ordering::SeqCst), n + 4); + + let ptr = System.alloc(layout.clone()).unwrap(); + assert_eq!(HITS.load(Ordering::SeqCst), n + 4); + helper::work_with(&ptr); + System.dealloc(ptr, layout); + assert_eq!(HITS.load(Ordering::SeqCst), n + 4); + } +} diff --git a/src/test/run-pass/allocator/xcrate-use.rs b/src/test/run-pass/allocator/xcrate-use.rs new file mode 100644 index 00000000000..8b9e1e329f7 --- /dev/null +++ b/src/test/run-pass/allocator/xcrate-use.rs @@ -0,0 +1,45 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:custom.rs +// aux-build:helper.rs +// no-prefer-dynamic + +#![feature(allocator_api)] + +extern crate custom; +extern crate helper; + +use std::alloc::{Global, Alloc, System, Layout}; +use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT}; + +#[global_allocator] +static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT); + +fn main() { + unsafe { + let n = GLOBAL.0.load(Ordering::SeqCst); + let layout = Layout::from_size_align(4, 2).unwrap(); + + let ptr = Global.alloc(layout.clone()).unwrap(); + helper::work_with(&ptr); + assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1); + Global.dealloc(ptr, layout.clone()); + assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2); + + let ptr = System.alloc(layout.clone()).unwrap(); + assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2); + helper::work_with(&ptr); + System.dealloc(ptr, layout); + assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2); + } +} diff --git a/src/test/run-pass/allocator/xcrate-use2.rs b/src/test/run-pass/allocator/xcrate-use2.rs new file mode 100644 index 00000000000..2e52f28d311 --- /dev/null +++ b/src/test/run-pass/allocator/xcrate-use2.rs @@ -0,0 +1,58 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:custom.rs +// aux-build:custom-as-global.rs +// aux-build:helper.rs +// no-prefer-dynamic + +#![feature(allocator_api)] + +extern crate custom; +extern crate custom_as_global; +extern crate helper; + +use std::alloc::{alloc, dealloc, GlobalAlloc, System, Layout}; +use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT}; + +static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT); + +fn main() { + unsafe { + let n = custom_as_global::get(); + let layout = Layout::from_size_align(4, 2).unwrap(); + + // Global allocator routes to the `custom_as_global` global + let ptr = alloc(layout.clone()); + helper::work_with(&ptr); + assert_eq!(custom_as_global::get(), n + 1); + dealloc(ptr, layout.clone()); + assert_eq!(custom_as_global::get(), n + 2); + + // Usage of the system allocator avoids all globals + let ptr = System.alloc(layout.clone()); + helper::work_with(&ptr); + assert_eq!(custom_as_global::get(), n + 2); + System.dealloc(ptr, layout.clone()); + assert_eq!(custom_as_global::get(), n + 2); + + // Usage of our personal allocator doesn't affect other instances + let ptr = GLOBAL.alloc(layout.clone()); + helper::work_with(&ptr); + assert_eq!(custom_as_global::get(), n + 2); + assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 1); + GLOBAL.dealloc(ptr, layout); + assert_eq!(custom_as_global::get(), n + 2); + assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 2); + } +} + diff --git a/src/test/run-pass/array-slice-vec/arr_cycle.rs b/src/test/run-pass/array-slice-vec/arr_cycle.rs new file mode 100644 index 00000000000..4029a270c8d --- /dev/null +++ b/src/test/run-pass/array-slice-vec/arr_cycle.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::cell::Cell; + +#[derive(Debug)] +struct B<'a> { + a: [Cell>>; 2] +} + +impl<'a> B<'a> { + fn new() -> B<'a> { + B { a: [Cell::new(None), Cell::new(None)] } + } +} + +fn f() { + let (b1, b2, b3); + b1 = B::new(); + b2 = B::new(); + b3 = B::new(); + b1.a[0].set(Some(&b2)); + b1.a[1].set(Some(&b3)); + b2.a[0].set(Some(&b2)); + b2.a[1].set(Some(&b3)); + b3.a[0].set(Some(&b1)); + b3.a[1].set(Some(&b2)); +} + +fn main() { + f(); +} diff --git a/src/test/run-pass/array-slice-vec/array_const_index-1.rs b/src/test/run-pass/array-slice-vec/array_const_index-1.rs new file mode 100644 index 00000000000..c026a47c4f9 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/array_const_index-1.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(const_indexing)] + +fn main() { + const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47]; + const IDX: usize = 3; + const VAL: i32 = ARR[IDX]; + const BLUB: [i32; (ARR[0] - 41) as usize] = [5]; +} diff --git a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs new file mode 100644 index 00000000000..5d6cc5f686e --- /dev/null +++ b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-1.rs @@ -0,0 +1,57 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +// Test that we cleanup a fixed size Box<[D; k]> properly when D has a +// destructor. + +// ignore-emscripten no threads support + +use std::thread; +use std::sync::atomic::{AtomicUsize, Ordering}; + +static LOG: AtomicUsize = AtomicUsize::new(0); + +struct D(u8); + +impl Drop for D { + fn drop(&mut self) { + println!("Dropping {}", self.0); + let old = LOG.load(Ordering::SeqCst); + LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst); + } +} + +fn main() { + fn die() -> D { panic!("Oh no"); } + let g = thread::spawn(|| { + let _b1: Box<[D; 4]> = Box::new([D( 1), D( 2), D( 3), D( 4)]); + let _b2: Box<[D; 4]> = Box::new([D( 5), D( 6), D( 7), D( 8)]); + let _b3: Box<[D; 4]> = Box::new([D( 9), D(10), die(), D(12)]); + let _b4: Box<[D; 4]> = Box::new([D(13), D(14), D(15), D(16)]); + }); + assert!(g.join().is_err()); + + // When the panic occurs, we will be in the midst of constructing + // the input to `_b3`. Therefore, we drop the elements of the + // partially filled array first, before we get around to dropping + // the elements of `_b1` and _b2`. + + // Issue 23222: The order in which the elements actually get + // dropped is a little funky. See similar notes in nested-vec-3; + // in essence, I would not be surprised if we change the ordering + // given in `expect` in the future. + + let expect = 0x__A_9__5_6_7_8__1_2_3_4; + let actual = LOG.load(Ordering::SeqCst); + assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual); +} diff --git a/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs new file mode 100644 index 00000000000..d2dedc4602a --- /dev/null +++ b/src/test/run-pass/array-slice-vec/box-of-array-of-drop-2.rs @@ -0,0 +1,57 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +// Test that we cleanup dynamic sized Box<[D]> properly when D has a +// destructor. + +// ignore-emscripten no threads support + +use std::thread; +use std::sync::atomic::{AtomicUsize, Ordering}; + +static LOG: AtomicUsize = AtomicUsize::new(0); + +struct D(u8); + +impl Drop for D { + fn drop(&mut self) { + println!("Dropping {}", self.0); + let old = LOG.load(Ordering::SeqCst); + LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst); + } +} + +fn main() { + fn die() -> D { panic!("Oh no"); } + let g = thread::spawn(|| { + let _b1: Box<[D; 4]> = Box::new([D( 1), D( 2), D( 3), D( 4)]); + let _b2: Box<[D; 4]> = Box::new([D( 5), D( 6), D( 7), D( 8)]); + let _b3: Box<[D; 4]> = Box::new([D( 9), D(10), die(), D(12)]); + let _b4: Box<[D; 4]> = Box::new([D(13), D(14), D(15), D(16)]); + }); + assert!(g.join().is_err()); + + // When the panic occurs, we will be in the midst of constructing + // the input to `_b3`. Therefore, we drop the elements of the + // partially filled array first, before we get around to dropping + // the elements of `_b1` and _b2`. + + // Issue 23222: The order in which the elements actually get + // dropped is a little funky. See similar notes in nested-vec-3; + // in essence, I would not be surprised if we change the ordering + // given in `expect` in the future. + + let expect = 0x__A_9__5_6_7_8__1_2_3_4; + let actual = LOG.load(Ordering::SeqCst); + assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual); +} diff --git a/src/test/run-pass/array-slice-vec/cast-in-array-size.rs b/src/test/run-pass/array-slice-vec/cast-in-array-size.rs new file mode 100644 index 00000000000..d78bc0b0072 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/cast-in-array-size.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +// issues #10618 and #16382 +// pretty-expanded FIXME #23616 + +const SIZE: isize = 25; + +fn main() { + let _a: [bool; 1 as usize]; + let _b: [isize; SIZE as usize] = [1; SIZE as usize]; + let _c: [bool; '\n' as usize] = [true; '\n' as usize]; + let _d: [bool; true as usize] = [true; true as usize]; +} diff --git a/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs b/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs new file mode 100644 index 00000000000..3d2fc8195eb --- /dev/null +++ b/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Checks that mutable static items can have mutable slices + + +static mut TEST: &'static mut [isize] = &mut [1]; +static mut EMPTY: &'static mut [isize] = &mut []; + +pub fn main() { + unsafe { + TEST[0] += 1; + assert_eq!(TEST[0], 2); + } +} diff --git a/src/test/run-pass/array-slice-vec/check-static-slice.rs b/src/test/run-pass/array-slice-vec/check-static-slice.rs new file mode 100644 index 00000000000..6627095c32b --- /dev/null +++ b/src/test/run-pass/array-slice-vec/check-static-slice.rs @@ -0,0 +1,46 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Check that the various ways of getting to a reference to a vec (both sized +// and unsized) work properly. + + +const AA: [isize; 3] = [1, 2, 3]; +const AB: &'static [isize; 3] = &AA; +const AC: &'static [isize] = AB; +const AD: &'static [isize] = &AA; +const AE: &'static [isize; 3] = &[1, 2, 3]; +const AF: &'static [isize] = &[1, 2, 3]; + +static CA: isize = AA[0]; +static CB: isize = AB[1]; +static CC: isize = AC[2]; +static CD: isize = AD[0]; +static CE: isize = AE[1]; +static CF: isize = AF[2]; + +static AG: &'static isize = &AA[2]; + +fn main () { + let b: &[isize] = &[1, 2, 3]; + assert_eq!(AC, b); + assert_eq!(AD, b); + assert_eq!(AF, b); + assert_eq!(*AG, 3); + + assert_eq!(CA, 1); + assert_eq!(CB, 2); + assert_eq!(CC, 3); + assert_eq!(CD, 1); + assert_eq!(CE, 2); + assert_eq!(CF, 3); +} diff --git a/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs b/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs new file mode 100644 index 00000000000..917683e4eeb --- /dev/null +++ b/src/test/run-pass/array-slice-vec/copy-out-of-array-1.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Ensure that we can copy out of a fixed-size array. +// +// (Compare with compile-fail/move-out-of-array-1.rs) + +#[derive(Copy, Clone)] +struct C { _x: u8 } + +fn main() { + fn d() -> C { C { _x: 0 } } + + let _d1 = foo([d(), d(), d(), d()], 1); + let _d3 = foo([d(), d(), d(), d()], 3); +} + +fn foo(a: [C; 4], i: usize) -> C { + a[i] +} diff --git a/src/test/run-pass/array-slice-vec/destructure-array-1.rs b/src/test/run-pass/array-slice-vec/destructure-array-1.rs new file mode 100644 index 00000000000..17620f62be6 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/destructure-array-1.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Ensure that we can do a destructuring bind of a fixed-size array, +// even when the element type has a destructor. + +struct D { x: u8 } + +impl Drop for D { fn drop(&mut self) { } } + +fn main() { + fn d(x: u8) -> D { D { x: x } } + + let d1 = foo([d(1), d(2), d(3), d(4)], 1); + let d3 = foo([d(5), d(6), d(7), d(8)], 3); + assert_eq!(d1.x, 2); + assert_eq!(d3.x, 8); +} + +fn foo([a, b, c, d]: [D; 4], i: usize) -> D { + match i { + 0 => a, + 1 => b, + 2 => c, + 3 => d, + _ => panic!("unmatched"), + } +} diff --git a/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs b/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs new file mode 100644 index 00000000000..7411d574321 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/empty-mutable-vec.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +#![allow(unused_mut)] + + +pub fn main() { let mut _v: Vec = Vec::new(); } diff --git a/src/test/run-pass/array-slice-vec/estr-slice.rs b/src/test/run-pass/array-slice-vec/estr-slice.rs new file mode 100644 index 00000000000..768229aafbf --- /dev/null +++ b/src/test/run-pass/array-slice-vec/estr-slice.rs @@ -0,0 +1,60 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let x = "hello"; + let v = "hello"; + let y : &str = "there"; + + println!("{}", x); + println!("{}", y); + + assert_eq!(x.as_bytes()[0], 'h' as u8); + assert_eq!(x.as_bytes()[4], 'o' as u8); + + let z : &str = "thing"; + assert_eq!(v, x); + assert!(x != z); + + let a = "aaaa"; + let b = "bbbb"; + + let c = "cccc"; + let cc = "ccccc"; + + println!("{}", a); + + assert!(a < b); + assert!(a <= b); + assert!(a != b); + assert!(b >= a); + assert!(b > a); + + println!("{}", b); + + assert!(a < c); + assert!(a <= c); + assert!(a != c); + assert!(c >= a); + assert!(c > a); + + println!("{}", c); + + assert!(c < cc); + assert!(c <= cc); + assert!(c != cc); + assert!(cc >= c); + assert!(cc > c); + + println!("{}", cc); +} diff --git a/src/test/run-pass/array-slice-vec/evec-slice.rs b/src/test/run-pass/array-slice-vec/evec-slice.rs new file mode 100644 index 00000000000..7f54801910b --- /dev/null +++ b/src/test/run-pass/array-slice-vec/evec-slice.rs @@ -0,0 +1,56 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x : &[isize] = &[1,2,3,4,5]; + let mut z : &[isize] = &[1,2,3,4,5]; + z = x; + assert_eq!(z[0], 1); + assert_eq!(z[4], 5); + + let a : &[isize] = &[1,1,1,1,1]; + let b : &[isize] = &[2,2,2,2,2]; + let c : &[isize] = &[2,2,2,2,3]; + let cc : &[isize] = &[2,2,2,2,2,2]; + + println!("{:?}", a); + + assert!(a < b); + assert!(a <= b); + assert!(a != b); + assert!(b >= a); + assert!(b > a); + + println!("{:?}", b); + + assert!(b < c); + assert!(b <= c); + assert!(b != c); + assert!(c >= b); + assert!(c > b); + + assert!(a < c); + assert!(a <= c); + assert!(a != c); + assert!(c >= a); + assert!(c > a); + + println!("{:?}", c); + + assert!(a < cc); + assert!(a <= cc); + assert!(a != cc); + assert!(cc >= a); + assert!(cc > a); + + println!("{:?}", cc); +} diff --git a/src/test/run-pass/array-slice-vec/fixed_length_copy.rs b/src/test/run-pass/array-slice-vec/fixed_length_copy.rs new file mode 100644 index 00000000000..09492e37e28 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/fixed_length_copy.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let arr = [1,2,3]; + let arr2 = arr; + assert_eq!(arr[1], 2); + assert_eq!(arr2[2], 3); +} diff --git a/src/test/run-pass/array-slice-vec/huge-largest-array.rs b/src/test/run-pass/array-slice-vec/huge-largest-array.rs new file mode 100644 index 00000000000..27b4e68e771 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/huge-largest-array.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +use std::mem::size_of; + +#[cfg(target_pointer_width = "32")] +pub fn main() { + assert_eq!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1); +} + +#[cfg(target_pointer_width = "64")] +pub fn main() { + assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1); +} diff --git a/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs b/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs new file mode 100644 index 00000000000..2f3efef5636 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/ivec-pass-by-value.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn f(_a: Vec ) { } +pub fn main() { f(vec![1, 2, 3, 4, 5]); } diff --git a/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs b/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs new file mode 100644 index 00000000000..49dc348952b --- /dev/null +++ b/src/test/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn test1() { + let mut ints = [0; 32]; + ints[0] += 1; + assert_eq!(ints[0], 1); +} + +fn test2() { + let mut ints = [0; 32]; + for i in &mut ints { *i += 22; } + for i in &ints { assert_eq!(*i, 22); } +} + +pub fn main() { + test1(); + test2(); +} diff --git a/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs b/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs new file mode 100644 index 00000000000..dc2548ad53c --- /dev/null +++ b/src/test/run-pass/array-slice-vec/mutable-alias-vec.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn grow(v: &mut Vec ) { + v.push(1); +} + +pub fn main() { + let mut v: Vec = Vec::new(); + grow(&mut v); + grow(&mut v); + grow(&mut v); + let len = v.len(); + println!("{}", len); + assert_eq!(len, 3 as usize); +} diff --git a/src/test/run-pass/array-slice-vec/nested-vec-1.rs b/src/test/run-pass/array-slice-vec/nested-vec-1.rs new file mode 100644 index 00000000000..62bcc5f7254 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/nested-vec-1.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that using the `vec!` macro nested within itself works + +fn main() { + let nested = vec![vec![1u32, 2u32, 3u32]]; + assert_eq!(nested[0][1], 2); +} diff --git a/src/test/run-pass/array-slice-vec/nested-vec-2.rs b/src/test/run-pass/array-slice-vec/nested-vec-2.rs new file mode 100644 index 00000000000..4af2350cc36 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/nested-vec-2.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that using the `vec!` macro nested within itself works +// when the contents implement Drop + +struct D(u32); + +impl Drop for D { + fn drop(&mut self) { println!("Dropping {}", self.0); } +} + +fn main() { + let nested = vec![vec![D(1u32), D(2u32), D(3u32)]]; + assert_eq!(nested[0][1].0, 2); +} diff --git a/src/test/run-pass/array-slice-vec/nested-vec-3.rs b/src/test/run-pass/array-slice-vec/nested-vec-3.rs new file mode 100644 index 00000000000..dc3146a2b35 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/nested-vec-3.rs @@ -0,0 +1,64 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +// ignore-emscripten no threads support + +// Test that using the `vec!` macro nested within itself works when +// the contents implement Drop and we hit a panic in the middle of +// construction. + +use std::thread; +use std::sync::atomic::{AtomicUsize, Ordering}; + +static LOG: AtomicUsize = AtomicUsize::new(0); + +struct D(u8); + +impl Drop for D { + fn drop(&mut self) { + println!("Dropping {}", self.0); + let old = LOG.load(Ordering::SeqCst); + LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst); + } +} + +fn main() { + fn die() -> D { panic!("Oh no"); } + let g = thread::spawn(|| { + let _nested = vec![vec![D( 1), D( 2), D( 3), D( 4)], + vec![D( 5), D( 6), D( 7), D( 8)], + vec![D( 9), D(10), die(), D(12)], + vec![D(13), D(14), D(15), D(16)]]; + }); + assert!(g.join().is_err()); + + // When the panic occurs, we will be in the midst of constructing the + // second inner vector. Therefore, we drop the elements of the + // partially filled vector first, before we get around to dropping + // the elements of the filled vector. + + // Issue 23222: The order in which the elements actually get + // dropped is a little funky: as noted above, we'll drop the 9+10 + // first, but due to #23222, they get dropped in reverse + // order. Likewise, again due to #23222, we will drop the second + // filled vec before the first filled vec. + // + // If Issue 23222 is "fixed", then presumably the corrected + // expected order of events will be 0x__9_A__1_2_3_4__5_6_7_8; + // that is, we would still drop 9+10 first, since they belong to + // the more deeply nested expression when the panic occurs. + + let expect = 0x__A_9__5_6_7_8__1_2_3_4; + let actual = LOG.load(Ordering::SeqCst); + assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual); +} diff --git a/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs b/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs new file mode 100644 index 00000000000..268fa5c4b59 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/new-style-fixed-length-vec.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +static FOO: [isize; 3] = [1, 2, 3]; + +pub fn main() { + println!("{} {} {}", FOO[0], FOO[1], FOO[2]); +} diff --git a/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs b/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs new file mode 100644 index 00000000000..76302b92ed0 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(non_camel_case_types)] + +trait sum { + fn sum_(self) -> isize; +} + +// Note: impl on a slice +impl<'a> sum for &'a [isize] { + fn sum_(self) -> isize { + self.iter().fold(0, |a, &b| a + b) + } +} + +fn call_sum(x: &[isize]) -> isize { x.sum_() } + +pub fn main() { + let x = vec![1, 2, 3]; + let y = call_sum(&x); + println!("y=={}", y); + assert_eq!(y, 6); + + let x = vec![1, 2, 3]; + let y = x.sum_(); + println!("y=={}", y); + assert_eq!(y, 6); + + let x = vec![1, 2, 3]; + let y = x.sum_(); + println!("y=={}", y); + assert_eq!(y, 6); +} diff --git a/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs b/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs new file mode 100644 index 00000000000..d706be4c336 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/repeated-vector-syntax.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = [ [true]; 512 ]; + let y = [ 0; 1 ]; + + print!("["); + for xi in &x[..] { + print!("{:?}, ", &xi[..]); + } + println!("]"); + println!("{:?}", &y[..]); +} diff --git a/src/test/run-pass/array-slice-vec/show-boxed-slice.rs b/src/test/run-pass/array-slice-vec/show-boxed-slice.rs new file mode 100644 index 00000000000..dda4ce9f227 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/show-boxed-slice.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(Debug)] +struct Foo(Box<[u8]>); + +pub fn main() { + println!("{:?}", Foo(Box::new([0, 1, 2]))); +} diff --git a/src/test/run-pass/array-slice-vec/slice-2.rs b/src/test/run-pass/array-slice-vec/slice-2.rs new file mode 100644 index 00000000000..1f71ceac04f --- /dev/null +++ b/src/test/run-pass/array-slice-vec/slice-2.rs @@ -0,0 +1,72 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test slicing expressions on slices and Vecs. + + +fn main() { + let x: &[isize] = &[1, 2, 3, 4, 5]; + let cmp: &[isize] = &[1, 2, 3, 4, 5]; + assert_eq!(&x[..], cmp); + let cmp: &[isize] = &[3, 4, 5]; + assert_eq!(&x[2..], cmp); + let cmp: &[isize] = &[1, 2, 3]; + assert_eq!(&x[..3], cmp); + let cmp: &[isize] = &[2, 3, 4]; + assert_eq!(&x[1..4], cmp); + + let x: Vec = vec![1, 2, 3, 4, 5]; + let cmp: &[isize] = &[1, 2, 3, 4, 5]; + assert_eq!(&x[..], cmp); + let cmp: &[isize] = &[3, 4, 5]; + assert_eq!(&x[2..], cmp); + let cmp: &[isize] = &[1, 2, 3]; + assert_eq!(&x[..3], cmp); + let cmp: &[isize] = &[2, 3, 4]; + assert_eq!(&x[1..4], cmp); + + let x: &mut [isize] = &mut [1, 2, 3, 4, 5]; + { + let cmp: &mut [isize] = &mut [1, 2, 3, 4, 5]; + assert_eq!(&mut x[..], cmp); + } + { + let cmp: &mut [isize] = &mut [3, 4, 5]; + assert_eq!(&mut x[2..], cmp); + } + { + let cmp: &mut [isize] = &mut [1, 2, 3]; + assert_eq!(&mut x[..3], cmp); + } + { + let cmp: &mut [isize] = &mut [2, 3, 4]; + assert_eq!(&mut x[1..4], cmp); + } + + let mut x: Vec = vec![1, 2, 3, 4, 5]; + { + let cmp: &mut [isize] = &mut [1, 2, 3, 4, 5]; + assert_eq!(&mut x[..], cmp); + } + { + let cmp: &mut [isize] = &mut [3, 4, 5]; + assert_eq!(&mut x[2..], cmp); + } + { + let cmp: &mut [isize] = &mut [1, 2, 3]; + assert_eq!(&mut x[..3], cmp); + } + { + let cmp: &mut [isize] = &mut [2, 3, 4]; + assert_eq!(&mut x[1..4], cmp); + } +} diff --git a/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs b/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs new file mode 100644 index 00000000000..671246f6a63 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/slice-of-zero-size-elements.rs @@ -0,0 +1,63 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// compile-flags: -C debug-assertions + +#![feature(iter_to_slice)] + +use std::slice; + +fn foo(v: &[T]) -> Option<&[T]> { + let mut it = v.iter(); + for _ in 0..5 { + let _ = it.next(); + } + Some(it.as_slice()) +} + +fn foo_mut(v: &mut [T]) -> Option<&mut [T]> { + let mut it = v.iter_mut(); + for _ in 0..5 { + let _ = it.next(); + } + Some(it.into_slice()) +} + +pub fn main() { + // In a slice of zero-size elements the pointer is meaningless. + // Ensure iteration still works even if the pointer is at the end of the address space. + let slice: &[()] = unsafe { slice::from_raw_parts(-5isize as *const (), 10) }; + assert_eq!(slice.len(), 10); + assert_eq!(slice.iter().count(), 10); + + // .nth() on the iterator should also behave correctly + let mut it = slice.iter(); + assert!(it.nth(5).is_some()); + assert_eq!(it.count(), 4); + + // Converting Iter to a slice should never have a null pointer + assert!(foo(slice).is_some()); + + // Test mutable iterators as well + let slice: &mut [()] = unsafe { slice::from_raw_parts_mut(-5isize as *mut (), 10) }; + assert_eq!(slice.len(), 10); + assert_eq!(slice.iter_mut().count(), 10); + + { + let mut it = slice.iter_mut(); + assert!(it.nth(5).is_some()); + assert_eq!(it.count(), 4); + } + + assert!(foo_mut(slice).is_some()) +} diff --git a/src/test/run-pass/array-slice-vec/slice-panic-1.rs b/src/test/run-pass/array-slice-vec/slice-panic-1.rs new file mode 100644 index 00000000000..b9d816acaa2 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/slice-panic-1.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-emscripten no threads support + +// Test that if a slicing expr[..] fails, the correct cleanups happen. + + +use std::thread; + +struct Foo; + +static mut DTOR_COUNT: isize = 0; + +impl Drop for Foo { + fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } } +} + +fn foo() { + let x: &[_] = &[Foo, Foo]; + &x[3..4]; +} + +fn main() { + let _ = thread::spawn(move|| foo()).join(); + unsafe { assert_eq!(DTOR_COUNT, 2); } +} diff --git a/src/test/run-pass/array-slice-vec/slice-panic-2.rs b/src/test/run-pass/array-slice-vec/slice-panic-2.rs new file mode 100644 index 00000000000..787d10b042f --- /dev/null +++ b/src/test/run-pass/array-slice-vec/slice-panic-2.rs @@ -0,0 +1,40 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-emscripten no threads support + +// Test that if a slicing expr[..] fails, the correct cleanups happen. + + +use std::thread; + +struct Foo; + +static mut DTOR_COUNT: isize = 0; + +impl Drop for Foo { + fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } } +} + +fn bar() -> usize { + panic!(); +} + +fn foo() { + let x: &[_] = &[Foo, Foo]; + &x[3..bar()]; +} + +fn main() { + let _ = thread::spawn(move|| foo()).join(); + unsafe { assert_eq!(DTOR_COUNT, 2); } +} diff --git a/src/test/run-pass/array-slice-vec/slice.rs b/src/test/run-pass/array-slice-vec/slice.rs new file mode 100644 index 00000000000..6c43d883230 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/slice.rs @@ -0,0 +1,90 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test slicing sugar. + +extern crate core; +use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull}; + +static mut COUNT: usize = 0; + +struct Foo; + +impl Index> for Foo { + type Output = Foo; + fn index(&self, index: Range) -> &Foo { + unsafe { COUNT += 1; } + self + } +} +impl Index> for Foo { + type Output = Foo; + fn index(&self, index: RangeTo) -> &Foo { + unsafe { COUNT += 1; } + self + } +} +impl Index> for Foo { + type Output = Foo; + fn index(&self, index: RangeFrom) -> &Foo { + unsafe { COUNT += 1; } + self + } +} +impl Index for Foo { + type Output = Foo; + fn index(&self, _index: RangeFull) -> &Foo { + unsafe { COUNT += 1; } + self + } +} + +impl IndexMut> for Foo { + fn index_mut(&mut self, index: Range) -> &mut Foo { + unsafe { COUNT += 1; } + self + } +} +impl IndexMut> for Foo { + fn index_mut(&mut self, index: RangeTo) -> &mut Foo { + unsafe { COUNT += 1; } + self + } +} +impl IndexMut> for Foo { + fn index_mut(&mut self, index: RangeFrom) -> &mut Foo { + unsafe { COUNT += 1; } + self + } +} +impl IndexMut for Foo { + fn index_mut(&mut self, _index: RangeFull) -> &mut Foo { + unsafe { COUNT += 1; } + self + } +} + + +fn main() { + let mut x = Foo; + &x[..]; + &x[Foo..]; + &x[..Foo]; + &x[Foo..Foo]; + &mut x[..]; + &mut x[Foo..]; + &mut x[..Foo]; + &mut x[Foo..Foo]; + unsafe { + assert_eq!(COUNT, 8); + } +} diff --git a/src/test/run-pass/array-slice-vec/slice_binary_search.rs b/src/test/run-pass/array-slice-vec/slice_binary_search.rs new file mode 100644 index 00000000000..081b06bea5c --- /dev/null +++ b/src/test/run-pass/array-slice-vec/slice_binary_search.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test binary_search_by_key lifetime. Issue #34683 + +#[derive(Debug)] +struct Assignment { + topic: String, + partition: i32, +} + +fn main() { + let xs = vec![ + Assignment { topic: "abc".into(), partition: 1 }, + Assignment { topic: "def".into(), partition: 2 }, + Assignment { topic: "ghi".into(), partition: 3 }, + ]; + + let key: &str = "def"; + let r = xs.binary_search_by_key(&key, |e| &e.topic); + assert_eq!(Ok(1), r.map(|i| i)); +} diff --git a/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs b/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs new file mode 100644 index 00000000000..5cf52006f3c --- /dev/null +++ b/src/test/run-pass/array-slice-vec/variance-vec-covariant.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that vec is now covariant in its argument type. + +#![allow(dead_code)] + +fn foo<'a,'b>(v1: Vec<&'a i32>, v2: Vec<&'b i32>) -> i32 { + bar(v1, v2).cloned().unwrap_or(0) // only type checks if we can intersect 'a and 'b +} + +fn bar<'c>(v1: Vec<&'c i32>, v2: Vec<&'c i32>) -> Option<&'c i32> { + v1.get(0).cloned().or_else(|| v2.get(0).cloned()) +} + +fn main() { + let x = 22; + let y = 44; + assert_eq!(foo(vec![&x], vec![&y]), 22); + assert_eq!(foo(vec![&y], vec![&x]), 44); +} diff --git a/src/test/run-pass/array-slice-vec/vec-concat.rs b/src/test/run-pass/array-slice-vec/vec-concat.rs new file mode 100644 index 00000000000..7c734d8d6a2 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-concat.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::vec; + +pub fn main() { + let a: Vec = vec![1, 2, 3, 4, 5]; + let b: Vec = vec![6, 7, 8, 9, 0]; + let mut v: Vec = a; + v.extend_from_slice(&b); + println!("{}", v[9]); + assert_eq!(v[0], 1); + assert_eq!(v[7], 8); + assert_eq!(v[9], 0); +} diff --git a/src/test/run-pass/array-slice-vec/vec-dst.rs b/src/test/run-pass/array-slice-vec/vec-dst.rs new file mode 100644 index 00000000000..6421b69d22e --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-dst.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(box_syntax)] + +pub fn main() { + // Tests for indexing into box/& [T; n] + let x: [isize; 3] = [1, 2, 3]; + let mut x: Box<[isize; 3]> = box x; + assert_eq!(x[0], 1); + assert_eq!(x[1], 2); + assert_eq!(x[2], 3); + x[1] = 45; + assert_eq!(x[0], 1); + assert_eq!(x[1], 45); + assert_eq!(x[2], 3); + + let mut x: [isize; 3] = [1, 2, 3]; + let x: &mut [isize; 3] = &mut x; + assert_eq!(x[0], 1); + assert_eq!(x[1], 2); + assert_eq!(x[2], 3); + x[1] = 45; + assert_eq!(x[0], 1); + assert_eq!(x[1], 45); + assert_eq!(x[2], 3); +} diff --git a/src/test/run-pass/array-slice-vec/vec-fixed-length.rs b/src/test/run-pass/array-slice-vec/vec-fixed-length.rs new file mode 100644 index 00000000000..a7b86794132 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-fixed-length.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +use std::mem::size_of; + +#[cfg(not(target_pointer_width = "64"))] +fn test_big_vec() {} + +#[cfg(target_pointer_width = "64")] +fn test_big_vec() +{ + assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32)); +} + +fn main() { + let x: [isize; 4] = [1, 2, 3, 4]; + assert_eq!(x[0], 1); + assert_eq!(x[1], 2); + assert_eq!(x[2], 3); + assert_eq!(x[3], 4); + + assert_eq!(size_of::<[u8; 4]>(), 4); + test_big_vec(); +} diff --git a/src/test/run-pass/array-slice-vec/vec-growth.rs b/src/test/run-pass/array-slice-vec/vec-growth.rs new file mode 100644 index 00000000000..e783a799c05 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-growth.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let mut v = vec![1]; + v.push(2); + v.push(3); + v.push(4); + v.push(5); + assert_eq!(v[0], 1); + assert_eq!(v[1], 2); + assert_eq!(v[2], 3); + assert_eq!(v[3], 4); + assert_eq!(v[4], 5); +} diff --git a/src/test/run-pass/array-slice-vec/vec-late-init.rs b/src/test/run-pass/array-slice-vec/vec-late-init.rs new file mode 100644 index 00000000000..dc7241a0e05 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-late-init.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let mut later: Vec ; + if true { later = vec![1]; } else { later = vec![2]; } + println!("{}", later[0]); +} diff --git a/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs new file mode 100644 index 00000000000..509167413b6 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-macro-no-std.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-emscripten no no_std executables + +#![feature(lang_items, start, libc, alloc)] +#![no_std] + +extern crate std as other; + +extern crate libc; + +#[macro_use] +extern crate alloc; + +use alloc::vec::Vec; + +// Issue #16806 + +#[start] +fn start(_argc: isize, _argv: *const *const u8) -> isize { + let x: Vec = vec![0, 1, 2]; + match x.last() { + Some(&2) => (), + _ => panic!(), + } + 0 +} diff --git a/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs b/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs new file mode 100644 index 00000000000..36c8b7cffab --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-macro-repeat.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + assert_eq!(vec![1; 3], vec![1, 1, 1]); + assert_eq!(vec![1; 2], vec![1, 1]); + assert_eq!(vec![1; 1], vec![1]); + assert_eq!(vec![1; 0], vec![]); + + // from_elem syntax (see RFC 832) + let el = Box::new(1); + let n = 3; + assert_eq!(vec![el; n], vec![Box::new(1), Box::new(1), Box::new(1)]); +} diff --git a/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs b/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs new file mode 100644 index 00000000000..8ccf22e6288 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn one() -> i32 { 1 } + +// Make sure the vec![...] macro doesn't introduce hidden rvalue +// scopes (such as blocks) around the element expressions. +pub fn main() { + assert_eq!(vec![&one(), &one(), &2], vec![&1, &1, &(one()+one())]); + assert_eq!(vec![&one(); 2], vec![&1, &one()]); +} diff --git a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs new file mode 100644 index 00000000000..b5d1459300a --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +macro_rules! vec [ + ($($e:expr),*) => ({ + let mut _temp = ::std::vec::Vec::new(); + $(_temp.push($e);)* + _temp + }) +]; + +pub fn main() { + let my_vec = vec![1, 2, 3, 4, 5]; +} diff --git a/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs b/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs new file mode 100644 index 00000000000..046d634b19d --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + assert_eq!(vec![1], vec![1,]); + assert_eq!(vec![1, 2, 3], vec![1, 2, 3,]); +} diff --git a/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs b/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs new file mode 100644 index 00000000000..b5cefb48ce7 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-matching-autoslice.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 + +pub fn main() { + let x = [1, 2, 3]; + match x { + [2, _, _] => panic!(), + [1, a, b] => { + assert_eq!([a, b], [2, 3]); + } + [_, _, _] => panic!(), + } + + let y = ([(1, true), (2, false)], 0.5f64); + match y { + ([(1, a), (b, false)], _) => { + assert_eq!(a, true); + assert_eq!(b, 2); + } + ([_, _], 0.5) => panic!(), + ([_, _], _) => panic!(), + } +} diff --git a/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs b/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs new file mode 100644 index 00000000000..7bfecdd2c7f --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-matching-fixed.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(slice_patterns)] + +fn a() { + let x = [1, 2, 3]; + match x { + [1, 2, 4] => unreachable!(), + [0, 2, 3, ..] => unreachable!(), + [0, .., 3] => unreachable!(), + [0, ..] => unreachable!(), + [1, 2, 3] => (), + [_, _, _] => unreachable!(), + } + match x { + [..] => (), + } + match x { + [_, _, _, ..] => (), + } + match x { + [a, b, c] => { + assert_eq!(1, a); + assert_eq!(2, b); + assert_eq!(3, c); + } + } +} + +pub fn main() { + a(); +} diff --git a/src/test/run-pass/array-slice-vec/vec-matching-fold.rs b/src/test/run-pass/array-slice-vec/vec-matching-fold.rs new file mode 100644 index 00000000000..b1aa7f1b70c --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-matching-fold.rs @@ -0,0 +1,58 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(slice_patterns)] + +use std::fmt::Debug; + +fn foldl(values: &[T], + initial: U, + mut function: F) + -> U where + U: Clone+Debug, T:Debug, + F: FnMut(U, &T) -> U, +{ match values { + &[ref head, ref tail..] => + foldl(tail, function(initial, head), function), + &[] => { + // FIXME: call guards + let res = initial.clone(); res + } + } +} + +fn foldr(values: &[T], + initial: U, + mut function: F) + -> U where + U: Clone, + F: FnMut(&T, U) -> U, +{ + match values { + &[ref head.., ref tail] => + foldr(head, function(tail, initial), function), + &[] => { + // FIXME: call guards + let res = initial.clone(); res + } + } +} + +pub fn main() { + let x = &[1, 2, 3, 4, 5]; + + let product = foldl(x, 1, |a, b| a * *b); + assert_eq!(product, 120); + + let sum = foldr(x, 0, |a, b| *a + b); + assert_eq!(sum, 15); +} diff --git a/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs b/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs new file mode 100644 index 00000000000..e727e56c0f8 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(slice_patterns)] + +pub fn main() { + let x = &[1, 2, 3, 4, 5]; + let x: &[isize] = &[1, 2, 3, 4, 5]; + if !x.is_empty() { + let el = match x { + &[1, ref tail..] => &tail[0], + _ => unreachable!() + }; + println!("{}", *el); + } +} diff --git a/src/test/run-pass/array-slice-vec/vec-matching.rs b/src/test/run-pass/array-slice-vec/vec-matching.rs new file mode 100644 index 00000000000..8d1ef6f755a --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-matching.rs @@ -0,0 +1,169 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(slice_patterns)] + +fn a() { + let x = [1]; + match x { + [a] => { + assert_eq!(a, 1); + } + } +} + +fn b() { + let x = [1, 2, 3]; + match x { + [a, b, c..] => { + assert_eq!(a, 1); + assert_eq!(b, 2); + let expected: &[_] = &[3]; + assert_eq!(c, expected); + } + } + match x { + [a.., b, c] => { + let expected: &[_] = &[1]; + assert_eq!(a, expected); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + [a, b.., c] => { + assert_eq!(a, 1); + let expected: &[_] = &[2]; + assert_eq!(b, expected); + assert_eq!(c, 3); + } + } + match x { + [a, b, c] => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } +} + + +fn b_slice() { + let x : &[_] = &[1, 2, 3]; + match x { + &[a, b, ref c..] => { + assert_eq!(a, 1); + assert_eq!(b, 2); + let expected: &[_] = &[3]; + assert_eq!(c, expected); + } + _ => unreachable!() + } + match x { + &[ref a.., b, c] => { + let expected: &[_] = &[1]; + assert_eq!(a, expected); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + _ => unreachable!() + } + match x { + &[a, ref b.., c] => { + assert_eq!(a, 1); + let expected: &[_] = &[2]; + assert_eq!(b, expected); + assert_eq!(c, 3); + } + _ => unreachable!() + } + match x { + &[a, b, c] => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + _ => unreachable!() + } +} + +fn c() { + let x = [1]; + match x { + [2, ..] => panic!(), + [..] => () + } +} + +fn d() { + let x = [1, 2, 3]; + let branch = match x { + [1, 1, ..] => 0, + [1, 2, 3, ..] => 1, + [1, 2, ..] => 2, + _ => 3 + }; + assert_eq!(branch, 1); +} + +fn e() { + let x: &[isize] = &[1, 2, 3]; + let a = match *x { + [1, 2] => 0, + [..] => 1, + }; + + assert_eq!(a, 1); + + let b = match *x { + [2, ..] => 0, + [1, 2, ..] => 1, + [_] => 2, + [..] => 3 + }; + + assert_eq!(b, 1); + + + let c = match *x { + [_, _, _, _, ..] => 0, + [1, 2, ..] => 1, + [_] => 2, + [..] => 3 + }; + + assert_eq!(c, 1); +} + +fn f() { + let x = &[1, 2, 3, 4, 5]; + let [a, [b, [c, ..].., d].., e] = *x; + assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5)); + + let x: &[isize] = x; + let (a, b, c, d, e) = match *x { + [a, [b, [c, ..].., d].., e] => (a, b, c, d, e), + _ => unimplemented!() + }; + + assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5)); +} + +pub fn main() { + a(); + b(); + b_slice(); + c(); + d(); + e(); + f(); +} diff --git a/src/test/run-pass/array-slice-vec/vec-push.rs b/src/test/run-pass/array-slice-vec/vec-push.rs new file mode 100644 index 00000000000..360568048c0 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-push.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { let mut v = vec![1, 2, 3]; v.push(1); } diff --git a/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs b/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs new file mode 100644 index 00000000000..650de32fe61 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-repeat-with-cast.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +pub fn main() { let _a = [0; 1 as usize]; } diff --git a/src/test/run-pass/array-slice-vec/vec-slice-drop.rs b/src/test/run-pass/array-slice-vec/vec-slice-drop.rs new file mode 100644 index 00000000000..189d5a38ae3 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-slice-drop.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// Make sure that destructors get run on slice literals +struct foo<'a> { + x: &'a Cell, +} + +impl<'a> Drop for foo<'a> { + fn drop(&mut self) { + self.x.set(self.x.get() + 1); + } +} + +fn foo(x: &Cell) -> foo { + foo { + x: x + } +} + +pub fn main() { + let x = &Cell::new(0); + { + let l = &[foo(x)]; + assert_eq!(l[0].x.get(), 0); + } + assert_eq!(x.get(), 1); +} diff --git a/src/test/run-pass/array-slice-vec/vec-slice.rs b/src/test/run-pass/array-slice-vec/vec-slice.rs new file mode 100644 index 00000000000..8ad662f0c63 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-slice.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let v = vec![1,2,3,4,5]; + let v2 = &v[1..3]; + assert_eq!(v2[0], 2); + assert_eq!(v2[1], 3); +} diff --git a/src/test/run-pass/array-slice-vec/vec-tail-matching.rs b/src/test/run-pass/array-slice-vec/vec-tail-matching.rs new file mode 100644 index 00000000000..46a882a2ae1 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-tail-matching.rs @@ -0,0 +1,46 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(slice_patterns)] + +struct Foo { + string: &'static str +} + +pub fn main() { + let x = [ + Foo { string: "foo" }, + Foo { string: "bar" }, + Foo { string: "baz" } + ]; + match x { + [ref first, ref tail..] => { + assert_eq!(first.string, "foo"); + assert_eq!(tail.len(), 2); + assert_eq!(tail[0].string, "bar"); + assert_eq!(tail[1].string, "baz"); + + match *(tail as &[_]) { + [Foo { .. }, _, Foo { .. }, ref _tail..] => { + unreachable!(); + } + [Foo { string: ref a }, Foo { string: ref b }] => { + assert_eq!("bar", &a[0..a.len()]); + assert_eq!("baz", &b[0..b.len()]); + } + _ => { + unreachable!(); + } + } + } + } +} diff --git a/src/test/run-pass/array-slice-vec/vec-to_str.rs b/src/test/run-pass/array-slice-vec/vec-to_str.rs new file mode 100644 index 00000000000..4facc0e6892 --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec-to_str.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + assert_eq!(format!("{:?}", vec![0, 1]), "[0, 1]".to_string()); + + let foo = vec![3, 4]; + let bar: &[isize] = &[4, 5]; + + assert_eq!(format!("{:?}", foo), "[3, 4]"); + assert_eq!(format!("{:?}", bar), "[4, 5]"); +} diff --git a/src/test/run-pass/array-slice-vec/vec.rs b/src/test/run-pass/array-slice-vec/vec.rs new file mode 100644 index 00000000000..34a8e125a5c --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let v: Vec = vec![10, 20]; + assert_eq!(v[0], 10); + assert_eq!(v[1], 20); + let mut x: usize = 0; + assert_eq!(v[x], 10); + assert_eq!(v[x + 1], 20); + x = x + 1; + assert_eq!(v[x], 20); + assert_eq!(v[x - 1], 10); +} diff --git a/src/test/run-pass/array-slice-vec/vec_cycle.rs b/src/test/run-pass/array-slice-vec/vec_cycle.rs new file mode 100644 index 00000000000..3222b0e789d --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec_cycle.rs @@ -0,0 +1,49 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::cell::Cell; + +#[derive(Debug)] +struct C<'a> { + v: Vec>>>, +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { v: Vec::new() } + } +} + +fn f() { + let (mut c1, mut c2, mut c3); + c1 = C::new(); + c2 = C::new(); + c3 = C::new(); + + c1.v.push(Cell::new(None)); + c1.v.push(Cell::new(None)); + c2.v.push(Cell::new(None)); + c2.v.push(Cell::new(None)); + c3.v.push(Cell::new(None)); + c3.v.push(Cell::new(None)); + + c1.v[0].set(Some(&c2)); + c1.v[1].set(Some(&c3)); + c2.v[0].set(Some(&c2)); + c2.v[1].set(Some(&c3)); + c3.v[0].set(Some(&c1)); + c3.v[1].set(Some(&c2)); +} + +fn main() { + f(); +} diff --git a/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs b/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs new file mode 100644 index 00000000000..355f9d3e40e --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vec_cycle_wrapped.rs @@ -0,0 +1,60 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::cell::Cell; + +#[derive(Debug)] +struct Refs<'a> { + v: Vec>>>, +} + +#[derive(Debug)] +struct C<'a> { + refs: Refs<'a>, +} + +impl<'a> Refs<'a> { + fn new() -> Refs<'a> { + Refs { v: Vec::new() } + } +} + +impl<'a> C<'a> { + fn new() -> C<'a> { + C { refs: Refs::new() } + } +} + +fn f() { + let (mut c1, mut c2, mut c3); + c1 = C::new(); + c2 = C::new(); + c3 = C::new(); + + c1.refs.v.push(Cell::new(None)); + c1.refs.v.push(Cell::new(None)); + c2.refs.v.push(Cell::new(None)); + c2.refs.v.push(Cell::new(None)); + c3.refs.v.push(Cell::new(None)); + c3.refs.v.push(Cell::new(None)); + + c1.refs.v[0].set(Some(&c2)); + c1.refs.v[1].set(Some(&c3)); + c2.refs.v[0].set(Some(&c2)); + c2.refs.v[1].set(Some(&c3)); + c3.refs.v[0].set(Some(&c1)); + c3.refs.v[1].set(Some(&c2)); +} + +fn main() { + f(); +} diff --git a/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs b/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs new file mode 100644 index 00000000000..0b09545c0aa --- /dev/null +++ b/src/test/run-pass/array-slice-vec/vector-no-ann-2.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { let _quux: Box> = box Vec::new(); } diff --git a/src/test/run-pass/associated-consts/associated-const-const-eval.rs b/src/test/run-pass/associated-consts/associated-const-const-eval.rs new file mode 100644 index 00000000000..3ef8e6c2478 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-const-eval.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + const NUM: usize; +} + +impl Foo for i32 { + const NUM: usize = 1; +} + +const FOO: usize = ::NUM; + +fn main() { + assert_eq!(1, FOO); + + match 1 { + ::NUM => {}, + _ => assert!(false) + } +} diff --git a/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs b/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs new file mode 100644 index 00000000000..c0f1d93c253 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:associated-const-cc-lib.rs + + +extern crate associated_const_cc_lib as foolib; + +pub struct LocalFoo; + +impl foolib::Foo for LocalFoo { + const BAR: usize = 1; +} + +const FOO_1: usize = ::BAR; +const FOO_2: usize = ::BAR; +const FOO_3: usize = foolib::InherentBar::BAR; + +fn main() { + assert_eq!(0, FOO_1); + assert_eq!(1, FOO_2); + assert_eq!(3, FOO_3); + + match 0 { + ::BAR => {}, + ::BAR => assert!(false), + foolib::InherentBar::BAR => assert!(false), + _ => assert!(false) + } +} diff --git a/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs b/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs new file mode 100644 index 00000000000..7d85c7021ab --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-cross-crate-defaults.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:associated-const-cc-lib.rs + + +extern crate associated_const_cc_lib as foolib; + +pub struct LocalFooUseDefault; + +impl foolib::FooDefault for LocalFooUseDefault {} + +pub struct LocalFooOverwriteDefault; + +impl foolib::FooDefault for LocalFooOverwriteDefault { + const BAR: usize = 4; +} + +fn main() { + assert_eq!(1, ::BAR); + assert_eq!(2, ::BAR); + assert_eq!(1, ::BAR); + assert_eq!(4, ::BAR); +} diff --git a/src/test/run-pass/associated-consts/associated-const-cross-crate.rs b/src/test/run-pass/associated-consts/associated-const-cross-crate.rs new file mode 100644 index 00000000000..0f1bde4b4db --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-cross-crate.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:associated-const-cc-lib.rs + + +extern crate associated_const_cc_lib as foolib; + +pub struct LocalFoo; + +impl foolib::Foo for LocalFoo { + const BAR: usize = 1; +} + +fn main() { + assert_eq!(0, ::BAR); + assert_eq!(1, ::BAR); + assert_eq!(3, foolib::InherentBar::BAR); +} diff --git a/src/test/run-pass/associated-consts/associated-const-in-global-const.rs b/src/test/run-pass/associated-consts/associated-const-in-global-const.rs new file mode 100644 index 00000000000..089bf07b9c7 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-in-global-const.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo; + +impl Foo { + const BAR: f32 = 1.5; +} + +const FOOBAR: f32 = ::BAR; + +fn main() { + assert_eq!(1.5f32, FOOBAR); +} diff --git a/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs b/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs new file mode 100644 index 00000000000..60b794015f9 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-inherent-impl.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo; + +impl Foo { + const ID: i32 = 1; +} + +fn main() { + assert_eq!(1, Foo::ID); +} diff --git a/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs b/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs new file mode 100644 index 00000000000..de9edfc679e --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-marks-live-code.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![deny(dead_code)] + +const GLOBAL_BAR: u32 = 1; + +struct Foo; + +impl Foo { + const BAR: u32 = GLOBAL_BAR; +} + +pub fn main() { + let _: u32 = Foo::BAR; +} diff --git a/src/test/run-pass/associated-consts/associated-const-match-patterns.rs b/src/test/run-pass/associated-consts/associated-const-match-patterns.rs new file mode 100644 index 00000000000..9fbce1cebf3 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-match-patterns.rs @@ -0,0 +1,78 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:empty-struct.rs + + +extern crate empty_struct; +use empty_struct::XEmpty2 as XFoo; + +struct Foo; + +#[derive(PartialEq, Eq)] +enum Bar { + Var1, + Var2, +} + +// Use inherent and trait impls to test UFCS syntax. +impl Foo { + const MYBAR: Bar = Bar::Var2; +} + +trait HasBar { + const THEBAR: Bar; +} + +impl HasBar for Foo { + const THEBAR: Bar = Bar::Var1; +} + +impl HasBar for XFoo { + const THEBAR: Bar = Bar::Var1; +} + +fn main() { + // Inherent impl + assert!(match Bar::Var2 { + Foo::MYBAR => true, + _ => false, + }); + assert!(match Bar::Var2 { + ::MYBAR => true, + _ => false, + }); + // Trait impl + assert!(match Bar::Var1 { + Foo::THEBAR => true, + _ => false, + }); + assert!(match Bar::Var1 { + ::THEBAR => true, + _ => false, + }); + assert!(match Bar::Var1 { + ::THEBAR => true, + _ => false, + }); + assert!(match Bar::Var1 { + XFoo::THEBAR => true, + _ => false, + }); + assert!(match Bar::Var1 { + ::THEBAR => true, + _ => false, + }); + assert!(match Bar::Var1 { + ::THEBAR => true, + _ => false, + }); +} diff --git a/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs b/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs new file mode 100644 index 00000000000..c62e073a6a7 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-outer-ty-refs.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Lattice { + const BOTTOM: Self; +} + +impl Lattice for Option { + const BOTTOM: Option = None; +} + +fn main(){} diff --git a/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs b/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs new file mode 100644 index 00000000000..0e225d7117e --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-overwrite-default.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + const ID: i32 = 2; +} + +impl Foo for i32 { + const ID: i32 = 1; +} + +fn main() { + assert_eq!(1, ::ID); +} diff --git a/src/test/run-pass/associated-consts/associated-const-public-impl.rs b/src/test/run-pass/associated-consts/associated-const-public-impl.rs new file mode 100644 index 00000000000..8c11ae69ded --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-public-impl.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod bar1 { + pub use self::bar2::Foo; + mod bar2 { + pub struct Foo; + + impl Foo { + pub const ID: i32 = 1; + } + } +} + +fn main() { + assert_eq!(1, bar1::Foo::ID); +} diff --git a/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs b/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs new file mode 100644 index 00000000000..eeff2775323 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo; + +trait HasNum { + const NUM: isize; +} +impl HasNum for Foo { + const NUM: isize = 1; +} + +fn main() { + assert!(match 2 { + Foo::NUM ... 3 => true, + _ => false, + }); + assert!(match 0 { + -1 ... ::NUM => true, + _ => false, + }); + assert!(match 1 { + ::NUM ... ::NUM => true, + _ => false, + }); +} diff --git a/src/test/run-pass/associated-consts/associated-const-resolution-order.rs b/src/test/run-pass/associated-consts/associated-const-resolution-order.rs new file mode 100644 index 00000000000..ed02644c6a1 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-resolution-order.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct MyType; + +impl MyType { + const IMPL_IS_INHERENT: bool = true; +} + +trait MyTrait { + const IMPL_IS_INHERENT: bool; + const IMPL_IS_ON_TRAIT: bool; +} + +impl MyTrait for MyType { + const IMPL_IS_INHERENT: bool = false; + const IMPL_IS_ON_TRAIT: bool = true; +} + +fn main() { + // Check that the inherent impl is used before the trait, but that the trait + // can still be accessed. + assert!(::IMPL_IS_INHERENT); + assert!(!::IMPL_IS_INHERENT); + assert!(::IMPL_IS_ON_TRAIT); +} diff --git a/src/test/run-pass/associated-consts/associated-const-self-type.rs b/src/test/run-pass/associated-consts/associated-const-self-type.rs new file mode 100644 index 00000000000..52d9574edde --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-self-type.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait MyInt { + const ONE: Self; +} + +impl MyInt for i32 { + const ONE: i32 = 1; +} + +fn main() { + assert_eq!(1, ::ONE); +} diff --git a/src/test/run-pass/associated-consts/associated-const-type-parameters.rs b/src/test/run-pass/associated-consts/associated-const-type-parameters.rs new file mode 100644 index 00000000000..37407b6bf9f --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-type-parameters.rs @@ -0,0 +1,54 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + const X: i32; + fn get_x() -> i32 { + Self::X + } +} + +struct Abc; +impl Foo for Abc { + const X: i32 = 11; +} + +struct Def; +impl Foo for Def { + const X: i32 = 97; +} + +struct Proxy(T); + +impl Foo for Proxy { + const X: i32 = T::X; +} + +fn sub() -> i32 { + A::X - B::X +} + +trait Bar: Foo { + const Y: i32 = Self::X; +} + +fn main() { + assert_eq!(11, Abc::X); + assert_eq!(97, Def::X); + assert_eq!(11, Abc::get_x()); + assert_eq!(97, Def::get_x()); + assert_eq!(-86, sub::()); + assert_eq!(86, sub::()); + assert_eq!(-86, sub::, Def>()); + assert_eq!(-86, sub::>()); + assert_eq!(86, sub::, Proxy>()); +} diff --git a/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs b/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs new file mode 100644 index 00000000000..6269222fb8e --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + const ID: i32; +} + +impl Foo for i32 { + const ID: i32 = 1; +} + +fn main() { + assert_eq!(1, ::ID); +} diff --git a/src/test/run-pass/associated-consts/associated-const-use-default.rs b/src/test/run-pass/associated-consts/associated-const-use-default.rs new file mode 100644 index 00000000000..623949b2418 --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-use-default.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + const ID: i32 = 1; +} + +impl Foo for i32 {} + +fn main() { + assert_eq!(1, ::ID); +} diff --git a/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs b/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs new file mode 100644 index 00000000000..80848e5653f --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// The main purpose of this test is to ensure that different impls of the same +// trait can refer to each other without setting off the static recursion check +// (as long as there's no actual recursion). + +trait Foo { + const BAR: u32; +} + +struct IsFoo1; + +impl Foo for IsFoo1 { + const BAR: u32 = 1; +} + +struct IsFoo2; + +impl Foo for IsFoo2 { + const BAR: u32 = ::BAR; +} + +fn main() { + assert_eq!(::BAR, ::BAR); +} diff --git a/src/test/run-pass/associated-consts/associated-const.rs b/src/test/run-pass/associated-consts/associated-const.rs new file mode 100644 index 00000000000..c20025c385a --- /dev/null +++ b/src/test/run-pass/associated-consts/associated-const.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + const ID: i32; +} + +impl Foo for i32 { + const ID: i32 = 1; +} + +fn main() { + assert_eq!(1, ::ID); +} diff --git a/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs b/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs new file mode 100644 index 00000000000..e4cada40db3 --- /dev/null +++ b/src/test/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +#![crate_type="lib"] + +// These items are for testing that associated consts work cross-crate. +pub trait Foo { + const BAR: usize; +} + +pub struct FooNoDefault; + +impl Foo for FooNoDefault { + const BAR: usize = 0; +} + +// These test that defaults and default resolution work cross-crate. +pub trait FooDefault { + const BAR: usize = 1; +} + +pub struct FooOverwriteDefault; + +impl FooDefault for FooOverwriteDefault { + const BAR: usize = 2; +} + +pub struct FooUseDefault; + +impl FooDefault for FooUseDefault {} + +// Test inherent impls. +pub struct InherentBar; + +impl InherentBar { + pub const BAR: usize = 3; +} diff --git a/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs b/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs new file mode 100644 index 00000000000..734e57a774d --- /dev/null +++ b/src/test/run-pass/associated-consts/auxiliary/empty-struct.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct XEmpty1 {} +pub struct XEmpty2; +pub struct XEmpty7(); + +pub enum XE { + XEmpty3 {}, + XEmpty4, + XEmpty6(), +} diff --git a/src/test/run-pass/associated-types/associated-types-basic.rs b/src/test/run-pass/associated-types/associated-types-basic.rs new file mode 100644 index 00000000000..3628f9ce183 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-basic.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + type T; +} + +impl Foo for i32 { + type T = isize; +} + +fn main() { + let x: ::T = 22; + let y: isize = 44; + assert_eq!(x * 2, y); +} diff --git a/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs b/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs new file mode 100644 index 00000000000..63ac60e62d9 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-binding-in-trait.rs @@ -0,0 +1,46 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a case where the associated type binding (to `bool`, in this +// case) is derived from the trait definition. Issue #21636. + + +use std::vec; + +pub trait BitIter { + type Iter: Iterator; + fn bit_iter(self) -> ::Iter; +} + +impl BitIter for Vec { + type Iter = vec::IntoIter; + fn bit_iter(self) -> ::Iter { + self.into_iter() + } +} + +fn count(arg: T) -> usize + where T: BitIter +{ + let mut sum = 0; + for i in arg.bit_iter() { + if i { + sum += 1; + } + } + sum +} + +fn main() { + let v = vec![true, false, true]; + let c = count(v); + assert_eq!(c, 2); +} diff --git a/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs new file mode 100644 index 00000000000..7b735520efb --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-binding-in-where-clause.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test equality constraints on associated types in a where clause. + +// pretty-expanded FIXME #23616 + +pub trait Foo { + type A; + fn boo(&self) -> ::A; +} + +#[derive(PartialEq)] +pub struct Bar; + +impl Foo for isize { + type A = usize; + fn boo(&self) -> usize { 42 } +} + +impl Foo for char { + type A = Bar; + fn boo(&self) -> Bar { Bar } +} + +fn foo_bar>(x: I) -> Bar { + x.boo() +} + +fn foo_uint>(x: I) -> usize { + x.boo() +} + +pub fn main() { + let a = 42; + foo_uint(a); + + let a = 'a'; + foo_bar(a); +} diff --git a/src/test/run-pass/associated-types/associated-types-bound.rs b/src/test/run-pass/associated-types/associated-types-bound.rs new file mode 100644 index 00000000000..56ce378da65 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-bound.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test equality constrai32s on associated types in a where clause. + + +pub trait ToI32 { + fn to_i32(&self) -> i32; +} + +impl ToI32 for i32 { + fn to_i32(&self) -> i32 { *self } +} + +impl ToI32 for u32 { + fn to_i32(&self) -> i32 { *self as i32 } +} + +pub trait GetToI32 +{ + type R : ToI32; + + fn get(&self) -> ::R; +} + +impl GetToI32 for i32 { + type R = i32; + fn get(&self) -> i32 { *self } +} + +impl GetToI32 for u32 { + type R = u32; + fn get(&self) -> u32 { *self } +} + +fn foo(g: G) -> i32 + where G : GetToI32 +{ + ToI32::to_i32(&g.get()) +} + +pub fn main() { + assert_eq!(foo(22i32), 22); + assert_eq!(foo(22u32), 22); +} diff --git a/src/test/run-pass/associated-types/associated-types-cc.rs b/src/test/run-pass/associated-types/associated-types-cc.rs new file mode 100644 index 00000000000..a8c7caa9361 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-cc.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:associated-types-cc-lib.rs + +// Test that we are able to reference cross-crate traits that employ +// associated types. + +extern crate associated_types_cc_lib as bar; + +use bar::Bar; + +fn foo(b: B) -> ::T { + Bar::get(None::) +} + +fn main() { + println!("{}", foo(3)); +} diff --git a/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs b/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs new file mode 100644 index 00000000000..a795ee2c5ef --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-conditional-dispatch.rs @@ -0,0 +1,76 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we evaluate projection predicates to winnow out +// candidates during trait selection and method resolution (#20296). +// If we don't properly winnow out candidates based on the output type +// `Target=[A]`, then the impl marked with `(*)` is seen to conflict +// with all the others. + +// pretty-expanded FIXME #23616 + +use std::marker::PhantomData; +use std::ops::Deref; + +pub trait MyEq { + fn eq(&self, u: &U) -> bool; +} + +impl MyEq<[B]> for [A] + where A : MyEq +{ + fn eq(&self, other: &[B]) -> bool { + self.len() == other.len() && + self.iter().zip(other).all(|(a, b)| MyEq::eq(a, b)) + } +} + +// (*) This impl conflicts with everything unless the `Target=[A]` +// constraint is considered. +impl<'a, A, B, Lhs> MyEq<[B; 0]> for Lhs + where A: MyEq, Lhs: Deref +{ + fn eq(&self, other: &[B; 0]) -> bool { + MyEq::eq(&**self, other) + } +} + +struct DerefWithHelper { + pub helper: H, + pub marker: PhantomData, +} + +trait Helper { + fn helper_borrow(&self) -> &T; +} + +impl Helper for Option { + fn helper_borrow(&self) -> &T { + self.as_ref().unwrap() + } +} + +impl> Deref for DerefWithHelper { + type Target = T; + + fn deref(&self) -> &T { + self.helper.helper_borrow() + } +} + +pub fn check(x: T, y: T) -> bool { + let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), + marker: PhantomData }; + d.eq(&y) +} + +pub fn main() { +} diff --git a/src/test/run-pass/associated-types/associated-types-constant-type.rs b/src/test/run-pass/associated-types/associated-types-constant-type.rs new file mode 100644 index 00000000000..3581a6c4388 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-constant-type.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait SignedUnsigned { + type Opposite; + fn convert(self) -> Self::Opposite; +} + +impl SignedUnsigned for isize { + type Opposite = usize; + + fn convert(self) -> usize { + self as usize + } +} + +impl SignedUnsigned for usize { + type Opposite = isize; + + fn convert(self) -> isize { + self as isize + } +} + +fn get(x: isize) -> ::Opposite { + x.convert() +} + +fn main() { + let x = get(22); + assert_eq!(22, x); +} diff --git a/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs b/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs new file mode 100644 index 00000000000..4b8ceda9b81 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-doubleendediterator-object.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn pairwise_sub(mut t: Box>) -> isize { + let mut result = 0; + loop { + let front = t.next(); + let back = t.next_back(); + match (front, back) { + (Some(f), Some(b)) => { result += b - f; } + _ => { return result; } + } + } +} + +fn main() { + let v = vec![1, 2, 3, 4, 5, 6]; + let r = pairwise_sub(Box::new(v.into_iter())); + assert_eq!(r, 9); +} diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs new file mode 100644 index 00000000000..e6175dc34ec --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that we do not report ambiguities when equivalent predicates +// (modulo bound lifetime names) appears in the environment +// twice. Issue #21965. + +// pretty-expanded FIXME #23616 + +fn foo(t: T) -> i32 + where T : for<'a> Fn(&'a u8) -> i32, + T : for<'b> Fn(&'b u8) -> i32, +{ + t(&3) +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs new file mode 100644 index 00000000000..6836d2860b5 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that we do not report ambiguities when the same predicate +// appears in the environment twice. Issue #21965. + +// pretty-expanded FIXME #23616 + +trait Foo { + type B; + + fn get() -> Self::B; +} + +fn foo() -> () + where T : Foo, T : Foo +{ + ::get() +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types/associated-types-enum-field-named.rs b/src/test/run-pass/associated-types/associated-types-enum-field-named.rs new file mode 100644 index 00000000000..d21195c3d3a --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-enum-field-named.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test associated types appearing in struct-like enum variants. + + +use self::VarValue::*; + +pub trait UnifyKey { + type Value; + fn to_index(&self) -> usize; +} + +pub enum VarValue { + Redirect { to: K }, + Root { value: K::Value, rank: usize }, +} + +fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { + match table[key.to_index()] { + VarValue::Redirect { to: ref k } => get(table, k), + VarValue::Root { value: ref v, rank: _ } => v, + } +} + +impl UnifyKey for usize { + type Value = Option; + fn to_index(&self) -> usize { *self } +} + +fn main() { + let table = vec![/* 0 */ Redirect { to: 1 }, + /* 1 */ Redirect { to: 3 }, + /* 2 */ Root { value: Some('x'), rank: 0 }, + /* 3 */ Redirect { to: 2 }]; + assert_eq!(get(&table, &0), &Some('x')); +} diff --git a/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs b/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs new file mode 100644 index 00000000000..9a91a998201 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-enum-field-numbered.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test associated types appearing in tuple-like enum variants. + + +use self::VarValue::*; + +pub trait UnifyKey { + type Value; + fn to_index(&self) -> usize; +} + +pub enum VarValue { + Redirect(K), + Root(K::Value, usize), +} + +fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { + match table[key.to_index()] { + VarValue::Redirect(ref k) => get(table, k), + VarValue::Root(ref v, _) => v, + } +} + +impl UnifyKey for usize { + type Value = Option; + fn to_index(&self) -> usize { *self } +} + +fn main() { + let table = vec![/* 0 */ Redirect(1), + /* 1 */ Redirect(3), + /* 2 */ Root(Some('x'), 0), + /* 3 */ Redirect(2)]; + assert_eq!(get(&table, &0), &Some('x')); +} diff --git a/src/test/run-pass/associated-types/associated-types-eq-obj.rs b/src/test/run-pass/associated-types/associated-types-eq-obj.rs new file mode 100644 index 00000000000..75fe2093da9 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-eq-obj.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test equality constraints on associated types inside of an object type + +// pretty-expanded FIXME #23616 + +pub trait Foo { + type A; + fn boo(&self) -> ::A; +} + +pub struct Bar; + +impl Foo for char { + type A = Bar; + fn boo(&self) -> Bar { Bar } +} + +fn baz(x: &Foo) -> Bar { + x.boo() +} + +pub fn main() { + let a = 'a'; + baz(&a); +} diff --git a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs new file mode 100644 index 00000000000..aca76748925 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs @@ -0,0 +1,58 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test how resolving a projection interacts with inference. In this +// case, we were eagerly unifying the type variable for the iterator +// type with `I` from the where clause, ignoring the in-scope `impl` +// for `ByRef`. The right answer was to consider the result ambiguous +// until more type information was available. + +#![feature(lang_items)] +#![no_implicit_prelude] + +use std::marker::Sized; +use std::option::Option::{None, Some, self}; + +trait Iterator { + type Item; + + fn next(&mut self) -> Option; +} + +trait IteratorExt: Iterator + Sized { + fn by_ref(&mut self) -> ByRef { + ByRef(self) + } +} + +impl IteratorExt for I where I: Iterator {} + +struct ByRef<'a, I: 'a + Iterator>(&'a mut I); + +impl<'a, I: Iterator> Iterator for ByRef<'a, I> { + type Item = I::Item; + + fn next(&mut self) -> Option< ::Item > { + self.0.next() + } +} + +fn is_iterator_of>(_: &I) {} + +fn test>(mut it: I) { + is_iterator_of::(&it.by_ref()); +} + +fn test2, I2: Iterator>(mut it: I2) { + is_iterator_of::(&it) +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs b/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs new file mode 100644 index 00000000000..a80350a596e --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-in-bound-type-arg.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test the case where we resolve `C::Result` and the trait bound +// itself includes a `Self::Item` shorthand. +// +// Regression test for issue #33425. + +trait ParallelIterator { + type Item; + fn drive_unindexed(self, consumer: C) -> C::Result + where C: Consumer; +} + +pub trait Consumer { + type Result; +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-in-default-method.rs b/src/test/run-pass/associated-types/associated-types-in-default-method.rs new file mode 100644 index 00000000000..846dfcd2141 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-in-default-method.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Get { + type Value; + fn get(&self) -> &::Value; + fn grab(&self) -> &::Value { + self.get() + } +} + +struct Struct { + x: isize, +} + +impl Get for Struct { + type Value = isize; + fn get(&self) -> &isize { + &self.x + } +} + +fn main() { + let s = Struct { + x: 100, + }; + assert_eq!(*s.grab(), 100); +} diff --git a/src/test/run-pass/associated-types/associated-types-in-fn.rs b/src/test/run-pass/associated-types/associated-types-in-fn.rs new file mode 100644 index 00000000000..555c74dd70a --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-in-fn.rs @@ -0,0 +1,38 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Get { + type Value; + fn get(&self) -> &::Value; +} + +struct Struct { + x: isize, +} + +impl Get for Struct { + type Value = isize; + fn get(&self) -> &isize { + &self.x + } +} + +fn grab(x: &T) -> &::Value { + x.get() +} + +fn main() { + let s = Struct { + x: 100, + }; + assert_eq!(*grab(&s), 100); +} diff --git a/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs b/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs new file mode 100644 index 00000000000..d27c1dd296e --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-in-impl-generics.rs @@ -0,0 +1,46 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Get { + type Value; + fn get(&self) -> &::Value; +} + +struct Struct { + x: isize, +} + +impl Get for Struct { + type Value = isize; + fn get(&self) -> &isize { + &self.x + } +} + +trait Grab { + type U; + fn grab(&self) -> &::U; +} + +impl Grab for T { + type U = ::Value; + fn grab(&self) -> &::Value { + self.get() + } +} + +fn main() { + let s = Struct { + x: 100, + }; + assert_eq!(*s.grab(), 100); +} diff --git a/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs b/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs new file mode 100644 index 00000000000..f68ab8cd610 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-in-inherent-method.rs @@ -0,0 +1,40 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Get { + type Value; + fn get(&self) -> &::Value; +} + +struct Struct { + x: isize, +} + +impl Get for Struct { + type Value = isize; + fn get(&self) -> &isize { + &self.x + } +} + +impl Struct { + fn grab(x: &T) -> &::Value { + x.get() + } +} + +fn main() { + let s = Struct { + x: 100, + }; + assert_eq!(*Struct::grab(&s), 100); +} diff --git a/src/test/run-pass/associated-types/associated-types-issue-20220.rs b/src/test/run-pass/associated-types/associated-types-issue-20220.rs new file mode 100644 index 00000000000..e2a87382fba --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-issue-20220.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test references to `Self::Item` in the trait. Issue #20220. + + +use std::vec; + +trait IntoIteratorX { + type Item; + type IntoIter: Iterator; + + fn into_iter_x(self) -> Self::IntoIter; +} + +impl IntoIteratorX for Vec { + type Item = T; + type IntoIter = vec::IntoIter; + + fn into_iter_x(self) -> vec::IntoIter { + self.into_iter() + } +} + +fn main() { + let vec = vec![1, 2, 3]; + for (i, e) in vec.into_iter().enumerate() { + assert_eq!(i+1, e); + } +} diff --git a/src/test/run-pass/associated-types/associated-types-issue-20371.rs b/src/test/run-pass/associated-types/associated-types-issue-20371.rs new file mode 100644 index 00000000000..54f1d2e8126 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-issue-20371.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to have an impl that defines an associated type +// before the actual trait. + +// pretty-expanded FIXME #23616 + +impl X for f64 { type Y = isize; } +trait X { type Y; } +fn main() {} diff --git a/src/test/run-pass/associated-types/associated-types-issue-21212.rs b/src/test/run-pass/associated-types/associated-types-issue-21212.rs new file mode 100644 index 00000000000..259661dc058 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-issue-21212.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #21212: an overflow occurred during trait +// checking where normalizing `Self::Input` led to normalizing the +// where clauses in the environment which in turn required normalizing +// `Self::Input`. + + +pub trait Parser { + type Input; + + fn parse(input: ::Input) { + panic!() + } +} + +impl

Parser for P { + type Input = (); +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types/associated-types-iterator-binding.rs b/src/test/run-pass/associated-types/associated-types-iterator-binding.rs new file mode 100644 index 00000000000..eab66a94129 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-iterator-binding.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn pairwise_sub>(mut t: T) -> isize { + let mut result = 0; + loop { + let front = t.next(); + let back = t.next_back(); + match (front, back) { + (Some(f), Some(b)) => { result += b - f; } + _ => { return result; } + } + } +} + +fn main() { + let v = vec![1, 2, 3, 4, 5, 6]; + let r = pairwise_sub(v.into_iter()); + assert_eq!(r, 9); +} diff --git a/src/test/run-pass/associated-types/associated-types-method.rs b/src/test/run-pass/associated-types/associated-types-method.rs new file mode 100644 index 00000000000..73d075313ad --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-method.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that methods whose impl-trait-ref contains associated types +// are supported. + +trait Device { + type Resources; +} +struct Foo(D, R); + +trait Tr { + fn present(&self) {} +} + +impl Tr for Foo { + fn present(&self) {} +} + +struct Res; +struct Dev; +impl Device for Dev { + type Resources = Res; +} + +fn main() { + let foo = Foo(Dev, Res); + foo.present(); +} diff --git a/src/test/run-pass/associated-types/associated-types-nested-projections.rs b/src/test/run-pass/associated-types/associated-types-nested-projections.rs new file mode 100644 index 00000000000..a877a3cfa9d --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-nested-projections.rs @@ -0,0 +1,53 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can resolve nested projection types. Issue #20666. + +// pretty-expanded FIXME #23616 + +use std::slice; + +trait Bound {} + +impl<'a> Bound for &'a i32 {} + +trait IntoIterator { + type Iter: Iterator; + + fn into_iter(self) -> Self::Iter; +} + +impl<'a, T> IntoIterator for &'a [T; 3] { + type Iter = slice::Iter<'a, T>; + + fn into_iter(self) -> slice::Iter<'a, T> { + self.iter() + } +} + +fn foo(x: X) where + X: IntoIterator, + <::Iter as Iterator>::Item: Bound, +{ +} + +fn bar(x: X) where + T: Bound, + I: Iterator, + X: IntoIterator, +{ + +} + +fn main() { + foo(&[0, 1, 2]); + bar(&[0, 1, 2]); +} diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs new file mode 100644 index 00000000000..d989e08e808 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we normalize associated types that appear in a bound that +// contains a binding. Issue #21664. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +pub trait Integral { + type Opposite; +} + +impl Integral for i32 { + type Opposite = u32; +} + +impl Integral for u32 { + type Opposite = i32; +} + +pub trait FnLike { + type R; + + fn dummy(&self, a: A) -> Self::R { loop { } } +} + +fn foo() + where T : FnLike<::Opposite, R=bool> +{ + bar::(); +} + +fn bar() + where T : FnLike +{} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs new file mode 100644 index 00000000000..3d3540bbf72 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we normalize associated types that appear in bounds; if +// we didn't, the call to `self.split2()` fails to type check. + +// pretty-expanded FIXME #23616 + +use std::marker::PhantomData; + +struct Splits<'a, T:'a, P>(PhantomData<(&'a T, P)>); +struct SplitsN(PhantomData); + +trait SliceExt2 { + type Item; + + fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> + where P: FnMut(&Self::Item) -> bool; + fn splitn2<'a, P>(&'a self, n: u32, pred: P) -> SplitsN> + where P: FnMut(&Self::Item) -> bool; +} + +impl SliceExt2 for [T] { + type Item = T; + + fn split2

(&self, pred: P) -> Splits where P: FnMut(&T) -> bool { + loop {} + } + + fn splitn2

(&self, n: u32, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { + SliceExt2::split2(self, pred); + loop {} + } +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs new file mode 100644 index 00000000000..79d23c3999e --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we normalize associated types that appear in bounds; if +// we didn't, the call to `self.split2()` fails to type check. + +// pretty-expanded FIXME #23616 + +use std::marker::PhantomData; + +struct Splits<'a, T, P>(PhantomData<(&'a(),T,P)>); +struct SplitsN(PhantomData); + +trait SliceExt2 { + type Item; + + fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> + where P: FnMut(&Self::Item) -> bool; + fn splitn2<'a, P>(&'a self, n: usize, pred: P) -> SplitsN> + where P: FnMut(&Self::Item) -> bool; +} + +impl SliceExt2 for [T] { + type Item = T; + + fn split2

(&self, pred: P) -> Splits where P: FnMut(&T) -> bool { + loop {} + } + + fn splitn2

(&self, n: usize, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { + self.split2(pred); + loop {} + } +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs b/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs new file mode 100644 index 00000000000..03d712b110d --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-normalize-unifield-struct.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #21010: Normalize associated types in +// various special paths in the `type_is_immediate` function. + +pub trait OffsetState: Sized {} +pub trait Offset { + type State: OffsetState; + fn dummy(&self) { } +} + +#[derive(Copy, Clone)] pub struct X; +impl Offset for X { type State = Y; } + +#[derive(Copy, Clone)] pub struct Y; +impl OffsetState for Y {} + +pub fn now() -> DateTime { from_utc(Y) } + +pub struct DateTime { pub offset: Off::State } +pub fn from_utc(offset: Off::State) -> DateTime { DateTime { offset: offset } } + +pub fn main() { + let _x = now(); +} diff --git a/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs b/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs new file mode 100644 index 00000000000..f21bbddc4dd --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs @@ -0,0 +1,108 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Various uses of `T::Item` syntax where the bound that supplies +// `Item` originates in a where-clause, not the declaration of +// `T`. Issue #20300. + +use std::marker::{PhantomData}; +use std::sync::atomic::{AtomicUsize}; +use std::sync::atomic::Ordering::SeqCst; + +static COUNTER: AtomicUsize = AtomicUsize::new(0); + +// Preamble. +trait Trait { type Item; } +struct Struct; +impl Trait for Struct { + type Item = u32; +} + +// Where-clause attached on the method which declares `T`. +struct A; +impl A { + fn foo(_x: T::Item) where T: Trait { + COUNTER.fetch_add(1, SeqCst); + } +} + +// Where-clause attached on the method to a parameter from the struct. +struct B(PhantomData); +impl B { + fn foo(_x: T::Item) where T: Trait { + COUNTER.fetch_add(10, SeqCst); + } +} + +// Where-clause attached to free fn. +fn c(_: T::Item) where T : Trait { + COUNTER.fetch_add(100, SeqCst); +} + +// Where-clause attached to defaulted and non-defaulted trait method. +trait AnotherTrait { + fn method(&self, _: T::Item) where T: Trait; + fn default_method(&self, _: T::Item) where T: Trait { + COUNTER.fetch_add(1000, SeqCst); + } +} +struct D; +impl AnotherTrait for D { + fn method(&self, _: T::Item) where T: Trait { + COUNTER.fetch_add(10000, SeqCst); + } +} + +// Where-clause attached to trait and impl containing the method. +trait YetAnotherTrait + where T : Trait +{ + fn method(&self, _: T::Item); + fn default_method(&self, _: T::Item) { + COUNTER.fetch_add(100000, SeqCst); + } +} +struct E(PhantomData); +impl YetAnotherTrait for E + where T : Trait +{ + fn method(&self, _: T::Item) { + COUNTER.fetch_add(1000000, SeqCst); + } +} + +// Where-clause attached to inherent impl containing the method. +struct F(PhantomData); +impl F where T : Trait { + fn method(&self, _: T::Item) { + COUNTER.fetch_add(10000000, SeqCst); + } +} + +// Where-clause attached to struct. +#[allow(dead_code)] +struct G where T : Trait { + data: T::Item, + phantom: PhantomData, +} + +fn main() { + A::foo::(22); + B::::foo(22); + c::(22); + D.method::(22); + D.default_method::(22); + E(PhantomData::).method(22); + E(PhantomData::).default_method(22); + F(PhantomData::).method(22); + G:: { data: 22, phantom: PhantomData }; + assert_eq!(COUNTER.load(SeqCst), 11111111); +} diff --git a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs new file mode 100644 index 00000000000..57c7f557ffa --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we correctly handle projection bounds appearing in the +// supertrait list (and in conjunction with overloaded operators). In +// this case, the `Result=Self` binding in the supertrait listing of +// `Int` was being ignored. + +trait Not { + type Result; + + fn not(self) -> Self::Result; +} + +trait Int: Not + Sized { + fn count_ones(self) -> usize; + fn count_zeros(self) -> usize { + // neither works + let x: Self = self.not(); + 0 + } +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs b/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs new file mode 100644 index 00000000000..964eb886236 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs @@ -0,0 +1,48 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test where the impl self type uses a projection from a constant type. + + +trait Int +{ + type T; + + fn dummy(&self) { } +} + +trait NonZero +{ + fn non_zero(self) -> bool; +} + +impl Int for i32 { type T = i32; } +impl Int for i64 { type T = i64; } +impl Int for u32 { type T = u32; } +impl Int for u64 { type T = u64; } + +impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } +impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } +impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } +impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } + +fn main () +{ + assert!(NonZero::non_zero(22_i32)); + assert!(NonZero::non_zero(22_i64)); + assert!(NonZero::non_zero(22_u32)); + assert!(NonZero::non_zero(22_u64)); + + assert!(!NonZero::non_zero(0_i32)); + assert!(!NonZero::non_zero(0_i64)); + assert!(!NonZero::non_zero(0_u32)); + assert!(!NonZero::non_zero(0_u64)); +} diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs new file mode 100644 index 00000000000..8b98325598c --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs @@ -0,0 +1,48 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Corrected regression test for #20831. The original did not compile. +// When fixed, it revealed another problem concerning projections that +// appear in associated type bindings in object types, which were not +// being properly flagged. + +// pretty-expanded FIXME #23616 + +use std::ops::{Shl, Shr}; +use std::cell::RefCell; + +pub trait Subscriber { + type Input; + + fn dummy(&self) { } +} + +pub trait Publisher<'a> { + type Output; + fn subscribe(&mut self, _: Box + 'a>); +} + +pub trait Processor<'a> : Subscriber + Publisher<'a> { } + +impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } + +struct MyStruct<'a> { + sub: Box + 'a> +} + +impl<'a> Publisher<'a> for MyStruct<'a> { + type Output = u64; + fn subscribe(&mut self, t : Box + 'a>) { + self.sub = t; + } +} + +fn main() {} diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs b/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs new file mode 100644 index 00000000000..001faef7f48 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs @@ -0,0 +1,54 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are handle to correctly handle a projection type +// that appears in a supertrait bound. Issue #20559. + + +trait A +{ + type TA; + + fn dummy(&self) { } +} + +trait B +{ + fn foo (&self, t : TB) -> String; +} + +trait C : B<::TA> { } + +struct X; + +impl A for X +{ + type TA = i32; +} + +struct Y; + +impl C for Y { } + +// Both of these impls are required for successful compilation +impl B for Y +{ + fn foo (&self, t : i32) -> String + { + format!("First {}", t) + } +} + +fn main () +{ + let y = Y; + assert_eq!(y.foo(5), format!("First 5")); +} diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs new file mode 100644 index 00000000000..c2379e0f078 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a where clause that uses a non-normalized projection type. + +// pretty-expanded FIXME #23616 + +trait Int +{ + type T; + + fn dummy(&self) { } +} + +trait NonZero +{ + fn non_zero(self) -> bool; +} + +fn foo,J>(t: I) -> bool + where ::T : NonZero + // ^~~~~~~~~~~~~ canonical form is just J +{ + bar::() +} + +fn bar() -> bool { true } + +fn main () +{ +} diff --git a/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs b/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs new file mode 100644 index 00000000000..f6951b48ae7 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that we do not get an error when you use `::Value` in +// the trait definition if there is no default method and for every impl, +// `Self` does implement `Get`. +// +// See also compile-fail tests associated-types-no-suitable-supertrait +// and associated-types-no-suitable-supertrait-2, which show how small +// variants of the code below can fail. + +trait Get { + type Value; +} + +trait Other { + fn okay(&self, foo: U, bar: ::Value) + where Self: Get; +} + +impl Get for () { + type Value = f32; +} + +impl Get for f64 { + type Value = u32; +} + +impl Other for () { + fn okay(&self, _foo: U, _bar: ::Value) { } +} + +impl Other for f64 { + fn okay(&self, _foo: U, _bar: ::Value) { } +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs b/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs new file mode 100644 index 00000000000..b3d5c353989 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Foo { + type Bar; + fn get_bar() -> >::Bar; +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs b/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs new file mode 100644 index 00000000000..e45766adc2c --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-ref-from-struct.rs @@ -0,0 +1,65 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test associated type references in structure fields. + +// pretty-expanded FIXME #23616 + +trait Test { + type V; + + fn test(&self, value: &Self::V) -> bool; +} + +/////////////////////////////////////////////////////////////////////////// + +struct TesterPair { + tester: T, + value: T::V, +} + +impl TesterPair { + fn new(tester: T, value: T::V) -> TesterPair { + TesterPair { tester: tester, value: value } + } + + fn test(&self) -> bool { + self.tester.test(&self.value) + } +} + +/////////////////////////////////////////////////////////////////////////// + +struct EqU32(u32); +impl Test for EqU32 { + type V = u32; + + fn test(&self, value: &u32) -> bool { + self.0 == *value + } +} + +struct EqI32(i32); +impl Test for EqI32 { + type V = i32; + + fn test(&self, value: &i32) -> bool { + self.0 == *value + } +} + +fn main() { + let tester = TesterPair::new(EqU32(22), 23); + tester.test(); + + let tester = TesterPair::new(EqI32(22), 23); + tester.test(); +} diff --git a/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs b/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs new file mode 100644 index 00000000000..02e1d74db47 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-ref-in-struct-literal.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test associated type references in a struct literal. Issue #20535. + + +pub trait Foo { + type Bar; + + fn dummy(&self) { } +} + +impl Foo for isize { + type Bar = isize; +} + +struct Thing { + a: F, + b: F::Bar, +} + +fn main() { + let thing = Thing{a: 1, b: 2}; + assert_eq!(thing.a + 1, thing.b); +} diff --git a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs new file mode 100644 index 00000000000..b4038a21828 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #20582. This test caused an ICE related to +// inconsistent region erasure in codegen. + +// pretty-expanded FIXME #23616 + +struct Foo<'a> { + buf: &'a[u8] +} + +impl<'a> Iterator for Foo<'a> { + type Item = &'a[u8]; + + fn next(&mut self) -> Option<::Item> { + Some(self.buf) + } +} + +fn main() { +} diff --git a/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs b/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs new file mode 100644 index 00000000000..b77f3fcd295 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-resolve-lifetime.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Get { + fn get(&self) -> T; +} + +trait Trait<'a> { + type T: 'static; + type U: Get<&'a isize>; + + fn dummy(&'a self) { } +} + +fn main() {} diff --git a/src/test/run-pass/associated-types/associated-types-return.rs b/src/test/run-pass/associated-types/associated-types-return.rs new file mode 100644 index 00000000000..18b05987715 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-return.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test equality constraints on associated types in a where clause. + + +pub trait Foo { + type A; + fn boo(&self) -> ::A; +} + +#[derive(PartialEq, Debug)] +pub struct Bar; + +impl Foo for isize { + type A = usize; + fn boo(&self) -> usize { 42 } +} + +impl Foo for Bar { + type A = isize; + fn boo(&self) -> isize { 43 } +} + +impl Foo for char { + type A = Bar; + fn boo(&self) -> Bar { Bar } +} + +fn foo1>(x: I) -> Bar { + x.boo() +} + +fn foo2(x: I) -> ::A { + x.boo() +} + +pub fn main() { + let a = 42; + assert_eq!(foo2(a), 42); + + let a = Bar; + assert_eq!(foo2(a), 43); + + let a = 'a'; + foo1(a); + assert_eq!(foo2(a), Bar); +} diff --git a/src/test/run-pass/associated-types/associated-types-simple.rs b/src/test/run-pass/associated-types/associated-types-simple.rs new file mode 100644 index 00000000000..8e9b2367fcd --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-simple.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Get { + type Value; + fn get(&self) -> &::Value; +} + +struct Struct { + x: isize, +} + +impl Get for Struct { + type Value = isize; + fn get(&self) -> &isize { + &self.x + } +} + +fn main() { + let s = Struct { + x: 100, + }; + assert_eq!(*s.get(), 100); +} diff --git a/src/test/run-pass/associated-types/associated-types-stream.rs b/src/test/run-pass/associated-types/associated-types-stream.rs new file mode 100644 index 00000000000..c486e346351 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-stream.rs @@ -0,0 +1,49 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test references to the trait `Stream` in the bounds for associated +// types defined on `Stream`. Issue #20551. + + +trait Stream { + type Car; + type Cdr: Stream; + + fn car(&self) -> Self::Car; + fn cdr(self) -> Self::Cdr; +} + +impl Stream for () { + type Car = (); + type Cdr = (); + fn car(&self) -> () { () } + fn cdr(self) -> () { self } +} + +impl Stream for (T, U) + where T : Clone, U : Stream +{ + type Car = T; + type Cdr = U; + fn car(&self) -> T { self.0.clone() } + fn cdr(self) -> U { self.1 } +} + +fn main() { + let p = (22, (44, (66, ()))); + assert_eq!(p.car(), 22); + + let p = p.cdr(); + assert_eq!(p.car(), 44); + + let p = p.cdr(); + assert_eq!(p.car(), 66); +} diff --git a/src/test/run-pass/associated-types/associated-types-struct-field-named.rs b/src/test/run-pass/associated-types/associated-types-struct-field-named.rs new file mode 100644 index 00000000000..384ec8ef44f --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-struct-field-named.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we correctly normalize the type of a struct field +// which has an associated type. + + +pub trait UnifyKey { + type Value; + + fn dummy(&self) { } +} + +pub struct Node { + pub key: K, + pub value: K::Value, +} + +fn foo>,V : Clone>(node: &Node) -> Option { + node.value.clone() +} + +impl UnifyKey for i32 { + type Value = Option; +} + +impl UnifyKey for u32 { + type Value = Option; +} + +pub fn main() { + let node: Node = Node { key: 1, value: Some(22) }; + assert_eq!(foo(&node), Some(22)); + + let node: Node = Node { key: 1, value: Some(22) }; + assert_eq!(foo(&node), Some(22)); +} diff --git a/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs b/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs new file mode 100644 index 00000000000..54d0c8839a3 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-struct-field-numbered.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we correctly normalize the type of a struct field +// which has an associated type. + + +pub trait UnifyKey { + type Value; + + fn dummy(&self) { } +} + +pub struct Node(K, K::Value); + +fn foo>,V : Clone>(node: &Node) -> Option { + node.1.clone() +} + +impl UnifyKey for i32 { + type Value = Option; +} + +impl UnifyKey for u32 { + type Value = Option; +} + +pub fn main() { + let node: Node = Node(1, Some(22)); + assert_eq!(foo(&node), Some(22)); + + let node: Node = Node(1, Some(22)); + assert_eq!(foo(&node), Some(22)); +} diff --git a/src/test/run-pass/associated-types/associated-types-sugar-path.rs b/src/test/run-pass/associated-types/associated-types-sugar-path.rs new file mode 100644 index 00000000000..3b148c5e106 --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-sugar-path.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test paths to associated types using the type-parameter-only sugar. + +use std::ops::Deref; + +pub trait Foo { + type A; + fn boo(&self) -> Self::A; +} + +impl Foo for isize { + type A = usize; + fn boo(&self) -> usize { + 5 + } +} + +// Using a type via a function. +pub fn bar(a: T, x: T::A) -> T::A { + let _: T::A = a.boo(); + x +} + +// Using a type via an impl. +trait C { + fn f(); + fn g(&self) { } +} +struct B(X); +impl C for B { + fn f() { + let x: T::A = panic!(); + } +} + +pub fn main() { + let z: usize = bar(2, 4); +} diff --git a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs new file mode 100644 index 00000000000..5f24a44c14b --- /dev/null +++ b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs @@ -0,0 +1,54 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test how resolving a projection interacts with inference. In this +// case, we were eagerly unifying the type variable for the iterator +// type with `I` from the where clause, ignoring the in-scope `impl` +// for `ByRef`. The right answer was to consider the result ambiguous +// until more type information was available. + +#![feature(lang_items)] +#![no_implicit_prelude] + +use std::marker::Sized; +use std::option::Option::{None, Some, self}; + +trait Iterator { + type Item; + + fn next(&mut self) -> Option; +} + +trait IteratorExt: Iterator + Sized { + fn by_ref(&mut self) -> ByRef { + ByRef(self) + } +} + +impl IteratorExt for I where I: Iterator {} + +struct ByRef<'a, I: 'a + Iterator>(&'a mut I); + +impl<'a, A, I> Iterator for ByRef<'a, I> where I: Iterator { + type Item = A; + + fn next(&mut self) -> Option< ::Item > { + self.0.next() + } +} + +fn is_iterator_of>(_: &I) {} + +fn test>(mut it: I) { + is_iterator_of::(&it.by_ref()); +} + +fn main() { } diff --git a/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs b/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs new file mode 100644 index 00000000000..175e8730cbc --- /dev/null +++ b/src/test/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Helper for test issue-18048, which tests associated types in a +// cross-crate scenario. + +#![crate_type="lib"] + +pub trait Bar: Sized { + type T; + + fn get(x: Option) -> ::T; +} + +impl Bar for isize { + type T = usize; + + fn get(_: Option) -> usize { 22 } +} diff --git a/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs b/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs new file mode 100644 index 00000000000..d984531b8bb --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + fn f(&self); +} + +struct Bar { + x: isize +} + +trait Baz { + fn g(&self); +} + +impl Foo for T { + fn f(&self) { + self.g(); + } +} + +impl Baz for Bar { + fn g(&self) { + println!("{}", self.x); + } +} + +pub fn main() { + let y = Bar { x: 42 }; + y.f(); +} diff --git a/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs b/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs new file mode 100644 index 00000000000..6e665b07656 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/auto-ref-sliceable.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait Pushable { + fn push_val(&mut self, t: T); +} + +impl Pushable for Vec { + fn push_val(&mut self, t: T) { + self.push(t); + } +} + +pub fn main() { + let mut v = vec![1]; + v.push_val(2); + v.push_val(3); + assert_eq!(v, [1, 2, 3]); +} diff --git a/src/test/run-pass/autoref-autoderef/auto-ref.rs b/src/test/run-pass/autoref-autoderef/auto-ref.rs new file mode 100644 index 00000000000..afc79cce35e --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/auto-ref.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + x: isize, +} + +trait Stuff { + fn printme(&self); +} + +impl Stuff for Foo { + fn printme(&self) { + println!("{}", self.x); + } +} + +pub fn main() { + let x = Foo { x: 3 }; + x.printme(); +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs new file mode 100644 index 00000000000..0ce3ef7fd7b --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo { + x: isize, +} + +impl Foo { + pub fn f(&self) {} +} + +fn g(x: &mut Foo) { + x.f(); +} + +pub fn main() { +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs new file mode 100644 index 00000000000..8116a311eb4 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-on-trait.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +trait double { + fn double(self: Box) -> usize; +} + +impl double for usize { + fn double(self: Box) -> usize { *self * 2 } +} + +pub fn main() { + let x: Box<_> = box (box 3usize as Box); + assert_eq!(x.double(), 6); +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs new file mode 100644 index 00000000000..2b148395003 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-priority.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +trait double { + fn double(self) -> usize; +} + +impl double for usize { + fn double(self) -> usize { self } +} + +impl double for Box { + fn double(self) -> usize { *self * 2 } +} + +pub fn main() { + let x: Box<_> = box 3; + assert_eq!(x.double(), 6); +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs new file mode 100644 index 00000000000..14c57b07519 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +trait double { + fn double(self: Box) -> usize; +} + +impl double for Box { + fn double(self: Box>) -> usize { **self * 2 } +} + +pub fn main() { + let x: Box>>>> = box box box box box 3; + assert_eq!(x.double(), 6); +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs b/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs new file mode 100644 index 00000000000..5185d0ee749 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-method-twice.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +trait double { + fn double(self: Box) -> usize; +} + +impl double for usize { + fn double(self: Box) -> usize { *self * 2 } +} + +pub fn main() { + let x: Box> = box box 3; + assert_eq!(x.double(), 6); +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-method.rs b/src/test/run-pass/autoref-autoderef/autoderef-method.rs new file mode 100644 index 00000000000..398ccde8894 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-method.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +trait double { + fn double(self: Box) -> usize; +} + +impl double for usize { + fn double(self: Box) -> usize { *self * 2 } +} + +pub fn main() { + let x: Box<_> = box 3; + assert_eq!(x.double(), 6); +} diff --git a/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs b/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs new file mode 100644 index 00000000000..cfbc7744a4c --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoderef-privacy.rs @@ -0,0 +1,61 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check we do not select a private method or field when computing autoderefs + +#![allow(unused)] + +#[derive(Default)] +pub struct Bar2 { i: i32 } +#[derive(Default)] +pub struct Baz2(i32); + +impl Bar2 { + fn f(&self) -> bool { true } +} + +mod foo { + #[derive(Default)] + pub struct Bar { i: ::Bar2 } + #[derive(Default)] + pub struct Baz(::Baz2); + + impl Bar { + fn f(&self) -> bool { false } + } + + impl ::std::ops::Deref for Bar { + type Target = ::Bar2; + fn deref(&self) -> &::Bar2 { &self.i } + } + + impl ::std::ops::Deref for Baz { + type Target = ::Baz2; + fn deref(&self) -> &::Baz2 { &self.0 } + } + + pub fn f(bar: &Bar, baz: &Baz) { + // Since the private fields and methods are visible here, there should be no autoderefs. + let _: &::Bar2 = &bar.i; + let _: &::Baz2 = &baz.0; + assert!(!bar.f()); + } +} + +fn main() { + let bar = foo::Bar::default(); + let baz = foo::Baz::default(); + foo::f(&bar, &baz); + + let _: i32 = bar.i; + let _: i32 = baz.0; + assert!(bar.f()); +} diff --git a/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs b/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs new file mode 100644 index 00000000000..e32738e8f15 --- /dev/null +++ b/src/test/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +trait Foo { + fn foo(&self) -> String; +} + +impl Foo for Box { + fn foo(&self) -> String { + format!("box {}", (**self).foo()) + } +} + +impl Foo for usize { + fn foo(&self) -> String { + format!("{}", *self) + } +} + +pub fn main() { + let x: Box<_> = box 3; + assert_eq!(x.foo(), "box 3".to_string()); +} diff --git a/src/test/run-pass/bench/issue-32062.rs b/src/test/run-pass/bench/issue-32062.rs new file mode 100644 index 00000000000..c21399fd299 --- /dev/null +++ b/src/test/run-pass/bench/issue-32062.rs @@ -0,0 +1,60 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +fn main() { + let _ = test(Some(0).into_iter()); +} + +trait Parser { + type Input: Iterator; + type Output; + fn parse(self, input: Self::Input) -> Result<(Self::Output, Self::Input), ()>; + fn chain

(self, p: P) -> Chain where Self: Sized { + Chain(self, p) + } +} + +struct Token(T::Item) where T: Iterator; + +impl Parser for Token where T: Iterator { + type Input = T; + type Output = T::Item; + fn parse(self, _input: Self::Input) -> Result<(Self::Output, Self::Input), ()> { + Err(()) + } +} + +struct Chain(L, R); + +impl Parser for Chain where L: Parser, R: Parser { + type Input = L::Input; + type Output = (L::Output, R::Output); + fn parse(self, _input: Self::Input) -> Result<(Self::Output, Self::Input), ()> { + Err(()) + } +} + +fn test(i: I) -> Result<((), I), ()> where I: Iterator { + Chain(Token(0), Token(1)) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .chain(Chain(Token(0), Token(1))) + .parse(i) + .map(|(_, i)| ((), i)) +} diff --git a/src/test/run-pass/binding/allow_irrefutable_let_patterns.rs b/src/test/run-pass/binding/allow_irrefutable_let_patterns.rs new file mode 100644 index 00000000000..866784e517c --- /dev/null +++ b/src/test/run-pass/binding/allow_irrefutable_let_patterns.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(irrefutable_let_patterns)] + +// must-compile-successfully-irrefutable_let_patterns_with_gate +#[allow(irrefutable_let_patterns)] +fn main() { + if let _ = 5 {} + + while let _ = 5 { + break; + } +} diff --git a/src/test/run-pass/binding/bind-field-short-with-modifiers.rs b/src/test/run-pass/binding/bind-field-short-with-modifiers.rs new file mode 100644 index 00000000000..24f03774270 --- /dev/null +++ b/src/test/run-pass/binding/bind-field-short-with-modifiers.rs @@ -0,0 +1,34 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +pub fn main() { + struct Foo { x: isize, y: isize } + let mut f = Foo { x: 10, y: 0 }; + match f { + Foo { ref mut x, .. } => *x = 11, + } + match f { + Foo { ref x, ref y } => { + assert_eq!(f.x, 11); + assert_eq!(f.y, 0); + } + } + match f { + Foo { mut x, y: ref mut y } => { + x = 12; + *y = 1; + } + } + assert_eq!(f.x, 11); + assert_eq!(f.y, 1); +} diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs new file mode 100644 index 00000000000..6a23d159047 --- /dev/null +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-2.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn foo(s: &String) -> bool { + match &**s { + "kitty" => true, + _ => false + } +} + +pub fn main() { + assert!(foo(&"kitty".to_string())); + assert!(!foo(&"gata".to_string())); +} diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs new file mode 100644 index 00000000000..cb40b3a0099 --- /dev/null +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-3.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn foo<'r>(s: &'r usize) -> bool { + match s { + &3 => true, + _ => false + } +} + +pub fn main() { + assert!(foo(&3)); + assert!(!foo(&4)); +} diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs new file mode 100644 index 00000000000..5f906903ed2 --- /dev/null +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-infallible.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let (&x, &y) = (&3, &'a'); + assert_eq!(x, 3); + assert_eq!(y, 'a'); +} diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs b/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs new file mode 100644 index 00000000000..1372a7a0789 --- /dev/null +++ b/src/test/run-pass/binding/borrowed-ptr-pattern-option.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn select<'r>(x: &'r Option, y: &'r Option) -> &'r Option { + match (x, y) { + (&None, &None) => x, + (&Some(_), _) => x, + (&None, &Some(_)) => y + } +} + +pub fn main() { + let x = None; + let y = Some(3); + assert_eq!(select(&x, &y).unwrap(), 3); +} diff --git a/src/test/run-pass/binding/borrowed-ptr-pattern.rs b/src/test/run-pass/binding/borrowed-ptr-pattern.rs new file mode 100644 index 00000000000..f363bef36d6 --- /dev/null +++ b/src/test/run-pass/binding/borrowed-ptr-pattern.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn foo(x: &T) -> T{ + match x { + &ref a => (*a).clone() + } +} + +pub fn main() { + assert_eq!(foo(&3), 3); + assert_eq!(foo(&'a'), 'a'); +} diff --git a/src/test/run-pass/binding/empty-types-in-patterns.rs b/src/test/run-pass/binding/empty-types-in-patterns.rs new file mode 100644 index 00000000000..c230442eecc --- /dev/null +++ b/src/test/run-pass/binding/empty-types-in-patterns.rs @@ -0,0 +1,67 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(never_type)] +#![feature(exhaustive_patterns)] +#![feature(slice_patterns)] +#![allow(unreachable_patterns)] +#![allow(unreachable_code)] + +#[allow(dead_code)] +fn foo(z: !) { + let x: Result = Ok(z); + + let Ok(_y) = x; + let Err(_y) = x; + + let x = [z; 1]; + + match x {}; + match x { + [q] => q, + }; +} + +fn bar(nevers: &[!]) { + match nevers { + &[] => (), + }; + + match nevers { + &[] => (), + &[_] => (), + &[_, _, _, ..] => (), + }; +} + +fn main() { + let x: Result = Ok(123); + let Ok(y) = x; + + assert_eq!(123, y); + + match x { + Ok(y) => y, + }; + + match x { + Ok(y) => y, + Err(e) => match e {}, + }; + + let x: Result = Ok(123); + match x { + Ok(y) => y, + }; + + bar(&[]); +} + diff --git a/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs b/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs new file mode 100644 index 00000000000..26e852eff23 --- /dev/null +++ b/src/test/run-pass/binding/exhaustive-bool-match-sanity.rs @@ -0,0 +1,32 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #33540 +// We previously used to generate a 3-armed boolean `SwitchInt` in the +// MIR of the function `foo` below. #33583 changed rustc to +// generate an `If` terminator instead. This test is to just ensure +// sanity in that we generate an if-else chain giving the correct +// results. + +fn foo(x: bool, y: bool) -> u32 { + match (x, y) { + (false, _) => 0, + (_, false) => 1, + (true, true) => 2 + } +} + +fn main() { + assert_eq!(foo(false, true), 0); + assert_eq!(foo(false, false), 0); + assert_eq!(foo(true, false), 1); + assert_eq!(foo(true, true), 2); +} diff --git a/src/test/run-pass/binding/expr-match-generic-unique1.rs b/src/test/run-pass/binding/expr-match-generic-unique1.rs new file mode 100644 index 00000000000..3325aa7b3df --- /dev/null +++ b/src/test/run-pass/binding/expr-match-generic-unique1.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn test_generic(expected: Box, eq: F) where F: FnOnce(Box, Box) -> bool { + let actual: Box = match true { + true => { expected.clone() }, + _ => panic!("wat") + }; + assert!(eq(expected, actual)); +} + +fn test_box() { + fn compare_box(b1: Box, b2: Box) -> bool { + return *b1 == *b2; + } + test_generic::(box true, compare_box); +} + +pub fn main() { test_box(); } diff --git a/src/test/run-pass/binding/expr-match-generic-unique2.rs b/src/test/run-pass/binding/expr-match-generic-unique2.rs new file mode 100644 index 00000000000..8daa33e6227 --- /dev/null +++ b/src/test/run-pass/binding/expr-match-generic-unique2.rs @@ -0,0 +1,27 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn test_generic(expected: T, eq: F) where F: FnOnce(T, T) -> bool { + let actual: T = match true { + true => expected.clone(), + _ => panic!("wat") + }; + assert!(eq(expected, actual)); +} + +fn test_vec() { + fn compare_box(v1: Box, v2: Box) -> bool { return v1 == v2; } + test_generic::, _>(box 1, compare_box); +} + +pub fn main() { test_vec(); } diff --git a/src/test/run-pass/binding/expr-match-generic.rs b/src/test/run-pass/binding/expr-match-generic.rs new file mode 100644 index 00000000000..11c907b9b2d --- /dev/null +++ b/src/test/run-pass/binding/expr-match-generic.rs @@ -0,0 +1,39 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +type compare = extern "Rust" fn(T, T) -> bool; + +fn test_generic(expected: T, eq: compare) { + let actual: T = match true { true => { expected.clone() }, _ => panic!("wat") }; + assert!((eq(expected, actual))); +} + +fn test_bool() { + fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; } + test_generic::(true, compare_bool); +} + +#[derive(Clone)] +struct Pair { + a: isize, + b: isize, +} + +fn test_rec() { + fn compare_rec(t1: Pair, t2: Pair) -> bool { + t1.a == t2.a && t1.b == t2.b + } + test_generic::(Pair {a: 1, b: 2}, compare_rec); +} + +pub fn main() { test_bool(); test_rec(); } diff --git a/src/test/run-pass/binding/expr-match-panic-all.rs b/src/test/run-pass/binding/expr-match-panic-all.rs new file mode 100644 index 00000000000..f283fdddb6a --- /dev/null +++ b/src/test/run-pass/binding/expr-match-panic-all.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +// When all branches of a match expression result in panic, the entire +// match expression results in panic. + +pub fn main() { + let _x = + match true { + true => { 10 } + false => { match true { true => { panic!() } false => { panic!() } } } + }; +} diff --git a/src/test/run-pass/binding/expr-match-panic.rs b/src/test/run-pass/binding/expr-match-panic.rs new file mode 100644 index 00000000000..c6f8ae7bca6 --- /dev/null +++ b/src/test/run-pass/binding/expr-match-panic.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn test_simple() { + let r = match true { true => { true } false => { panic!() } }; + assert_eq!(r, true); +} + +fn test_box() { + let r = match true { true => { vec![10] } false => { panic!() } }; + assert_eq!(r[0], 10); +} + +pub fn main() { test_simple(); test_box(); } diff --git a/src/test/run-pass/binding/expr-match-unique.rs b/src/test/run-pass/binding/expr-match-unique.rs new file mode 100644 index 00000000000..b67b9fa3dda --- /dev/null +++ b/src/test/run-pass/binding/expr-match-unique.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +// Tests for match as expressions resulting in boxed types +fn test_box() { + let res: Box<_> = match true { true => { box 100 }, _ => panic!() }; + assert_eq!(*res, 100); +} + +pub fn main() { test_box(); } diff --git a/src/test/run-pass/binding/expr-match.rs b/src/test/run-pass/binding/expr-match.rs new file mode 100644 index 00000000000..83d44e42b32 --- /dev/null +++ b/src/test/run-pass/binding/expr-match.rs @@ -0,0 +1,55 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +// Tests for using match as an expression + +fn test_basic() { + let mut rs: bool = match true { true => { true } false => { false } }; + assert!((rs)); + rs = match false { true => { false } false => { true } }; + assert!((rs)); +} + +fn test_inferrence() { + let rs = match true { true => { true } false => { false } }; + assert!((rs)); +} + +fn test_alt_as_alt_head() { + // Yeah, this is kind of confusing ... + + let rs = + match match false { true => { true } false => { false } } { + true => { false } + false => { true } + }; + assert!((rs)); +} + +fn test_alt_as_block_result() { + let rs = + match false { + true => { false } + false => { match true { true => { true } false => { false } } } + }; + assert!((rs)); +} + +pub fn main() { + test_basic(); + test_inferrence(); + test_alt_as_alt_head(); + test_alt_as_block_result(); +} diff --git a/src/test/run-pass/binding/fat-arrow-match.rs b/src/test/run-pass/binding/fat-arrow-match.rs new file mode 100644 index 00000000000..c0e68f99ad0 --- /dev/null +++ b/src/test/run-pass/binding/fat-arrow-match.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum color { + red, + green, + blue +} + +pub fn main() { + println!("{}", match color::red { + color::red => { 1 } + color::green => { 2 } + color::blue => { 3 } + }); +} diff --git a/src/test/run-pass/binding/fn-pattern-expected-type-2.rs b/src/test/run-pass/binding/fn-pattern-expected-type-2.rs new file mode 100644 index 00000000000..7926234161f --- /dev/null +++ b/src/test/run-pass/binding/fn-pattern-expected-type-2.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let v : &[(isize,isize)] = &[ (1, 2), (3, 4), (5, 6) ]; + for &(x, y) in v { + println!("{}", y); + println!("{}", x); + } +} diff --git a/src/test/run-pass/binding/fn-pattern-expected-type.rs b/src/test/run-pass/binding/fn-pattern-expected-type.rs new file mode 100644 index 00000000000..a868267f371 --- /dev/null +++ b/src/test/run-pass/binding/fn-pattern-expected-type.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let f = |(x, y): (isize, isize)| { + assert_eq!(x, 1); + assert_eq!(y, 2); + }; + f((1, 2)); +} diff --git a/src/test/run-pass/binding/func-arg-incomplete-pattern.rs b/src/test/run-pass/binding/func-arg-incomplete-pattern.rs new file mode 100644 index 00000000000..d766feeb72c --- /dev/null +++ b/src/test/run-pass/binding/func-arg-incomplete-pattern.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we do not leak when the arg pattern must drop part of the +// argument (in this case, the `y` field). + +#![feature(box_syntax)] + +struct Foo { + x: Box, + y: Box, +} + +fn foo(Foo {x, ..}: Foo) -> *const usize { + let addr: *const usize = &*x; + addr +} + +pub fn main() { + let obj: Box<_> = box 1; + let objptr: *const usize = &*obj; + let f = Foo {x: obj, y: box 2}; + let xptr = foo(f); + assert_eq!(objptr, xptr); +} diff --git a/src/test/run-pass/binding/func-arg-ref-pattern.rs b/src/test/run-pass/binding/func-arg-ref-pattern.rs new file mode 100644 index 00000000000..7e87f14e2c5 --- /dev/null +++ b/src/test/run-pass/binding/func-arg-ref-pattern.rs @@ -0,0 +1,38 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// exec-env:RUST_POISON_ON_FREE=1 + +// Test argument patterns where we create refs to the inside of +// boxes. Make sure that we don't free the box as we match the +// pattern. + +#![feature(box_patterns)] +#![feature(box_syntax)] + +fn getaddr(box ref x: Box) -> *const usize { + let addr: *const usize = &*x; + addr +} + +fn checkval(box ref x: Box) -> usize { + *x +} + +pub fn main() { + let obj: Box<_> = box 1; + let objptr: *const usize = &*obj; + let xptr = getaddr(obj); + assert_eq!(objptr, xptr); + + let obj = box 22; + assert_eq!(checkval(obj), 22); +} diff --git a/src/test/run-pass/binding/func-arg-wild-pattern.rs b/src/test/run-pass/binding/func-arg-wild-pattern.rs new file mode 100644 index 00000000000..18a1909b51e --- /dev/null +++ b/src/test/run-pass/binding/func-arg-wild-pattern.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can compile code that uses a `_` in function argument +// patterns. + + +fn foo((x, _): (isize, isize)) -> isize { + x +} + +pub fn main() { + assert_eq!(foo((22, 23)), 22); +} diff --git a/src/test/run-pass/binding/if-let.rs b/src/test/run-pass/binding/if-let.rs new file mode 100644 index 00000000000..9147bf14cad --- /dev/null +++ b/src/test/run-pass/binding/if-let.rs @@ -0,0 +1,69 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = Some(3); + if let Some(y) = x { + assert_eq!(y, 3); + } else { + panic!("if-let panicked"); + } + let mut worked = false; + if let Some(_) = x { + worked = true; + } + assert!(worked); + let clause: usize; + if let None = Some("test") { + clause = 1; + } else if 4_usize > 5 { + clause = 2; + } else if let Ok(()) = Err::<(),&'static str>("test") { + clause = 3; + } else { + clause = 4; + } + assert_eq!(clause, 4_usize); + + if 3 > 4 { + panic!("bad math"); + } else if let 1 = 2 { + panic!("bad pattern match"); + } + + enum Foo { + One, + Two(usize), + Three(String, isize) + } + + let foo = Foo::Three("three".to_string(), 42); + if let Foo::One = foo { + panic!("bad pattern match"); + } else if let Foo::Two(_x) = foo { + panic!("bad pattern match"); + } else if let Foo::Three(s, _) = foo { + assert_eq!(s, "three"); + } else { + panic!("bad else"); + } + + if false { + panic!("wat"); + } else if let a@Foo::Two(_) = Foo::Two(42_usize) { + if let Foo::Two(b) = a { + assert_eq!(b, 42_usize); + } else { + panic!("panic in nested if-let"); + } + } +} diff --git a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs new file mode 100644 index 00000000000..9e9fc8b4249 --- /dev/null +++ b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo(_: &[&str]) {} + +fn bad(a: &str, b: &str) { + foo(&[a, b]); +} + +fn good(a: &str, b: &str) { + foo(&[a, b]); +} + +fn main() {} diff --git a/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs b/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs new file mode 100644 index 00000000000..3be0991aea6 --- /dev/null +++ b/src/test/run-pass/binding/inferred-suffix-in-pattern-range.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = 2; + let x_message = match x { + 0 ..= 1 => { "not many".to_string() } + _ => { "lots".to_string() } + }; + assert_eq!(x_message, "lots".to_string()); + + let y = 2; + let y_message = match y { + 0 ..= 1 => { "not many".to_string() } + _ => { "lots".to_string() } + }; + assert_eq!(y_message, "lots".to_string()); + + let z = 1u64; + let z_message = match z { + 0 ..= 1 => { "not many".to_string() } + _ => { "lots".to_string() } + }; + assert_eq!(z_message, "not many".to_string()); +} diff --git a/src/test/run-pass/binding/irrefutable-slice-patterns.rs b/src/test/run-pass/binding/irrefutable-slice-patterns.rs new file mode 100644 index 00000000000..9cd62f9a901 --- /dev/null +++ b/src/test/run-pass/binding/irrefutable-slice-patterns.rs @@ -0,0 +1,25 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #47096 + +#![feature(slice_patterns)] + +fn foo(s: &[i32]) -> &[i32] { + let &[ref xs..] = s; + xs +} + +fn main() { + let x = [1, 2, 3]; + let y = foo(&x); + assert_eq!(x, y); +} diff --git a/src/test/run-pass/binding/let-assignability.rs b/src/test/run-pass/binding/let-assignability.rs new file mode 100644 index 00000000000..99fc172892c --- /dev/null +++ b/src/test/run-pass/binding/let-assignability.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f() { + let a: Box<_> = box 1; + let b: &isize = &*a; + println!("{}", b); +} + +pub fn main() { + f(); +} diff --git a/src/test/run-pass/binding/let-destruct-ref.rs b/src/test/run-pass/binding/let-destruct-ref.rs new file mode 100644 index 00000000000..1c1b1a39769 --- /dev/null +++ b/src/test/run-pass/binding/let-destruct-ref.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = 3_usize; + let ref y = x; + assert_eq!(x, *y); +} diff --git a/src/test/run-pass/binding/let-var-hygiene.rs b/src/test/run-pass/binding/let-var-hygiene.rs new file mode 100644 index 00000000000..d432dbe86b9 --- /dev/null +++ b/src/test/run-pass/binding/let-var-hygiene.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// shouldn't affect evaluation of $ex: + +macro_rules! bad_macro { + ($ex:expr) => ({let _x = 9; $ex}) +} + +pub fn main() { + let _x = 8; + assert_eq!(bad_macro!(_x),8) +} diff --git a/src/test/run-pass/binding/match-arm-statics.rs b/src/test/run-pass/binding/match-arm-statics.rs new file mode 100644 index 00000000000..c5111073ca8 --- /dev/null +++ b/src/test/run-pass/binding/match-arm-statics.rs @@ -0,0 +1,175 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -g + +#[derive(PartialEq, Eq)] +struct NewBool(bool); + +#[derive(PartialEq, Eq)] +enum Direction { + North, + East, + South, + West +} + +#[derive(PartialEq, Eq)] +struct Foo { + bar: Option, + baz: NewBool +} + +#[derive(PartialEq, Eq)] +enum EnumWithStructVariants { + Variant1(bool), + Variant2 { + dir: Direction + } +} + +const TRUE_TRUE: (bool, bool) = (true, true); +const NONE: Option = None; +const EAST: Direction = Direction::East; +const NEW_FALSE: NewBool = NewBool(false); +const STATIC_FOO: Foo = Foo { bar: Some(Direction::South), baz: NEW_FALSE }; +const VARIANT2_NORTH: EnumWithStructVariants = EnumWithStructVariants::Variant2 { + dir: Direction::North }; + +pub mod glfw { + #[derive(Copy, Clone, PartialEq, Eq)] + pub struct InputState(usize); + + pub const RELEASE : InputState = InputState(0); + pub const PRESS : InputState = InputState(1); + pub const REPEAT : InputState = InputState(2); +} + +fn issue_6533() { + use glfw; + + fn action_to_str(state: glfw::InputState) -> &'static str { + use glfw::{RELEASE, PRESS, REPEAT}; + match state { + RELEASE => { "Released" } + PRESS => { "Pressed" } + REPEAT => { "Repeated" } + _ => { "Unknown" } + } + } + + assert_eq!(action_to_str(glfw::RELEASE), "Released"); + assert_eq!(action_to_str(glfw::PRESS), "Pressed"); + assert_eq!(action_to_str(glfw::REPEAT), "Repeated"); +} + +fn issue_13626() { + const VAL: [u8; 1] = [0]; + match [1] { + VAL => unreachable!(), + _ => () + } +} + +fn issue_14576() { + type Foo = (i32, i32); + const ON: Foo = (1, 1); + const OFF: Foo = (0, 0); + + match (1, 1) { + OFF => unreachable!(), + ON => (), + _ => unreachable!() + } + + #[derive(PartialEq, Eq)] + enum C { D = 3, E = 4 } + const F : C = C::D; + + assert_eq!(match C::D { F => 1, _ => 2, }, 1); + + // test gaps + #[derive(PartialEq, Eq)] + enum G { H = 3, I = 5 } + const K : G = G::I; + + assert_eq!(match G::I { K => 1, _ => 2, }, 1); +} + +fn issue_13731() { + #[derive(PartialEq, Eq)] + enum A { AA(()) } + const B: A = A::AA(()); + + match A::AA(()) { + B => () + } +} + +fn issue_15393() { + #![allow(dead_code)] + #[derive(PartialEq, Eq)] + struct Flags { + bits: usize + } + + const FOO: Flags = Flags { bits: 0x01 }; + const BAR: Flags = Flags { bits: 0x02 }; + match (Flags { bits: 0x02 }) { + FOO => unreachable!(), + BAR => (), + _ => unreachable!() + } +} + +fn main() { + assert_eq!(match (true, false) { + TRUE_TRUE => 1, + (false, false) => 2, + (false, true) => 3, + (true, false) => 4 + }, 4); + + assert_eq!(match Some(Some(Direction::North)) { + Some(NONE) => 1, + Some(Some(Direction::North)) => 2, + Some(Some(EAST)) => 3, + Some(Some(Direction::South)) => 4, + Some(Some(Direction::West)) => 5, + None => 6 + }, 2); + + assert_eq!(match (Foo { bar: Some(Direction::West), baz: NewBool(true) }) { + Foo { bar: None, baz: NewBool(true) } => 1, + Foo { bar: NONE, baz: NEW_FALSE } => 2, + STATIC_FOO => 3, + Foo { bar: _, baz: NEW_FALSE } => 4, + Foo { bar: Some(Direction::West), baz: NewBool(true) } => 5, + Foo { bar: Some(Direction::South), baz: NewBool(true) } => 6, + Foo { bar: Some(EAST), .. } => 7, + Foo { bar: Some(Direction::North), baz: NewBool(true) } => 8 + }, 5); + + assert_eq!(match (EnumWithStructVariants::Variant2 { dir: Direction::North }) { + EnumWithStructVariants::Variant1(true) => 1, + EnumWithStructVariants::Variant1(false) => 2, + EnumWithStructVariants::Variant2 { dir: Direction::West } => 3, + VARIANT2_NORTH => 4, + EnumWithStructVariants::Variant2 { dir: Direction::South } => 5, + EnumWithStructVariants::Variant2 { dir: Direction::East } => 6 + }, 4); + + issue_6533(); + issue_13626(); + issue_13731(); + issue_14576(); + issue_15393(); +} diff --git a/src/test/run-pass/binding/match-beginning-vert.rs b/src/test/run-pass/binding/match-beginning-vert.rs new file mode 100644 index 00000000000..16954f85752 --- /dev/null +++ b/src/test/run-pass/binding/match-beginning-vert.rs @@ -0,0 +1,29 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Foo { + A, + B, + C, + D, + E, +} +use Foo::*; + +fn main() { + for foo in &[A, B, C, D, E] { + match *foo { + | A => println!("A"), + | B | C if 1 < 2 => println!("BC!"), + | _ => {}, + } + } +} diff --git a/src/test/run-pass/binding/match-borrowed_str.rs b/src/test/run-pass/binding/match-borrowed_str.rs new file mode 100644 index 00000000000..0871ff836cc --- /dev/null +++ b/src/test/run-pass/binding/match-borrowed_str.rs @@ -0,0 +1,58 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn f1(ref_string: &str) -> String { + match ref_string { + "a" => "found a".to_string(), + "b" => "found b".to_string(), + _ => "not found".to_string() + } +} + +fn f2(ref_string: &str) -> String { + match ref_string { + "a" => "found a".to_string(), + "b" => "found b".to_string(), + s => format!("not found ({})", s) + } +} + +fn g1(ref_1: &str, ref_2: &str) -> String { + match (ref_1, ref_2) { + ("a", "b") => "found a,b".to_string(), + ("b", "c") => "found b,c".to_string(), + _ => "not found".to_string() + } +} + +fn g2(ref_1: &str, ref_2: &str) -> String { + match (ref_1, ref_2) { + ("a", "b") => "found a,b".to_string(), + ("b", "c") => "found b,c".to_string(), + (s1, s2) => format!("not found ({}, {})", s1, s2) + } +} + +pub fn main() { + assert_eq!(f1("b"), "found b".to_string()); + assert_eq!(f1("c"), "not found".to_string()); + assert_eq!(f1("d"), "not found".to_string()); + assert_eq!(f2("b"), "found b".to_string()); + assert_eq!(f2("c"), "not found (c)".to_string()); + assert_eq!(f2("d"), "not found (d)".to_string()); + assert_eq!(g1("b", "c"), "found b,c".to_string()); + assert_eq!(g1("c", "d"), "not found".to_string()); + assert_eq!(g1("d", "e"), "not found".to_string()); + assert_eq!(g2("b", "c"), "found b,c".to_string()); + assert_eq!(g2("c", "d"), "not found (c, d)".to_string()); + assert_eq!(g2("d", "e"), "not found (d, e)".to_string()); +} diff --git a/src/test/run-pass/binding/match-bot-2.rs b/src/test/run-pass/binding/match-bot-2.rs new file mode 100644 index 00000000000..8f9a8d2cfcc --- /dev/null +++ b/src/test/run-pass/binding/match-bot-2.rs @@ -0,0 +1,15 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// n.b. This was only ever failing with optimization disabled. + +fn a() -> isize { match return 1 { 2 => 3, _ => panic!() } } +pub fn main() { a(); } diff --git a/src/test/run-pass/binding/match-bot.rs b/src/test/run-pass/binding/match-bot.rs new file mode 100644 index 00000000000..d91d95b826a --- /dev/null +++ b/src/test/run-pass/binding/match-bot.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let i: isize = + match Some::(3) { None:: => { panic!() } Some::(_) => { 5 } }; + println!("{}", i); +} diff --git a/src/test/run-pass/binding/match-byte-array-patterns.rs b/src/test/run-pass/binding/match-byte-array-patterns.rs new file mode 100644 index 00000000000..728d4a241fe --- /dev/null +++ b/src/test/run-pass/binding/match-byte-array-patterns.rs @@ -0,0 +1,55 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn main() { + let buf = &[0u8; 4]; + match buf { + &[0, 1, 0, 0] => unimplemented!(), + b"true" => unimplemented!(), + _ => {} + } + + match buf { + b"true" => unimplemented!(), + &[0, 1, 0, 0] => unimplemented!(), + _ => {} + } + + match buf { + b"true" => unimplemented!(), + &[0, x, 0, 0] => assert_eq!(x, 0), + _ => unimplemented!(), + } + + let buf: &[u8] = buf; + + match buf { + &[0, 1, 0, 0] => unimplemented!(), + &[_] => unimplemented!(), + &[_, _, _, _, _, ..] => unimplemented!(), + b"true" => unimplemented!(), + _ => {} + } + + match buf { + b"true" => unimplemented!(), + &[0, 1, 0, 0] => unimplemented!(), + _ => {} + } + + match buf { + b"true" => unimplemented!(), + &[0, x, 0, 0] => assert_eq!(x, 0), + _ => unimplemented!(), + } +} diff --git a/src/test/run-pass/binding/match-enum-struct-0.rs b/src/test/run-pass/binding/match-enum-struct-0.rs new file mode 100644 index 00000000000..9ddf3b421d5 --- /dev/null +++ b/src/test/run-pass/binding/match-enum-struct-0.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// regression test for issue #5625 + + +enum E { + Foo{f : isize}, + Bar +} + +pub fn main() { + let e = E::Bar; + match e { + E::Foo{f: _f} => panic!(), + _ => (), + } +} diff --git a/src/test/run-pass/binding/match-enum-struct-1.rs b/src/test/run-pass/binding/match-enum-struct-1.rs new file mode 100644 index 00000000000..46d9c19bf84 --- /dev/null +++ b/src/test/run-pass/binding/match-enum-struct-1.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { + Foo{f : isize}, + Bar +} + +pub fn main() { + let e = E::Foo{f: 1}; + match e { + E::Foo{..} => (), + _ => panic!(), + } + match e { + E::Foo{f: _f} => (), + _ => panic!(), + } +} diff --git a/src/test/run-pass/binding/match-implicit-copy-unique.rs b/src/test/run-pass/binding/match-implicit-copy-unique.rs new file mode 100644 index 00000000000..68edbea3471 --- /dev/null +++ b/src/test/run-pass/binding/match-implicit-copy-unique.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] +#![feature(box_syntax)] + +struct Pair { a: Box, b: Box } + +pub fn main() { + let mut x: Box<_> = box Pair {a: box 10, b: box 20}; + let x_internal = &mut *x; + match *x_internal { + Pair {a: ref mut a, b: ref mut _b} => { + assert_eq!(**a, 10); + *a = box 30; + assert_eq!(**a, 30); + } + } +} diff --git a/src/test/run-pass/binding/match-in-macro.rs b/src/test/run-pass/binding/match-in-macro.rs new file mode 100644 index 00000000000..5c4c7c048ef --- /dev/null +++ b/src/test/run-pass/binding/match-in-macro.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum Foo { + B { b1: isize, bb1: isize}, +} + +macro_rules! match_inside_expansion { + () => ( + match (Foo::B { b1:29 , bb1: 100}) { + Foo::B { b1:b2 , bb1:bb2 } => b2+bb2 + } + ) +} + +pub fn main() { + assert_eq!(match_inside_expansion!(),129); +} diff --git a/src/test/run-pass/binding/match-join.rs b/src/test/run-pass/binding/match-join.rs new file mode 100644 index 00000000000..94ea8edd70f --- /dev/null +++ b/src/test/run-pass/binding/match-join.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo(y: Option) { + let mut x: isize; + let mut rs: Vec = Vec::new(); + /* tests that x doesn't get put in the precondition for the + entire if expression */ + + if true { + } else { + match y { + None:: => x = 17, + _ => x = 42 + } + rs.push(x); + } + return; +} + +pub fn main() { println!("hello"); foo::(Some::(5)); } diff --git a/src/test/run-pass/binding/match-larger-const.rs b/src/test/run-pass/binding/match-larger-const.rs new file mode 100644 index 00000000000..f649ce0ee0e --- /dev/null +++ b/src/test/run-pass/binding/match-larger-const.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Eq, PartialEq)] +pub struct Data([u8; 4]); + +const DATA: Data = Data([1, 2, 3, 4]); + +fn main() { + match DATA { + DATA => (), + _ => (), + } +} diff --git a/src/test/run-pass/binding/match-naked-record-expr.rs b/src/test/run-pass/binding/match-naked-record-expr.rs new file mode 100644 index 00000000000..f016ca8e43c --- /dev/null +++ b/src/test/run-pass/binding/match-naked-record-expr.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct X { x: isize } + +pub fn main() { + let _x = match 0 { + _ => X { + x: 0 + }.x + }; +} diff --git a/src/test/run-pass/binding/match-naked-record.rs b/src/test/run-pass/binding/match-naked-record.rs new file mode 100644 index 00000000000..550ace8b649 --- /dev/null +++ b/src/test/run-pass/binding/match-naked-record.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct X { x: isize } + +pub fn main() { + let _x = match 0 { + _ => X { + x: 0 + } + }; +} diff --git a/src/test/run-pass/binding/match-path.rs b/src/test/run-pass/binding/match-path.rs new file mode 100644 index 00000000000..06d7095a924 --- /dev/null +++ b/src/test/run-pass/binding/match-path.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +// pretty-expanded FIXME #23616 + +mod m1 { + pub enum foo { foo1, foo2, } +} + +fn bar(x: m1::foo) { match x { m1::foo::foo1 => { } m1::foo::foo2 => { } } } + +pub fn main() { } diff --git a/src/test/run-pass/binding/match-pattern-bindings.rs b/src/test/run-pass/binding/match-pattern-bindings.rs new file mode 100644 index 00000000000..e6242a0ee58 --- /dev/null +++ b/src/test/run-pass/binding/match-pattern-bindings.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let value = Some(1); + assert_eq!(match value { + ref a @ Some(_) => a, + ref b @ None => b + }, &Some(1)); + assert_eq!(match value { + ref c @ Some(_) => c, + ref b @ None => b + }, &Some(1)); + assert_eq!(match "foobarbaz" { + b @ _ => b + }, "foobarbaz"); + let a @ _ = "foobarbaz"; + assert_eq!(a, "foobarbaz"); + let value = Some(true); + let ref a @ _ = value; + assert_eq!(a, &Some(true)); +} diff --git a/src/test/run-pass/binding/match-pattern-lit.rs b/src/test/run-pass/binding/match-pattern-lit.rs new file mode 100644 index 00000000000..8e6129d60b5 --- /dev/null +++ b/src/test/run-pass/binding/match-pattern-lit.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn altlit(f: isize) -> isize { + match f { + 10 => { println!("case 10"); return 20; } + 11 => { println!("case 11"); return 22; } + _ => panic!("the impossible happened") + } +} + +pub fn main() { + assert_eq!(altlit(10), 20); + assert_eq!(altlit(11), 22); +} diff --git a/src/test/run-pass/binding/match-pattern-no-type-params.rs b/src/test/run-pass/binding/match-pattern-no-type-params.rs new file mode 100644 index 00000000000..2486fa782e0 --- /dev/null +++ b/src/test/run-pass/binding/match-pattern-no-type-params.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum maybe { nothing, just(T), } + +fn foo(x: maybe) { + match x { + maybe::nothing => { println!("A"); } + maybe::just(_a) => { println!("B"); } + } +} + +pub fn main() { } diff --git a/src/test/run-pass/binding/match-pattern-simple.rs b/src/test/run-pass/binding/match-pattern-simple.rs new file mode 100644 index 00000000000..d1525661269 --- /dev/null +++ b/src/test/run-pass/binding/match-pattern-simple.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +// pretty-expanded FIXME #23616 + +fn altsimple(f: isize) { match f { _x => () } } + +pub fn main() { } diff --git a/src/test/run-pass/binding/match-phi.rs b/src/test/run-pass/binding/match-phi.rs new file mode 100644 index 00000000000..06a011c0fa2 --- /dev/null +++ b/src/test/run-pass/binding/match-phi.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] +#![allow(unused_variables)] + +enum thing { a, b, c, } + +fn foo(it: F) where F: FnOnce(isize) { it(10); } + +pub fn main() { + let mut x = true; + match thing::a { + thing::a => { x = true; foo(|_i| { } ) } + thing::b => { x = false; } + thing::c => { x = false; } + } +} diff --git a/src/test/run-pass/binding/match-pipe-binding.rs b/src/test/run-pass/binding/match-pipe-binding.rs new file mode 100644 index 00000000000..577e5c97e42 --- /dev/null +++ b/src/test/run-pass/binding/match-pipe-binding.rs @@ -0,0 +1,71 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z borrowck=compare + +fn test1() { + // from issue 6338 + match ((1, "a".to_string()), (2, "b".to_string())) { + ((1, a), (2, b)) | ((2, b), (1, a)) => { + assert_eq!(a, "a".to_string()); + assert_eq!(b, "b".to_string()); + }, + _ => panic!(), + } +} + +fn test2() { + match (1, 2, 3) { + (1, a, b) | (2, b, a) => { + assert_eq!(a, 2); + assert_eq!(b, 3); + }, + _ => panic!(), + } +} + +fn test3() { + match (1, 2, 3) { + (1, ref a, ref b) | (2, ref b, ref a) => { + assert_eq!(*a, 2); + assert_eq!(*b, 3); + }, + _ => panic!(), + } +} + +fn test4() { + match (1, 2, 3) { + (1, a, b) | (2, b, a) if a == 2 => { + assert_eq!(a, 2); + assert_eq!(b, 3); + }, + _ => panic!(), + } +} + +fn test5() { + match (1, 2, 3) { + (1, ref a, ref b) | (2, ref b, ref a) if *a == 2 => { + assert_eq!(*a, 2); + assert_eq!(*b, 3); + }, + _ => panic!(), + } +} + +pub fn main() { + test1(); + test2(); + test3(); + test4(); + test5(); +} diff --git a/src/test/run-pass/binding/match-range-infer.rs b/src/test/run-pass/binding/match-range-infer.rs new file mode 100644 index 00000000000..7178d1837c7 --- /dev/null +++ b/src/test/run-pass/binding/match-range-infer.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that type inference for range patterns works correctly (is bi-directional). + +pub fn main() { + match 1 { + 1 ..= 3 => {} + _ => panic!("should match range") + } + match 1 { + 1 ..= 3u16 => {} + _ => panic!("should match range with inferred start type") + } + match 1 { + 1u16 ..= 3 => {} + _ => panic!("should match range with inferred end type") + } +} diff --git a/src/test/run-pass/binding/match-range-static.rs b/src/test/run-pass/binding/match-range-static.rs new file mode 100644 index 00000000000..5be8db5fc86 --- /dev/null +++ b/src/test/run-pass/binding/match-range-static.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_upper_case_globals)] + +const s: isize = 1; +const e: isize = 42; + +pub fn main() { + match 7 { + s..=e => (), + _ => (), + } +} diff --git a/src/test/run-pass/binding/match-range.rs b/src/test/run-pass/binding/match-range.rs new file mode 100644 index 00000000000..a9687943e99 --- /dev/null +++ b/src/test/run-pass/binding/match-range.rs @@ -0,0 +1,61 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 +#![feature(exclusive_range_pattern)] + +pub fn main() { + match 5_usize { + 1_usize..=5_usize => {} + _ => panic!("should match range"), + } + match 1_usize { + 1_usize..5_usize => {} + _ => panic!("should match range start"), + } + match 5_usize { + 6_usize..=7_usize => panic!("shouldn't match range"), + _ => {} + } + match 7_usize { + 6_usize..7_usize => panic!("shouldn't match range end"), + _ => {}, + } + match 5_usize { + 1_usize => panic!("should match non-first range"), + 2_usize..=6_usize => {} + _ => panic!("math is broken") + } + match 'c' { + 'a'..='z' => {} + _ => panic!("should support char ranges") + } + match -3 { + -7..=5 => {} + _ => panic!("should match signed range") + } + match 3.0f64 { + 1.0..=5.0 => {} + _ => panic!("should match float range") + } + match -1.5f64 { + -3.6..=3.6 => {} + _ => panic!("should match negative float range") + } + match 3.5 { + 0.0..3.5 => panic!("should not match the range end"), + _ => {}, + } + match 0.0 { + 0.0..3.5 => {}, + _ => panic!("should match the range start"), + } +} diff --git a/src/test/run-pass/binding/match-reassign.rs b/src/test/run-pass/binding/match-reassign.rs new file mode 100644 index 00000000000..89b12976355 --- /dev/null +++ b/src/test/run-pass/binding/match-reassign.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #23698: The reassignment checker only cared +// about the last assignment in a match arm body + +// Use an extra function to make sure no extra assignments +// are introduced by macros in the match statement +fn check_eq(x: i32, y: i32) { + assert_eq!(x, y); +} + +#[allow(unused_assignments)] +fn main() { + let mut x = Box::new(1); + match x { + y => { + x = Box::new(2); + let _tmp = 1; // This assignment used to throw off the reassignment checker + check_eq(*y, 1); + } + } +} diff --git a/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs b/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs new file mode 100644 index 00000000000..2da75d941b4 --- /dev/null +++ b/src/test/run-pass/binding/match-ref-binding-in-guard-3256.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::sync::Mutex; + +pub fn main() { + let x = Some(Mutex::new(true)); + match x { + Some(ref z) if *z.lock().unwrap() => { + assert!(*z.lock().unwrap()); + }, + _ => panic!() + } +} diff --git a/src/test/run-pass/binding/match-ref-binding-mut-option.rs b/src/test/run-pass/binding/match-ref-binding-mut-option.rs new file mode 100644 index 00000000000..a3d26024732 --- /dev/null +++ b/src/test/run-pass/binding/match-ref-binding-mut-option.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let mut v = Some(22); + match v { + None => {} + Some(ref mut p) => { *p += 1; } + } + assert_eq!(v, Some(23)); +} diff --git a/src/test/run-pass/binding/match-ref-binding-mut.rs b/src/test/run-pass/binding/match-ref-binding-mut.rs new file mode 100644 index 00000000000..c1f09502542 --- /dev/null +++ b/src/test/run-pass/binding/match-ref-binding-mut.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct Rec { + f: isize +} + +fn destructure(x: &mut Rec) { + match *x { + Rec {f: ref mut f} => *f += 1 + } +} + +pub fn main() { + let mut v = Rec {f: 22}; + destructure(&mut v); + assert_eq!(v.f, 23); +} diff --git a/src/test/run-pass/binding/match-ref-binding.rs b/src/test/run-pass/binding/match-ref-binding.rs new file mode 100644 index 00000000000..bc36b8102ce --- /dev/null +++ b/src/test/run-pass/binding/match-ref-binding.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn destructure(x: Option) -> isize { + match x { + None => 0, + Some(ref v) => *v + } +} + +pub fn main() { + assert_eq!(destructure(Some(22)), 22); +} diff --git a/src/test/run-pass/binding/match-ref-unsized.rs b/src/test/run-pass/binding/match-ref-unsized.rs new file mode 100644 index 00000000000..7ef19330015 --- /dev/null +++ b/src/test/run-pass/binding/match-ref-unsized.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Binding unsized expressions to ref patterns + +pub fn main() { + let ref a = *"abcdef"; + assert_eq!(a, "abcdef"); + + match *"12345" { + ref b => { assert_eq!(b, "12345") } + } +} diff --git a/src/test/run-pass/binding/match-static-const-rename.rs b/src/test/run-pass/binding/match-static-const-rename.rs new file mode 100644 index 00000000000..0d75c81b1e6 --- /dev/null +++ b/src/test/run-pass/binding/match-static-const-rename.rs @@ -0,0 +1,74 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #7526: lowercase static constants in patterns look like bindings + +// This is similar to compile-fail/match-static-const-lc, except it +// shows the expected usual workaround (choosing a different name for +// the static definition) and also demonstrates that one can work +// around this problem locally by renaming the constant in the `use` +// form to an uppercase identifier that placates the lint. + + +#![deny(non_upper_case_globals)] + +pub const A : isize = 97; + +fn f() { + let r = match (0,0) { + (0, A) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); + let r = match (0,97) { + (0, A) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 0); +} + +mod m { + #[allow(non_upper_case_globals)] + pub const aha : isize = 7; +} + +fn g() { + use self::m::aha as AHA; + let r = match (0,0) { + (0, AHA) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); + let r = match (0,7) { + (0, AHA) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 0); +} + +fn h() { + let r = match (0,0) { + (0, self::m::aha) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 1); + let r = match (0,7) { + (0, self::m::aha) => 0, + (x, y) => 1 + x + y, + }; + assert_eq!(r, 0); +} + +pub fn main () { + f(); + g(); + h(); +} diff --git a/src/test/run-pass/binding/match-str.rs b/src/test/run-pass/binding/match-str.rs new file mode 100644 index 00000000000..0722a6f0b32 --- /dev/null +++ b/src/test/run-pass/binding/match-str.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #53 +#![allow(non_camel_case_types)] + + +pub fn main() { + match "test" { "not-test" => panic!(), "test" => (), _ => panic!() } + + enum t { tag1(String), tag2, } + + + match t::tag1("test".to_string()) { + t::tag2 => panic!(), + t::tag1(ref s) if "test" != &**s => panic!(), + t::tag1(ref s) if "test" == &**s => (), + _ => panic!() + } + + let x = match "a" { "a" => 1, "b" => 2, _ => panic!() }; + assert_eq!(x, 1); + + match "a" { "a" => { } "b" => { }, _ => panic!() } + +} diff --git a/src/test/run-pass/binding/match-struct-0.rs b/src/test/run-pass/binding/match-struct-0.rs new file mode 100644 index 00000000000..facfaae5405 --- /dev/null +++ b/src/test/run-pass/binding/match-struct-0.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo{ + f : isize, +} + +pub fn main() { + let f = Foo{f: 1}; + match f { + Foo{f: 0} => panic!(), + Foo{..} => (), + } + match f { + Foo{f: 0} => panic!(), + Foo{f: _f} => (), + } + match f { + Foo{f: 0} => panic!(), + _ => (), + } +} diff --git a/src/test/run-pass/binding/match-tag.rs b/src/test/run-pass/binding/match-tag.rs new file mode 100644 index 00000000000..aeeb7dd4bc9 --- /dev/null +++ b/src/test/run-pass/binding/match-tag.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + +enum color { + rgb(isize, isize, isize), + rgba(isize, isize, isize, isize), + hsl(isize, isize, isize), +} + +fn process(c: color) -> isize { + let mut x: isize; + match c { + color::rgb(r, _, _) => { x = r; } + color::rgba(_, _, _, a) => { x = a; } + color::hsl(_, s, _) => { x = s; } + } + return x; +} + +pub fn main() { + let gray: color = color::rgb(127, 127, 127); + let clear: color = color::rgba(50, 150, 250, 0); + let red: color = color::hsl(0, 255, 255); + assert_eq!(process(gray), 127); + assert_eq!(process(clear), 0); + assert_eq!(process(red), 255); +} diff --git a/src/test/run-pass/binding/match-unique-bind.rs b/src/test/run-pass/binding/match-unique-bind.rs new file mode 100644 index 00000000000..a543527586f --- /dev/null +++ b/src/test/run-pass/binding/match-unique-bind.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_patterns)] +#![feature(box_syntax)] + +pub fn main() { + match box 100 { + box x => { + println!("{}", x); + assert_eq!(x, 100); + } + } +} diff --git a/src/test/run-pass/binding/match-unsized.rs b/src/test/run-pass/binding/match-unsized.rs new file mode 100644 index 00000000000..2e2f0f0b7ea --- /dev/null +++ b/src/test/run-pass/binding/match-unsized.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let data: &'static str = "Hello, World!"; + match data { + &ref xs => { + assert_eq!(data, xs); + } + } +} diff --git a/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs b/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs new file mode 100644 index 00000000000..a24a38af22f --- /dev/null +++ b/src/test/run-pass/binding/match-value-binding-in-guard-3291.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +fn foo(x: Option>, b: bool) -> isize { + match x { + None => { 1 } + Some(ref x) if b => { *x.clone() } + Some(_) => { 0 } + } +} + +pub fn main() { + foo(Some(box 22), true); + foo(Some(box 22), false); + foo(None, true); + foo(None, false); +} diff --git a/src/test/run-pass/binding/match-var-hygiene.rs b/src/test/run-pass/binding/match-var-hygiene.rs new file mode 100644 index 00000000000..5d4347559f7 --- /dev/null +++ b/src/test/run-pass/binding/match-var-hygiene.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// shouldn't affect evaluation of $ex. +macro_rules! bad_macro { ($ex:expr) => ( + {match 9 {_x => $ex}} +)} + +fn main() { + match 8 { + _x => assert_eq!(bad_macro!(_x),8) + } +} diff --git a/src/test/run-pass/binding/match-vec-alternatives.rs b/src/test/run-pass/binding/match-vec-alternatives.rs new file mode 100644 index 00000000000..4c728924556 --- /dev/null +++ b/src/test/run-pass/binding/match-vec-alternatives.rs @@ -0,0 +1,91 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { + match (l1, l2) { + (&[], &[]) => "both empty", + (&[], &[..]) | (&[..], &[]) => "one empty", + (&[..], &[..]) => "both non-empty" + } +} + +fn match_vecs_cons<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { + match (l1, l2) { + (&[], &[]) => "both empty", + (&[], &[_, ..]) | (&[_, ..], &[]) => "one empty", + (&[_, ..], &[_, ..]) => "both non-empty" + } +} + +fn match_vecs_snoc<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { + match (l1, l2) { + (&[], &[]) => "both empty", + (&[], &[.., _]) | (&[.., _], &[]) => "one empty", + (&[.., _], &[.., _]) => "both non-empty" + } +} + +fn match_nested_vecs_cons<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { + match (l1, l2) { + (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", + (Some(&[_, ..]), Ok(_)) | (Some(&[_, ..]), Err(())) => "Some(non-empty), any", + (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", + (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", + _ => "other" + } +} + +fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { + match (l1, l2) { + (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", + (Some(&[.., _]), Ok(_)) | (Some(&[.., _]), Err(())) => "Some(non-empty), any", + (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", + (None, Ok(&[.., _, _])) => "None, Ok(at least two elements)", + _ => "other" + } +} + +fn main() { + assert_eq!(match_vecs(&[1, 2], &[2, 3]), "both non-empty"); + assert_eq!(match_vecs(&[], &[1, 2, 3, 4]), "one empty"); + assert_eq!(match_vecs::(&[], &[]), "both empty"); + assert_eq!(match_vecs(&[1, 2, 3], &[]), "one empty"); + + assert_eq!(match_vecs_cons(&[1, 2], &[2, 3]), "both non-empty"); + assert_eq!(match_vecs_cons(&[], &[1, 2, 3, 4]), "one empty"); + assert_eq!(match_vecs_cons::(&[], &[]), "both empty"); + assert_eq!(match_vecs_cons(&[1, 2, 3], &[]), "one empty"); + + assert_eq!(match_vecs_snoc(&[1, 2], &[2, 3]), "both non-empty"); + assert_eq!(match_vecs_snoc(&[], &[1, 2, 3, 4]), "one empty"); + assert_eq!(match_vecs_snoc::(&[], &[]), "both empty"); + assert_eq!(match_vecs_snoc(&[1, 2, 3], &[]), "one empty"); + + assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), + "None, Ok(at least two elements)"); + assert_eq!(match_nested_vecs_cons::(None, Err(())), "None, Ok(less than one element)"); + assert_eq!(match_nested_vecs_cons::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), + "Some(empty), Ok(empty)"); + assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); + assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), + "Some(non-empty), any"); + + assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), + "None, Ok(at least two elements)"); + assert_eq!(match_nested_vecs_snoc::(None, Err(())), "None, Ok(less than one element)"); + assert_eq!(match_nested_vecs_snoc::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), + "Some(empty), Ok(empty)"); + assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); + assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), + "Some(non-empty), any"); +} diff --git a/src/test/run-pass/binding/match-vec-rvalue.rs b/src/test/run-pass/binding/match-vec-rvalue.rs new file mode 100644 index 00000000000..308a4938b3a --- /dev/null +++ b/src/test/run-pass/binding/match-vec-rvalue.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that matching rvalues with drops does not crash. + + + +pub fn main() { + match vec![1, 2, 3] { + x => { + assert_eq!(x.len(), 3); + assert_eq!(x[0], 1); + assert_eq!(x[1], 2); + assert_eq!(x[2], 3); + } + } +} diff --git a/src/test/run-pass/binding/match-with-ret-arm.rs b/src/test/run-pass/binding/match-with-ret-arm.rs new file mode 100644 index 00000000000..fe7aa288d52 --- /dev/null +++ b/src/test/run-pass/binding/match-with-ret-arm.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + // sometimes we have had trouble finding + // the right type for f, as we unified + // bot and u32 here + let f = match "1234".parse::().ok() { + None => return (), + Some(num) => num as u32 + }; + assert_eq!(f, 1234); + println!("{}", f) +} diff --git a/src/test/run-pass/binding/multi-let.rs b/src/test/run-pass/binding/multi-let.rs new file mode 100644 index 00000000000..6ecd84d8c58 --- /dev/null +++ b/src/test/run-pass/binding/multi-let.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = 10; + let y = x; + assert_eq!(y, 10); +} diff --git a/src/test/run-pass/binding/mut-in-ident-patterns.rs b/src/test/run-pass/binding/mut-in-ident-patterns.rs new file mode 100644 index 00000000000..1e28b77f2ce --- /dev/null +++ b/src/test/run-pass/binding/mut-in-ident-patterns.rs @@ -0,0 +1,84 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_shorthand_field_patterns)] + +trait Foo { + fn foo(&self, mut x: isize) -> isize { + let val = x; + x = 37 * x; + val + x + } +} + +struct X; +impl Foo for X {} + +pub fn main() { + let (a, mut b) = (23, 4); + assert_eq!(a, 23); + assert_eq!(b, 4); + b = a + b; + assert_eq!(b, 27); + + + assert_eq!(X.foo(2), 76); + + enum Bar { + Foo(isize), + Baz(f32, u8) + } + + let (x, mut y) = (32, Bar::Foo(21)); + + match x { + mut z @ 32 => { + assert_eq!(z, 32); + z = 34; + assert_eq!(z, 34); + } + _ => {} + } + + check_bar(&y); + y = Bar::Baz(10.0, 3); + check_bar(&y); + + fn check_bar(y: &Bar) { + match y { + &Bar::Foo(a) => { + assert_eq!(a, 21); + } + &Bar::Baz(a, b) => { + assert_eq!(a, 10.0); + assert_eq!(b, 3); + } + } + } + + fn foo1((x, mut y): (f64, isize), mut z: isize) -> isize { + y = 2 * 6; + z = y + (x as isize); + y - z + } + + struct A { + x: isize + } + let A { x: mut x } = A { x: 10 }; + assert_eq!(x, 10); + x = 30; + assert_eq!(x, 30); + + (|A { x: mut t }: A| { t = t+1; t })(A { x: 34 }); + +} diff --git a/src/test/run-pass/binding/nested-exhaustive-match.rs b/src/test/run-pass/binding/nested-exhaustive-match.rs new file mode 100644 index 00000000000..8456e63d4c7 --- /dev/null +++ b/src/test/run-pass/binding/nested-exhaustive-match.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo { foo: bool, bar: Option, baz: isize } + +pub fn main() { + match (Foo{foo: true, bar: Some(10), baz: 20}) { + Foo{foo: true, bar: Some(_), ..} => {} + Foo{foo: false, bar: None, ..} => {} + Foo{foo: true, bar: None, ..} => {} + Foo{foo: false, bar: Some(_), ..} => {} + } +} diff --git a/src/test/run-pass/binding/nested-matchs.rs b/src/test/run-pass/binding/nested-matchs.rs new file mode 100644 index 00000000000..e1012f3b384 --- /dev/null +++ b/src/test/run-pass/binding/nested-matchs.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn baz() -> ! { panic!(); } + +fn foo() { + match Some::(5) { + Some::(_x) => { + let mut bar; + match None:: { None:: => { bar = 5; } _ => { baz(); } } + println!("{}", bar); + } + None:: => { println!("hello"); } + } +} + +pub fn main() { foo(); } diff --git a/src/test/run-pass/binding/nested-pattern.rs b/src/test/run-pass/binding/nested-pattern.rs new file mode 100644 index 00000000000..5bf558a4871 --- /dev/null +++ b/src/test/run-pass/binding/nested-pattern.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// a bug was causing this to complain about leaked memory on exit + +enum t { foo(isize, usize), bar(isize, Option), } + +fn nested(o: t) { + match o { + t::bar(_i, Some::(_)) => { println!("wrong pattern matched"); panic!(); } + _ => { println!("succeeded"); } + } +} + +pub fn main() { nested(t::bar(1, None::)); } diff --git a/src/test/run-pass/binding/nil-pattern.rs b/src/test/run-pass/binding/nil-pattern.rs new file mode 100644 index 00000000000..39b2f2da624 --- /dev/null +++ b/src/test/run-pass/binding/nil-pattern.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { let x = (); match x { () => { } } } diff --git a/src/test/run-pass/binding/nullary-or-pattern.rs b/src/test/run-pass/binding/nullary-or-pattern.rs new file mode 100644 index 00000000000..892464dd1db --- /dev/null +++ b/src/test/run-pass/binding/nullary-or-pattern.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum blah { a, b, } + +fn or_alt(q: blah) -> isize { + match q { blah::a | blah::b => { 42 } } +} + +pub fn main() { + assert_eq!(or_alt(blah::a), 42); + assert_eq!(or_alt(blah::b), 42); +} diff --git a/src/test/run-pass/binding/optional_comma_in_match_arm.rs b/src/test/run-pass/binding/optional_comma_in_match_arm.rs new file mode 100644 index 00000000000..90ef3c2b7ea --- /dev/null +++ b/src/test/run-pass/binding/optional_comma_in_match_arm.rs @@ -0,0 +1,49 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37199 +#![allow(while_true)] + +fn main() { + let x = 1; + + match x { + 1 => loop { break; }, + 2 => while true { break; }, + 3 => if true { () }, + 4 => if true { () } else { () }, + 5 => match () { () => () }, + 6 => { () }, + 7 => unsafe { () }, + _ => (), + } + + match x { + 1 => loop { break; } + 2 => while true { break; } + 3 => if true { () } + 4 => if true { () } else { () } + 5 => match () { () => () } + 6 => { () } + 7 => unsafe { () } + _ => () + } + + let r: &i32 = &x; + + match r { + // Absence of comma should not cause confusion between a pattern + // and a bitwise and. + &1 => if true { () } else { () } + &2 => (), + _ =>() + } +} diff --git a/src/test/run-pass/binding/or-pattern.rs b/src/test/run-pass/binding/or-pattern.rs new file mode 100644 index 00000000000..a9b3e278652 --- /dev/null +++ b/src/test/run-pass/binding/or-pattern.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum blah { a(isize, isize, usize), b(isize, isize), c, } + +fn or_alt(q: blah) -> isize { + match q { blah::a(x, y, _) | blah::b(x, y) => { return x + y; } blah::c => { return 0; } } +} + +pub fn main() { + assert_eq!(or_alt(blah::c), 0); + assert_eq!(or_alt(blah::a(10, 100, 0)), 110); + assert_eq!(or_alt(blah::b(20, 200)), 220); +} diff --git a/src/test/run-pass/binding/order-drop-with-match.rs b/src/test/run-pass/binding/order-drop-with-match.rs new file mode 100644 index 00000000000..7bb929325ad --- /dev/null +++ b/src/test/run-pass/binding/order-drop-with-match.rs @@ -0,0 +1,67 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test to make sure the destructors run in the right order. +// Each destructor sets it's tag in the corresponding entry +// in ORDER matching up to when it ran. +// Correct order is: matched, inner, outer + + +static mut ORDER: [usize; 3] = [0, 0, 0]; +static mut INDEX: usize = 0; + +struct A; +impl Drop for A { + fn drop(&mut self) { + unsafe { + ORDER[INDEX] = 1; + INDEX = INDEX + 1; + } + } +} + +struct B; +impl Drop for B { + fn drop(&mut self) { + unsafe { + ORDER[INDEX] = 2; + INDEX = INDEX + 1; + } + } +} + +struct C; +impl Drop for C { + fn drop(&mut self) { + unsafe { + ORDER[INDEX] = 3; + INDEX = INDEX + 1; + } + } +} + +fn main() { + { + let matched = A; + let _outer = C; + { + match matched { + _s => {} + } + let _inner = B; + } + } + unsafe { + let expected: &[_] = &[1, 2, 3]; + assert_eq!(expected, ORDER); + } +} diff --git a/src/test/run-pass/binding/pat-ranges.rs b/src/test/run-pass/binding/pat-ranges.rs new file mode 100644 index 00000000000..44666eda3ca --- /dev/null +++ b/src/test/run-pass/binding/pat-ranges.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Parsing of range patterns + +const NUM1: i32 = 10; + +mod m { + pub const NUM2: i32 = 16; +} + +fn main() { + if let NUM1 ... m::NUM2 = 10 {} else { panic!() } + if let ::NUM1 ... ::m::NUM2 = 11 {} else { panic!() } + if let -13 ... -10 = 12 { panic!() } else {} +} diff --git a/src/test/run-pass/binding/pat-tuple-1.rs b/src/test/run-pass/binding/pat-tuple-1.rs new file mode 100644 index 00000000000..dc8a7ff7a07 --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-1.rs @@ -0,0 +1,103 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn tuple() { + let x = (1, 2, 3); + match x { + (a, b, ..) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + } + } + match x { + (.., b, c) => { + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + (a, .., c) => { + assert_eq!(a, 1); + assert_eq!(c, 3); + } + } + match x { + (a, b, c) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + (a, b, c, ..) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + (.., a, b, c) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } +} + +fn tuple_struct() { + struct S(u8, u8, u8); + + let x = S(1, 2, 3); + match x { + S(a, b, ..) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + } + } + match x { + S(.., b, c) => { + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + S(a, .., c) => { + assert_eq!(a, 1); + assert_eq!(c, 3); + } + } + match x { + S(a, b, c) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + S(a, b, c, ..) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } + match x { + S(.., a, b, c) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + } + } +} + +fn main() { + tuple(); + tuple_struct(); +} diff --git a/src/test/run-pass/binding/pat-tuple-2.rs b/src/test/run-pass/binding/pat-tuple-2.rs new file mode 100644 index 00000000000..0428e32c43b --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-2.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn tuple() { + let x = (1,); + match x { + (2, ..) => panic!(), + (..) => () + } +} + +fn tuple_struct() { + struct S(u8); + + let x = S(1); + match x { + S(2, ..) => panic!(), + S(..) => () + } +} + +fn main() { + tuple(); + tuple_struct(); +} diff --git a/src/test/run-pass/binding/pat-tuple-3.rs b/src/test/run-pass/binding/pat-tuple-3.rs new file mode 100644 index 00000000000..60b933e4ce4 --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-3.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn tuple() { + let x = (1, 2, 3); + let branch = match x { + (1, 1, ..) => 0, + (1, 2, 3, ..) => 1, + (1, 2, ..) => 2, + _ => 3 + }; + assert_eq!(branch, 1); +} + +fn tuple_struct() { + struct S(u8, u8, u8); + + let x = S(1, 2, 3); + let branch = match x { + S(1, 1, ..) => 0, + S(1, 2, 3, ..) => 1, + S(1, 2, ..) => 2, + _ => 3 + }; + assert_eq!(branch, 1); +} + +fn main() { + tuple(); + tuple_struct(); +} diff --git a/src/test/run-pass/binding/pat-tuple-4.rs b/src/test/run-pass/binding/pat-tuple-4.rs new file mode 100644 index 00000000000..cd19f2c67a1 --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-4.rs @@ -0,0 +1,67 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn tuple() { + let x = (1, 2, 3); + match x { + (1, 2, 4) => unreachable!(), + (0, 2, 3, ..) => unreachable!(), + (0, .., 3) => unreachable!(), + (0, ..) => unreachable!(), + (1, 2, 3) => (), + (_, _, _) => unreachable!(), + } + match x { + (..) => (), + } + match x { + (_, _, _, ..) => (), + } + match x { + (a, b, c) => { + assert_eq!(1, a); + assert_eq!(2, b); + assert_eq!(3, c); + } + } +} + +fn tuple_struct() { + struct S(u8, u8, u8); + + let x = S(1, 2, 3); + match x { + S(1, 2, 4) => unreachable!(), + S(0, 2, 3, ..) => unreachable!(), + S(0, .., 3) => unreachable!(), + S(0, ..) => unreachable!(), + S(1, 2, 3) => (), + S(_, _, _) => unreachable!(), + } + match x { + S(..) => (), + } + match x { + S(_, _, _, ..) => (), + } + match x { + S(a, b, c) => { + assert_eq!(1, a); + assert_eq!(2, b); + assert_eq!(3, c); + } + } +} + +fn main() { + tuple(); + tuple_struct(); +} diff --git a/src/test/run-pass/binding/pat-tuple-5.rs b/src/test/run-pass/binding/pat-tuple-5.rs new file mode 100644 index 00000000000..0ac4c24c4ee --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-5.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn tuple() { + struct S; + struct Z; + struct W; + let x = (S, Z, W); + match x { (S, ..) => {} } + match x { (.., W) => {} } + match x { (S, .., W) => {} } + match x { (.., Z, _) => {} } +} + +fn tuple_struct() { + struct SS(S, Z, W); + + struct S; + struct Z; + struct W; + let x = SS(S, Z, W); + match x { SS(S, ..) => {} } + match x { SS(.., W) => {} } + match x { SS(S, .., W) => {} } + match x { SS(.., Z, _) => {} } +} + +fn main() { + tuple(); + tuple_struct(); +} diff --git a/src/test/run-pass/binding/pat-tuple-6.rs b/src/test/run-pass/binding/pat-tuple-6.rs new file mode 100644 index 00000000000..b3cd0e1b543 --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-6.rs @@ -0,0 +1,55 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn tuple() { + let x = (1, 2, 3, 4, 5); + match x { + (a, .., b, c) => { + assert_eq!(a, 1); + assert_eq!(b, 4); + assert_eq!(c, 5); + } + } + match x { + (a, b, c, .., d) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + assert_eq!(d, 5); + } + } +} + +fn tuple_struct() { + struct S(u8, u8, u8, u8, u8); + + let x = S(1, 2, 3, 4, 5); + match x { + S(a, .., b, c) => { + assert_eq!(a, 1); + assert_eq!(b, 4); + assert_eq!(c, 5); + } + } + match x { + S(a, b, c, .., d) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + assert_eq!(d, 5); + } + } +} + +fn main() { + tuple(); + tuple_struct(); +} diff --git a/src/test/run-pass/binding/pat-tuple-7.rs b/src/test/run-pass/binding/pat-tuple-7.rs new file mode 100644 index 00000000000..c32b52eac33 --- /dev/null +++ b/src/test/run-pass/binding/pat-tuple-7.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + match 0 { + (pat) => assert_eq!(pat, 0) + } +} diff --git a/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs b/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs new file mode 100644 index 00000000000..2ee697fe2ff --- /dev/null +++ b/src/test/run-pass/binding/pattern-bound-var-in-for-each.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that codegen_path checks whether a +// pattern-bound var is an upvar (when codegenning +// the for-each body) + + +fn foo(src: usize) { + + match Some(src) { + Some(src_id) => { + for _i in 0_usize..10_usize { + let yyy = src_id; + assert_eq!(yyy, 0_usize); + } + } + _ => { } + } +} + +pub fn main() { foo(0_usize); } diff --git a/src/test/run-pass/binding/pattern-in-closure.rs b/src/test/run-pass/binding/pattern-in-closure.rs new file mode 100644 index 00000000000..9a5a420a80b --- /dev/null +++ b/src/test/run-pass/binding/pattern-in-closure.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct Foo { + x: isize, + y: isize +} + +pub fn main() { + let f = |(x, _): (isize, isize)| println!("{}", x + 1); + let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1); + f((2, 3)); + g(Foo { x: 1, y: 2 }); +} diff --git a/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs b/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs new file mode 100644 index 00000000000..d492edb1617 --- /dev/null +++ b/src/test/run-pass/binding/range-inclusive-pattern-precedence.rs @@ -0,0 +1,33 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_patterns)] + +const VALUE: usize = 21; + +pub fn main() { + match &18 { + &(18..=18) => {} + _ => { unreachable!(); } + } + match &21 { + &(VALUE..=VALUE) => {} + _ => { unreachable!(); } + } + match Box::new(18) { + box (18..=18) => {} + _ => { unreachable!(); } + } + match Box::new(21) { + box (VALUE..=VALUE) => {} + _ => { unreachable!(); } + } +} diff --git a/src/test/run-pass/binding/simple-generic-match.rs b/src/test/run-pass/binding/simple-generic-match.rs new file mode 100644 index 00000000000..13c16790e09 --- /dev/null +++ b/src/test/run-pass/binding/simple-generic-match.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum clam { a(T), } + +pub fn main() { let c = clam::a(2); match c { clam::a::(_) => { } } } diff --git a/src/test/run-pass/binding/use-uninit-match.rs b/src/test/run-pass/binding/use-uninit-match.rs new file mode 100644 index 00000000000..1fc597b636e --- /dev/null +++ b/src/test/run-pass/binding/use-uninit-match.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +fn foo(o: myoption) -> isize { + let mut x: isize = 5; + match o { + myoption::none:: => { } + myoption::some::(_t) => { x += 1; } + } + return x; +} + +enum myoption { none, some(T), } + +pub fn main() { println!("{}", 5); } diff --git a/src/test/run-pass/binding/use-uninit-match2.rs b/src/test/run-pass/binding/use-uninit-match2.rs new file mode 100644 index 00000000000..8eb44fd76e1 --- /dev/null +++ b/src/test/run-pass/binding/use-uninit-match2.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +fn foo(o: myoption) -> isize { + let mut x: isize; + match o { + myoption::none:: => { panic!(); } + myoption::some::(_t) => { x = 5; } + } + return x; +} + +enum myoption { none, some(T), } + +pub fn main() { println!("{}", 5); } diff --git a/src/test/run-pass/binding/zero_sized_subslice_match.rs b/src/test/run-pass/binding/zero_sized_subslice_match.rs new file mode 100644 index 00000000000..db71d97a19d --- /dev/null +++ b/src/test/run-pass/binding/zero_sized_subslice_match.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn main() { + let x = [(), ()]; + + // The subslice used to go out of bounds for zero-sized array items, check that this doesn't + // happen anymore + match x { + [_, ref y..] => assert_eq!(&x[1] as *const (), &y[0] as *const ()) + } +} diff --git a/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs b/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs new file mode 100644 index 00000000000..248e34bde09 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-assign-to-subfield.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + struct A { + a: isize, + w: B, + } + struct B { + a: isize + } + let mut p = A { + a: 1, + w: B {a: 1}, + }; + + // even though `x` is not declared as a mutable field, + // `p` as a whole is mutable, so it can be modified. + p.a = 2; + + // this is true for an interior field too + p.w.a = 2; +} diff --git a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs new file mode 100644 index 00000000000..fa79ac84c86 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641) + +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + +static mut Y: u32 = 0; + +unsafe fn should_ok() { + Y = 1; +} + +fn main() {} diff --git a/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs b/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs new file mode 100644 index 00000000000..86875a038da --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-binding-mutbl.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct F { f: Vec } + +fn impure(_v: &[isize]) { +} + +pub fn main() { + let mut x = F {f: vec![3]}; + + match x { + F {f: ref mut v} => { + impure(v); + } + } +} diff --git a/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs b/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs new file mode 100644 index 00000000000..b85a9baf5a0 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-borrow-from-expr-block.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn borrow(x: &isize, f: F) where F: FnOnce(&isize) { + f(x) +} + +fn test1(x: &Box) { + borrow(&*(*x).clone(), |p| { + let x_a = &**x as *const isize; + assert!((x_a as usize) != (p as *const isize as usize)); + assert_eq!(unsafe{*x_a}, *p); + }) +} + +pub fn main() { + test1(&box 22); +} diff --git a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs new file mode 100644 index 00000000000..72634651d95 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that freezing an `&mut` pointer while referent is +// frozen is legal. +// +// Example from src/librustc_borrowck/borrowck/README.md + +// pretty-expanded FIXME #23616 + +fn foo<'a>(mut t0: &'a mut isize, + mut t1: &'a mut isize) { + let p: &isize = &*t0; // Freezes `*t0` + let mut t2 = &t0; + let q: &isize = &**t2; // Freezes `*t0`, but that's ok... + let r: &isize = &*t0; // ...after all, could do same thing directly. +} + +pub fn main() { +} diff --git a/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs b/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs new file mode 100644 index 00000000000..8c6d92c9962 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-closures-two-imm.rs @@ -0,0 +1,51 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that two closures can simultaneously have immutable +// access to the variable, whether that immutable access be used +// for direct reads or for taking immutable ref. Also check +// that the main function can read the variable too while +// the closures are in scope. Issue #6801. + + +fn a() -> i32 { + let mut x = 3; + x += 1; + let c1 = || x * 4; + let c2 = || x * 5; + c1() * c2() * x +} + +fn get(x: &i32) -> i32 { + *x * 4 +} + +fn b() -> i32 { + let mut x = 3; + x += 1; + let c1 = || get(&x); + let c2 = || get(&x); + c1() * c2() * x +} + +fn c() -> i32 { + let mut x = 3; + x += 1; + let c1 = || x * 5; + let c2 = || get(&x); + c1() * c2() * x +} + +pub fn main() { + assert_eq!(a(), 1280); + assert_eq!(b(), 1024); + assert_eq!(c(), 1280); +} diff --git a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs new file mode 100644 index 00000000000..a3d6f129f18 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs @@ -0,0 +1,274 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +struct A { a: isize, b: Box } +struct B { a: Box, b: Box } + +fn move_after_copy() { + let x = A { a: 1, b: box 2 }; + drop(x.a); + drop(x.b); +} + +fn move_after_fu_copy() { + let x = A { a: 1, b: box 2 }; + let _y = A { b: box 3, .. x }; + drop(x.b); +} + +fn fu_move_after_copy() { + let x = A { a: 1, b: box 2 }; + drop(x.a); + let _y = A { a: 3, .. x }; +} + +fn fu_move_after_fu_copy() { + let x = A { a: 1, b: box 2 }; + let _y = A { b: box 3, .. x }; + let _z = A { a: 4, .. x }; +} + +fn copy_after_move() { + let x = A { a: 1, b: box 2 }; + drop(x.b); + drop(x.a); +} + +fn copy_after_fu_move() { + let x = A { a: 1, b: box 2 }; + let y = A { a: 3, .. x }; + drop(x.a); +} + +fn fu_copy_after_move() { + let x = A { a: 1, b: box 2 }; + drop(x.b); + let _y = A { b: box 3, .. x }; +} + +fn fu_copy_after_fu_move() { + let x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + let _z = A { b: box 3, .. x }; +} + +fn borrow_after_move() { + let x = A { a: 1, b: box 2 }; + drop(x.b); + let p = &x.a; + drop(*p); +} + +fn borrow_after_fu_move() { + let x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + let p = &x.a; + drop(*p); +} + +fn move_after_borrow() { + let x = A { a: 1, b: box 2 }; + let p = &x.a; + drop(x.b); + drop(*p); +} + +fn fu_move_after_borrow() { + let x = A { a: 1, b: box 2 }; + let p = &x.a; + let _y = A { a: 3, .. x }; + drop(*p); +} + +fn mut_borrow_after_mut_borrow() { + let mut x = A { a: 1, b: box 2 }; + let p = &mut x.a; + let q = &mut x.b; + drop(*p); + drop(**q); +} + +fn move_after_move() { + let x = B { a: box 1, b: box 2 }; + drop(x.a); + drop(x.b); +} + +fn move_after_fu_move() { + let x = B { a: box 1, b: box 2 }; + let y = B { a: box 3, .. x }; + drop(x.a); +} + +fn fu_move_after_move() { + let x = B { a: box 1, b: box 2 }; + drop(x.a); + let z = B { a: box 3, .. x }; + drop(z.b); +} + +fn fu_move_after_fu_move() { + let x = B { a: box 1, b: box 2 }; + let _y = B { b: box 3, .. x }; + let _z = B { a: box 4, .. x }; +} + +fn copy_after_assign_after_move() { + let mut x = A { a: 1, b: box 2 }; + drop(x.b); + x = A { a: 3, b: box 4 }; + drop(*x.b); +} + +fn copy_after_assign_after_fu_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + x = A { a: 3, b: box 4 }; + drop(*x.b); +} + +fn copy_after_field_assign_after_move() { + let mut x = A { a: 1, b: box 2 }; + drop(x.b); + x.b = box 3; + drop(*x.b); +} + +fn copy_after_field_assign_after_fu_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + x.b = box 3; + drop(*x.b); +} + +fn borrow_after_assign_after_move() { + let mut x = A { a: 1, b: box 2 }; + drop(x.b); + x = A { a: 3, b: box 4 }; + let p = &x.b; + drop(**p); +} + +fn borrow_after_assign_after_fu_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + x = A { a: 3, b: box 4 }; + let p = &x.b; + drop(**p); +} + +fn borrow_after_field_assign_after_move() { + let mut x = A { a: 1, b: box 2 }; + drop(x.b); + x.b = box 3; + let p = &x.b; + drop(**p); +} + +fn borrow_after_field_assign_after_fu_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + x.b = box 3; + let p = &x.b; + drop(**p); +} + +fn move_after_assign_after_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = x.b; + x = A { a: 3, b: box 4 }; + drop(x.b); +} + +fn move_after_assign_after_fu_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + x = A { a: 3, b: box 4 }; + drop(x.b); +} + +fn move_after_field_assign_after_move() { + let mut x = A { a: 1, b: box 2 }; + drop(x.b); + x.b = box 3; + drop(x.b); +} + +fn move_after_field_assign_after_fu_move() { + let mut x = A { a: 1, b: box 2 }; + let _y = A { a: 3, .. x }; + x.b = box 3; + drop(x.b); +} + +fn copy_after_assign_after_uninit() { + let mut x: A; + x = A { a: 1, b: box 2 }; + drop(x.a); +} + +fn borrow_after_assign_after_uninit() { + let mut x: A; + x = A { a: 1, b: box 2 }; + let p = &x.a; + drop(*p); +} + +fn move_after_assign_after_uninit() { + let mut x: A; + x = A { a: 1, b: box 2 }; + drop(x.b); +} + +fn main() { + move_after_copy(); + move_after_fu_copy(); + fu_move_after_copy(); + fu_move_after_fu_copy(); + copy_after_move(); + copy_after_fu_move(); + fu_copy_after_move(); + fu_copy_after_fu_move(); + + borrow_after_move(); + borrow_after_fu_move(); + move_after_borrow(); + fu_move_after_borrow(); + mut_borrow_after_mut_borrow(); + + move_after_move(); + move_after_fu_move(); + fu_move_after_move(); + fu_move_after_fu_move(); + + copy_after_assign_after_move(); + copy_after_assign_after_fu_move(); + copy_after_field_assign_after_move(); + copy_after_field_assign_after_fu_move(); + + borrow_after_assign_after_move(); + borrow_after_assign_after_fu_move(); + borrow_after_field_assign_after_move(); + borrow_after_field_assign_after_fu_move(); + + move_after_assign_after_move(); + move_after_assign_after_fu_move(); + move_after_field_assign_after_move(); + move_after_field_assign_after_fu_move(); + + copy_after_assign_after_uninit(); + borrow_after_assign_after_uninit(); + move_after_assign_after_uninit(); +} diff --git a/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs b/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs new file mode 100644 index 00000000000..baefdf657ea --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-fixed-length-vecs.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = [22]; + let y = &x[0]; + assert_eq!(*y, 22); +} diff --git a/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs b/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs new file mode 100644 index 00000000000..0ddb71d1d15 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-freeze-frozen-mut.rs @@ -0,0 +1,38 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a `&mut` inside of an `&` is freezable. + + +struct MutSlice<'a, T:'a> { + data: &'a mut [T] +} + +fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: usize) -> &'a T { + &ms.data[index] +} + +pub fn main() { + let mut data = [1, 2, 3]; + { + let slice = MutSlice { data: &mut data }; + slice.data[0] += 4; + let index0 = get(&slice, 0); + let index1 = get(&slice, 1); + let index2 = get(&slice, 2); + assert_eq!(*index0, 5); + assert_eq!(*index1, 2); + assert_eq!(*index2, 3); + } + assert_eq!(data[0], 5); + assert_eq!(data[1], 2); + assert_eq!(data[2], 3); +} diff --git a/src/test/run-pass/borrowck/borrowck-lend-args.rs b/src/test/run-pass/borrowck/borrowck-lend-args.rs new file mode 100644 index 00000000000..4ec7e0a5898 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-lend-args.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +fn borrow(_v: &isize) {} + +fn borrow_from_arg_imm_ref(v: Box) { + borrow(&*v); +} + +fn borrow_from_arg_mut_ref(v: &mut Box) { + borrow(&**v); +} + +fn borrow_from_arg_copy(v: Box) { + borrow(&*v); +} + +pub fn main() { +} diff --git a/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs b/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs new file mode 100644 index 00000000000..3f81c2e5619 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs @@ -0,0 +1,46 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unconditional_recursion)] + +// Check that we do not ICE when compiling this +// macro, which reuses the expression `$id` + + +#![feature(box_patterns)] +#![feature(box_syntax)] + +struct Foo { + a: isize +} + +pub enum Bar { + Bar1, Bar2(isize, Box), +} + +impl Foo { + fn elaborate_stm(&mut self, s: Box) -> Box { + macro_rules! declare { + ($id:expr, $rest:expr) => ({ + self.check_id($id); + box Bar::Bar2($id, $rest) + }) + } + match s { + box Bar::Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)), + _ => panic!() + } + } + + fn check_id(&mut self, s: isize) { panic!() } +} + +pub fn main() { } diff --git a/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs b/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs new file mode 100644 index 00000000000..180a6ad8f87 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-move-by-capture-ok.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let bar: Box<_> = box 3; + let h = || -> isize { *bar }; + assert_eq!(h(), 3); +} diff --git a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs new file mode 100644 index 00000000000..4650ce8d2c4 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs @@ -0,0 +1,30 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test case from #39963. + +#![feature(nll)] + +#[derive(Clone)] +struct Foo(Option>, Option>); + +fn test(f: &mut Foo) { + match *f { + Foo(Some(ref mut left), Some(ref mut right)) => match **left { + Foo(Some(ref mut left), Some(ref mut right)) => panic!(), + _ => panic!(), + }, + _ => panic!(), + } +} + +fn main() { +} diff --git a/src/test/run-pass/borrowck/borrowck-mut-uniq.rs b/src/test/run-pass/borrowck/borrowck-mut-uniq.rs new file mode 100644 index 00000000000..87dd1f1de53 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-mut-uniq.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::mem::swap; + +#[derive(Debug)] +struct Ints {sum: Box, values: Vec } + +fn add_int(x: &mut Ints, v: isize) { + *x.sum += v; + let mut values = Vec::new(); + swap(&mut values, &mut x.values); + values.push(v); + swap(&mut values, &mut x.values); +} + +fn iter_ints(x: &Ints, mut f: F) -> bool where F: FnMut(&isize) -> bool { + let l = x.values.len(); + (0..l).all(|i| f(&x.values[i])) +} + +pub fn main() { + let mut ints: Box<_> = box Ints {sum: box 0, values: Vec::new()}; + add_int(&mut *ints, 22); + add_int(&mut *ints, 44); + + iter_ints(&*ints, |i| { + println!("isize = {:?}", *i); + true + }); + + println!("ints={:?}", ints); +} diff --git a/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs b/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs new file mode 100644 index 00000000000..b616cf25382 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn want_slice(v: &[isize]) -> isize { + let mut sum = 0; + for i in v { sum += *i; } + sum +} + +fn has_mut_vec(v: Vec ) -> isize { + want_slice(&v) +} + +pub fn main() { + assert_eq!(has_mut_vec(vec![1, 2, 3]), 6); +} diff --git a/src/test/run-pass/borrowck/borrowck-pat-enum.rs b/src/test/run-pass/borrowck/borrowck-pat-enum.rs new file mode 100644 index 00000000000..3b9c4aed03e --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-pat-enum.rs @@ -0,0 +1,48 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37199 + +fn match_ref(v: Option) -> isize { + match v { + Some(ref i) => { + *i + } + None => {0} + } +} + +fn match_ref_unused(v: Option) { + match v { + Some(_) => {} + None => {} + } +} + +fn impure(_i: isize) { +} + +fn match_imm_reg(v: &Option) { + match *v { + Some(ref i) => {impure(*i)} // OK because immutable + None => {} + } +} + +fn match_mut_reg(v: &mut Option) { + match *v { + Some(ref i) => {impure(*i)} // OK, frozen + None => {} + } +} + +pub fn main() { +} diff --git a/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs b/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs new file mode 100644 index 00000000000..1ce7a00d423 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let mut x = None; + match x { + None => { + // It is ok to reassign x here, because there is in + // fact no outstanding loan of x! + x = Some(0); + } + Some(_) => { } + } + assert_eq!(x, Some(0)); +} diff --git a/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs b/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs new file mode 100644 index 00000000000..936e5565eed --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-rvalues-mutable.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Counter { + value: usize +} + +impl Counter { + fn new(v: usize) -> Counter { + Counter {value: v} + } + + fn inc<'a>(&'a mut self) -> &'a mut Counter { + self.value += 1; + self + } + + fn get(&self) -> usize { + self.value + } + + fn get_and_inc(&mut self) -> usize { + let v = self.value; + self.value += 1; + v + } +} + +pub fn main() { + let v = Counter::new(22).get_and_inc(); + assert_eq!(v, 22); + + let v = Counter::new(22).inc().inc().get(); + assert_eq!(v, 24); +} diff --git a/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs b/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs new file mode 100644 index 00000000000..dd832b9eee0 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs @@ -0,0 +1,52 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that the scope of the pointer returned from `get()` is +// limited to the deref operation itself, and does not infect the +// block as a whole. + + +struct Box { + x: usize +} + +impl Box { + fn get(&self) -> &usize { + &self.x + } + fn set(&mut self, x: usize) { + self.x = x; + } +} + +fn fun1() { + // in the past, borrow checker behaved differently when + // init and decl of `v` were distinct + let v; + let mut a_box = Box {x: 0}; + a_box.set(22); + v = *a_box.get(); + a_box.set(v+1); + assert_eq!(23, *a_box.get()); +} + +fn fun2() { + let mut a_box = Box {x: 0}; + a_box.set(22); + let v = *a_box.get(); + a_box.set(v+1); + assert_eq!(23, *a_box.get()); +} + +pub fn main() { + fun1(); + fun2(); +} diff --git a/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs b/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs new file mode 100644 index 00000000000..e7c1699f7b4 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +//compile-flags: -Z borrowck=mir + +#![feature(slice_patterns)] + +fn mut_head_tail<'a, A>(v: &'a mut [A]) -> Option<(&'a mut A, &'a mut [A])> { + match *v { + [ref mut head, ref mut tail..] => { + Some((head, tail)) + } + [] => None + } +} + +fn main() { + let mut v = [1,2,3,4]; + match mut_head_tail(&mut v) { + None => {}, + Some((h,t)) => { + *h = 1000; + t.reverse(); + } + } +} diff --git a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs new file mode 100644 index 00000000000..809948d5423 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #7740 + +// pretty-expanded FIXME #23616 + +pub fn main() { + static A: &'static char = &'A'; +} diff --git a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs new file mode 100644 index 00000000000..cf7a976628e --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test verifies that casting from the same lifetime on a value +// to the same lifetime on a trait succeeds. See issue #10766. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +use std::marker; + +fn main() { + trait T { fn foo(&self) {} } + + fn f<'a, V: T>(v: &'a V) -> &'a T { + v as &'a T + } +} diff --git a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs new file mode 100644 index 00000000000..f9b650e0e82 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs @@ -0,0 +1,58 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +struct Rec { + f: Box, +} + +struct Outer { + f: Inner +} + +struct Inner { + g: Innermost +} + +struct Innermost { + h: Box, +} + +fn borrow(_v: &isize) {} + +fn box_mut(v: &mut Box) { + borrow(&**v); // OK: &mut -> &imm +} + +fn box_mut_rec(v: &mut Rec) { + borrow(&*v.f); // OK: &mut -> &imm +} + +fn box_mut_recs(v: &mut Outer) { + borrow(&*v.f.g.h); // OK: &mut -> &imm +} + +fn box_imm(v: &Box) { + borrow(&**v); // OK +} + +fn box_imm_rec(v: &Rec) { + borrow(&*v.f); // OK +} + +fn box_imm_recs(v: &Outer) { + borrow(&*v.f.g.h); // OK +} + +pub fn main() { +} diff --git a/src/test/run-pass/borrowck/borrowck-univariant-enum.rs b/src/test/run-pass/borrowck/borrowck-univariant-enum.rs new file mode 100644 index 00000000000..0a8d3075336 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-univariant-enum.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +#[derive(Copy, Clone)] +enum newtype { + newvar(isize) +} + +pub fn main() { + + // Test that borrowck treats enums with a single variant + // specially. + + let x = &Cell::new(5); + let y = &Cell::new(newtype::newvar(3)); + let z = match y.get() { + newtype::newvar(b) => { + x.set(x.get() + 1); + x.get() * b + } + }; + assert_eq!(z, 18); +} diff --git a/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs new file mode 100644 index 00000000000..aba46ad609f --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs @@ -0,0 +1,32 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// revisions: ast mir +//[mir]compile-flags: -Z borrowck=mir + +// Test file taken from issue 45129 (https://github.com/rust-lang/rust/issues/45129) + +struct Foo { x: [usize; 2] } + +static mut SFOO: Foo = Foo { x: [23, 32] }; + +impl Foo { + fn x(&mut self) -> &mut usize { &mut self.x[0] } +} + +fn main() { + unsafe { + let sfoo: *mut Foo = &mut SFOO; + let x = (*sfoo).x(); + (*sfoo).x[1] += 1; + *x += 1; + } +} diff --git a/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs b/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs new file mode 100644 index 00000000000..15eaf83b508 --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-unused-mut-locals.rs @@ -0,0 +1,57 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(nll)] +#![deny(unused_mut)] + +#[derive(Debug)] +struct A {} + +fn init_a() -> A { + A {} +} + +#[derive(Debug)] +struct B<'a> { + ed: &'a mut A, +} + +fn init_b<'a>(ed: &'a mut A) -> B<'a> { + B { ed } +} + +#[derive(Debug)] +struct C<'a> { + pd: &'a mut B<'a>, +} + +fn init_c<'a>(pd: &'a mut B<'a>) -> C<'a> { + C { pd } +} + +#[derive(Debug)] +struct D<'a> { + sd: &'a mut C<'a>, +} + +fn init_d<'a>(sd: &'a mut C<'a>) -> D<'a> { + D { sd } +} + +fn main() { + let mut a = init_a(); + let mut b = init_b(&mut a); + let mut c = init_c(&mut b); + + let d = init_d(&mut c); + + println!("{:?}", d) +} diff --git a/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs new file mode 100644 index 00000000000..10809c1bb0b --- /dev/null +++ b/src/test/run-pass/borrowck/borrowck-use-mut-borrow.rs @@ -0,0 +1,61 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +struct A { a: isize, b: Box } + +fn field_copy_after_field_borrow() { + let mut x = A { a: 1, b: box 2 }; + let p = &mut x.b; + drop(x.a); + **p = 3; +} + +fn fu_field_copy_after_field_borrow() { + let mut x = A { a: 1, b: box 2 }; + let p = &mut x.b; + let y = A { b: box 3, .. x }; + drop(y); + **p = 4; +} + +fn field_deref_after_field_borrow() { + let mut x = A { a: 1, b: box 2 }; + let p = &mut x.a; + drop(*x.b); + *p = 3; +} + +fn field_move_after_field_borrow() { + let mut x = A { a: 1, b: box 2 }; + let p = &mut x.a; + drop(x.b); + *p = 3; +} + +fn fu_field_move_after_field_borrow() { + let mut x = A { a: 1, b: box 2 }; + let p = &mut x.a; + let y = A { a: 3, .. x }; + drop(y); + *p = 4; +} + +fn main() { + field_copy_after_field_borrow(); + fu_field_copy_after_field_borrow(); + field_deref_after_field_borrow(); + field_move_after_field_borrow(); + fu_field_move_after_field_borrow(); +} diff --git a/src/test/run-pass/borrowck/two-phase-baseline.rs b/src/test/run-pass/borrowck/two-phase-baseline.rs new file mode 100644 index 00000000000..561a5b3c115 --- /dev/null +++ b/src/test/run-pass/borrowck/two-phase-baseline.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z borrowck=mir -Z two-phase-borrows + +// This is the "goto example" for why we want two phase borrows. + +fn main() { + let mut v = vec![0, 1, 2]; + v.push(v.len()); + assert_eq!(v, [0, 1, 2, 3]); +} diff --git a/src/test/run-pass/borrowck/two-phase-bin-ops.rs b/src/test/run-pass/borrowck/two-phase-bin-ops.rs new file mode 100644 index 00000000000..ce601bc9a3c --- /dev/null +++ b/src/test/run-pass/borrowck/two-phase-bin-ops.rs @@ -0,0 +1,49 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// revisions: lxl nll + +#![cfg_attr(nll, feature(nll))] + +use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; +use std::ops::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign}; + +struct A(i32); + +macro_rules! trivial_binop { + ($Trait:ident, $m:ident) => { + impl $Trait for A { fn $m(&mut self, rhs: i32) { self.0 = rhs; } } + } +} + +trivial_binop!(AddAssign, add_assign); +trivial_binop!(SubAssign, sub_assign); +trivial_binop!(MulAssign, mul_assign); +trivial_binop!(DivAssign, div_assign); +trivial_binop!(RemAssign, rem_assign); +trivial_binop!(BitAndAssign, bitand_assign); +trivial_binop!(BitOrAssign, bitor_assign); +trivial_binop!(BitXorAssign, bitxor_assign); +trivial_binop!(ShlAssign, shl_assign); +trivial_binop!(ShrAssign, shr_assign); + +fn main() { + let mut a = A(10); + a += a.0; + a -= a.0; + a *= a.0; + a /= a.0; + a &= a.0; + a |= a.0; + a ^= a.0; + a <<= a.0; + a >>= a.0; +} diff --git a/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs new file mode 100644 index 00000000000..6d06d0c7941 --- /dev/null +++ b/src/test/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs @@ -0,0 +1,29 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// revisions: lxl nll +//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows + +#![cfg_attr(nll, feature(nll))] + +fn main() { + let mut a = 0; + let mut b = 0; + let p = if maybe() { + &mut a + } else { + &mut b + }; + use_(p); +} + +fn maybe() -> bool { false } +fn use_(_: T) { } diff --git a/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs b/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs new file mode 100644 index 00000000000..b5b4390657b --- /dev/null +++ b/src/test/run-pass/cfg/auxiliary/cfg_inner_static.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// this used to just ICE on compiling +pub fn foo() { + if cfg!(foo) { + static a: isize = 3; + a + } else { 3 }; +} diff --git a/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs b/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs new file mode 100644 index 00000000000..0028b51f9d1 --- /dev/null +++ b/src/test/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +// compile-flags: --cfg foo + +#![cfg_attr(foo, crate_type="lib")] + +pub fn foo() {} diff --git a/src/test/run-pass/cfg/cfg-attr-cfg.rs b/src/test/run-pass/cfg/cfg-attr-cfg.rs new file mode 100644 index 00000000000..6e3d8f2e7f1 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-attr-cfg.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// main is conditionally compiled, but the conditional compilation +// is conditional too! + +// pretty-expanded FIXME #23616 + +#[cfg_attr(foo, cfg(bar))] +fn main() { } diff --git a/src/test/run-pass/cfg/cfg-attr-crate.rs b/src/test/run-pass/cfg/cfg-attr-crate.rs new file mode 100644 index 00000000000..d352e53f231 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-attr-crate.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 + +// pretty-expanded FIXME #23616 + +#![cfg_attr(not_used, no_core)] + +fn main() { } diff --git a/src/test/run-pass/cfg/cfg-family.rs b/src/test/run-pass/cfg/cfg-family.rs new file mode 100644 index 00000000000..0a1241cccb8 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-family.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +// ignore-cloudabi no target_family +// ignore-wasm32-bare no target_family + +#[cfg(windows)] +pub fn main() { +} + +#[cfg(unix)] +pub fn main() { +} diff --git a/src/test/run-pass/cfg/cfg-in-crate-1.rs b/src/test/run-pass/cfg/cfg-in-crate-1.rs new file mode 100644 index 00000000000..e66c8324f36 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-in-crate-1.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg bar -D warnings +#![cfg(bar)] + +fn main() {} diff --git a/src/test/run-pass/cfg/cfg-macros-foo.rs b/src/test/run-pass/cfg/cfg-macros-foo.rs new file mode 100644 index 00000000000..6729d205410 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-macros-foo.rs @@ -0,0 +1,36 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg foo + +// check that cfg correctly chooses between the macro impls (see also +// cfg-macros-notfoo.rs) + + +#[cfg(foo)] +#[macro_use] +mod foo { + macro_rules! bar { + () => { true } + } +} + +#[cfg(not(foo))] +#[macro_use] +mod foo { + macro_rules! bar { + () => { false } + } +} + +pub fn main() { + assert!(bar!()) +} diff --git a/src/test/run-pass/cfg/cfg-macros-notfoo.rs b/src/test/run-pass/cfg/cfg-macros-notfoo.rs new file mode 100644 index 00000000000..2e9614cf8af --- /dev/null +++ b/src/test/run-pass/cfg/cfg-macros-notfoo.rs @@ -0,0 +1,36 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: + +// check that cfg correctly chooses between the macro impls (see also +// cfg-macros-foo.rs) + + +#[cfg(foo)] +#[macro_use] +mod foo { + macro_rules! bar { + () => { true } + } +} + +#[cfg(not(foo))] +#[macro_use] +mod foo { + macro_rules! bar { + () => { false } + } +} + +pub fn main() { + assert!(!bar!()) +} diff --git a/src/test/run-pass/cfg/cfg-match-arm.rs b/src/test/run-pass/cfg/cfg-match-arm.rs new file mode 100644 index 00000000000..8443d59e869 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-match-arm.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Foo { + Bar, + Baz, +} + +fn foo(f: Foo) { + match f { + Foo::Bar => {}, + #[cfg(not(asdfa))] + Foo::Baz => {}, + #[cfg(afsd)] + Basdfwe => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/cfg/cfg-target-family.rs b/src/test/run-pass/cfg/cfg-target-family.rs new file mode 100644 index 00000000000..3345df69d87 --- /dev/null +++ b/src/test/run-pass/cfg/cfg-target-family.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no target_family +// ignore-wasm32-bare no target_family + +// pretty-expanded FIXME #23616 + +#[cfg(target_family = "windows")] +pub fn main() { +} + +#[cfg(target_family = "unix")] +pub fn main() { +} diff --git a/src/test/run-pass/cfg/cfg-target-vendor.rs b/src/test/run-pass/cfg/cfg-target-vendor.rs new file mode 100644 index 00000000000..08daa67827b --- /dev/null +++ b/src/test/run-pass/cfg/cfg-target-vendor.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(cfg_target_vendor)] + +#[cfg(target_vendor = "unknown")] +pub fn main() { +} + +#[cfg(not(target_vendor = "unknown"))] +pub fn main() { +} diff --git a/src/test/run-pass/cfg/cfg_attr.rs b/src/test/run-pass/cfg/cfg_attr.rs new file mode 100644 index 00000000000..e9f83e1112f --- /dev/null +++ b/src/test/run-pass/cfg/cfg_attr.rs @@ -0,0 +1,60 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--cfg set1 --cfg set2 +#![allow(dead_code)] +use std::fmt::Debug; + +struct NotDebugable; + +#[cfg_attr(set1, derive(Debug))] +struct Set1; + +#[cfg_attr(notset, derive(Debug))] +struct Notset(NotDebugable); + +#[cfg_attr(not(notset), derive(Debug))] +struct NotNotset; + +#[cfg_attr(not(set1), derive(Debug))] +struct NotSet1(NotDebugable); + +#[cfg_attr(all(set1, set2), derive(Debug))] +struct AllSet1Set2; + +#[cfg_attr(all(set1, notset), derive(Debug))] +struct AllSet1Notset(NotDebugable); + +#[cfg_attr(any(set1, notset), derive(Debug))] +struct AnySet1Notset; + +#[cfg_attr(any(notset, notset2), derive(Debug))] +struct AnyNotsetNotset2(NotDebugable); + +#[cfg_attr(all(not(notset), any(set1, notset)), derive(Debug))] +struct Complex; + +#[cfg_attr(any(notset, not(any(set1, notset))), derive(Debug))] +struct ComplexNot(NotDebugable); + +#[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Debug))] +struct KeyValue; + +fn is_show() {} + +fn main() { + is_show::(); + is_show::(); + is_show::(); + is_show::(); + is_show::(); + is_show::(); +} diff --git a/src/test/run-pass/cfg/cfg_inner_static.rs b/src/test/run-pass/cfg/cfg_inner_static.rs new file mode 100644 index 00000000000..e711132e16a --- /dev/null +++ b/src/test/run-pass/cfg/cfg_inner_static.rs @@ -0,0 +1,20 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cfg_inner_static.rs + +// pretty-expanded FIXME #23616 + +extern crate cfg_inner_static; + +pub fn main() { + cfg_inner_static::foo(); +} diff --git a/src/test/run-pass/cfg/cfg_stmt_expr.rs b/src/test/run-pass/cfg/cfg_stmt_expr.rs new file mode 100644 index 00000000000..102ca22f0bd --- /dev/null +++ b/src/test/run-pass/cfg/cfg_stmt_expr.rs @@ -0,0 +1,99 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(non_snake_case)] +#![feature(stmt_expr_attributes)] + +fn main() { + let a = 413; + #[cfg(unset)] + let a = (); + assert_eq!(a, 413); + + let mut b = 612; + #[cfg(unset)] + { + b = 1111; + } + assert_eq!(b, 612); + + #[cfg(unset)] + undefined_fn(); + + #[cfg(unset)] + undefined_macro!(); + #[cfg(unset)] + undefined_macro![]; + #[cfg(unset)] + undefined_macro!{}; + + // pretty printer bug... + // #[cfg(unset)] + // undefined_macro!{} + + let () = (#[cfg(unset)] 341,); // Should this also work on parens? + let t = (1, #[cfg(unset)] 3, 4); + assert_eq!(t, (1, 4)); + + let f = |_: u32, _: u32| (); + f(2, 1, #[cfg(unset)] 6); + + let _: u32 = a.clone(#[cfg(unset)] undefined); + + let _: [(); 0] = [#[cfg(unset)] 126]; + let t = [#[cfg(unset)] 1, 2, 6]; + assert_eq!(t, [2, 6]); + + { + let r; + #[cfg(unset)] + (r = 5); + #[cfg(not(unset))] + (r = 10); + assert_eq!(r, 10); + } + + // check that macro expanded code works + + macro_rules! if_cfg { + ($cfg:meta $ib:block else $eb:block) => { + { + let r; + #[cfg($cfg)] + (r = $ib); + #[cfg(not($cfg))] + (r = $eb); + r + } + } + } + + let n = if_cfg!(unset { + 413 + } else { + 612 + }); + + assert_eq!((#[cfg(unset)] 1, #[cfg(not(unset))] 2), (2,)); + assert_eq!(n, 612); + + // check that lints work + + #[allow(non_snake_case)] + let FOOBAR = { + fn SYLADEX() {} + }; + + #[allow(non_snake_case)] + { + fn CRUXTRUDER() {} + } +} diff --git a/src/test/run-pass/cfg/cfgs-on-items.rs b/src/test/run-pass/cfg/cfgs-on-items.rs new file mode 100644 index 00000000000..d8011827f66 --- /dev/null +++ b/src/test/run-pass/cfg/cfgs-on-items.rs @@ -0,0 +1,39 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg fooA --cfg fooB + +// fooA AND !bar + +#[cfg(all(fooA, not(bar)))] +fn foo1() -> isize { 1 } + +// !fooA AND !bar +#[cfg(all(not(fooA), not(bar)))] +fn foo2() -> isize { 2 } + +// fooC OR (fooB AND !bar) +#[cfg(any(fooC, all(fooB, not(bar))))] +fn foo2() -> isize { 3 } + +// fooA AND bar +#[cfg(all(fooA, bar))] +fn foo3() -> isize { 2 } + +// !(fooA AND bar) +#[cfg(not(all(fooA, bar)))] +fn foo3() -> isize { 3 } + +pub fn main() { + assert_eq!(1, foo1()); + assert_eq!(3, foo2()); + assert_eq!(3, foo3()); +} diff --git a/src/test/run-pass/cfg/conditional-compile-arch.rs b/src/test/run-pass/cfg/conditional-compile-arch.rs new file mode 100644 index 00000000000..2eafd8f854d --- /dev/null +++ b/src/test/run-pass/cfg/conditional-compile-arch.rs @@ -0,0 +1,48 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[cfg(target_arch = "x86")] +pub fn main() { } + +#[cfg(target_arch = "x86_64")] +pub fn main() { } + +#[cfg(target_arch = "arm")] +pub fn main() { } + +#[cfg(target_arch = "aarch64")] +pub fn main() { } + +#[cfg(target_arch = "mips")] +pub fn main() { } + +#[cfg(target_arch = "mips64")] +pub fn main() { } + +#[cfg(target_arch = "powerpc")] +pub fn main() { } + +#[cfg(target_arch = "powerpc64")] +pub fn main() { } + +#[cfg(target_arch = "s390x")] +pub fn main() { } + +#[cfg(target_arch = "asmjs")] +pub fn main() { } + +#[cfg(target_arch = "wasm32")] +pub fn main() { } + +#[cfg(target_arch = "sparc64")] +pub fn main() { } diff --git a/src/test/run-pass/cfg/conditional-compile.rs b/src/test/run-pass/cfg/conditional-compile.rs new file mode 100644 index 00000000000..20362462484 --- /dev/null +++ b/src/test/run-pass/cfg/conditional-compile.rs @@ -0,0 +1,158 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] +#![allow(improper_ctypes)] + +// Crate use statements + +#[cfg(bogus)] +use flippity; + +#[cfg(bogus)] +static b: bool = false; + +static b: bool = true; + +mod rustrt { + #[cfg(bogus)] + extern { + // This symbol doesn't exist and would be a link error if this + // module was codegened + pub fn bogus(); + } + + extern {} +} + +#[cfg(bogus)] +type t = isize; + +type t = bool; + +#[cfg(bogus)] +enum tg { foo, } + +enum tg { bar, } + +#[cfg(bogus)] +struct r { + i: isize, +} + +#[cfg(bogus)] +fn r(i:isize) -> r { + r { + i: i + } +} + +struct r { + i: isize, +} + +fn r(i:isize) -> r { + r { + i: i + } +} + +#[cfg(bogus)] +mod m { + // This needs to parse but would fail in typeck. Since it's not in + // the current config it should not be typechecked. + pub fn bogus() { return 0; } +} + +mod m { + // Submodules have slightly different code paths than the top-level + // module, so let's make sure this jazz works here as well + #[cfg(bogus)] + pub fn f() { } + + pub fn f() { } +} + +// Since the bogus configuration isn't defined main will just be +// parsed, but nothing further will be done with it +#[cfg(bogus)] +pub fn main() { panic!() } + +pub fn main() { + // Exercise some of the configured items in ways that wouldn't be possible + // if they had the bogus definition + assert!((b)); + let _x: t = true; + let _y: tg = tg::bar; + + test_in_fn_ctxt(); +} + +fn test_in_fn_ctxt() { + #[cfg(bogus)] + fn f() { panic!() } + fn f() { } + f(); + + #[cfg(bogus)] + static i: isize = 0; + static i: isize = 1; + assert_eq!(i, 1); +} + +mod test_foreign_items { + pub mod rustrt { + extern { + #[cfg(bogus)] + pub fn write() -> String; + pub fn write() -> String; + } + } +} + +mod test_use_statements { + #[cfg(bogus)] + use flippity_foo; +} + +mod test_methods { + struct Foo { + bar: usize + } + + impl Fooable for Foo { + #[cfg(bogus)] + fn what(&self) { } + + fn what(&self) { } + + #[cfg(bogus)] + fn the(&self) { } + + fn the(&self) { } + } + + trait Fooable { + #[cfg(bogus)] + fn what(&self); + + fn what(&self); + + #[cfg(bogus)] + fn the(&self); + + fn the(&self); + } +} + +#[cfg(any())] +mod nonexistent_file; // Check that unconfigured non-inline modules are not loaded or parsed. diff --git a/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs b/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs new file mode 100644 index 00000000000..0d817df7cdc --- /dev/null +++ b/src/test/run-pass/cfg/crate-attributes-using-cfg_attr.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:crate-attributes-using-cfg_attr.rs + +extern crate crate_attributes_using_cfg_attr; + +pub fn main() {} diff --git a/src/test/run-pass/coerce/coerce-expect-unsized.rs b/src/test/run-pass/coerce/coerce-expect-unsized.rs new file mode 100644 index 00000000000..cb0fd0b7504 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-expect-unsized.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::cell::RefCell; +use std::fmt::Debug; +use std::rc::Rc; + +// Check that coercions apply at the pointer level and don't cause +// rvalue expressions to be unsized. See #20169 for more information. + +pub fn main() { + let _: Box<[isize]> = Box::new({ [1, 2, 3] }); + let _: Box<[isize]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] }); + let _: Box<[isize]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] }); + let _: Box _> = Box::new({ |x| (x as u8) }); + let _: Box = Box::new(if true { false } else { true }); + let _: Box = Box::new(match true { true => 'a', false => 'b' }); + + let _: &[isize] = &{ [1, 2, 3] }; + let _: &[isize] = &if true { [1, 2, 3] } else { [1, 3, 4] }; + let _: &[isize] = &match true { true => [1, 2, 3], false => [1, 3, 4] }; + let _: &Fn(isize) -> _ = &{ |x| (x as u8) }; + let _: &Debug = &if true { false } else { true }; + let _: &Debug = &match true { true => 'a', false => 'b' }; + + let _: &str = &{ String::new() }; + let _: &str = &if true { String::from("...") } else { 5.to_string() }; + let _: &str = &match true { + true => format!("{}", false), + false => ["x", "y"].join("+") + }; + + let _: Box<[isize]> = Box::new([1, 2, 3]); + let _: Box _> = Box::new(|x| (x as u8)); + + let _: Rc> = Rc::new(RefCell::new([1, 2, 3])); + let _: Rc _>> = Rc::new(RefCell::new(|x| (x as u8))); + + let _: Vec _>> = vec![ + Box::new(|x| (x as u8)), + Box::new(|x| (x as i16 as u8)), + ]; +} diff --git a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs new file mode 100644 index 00000000000..c6b9e61dae1 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs @@ -0,0 +1,76 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::rc::Rc; + +// Examples from the "deref coercions" RFC, at rust-lang/rfcs#241. + +fn use_ref(_: &T) {} +fn use_mut(_: &mut T) {} + +fn use_rc(t: Rc) { + use_ref(&*t); // what you have to write today + use_ref(&t); // what you'd be able to write + use_ref(&&&&&&t); + use_ref(&mut &&&&&t); + use_ref(&&&mut &&&t); +} + +fn use_mut_box(mut t: &mut Box) { + use_mut(&mut *t); // what you have to write today + use_mut(t); // what you'd be able to write + use_mut(&mut &mut &mut t); + + use_ref(&*t); // what you have to write today + use_ref(t); // what you'd be able to write + use_ref(&&&&&&t); + use_ref(&mut &&&&&t); + use_ref(&&&mut &&&t); +} + +fn use_nested(t: &Box) { + use_ref(&**t); // what you have to write today + use_ref(t); // what you'd be able to write (note: recursive deref) + use_ref(&&&&&&t); + use_ref(&mut &&&&&t); + use_ref(&&&mut &&&t); +} + +fn use_slice(_: &[u8]) {} +fn use_slice_mut(_: &mut [u8]) {} + +fn use_vec(mut v: Vec) { + use_slice_mut(&mut v[..]); // what you have to write today + use_slice_mut(&mut v); // what you'd be able to write + use_slice_mut(&mut &mut &mut v); + + use_slice(&v[..]); // what you have to write today + use_slice(&v); // what you'd be able to write + use_slice(&&&&&&v); + use_slice(&mut &&&&&v); + use_slice(&&&mut &&&v); +} + +fn use_vec_ref(v: &Vec) { + use_slice(&v[..]); // what you have to write today + use_slice(v); // what you'd be able to write + use_slice(&&&&&&v); + use_slice(&mut &&&&&v); + use_slice(&&&mut &&&v); +} + +fn use_op_rhs(s: &mut String) { + *s += {&String::from(" ")}; +} + +pub fn main() {} diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs new file mode 100644 index 00000000000..be5e55afbc5 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn negate(x: &isize) -> isize { + -*x +} + +fn negate_mut(y: &mut isize) -> isize { + negate(y) +} + +fn negate_imm(y: &isize) -> isize { + negate(y) +} + +pub fn main() {} diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs new file mode 100644 index 00000000000..0b76375fba1 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct SpeechMaker { + speeches: usize +} + +impl SpeechMaker { + pub fn how_many(&self) -> usize { self.speeches } +} + +fn foo(speaker: &SpeechMaker) -> usize { + speaker.how_many() + 33 +} + +pub fn main() { + let lincoln = SpeechMaker {speeches: 22}; + assert_eq!(foo(&lincoln), 55); +} diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs new file mode 100644 index 00000000000..f8849e6af86 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn sum(x: &[isize]) -> isize { + let mut sum = 0; + for y in x { sum += *y; } + return sum; +} + +fn sum_mut(y: &mut [isize]) -> isize { + sum(y) +} + +fn sum_imm(y: &[isize]) -> isize { + sum(y) +} + +pub fn main() {} diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs new file mode 100644 index 00000000000..4faf6dadbef --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn bar(v: &mut [usize]) -> Vec { + v.to_vec() +} + +fn bip(v: &[usize]) -> Vec { + v.to_vec() +} + +pub fn main() { + let mut the_vec = vec![1, 2, 3, 100]; + assert_eq!(the_vec.clone(), bar(&mut the_vec)); + assert_eq!(the_vec.clone(), bip(&the_vec)); +} diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs new file mode 100644 index 00000000000..7d851bb8bd2 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct SpeechMaker { + speeches: usize +} + +fn talk(x: &mut SpeechMaker) { + x.speeches += 1; +} + +fn give_a_few_speeches(speaker: &mut SpeechMaker) { + + // Here speaker is reborrowed for each call, so we don't get errors + // about speaker being moved. + + talk(speaker); + talk(speaker); + talk(speaker); +} + +pub fn main() { + let mut lincoln = SpeechMaker {speeches: 22}; + give_a_few_speeches(&mut lincoln); +} diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs new file mode 100644 index 00000000000..42f710299ff --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct SpeechMaker { + speeches: usize +} + +impl SpeechMaker { + pub fn talk(&mut self) { + self.speeches += 1; + } +} + +fn give_a_few_speeches(speaker: &mut SpeechMaker) { + + // Here speaker is reborrowed for each call, so we don't get errors + // about speaker being moved. + + speaker.talk(); + speaker.talk(); + speaker.talk(); +} + +pub fn main() { + let mut lincoln = SpeechMaker {speeches: 22}; + give_a_few_speeches(&mut lincoln); +} diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs new file mode 100644 index 00000000000..25a73c3d2d6 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn reverse(v: &mut [usize]) { + v.reverse(); +} + +fn bar(v: &mut [usize]) { + reverse(v); + reverse(v); + reverse(v); +} + +pub fn main() { + let mut the_vec = vec![1, 2, 3, 100]; + bar(&mut the_vec); + assert_eq!(the_vec, [100, 3, 2, 1]); +} diff --git a/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs new file mode 100644 index 00000000000..04b884620b6 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn bar(v: &mut [usize]) { + v.reverse(); + v.reverse(); + v.reverse(); +} + +pub fn main() { + let mut the_vec = vec![1, 2, 3, 100]; + bar(&mut the_vec); + assert_eq!(the_vec, [100, 3, 2, 1]); +} diff --git a/src/test/run-pass/coerce/coerce-unify-return.rs b/src/test/run-pass/coerce/coerce-unify-return.rs new file mode 100644 index 00000000000..2b276f2cfe4 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-unify-return.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that coercions unify the expected return type of a polymorphic +// function call, instead of leaving the type variables as they were. + +// pretty-expanded FIXME #23616 + +struct Foo; +impl Foo { + fn foo(self, x: T) -> Option { Some(x) } +} + +pub fn main() { + let _: Option = Some(main); + let _: Option = Foo.foo(main); + + // The same two cases, with implicit type variables made explicit. + let _: Option = Some::<_>(main); + let _: Option = Foo.foo::<_>(main); +} diff --git a/src/test/run-pass/coerce/coerce-unify.rs b/src/test/run-pass/coerce/coerce-unify.rs new file mode 100644 index 00000000000..575d672e092 --- /dev/null +++ b/src/test/run-pass/coerce/coerce-unify.rs @@ -0,0 +1,78 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that coercions can unify if-else, match arms and array elements. + +// Try to construct if-else chains, matches and arrays out of given expressions. +macro_rules! check { + ($last:expr $(, $rest:expr)+) => { + // Last expression comes first because of whacky ifs and matches. + let _ = $(if false { $rest })else+ else { $last }; + + let _ = match 0 { $(_ if false => $rest,)+ _ => $last }; + + let _ = [$($rest,)+ $last]; + } +} + +// Check all non-uniform cases of 2 and 3 expressions of 2 types. +macro_rules! check2 { + ($a:expr, $b:expr) => { + check!($a, $b); + check!($b, $a); + + check!($a, $a, $b); + check!($a, $b, $a); + check!($a, $b, $b); + + check!($b, $a, $a); + check!($b, $a, $b); + check!($b, $b, $a); + } +} + +// Check all non-uniform cases of 2 and 3 expressions of 3 types. +macro_rules! check3 { + ($a:expr, $b:expr, $c:expr) => { + // Delegate to check2 for cases where a type repeats. + check2!($a, $b); + check2!($b, $c); + check2!($a, $c); + + // Check the remaining cases, i.e. permutations of ($a, $b, $c). + check!($a, $b, $c); + check!($a, $c, $b); + check!($b, $a, $c); + check!($b, $c, $a); + check!($c, $a, $b); + check!($c, $b, $a); + } +} + +use std::mem::size_of; + +fn foo() {} +fn bar() {} + +pub fn main() { + check3!(foo, bar, foo as fn()); + check3!(size_of::, size_of::, size_of:: as fn() -> usize); + + let s = String::from("bar"); + check2!("foo", &s); + + let a = [1, 2, 3]; + let v = vec![1, 2, 3]; + check2!(&a[..], &v); + + // Make sure in-array coercion still works. + let _ = [("a", Default::default()), (Default::default(), "b"), (&s, &s)]; +} diff --git a/src/test/run-pass/coerce/coerce-unsize-subtype.rs b/src/test/run-pass/coerce/coerce-unsize-subtype.rs new file mode 100644 index 00000000000..ab571a8b40d --- /dev/null +++ b/src/test/run-pass/coerce/coerce-unsize-subtype.rs @@ -0,0 +1,49 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::rc::Rc; + +fn lub_short<'a, T>(_: &[&'a T], _: &[&'a T]) {} + +// The two arguments are a subtype of their LUB, after coercion. +fn long_and_short<'a, T>(xs: &[&'static T; 1], ys: &[&'a T; 1]) { + lub_short(xs, ys); +} + +// The argument coerces to a subtype of the return type. +fn long_to_short<'a, 'b, T>(xs: &'b [&'static T; 1]) -> &'b [&'a T] { + xs +} + +// Rc is covariant over T just like &T. +fn long_to_short_rc<'a, T>(xs: Rc<[&'static T; 1]>) -> Rc<[&'a T]> { + xs +} + +// LUB-coercion (if-else/match/array) coerces `xs: &'b [&'static T: N]` +// to a subtype of the LUB of `xs` and `ys` (i.e. `&'b [&'a T]`), +// regardless of the order they appear (in if-else/match/array). +fn long_and_short_lub1<'a, 'b, T>(xs: &'b [&'static T; 1], ys: &'b [&'a T]) { + let _order1 = [xs, ys]; + let _order2 = [ys, xs]; +} + +// LUB-coercion should also have the exact same effect when `&'b [&'a T; N]` +// needs to be coerced, i.e. the resulting type is not &'b [&'static T], but +// rather the `&'b [&'a T]` LUB. +fn long_and_short_lub2<'a, 'b, T>(xs: &'b [&'static T], ys: &'b [&'a T; 1]) { + let _order1 = [xs, ys]; + let _order2 = [ys, xs]; +} + +fn main() {} diff --git a/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs new file mode 100644 index 00000000000..d3d389c6a8b --- /dev/null +++ b/src/test/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] +#![feature(fundamental)] + +pub trait MyCopy { } +impl MyCopy for i32 { } + +pub struct MyStruct(T); + +#[fundamental] +pub struct MyFundamentalStruct(T); diff --git a/src/test/run-pass/coherence/auxiliary/coherence_lib.rs b/src/test/run-pass/coherence/auxiliary/coherence_lib.rs new file mode 100644 index 00000000000..daa123849e4 --- /dev/null +++ b/src/test/run-pass/coherence/auxiliary/coherence_lib.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub trait Remote { + fn foo(&self) { } +} + +pub trait Remote1 { + fn foo(&self, t: T) { } +} + +pub trait Remote2 { + fn foo(&self, t: T, u: U) { } +} + +pub struct Pair(T,U); diff --git a/src/test/run-pass/coherence/coherence-bigint-int.rs b/src/test/run-pass/coherence/coherence-bigint-int.rs new file mode 100644 index 00000000000..62736b1f368 --- /dev/null +++ b/src/test/run-pass/coherence/coherence-bigint-int.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub struct BigInt; + +impl Remote1 for isize { } + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-bigint-vecint.rs b/src/test/run-pass/coherence/coherence-bigint-vecint.rs new file mode 100644 index 00000000000..372f38738e5 --- /dev/null +++ b/src/test/run-pass/coherence/coherence-bigint-vecint.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub struct BigInt; + +impl Remote1 for Vec { } + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-blanket.rs b/src/test/run-pass/coherence/coherence-blanket.rs new file mode 100644 index 00000000000..fa09b13bf67 --- /dev/null +++ b/src/test/run-pass/coherence/coherence-blanket.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +pub trait Local { + fn foo(&self) { } +} + +impl Local for T { } + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs new file mode 100644 index 00000000000..3ddeb58dddc --- /dev/null +++ b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote; + +struct Foo(T); + +impl Remote for Foo { } + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-impl-in-fn.rs b/src/test/run-pass/coherence/coherence-impl-in-fn.rs new file mode 100644 index 00000000000..de7cb7664b6 --- /dev/null +++ b/src/test/run-pass/coherence/coherence-impl-in-fn.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +pub fn main() { + #[derive(Copy, Clone)] + enum x { foo } + impl ::std::cmp::PartialEq for x { + fn eq(&self, other: &x) -> bool { + (*self) as isize == (*other) as isize + } + fn ne(&self, other: &x) -> bool { !(*self).eq(other) } + } +} diff --git a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs new file mode 100644 index 00000000000..d446f0dca9a --- /dev/null +++ b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +struct Foo(T); + +impl Remote1 for Foo { } + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-iterator-vec.rs b/src/test/run-pass/coherence/coherence-iterator-vec.rs new file mode 100644 index 00000000000..38ad5b8115a --- /dev/null +++ b/src/test/run-pass/coherence/coherence-iterator-vec.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:coherence_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate coherence_lib as lib; +use lib::Remote1; + +struct Foo(T); + +impl Remote1 for Foo { } + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs new file mode 100644 index 00000000000..ab04f946fa6 --- /dev/null +++ b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::fmt::Debug; +use std::default::Default; + +// Test that an impl for homogeneous pairs does not conflict with a +// heterogeneous pair. + +trait MyTrait { + fn get(&self) -> usize; +} + +impl MyTrait for (T,T) { + fn get(&self) -> usize { 0 } +} + +impl MyTrait for (usize,isize) { + fn get(&self) -> usize { 0 } +} + +fn main() { +} diff --git a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs new file mode 100644 index 00000000000..7984193862e --- /dev/null +++ b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +struct TestType; + +impl !Send for TestType {} + +fn main() {} diff --git a/src/test/run-pass/coherence/coherence-rfc447-constrained.rs b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs new file mode 100644 index 00000000000..5db8188e1ff --- /dev/null +++ b/src/test/run-pass/coherence/coherence-rfc447-constrained.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that trait matching can handle impls whose types are only +// constrained by a projection. + +trait IsU32 {} +impl IsU32 for u32 {} + +trait Mirror { type Image: ?Sized; } +impl Mirror for T { type Image = T; } + +trait Bar {} +impl, L: Mirror> Bar for V + where U::Image: IsU32 {} + +trait Foo { fn name() -> &'static str; } +impl Foo for u64 { fn name() -> &'static str { "u64" } } +impl Foo for T { fn name() -> &'static str { "Bar" }} + +fn main() { + assert_eq!(::name(), "u64"); + assert_eq!(::name(), "Bar"); +} diff --git a/src/test/run-pass/coherence/coherence-subtyping.rs b/src/test/run-pass/coherence/coherence-subtyping.rs new file mode 100644 index 00000000000..0dcd83f87b8 --- /dev/null +++ b/src/test/run-pass/coherence/coherence-subtyping.rs @@ -0,0 +1,49 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that two distinct impls which match subtypes of one another +// yield coherence errors (or not) depending on the variance. + +trait Contravariant { + fn foo(&self) { } +} + +impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { +} + +/////////////////////////////////////////////////////////////////////////// + +trait Covariant { + fn foo(&self) { } +} + +impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { +} + +/////////////////////////////////////////////////////////////////////////// + +trait Invariant { + fn foo(&self) { } +} + +impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { +} + +impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { +} + +fn main() { } diff --git a/src/test/run-pass/coherence/coherence-where-clause.rs b/src/test/run-pass/coherence/coherence-where-clause.rs new file mode 100644 index 00000000000..9691978466b --- /dev/null +++ b/src/test/run-pass/coherence/coherence-where-clause.rs @@ -0,0 +1,47 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt::Debug; +use std::default::Default; + +trait MyTrait { + fn get(&self) -> Self; +} + +impl MyTrait for T + where T : Default +{ + fn get(&self) -> T { + Default::default() + } +} + +#[derive(Clone, Copy, Debug, PartialEq)] +struct MyType { + dummy: usize +} + +impl MyTrait for MyType { + fn get(&self) -> MyType { (*self).clone() } +} + +fn test_eq(m: M, n: M) +where M : MyTrait + Debug + PartialEq +{ + assert_eq!(m.get(), n); +} + +pub fn main() { + test_eq(0_usize, 0_usize); + + let value = MyType { dummy: 256 + 22 }; + test_eq(value, value); +} diff --git a/src/test/run-pass/coherence/coherence_copy_like.rs b/src/test/run-pass/coherence/coherence_copy_like.rs new file mode 100644 index 00000000000..c6903d911f9 --- /dev/null +++ b/src/test/run-pass/coherence/coherence_copy_like.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to introduce a negative constraint that +// `MyType: !MyTrait` along with other "fundamental" wrappers. + +// aux-build:coherence_copy_like_lib.rs + +extern crate coherence_copy_like_lib as lib; + +struct MyType { x: i32 } + +trait MyTrait { } +impl MyTrait for T { } +impl MyTrait for MyType { } +impl<'a> MyTrait for &'a MyType { } +impl MyTrait for Box { } +impl<'a> MyTrait for &'a Box { } + +fn main() { } diff --git a/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs new file mode 100644 index 00000000000..741ce351da3 --- /dev/null +++ b/src/test/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="anonexternmod"] +#![feature(libc)] + +extern crate libc; + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_get_test_int() -> libc::intptr_t; +} diff --git a/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs b/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs new file mode 100644 index 00000000000..9c90510a857 --- /dev/null +++ b/src/test/run-pass/consts/auxiliary/cci_borrow_lib.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo(x: &usize) -> usize { + *x +} diff --git a/src/test/run-pass/consts/auxiliary/cci_const.rs b/src/test/run-pass/consts/auxiliary/cci_const.rs new file mode 100644 index 00000000000..ee8290050f9 --- /dev/null +++ b/src/test/run-pass/consts/auxiliary/cci_const.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub extern fn bar() { +} + +pub const foopy: &'static str = "hi there"; +pub const uint_val: usize = 12; +pub const uint_expr: usize = (1 << uint_val) - 1; diff --git a/src/test/run-pass/consts/auxiliary/cci_const_block.rs b/src/test/run-pass/consts/auxiliary/cci_const_block.rs new file mode 100644 index 00000000000..76fe9fe5aa4 --- /dev/null +++ b/src/test/run-pass/consts/auxiliary/cci_const_block.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub static BLOCK_FN_DEF: fn(usize) -> usize = { + fn foo(a: usize) -> usize { + a + 10 + } + foo +}; diff --git a/src/test/run-pass/consts/auxiliary/const_fn_lib.rs b/src/test/run-pass/consts/auxiliary/const_fn_lib.rs new file mode 100644 index 00000000000..6985a6527c8 --- /dev/null +++ b/src/test/run-pass/consts/auxiliary/const_fn_lib.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Crate that exports a const fn. Used for testing cross-crate. + +#![crate_type="rlib"] +#![feature(min_const_fn)] + +pub const fn foo() -> usize { 22 } diff --git a/src/test/run-pass/consts/const-adt-align-mismatch.rs b/src/test/run-pass/consts/const-adt-align-mismatch.rs new file mode 100644 index 00000000000..10875d5046c --- /dev/null +++ b/src/test/run-pass/consts/const-adt-align-mismatch.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +use std::mem; + +#[derive(PartialEq, Debug)] +enum Foo { + A(u32), + Bar([u16; 4]), + C +} + +// NOTE(eddyb) Don't make this a const, needs to be a static +// so it is always instantiated as a LLVM constant value. +static FOO: Foo = Foo::C; + +fn main() { + assert_eq!(FOO, Foo::C); + assert_eq!(mem::size_of::(), 12); + assert_eq!(mem::min_align_of::(), 4); +} diff --git a/src/test/run-pass/consts/const-autoderef.rs b/src/test/run-pass/consts/const-autoderef.rs new file mode 100644 index 00000000000..939f7d4441a --- /dev/null +++ b/src/test/run-pass/consts/const-autoderef.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const A: [u8; 1] = ['h' as u8]; +const B: u8 = (&A)[0]; +const C: &'static &'static &'static &'static [u8; 1] = & & & &A; +const D: u8 = (&C)[0]; + +pub fn main() { + assert_eq!(B, A[0]); + assert_eq!(D, A[0]); +} diff --git a/src/test/run-pass/consts/const-big-enum.rs b/src/test/run-pass/consts/const-big-enum.rs new file mode 100644 index 00000000000..1ad46fa4106 --- /dev/null +++ b/src/test/run-pass/consts/const-big-enum.rs @@ -0,0 +1,40 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum Foo { + Bar(u32), + Baz, + Quux(u64, u16) +} + +static X: Foo = Foo::Baz; + +pub fn main() { + match X { + Foo::Baz => {} + _ => panic!() + } + match Y { + Foo::Bar(s) => assert_eq!(s, 2654435769), + _ => panic!() + } + match Z { + Foo::Quux(d,h) => { + assert_eq!(d, 0x123456789abcdef0); + assert_eq!(h, 0x1234); + } + _ => panic!() + } +} + +static Y: Foo = Foo::Bar(2654435769); +static Z: Foo = Foo::Quux(0x123456789abcdef0, 0x1234); diff --git a/src/test/run-pass/consts/const-binops.rs b/src/test/run-pass/consts/const-binops.rs new file mode 100644 index 00000000000..2e90a458aee --- /dev/null +++ b/src/test/run-pass/consts/const-binops.rs @@ -0,0 +1,136 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! assert_approx_eq { + ($a:expr, $b:expr) => ({ + let (a, b) = (&$a, &$b); + assert!((*a - *b).abs() < 1.0e-6, + "{} is not approximately equal to {}", *a, *b); + }) +} + +static A: isize = -4 + 3; +static A2: usize = 3 + 3; +static B: f64 = 3.0 + 2.7; + +static C: isize = 3 - 4; +static D: usize = 3 - 3; +static E: f64 = 3.0 - 2.7; + +static E2: isize = -3 * 3; +static F: usize = 3 * 3; +static G: f64 = 3.3 * 3.3; + +static H: isize = 3 / -1; +static I: usize = 3 / 3; +static J: f64 = 3.3 / 3.3; + +static N: bool = true && false; + +static O: bool = true || false; + +static P: isize = 3 & 1; +static Q: usize = 1 & 3; + +static R: isize = 3 | 1; +static S: usize = 1 | 3; + +static T: isize = 3 ^ 1; +static U: usize = 1 ^ 3; + +static V: isize = 1 << 3; + +// NOTE: better shr coverage +static W: isize = 1024 >> 4; +static X: usize = 1024 >> 4; + +static Y: bool = 1 == 1; +static Z: bool = 1.0f64 == 1.0; + +static AA: bool = 1 <= 2; +static AB: bool = -1 <= 2; +static AC: bool = 1.0f64 <= 2.0; + +static AD: bool = 1 < 2; +static AE: bool = -1 < 2; +static AF: bool = 1.0f64 < 2.0; + +static AG: bool = 1 != 2; +static AH: bool = -1 != 2; +static AI: bool = 1.0f64 != 2.0; + +static AJ: bool = 2 >= 1; +static AK: bool = 2 >= -2; +static AL: bool = 1.0f64 >= -2.0; + +static AM: bool = 2 > 1; +static AN: bool = 2 > -2; +static AO: bool = 1.0f64 > -2.0; + +pub fn main() { + assert_eq!(A, -1); + assert_eq!(A2, 6); + assert_approx_eq!(B, 5.7); + + assert_eq!(C, -1); + assert_eq!(D, 0); + assert_approx_eq!(E, 0.3); + + assert_eq!(E2, -9); + assert_eq!(F, 9); + assert_approx_eq!(G, 10.89); + + assert_eq!(H, -3); + assert_eq!(I, 1); + assert_approx_eq!(J, 1.0); + + assert_eq!(N, false); + + assert_eq!(O, true); + + assert_eq!(P, 1); + assert_eq!(Q, 1); + + assert_eq!(R, 3); + assert_eq!(S, 3); + + assert_eq!(T, 2); + assert_eq!(U, 2); + + assert_eq!(V, 8); + + assert_eq!(W, 64); + assert_eq!(X, 64); + + assert_eq!(Y, true); + assert_eq!(Z, true); + + assert_eq!(AA, true); + assert_eq!(AB, true); + assert_eq!(AC, true); + + assert_eq!(AD, true); + assert_eq!(AE, true); + assert_eq!(AF, true); + + assert_eq!(AG, true); + assert_eq!(AH, true); + assert_eq!(AI, true); + + assert_eq!(AJ, true); + assert_eq!(AK, true); + assert_eq!(AL, true); + + assert_eq!(AM, true); + assert_eq!(AN, true); + assert_eq!(AO, true); +} diff --git a/src/test/run-pass/consts/const-bitshift-rhs-inference.rs b/src/test/run-pass/consts/const-bitshift-rhs-inference.rs new file mode 100644 index 00000000000..63b8af77326 --- /dev/null +++ b/src/test/run-pass/consts/const-bitshift-rhs-inference.rs @@ -0,0 +1,34 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const RHS: u8 = 8; +const IRHS: i8 = 8; +const RHS16: u16 = 8; +const IRHS16: i16 = 8; +const RHS32: u32 = 8; +const IRHS32: i32 = 8; +const RHS64: u64 = 8; +const IRHS64: i64 = 8; +const RHSUS: usize = 8; +const IRHSIS: isize = 8; + +fn main() { + let _: [&'static str; 1 << RHS] = [""; 256]; + let _: [&'static str; 1 << IRHS] = [""; 256]; + let _: [&'static str; 1 << RHS16] = [""; 256]; + let _: [&'static str; 1 << IRHS16] = [""; 256]; + let _: [&'static str; 1 << RHS32] = [""; 256]; + let _: [&'static str; 1 << IRHS32] = [""; 256]; + let _: [&'static str; 1 << RHS64] = [""; 256]; + let _: [&'static str; 1 << IRHS64] = [""; 256]; + let _: [&'static str; 1 << RHSUS] = [""; 256]; + let _: [&'static str; 1 << IRHSIS] = [""; 256]; +} diff --git a/src/test/run-pass/consts/const-block-cross-crate-fn.rs b/src/test/run-pass/consts/const-block-cross-crate-fn.rs new file mode 100644 index 00000000000..c7d156fcf19 --- /dev/null +++ b/src/test/run-pass/consts/const-block-cross-crate-fn.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_const_block.rs + + +extern crate cci_const_block; + +pub fn main() { + assert_eq!(cci_const_block::BLOCK_FN_DEF(390), 400); +} diff --git a/src/test/run-pass/consts/const-block-item-macro-codegen.rs b/src/test/run-pass/consts/const-block-item-macro-codegen.rs new file mode 100644 index 00000000000..ab452e4fe46 --- /dev/null +++ b/src/test/run-pass/consts/const-block-item-macro-codegen.rs @@ -0,0 +1,49 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// General test that function items in static blocks +// can be generated with a macro. + + +struct MyType { + desc: &'static str, + data: usize, + code: fn(usize, usize) -> usize +} + +impl MyType { + fn eval(&self, a: usize) -> usize { + (self.code)(self.data, a) + } +} + +macro_rules! codegen { + ($e:expr, $v:expr) => { + { + fn generated(a: usize, b: usize) -> usize { + a - ($e * b) + } + MyType { + desc: "test", + data: $v, + code: generated + } + } + } +} + +static GENERATED_CODE_1: MyType = codegen!(2, 100); +static GENERATED_CODE_2: MyType = codegen!(5, 1000); + +pub fn main() { + assert_eq!(GENERATED_CODE_1.eval(10), 80); + assert_eq!(GENERATED_CODE_2.eval(100), 500); +} diff --git a/src/test/run-pass/consts/const-block-item.rs b/src/test/run-pass/consts/const-block-item.rs new file mode 100644 index 00000000000..fe3483ae9f0 --- /dev/null +++ b/src/test/run-pass/consts/const-block-item.rs @@ -0,0 +1,50 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod foo { + pub trait Value { + fn value(&self) -> usize; + } +} + +static BLOCK_USE: usize = { + use foo::Value; + 100 +}; + +static BLOCK_STRUCT_DEF: usize = { + struct Foo { + a: usize + } + Foo{ a: 300 }.a +}; + +static BLOCK_FN_DEF: fn(usize) -> usize = { + fn foo(a: usize) -> usize { + a + 10 + } + foo +}; + +static BLOCK_MACRO_RULES: usize = { + macro_rules! baz { + () => (412) + } + baz!() +}; + +pub fn main() { + assert_eq!(BLOCK_USE, 100); + assert_eq!(BLOCK_STRUCT_DEF, 300); + assert_eq!(BLOCK_FN_DEF(390), 400); + assert_eq!(BLOCK_MACRO_RULES, 412); +} diff --git a/src/test/run-pass/consts/const-block.rs b/src/test/run-pass/consts/const-block.rs new file mode 100644 index 00000000000..1b9330a6ebf --- /dev/null +++ b/src/test/run-pass/consts/const-block.rs @@ -0,0 +1,55 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(dead_code)] +#![allow(unused_unsafe)] + +use std::marker::Sync; + +struct Foo { + a: usize, + b: *const () +} + +unsafe impl Sync for Foo {} + +fn foo(a: T) -> T { + a +} + +static BLOCK_INTEGRAL: usize = { 1 }; +static BLOCK_EXPLICIT_UNIT: () = { () }; +static BLOCK_IMPLICIT_UNIT: () = { }; +static BLOCK_FLOAT: f64 = { 1.0 }; +static BLOCK_ENUM: Option = { Some(100) }; +static BLOCK_STRUCT: Foo = { Foo { a: 12, b: 0 as *const () } }; +static BLOCK_UNSAFE: usize = unsafe { 1000 }; + +static BLOCK_FN_INFERRED: fn(usize) -> usize = { foo }; + +static BLOCK_FN: fn(usize) -> usize = { foo:: }; + +static BLOCK_ENUM_CONSTRUCTOR: fn(usize) -> Option = { Some }; + +pub fn main() { + assert_eq!(BLOCK_INTEGRAL, 1); + assert_eq!(BLOCK_EXPLICIT_UNIT, ()); + assert_eq!(BLOCK_IMPLICIT_UNIT, ()); + assert_eq!(BLOCK_FLOAT, 1.0_f64); + assert_eq!(BLOCK_STRUCT.a, 12); + assert_eq!(BLOCK_STRUCT.b, 0 as *const ()); + assert_eq!(BLOCK_ENUM, Some(100)); + assert_eq!(BLOCK_UNSAFE, 1000); + assert_eq!(BLOCK_FN_INFERRED(300), 300); + assert_eq!(BLOCK_FN(300), 300); + assert_eq!(BLOCK_ENUM_CONSTRUCTOR(200), Some(200)); +} diff --git a/src/test/run-pass/consts/const-bound.rs b/src/test/run-pass/consts/const-bound.rs new file mode 100644 index 00000000000..a4ac766a740 --- /dev/null +++ b/src/test/run-pass/consts/const-bound.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Make sure const bounds work on things, and test that a few types +// are const. + +// pretty-expanded FIXME #23616 + +fn foo(x: T) -> T { x } + +struct F { field: isize } + +pub fn main() { + /*foo(1); + foo("hi".to_string()); + foo(vec![1, 2, 3]); + foo(F{field: 42}); + foo((1, 2)); + foo(@1);*/ + foo(Box::new(1)); +} diff --git a/src/test/run-pass/consts/const-byte-str-cast.rs b/src/test/run-pass/consts/const-byte-str-cast.rs new file mode 100644 index 00000000000..175d48e5c01 --- /dev/null +++ b/src/test/run-pass/consts/const-byte-str-cast.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[deny(warnings)] + +pub fn main() { + let _ = b"x" as &[u8]; + let _ = b"y" as &[u8; 1]; + let _ = b"z" as *const u8; + let _ = "ä" as *const str; +} diff --git a/src/test/run-pass/consts/const-cast-ptr-int.rs b/src/test/run-pass/consts/const-cast-ptr-int.rs new file mode 100644 index 00000000000..f12a73f0ea6 --- /dev/null +++ b/src/test/run-pass/consts/const-cast-ptr-int.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +use std::ptr; + +struct TestStruct { + x: *const u8 +} + +unsafe impl Sync for TestStruct {} + +static a: TestStruct = TestStruct{x: 0 as *const u8}; + +pub fn main() { + assert_eq!(a.x, ptr::null()); +} diff --git a/src/test/run-pass/consts/const-cast.rs b/src/test/run-pass/consts/const-cast.rs new file mode 100644 index 00000000000..100034ccc30 --- /dev/null +++ b/src/test/run-pass/consts/const-cast.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +struct TestStruct { + x: *const u8, +} + +unsafe impl Sync for TestStruct {} + +extern fn foo() {} +const x: extern "C" fn() = foo; +static y: TestStruct = TestStruct { x: x as *const u8 }; + +pub fn main() { + assert_eq!(x as *const u8, y.x); +} diff --git a/src/test/run-pass/consts/const-const.rs b/src/test/run-pass/consts/const-const.rs new file mode 100644 index 00000000000..160d10d3b11 --- /dev/null +++ b/src/test/run-pass/consts/const-const.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +const a: isize = 1; +const b: isize = a + 2; + +pub fn main() { + assert_eq!(b, 3); +} diff --git a/src/test/run-pass/consts/const-contents.rs b/src/test/run-pass/consts/const-contents.rs new file mode 100644 index 00000000000..3d99af9ee66 --- /dev/null +++ b/src/test/run-pass/consts/const-contents.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #570 +#![allow(non_upper_case_globals)] + +static lsl : isize = 1 << 2; +static add : isize = 1 + 2; +static addf : f64 = 1.0 + 2.0; +static not : isize = !0; +static notb : bool = !true; +static neg : isize = -(1); + +pub fn main() { + assert_eq!(lsl, 4); + assert_eq!(add, 3); + assert_eq!(addf, 3.0); + assert_eq!(not, -1); + assert_eq!(notb, false); + assert_eq!(neg, -1); +} diff --git a/src/test/run-pass/consts/const-cross-crate-const.rs b/src/test/run-pass/consts/const-cross-crate-const.rs new file mode 100644 index 00000000000..3e8eb9a422d --- /dev/null +++ b/src/test/run-pass/consts/const-cross-crate-const.rs @@ -0,0 +1,26 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_const.rs +#![allow(non_upper_case_globals)] + +extern crate cci_const; +static foo: &'static str = cci_const::foopy; +static a: usize = cci_const::uint_val; +static b: usize = cci_const::uint_expr + 5; + +pub fn main() { + assert_eq!(a, 12); + let foo2 = a; + assert_eq!(foo2, cci_const::uint_val); + assert_eq!(b, cci_const::uint_expr + 5); + assert_eq!(foo, cci_const::foopy); +} diff --git a/src/test/run-pass/consts/const-cross-crate-extern.rs b/src/test/run-pass/consts/const-cross-crate-extern.rs new file mode 100644 index 00000000000..504b872782b --- /dev/null +++ b/src/test/run-pass/consts/const-cross-crate-extern.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_const.rs +#![allow(non_upper_case_globals)] + +extern crate cci_const; +use cci_const::bar; +static foo: extern "C" fn() = bar; + +pub fn main() { + assert!(foo == bar); +} diff --git a/src/test/run-pass/consts/const-deref.rs b/src/test/run-pass/consts/const-deref.rs new file mode 100644 index 00000000000..39515c8546a --- /dev/null +++ b/src/test/run-pass/consts/const-deref.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const C: &'static isize = &1000; +static D: isize = *C; + +pub fn main() { + assert_eq!(D, 1000); +} diff --git a/src/test/run-pass/consts/const-endianess.rs b/src/test/run-pass/consts/const-endianess.rs new file mode 100644 index 00000000000..4ac46955709 --- /dev/null +++ b/src/test/run-pass/consts/const-endianess.rs @@ -0,0 +1,33 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(const_int_ops)] +#![feature(test)] + +extern crate test; +use test::black_box as b; + +const BE_U32: u32 = 55u32.to_be(); +const LE_U32: u32 = 55u32.to_le(); + + +fn main() { + assert_eq!(BE_U32, b(55u32).to_be()); + assert_eq!(LE_U32, b(55u32).to_le()); + + #[cfg(not(target_arch = "asmjs"))] + { + const BE_U128: u128 = 999999u128.to_be(); + const LE_I128: i128 = (-999999i128).to_le(); + assert_eq!(BE_U128, b(999999u128).to_be()); + assert_eq!(LE_I128, b(-999999i128).to_le()); + } +} diff --git a/src/test/run-pass/consts/const-enum-byref-self.rs b/src/test/run-pass/consts/const-enum-byref-self.rs new file mode 100644 index 00000000000..9656bc54eb2 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-byref-self.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V, VV(isize) } +static C: E = E::V; + +impl E { + pub fn method(&self) { + match *self { + E::V => {} + E::VV(..) => panic!() + } + } +} + +pub fn main() { + C.method() +} diff --git a/src/test/run-pass/consts/const-enum-byref.rs b/src/test/run-pass/consts/const-enum-byref.rs new file mode 100644 index 00000000000..1e418f66c13 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-byref.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V, VV(isize) } +static C: E = E::V; + +fn f(a: &E) { + match *a { + E::V => {} + E::VV(..) => panic!() + } +} + +pub fn main() { + f(&C) +} diff --git a/src/test/run-pass/consts/const-enum-cast.rs b/src/test/run-pass/consts/const-enum-cast.rs new file mode 100644 index 00000000000..39602153c79 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-cast.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +enum A { A1, A2 } +enum B { B1=0, B2=2 } + +pub fn main () { + static c1: isize = A::A2 as isize; + static c2: isize = B::B2 as isize; + let a1 = A::A2 as isize; + let a2 = B::B2 as isize; + assert_eq!(c1, 1); + assert_eq!(c2, 2); + assert_eq!(a1, 1); + assert_eq!(a2, 2); +} diff --git a/src/test/run-pass/consts/const-enum-ptr.rs b/src/test/run-pass/consts/const-enum-ptr.rs new file mode 100644 index 00000000000..78c784e4bb3 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-ptr.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V0, V1(isize) } +static C: &'static E = &E::V0; + +pub fn main() { + match *C { + E::V0 => (), + _ => panic!() + } +} diff --git a/src/test/run-pass/consts/const-enum-struct.rs b/src/test/run-pass/consts/const-enum-struct.rs new file mode 100644 index 00000000000..4a4ad9d89e6 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-struct.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V16(u16), V32(u32) } +struct S { a: E, b: u16, c: u16 } +static C: S = S { a: E::V16(0xDEAD), b: 0x600D, c: 0xBAD }; + +pub fn main() { + let n = C.b; + assert!(n != 0xBAD); + assert_eq!(n, 0x600D); +} diff --git a/src/test/run-pass/consts/const-enum-struct2.rs b/src/test/run-pass/consts/const-enum-struct2.rs new file mode 100644 index 00000000000..c37b06f8337 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-struct2.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V0, V16(u16) } +struct S { a: E, b: u16, c: u16 } +static C: S = S { a: E::V0, b: 0x600D, c: 0xBAD }; + +pub fn main() { + let n = C.b; + assert!(n != 0xBAD); + assert_eq!(n, 0x600D); +} diff --git a/src/test/run-pass/consts/const-enum-structlike.rs b/src/test/run-pass/consts/const-enum-structlike.rs new file mode 100644 index 00000000000..a6bac3c9e7d --- /dev/null +++ b/src/test/run-pass/consts/const-enum-structlike.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { + S0 { s: String }, + S1 { u: usize } +} + +static C: E = E::S1 { u: 23 }; + +pub fn main() { + match C { + E::S0 { .. } => panic!(), + E::S1 { u } => assert_eq!(u, 23) + } +} diff --git a/src/test/run-pass/consts/const-enum-tuple.rs b/src/test/run-pass/consts/const-enum-tuple.rs new file mode 100644 index 00000000000..2f0dcdaf9b2 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-tuple.rs @@ -0,0 +1,20 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V16(u16), V32(u32) } +static C: (E, u16, u16) = (E::V16(0xDEAD), 0x600D, 0xBAD); + +pub fn main() { + let (_, n, _) = C; + assert!(n != 0xBAD); + assert_eq!(n, 0x600D); +} diff --git a/src/test/run-pass/consts/const-enum-tuple2.rs b/src/test/run-pass/consts/const-enum-tuple2.rs new file mode 100644 index 00000000000..1db56e0e6f2 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-tuple2.rs @@ -0,0 +1,20 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V0, V16(u16) } +static C: (E, u16, u16) = (E::V0, 0x600D, 0xBAD); + +pub fn main() { + let (_, n, _) = C; + assert!(n != 0xBAD); + assert_eq!(n, 0x600D); +} diff --git a/src/test/run-pass/consts/const-enum-tuplestruct.rs b/src/test/run-pass/consts/const-enum-tuplestruct.rs new file mode 100644 index 00000000000..f37ff4d9c99 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-tuplestruct.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V16(u16), V32(u32) } +struct S(E, u16, u16); +static C: S = S(E::V16(0xDEAD), 0x600D, 0xBAD); + +pub fn main() { + let S(_, n, _) = C; + assert!(n != 0xBAD); + assert_eq!(n, 0x600D); +} diff --git a/src/test/run-pass/consts/const-enum-tuplestruct2.rs b/src/test/run-pass/consts/const-enum-tuplestruct2.rs new file mode 100644 index 00000000000..5d6a77dddb8 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-tuplestruct2.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V0, V16(u16) } +struct S(E, u16, u16); +static C: S = S(E::V0, 0x600D, 0xBAD); + +pub fn main() { + let S(_, n, _) = C; + assert!(n != 0xBAD); + assert_eq!(n, 0x600D); +} diff --git a/src/test/run-pass/consts/const-enum-vec-index.rs b/src/test/run-pass/consts/const-enum-vec-index.rs new file mode 100644 index 00000000000..067cc2bc75f --- /dev/null +++ b/src/test/run-pass/consts/const-enum-vec-index.rs @@ -0,0 +1,40 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Copy, Clone)] +enum E { V1(isize), V0 } + +const C: &'static [E] = &[E::V0, E::V1(0xDEADBEE)]; +static C0: E = C[0]; +static C1: E = C[1]; +const D: &'static [E; 2] = &[E::V0, E::V1(0xDEAFBEE)]; +static D0: E = D[0]; +static D1: E = D[1]; + +pub fn main() { + match C0 { + E::V0 => (), + _ => panic!() + } + match C1 { + E::V1(n) => assert_eq!(n, 0xDEADBEE), + _ => panic!() + } + + match D0 { + E::V0 => (), + _ => panic!() + } + match D1 { + E::V1(n) => assert_eq!(n, 0xDEAFBEE), + _ => panic!() + } +} diff --git a/src/test/run-pass/consts/const-enum-vec-ptr.rs b/src/test/run-pass/consts/const-enum-vec-ptr.rs new file mode 100644 index 00000000000..a8a3dec5bdc --- /dev/null +++ b/src/test/run-pass/consts/const-enum-vec-ptr.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V1(isize), V0 } +static C: &'static [E] = &[E::V0, E::V1(0xDEADBEE), E::V0]; + +pub fn main() { + match C[1] { + E::V1(n) => assert_eq!(n, 0xDEADBEE), + _ => panic!() + } + match C[2] { + E::V0 => (), + _ => panic!() + } +} diff --git a/src/test/run-pass/consts/const-enum-vector.rs b/src/test/run-pass/consts/const-enum-vector.rs new file mode 100644 index 00000000000..e95742451b4 --- /dev/null +++ b/src/test/run-pass/consts/const-enum-vector.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { V1(isize), V0 } +static C: [E; 3] = [E::V0, E::V1(0xDEADBEE), E::V0]; + +pub fn main() { + match C[1] { + E::V1(n) => assert_eq!(n, 0xDEADBEE), + _ => panic!() + } + match C[2] { + E::V0 => (), + _ => panic!() + } +} diff --git a/src/test/run-pass/consts/const-err.rs b/src/test/run-pass/consts/const-err.rs new file mode 100644 index 00000000000..2074ee3e908 --- /dev/null +++ b/src/test/run-pass/consts/const-err.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check for const_err regressions + +#![deny(const_err)] + +const X: *const u8 = b"" as _; +const Y: bool = 'A' == 'B'; +const Z: char = 'A'; +const W: bool = Z <= 'B'; + + +fn main() { + let _ = ((-1 as i8) << 8 - 1) as f32; + let _ = 0u8 as char; + let _ = true > false; + let _ = true >= false; + let _ = true < false; + let _ = true >= false; +} diff --git a/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs b/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs new file mode 100644 index 00000000000..c67946d6fa1 --- /dev/null +++ b/src/test/run-pass/consts/const-expr-in-fixed-length-vec.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that constant expressions can be used for declaring the +// type of a fixed length vector. + +// pretty-expanded FIXME #23616 + +pub fn main() { + + const FOO: usize = 2; + let _v: [isize; FOO*3]; + +} diff --git a/src/test/run-pass/consts/const-expr-in-vec-repeat.rs b/src/test/run-pass/consts/const-expr-in-vec-repeat.rs new file mode 100644 index 00000000000..150d24b3106 --- /dev/null +++ b/src/test/run-pass/consts/const-expr-in-vec-repeat.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that constant expressions can be used in vec repeat syntax. + +// pretty-expanded FIXME #23616 + +pub fn main() { + + const FOO: usize = 2; + let _v = [0; FOO*3*2/2]; + +} diff --git a/src/test/run-pass/consts/const-extern-function.rs b/src/test/run-pass/consts/const-extern-function.rs new file mode 100644 index 00000000000..e7e11e74086 --- /dev/null +++ b/src/test/run-pass/consts/const-extern-function.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +extern fn foopy() {} + +static f: extern "C" fn() = foopy; +static s: S = S { f: foopy }; + +struct S { + f: extern "C" fn() +} + +pub fn main() { + assert!(foopy as extern "C" fn() == f); + assert!(f == s.f); +} diff --git a/src/test/run-pass/consts/const-fields-and-indexing.rs b/src/test/run-pass/consts/const-fields-and-indexing.rs new file mode 100644 index 00000000000..c0ba4404f00 --- /dev/null +++ b/src/test/run-pass/consts/const-fields-and-indexing.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +const x : [isize; 4] = [1,2,3,4]; +static p : isize = x[2]; +const y : &'static [isize] = &[1,2,3,4]; +static q : isize = y[2]; + +struct S {a: isize, b: isize} + +const s : S = S {a: 10, b: 20}; +static t : isize = s.b; + +struct K {a: isize, b: isize, c: D} +struct D { d: isize, e: isize } + +const k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}}; +static m : isize = k.c.e; + +pub fn main() { + println!("{}", p); + println!("{}", q); + println!("{}", t); + assert_eq!(p, 3); + assert_eq!(q, 3); + assert_eq!(t, 20); +} diff --git a/src/test/run-pass/consts/const-fn-const-eval.rs b/src/test/run-pass/consts/const-fn-const-eval.rs new file mode 100644 index 00000000000..897073cd623 --- /dev/null +++ b/src/test/run-pass/consts/const-fn-const-eval.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +const fn add(x: usize, y: usize) -> usize { + x + y +} + +const ARR: [i32; add(1, 2)] = [5, 6, 7]; + +pub fn main() {} diff --git a/src/test/run-pass/consts/const-fn-feature-flags.rs b/src/test/run-pass/consts/const-fn-feature-flags.rs new file mode 100644 index 00000000000..be529db3c08 --- /dev/null +++ b/src/test/run-pass/consts/const-fn-feature-flags.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test use of stabilized const fns in std formerly using individual feature gates. + +use std::cell::Cell; + +const CELL: Cell = Cell::new(42); + +fn main() { + let v = CELL.get(); + CELL.set(v+1); + + assert_eq!(CELL.get(), v); +} + diff --git a/src/test/run-pass/consts/const-fn-method.rs b/src/test/run-pass/consts/const-fn-method.rs new file mode 100644 index 00000000000..3ecb4fffba1 --- /dev/null +++ b/src/test/run-pass/consts/const-fn-method.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +struct Foo { value: u32 } + +impl Foo { + const fn new() -> Foo { + Foo { value: 22 } + } +} + +const FOO: Foo = Foo::new(); + +pub fn main() { + assert_eq!(FOO.value, 22); + let _: [&'static str; Foo::new().value as usize] = ["hey"; 22]; +} diff --git a/src/test/run-pass/consts/const-fn-nested.rs b/src/test/run-pass/consts/const-fn-nested.rs new file mode 100644 index 00000000000..41198a901c2 --- /dev/null +++ b/src/test/run-pass/consts/const-fn-nested.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a call whose argument is the result of another call. + +#![feature(min_const_fn)] + +const fn sub(x: u32, y: u32) -> u32 { + x - y +} + +const X: u32 = sub(sub(88, 44), 22); + +fn main() { + assert_eq!(X, 22); +} diff --git a/src/test/run-pass/consts/const-fn-stability-calls.rs b/src/test/run-pass/consts/const-fn-stability-calls.rs new file mode 100644 index 00000000000..b520ebab17c --- /dev/null +++ b/src/test/run-pass/consts/const-fn-stability-calls.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test use of const fn from another crate without a feature gate. + +// aux-build:const_fn_lib.rs + +extern crate const_fn_lib; + +use const_fn_lib::foo; + +static FOO: usize = foo(); +const BAR: usize = foo(); + +macro_rules! constant { + ($n:ident: $t:ty = $v:expr) => { + const $n: $t = $v; + } +} + +constant! { + BAZ: usize = foo() +} + +fn main() { + let x: [usize; foo()] = [42; foo()]; +} diff --git a/src/test/run-pass/consts/const-fn-val.rs b/src/test/run-pass/consts/const-fn-val.rs new file mode 100644 index 00000000000..4b6b529617f --- /dev/null +++ b/src/test/run-pass/consts/const-fn-val.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] +#![allow(overflowing_literals)] + +fn foo() -> isize { + return 0xca7f000d; +} + +struct Bar where F: FnMut() -> isize { f: F } + +static mut b : Bar isize> = Bar { f: foo as fn() -> isize}; + +pub fn main() { + unsafe { assert_eq!((b.f)(), 0xca7f000d); } +} diff --git a/src/test/run-pass/consts/const-fn.rs b/src/test/run-pass/consts/const-fn.rs new file mode 100644 index 00000000000..616429bf1df --- /dev/null +++ b/src/test/run-pass/consts/const-fn.rs @@ -0,0 +1,52 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// A very basic test of const fn functionality. + +#![feature(const_fn, const_indexing)] + +const fn add(x: u32, y: u32) -> u32 { + x + y +} + +const fn sub(x: u32, y: u32) -> u32 { + x - y +} + +const unsafe fn div(x: u32, y: u32) -> u32 { + x / y +} + +const fn generic(t: T) -> T { + t +} + +const fn generic_arr(t: [T; 1]) -> T { + t[0] +} + +const SUM: u32 = add(44, 22); +const DIFF: u32 = sub(44, 22); +const DIV: u32 = unsafe{div(44, 22)}; + +fn main() { + assert_eq!(SUM, 66); + assert!(SUM != 88); + + assert_eq!(DIFF, 22); + assert_eq!(DIV, 2); + + let _: [&'static str; sub(100, 99) as usize] = ["hi"]; + let _: [&'static str; generic(1)] = ["hi"]; + let _: [&'static str; generic_arr([1])] = ["hi"]; +} diff --git a/src/test/run-pass/consts/const-index-feature-gate.rs b/src/test/run-pass/consts/const-index-feature-gate.rs new file mode 100644 index 00000000000..3e26ea9dcae --- /dev/null +++ b/src/test/run-pass/consts/const-index-feature-gate.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const ARR: [usize; 1] = [2]; +const ARR2: [i32; ARR[0]] = [5, 6]; + +fn main() { +} diff --git a/src/test/run-pass/consts/const-meth-pattern.rs b/src/test/run-pass/consts/const-meth-pattern.rs new file mode 100644 index 00000000000..1762c17e943 --- /dev/null +++ b/src/test/run-pass/consts/const-meth-pattern.rs @@ -0,0 +1,30 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(min_const_fn)] + +struct A; + +impl A { + const fn banana() -> bool { + true + } +} + +const ABANANA: bool = A::banana(); + +fn main() { + match true { + ABANANA => {}, + _ => panic!("what?") + } +} diff --git a/src/test/run-pass/consts/const-negation.rs b/src/test/run-pass/consts/const-negation.rs new file mode 100644 index 00000000000..048aa1f4e7a --- /dev/null +++ b/src/test/run-pass/consts/const-negation.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +#[deny(const_err)] + +fn main() { + #[cfg(target_pointer_width = "32")] + const I: isize = -2147483648isize; + #[cfg(target_pointer_width = "64")] + const I: isize = -9223372036854775808isize; + assert_eq!(::std::i32::MIN as u64, 0xffffffff80000000); + assert_eq!(-2147483648isize as u64, 0xffffffff80000000); + assert_eq!(-2147483648i32 as u64, 0xffffffff80000000); + assert_eq!(::std::i64::MIN as u64, 0x8000000000000000); + #[cfg(target_pointer_width = "64")] + assert_eq!(-9223372036854775808isize as u64, 0x8000000000000000); + #[cfg(target_pointer_width = "32")] + assert_eq!(-9223372036854775808isize as u64, 0); + assert_eq!(-9223372036854775808i32 as u64, 0); + const J: usize = ::std::i32::MAX as usize; + const K: usize = -1i32 as u32 as usize; + const L: usize = ::std::i32::MIN as usize; + const M: usize = ::std::i64::MIN as usize; + match 5 { + J => {}, + K => {}, + L => {}, + M => {}, + _ => {} + } + match 5 { + I => {}, + _ => {} + } +} diff --git a/src/test/run-pass/consts/const-negative.rs b/src/test/run-pass/consts/const-negative.rs new file mode 100644 index 00000000000..9b3c846deac --- /dev/null +++ b/src/test/run-pass/consts/const-negative.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #358 +#![allow(non_upper_case_globals)] + +static toplevel_mod: isize = -1; + +pub fn main() { + assert_eq!(toplevel_mod, -1); +} diff --git a/src/test/run-pass/consts/const-nullary-enum.rs b/src/test/run-pass/consts/const-nullary-enum.rs new file mode 100644 index 00000000000..d1e359eab4e --- /dev/null +++ b/src/test/run-pass/consts/const-nullary-enum.rs @@ -0,0 +1,32 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum Foo { + Bar, + Baz, + Boo, +} + +static X: Foo = Foo::Bar; + +pub fn main() { + match X { + Foo::Bar => {} + Foo::Baz | Foo::Boo => panic!() + } + match Y { + Foo::Baz => {} + Foo::Bar | Foo::Boo => panic!() + } +} + +static Y: Foo = Foo::Baz; diff --git a/src/test/run-pass/consts/const-nullary-univariant-enum.rs b/src/test/run-pass/consts/const-nullary-univariant-enum.rs new file mode 100644 index 00000000000..aa255c4fdeb --- /dev/null +++ b/src/test/run-pass/consts/const-nullary-univariant-enum.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(Copy, Clone)] +enum Foo { + Bar = 0xDEADBEE +} + +static X: Foo = Foo::Bar; + +pub fn main() { + assert_eq!((X as usize), 0xDEADBEE); + assert_eq!((Y as usize), 0xDEADBEE); +} + +static Y: Foo = Foo::Bar; diff --git a/src/test/run-pass/consts/const-pattern-variant.rs b/src/test/run-pass/consts/const-pattern-variant.rs new file mode 100644 index 00000000000..95e0a5a62e3 --- /dev/null +++ b/src/test/run-pass/consts/const-pattern-variant.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +#[derive(PartialEq, Eq)] +enum Cake { + BlackForest, + Marmor, +} +use Cake::*; + +const BOO: (Cake, Cake) = (Marmor, BlackForest); +const FOO: Cake = BOO.1; + +const fn foo() -> Cake { + Marmor +} + +const WORKS: Cake = Marmor; + +const GOO: Cake = foo(); + +fn main() { + match BlackForest { + FOO => println!("hi"), + GOO => println!("meh"), + WORKS => println!("möp"), + _ => println!("bye"), + } +} diff --git a/src/test/run-pass/consts/const-rec-and-tup.rs b/src/test/run-pass/consts/const-rec-and-tup.rs new file mode 100644 index 00000000000..15f74d23b6d --- /dev/null +++ b/src/test/run-pass/consts/const-rec-and-tup.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] +#![allow(overflowing_literals)] + +struct Pair { a: f64, b: f64 } + +struct AnotherPair { x: (i64, i64), y: Pair } + +static x : (i32,i32) = (0xfeedf00dd,0xca11ab1e); +static y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0, + 0xabababab_abababab), + y: Pair { a: 3.14159265358979323846, + b: 2.7182818284590452354 }}; + +pub fn main() { + let (p, _) = y.x; + assert_eq!(p, - 1085102592571150096); + println!("{:#x}", p); +} diff --git a/src/test/run-pass/consts/const-region-ptrs-noncopy.rs b/src/test/run-pass/consts/const-region-ptrs-noncopy.rs new file mode 100644 index 00000000000..fdbebc47990 --- /dev/null +++ b/src/test/run-pass/consts/const-region-ptrs-noncopy.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +type Big = [u64; 8]; +struct Pair<'a> { a: isize, b: &'a Big } +const x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]); +const y: &'static Pair<'static> = &Pair {a: 15, b: x}; + +pub fn main() { + assert_eq!(x as *const Big, y.b as *const Big); +} diff --git a/src/test/run-pass/consts/const-region-ptrs.rs b/src/test/run-pass/consts/const-region-ptrs.rs new file mode 100644 index 00000000000..00f987c745c --- /dev/null +++ b/src/test/run-pass/consts/const-region-ptrs.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +struct Pair<'a> { a: isize, b: &'a isize } + +const x: &'static isize = &10; + +const y: &'static Pair<'static> = &Pair {a: 15, b: x}; + +pub fn main() { + println!("x = {}", *x); + println!("y = {{a: {}, b: {}}}", y.a, *(y.b)); + assert_eq!(*x, 10); + assert_eq!(*(y.b), 10); +} diff --git a/src/test/run-pass/consts/const-repeated-values.rs b/src/test/run-pass/consts/const-repeated-values.rs new file mode 100644 index 00000000000..15a377c9c25 --- /dev/null +++ b/src/test/run-pass/consts/const-repeated-values.rs @@ -0,0 +1,20 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const FOO: isize = 42; + +enum Bar { + Boo = *[&FOO; 4][3], +} + +fn main() { + assert_eq!(Bar::Boo as isize, 42); +} diff --git a/src/test/run-pass/consts/const-size_of-align_of.rs b/src/test/run-pass/consts/const-size_of-align_of.rs new file mode 100644 index 00000000000..289c61ea9fa --- /dev/null +++ b/src/test/run-pass/consts/const-size_of-align_of.rs @@ -0,0 +1,61 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +use std::mem; + +// Get around the limitations of CTFE in today's Rust. +const fn choice_u64(c: bool, a: u64, b: u64) -> u64 { + (-(c as i64) as u64) & a | (-(!c as i64) as u64) & b +} + +const fn max_usize(a: usize, b: usize) -> usize { + choice_u64(a > b, a as u64, b as u64) as usize +} + +const fn align_to(size: usize, align: usize) -> usize { + (size + (align - 1)) & !(align - 1) +} + +const fn packed_union_size_of() -> usize { + max_usize(mem::size_of::(), mem::size_of::()) +} + +const fn union_align_of() -> usize { + max_usize(mem::align_of::(), mem::align_of::()) +} + +const fn union_size_of() -> usize { + align_to(packed_union_size_of::(), union_align_of::()) +} + +macro_rules! fake_union { + ($name:ident { $a:ty, $b:ty }) => ( + struct $name { + _align: ([$a; 0], [$b; 0]), + _bytes: [u8; union_size_of::<$a, $b>()] + } + ) +} + +// Check that we can (poorly) emulate unions by +// calling size_of and align_of at compile-time. +fake_union!(U { u16, [u8; 3] }); + +fn test(u: U) { + assert_eq!(mem::size_of_val(&u._bytes), 4); +} + +fn main() { + assert_eq!(mem::size_of::(), 4); + assert_eq!(mem::align_of::(), 2); +} diff --git a/src/test/run-pass/consts/const-str-ptr.rs b/src/test/run-pass/consts/const-str-ptr.rs new file mode 100644 index 00000000000..59482811829 --- /dev/null +++ b/src/test/run-pass/consts/const-str-ptr.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::{str, string}; + +const A: [u8; 2] = ['h' as u8, 'i' as u8]; +const B: &'static [u8; 2] = &A; +const C: *const u8 = B as *const u8; + +pub fn main() { + unsafe { + let foo = &A as *const u8; + assert_eq!(foo, C); + assert_eq!(str::from_utf8_unchecked(&A), "hi"); + assert_eq!(*C, A[0]); + assert_eq!(*(&B[0] as *const u8), A[0]); + } +} diff --git a/src/test/run-pass/consts/const-struct-offsets.rs b/src/test/run-pass/consts/const-struct-offsets.rs new file mode 100644 index 00000000000..ec77b59e09d --- /dev/null +++ b/src/test/run-pass/consts/const-struct-offsets.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_upper_case_globals)] + +enum Foo { + IntVal(i32), + Int64Val(i64) +} + +struct Bar { + i: i32, + v: Foo +} + +static bar: Bar = Bar { i: 0, v: Foo::IntVal(0) }; + +pub fn main() {} diff --git a/src/test/run-pass/consts/const-struct.rs b/src/test/run-pass/consts/const-struct.rs new file mode 100644 index 00000000000..0554356ab8e --- /dev/null +++ b/src/test/run-pass/consts/const-struct.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +use std::cmp; + +#[derive(Debug)] +struct foo { a: isize, b: isize, c: isize } + +impl cmp::PartialEq for foo { + fn eq(&self, other: &foo) -> bool { + (*self).a == (*other).a && + (*self).b == (*other).b && + (*self).c == (*other).c + } + fn ne(&self, other: &foo) -> bool { !(*self).eq(other) } +} + +const x : foo = foo { a:1, b:2, c: 3 }; +const y : foo = foo { b:2, c:3, a: 1 }; +const z : &'static foo = &foo { a: 10, b: 22, c: 12 }; +const w : foo = foo { a:5, ..x }; + +pub fn main() { + assert_eq!(x.b, 2); + assert_eq!(x, y); + assert_eq!(z.b, 22); + assert_eq!(w.a, 5); + assert_eq!(w.c, 3); + println!("{:#x}", x.b); + println!("{:#x}", z.c); +} diff --git a/src/test/run-pass/consts/const-trait-to-trait.rs b/src/test/run-pass/consts/const-trait-to-trait.rs new file mode 100644 index 00000000000..6b7e4972536 --- /dev/null +++ b/src/test/run-pass/consts/const-trait-to-trait.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #24644 - block causes a &Trait -> &Trait coercion: +trait Trait {} + +struct Bar; +impl Trait for Bar {} + +fn main() { + let x: &[&Trait] = &[{ &Bar }]; +} + +// Issue #25748 - the cast causes an &Encoding -> &Encoding coercion: +pub struct UTF8Encoding; +pub const UTF_8: &'static UTF8Encoding = &UTF8Encoding; +pub trait Encoding {} +impl Encoding for UTF8Encoding {} +pub fn f() -> &'static Encoding { UTF_8 as &'static Encoding } + +// Root of the problem: &Trait -> &Trait coercions: +const FOO: &'static Trait = &Bar; +const BAR: &'static Trait = FOO; +fn foo() { let _x = BAR; } diff --git a/src/test/run-pass/consts/const-tuple-struct.rs b/src/test/run-pass/consts/const-tuple-struct.rs new file mode 100644 index 00000000000..bee1c83e3f9 --- /dev/null +++ b/src/test/run-pass/consts/const-tuple-struct.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Bar(isize, isize); + +static X: Bar = Bar(1, 2); + +pub fn main() { + match X { + Bar(x, y) => { + assert_eq!(x, 1); + assert_eq!(y, 2); + } + } +} diff --git a/src/test/run-pass/consts/const-typeid-of.rs b/src/test/run-pass/consts/const-typeid-of.rs new file mode 100644 index 00000000000..153d6eccaab --- /dev/null +++ b/src/test/run-pass/consts/const-typeid-of.rs @@ -0,0 +1,44 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] +#![feature(const_type_id)] + +use std::any::TypeId; + +struct A; + +static ID_ISIZE: TypeId = TypeId::of::(); + +pub fn main() { + assert_eq!(ID_ISIZE, TypeId::of::()); + + // sanity test of TypeId + const T: (TypeId, TypeId, TypeId) = (TypeId::of::(), + TypeId::of::<&'static str>(), + TypeId::of::()); + let (d, e, f) = (TypeId::of::(), TypeId::of::<&'static str>(), + TypeId::of::()); + + assert!(T.0 != T.1); + assert!(T.0 != T.2); + assert!(T.1 != T.2); + + assert_eq!(T.0, d); + assert_eq!(T.1, e); + assert_eq!(T.2, f); + + // Check fn pointer against collisions + const F: (TypeId, TypeId) = (TypeId::of:: A) -> A>(), + TypeId::of:: A, A) -> A>()); + + assert!(F.0 != F.1); +} diff --git a/src/test/run-pass/consts/const-unit-struct.rs b/src/test/run-pass/consts/const-unit-struct.rs new file mode 100644 index 00000000000..6dcf75b5331 --- /dev/null +++ b/src/test/run-pass/consts/const-unit-struct.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo; + +static X: Foo = Foo; + +pub fn main() { + match X { + Foo => {} + } +} diff --git a/src/test/run-pass/consts/const-unsafe-fn.rs b/src/test/run-pass/consts/const-unsafe-fn.rs new file mode 100644 index 00000000000..6e05b0ac4d8 --- /dev/null +++ b/src/test/run-pass/consts/const-unsafe-fn.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A quick test of 'unsafe const fn' functionality + +#![feature(min_const_fn)] + +const unsafe fn dummy(v: u32) -> u32 { + !v +} + +struct Type; +impl Type { + const unsafe fn new() -> Type { + Type + } +} + +const VAL: u32 = unsafe { dummy(0xFFFF) }; +const TYPE_INST: Type = unsafe { Type::new() }; + +fn main() { + assert_eq!(VAL, 0xFFFF0000); +} diff --git a/src/test/run-pass/consts/const-vec-of-fns.rs b/src/test/run-pass/consts/const-vec-of-fns.rs new file mode 100644 index 00000000000..79387b5195b --- /dev/null +++ b/src/test/run-pass/consts/const-vec-of-fns.rs @@ -0,0 +1,35 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_upper_case_globals)] + +/*! + * Try to double-check that static fns have the right size (with or + * without dummy env ptr, as appropriate) by iterating a size-2 array. + * If the static size differs from the runtime size, the second element + * should be read as a null or otherwise wrong pointer and crash. + */ + +fn f() { } +static bare_fns: &'static [fn()] = &[f, f]; +struct S(F); +static mut closures: &'static mut [S] = &mut [S(f as fn()), S(f as fn())]; + +pub fn main() { + unsafe { + for &bare_fn in bare_fns { bare_fn() } + for closure in &mut *closures { + let S(ref mut closure) = *closure; + (*closure)() + } + } +} diff --git a/src/test/run-pass/consts/const-vec-syntax.rs b/src/test/run-pass/consts/const-vec-syntax.rs new file mode 100644 index 00000000000..ef979ca398e --- /dev/null +++ b/src/test/run-pass/consts/const-vec-syntax.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn f(_: &[isize]) {} + +pub fn main() { + let v = [ 1, 2, 3 ]; + f(&v); +} diff --git a/src/test/run-pass/consts/const-vecs-and-slices.rs b/src/test/run-pass/consts/const-vecs-and-slices.rs new file mode 100644 index 00000000000..85d227b2d6e --- /dev/null +++ b/src/test/run-pass/consts/const-vecs-and-slices.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +static x : [isize; 4] = [1,2,3,4]; +static y : &'static [isize] = &[1,2,3,4]; +static z : &'static [isize; 4] = &[1,2,3,4]; +static zz : &'static [isize] = &[1,2,3,4]; + +pub fn main() { + println!("{}", x[1]); + println!("{}", y[1]); + println!("{}", z[1]); + println!("{}", zz[1]); + assert_eq!(x[1], 2); + assert_eq!(x[3], 4); + assert_eq!(x[3], y[3]); + assert_eq!(z[1], 2); + assert_eq!(z[3], 4); + assert_eq!(z[3], y[3]); + assert_eq!(zz[1], 2); + assert_eq!(zz[3], 4); + assert_eq!(zz[3], y[3]); +} diff --git a/src/test/run-pass/consts/const.rs b/src/test/run-pass/consts/const.rs new file mode 100644 index 00000000000..7fc5ecb5bd7 --- /dev/null +++ b/src/test/run-pass/consts/const.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +static i: isize = 10; + +pub fn main() { println!("{}", i); } diff --git a/src/test/run-pass/consts/consts-in-patterns.rs b/src/test/run-pass/consts/consts-in-patterns.rs new file mode 100644 index 00000000000..b96ad2f40a5 --- /dev/null +++ b/src/test/run-pass/consts/consts-in-patterns.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +const FOO: isize = 10; +const BAR: isize = 3; + +const fn foo() -> isize { 4 } +const BOO: isize = foo(); + +pub fn main() { + let x: isize = 3; + let y = match x { + FOO => 1, + BAR => 2, + BOO => 4, + _ => 3 + }; + assert_eq!(y, 2); +} diff --git a/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs b/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs new file mode 100644 index 00000000000..52c3b073388 --- /dev/null +++ b/src/test/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:anon-extern-mod-cross-crate-1.rs +// pretty-expanded FIXME #23616 +// ignore-wasm32-bare no libc to test ffi with + +extern crate anonexternmod; + +use anonexternmod::rust_get_test_int; + +pub fn main() { + unsafe { + rust_get_test_int(); + } +} diff --git a/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs new file mode 100644 index 00000000000..741ce351da3 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="anonexternmod"] +#![feature(libc)] + +extern crate libc; + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_get_test_int() -> libc::intptr_t; +} diff --git a/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs b/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs new file mode 100644 index 00000000000..9d93d9689e7 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo { + pub x: isize +} + +impl Foo { + pub fn new() -> Foo { + Foo { x: 3 } + } +} diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs new file mode 100644 index 00000000000..9c90510a857 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo(x: &usize) -> usize { + *x +} diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs b/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs new file mode 100644 index 00000000000..b38e955231e --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_capture_clause.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::thread; +use std::sync::mpsc::{Receiver, channel}; + +pub fn foo(x: T) -> Receiver { + let (tx, rx) = channel(); + thread::spawn(move|| { + tx.send(x.clone()); + }); + rx +} diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_const.rs b/src/test/run-pass/cross-crate/auxiliary/cci_const.rs new file mode 100644 index 00000000000..ee8290050f9 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_const.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub extern fn bar() { +} + +pub const foopy: &'static str = "hi there"; +pub const uint_val: usize = 12; +pub const uint_expr: usize = (1 << uint_val) - 1; diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs new file mode 100644 index 00000000000..d8921f4e09a --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_impl_lib.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="cci_impl_lib"] + +pub trait uint_helpers { + fn to(&self, v: usize, f: F) where F: FnMut(usize); +} + +impl uint_helpers for usize { + #[inline] + fn to(&self, v: usize, mut f: F) where F: FnMut(usize) { + let mut i = *self; + while i < v { + f(i); + i += 1; + } + } +} diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs new file mode 100644 index 00000000000..07d03b4c759 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_iter_lib.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="cci_iter_lib"] + +#[inline] +pub fn iter(v: &[T], mut f: F) where F: FnMut(&T) { + let mut i = 0; + let n = v.len(); + while i < n { + f(&v[i]); + i += 1; + } +} diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs new file mode 100644 index 00000000000..91de734ec3a --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_nested_lib.rs @@ -0,0 +1,62 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(box_syntax)] + +use std::cell::RefCell; + +pub struct Entry { + key: A, + value: B +} + +pub struct alist { + eq_fn: extern "Rust" fn(A,A) -> bool, + data: Box>>>, +} + +pub fn alist_add(lst: &alist, k: A, v: B) { + let mut data = lst.data.borrow_mut(); + (*data).push(Entry{key:k, value:v}); +} + +pub fn alist_get( + lst: &alist, + k: A) + -> B { + let eq_fn = lst.eq_fn; + let data = lst.data.borrow(); + for entry in &(*data) { + if eq_fn(entry.key.clone(), k.clone()) { + return entry.value.clone(); + } + } + panic!(); +} + +#[inline] +pub fn new_int_alist() -> alist { + fn eq_int(a: isize, b: isize) -> bool { a == b } + return alist { + eq_fn: eq_int, + data: box RefCell::new(Vec::new()), + }; +} + +#[inline] +pub fn new_int_alist_2() -> alist { + #[inline] + fn eq_int(a: isize, b: isize) -> bool { a == b } + return alist { + eq_fn: eq_int, + data: box RefCell::new(Vec::new()), + }; +} diff --git a/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs b/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs new file mode 100644 index 00000000000..4c6f808c619 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="cci_no_inline_lib"] + + +// same as cci_iter_lib, more-or-less, but not marked inline +pub fn iter(v: Vec , mut f: F) where F: FnMut(usize) { + let mut i = 0; + let n = v.len(); + while i < n { + f(v[i]); + i += 1; + } +} diff --git a/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs b/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs new file mode 100644 index 00000000000..f95be3f4a1d --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub struct S { + x: isize, +} + +impl Drop for S { + fn drop(&mut self) { + println!("goodbye"); + } +} + +pub fn f() { + let x = S { x: 1 }; + let y = x; + let _z = y; +} diff --git a/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs b/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs new file mode 100644 index 00000000000..be3414b7ad2 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub struct Au(pub isize); diff --git a/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs b/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs new file mode 100644 index 00000000000..7248d0e543b --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/pub_static_array.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub static ARRAY: [u8; 1] = [1]; diff --git a/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs b/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs new file mode 100644 index 00000000000..cc4db1a9581 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/reexported_static_methods.rs @@ -0,0 +1,53 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use sub_foo::Foo; +pub use self::Bar as Baz; +pub use sub_foo::Boz; +pub use sub_foo::Bort; + +pub trait Bar { + fn bar() -> Self; +} + +impl Bar for isize { + fn bar() -> isize { 84 } +} + +pub mod sub_foo { + pub trait Foo { + fn foo() -> Self; + } + + impl Foo for isize { + fn foo() -> isize { 42 } + } + + pub struct Boz { + unused_str: String + } + + impl Boz { + pub fn boz(i: isize) -> bool { + i > 0 + } + } + + pub enum Bort { + Bort1, + Bort2 + } + + impl Bort { + pub fn bort() -> String { + "bort()".to_string() + } + } +} diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs new file mode 100644 index 00000000000..66c0300e260 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs @@ -0,0 +1,13 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait FromBuf<'a> { + fn from_buf(_: &'a [u8]) -> Self; +} diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs new file mode 100644 index 00000000000..5195839c067 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() -> isize { + static a: isize = 3; + a +} + +pub fn bar() -> isize { + foo::() +} diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs new file mode 100644 index 00000000000..6779438c672 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(associated_type_defaults)] + +pub trait Foo { + type Out: Default + ToString = T; +} + +impl Foo for () { +} + +impl Foo for () { + type Out = bool; +} diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs new file mode 100644 index 00000000000..48fb05f7779 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Request { + pub id: String, + pub arg: String, +} + +pub fn decode() -> Result { + (|| { + Ok(Request { + id: "hi".to_owned(), + arg: match Err(()) { + Ok(v) => v, + Err(e) => return Err(e) + }, + }) + })() +} diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs new file mode 100644 index 00000000000..d0da80e31b9 --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub static global: isize = 3; + +static global0: isize = 4; + +pub static global2: &'static isize = &global0; + +pub fn verify_same(a: &'static isize) { + let a = a as *const isize as usize; + let b = &global as *const isize as usize; + assert_eq!(a, b); +} + +pub fn verify_same2(a: &'static isize) { + let a = a as *const isize as usize; + let b = global2 as *const isize as usize; + assert_eq!(a, b); +} diff --git a/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs b/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs new file mode 100644 index 00000000000..7a69be2b06c --- /dev/null +++ b/src/test/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs @@ -0,0 +1,38 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +// used by the rpass test + +#[derive(Copy, Clone)] +pub struct Struct; + +#[derive(Copy, Clone)] +pub enum Unit { + UnitVariant, + Argument(Struct) +} + +#[derive(Copy, Clone)] +pub struct TupleStruct(pub usize, pub &'static str); + +// used by the cfail test + +#[derive(Copy, Clone)] +pub struct StructWithFields { + foo: isize, +} + +#[derive(Copy, Clone)] +pub enum EnumWithVariants { + EnumVariant, + EnumVariantArg(isize) +} diff --git a/src/test/run-pass/cross-crate/cci_borrow.rs b/src/test/run-pass/cross-crate/cci_borrow.rs new file mode 100644 index 00000000000..6e822d7cb68 --- /dev/null +++ b/src/test/run-pass/cross-crate/cci_borrow.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_borrow_lib.rs + +#![feature(box_syntax)] + +extern crate cci_borrow_lib; +use cci_borrow_lib::foo; + +pub fn main() { + let p: Box<_> = box 22; + let r = foo(&*p); + println!("r={}", r); + assert_eq!(r, 22); +} diff --git a/src/test/run-pass/cross-crate/cci_capture_clause.rs b/src/test/run-pass/cross-crate/cci_capture_clause.rs new file mode 100644 index 00000000000..ea389d314b5 --- /dev/null +++ b/src/test/run-pass/cross-crate/cci_capture_clause.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_capture_clause.rs + +// This test makes sure we can do cross-crate inlining on functions +// that use capture clauses. + +// pretty-expanded FIXME #23616 +// ignore-emscripten no threads support + +extern crate cci_capture_clause; + +pub fn main() { + cci_capture_clause::foo(()).recv().unwrap(); +} diff --git a/src/test/run-pass/cross-crate/cci_impl_exe.rs b/src/test/run-pass/cross-crate/cci_impl_exe.rs new file mode 100644 index 00000000000..18378ca63ed --- /dev/null +++ b/src/test/run-pass/cross-crate/cci_impl_exe.rs @@ -0,0 +1,28 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_impl_lib.rs + +extern crate cci_impl_lib; +use cci_impl_lib::uint_helpers; + +pub fn main() { + //let bt0 = sys::frame_address(); + //println!("%?", bt0); + + 3.to(10, |i| { + println!("{}", i); + + //let bt1 = sys::frame_address(); + //println!("%?", bt1); + //assert_eq!(bt0, bt1); + }) +} diff --git a/src/test/run-pass/cross-crate/cci_iter_exe.rs b/src/test/run-pass/cross-crate/cci_iter_exe.rs new file mode 100644 index 00000000000..89c01bab3ca --- /dev/null +++ b/src/test/run-pass/cross-crate/cci_iter_exe.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_iter_lib.rs + +extern crate cci_iter_lib; + +pub fn main() { + //let bt0 = sys::rusti::frame_address(1); + //println!("%?", bt0); + cci_iter_lib::iter(&[1, 2, 3], |i| { + println!("{}", *i); + //assert_eq!(bt0, sys::rusti::frame_address(2)); + }) +} diff --git a/src/test/run-pass/cross-crate/cci_nested_exe.rs b/src/test/run-pass/cross-crate/cci_nested_exe.rs new file mode 100644 index 00000000000..3e88aad55f3 --- /dev/null +++ b/src/test/run-pass/cross-crate/cci_nested_exe.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_nested_lib.rs + + +extern crate cci_nested_lib; +use cci_nested_lib::*; + +pub fn main() { + let lst = new_int_alist(); + alist_add(&lst, 22, "hi".to_string()); + alist_add(&lst, 44, "ho".to_string()); + assert_eq!(alist_get(&lst, 22), "hi".to_string()); + assert_eq!(alist_get(&lst, 44), "ho".to_string()); + + let lst = new_int_alist_2(); + alist_add(&lst, 22, "hi".to_string()); + alist_add(&lst, 44, "ho".to_string()); + assert_eq!(alist_get(&lst, 22), "hi".to_string()); + assert_eq!(alist_get(&lst, 44), "ho".to_string()); +} diff --git a/src/test/run-pass/cross-crate/cci_no_inline_exe.rs b/src/test/run-pass/cross-crate/cci_no_inline_exe.rs new file mode 100644 index 00000000000..79729494009 --- /dev/null +++ b/src/test/run-pass/cross-crate/cci_no_inline_exe.rs @@ -0,0 +1,33 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_no_inline_lib.rs + +extern crate cci_no_inline_lib; +use cci_no_inline_lib::iter; + +pub fn main() { + // Check that a cross-crate call function not marked as inline + // does not, in fact, get inlined. Also, perhaps more + // importantly, checks that our scheme of using + // sys::frame_address() to determine if we are inlining is + // actually working. + //let bt0 = sys::frame_address(); + //println!("%?", bt0); + iter(vec![1, 2, 3], |i| { + println!("{}", i); + + //let bt1 = sys::frame_address(); + //println!("%?", bt1); + + //assert!(bt0 != bt1); + }) +} diff --git a/src/test/run-pass/cross-crate/cross-crate-const-pat.rs b/src/test/run-pass/cross-crate/cross-crate-const-pat.rs new file mode 100644 index 00000000000..8040f60f947 --- /dev/null +++ b/src/test/run-pass/cross-crate/cross-crate-const-pat.rs @@ -0,0 +1,24 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_const.rs + +// pretty-expanded FIXME #23616 + +extern crate cci_const; + +pub fn main() { + let x = cci_const::uint_val; + match x { + cci_const::uint_val => {} + _ => {} + } +} diff --git a/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs b/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs new file mode 100644 index 00000000000..e714e1d32ff --- /dev/null +++ b/src/test/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs @@ -0,0 +1,22 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:newtype_struct_xc.rs + + +extern crate newtype_struct_xc; + +pub fn main() { + let x = newtype_struct_xc::Au(21); + match x { + newtype_struct_xc::Au(n) => assert_eq!(n, 21) + } +} diff --git a/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs b/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs new file mode 100644 index 00000000000..8cc84c6c536 --- /dev/null +++ b/src/test/run-pass/cross-crate/moves-based-on-type-cross-crate.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:moves_based_on_type_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate moves_based_on_type_lib; +use moves_based_on_type_lib::f; + +pub fn main() { + f(); +} diff --git a/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs b/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs new file mode 100644 index 00000000000..062e2572399 --- /dev/null +++ b/src/test/run-pass/cross-crate/reexported-static-methods-cross-crate.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:reexported_static_methods.rs + +extern crate reexported_static_methods; + +use reexported_static_methods::Foo; +use reexported_static_methods::Baz; +use reexported_static_methods::Boz; +use reexported_static_methods::Bort; + +pub fn main() { + assert_eq!(42_isize, Foo::foo()); + assert_eq!(84_isize, Baz::bar()); + assert!(Boz::boz(1)); + assert_eq!("bort()".to_string(), Bort::bort()); +} diff --git a/src/test/run-pass/cross-crate/static-array-across-crate.rs b/src/test/run-pass/cross-crate/static-array-across-crate.rs new file mode 100644 index 00000000000..c21be4ce47c --- /dev/null +++ b/src/test/run-pass/cross-crate/static-array-across-crate.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:pub_static_array.rs + +extern crate pub_static_array as array; + +use array::ARRAY; + +static X: &'static u8 = &ARRAY[0]; +static Y: &'static u8 = &(&ARRAY)[0]; +static Z: u8 = (&ARRAY)[0]; + +pub fn main() {} diff --git a/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs b/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs new file mode 100644 index 00000000000..3ac2a0c8b45 --- /dev/null +++ b/src/test/run-pass/cross-crate/xcrate-address-insignificant.rs @@ -0,0 +1,19 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate_address_insignificant.rs + + +extern crate xcrate_address_insignificant as foo; + +pub fn main() { + assert_eq!(foo::foo::(), foo::bar()); +} diff --git a/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs b/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs new file mode 100644 index 00000000000..7015732daf6 --- /dev/null +++ b/src/test/run-pass/cross-crate/xcrate-associated-type-defaults.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate_associated_type_defaults.rs + +extern crate xcrate_associated_type_defaults; +use xcrate_associated_type_defaults::Foo; + +struct LocalDefault; +impl Foo for LocalDefault {} + +struct LocalOverride; +impl Foo for LocalOverride { + type Out = bool; +} + +fn main() { + assert_eq!( + <() as Foo>::Out::default().to_string(), + "0"); + assert_eq!( + <() as Foo>::Out::default().to_string(), + "false"); + + assert_eq!( + >::Out::default().to_string(), + "0"); + assert_eq!( + >::Out::default().to_string(), + "false"); +} diff --git a/src/test/run-pass/cross-crate/xcrate-static-addresses.rs b/src/test/run-pass/cross-crate/xcrate-static-addresses.rs new file mode 100644 index 00000000000..cb2a3563c7e --- /dev/null +++ b/src/test/run-pass/cross-crate/xcrate-static-addresses.rs @@ -0,0 +1,23 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate_static_addresses.rs + +// pretty-expanded FIXME #23616 + +extern crate xcrate_static_addresses; + +use xcrate_static_addresses as other; + +pub fn main() { + other::verify_same(&other::global); + other::verify_same2(other::global2); +} diff --git a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs new file mode 100644 index 00000000000..467ee2cedb9 --- /dev/null +++ b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs @@ -0,0 +1,28 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate-trait-lifetime-param.rs + +// pretty-expanded FIXME #23616 + +extern crate xcrate_trait_lifetime_param as other; + +struct Reader<'a> { + b : &'a [u8] +} + +impl <'a> other::FromBuf<'a> for Reader<'a> { + fn from_buf(b : &'a [u8]) -> Reader<'a> { + Reader { b : b } + } +} + +pub fn main () {} diff --git a/src/test/run-pass/cross-crate/xcrate-unit-struct.rs b/src/test/run-pass/cross-crate/xcrate-unit-struct.rs new file mode 100644 index 00000000000..65ce4244f56 --- /dev/null +++ b/src/test/run-pass/cross-crate/xcrate-unit-struct.rs @@ -0,0 +1,40 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate_unit_struct.rs +// pretty-expanded FIXME #23616 +#![allow(non_upper_case_globals)] + +extern crate xcrate_unit_struct; + +const s1: xcrate_unit_struct::Struct = xcrate_unit_struct::Struct; +static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::UnitVariant; +static s3: xcrate_unit_struct::Unit = + xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct); +static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::Argument(s1); +static s5: xcrate_unit_struct::TupleStruct = xcrate_unit_struct::TupleStruct(20, "foo"); + +fn f1(_: xcrate_unit_struct::Struct) {} +fn f2(_: xcrate_unit_struct::Unit) {} +fn f3(_: xcrate_unit_struct::TupleStruct) {} + +pub fn main() { + f1(xcrate_unit_struct::Struct); + f2(xcrate_unit_struct::Unit::UnitVariant); + f2(xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct)); + f3(xcrate_unit_struct::TupleStruct(10, "bar")); + + f1(s1); + f2(s2); + f2(s3); + f2(s4); + f3(s5); +} diff --git a/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs b/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs new file mode 100644 index 00000000000..2ed392a3fbb --- /dev/null +++ b/src/test/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate_generic_fn_nested_return.rs + +extern crate xcrate_generic_fn_nested_return as test; + +pub fn main() { + assert!(test::decode::<()>().is_err()); +} diff --git a/src/test/run-pass/ctfe/assoc-const.rs b/src/test/run-pass/ctfe/assoc-const.rs new file mode 100644 index 00000000000..cead1743926 --- /dev/null +++ b/src/test/run-pass/ctfe/assoc-const.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Nat { + const VALUE: usize; +} + +struct Zero; +struct Succ(N); + +impl Nat for Zero { + const VALUE: usize = 0; +} + +impl Nat for Succ { + const VALUE: usize = N::VALUE + 1; +} + +fn main() { + let x: [i32; >>>>::VALUE] = [1, 2, 3, 4]; +} diff --git a/src/test/run-pass/ctfe/bswap-const.rs b/src/test/run-pass/ctfe/bswap-const.rs new file mode 100644 index 00000000000..5fc7609bb68 --- /dev/null +++ b/src/test/run-pass/ctfe/bswap-const.rs @@ -0,0 +1,25 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(core_intrinsics)] + +use std::intrinsics; + +const SWAPPED_U8: u8 = unsafe { intrinsics::bswap(0x12_u8) }; +const SWAPPED_U16: u16 = unsafe { intrinsics::bswap(0x12_34_u16) }; +const SWAPPED_I32: i32 = unsafe { intrinsics::bswap(0x12_34_56_78_i32) }; + +fn main() { + assert_eq!(SWAPPED_U8, 0x12); + assert_eq!(SWAPPED_U16, 0x34_12); + assert_eq!(SWAPPED_I32, 0x78_56_34_12); +} diff --git a/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs new file mode 100644 index 00000000000..94e97d37424 --- /dev/null +++ b/src/test/run-pass/ctfe/chained-constants-stackoverflow.rs @@ -0,0 +1,366 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/34997 + +pub const CST_1: u32 = 0; +pub const CST_2: u32 = CST_1+1; +pub const CST_3: u32 = CST_2+1; +pub const CST_4: u32 = CST_3+1; +pub const CST_5: u32 = CST_4+1; +pub const CST_6: u32 = CST_5+1; +pub const CST_7: u32 = CST_6+1; +pub const CST_8: u32 = CST_7+1; +pub const CST_9: u32 = CST_8+1; +pub const CST_10: u32 = CST_9+1; +pub const CST_11: u32 = CST_10+1; +pub const CST_12: u32 = CST_11+1; +pub const CST_13: u32 = CST_12+1; +pub const CST_14: u32 = CST_13+1; +pub const CST_15: u32 = CST_14+1; +pub const CST_16: u32 = CST_15+1; +pub const CST_17: u32 = CST_16+1; +pub const CST_18: u32 = CST_17+1; +pub const CST_19: u32 = CST_18+1; +pub const CST_20: u32 = CST_19+1; +pub const CST_21: u32 = CST_20+1; +pub const CST_22: u32 = CST_21+1; +pub const CST_23: u32 = CST_22+1; +pub const CST_24: u32 = CST_23+1; +pub const CST_25: u32 = CST_24+1; +pub const CST_26: u32 = CST_25+1; +pub const CST_27: u32 = CST_26+1; +pub const CST_28: u32 = CST_27+1; +pub const CST_29: u32 = CST_28+1; +pub const CST_30: u32 = CST_29+1; +pub const CST_31: u32 = CST_30+1; +pub const CST_32: u32 = CST_31+1; +pub const CST_33: u32 = CST_32+1; +pub const CST_34: u32 = CST_33+1; +pub const CST_35: u32 = CST_34+1; +pub const CST_36: u32 = CST_35+1; +pub const CST_37: u32 = CST_36+1; +pub const CST_38: u32 = CST_37+1; +pub const CST_39: u32 = CST_38+1; +pub const CST_40: u32 = CST_39+1; +pub const CST_41: u32 = CST_40+1; +pub const CST_42: u32 = CST_41+1; +pub const CST_43: u32 = CST_42+1; +pub const CST_44: u32 = CST_43+1; +pub const CST_45: u32 = CST_44+1; +pub const CST_46: u32 = CST_45+1; +pub const CST_47: u32 = CST_46+1; +pub const CST_48: u32 = CST_47+1; +pub const CST_49: u32 = CST_48+1; +pub const CST_50: u32 = CST_49+1; +pub const CST_51: u32 = CST_50+1; +pub const CST_52: u32 = CST_51+1; +pub const CST_53: u32 = CST_52+1; +pub const CST_54: u32 = CST_53+1; +pub const CST_55: u32 = CST_54+1; +pub const CST_56: u32 = CST_55+1; +pub const CST_57: u32 = CST_56+1; +pub const CST_58: u32 = CST_57+1; +pub const CST_59: u32 = CST_58+1; +pub const CST_60: u32 = CST_59+1; +pub const CST_61: u32 = CST_60+1; +pub const CST_62: u32 = CST_61+1; +pub const CST_63: u32 = CST_62+1; +pub const CST_64: u32 = CST_63+1; +pub const CST_65: u32 = CST_64+1; +pub const CST_66: u32 = CST_65+1; +pub const CST_67: u32 = CST_66+1; +pub const CST_68: u32 = CST_67+1; +pub const CST_69: u32 = CST_68+1; +pub const CST_70: u32 = CST_69+1; +pub const CST_71: u32 = CST_70+1; +pub const CST_72: u32 = CST_71+1; +pub const CST_73: u32 = CST_72+1; +pub const CST_74: u32 = CST_73+1; +pub const CST_75: u32 = CST_74+1; +pub const CST_76: u32 = CST_75+1; +pub const CST_77: u32 = CST_76+1; +pub const CST_78: u32 = CST_77+1; +pub const CST_79: u32 = CST_78+1; +pub const CST_80: u32 = CST_79+1; +pub const CST_81: u32 = CST_80+1; +pub const CST_82: u32 = CST_81+1; +pub const CST_83: u32 = CST_82+1; +pub const CST_84: u32 = CST_83+1; +pub const CST_85: u32 = CST_84+1; +pub const CST_86: u32 = CST_85+1; +pub const CST_87: u32 = CST_86+1; +pub const CST_88: u32 = CST_87+1; +pub const CST_89: u32 = CST_88+1; +pub const CST_90: u32 = CST_89+1; +pub const CST_91: u32 = CST_90+1; +pub const CST_92: u32 = CST_91+1; +pub const CST_93: u32 = CST_92+1; +pub const CST_94: u32 = CST_93+1; +pub const CST_95: u32 = CST_94+1; +pub const CST_96: u32 = CST_95+1; +pub const CST_97: u32 = CST_96+1; +pub const CST_98: u32 = CST_97+1; +pub const CST_99: u32 = CST_98+1; +pub const CST_100: u32 = CST_99+1; +pub const CST_101: u32 = CST_100+1; +pub const CST_102: u32 = CST_101+1; +pub const CST_103: u32 = CST_102+1; +pub const CST_104: u32 = CST_103+1; +pub const CST_105: u32 = CST_104+1; +pub const CST_106: u32 = CST_105+1; +pub const CST_107: u32 = CST_106+1; +pub const CST_108: u32 = CST_107+1; +pub const CST_109: u32 = CST_108+1; +pub const CST_110: u32 = CST_109+1; +pub const CST_111: u32 = CST_110+1; +pub const CST_112: u32 = CST_111+1; +pub const CST_113: u32 = CST_112+1; +pub const CST_114: u32 = CST_113+1; +pub const CST_115: u32 = CST_114+1; +pub const CST_116: u32 = CST_115+1; +pub const CST_117: u32 = CST_116+1; +pub const CST_118: u32 = CST_117+1; +pub const CST_119: u32 = CST_118+1; +pub const CST_120: u32 = CST_119+1; +pub const CST_121: u32 = CST_120+1; +pub const CST_122: u32 = CST_121+1; +pub const CST_123: u32 = CST_122+1; +pub const CST_124: u32 = CST_123+1; +pub const CST_125: u32 = CST_124+1; +pub const CST_126: u32 = CST_125+1; +pub const CST_127: u32 = CST_126+1; +pub const CST_128: u32 = CST_127+1; +pub const CST_129: u32 = CST_128+1; +pub const CST_130: u32 = CST_129+1; +pub const CST_131: u32 = CST_130+1; +pub const CST_132: u32 = CST_131+1; +pub const CST_133: u32 = CST_132+1; +pub const CST_134: u32 = CST_133+1; +pub const CST_135: u32 = CST_134+1; +pub const CST_136: u32 = CST_135+1; +pub const CST_137: u32 = CST_136+1; +pub const CST_138: u32 = CST_137+1; +pub const CST_139: u32 = CST_138+1; +pub const CST_140: u32 = CST_139+1; +pub const CST_141: u32 = CST_140+1; +pub const CST_142: u32 = CST_141+1; +pub const CST_143: u32 = CST_142+1; +pub const CST_144: u32 = CST_143+1; +pub const CST_145: u32 = CST_144+1; +pub const CST_146: u32 = CST_145+1; +pub const CST_147: u32 = CST_146+1; +pub const CST_148: u32 = CST_147+1; +pub const CST_149: u32 = CST_148+1; +pub const CST_150: u32 = CST_149+1; +pub const CST_151: u32 = CST_150+1; +pub const CST_152: u32 = CST_151+1; +pub const CST_153: u32 = CST_152+1; +pub const CST_154: u32 = CST_153+1; +pub const CST_155: u32 = CST_154+1; +pub const CST_156: u32 = CST_155+1; +pub const CST_157: u32 = CST_156+1; +pub const CST_158: u32 = CST_157+1; +pub const CST_159: u32 = CST_158+1; +pub const CST_160: u32 = CST_159+1; +pub const CST_161: u32 = CST_160+1; +pub const CST_162: u32 = CST_161+1; +pub const CST_163: u32 = CST_162+1; +pub const CST_164: u32 = CST_163+1; +pub const CST_165: u32 = CST_164+1; +pub const CST_166: u32 = CST_165+1; +pub const CST_167: u32 = CST_166+1; +pub const CST_168: u32 = CST_167+1; +pub const CST_169: u32 = CST_168+1; +pub const CST_170: u32 = CST_169+1; +pub const CST_171: u32 = CST_170+1; +pub const CST_172: u32 = CST_171+1; +pub const CST_173: u32 = CST_172+1; +pub const CST_174: u32 = CST_173+1; +pub const CST_175: u32 = CST_174+1; +pub const CST_176: u32 = CST_175+1; +pub const CST_177: u32 = CST_176+1; +pub const CST_178: u32 = CST_177+1; +pub const CST_179: u32 = CST_178+1; +pub const CST_180: u32 = CST_179+1; +pub const CST_181: u32 = CST_180+1; +pub const CST_182: u32 = CST_181+1; +pub const CST_183: u32 = CST_182+1; +pub const CST_184: u32 = CST_183+1; +pub const CST_185: u32 = CST_184+1; +pub const CST_186: u32 = CST_185+1; +pub const CST_187: u32 = CST_186+1; +pub const CST_188: u32 = CST_187+1; +pub const CST_189: u32 = CST_188+1; +pub const CST_190: u32 = CST_189+1; +pub const CST_191: u32 = CST_190+1; +pub const CST_192: u32 = CST_191+1; +pub const CST_193: u32 = CST_192+1; +pub const CST_194: u32 = CST_193+1; +pub const CST_195: u32 = CST_194+1; +pub const CST_196: u32 = CST_195+1; +pub const CST_197: u32 = CST_196+1; +pub const CST_198: u32 = CST_197+1; +pub const CST_199: u32 = CST_198+1; +pub const CST_200: u32 = CST_199+1; +pub const CST_201: u32 = CST_200+1; +pub const CST_202: u32 = CST_201+1; +pub const CST_203: u32 = CST_202+1; +pub const CST_204: u32 = CST_203+1; +pub const CST_205: u32 = CST_204+1; +pub const CST_206: u32 = CST_205+1; +pub const CST_207: u32 = CST_206+1; +pub const CST_208: u32 = CST_207+1; +pub const CST_209: u32 = CST_208+1; +pub const CST_210: u32 = CST_209+1; +pub const CST_211: u32 = CST_210+1; +pub const CST_212: u32 = CST_211+1; +pub const CST_213: u32 = CST_212+1; +pub const CST_214: u32 = CST_213+1; +pub const CST_215: u32 = CST_214+1; +pub const CST_216: u32 = CST_215+1; +pub const CST_217: u32 = CST_216+1; +pub const CST_218: u32 = CST_217+1; +pub const CST_219: u32 = CST_218+1; +pub const CST_220: u32 = CST_219+1; +pub const CST_221: u32 = CST_220+1; +pub const CST_222: u32 = CST_221+1; +pub const CST_223: u32 = CST_222+1; +pub const CST_224: u32 = CST_223+1; +pub const CST_225: u32 = CST_224+1; +pub const CST_226: u32 = CST_225+1; +pub const CST_227: u32 = CST_226+1; +pub const CST_228: u32 = CST_227+1; +pub const CST_229: u32 = CST_228+1; +pub const CST_230: u32 = CST_229+1; +pub const CST_231: u32 = CST_230+1; +pub const CST_232: u32 = CST_231+1; +pub const CST_233: u32 = CST_232+1; +pub const CST_234: u32 = CST_233+1; +pub const CST_235: u32 = CST_234+1; +pub const CST_236: u32 = CST_235+1; +pub const CST_237: u32 = CST_236+1; +pub const CST_238: u32 = CST_237+1; +pub const CST_239: u32 = CST_238+1; +pub const CST_240: u32 = CST_239+1; +pub const CST_241: u32 = CST_240+1; +pub const CST_242: u32 = CST_241+1; +pub const CST_243: u32 = CST_242+1; +pub const CST_244: u32 = CST_243+1; +pub const CST_245: u32 = CST_244+1; +pub const CST_246: u32 = CST_245+1; +pub const CST_247: u32 = CST_246+1; +pub const CST_248: u32 = CST_247+1; +pub const CST_249: u32 = CST_248+1; +pub const CST_250: u32 = CST_249+1; +pub const CST_251: u32 = CST_250+1; +pub const CST_252: u32 = CST_251+1; +pub const CST_253: u32 = CST_252+1; +pub const CST_254: u32 = CST_253+1; +pub const CST_255: u32 = CST_254+1; +pub const CST_256: u32 = CST_255+1; +pub const CST_257: u32 = CST_256+1; +pub const CST_258: u32 = CST_257+1; +pub const CST_259: u32 = CST_258+1; +pub const CST_260: u32 = CST_259+1; +pub const CST_261: u32 = CST_260+1; +pub const CST_262: u32 = CST_261+1; +pub const CST_263: u32 = CST_262+1; +pub const CST_264: u32 = CST_263+1; +pub const CST_265: u32 = CST_264+1; +pub const CST_266: u32 = CST_265+1; +pub const CST_267: u32 = CST_266+1; +pub const CST_268: u32 = CST_267+1; +pub const CST_269: u32 = CST_268+1; +pub const CST_270: u32 = CST_269+1; +pub const CST_271: u32 = CST_270+1; +pub const CST_272: u32 = CST_271+1; +pub const CST_273: u32 = CST_272+1; +pub const CST_274: u32 = CST_273+1; +pub const CST_275: u32 = CST_274+1; +pub const CST_276: u32 = CST_275+1; +pub const CST_277: u32 = CST_276+1; +pub const CST_278: u32 = CST_277+1; +pub const CST_279: u32 = CST_278+1; +pub const CST_280: u32 = CST_279+1; +pub const CST_281: u32 = CST_280+1; +pub const CST_282: u32 = CST_281+1; +pub const CST_283: u32 = CST_282+1; +pub const CST_284: u32 = CST_283+1; +pub const CST_285: u32 = CST_284+1; +pub const CST_286: u32 = CST_285+1; +pub const CST_287: u32 = CST_286+1; +pub const CST_288: u32 = CST_287+1; +pub const CST_289: u32 = CST_288+1; +pub const CST_290: u32 = CST_289+1; +pub const CST_291: u32 = CST_290+1; +pub const CST_292: u32 = CST_291+1; +pub const CST_293: u32 = CST_292+1; +pub const CST_294: u32 = CST_293+1; +pub const CST_295: u32 = CST_294+1; +pub const CST_296: u32 = CST_295+1; +pub const CST_297: u32 = CST_296+1; +pub const CST_298: u32 = CST_297+1; +pub const CST_299: u32 = CST_298+1; +pub const CST_300: u32 = CST_299+1; +pub const CST_301: u32 = CST_300+1; +pub const CST_302: u32 = CST_301+1; +pub const CST_303: u32 = CST_302+1; +pub const CST_304: u32 = CST_303+1; +pub const CST_305: u32 = CST_304+1; +pub const CST_306: u32 = CST_305+1; +pub const CST_307: u32 = CST_306+1; +pub const CST_308: u32 = CST_307+1; +pub const CST_309: u32 = CST_308+1; +pub const CST_310: u32 = CST_309+1; +pub const CST_311: u32 = CST_310+1; +pub const CST_312: u32 = CST_311+1; +pub const CST_313: u32 = CST_312+1; +pub const CST_314: u32 = CST_313+1; +pub const CST_315: u32 = CST_314+1; +pub const CST_316: u32 = CST_315+1; +pub const CST_317: u32 = CST_316+1; +pub const CST_318: u32 = CST_317+1; +pub const CST_319: u32 = CST_318+1; +pub const CST_320: u32 = CST_319+1; +pub const CST_321: u32 = CST_320+1; +pub const CST_322: u32 = CST_321+1; +pub const CST_323: u32 = CST_322+1; +pub const CST_324: u32 = CST_323+1; +pub const CST_325: u32 = CST_324+1; +pub const CST_326: u32 = CST_325+1; +pub const CST_327: u32 = CST_326+1; +pub const CST_328: u32 = CST_327+1; +pub const CST_329: u32 = CST_328+1; +pub const CST_330: u32 = CST_329+1; +pub const CST_331: u32 = CST_330+1; +pub const CST_332: u32 = CST_331+1; +pub const CST_333: u32 = CST_332+1; +pub const CST_334: u32 = CST_333+1; +pub const CST_335: u32 = CST_334+1; +pub const CST_336: u32 = CST_335+1; +pub const CST_337: u32 = CST_336+1; +pub const CST_338: u32 = CST_337+1; +pub const CST_339: u32 = CST_338+1; +pub const CST_340: u32 = CST_339+1; +pub const CST_341: u32 = CST_340+1; +pub const CST_342: u32 = CST_341+1; +pub const CST_343: u32 = CST_342+1; +pub const CST_344: u32 = CST_343+1; +pub const CST_345: u32 = CST_344+1; +pub const CST_346: u32 = CST_345+1; +pub const CST_347: u32 = CST_346+1; +pub const CST_348: u32 = CST_347+1; +pub const CST_349: u32 = CST_348+1; +pub const CST_350: u32 = CST_349+1; + +fn main() {} diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs new file mode 100644 index 00000000000..09590d5f197 --- /dev/null +++ b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(const_let)] + +type Array = [u32; { let x = 2; 5 }]; + +pub fn main() {} diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement.rs b/src/test/run-pass/ctfe/const-block-non-item-statement.rs new file mode 100644 index 00000000000..5490bd4d3ad --- /dev/null +++ b/src/test/run-pass/ctfe/const-block-non-item-statement.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(const_let)] + +enum Foo { + Bar = { let x = 1; 3 } +} + +pub fn main() {} diff --git a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs b/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs new file mode 100644 index 00000000000..323232acc67 --- /dev/null +++ b/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// test that certain things are disallowed in constant functions + +#![feature(const_fn, const_let)] + +// no destructuring +const fn i(( + a, + b + ): (u32, u32)) -> u32 { + a + b +} + +fn main() {} diff --git a/src/test/run-pass/ctfe/deref_in_pattern.rs b/src/test/run-pass/ctfe/deref_in_pattern.rs new file mode 100644 index 00000000000..6f4cca624bf --- /dev/null +++ b/src/test/run-pass/ctfe/deref_in_pattern.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/25574 + +const A: [u8; 4] = *b"fooo"; + +fn main() { + match *b"xxxx" { + A => {}, + _ => {} + } +} diff --git a/src/test/run-pass/ctfe/ice-48279.rs b/src/test/run-pass/ctfe/ice-48279.rs new file mode 100644 index 00000000000..34b7b56f274 --- /dev/null +++ b/src/test/run-pass/ctfe/ice-48279.rs @@ -0,0 +1,36 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/48279 + +#![feature(min_const_fn)] + +#[derive(PartialEq, Eq)] +pub struct NonZeroU32 { + value: u32 +} + +impl NonZeroU32 { + const unsafe fn new_unchecked(value: u32) -> Self { + NonZeroU32 { value } + } +} + +//pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) }; +pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } }; + +fn main() { + match None { + Some(FOO_ATOM) => {} + _ => {} + } +} diff --git a/src/test/run-pass/ctfe/issue-37550.rs b/src/test/run-pass/ctfe/issue-37550.rs new file mode 100644 index 00000000000..21c4ec2c09e --- /dev/null +++ b/src/test/run-pass/ctfe/issue-37550.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(const_fn, const_let)] + +const fn x() { + let t = true; + let x = || t; +} + +fn main() {} diff --git a/src/test/run-pass/ctfe/issue-broken-mir.rs b/src/test/run-pass/ctfe/issue-broken-mir.rs new file mode 100644 index 00000000000..4810ef75c78 --- /dev/null +++ b/src/test/run-pass/ctfe/issue-broken-mir.rs @@ -0,0 +1,20 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/27918 + +fn main() { + match b" " { + b"1234" => {}, + _ => {}, + } +} diff --git a/src/test/run-pass/ctfe/locals-in-const-fn.rs b/src/test/run-pass/ctfe/locals-in-const-fn.rs new file mode 100644 index 00000000000..d10465b9dcd --- /dev/null +++ b/src/test/run-pass/ctfe/locals-in-const-fn.rs @@ -0,0 +1,47 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/48821 + +#![feature(const_fn, const_let)] + +const fn foo(i: usize) -> usize { + let x = i; + x +} + +static FOO: usize = foo(42); + +const fn bar(mut i: usize) -> usize { + i += 8; + let x = &i; + *x +} + +static BAR: usize = bar(42); + +const fn boo(mut i: usize) -> usize { + { + let mut x = i; + x += 10; + i = x; + } + i +} + +static BOO: usize = boo(42); + +fn main() { + assert!(FOO == 42); + assert!(BAR == 50); + assert!(BOO == 52); +} diff --git a/src/test/run-pass/ctfe/match-const-fn-structs.rs b/src/test/run-pass/ctfe/match-const-fn-structs.rs new file mode 100644 index 00000000000..6c829f142dd --- /dev/null +++ b/src/test/run-pass/ctfe/match-const-fn-structs.rs @@ -0,0 +1,33 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/46114 + +#![feature(min_const_fn)] + +#[derive(Eq, PartialEq)] +struct A { value: u32 } + +const fn new(value: u32) -> A { + A { value } +} + +const A_1: A = new(1); +const A_2: A = new(2); + +fn main() { + let a_str = match new(42) { + A_1 => "A 1", + A_2 => "A 2", + _ => "Unknown A", + }; +} diff --git a/src/test/run-pass/ctfe/mozjs-error.rs b/src/test/run-pass/ctfe/mozjs-error.rs new file mode 100644 index 00000000000..ea200ba738f --- /dev/null +++ b/src/test/run-pass/ctfe/mozjs-error.rs @@ -0,0 +1,40 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +struct CustomAutoRooterVFTable { + trace: unsafe extern "C" fn(this: *mut i32, trc: *mut u32), +} + +unsafe trait CustomAutoTraceable: Sized { + const vftable: CustomAutoRooterVFTable = CustomAutoRooterVFTable { + trace: Self::trace, + }; + + unsafe extern "C" fn trace(this: *mut i32, trc: *mut u32) { + let this = this as *const Self; + let this = this.as_ref().unwrap(); + Self::do_trace(this, trc); + } + + fn do_trace(&self, trc: *mut u32); +} + +unsafe impl CustomAutoTraceable for () { + fn do_trace(&self, _: *mut u32) { + // nop + } +} + +fn main() { + let _ = <()>::vftable; +} diff --git a/src/test/run-pass/ctfe/non-scalar-cast.rs b/src/test/run-pass/ctfe/non-scalar-cast.rs new file mode 100644 index 00000000000..9711247b83e --- /dev/null +++ b/src/test/run-pass/ctfe/non-scalar-cast.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/37448 + +fn main() { + struct A; + const FOO: &A = &(A as A); + let _x = FOO; +} diff --git a/src/test/run-pass/ctfe/promotion.rs b/src/test/run-pass/ctfe/promotion.rs new file mode 100644 index 00000000000..5407529f065 --- /dev/null +++ b/src/test/run-pass/ctfe/promotion.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags: -O + +fn foo(_: &'static [&'static str]) {} +fn bar(_: &'static [&'static str; 3]) {} +fn baz_i32(_: &'static i32) {} +fn baz_u32(_: &'static u32) {} + +fn main() { + foo(&["a", "b", "c"]); + bar(&["d", "e", "f"]); + + // make sure that these do not cause trouble despite overflowing + baz_u32(&(0-1)); + baz_i32(&-std::i32::MIN); +} diff --git a/src/test/run-pass/ctfe/references.rs b/src/test/run-pass/ctfe/references.rs new file mode 100644 index 00000000000..946ed246bb0 --- /dev/null +++ b/src/test/run-pass/ctfe/references.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const FOO: &[u8] = b"foo"; +const BAR: &[u8] = &[1, 2, 3]; + +const BOO: &i32 = &42; + +fn main() { + match &[1u8, 2, 3] as &[u8] { + FOO => panic!("a"), + BAR => println!("b"), + _ => panic!("c"), + } + + match b"foo" as &[u8] { + FOO => println!("a"), + BAR => panic!("b"), + _ => panic!("c"), + } + + match &43 { + &42 => panic!(), + BOO => panic!(), + _ => println!("d"), + } +} diff --git a/src/test/run-pass/ctfe/repeat_match.rs b/src/test/run-pass/ctfe/repeat_match.rs new file mode 100644 index 00000000000..60a9a916bff --- /dev/null +++ b/src/test/run-pass/ctfe/repeat_match.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/45044 + +const X: [u8; 1] = [0; 1]; + +fn main() { + match &X { + &X => println!("a"), + _ => println!("b"), + }; +} diff --git a/src/test/run-pass/ctfe/return-in-const-fn.rs b/src/test/run-pass/ctfe/return-in-const-fn.rs new file mode 100644 index 00000000000..e0020019523 --- /dev/null +++ b/src/test/run-pass/ctfe/return-in-const-fn.rs @@ -0,0 +1,21 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/43754 + +#![feature(min_const_fn)] +const fn foo(x: usize) -> usize { + return x; +} +fn main() { + [0; foo(2)]; +} diff --git a/src/test/run-pass/ctfe/signed_enum_discr.rs b/src/test/run-pass/ctfe/signed_enum_discr.rs new file mode 100644 index 00000000000..9dd2990ab8d --- /dev/null +++ b/src/test/run-pass/ctfe/signed_enum_discr.rs @@ -0,0 +1,29 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/49181 + +#[derive(Eq, PartialEq)] +#[repr(i8)] +pub enum A { + B = -1, + C = 1, +} + +pub const D: A = A::B; + +fn main() { + match A::C { + D => {}, + _ => {} + } +} diff --git a/src/test/run-pass/ctfe/transmute-const.rs b/src/test/run-pass/ctfe/transmute-const.rs new file mode 100644 index 00000000000..efd6df5f886 --- /dev/null +++ b/src/test/run-pass/ctfe/transmute-const.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(const_transmute)] + +use std::mem; + +#[repr(transparent)] +struct Foo(u32); + +const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) }; + +fn main() { + assert_eq!(TRANSMUTED_U32, 3); +} diff --git a/src/test/run-pass/ctfe/tuple-struct-constructors.rs b/src/test/run-pass/ctfe/tuple-struct-constructors.rs new file mode 100644 index 00000000000..c7000d19813 --- /dev/null +++ b/src/test/run-pass/ctfe/tuple-struct-constructors.rs @@ -0,0 +1,20 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// https://github.com/rust-lang/rust/issues/41898 + +use std::num::NonZeroU64; + +fn main() { + const FOO: NonZeroU64 = unsafe { NonZeroU64::new_unchecked(2) }; + if let FOO = FOO {} +} diff --git a/src/test/run-pass/deriving/auxiliary/derive-no-std.rs b/src/test/run-pass/deriving/auxiliary/derive-no-std.rs new file mode 100644 index 00000000000..f083e10bfdb --- /dev/null +++ b/src/test/run-pass/deriving/auxiliary/derive-no-std.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![no_std] + +// Issue #16803 + +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Default, Copy)] +pub struct Foo { + pub x: u32, +} + +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Copy)] +pub enum Bar { + Qux, + Quux(u32), +} + +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Copy)] +pub enum Void {} +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Copy)] +pub struct Empty; +#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, + Debug, Copy)] +pub struct AlsoEmpty {} + diff --git a/src/test/run-pass/deriving/derive-no-std.rs b/src/test/run-pass/deriving/derive-no-std.rs new file mode 100644 index 00000000000..1122083eb80 --- /dev/null +++ b/src/test/run-pass/deriving/derive-no-std.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:derive-no-std.rs + +extern crate derive_no_std; +use derive_no_std::*; + +fn main() { + let f = Foo { x: 0 }; + assert_eq!(f.clone(), Foo::default()); + + assert!(Bar::Qux < Bar::Quux(42)); +} + diff --git a/src/test/run-pass/deriving/derive-partialord-correctness.rs b/src/test/run-pass/deriving/derive-partialord-correctness.rs new file mode 100644 index 00000000000..4890b1bc76b --- /dev/null +++ b/src/test/run-pass/deriving/derive-partialord-correctness.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Original issue: #49650 + +#[derive(PartialOrd, PartialEq)] +struct FloatWrapper(f64); + +fn main() { + assert!((0.0 / 0.0 >= 0.0) == (FloatWrapper(0.0 / 0.0) >= FloatWrapper(0.0))) +} diff --git a/src/test/run-pass/deriving/deriving-associated-types.rs b/src/test/run-pass/deriving/deriving-associated-types.rs new file mode 100644 index 00000000000..46fb88e05c6 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-associated-types.rs @@ -0,0 +1,209 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait DeclaredTrait { + type Type; +} + +impl DeclaredTrait for i32 { + type Type = i32; +} + +pub trait WhereTrait { + type Type; +} + +impl WhereTrait for i32 { + type Type = i32; +} + +// Make sure we don't add a bound that just shares a name with an associated +// type. +pub mod module { + pub type Type = i32; +} + +#[derive(PartialEq, Debug)] +struct PrivateStruct(T); + +#[derive(PartialEq, Debug)] +struct TupleStruct( + module::Type, + Option, + A, + PrivateStruct, + B, + B::Type, + Option, + ::Type, + Option<::Type>, + C, + C::Type, + Option, + ::Type, + Option<::Type>, + ::Type, +) where C: WhereTrait; + +#[derive(PartialEq, Debug)] +pub struct Struct where C: WhereTrait { + m1: module::Type, + m2: Option, + a1: A, + a2: PrivateStruct, + b: B, + b1: B::Type, + b2: Option, + b3: ::Type, + b4: Option<::Type>, + c: C, + c1: C::Type, + c2: Option, + c3: ::Type, + c4: Option<::Type>, + d: ::Type, +} + +#[derive(PartialEq, Debug)] +enum Enum where C: WhereTrait { + Unit, + Seq( + module::Type, + Option, + A, + PrivateStruct, + B, + B::Type, + Option, + ::Type, + Option<::Type>, + C, + C::Type, + Option, + ::Type, + Option<::Type>, + ::Type, + ), + Map { + m1: module::Type, + m2: Option, + a1: A, + a2: PrivateStruct, + b: B, + b1: B::Type, + b2: Option, + b3: ::Type, + b4: Option<::Type>, + c: C, + c1: C::Type, + c2: Option, + c3: ::Type, + c4: Option<::Type>, + d: ::Type, + }, +} + +fn main() { + let e: TupleStruct< + i32, + i32, + i32, + > = TupleStruct( + 0, + None, + 0, + PrivateStruct(0), + 0, + 0, + None, + 0, + None, + 0, + 0, + None, + 0, + None, + 0, + ); + assert_eq!(e, e); + + let e: Struct< + i32, + i32, + i32, + > = Struct { + m1: 0, + m2: None, + a1: 0, + a2: PrivateStruct(0), + b: 0, + b1: 0, + b2: None, + b3: 0, + b4: None, + c: 0, + c1: 0, + c2: None, + c3: 0, + c4: None, + d: 0, + }; + assert_eq!(e, e); + + let e = Enum::Unit::; + assert_eq!(e, e); + + let e: Enum< + i32, + i32, + i32, + > = Enum::Seq( + 0, + None, + 0, + PrivateStruct(0), + 0, + 0, + None, + 0, + None, + 0, + 0, + None, + 0, + None, + 0, + ); + assert_eq!(e, e); + + let e: Enum< + i32, + i32, + i32, + > = Enum::Map { + m1: 0, + m2: None, + a1: 0, + a2: PrivateStruct(0), + b: 0, + b1: 0, + b2: None, + b3: 0, + b4: None, + c: 0, + c1: 0, + c2: None, + c3: 0, + c4: None, + d: 0, + }; + assert_eq!(e, e); +} diff --git a/src/test/run-pass/deriving/deriving-bounds.rs b/src/test/run-pass/deriving/deriving-bounds.rs new file mode 100644 index 00000000000..0e30de10e82 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-bounds.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Copy, Clone)] +struct Test; + +pub fn main() {} diff --git a/src/test/run-pass/deriving/deriving-clone-array.rs b/src/test/run-pass/deriving/deriving-clone-array.rs new file mode 100644 index 00000000000..2d3be810def --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-array.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// test for issue #30244 + +#[derive(Copy, Clone)] +struct Array { + arr: [[u8; 256]; 4] +} + +pub fn main() {} diff --git a/src/test/run-pass/deriving/deriving-clone-enum.rs b/src/test/run-pass/deriving/deriving-clone-enum.rs new file mode 100644 index 00000000000..cf924e0ff5e --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-enum.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +enum E { + A, + B(()), + C +} + +pub fn main() { + let _ = E::A.clone(); +} diff --git a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs new file mode 100644 index 00000000000..2b1ace396a7 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +enum E { + A(T), + B(T,U), + C +} + +pub fn main() { + let _ = E::A::(1).clone(); +} diff --git a/src/test/run-pass/deriving/deriving-clone-generic-struct.rs b/src/test/run-pass/deriving/deriving-clone-generic-struct.rs new file mode 100644 index 00000000000..dea50871a74 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-generic-struct.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +struct S { + foo: (), + bar: (), + baz: T, +} + +pub fn main() { + let _ = S { foo: (), bar: (), baz: 1 }.clone(); +} diff --git a/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs b/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs new file mode 100644 index 00000000000..01ef89f81c1 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-generic-tuple-struct.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +struct S(T, ()); + +pub fn main() { + let _ = S(1, ()).clone(); +} diff --git a/src/test/run-pass/deriving/deriving-clone-struct.rs b/src/test/run-pass/deriving/deriving-clone-struct.rs new file mode 100644 index 00000000000..f82a41f8ba0 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-struct.rs @@ -0,0 +1,36 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +struct S { + _int: isize, + _i8: i8, + _i16: i16, + _i32: i32, + _i64: i64, + + _uint: usize, + _u8: u8, + _u16: u16, + _u32: u32, + _u64: u64, + + _f32: f32, + _f64: f64, + + _bool: bool, + _char: char, + _nil: () +} + +pub fn main() {} diff --git a/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs b/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs new file mode 100644 index 00000000000..49c675de112 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-clone-tuple-struct.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +struct S((), ()); + +pub fn main() {} diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs b/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs new file mode 100644 index 00000000000..1a6582d9af2 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-cmp-generic-enum.rs @@ -0,0 +1,54 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Eq, PartialOrd, Ord)] +enum E { + E0, + E1(T), + E2(T,T) +} + +pub fn main() { + let e0 = E::E0; + let e11 = E::E1(1); + let e12 = E::E1(2); + let e21 = E::E2(1, 1); + let e22 = E::E2(1, 2); + + // in order for both PartialOrd and Ord + let es = [e0, e11, e12, e21, e22]; + + for (i, e1) in es.iter().enumerate() { + for (j, e2) in es.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let lt = i < j; + let le = i <= j; + let gt = i > j; + let ge = i >= j; + + // PartialEq + assert_eq!(*e1 == *e2, eq); + assert_eq!(*e1 != *e2, !eq); + + // PartialOrd + assert_eq!(*e1 < *e2, lt); + assert_eq!(*e1 > *e2, gt); + + assert_eq!(*e1 <= *e2, le); + assert_eq!(*e1 >= *e2, ge); + + // Ord + assert_eq!(e1.cmp(e2), ord); + } + } +} diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs b/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs new file mode 100644 index 00000000000..93bda7fbf25 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-cmp-generic-struct-enum.rs @@ -0,0 +1,58 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Eq, PartialOrd, Ord)] +enum ES { + ES1 { x: T }, + ES2 { x: T, y: T } +} + + +pub fn main() { + let (es11, es12, es21, es22) = (ES::ES1 { + x: 1 + }, ES::ES1 { + x: 2 + }, ES::ES2 { + x: 1, + y: 1 + }, ES::ES2 { + x: 1, + y: 2 + }); + + // in order for both PartialOrd and Ord + let ess = [es11, es12, es21, es22]; + + for (i, es1) in ess.iter().enumerate() { + for (j, es2) in ess.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let (lt, le) = (i < j, i <= j); + let (gt, ge) = (i > j, i >= j); + + // PartialEq + assert_eq!(*es1 == *es2, eq); + assert_eq!(*es1 != *es2, !eq); + + // PartialOrd + assert_eq!(*es1 < *es2, lt); + assert_eq!(*es1 > *es2, gt); + + assert_eq!(*es1 <= *es2, le); + assert_eq!(*es1 >= *es2, ge); + + // Ord + assert_eq!(es1.cmp(es2), ord); + } + } +} diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs b/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs new file mode 100644 index 00000000000..f2e6fcd13fc --- /dev/null +++ b/src/test/run-pass/deriving/deriving-cmp-generic-struct.rs @@ -0,0 +1,50 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Eq, PartialOrd, Ord)] +struct S { + x: T, + y: T +} + +pub fn main() { + let s1 = S {x: 1, y: 1}; + let s2 = S {x: 1, y: 2}; + + // in order for both PartialOrd and Ord + let ss = [s1, s2]; + + for (i, s1) in ss.iter().enumerate() { + for (j, s2) in ss.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let lt = i < j; + let le = i <= j; + let gt = i > j; + let ge = i >= j; + + // PartialEq + assert_eq!(*s1 == *s2, eq); + assert_eq!(*s1 != *s2, !eq); + + // PartialOrd + assert_eq!(*s1 < *s2, lt); + assert_eq!(*s1 > *s2, gt); + + assert_eq!(*s1 <= *s2, le); + assert_eq!(*s1 >= *s2, ge); + + // Ord + assert_eq!(s1.cmp(s2), ord); + } + } +} diff --git a/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs b/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs new file mode 100644 index 00000000000..04688ff352d --- /dev/null +++ b/src/test/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs @@ -0,0 +1,48 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Eq, PartialOrd, Ord)] +struct TS(T,T); + + +pub fn main() { + let ts1 = TS(1, 1); + let ts2 = TS(1, 2); + + // in order for both PartialOrd and Ord + let tss = [ts1, ts2]; + + for (i, ts1) in tss.iter().enumerate() { + for (j, ts2) in tss.iter().enumerate() { + let ord = i.cmp(&j); + + let eq = i == j; + let lt = i < j; + let le = i <= j; + let gt = i > j; + let ge = i >= j; + + // PartialEq + assert_eq!(*ts1 == *ts2, eq); + assert_eq!(*ts1 != *ts2, !eq); + + // PartialOrd + assert_eq!(*ts1 < *ts2, lt); + assert_eq!(*ts1 > *ts2, gt); + + assert_eq!(*ts1 <= *ts2, le); + assert_eq!(*ts1 >= *ts2, ge); + + // Ord + assert_eq!(ts1.cmp(ts2), ord); + } + } +} diff --git a/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs b/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs new file mode 100644 index 00000000000..e1f301922bd --- /dev/null +++ b/src/test/run-pass/deriving/deriving-cmp-shortcircuit.rs @@ -0,0 +1,47 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that the derived impls for the comparison traits shortcircuit +// where possible, by having a type that panics when compared as the +// second element, so this passes iff the instances shortcircuit. + + +use std::cmp::Ordering; + +pub struct FailCmp; +impl PartialEq for FailCmp { + fn eq(&self, _: &FailCmp) -> bool { panic!("eq") } +} + +impl PartialOrd for FailCmp { + fn partial_cmp(&self, _: &FailCmp) -> Option { panic!("partial_cmp") } +} + +impl Eq for FailCmp {} + +impl Ord for FailCmp { + fn cmp(&self, _: &FailCmp) -> Ordering { panic!("cmp") } +} + +#[derive(PartialEq,PartialOrd,Eq,Ord)] +struct ShortCircuit { + x: isize, + y: FailCmp +} + +pub fn main() { + let a = ShortCircuit { x: 1, y: FailCmp }; + let b = ShortCircuit { x: 2, y: FailCmp }; + + assert!(a != b); + assert!(a < b); + assert_eq!(a.cmp(&b), ::std::cmp::Ordering::Less); +} diff --git a/src/test/run-pass/deriving/deriving-copyclone.rs b/src/test/run-pass/deriving/deriving-copyclone.rs new file mode 100644 index 00000000000..e9da90fe6ed --- /dev/null +++ b/src/test/run-pass/deriving/deriving-copyclone.rs @@ -0,0 +1,49 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +//! Test that #[derive(Copy, Clone)] produces a shallow copy +//! even when a member violates RFC 1521 + +use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; + +/// A struct that pretends to be Copy, but actually does something +/// in its Clone impl +#[derive(Copy)] +struct Liar; + +/// Static cooperating with the rogue Clone impl +static CLONED: AtomicBool = ATOMIC_BOOL_INIT; + +impl Clone for Liar { + fn clone(&self) -> Self { + // this makes Clone vs Copy observable + CLONED.store(true, Ordering::SeqCst); + + *self + } +} + +/// This struct is actually Copy... at least, it thinks it is! +#[derive(Copy, Clone)] +struct Innocent(Liar); + +impl Innocent { + fn new() -> Self { + Innocent(Liar) + } +} + +fn main() { + let _ = Innocent::new().clone(); + // if Innocent was byte-for-byte copied, CLONED will still be false + assert!(!CLONED.load(Ordering::SeqCst)); +} + diff --git a/src/test/run-pass/deriving/deriving-default-box.rs b/src/test/run-pass/deriving/deriving-default-box.rs new file mode 100644 index 00000000000..55111a4231a --- /dev/null +++ b/src/test/run-pass/deriving/deriving-default-box.rs @@ -0,0 +1,25 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::default::Default; + +#[derive(Default)] +struct A { + foo: Box<[bool]>, +} + +pub fn main() { + let a: A = Default::default(); + let b: Box<[_]> = Box::<[bool; 0]>::new([]); + assert_eq!(a.foo, b); +} diff --git a/src/test/run-pass/deriving/deriving-enum-single-variant.rs b/src/test/run-pass/deriving/deriving-enum-single-variant.rs new file mode 100644 index 00000000000..e304f481baa --- /dev/null +++ b/src/test/run-pass/deriving/deriving-enum-single-variant.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] + +pub type task_id = isize; + +#[derive(PartialEq)] +pub enum Task { + TaskHandle(task_id) +} + +pub fn main() { } diff --git a/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs b/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs new file mode 100644 index 00000000000..7997aa5a7ec --- /dev/null +++ b/src/test/run-pass/deriving/deriving-eq-ord-boxed-slice.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)] +struct Foo(Box<[u8]>); + +pub fn main() { + let a = Foo(Box::new([0, 1, 2])); + let b = Foo(Box::new([0, 1, 2])); + assert_eq!(a, b); + println!("{}", a != b); + println!("{}", a < b); + println!("{}", a <= b); + println!("{}", a == b); + println!("{}", a > b); + println!("{}", a >= b); +} diff --git a/src/test/run-pass/deriving/deriving-hash.rs b/src/test/run-pass/deriving/deriving-hash.rs new file mode 100644 index 00000000000..aec8a7075a5 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-hash.rs @@ -0,0 +1,84 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +#![allow(overflowing_literals)] + +use std::hash::{Hash, SipHasher, Hasher}; +use std::mem::size_of; + +#[derive(Hash)] +struct Person { + id: usize, + name: String, + phone: usize, +} + +// test for hygiene name collisions +#[derive(Hash)] struct __H__H; +#[derive(Hash)] enum Collision<__H> { __H { __H__H: __H } } + +#[derive(Hash)] +enum E { A=1, B } + +fn hash(t: &T) -> u64 { + let mut s = SipHasher::new_with_keys(0, 0); + t.hash(&mut s); + s.finish() +} + +struct FakeHasher<'a>(&'a mut Vec); +impl<'a> Hasher for FakeHasher<'a> { + fn finish(&self) -> u64 { + unimplemented!() + } + + fn write(&mut self, bytes: &[u8]) { + self.0.extend(bytes); + } +} + +fn fake_hash(v: &mut Vec, a: A) { + a.hash(&mut FakeHasher(v)); +} + +fn main() { + let person1 = Person { + id: 5, + name: "Janet".to_string(), + phone: 555_666_7777 + }; + let person2 = Person { + id: 5, + name: "Bob".to_string(), + phone: 555_666_7777 + }; + assert_eq!(hash(&person1), hash(&person1)); + assert!(hash(&person1) != hash(&person2)); + + // test #21714 + let mut va = vec![]; + let mut vb = vec![]; + fake_hash(&mut va, E::A); + fake_hash(&mut vb, E::B); + assert!(va != vb); + + // issue #39137: single variant enum hash should not hash discriminant + #[derive(Hash)] + enum SingleVariantEnum { + A(u8), + } + let mut v = vec![]; + fake_hash(&mut v, SingleVariantEnum::A(17)); + assert_eq!(vec![17], v); +} diff --git a/src/test/run-pass/deriving/deriving-in-fn.rs b/src/test/run-pass/deriving/deriving-in-fn.rs new file mode 100644 index 00000000000..00100aa1be1 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-in-fn.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + #[derive(Debug)] + struct Foo { + foo: isize, + } + + let f = Foo { foo: 10 }; + format!("{:?}", f); +} diff --git a/src/test/run-pass/deriving/deriving-in-macro.rs b/src/test/run-pass/deriving/deriving-in-macro.rs new file mode 100644 index 00000000000..dc6fda84f1d --- /dev/null +++ b/src/test/run-pass/deriving/deriving-in-macro.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] + +macro_rules! define_vec { + () => ( + mod foo { + #[derive(PartialEq)] + pub struct bar; + } + ) +} + +define_vec![]; + +pub fn main() {} diff --git a/src/test/run-pass/deriving/deriving-meta-multiple.rs b/src/test/run-pass/deriving/deriving-meta-multiple.rs new file mode 100644 index 00000000000..33f98a74b14 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-meta-multiple.rs @@ -0,0 +1,34 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(deprecated)] + +use std::hash::{Hash, SipHasher}; + +// testing multiple separate deriving attributes +#[derive(PartialEq)] +#[derive(Clone)] +#[derive(Hash)] +struct Foo { + bar: usize, + baz: isize +} + +fn hash(_t: &T) {} + +pub fn main() { + let a = Foo {bar: 4, baz: -3}; + + a == a; // check for PartialEq impl w/o testing its correctness + a.clone(); // check for Clone impl w/o testing its correctness + hash(&a); // check for Hash impl w/o testing its correctness +} diff --git a/src/test/run-pass/deriving/deriving-meta.rs b/src/test/run-pass/deriving/deriving-meta.rs new file mode 100644 index 00000000000..309cd5aed1d --- /dev/null +++ b/src/test/run-pass/deriving/deriving-meta.rs @@ -0,0 +1,31 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(deprecated)] + +use std::hash::{Hash, SipHasher}; + +#[derive(PartialEq, Clone, Hash)] +struct Foo { + bar: usize, + baz: isize +} + +fn hash(_t: &T) {} + +pub fn main() { + let a = Foo {bar: 4, baz: -3}; + + a == a; // check for PartialEq impl w/o testing its correctness + a.clone(); // check for Clone impl w/o testing its correctness + hash(&a); // check for Hash impl w/o testing its correctness +} diff --git a/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs b/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs new file mode 100644 index 00000000000..64ef03adcaf --- /dev/null +++ b/src/test/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs @@ -0,0 +1,26 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cmp::Ordering::{Less,Equal,Greater}; + +#[derive(PartialEq, Eq, PartialOrd, Ord)] +struct A<'a> { + x: &'a isize +} +pub fn main() { + let (a, b) = (A { x: &1 }, A { x: &2 }); + + assert_eq!(a.cmp(&a), Equal); + assert_eq!(b.cmp(&b), Equal); + + assert_eq!(a.cmp(&b), Less); + assert_eq!(b.cmp(&a), Greater); +} diff --git a/src/test/run-pass/deriving/deriving-show-2.rs b/src/test/run-pass/deriving/deriving-show-2.rs new file mode 100644 index 00000000000..3a1f40239c8 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-show-2.rs @@ -0,0 +1,63 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt; + +#[derive(Debug)] +enum A {} +#[derive(Debug)] +enum B { B1, B2, B3 } +#[derive(Debug)] +enum C { C1(isize), C2(B), C3(String) } +#[derive(Debug)] +enum D { D1{ a: isize } } +#[derive(Debug)] +struct E; +#[derive(Debug)] +struct F(isize); +#[derive(Debug)] +struct G(isize, isize); +#[derive(Debug)] +struct H { a: isize } +#[derive(Debug)] +struct I { a: isize, b: isize } +#[derive(Debug)] +struct J(Custom); + +struct Custom; +impl fmt::Debug for Custom { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "yay") + } +} + +trait ToDebug { + fn to_show(&self) -> String; +} + +impl ToDebug for T { + fn to_show(&self) -> String { + format!("{:?}", self) + } +} + +pub fn main() { + assert_eq!(B::B1.to_show(), "B1".to_string()); + assert_eq!(B::B2.to_show(), "B2".to_string()); + assert_eq!(C::C1(3).to_show(), "C1(3)".to_string()); + assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_string()); + assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2 }".to_string()); + assert_eq!(E.to_show(), "E".to_string()); + assert_eq!(F(3).to_show(), "F(3)".to_string()); + assert_eq!(G(3, 4).to_show(), "G(3, 4)".to_string()); + assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2, b: 4 }".to_string()); + assert_eq!(J(Custom).to_show(), "J(yay)".to_string()); +} diff --git a/src/test/run-pass/deriving/deriving-show.rs b/src/test/run-pass/deriving/deriving-show.rs new file mode 100644 index 00000000000..f19b014067d --- /dev/null +++ b/src/test/run-pass/deriving/deriving-show.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct Unit; + +#[derive(Debug)] +struct Tuple(isize, usize); + +#[derive(Debug)] +struct Struct { x: isize, y: usize } + +#[derive(Debug)] +enum Enum { + Nullary, + Variant(isize, usize), + StructVariant { x: isize, y : usize } +} + +#[derive(Debug)] +struct Pointers(*const Send, *mut Sync); + +macro_rules! t { + ($x:expr, $expected:expr) => { + assert_eq!(format!("{:?}", $x), $expected.to_string()) + } +} + +pub fn main() { + t!(Unit, "Unit"); + t!(Tuple(1, 2), "Tuple(1, 2)"); + t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }"); + t!(Enum::Nullary, "Nullary"); + t!(Enum::Variant(1, 2), "Variant(1, 2)"); + t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }"); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs new file mode 100644 index 00000000000..445545aaa0f --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +enum Foo { + Bar, + Baz, + Boo +} + +pub fn main() { + let a = Foo::Bar; + let b = Foo::Bar; + assert_eq!(a, b); + assert!(!(a != b)); + assert!(a.eq(&b)); + assert!(!a.ne(&b)); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-enum.rs new file mode 100644 index 00000000000..5b00f11a901 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-enum.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +enum Foo { + Bar(isize, isize), + Baz(f64, f64) +} + +pub fn main() { + let a = Foo::Bar(1, 2); + let b = Foo::Bar(1, 2); + assert_eq!(a, b); + assert!(!(a != b)); + assert!(a.eq(&b)); + assert!(!a.ne(&b)); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs new file mode 100644 index 00000000000..fe2716396d8 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Hash)] +enum Foo { + Bar(isize, char), + Baz(char, isize) +} + +#[derive(Hash)] +enum A { + B, + C, + D, + E +} + +pub fn main(){} diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs new file mode 100644 index 00000000000..2178673cac8 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Hash)] +struct Foo { + x: isize, + y: isize, + z: isize +} + +pub fn main() {} diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs new file mode 100644 index 00000000000..7753700db18 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-empty.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Foo; + +pub fn main() { + assert_eq!(Foo, Foo); + assert!(!(Foo != Foo)); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs new file mode 100644 index 00000000000..67a1472e883 --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +enum S { + X { x: isize, y: isize }, + Y +} + +pub fn main() { + let x = S::X { x: 1, y: 2 }; + assert_eq!(x, x); + assert!(!(x != x)); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs new file mode 100644 index 00000000000..dd9d9b7707e --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-tuple.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Foo(isize, isize, String); + +pub fn main() { + let a1 = Foo(5, 6, "abc".to_string()); + let a2 = Foo(5, 6, "abc".to_string()); + let b = Foo(5, 7, "def".to_string()); + + assert_eq!(a1, a1); + assert_eq!(a2, a1); + assert!(!(a1 == b)); + + assert!(a1 != b); + assert!(!(a1 != a1)); + assert!(!(a2 != a1)); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct.rs b/src/test/run-pass/deriving/deriving-via-extension-struct.rs new file mode 100644 index 00000000000..69bca7ce36d --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-struct.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Foo { + x: isize, + y: isize, + z: isize, +} + +pub fn main() { + let a = Foo { x: 1, y: 2, z: 3 }; + let b = Foo { x: 1, y: 2, z: 3 }; + assert_eq!(a, b); + assert!(!(a != b)); + assert!(a.eq(&b)); + assert!(!a.ne(&b)); +} diff --git a/src/test/run-pass/deriving/deriving-via-extension-type-params.rs b/src/test/run-pass/deriving/deriving-via-extension-type-params.rs new file mode 100644 index 00000000000..63d2b58804b --- /dev/null +++ b/src/test/run-pass/deriving/deriving-via-extension-type-params.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Hash, Debug)] +struct Foo { + x: isize, + y: T, + z: isize +} + +pub fn main() { + let a = Foo { x: 1, y: 2.0f64, z: 3 }; + let b = Foo { x: 1, y: 2.0f64, z: 3 }; + assert_eq!(a, b); + assert!(!(a != b)); + assert!(a.eq(&b)); + assert!(!a.ne(&b)); +} diff --git a/src/test/run-pass/deriving/deriving-with-repr-packed.rs b/src/test/run-pass/deriving/deriving-with-repr-packed.rs new file mode 100644 index 00000000000..fd84d6da29e --- /dev/null +++ b/src/test/run-pass/deriving/deriving-with-repr-packed.rs @@ -0,0 +1,46 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that derive on a packed struct does not call field +// methods with a misaligned field. + +use std::mem; + +#[derive(Copy, Clone)] +struct Aligned(usize); + +#[inline(never)] +fn check_align(ptr: *const Aligned) { + assert_eq!(ptr as usize % mem::align_of::(), + 0); +} + +impl PartialEq for Aligned { + fn eq(&self, other: &Self) -> bool { + check_align(self); + check_align(other); + self.0 == other.0 + } +} + +#[repr(packed)] +#[derive(Copy, Clone, PartialEq)] +struct Packed(Aligned, Aligned); + +#[derive(PartialEq)] +#[repr(C)] +struct Dealigned(u8, T); + +fn main() { + let d1 = Dealigned(0, Packed(Aligned(1), Aligned(2))); + let ck = d1 == d1; + assert!(ck); +} diff --git a/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs b/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs new file mode 100644 index 00000000000..d8912943441 --- /dev/null +++ b/src/test/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs @@ -0,0 +1,60 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(dropck_eyepatch)] + +// The point of this test is to illustrate that the `#[may_dangle]` +// attribute specifically allows, in the context of a type +// implementing `Drop`, a generic parameter to be instantiated with a +// lifetime that does not strictly outlive the owning type itself, +// and that this attributes effects are preserved when importing +// the type from another crate. +// +// See also dropck-eyepatch.rs for more information about the general +// structure of the test. + +use std::cell::RefCell; + +pub trait Foo { fn foo(&self, _: &str); } + +pub struct Dt(pub &'static str, pub A); +pub struct Dr<'a, B:'a+Foo>(pub &'static str, pub &'a B); +pub struct Pt(pub &'static str, pub A, pub B); +pub struct Pr<'a, 'b, B:'a+'b+Foo>(pub &'static str, pub &'a B, pub &'b B); +pub struct St(pub &'static str, pub A); +pub struct Sr<'a, B:'a+Foo>(pub &'static str, pub &'a B); + +impl Drop for Dt { + fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } +} +impl<'a, B: Foo> Drop for Dr<'a, B> { + fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } +} +unsafe impl<#[may_dangle] A, B: Foo> Drop for Pt { + // (unsafe to access self.1 due to #[may_dangle] on A) + fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } +} +unsafe impl<#[may_dangle] 'a, 'b, B: Foo> Drop for Pr<'a, 'b, B> { + // (unsafe to access self.1 due to #[may_dangle] on 'a) + fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } +} + +impl Foo for RefCell { + fn foo(&self, s: &str) { + let s2 = format!("{}|{}", *self.borrow(), s); + *self.borrow_mut() = s2; + } +} + +impl<'a, T:Foo> Foo for &'a T { + fn foo(&self, s: &str) { + (*self).foo(s); + } +} diff --git a/src/test/run-pass/drop/drop-on-empty-block-exit.rs b/src/test/run-pass/drop/drop-on-empty-block-exit.rs new file mode 100644 index 00000000000..9ddf399ed7a --- /dev/null +++ b/src/test/run-pass/drop/drop-on-empty-block-exit.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] + +#![feature(box_syntax)] + +enum t { foo(Box), } + +pub fn main() { + let tt = t::foo(box 10); + match tt { t::foo(_z) => { } } +} diff --git a/src/test/run-pass/drop/drop-on-ret.rs b/src/test/run-pass/drop/drop-on-ret.rs new file mode 100644 index 00000000000..e56119df20e --- /dev/null +++ b/src/test/run-pass/drop/drop-on-ret.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +// pretty-expanded FIXME #23616 + +fn f() -> isize { + if true { + let _s: String = "should not leak".to_string(); + return 1; + } + return 0; +} + +pub fn main() { f(); } diff --git a/src/test/run-pass/drop/drop-struct-as-object.rs b/src/test/run-pass/drop/drop-struct-as-object.rs new file mode 100644 index 00000000000..97ec423643c --- /dev/null +++ b/src/test/run-pass/drop/drop-struct-as-object.rs @@ -0,0 +1,47 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Test that destructor on a struct runs successfully after the struct +// is boxed and converted to an object. + +#![feature(box_syntax)] + +static mut value: usize = 0; + +struct Cat { + name : usize, +} + +trait Dummy { + fn get(&self) -> usize; +} + +impl Dummy for Cat { + fn get(&self) -> usize { self.name } +} + +impl Drop for Cat { + fn drop(&mut self) { + unsafe { value = self.name; } + } +} + +pub fn main() { + { + let x = box Cat {name: 22}; + let nyan: Box = x as Box; + } + unsafe { + assert_eq!(value, 22); + } +} diff --git a/src/test/run-pass/drop/drop-trait-enum.rs b/src/test/run-pass/drop/drop-trait-enum.rs new file mode 100644 index 00000000000..4d3cf2bd053 --- /dev/null +++ b/src/test/run-pass/drop/drop-trait-enum.rs @@ -0,0 +1,102 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(box_syntax)] + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +#[derive(PartialEq, Debug)] +enum Message { + Dropped, + DestructorRan +} + +struct SendOnDrop { + sender: Sender +} + +impl Drop for SendOnDrop { + fn drop(&mut self) { + self.sender.send(Message::Dropped).unwrap(); + } +} + +enum Foo { + SimpleVariant(Sender), + NestedVariant(Box, SendOnDrop, Sender), + FailingVariant { on_drop: SendOnDrop } +} + +impl Drop for Foo { + fn drop(&mut self) { + match self { + &mut Foo::SimpleVariant(ref mut sender) => { + sender.send(Message::DestructorRan).unwrap(); + } + &mut Foo::NestedVariant(_, _, ref mut sender) => { + sender.send(Message::DestructorRan).unwrap(); + } + &mut Foo::FailingVariant { .. } => { + panic!("Failed"); + } + } + } +} + +pub fn main() { + let (sender, receiver) = channel(); + { + let v = Foo::SimpleVariant(sender); + } + assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); + assert_eq!(receiver.recv().ok(), None); + + let (sender, receiver) = channel(); + { + let v = Foo::NestedVariant(box 42, SendOnDrop { sender: sender.clone() }, sender); + } + assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); + assert_eq!(receiver.recv().unwrap(), Message::Dropped); + assert_eq!(receiver.recv().ok(), None); + + let (sender, receiver) = channel(); + let t = thread::spawn(move|| { + let v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; + }); + assert_eq!(receiver.recv().unwrap(), Message::Dropped); + assert_eq!(receiver.recv().ok(), None); + drop(t.join()); + + let (sender, receiver) = channel(); + let t = { + thread::spawn(move|| { + let mut v = Foo::NestedVariant(box 42, SendOnDrop { + sender: sender.clone() + }, sender.clone()); + v = Foo::NestedVariant(box 42, + SendOnDrop { sender: sender.clone() }, + sender.clone()); + v = Foo::SimpleVariant(sender.clone()); + v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; + }) + }; + assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); + assert_eq!(receiver.recv().unwrap(), Message::Dropped); + assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); + assert_eq!(receiver.recv().unwrap(), Message::Dropped); + assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); + assert_eq!(receiver.recv().unwrap(), Message::Dropped); + assert_eq!(receiver.recv().ok(), None); + drop(t.join()); +} diff --git a/src/test/run-pass/drop/drop-trait-generic.rs b/src/test/run-pass/drop/drop-trait-generic.rs new file mode 100644 index 00000000000..c09482a4540 --- /dev/null +++ b/src/test/run-pass/drop/drop-trait-generic.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S { + x: T +} + +impl ::std::ops::Drop for S { + fn drop(&mut self) { + println!("bye"); + } +} + +pub fn main() { + let _x = S { x: 1 }; +} diff --git a/src/test/run-pass/drop/drop-trait.rs b/src/test/run-pass/drop/drop-trait.rs new file mode 100644 index 00000000000..2e867ac0fc0 --- /dev/null +++ b/src/test/run-pass/drop/drop-trait.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + x: isize +} + +impl Drop for Foo { + fn drop(&mut self) { + println!("bye"); + } +} + +pub fn main() { + let _x: Foo = Foo { x: 3 }; +} diff --git a/src/test/run-pass/drop/drop-uninhabited-enum.rs b/src/test/run-pass/drop/drop-uninhabited-enum.rs new file mode 100644 index 00000000000..6fb0abd9643 --- /dev/null +++ b/src/test/run-pass/drop/drop-uninhabited-enum.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Foo { } + +impl Drop for Foo { + fn drop(&mut self) { } +} + +fn foo(x: Foo) { } + +fn main() { } diff --git a/src/test/run-pass/drop/drop-with-type-ascription-1.rs b/src/test/run-pass/drop/drop-with-type-ascription-1.rs new file mode 100644 index 00000000000..2983508363b --- /dev/null +++ b/src/test/run-pass/drop/drop-with-type-ascription-1.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let foo = "hello".to_string(); + let foo: Vec<&str> = foo.split_whitespace().collect(); + let invalid_string = &foo[0]; + assert_eq!(*invalid_string, "hello"); +} diff --git a/src/test/run-pass/drop/drop-with-type-ascription-2.rs b/src/test/run-pass/drop/drop-with-type-ascription-2.rs new file mode 100644 index 00000000000..a2ac470ff11 --- /dev/null +++ b/src/test/run-pass/drop/drop-with-type-ascription-2.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let args = vec!["foobie", "asdf::asdf"]; + let arr: Vec<&str> = args[1].split("::").collect(); + assert_eq!(arr[0], "asdf"); + assert_eq!(arr[0], "asdf"); +} diff --git a/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs b/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs new file mode 100644 index 00000000000..42d54b7be37 --- /dev/null +++ b/src/test/run-pass/drop/dropck-eyepatch-extern-crate.rs @@ -0,0 +1,49 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:dropck_eyepatch_extern_crate.rs + +extern crate dropck_eyepatch_extern_crate as other; + +use other::{Dt,Dr,Pt,Pr,St,Sr}; + +fn main() { + use std::cell::RefCell; + + struct CheckOnDrop(RefCell, &'static str); + impl Drop for CheckOnDrop { + fn drop(&mut self) { assert_eq!(*self.0.borrow(), self.1); } + } + + let c_long; + let (c, dt, dr, pt, pr, st, sr) + : (CheckOnDrop, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>); + c_long = CheckOnDrop(RefCell::new("c_long".to_string()), + "c_long|pr|pt|dr|dt"); + c = CheckOnDrop(RefCell::new("c".to_string()), + "c"); + + // No error: sufficiently long-lived state can be referenced in dtors + dt = Dt("dt", &c_long.0); + dr = Dr("dr", &c_long.0); + + // No error: Drop impl asserts .1 (A and &'a _) are not accessed + pt = Pt("pt", &c.0, &c_long.0); + pr = Pr("pr", &c.0, &c_long.0); + + // No error: St and Sr have no destructor. + st = St("st", &c.0); + sr = Sr("sr", &c.0); + + println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); + assert_eq!(*c_long.0.borrow(), "c_long"); + assert_eq!(*c.0.borrow(), "c"); +} diff --git a/src/test/run-pass/drop/dropck-eyepatch-reorder.rs b/src/test/run-pass/drop/dropck-eyepatch-reorder.rs new file mode 100644 index 00000000000..6696044a02d --- /dev/null +++ b/src/test/run-pass/drop/dropck-eyepatch-reorder.rs @@ -0,0 +1,89 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(dropck_eyepatch)] + +// The point of this test is to test uses of `#[may_dangle]` attribute +// where the formal declaration order (in the impl generics) does not +// match the actual usage order (in the type instantiation). +// +// See also dropck-eyepatch.rs for more information about the general +// structure of the test. + +trait Foo { fn foo(&self, _: &str); } + +struct Dt(&'static str, A); +struct Dr<'a, B:'a+Foo>(&'static str, &'a B); +struct Pt(&'static str, A, B); +struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, &'a B, &'b B); +struct St(&'static str, A); +struct Sr<'a, B:'a+Foo>(&'static str, &'a B); + +impl Drop for Dt { + fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } +} +impl<'a, B: Foo> Drop for Dr<'a, B> { + fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } +} +unsafe impl Drop for Pt { + // (unsafe to access self.1 due to #[may_dangle] on A) + fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } +} +unsafe impl<'b, #[may_dangle] 'a, B: Foo> Drop for Pr<'a, 'b, B> { + // (unsafe to access self.1 due to #[may_dangle] on 'a) + fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } +} + +fn main() { + use std::cell::RefCell; + + impl Foo for RefCell { + fn foo(&self, s: &str) { + let s2 = format!("{}|{}", *self.borrow(), s); + *self.borrow_mut() = s2; + } + } + + impl<'a, T:Foo> Foo for &'a T { + fn foo(&self, s: &str) { + (*self).foo(s); + } + } + + struct CheckOnDrop(RefCell, &'static str); + impl Drop for CheckOnDrop { + fn drop(&mut self) { assert_eq!(*self.0.borrow(), self.1); } + } + + let c_long; + let (c, dt, dr, pt, pr, st, sr) + : (CheckOnDrop, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>); + c_long = CheckOnDrop(RefCell::new("c_long".to_string()), + "c_long|pr|pt|dr|dt"); + c = CheckOnDrop(RefCell::new("c".to_string()), + "c"); + + // No error: sufficiently long-lived state can be referenced in dtors + dt = Dt("dt", &c_long.0); + dr = Dr("dr", &c_long.0); + + // No error: Drop impl asserts .1 (A and &'a _) are not accessed + pt = Pt("pt", &c.0, &c_long.0); + pr = Pr("pr", &c.0, &c_long.0); + + // No error: St and Sr have no destructor. + st = St("st", &c.0); + sr = Sr("sr", &c.0); + + println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); + assert_eq!(*c_long.0.borrow(), "c_long"); + assert_eq!(*c.0.borrow(), "c"); +} diff --git a/src/test/run-pass/drop/dropck-eyepatch.rs b/src/test/run-pass/drop/dropck-eyepatch.rs new file mode 100644 index 00000000000..fb9af09a7ce --- /dev/null +++ b/src/test/run-pass/drop/dropck-eyepatch.rs @@ -0,0 +1,112 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(dropck_eyepatch)] + +// The point of this test is to illustrate that the `#[may_dangle]` +// attribute specifically allows, in the context of a type +// implementing `Drop`, a generic parameter to be instantiated with a +// lifetime that does not strictly outlive the owning type itself. +// +// Here we test that a model use of `#[may_dangle]` will compile and run. +// +// The illustration is made concrete by comparison with two variations +// on the type with `#[may_dangle]`: +// +// 1. an analogous type that does not implement `Drop` (and thus +// should exhibit maximal flexibility with respect to dropck), and +// +// 2. an analogous type that does not use `#[may_dangle]` (and thus +// should exhibit the standard limitations imposed by dropck. +// +// The types in this file follow a pattern, {D,P,S}{t,r}, where: +// +// - D means "I implement Drop" +// +// - P means "I implement Drop but guarantee my (first) parameter is +// pure, i.e. not accessed from the destructor"; no other parameters +// are pure. +// +// - S means "I do not implement Drop" +// +// - t suffix is used when the first generic is a type +// +// - r suffix is used when the first generic is a lifetime. + +trait Foo { fn foo(&self, _: &str); } + +struct Dt(&'static str, A); +struct Dr<'a, B:'a+Foo>(&'static str, &'a B); +struct Pt(&'static str, A, B); +struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, &'a B, &'b B); +struct St(&'static str, A); +struct Sr<'a, B:'a+Foo>(&'static str, &'a B); + +impl Drop for Dt { + fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } +} +impl<'a, B: Foo> Drop for Dr<'a, B> { + fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } +} +unsafe impl<#[may_dangle] A, B: Foo> Drop for Pt { + // (unsafe to access self.1 due to #[may_dangle] on A) + fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } +} +unsafe impl<#[may_dangle] 'a, 'b, B: Foo> Drop for Pr<'a, 'b, B> { + // (unsafe to access self.1 due to #[may_dangle] on 'a) + fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } +} + +fn main() { + use std::cell::RefCell; + + impl Foo for RefCell { + fn foo(&self, s: &str) { + let s2 = format!("{}|{}", *self.borrow(), s); + *self.borrow_mut() = s2; + } + } + + impl<'a, T:Foo> Foo for &'a T { + fn foo(&self, s: &str) { + (*self).foo(s); + } + } + + struct CheckOnDrop(RefCell, &'static str); + impl Drop for CheckOnDrop { + fn drop(&mut self) { assert_eq!(*self.0.borrow(), self.1); } + } + + let c_long; + let (c, dt, dr, pt, pr, st, sr) + : (CheckOnDrop, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>); + c_long = CheckOnDrop(RefCell::new("c_long".to_string()), + "c_long|pr|pt|dr|dt"); + c = CheckOnDrop(RefCell::new("c".to_string()), + "c"); + + // No error: sufficiently long-lived state can be referenced in dtors + dt = Dt("dt", &c_long.0); + dr = Dr("dr", &c_long.0); + + // No error: Drop impl asserts .1 (A and &'a _) are not accessed + pt = Pt("pt", &c.0, &c_long.0); + pr = Pr("pr", &c.0, &c_long.0); + + // No error: St and Sr have no destructor. + st = St("st", &c.0); + sr = Sr("sr", &c.0); + + println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); + assert_eq!(*c_long.0.borrow(), "c_long"); + assert_eq!(*c.0.borrow(), "c"); +} diff --git a/src/test/run-pass/drop/dropck_legal_cycles.rs b/src/test/run-pass/drop/dropck_legal_cycles.rs new file mode 100644 index 00000000000..2c88cfd5c8f --- /dev/null +++ b/src/test/run-pass/drop/dropck_legal_cycles.rs @@ -0,0 +1,1193 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test exercises cases where cyclic structure is legal, +// including when the cycles go through data-structures such +// as `Vec` or `TypedArena`. +// +// The intent is to cover as many such cases as possible, ensuring +// that if the compiler did not complain circa Rust 1.x (1.2 as of +// this writing), then it will continue to not complain in the future. +// +// Note that while some of the tests are only exercising using the +// given collection as a "backing store" for a set of nodes that hold +// the actual cycle (and thus the cycle does not go through the +// collection itself in such cases), in general we *do* want to make +// sure to have at least one example exercising a cycle that goes +// through the collection, for every collection type that supports +// this. + +// HIGH LEVEL DESCRIPTION OF THE TEST ARCHITECTURE +// ----------------------------------------------- +// +// We pick a data structure and want to make a cyclic construction +// from it. Each test of interest is labelled starting with "Cycle N: +// { ... }" where N is the test number and the "..."`is filled in with +// a graphviz-style description of the graph structure that the +// author believes is being made. So "{ a -> b, b -> (c,d), (c,d) -> e }" +// describes a line connected to a diamond: +// +// c +// / \ +// a - b e +// \ / +// d +// +// (Note that the above directed graph is actually acyclic.) +// +// The different graph structures are often composed of different data +// types. Some may be built atop `Vec`, others atop `HashMap`, etc. +// +// For each graph structure, we actually *confirm* that a cycle exists +// (as a safe-guard against a test author accidentally leaving it out) +// by traversing each graph and "proving" that a cycle exists within it. +// +// To do this, while trying to keep the code uniform (despite working +// with different underlying collection and smart-pointer types), we +// have a standard traversal API: +// +// 1. every node in the graph carries a `mark` (a u32, init'ed to 0). +// +// 2. every node provides a method to visit its children +// +// 3. a traversal attmepts to visit the nodes of the graph and prove that +// it sees the same node twice. It does this by setting the mark of each +// node to a fresh non-zero value, and if it sees the current mark, it +// "knows" that it must have found a cycle, and stops attempting further +// traversal. +// +// 4. each traversal is controlled by a bit-string that tells it which child +// it visit when it can take different paths. As a simple example, +// in a binary tree, 0 could mean "left" (and 1, "right"), so that +// "00010" means "left, left, left, right, left". (In general it will +// read as many bits as it needs to choose one child.) +// +// The graphs in this test are all meant to be very small, and thus +// short bitstrings of less than 64 bits should always suffice. +// +// (An earlier version of this test infrastructure simply had any +// given traversal visit all children it encountered, in a +// depth-first manner; one problem with this approach is that an +// acyclic graph can still have sharing, which would then be treated +// as a repeat mark and reported as a detected cycle.) +// +// The travseral code is a little more complicated because it has been +// programmed in a somewhat defensive manner. For example it also has +// a max threshold for the number of nodes it will visit, to guard +// against scenarios where the nodes are not correctly setting their +// mark when asked. There are various other methods not discussed here +// that are for aiding debugging the test when it runs, such as the +// `name` method that all nodes provide. +// +// So each test: +// +// 1. allocates the nodes in the graph, +// +// 2. sets up the links in the graph, +// +// 3. clones the "ContextData" +// +// 4. chooses a new current mark value for this test +// +// 5. initiates a traversal, potentially from multiple starting points +// (aka "roots"), with a given control-string (potentially a +// different string for each root). if it does start from a +// distinct root, then such a test should also increment the +// current mark value, so that this traversal is considered +// distinct from the prior one on this graph structure. +// +// Note that most of the tests work with the default control string +// of all-zeroes. +// +// 6. assert that the context confirms that it actually saw a cycle (since a traversal +// might have terminated, e.g. on a tree structure that contained no cycles). + +use std::cell::{Cell, RefCell}; +use std::cmp::Ordering; +use std::collections::BinaryHeap; +use std::collections::HashMap; +use std::collections::LinkedList; +use std::collections::VecDeque; +use std::collections::btree_map::BTreeMap; +use std::collections::btree_set::BTreeSet; +use std::hash::{Hash, Hasher}; +use std::rc::Rc; +use std::sync::{Arc, RwLock, Mutex}; + +const PRINT: bool = false; + +pub fn main() { + let c_orig = ContextData { + curr_depth: 0, + max_depth: 3, + visited: 0, + max_visits: 1000, + skipped: 0, + curr_mark: 0, + saw_prev_marked: false, + control_bits: 0, + }; + + // SANITY CHECK FOR TEST SUITE (thus unnumbered) + // Not a cycle: { v[0] -> (v[1], v[2]), v[1] -> v[3], v[2] -> v[3] }; + let v: Vec = vec![Named::new("s0"), + Named::new("s1"), + Named::new("s2"), + Named::new("s3")]; + v[0].next.set((Some(&v[1]), Some(&v[2]))); + v[1].next.set((Some(&v[3]), None)); + v[2].next.set((Some(&v[3]), None)); + v[3].next.set((None, None)); + + let mut c = c_orig.clone(); + c.curr_mark = 10; + assert!(!c.saw_prev_marked); + v[0].descend_into_self(&mut c); + assert!(!c.saw_prev_marked); // <-- different from below, b/c acyclic above + + if PRINT { println!(""); } + + // Cycle 1: { v[0] -> v[1], v[1] -> v[0] }; + // does not exercise `v` itself + let v: Vec = vec![Named::new("s0"), + Named::new("s1")]; + v[0].next.set(Some(&v[1])); + v[1].next.set(Some(&v[0])); + + let mut c = c_orig.clone(); + c.curr_mark = 10; + assert!(!c.saw_prev_marked); + v[0].descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 2: { v[0] -> v, v[1] -> v } + let v: V = Named::new("v"); + v.contents[0].set(Some(&v)); + v.contents[1].set(Some(&v)); + + let mut c = c_orig.clone(); + c.curr_mark = 20; + assert!(!c.saw_prev_marked); + v.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 3: { hk0 -> hv0, hv0 -> hk0, hk1 -> hv1, hv1 -> hk1 }; + // does not exercise `h` itself + + let mut h: HashMap = HashMap::new(); + h.insert(Named::new("hk0"), Named::new("hv0")); + h.insert(Named::new("hk1"), Named::new("hv1")); + for (key, val) in h.iter() { + val.next.set(Some(key)); + key.next.set(Some(val)); + } + + let mut c = c_orig.clone(); + c.curr_mark = 30; + for (key, _) in h.iter() { + c.curr_mark += 1; + c.saw_prev_marked = false; + key.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + } + + if PRINT { println!(""); } + + // Cycle 4: { h -> (hmk0,hmv0,hmk1,hmv1), {hmk0,hmv0,hmk1,hmv1} -> h } + + let mut h: HashMap = HashMap::new(); + h.insert(Named::new("hmk0"), Named::new("hmv0")); + h.insert(Named::new("hmk0"), Named::new("hmv0")); + for (key, val) in h.iter() { + val.contents.set(Some(&h)); + key.contents.set(Some(&h)); + } + + let mut c = c_orig.clone(); + c.max_depth = 2; + c.curr_mark = 40; + for (key, _) in h.iter() { + c.curr_mark += 1; + c.saw_prev_marked = false; + key.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + // break; + } + + if PRINT { println!(""); } + + // Cycle 5: { vd[0] -> vd[1], vd[1] -> vd[0] }; + // does not exercise vd itself + let mut vd: VecDeque = VecDeque::new(); + vd.push_back(Named::new("d0")); + vd.push_back(Named::new("d1")); + vd[0].next.set(Some(&vd[1])); + vd[1].next.set(Some(&vd[0])); + + let mut c = c_orig.clone(); + c.curr_mark = 50; + assert!(!c.saw_prev_marked); + vd[0].descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 6: { vd -> (vd0, vd1), {vd0, vd1} -> vd } + let mut vd: VecDeque = VecDeque::new(); + vd.push_back(Named::new("vd0")); + vd.push_back(Named::new("vd1")); + vd[0].contents.set(Some(&vd)); + vd[1].contents.set(Some(&vd)); + + let mut c = c_orig.clone(); + c.curr_mark = 60; + assert!(!c.saw_prev_marked); + vd[0].descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 7: { vm -> (vm0, vm1), {vm0, vm1} -> vm } + let mut vm: HashMap = HashMap::new(); + vm.insert(0, Named::new("vm0")); + vm.insert(1, Named::new("vm1")); + vm[&0].contents.set(Some(&vm)); + vm[&1].contents.set(Some(&vm)); + + let mut c = c_orig.clone(); + c.curr_mark = 70; + assert!(!c.saw_prev_marked); + vm[&0].descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 8: { ll -> (ll0, ll1), {ll0, ll1} -> ll } + let mut ll: LinkedList = LinkedList::new(); + ll.push_back(Named::new("ll0")); + ll.push_back(Named::new("ll1")); + for e in &ll { + e.contents.set(Some(&ll)); + } + + let mut c = c_orig.clone(); + c.curr_mark = 80; + for e in &ll { + c.curr_mark += 1; + c.saw_prev_marked = false; + e.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + // break; + } + + if PRINT { println!(""); } + + // Cycle 9: { bh -> (bh0, bh1), {bh0, bh1} -> bh } + let mut bh: BinaryHeap = BinaryHeap::new(); + bh.push(Named::new("bh0")); + bh.push(Named::new("bh1")); + for b in bh.iter() { + b.contents.set(Some(&bh)); + } + + let mut c = c_orig.clone(); + c.curr_mark = 90; + for b in &bh { + c.curr_mark += 1; + c.saw_prev_marked = false; + b.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + // break; + } + + if PRINT { println!(""); } + + // Cycle 10: { btm -> (btk0, btv1), {bt0, bt1} -> btm } + let mut btm: BTreeMap = BTreeMap::new(); + btm.insert(Named::new("btk0"), Named::new("btv0")); + btm.insert(Named::new("btk1"), Named::new("btv1")); + for (k, v) in btm.iter() { + k.contents.set(Some(&btm)); + v.contents.set(Some(&btm)); + } + + let mut c = c_orig.clone(); + c.curr_mark = 100; + for (k, _) in &btm { + c.curr_mark += 1; + c.saw_prev_marked = false; + k.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + // break; + } + + if PRINT { println!(""); } + + // Cycle 10: { bts -> (bts0, bts1), {bts0, bts1} -> btm } + let mut bts: BTreeSet = BTreeSet::new(); + bts.insert(Named::new("bts0")); + bts.insert(Named::new("bts1")); + for v in bts.iter() { + v.contents.set(Some(&bts)); + } + + let mut c = c_orig.clone(); + c.curr_mark = 100; + for b in &bts { + c.curr_mark += 1; + c.saw_prev_marked = false; + b.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + // break; + } + + if PRINT { println!(""); } + + // Cycle 11: { rc0 -> (rc1, rc2), rc1 -> (), rc2 -> rc0 } + let (rc0, rc1, rc2): (RCRC, RCRC, RCRC); + rc0 = RCRC::new("rcrc0"); + rc1 = RCRC::new("rcrc1"); + rc2 = RCRC::new("rcrc2"); + rc0.0.borrow_mut().children.0 = Some(&rc1); + rc0.0.borrow_mut().children.1 = Some(&rc2); + rc2.0.borrow_mut().children.0 = Some(&rc0); + + let mut c = c_orig.clone(); + c.control_bits = 0b1; + c.curr_mark = 110; + assert!(!c.saw_prev_marked); + rc0.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // We want to take the previous Rc case and generalize it to Arc. + // + // We can use refcells if we're single-threaded (as this test is). + // If one were to generalize these constructions to a + // multi-threaded context, then it might seem like we could choose + // between either a RwLock or a Mutex to hold the owned arcs on + // each node. + // + // Part of the point of this test is to actually confirm that the + // cycle exists by traversing it. We can do that just fine with an + // RwLock (since we can grab the child pointers in read-only + // mode), but we cannot lock a std::sync::Mutex to guard reading + // from each node via the same pattern, since once you hit the + // cycle, you'll be trying to acquiring the same lock twice. + // (We deal with this by exiting the traversal early if try_lock fails.) + + // Cycle 12: { arc0 -> (arc1, arc2), arc1 -> (), arc2 -> arc0 }, refcells + let (arc0, arc1, arc2): (ARCRC, ARCRC, ARCRC); + arc0 = ARCRC::new("arcrc0"); + arc1 = ARCRC::new("arcrc1"); + arc2 = ARCRC::new("arcrc2"); + arc0.0.borrow_mut().children.0 = Some(&arc1); + arc0.0.borrow_mut().children.1 = Some(&arc2); + arc2.0.borrow_mut().children.0 = Some(&arc0); + + let mut c = c_orig.clone(); + c.control_bits = 0b1; + c.curr_mark = 110; + assert!(!c.saw_prev_marked); + arc0.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 13: { arc0 -> (arc1, arc2), arc1 -> (), arc2 -> arc0 }, rwlocks + let (arc0, arc1, arc2): (ARCRW, ARCRW, ARCRW); + arc0 = ARCRW::new("arcrw0"); + arc1 = ARCRW::new("arcrw1"); + arc2 = ARCRW::new("arcrw2"); + arc0.0.write().unwrap().children.0 = Some(&arc1); + arc0.0.write().unwrap().children.1 = Some(&arc2); + arc2.0.write().unwrap().children.0 = Some(&arc0); + + let mut c = c_orig.clone(); + c.control_bits = 0b1; + c.curr_mark = 110; + assert!(!c.saw_prev_marked); + arc0.descend_into_self(&mut c); + assert!(c.saw_prev_marked); + + if PRINT { println!(""); } + + // Cycle 14: { arc0 -> (arc1, arc2), arc1 -> (), arc2 -> arc0 }, mutexs + let (arc0, arc1, arc2): (ARCM, ARCM, ARCM); + arc0 = ARCM::new("arcm0"); + arc1 = ARCM::new("arcm1"); + arc2 = ARCM::new("arcm2"); + arc0.1.lock().unwrap().children.0 = Some(&arc1); + arc0.1.lock().unwrap().children.1 = Some(&arc2); + arc2.1.lock().unwrap().children.0 = Some(&arc0); + + let mut c = c_orig.clone(); + c.control_bits = 0b1; + c.curr_mark = 110; + assert!(!c.saw_prev_marked); + arc0.descend_into_self(&mut c); + assert!(c.saw_prev_marked); +} + +trait Named { + fn new(_: &'static str) -> Self; + fn name(&self) -> &str; +} + +trait Marked { + fn mark(&self) -> M; + fn set_mark(&self, mark: M); +} + +struct S<'a> { + name: &'static str, + mark: Cell, + next: Cell>>, +} + +impl<'a> Named for S<'a> { + fn new(name: &'static str) -> S<'a> { + S { name: name, mark: Cell::new(0), next: Cell::new(None) } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for S<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +struct S2<'a> { + name: &'static str, + mark: Cell, + next: Cell<(Option<&'a S2<'a>>, Option<&'a S2<'a>>)>, +} + +impl<'a> Named for S2<'a> { + fn new(name: &'static str) -> S2<'a> { + S2 { name: name, mark: Cell::new(0), next: Cell::new((None, None)) } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for S2<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { + self.mark.set(mark); + } +} + +struct V<'a> { + name: &'static str, + mark: Cell, + contents: Vec>>>, +} + +impl<'a> Named for V<'a> { + fn new(name: &'static str) -> V<'a> { + V { name: name, + mark: Cell::new(0), + contents: vec![Cell::new(None), Cell::new(None)] + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for V<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +#[derive(Eq)] +struct H<'a> { + name: &'static str, + mark: Cell, + next: Cell>>, +} + +impl<'a> Named for H<'a> { + fn new(name: &'static str) -> H<'a> { + H { name: name, mark: Cell::new(0), next: Cell::new(None) } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for H<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +impl<'a> PartialEq for H<'a> { + fn eq(&self, rhs: &H<'a>) -> bool { + self.name == rhs.name + } +} + +impl<'a> Hash for H<'a> { + fn hash(&self, state: &mut H) { + self.name.hash(state) + } +} + +#[derive(Eq)] +struct HM<'a> { + name: &'static str, + mark: Cell, + contents: Cell, HM<'a>>>>, +} + +impl<'a> Named for HM<'a> { + fn new(name: &'static str) -> HM<'a> { + HM { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for HM<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +impl<'a> PartialEq for HM<'a> { + fn eq(&self, rhs: &HM<'a>) -> bool { + self.name == rhs.name + } +} + +impl<'a> Hash for HM<'a> { + fn hash(&self, state: &mut H) { + self.name.hash(state) + } +} + + +struct VD<'a> { + name: &'static str, + mark: Cell, + contents: Cell>>>, +} + +impl<'a> Named for VD<'a> { + fn new(name: &'static str) -> VD<'a> { + VD { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for VD<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +struct VM<'a> { + name: &'static str, + mark: Cell, + contents: Cell>>>, +} + +impl<'a> Named for VM<'a> { + fn new(name: &'static str) -> VM<'a> { + VM { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for VM<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +struct LL<'a> { + name: &'static str, + mark: Cell, + contents: Cell>>>, +} + +impl<'a> Named for LL<'a> { + fn new(name: &'static str) -> LL<'a> { + LL { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for LL<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +struct BH<'a> { + name: &'static str, + mark: Cell, + contents: Cell>>>, +} + +impl<'a> Named for BH<'a> { + fn new(name: &'static str) -> BH<'a> { + BH { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for BH<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +impl<'a> Eq for BH<'a> { } + +impl<'a> PartialEq for BH<'a> { + fn eq(&self, rhs: &BH<'a>) -> bool { + self.name == rhs.name + } +} + +impl<'a> PartialOrd for BH<'a> { + fn partial_cmp(&self, rhs: &BH<'a>) -> Option { + Some(self.cmp(rhs)) + } +} + +impl<'a> Ord for BH<'a> { + fn cmp(&self, rhs: &BH<'a>) -> Ordering { + self.name.cmp(rhs.name) + } +} + +struct BTM<'a> { + name: &'static str, + mark: Cell, + contents: Cell, BTM<'a>>>>, +} + +impl<'a> Named for BTM<'a> { + fn new(name: &'static str) -> BTM<'a> { + BTM { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for BTM<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +impl<'a> Eq for BTM<'a> { } + +impl<'a> PartialEq for BTM<'a> { + fn eq(&self, rhs: &BTM<'a>) -> bool { + self.name == rhs.name + } +} + +impl<'a> PartialOrd for BTM<'a> { + fn partial_cmp(&self, rhs: &BTM<'a>) -> Option { + Some(self.cmp(rhs)) + } +} + +impl<'a> Ord for BTM<'a> { + fn cmp(&self, rhs: &BTM<'a>) -> Ordering { + self.name.cmp(rhs.name) + } +} + +struct BTS<'a> { + name: &'static str, + mark: Cell, + contents: Cell>>>, +} + +impl<'a> Named for BTS<'a> { + fn new(name: &'static str) -> BTS<'a> { + BTS { name: name, + mark: Cell::new(0), + contents: Cell::new(None) + } + } + fn name(&self) -> &str { self.name } +} + +impl<'a> Marked for BTS<'a> { + fn mark(&self) -> u32 { self.mark.get() } + fn set_mark(&self, mark: u32) { self.mark.set(mark); } +} + +impl<'a> Eq for BTS<'a> { } + +impl<'a> PartialEq for BTS<'a> { + fn eq(&self, rhs: &BTS<'a>) -> bool { + self.name == rhs.name + } +} + +impl<'a> PartialOrd for BTS<'a> { + fn partial_cmp(&self, rhs: &BTS<'a>) -> Option { + Some(self.cmp(rhs)) + } +} + +impl<'a> Ord for BTS<'a> { + fn cmp(&self, rhs: &BTS<'a>) -> Ordering { + self.name.cmp(rhs.name) + } +} + +#[derive(Clone)] +struct RCRCData<'a> { + name: &'static str, + mark: Cell, + children: (Option<&'a RCRC<'a>>, Option<&'a RCRC<'a>>), +} +#[derive(Clone)] +struct RCRC<'a>(Rc>>); + +impl<'a> Named for RCRC<'a> { + fn new(name: &'static str) -> Self { + RCRC(Rc::new(RefCell::new(RCRCData { + name: name, mark: Cell::new(0), children: (None, None), }))) + } + fn name(&self) -> &str { self.0.borrow().name } +} + +impl<'a> Marked for RCRC<'a> { + fn mark(&self) -> u32 { self.0.borrow().mark.get() } + fn set_mark(&self, mark: u32) { self.0.borrow().mark.set(mark); } +} + +impl<'a> Children<'a> for RCRC<'a> { + fn count_children(&self) -> usize { 2 } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + let children = &self.0.borrow().children; + let child = match index { + 0 => if let Some(child) = children.0 { child } else { return; }, + 1 => if let Some(child) = children.1 { child } else { return; }, + _ => panic!("bad children"), + }; + // println!("S2 {} descending into child {} at index {}", self.name, child.name, index); + child.descend_into_self(context); + } +} +#[derive(Clone)] +struct ARCRCData<'a> { + name: &'static str, + mark: Cell, + children: (Option<&'a ARCRC<'a>>, Option<&'a ARCRC<'a>>), +} +#[derive(Clone)] +struct ARCRC<'a>(Arc>>); + +impl<'a> Named for ARCRC<'a> { + fn new(name: &'static str) -> Self { + ARCRC(Arc::new(RefCell::new(ARCRCData { + name: name, mark: Cell::new(0), children: (None, None), }))) + } + fn name(&self) -> &str { self.0.borrow().name } +} + +impl<'a> Marked for ARCRC<'a> { + fn mark(&self) -> u32 { self.0.borrow().mark.get() } + fn set_mark(&self, mark: u32) { self.0.borrow().mark.set(mark); } +} + +impl<'a> Children<'a> for ARCRC<'a> { + fn count_children(&self) -> usize { 2 } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + let children = &self.0.borrow().children; + match index { + 0 => if let Some(ref child) = children.0 { + child.descend_into_self(context); + }, + 1 => if let Some(ref child) = children.1 { + child.descend_into_self(context); + }, + _ => panic!("bad children!"), + } + } +} + +#[derive(Clone)] +struct ARCMData<'a> { + mark: Cell, + children: (Option<&'a ARCM<'a>>, Option<&'a ARCM<'a>>), +} + +#[derive(Clone)] +struct ARCM<'a>(&'static str, Arc>>); + +impl<'a> Named for ARCM<'a> { + fn new(name: &'static str) -> Self { + ARCM(name, Arc::new(Mutex::new(ARCMData { + mark: Cell::new(0), children: (None, None), }))) + } + fn name(&self) -> &str { self.0 } +} + +impl<'a> Marked for ARCM<'a> { + fn mark(&self) -> u32 { self.1.lock().unwrap().mark.get() } + fn set_mark(&self, mark: u32) { self.1.lock().unwrap().mark.set(mark); } +} + +impl<'a> Children<'a> for ARCM<'a> { + fn count_children(&self) -> usize { 2 } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + let ref children = if let Ok(data) = self.1.try_lock() { + data.children + } else { return; }; + match index { + 0 => if let Some(ref child) = children.0 { + child.descend_into_self(context); + }, + 1 => if let Some(ref child) = children.1 { + child.descend_into_self(context); + }, + _ => panic!("bad children!"), + } + } +} + +#[derive(Clone)] +struct ARCRWData<'a> { + name: &'static str, + mark: Cell, + children: (Option<&'a ARCRW<'a>>, Option<&'a ARCRW<'a>>), +} + +#[derive(Clone)] +struct ARCRW<'a>(Arc>>); + +impl<'a> Named for ARCRW<'a> { + fn new(name: &'static str) -> Self { + ARCRW(Arc::new(RwLock::new(ARCRWData { + name: name, mark: Cell::new(0), children: (None, None), }))) + } + fn name(&self) -> &str { self.0.read().unwrap().name } +} + +impl<'a> Marked for ARCRW<'a> { + fn mark(&self) -> u32 { self.0.read().unwrap().mark.get() } + fn set_mark(&self, mark: u32) { self.0.read().unwrap().mark.set(mark); } +} + +impl<'a> Children<'a> for ARCRW<'a> { + fn count_children(&self) -> usize { 2 } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + let children = &self.0.read().unwrap().children; + match index { + 0 => if let Some(ref child) = children.0 { + child.descend_into_self(context); + }, + 1 => if let Some(ref child) = children.1 { + child.descend_into_self(context); + }, + _ => panic!("bad children!"), + } + } +} + +trait Context { + fn next_index(&mut self, len: usize) -> usize; + fn should_act(&self) -> bool; + fn increase_visited(&mut self); + fn increase_skipped(&mut self); + fn increase_depth(&mut self); + fn decrease_depth(&mut self); +} + +trait PrePost { + fn pre(&mut self, _: &T); + fn post(&mut self, _: &T); + fn hit_limit(&mut self, _: &T); +} + +trait Children<'a> { + fn count_children(&self) -> usize; + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized; + + fn next_child(&self, context: &mut C) + where C: Context + PrePost, Self: Sized + { + let index = context.next_index(self.count_children()); + self.descend_one_child(context, index); + } + + fn descend_into_self(&self, context: &mut C) + where C: Context + PrePost, Self: Sized + { + context.pre(self); + if context.should_act() { + context.increase_visited(); + context.increase_depth(); + self.next_child(context); + context.decrease_depth(); + } else { + context.hit_limit(self); + context.increase_skipped(); + } + context.post(self); + } + + fn descend<'b, C>(&self, c: &Cell>, context: &mut C) + where C: Context + PrePost, Self: Sized + { + if let Some(r) = c.get() { + r.descend_into_self(context); + } + } +} + +impl<'a> Children<'a> for S<'a> { + fn count_children(&self) -> usize { 1 } + fn descend_one_child(&self, context: &mut C, _: usize) + where C: Context + PrePost, Self: Sized { + self.descend(&self.next, context); + } +} + +impl<'a> Children<'a> for S2<'a> { + fn count_children(&self) -> usize { 2 } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + let children = self.next.get(); + let child = match index { + 0 => if let Some(child) = children.0 { child } else { return; }, + 1 => if let Some(child) = children.1 { child } else { return; }, + _ => panic!("bad children"), + }; + // println!("S2 {} descending into child {} at index {}", self.name, child.name, index); + child.descend_into_self(context); + } +} + +impl<'a> Children<'a> for V<'a> { + fn count_children(&self) -> usize { self.contents.len() } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + if let Some(child) = self.contents[index].get() { + child.descend_into_self(context); + } + } +} + +impl<'a> Children<'a> for H<'a> { + fn count_children(&self) -> usize { 1 } + fn descend_one_child(&self, context: &mut C, _: usize) + where C: Context + PrePost, Self: Sized + { + self.descend(&self.next, context); + } +} + +impl<'a> Children<'a> for HM<'a> { + fn count_children(&self) -> usize { + if let Some(m) = self.contents.get() { 2 * m.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + if let Some(ref hm) = self.contents.get() { + for (k, v) in hm.iter().nth(index / 2) { + [k, v][index % 2].descend_into_self(context); + } + } + } +} + +impl<'a> Children<'a> for VD<'a> { + fn count_children(&self) -> usize { + if let Some(d) = self.contents.get() { d.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost, Self: Sized + { + if let Some(ref vd) = self.contents.get() { + for r in vd.iter().nth(index) { + r.descend_into_self(context); + } + } + } +} + +impl<'a> Children<'a> for VM<'a> { + fn count_children(&self) -> usize { + if let Some(m) = self.contents.get() { m.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost> + { + if let Some(ref vd) = self.contents.get() { + for (_idx, r) in vd.iter().nth(index) { + r.descend_into_self(context); + } + } + } +} + +impl<'a> Children<'a> for LL<'a> { + fn count_children(&self) -> usize { + if let Some(l) = self.contents.get() { l.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost> + { + if let Some(ref ll) = self.contents.get() { + for r in ll.iter().nth(index) { + r.descend_into_self(context); + } + } + } +} + +impl<'a> Children<'a> for BH<'a> { + fn count_children(&self) -> usize { + if let Some(h) = self.contents.get() { h.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost> + { + if let Some(ref bh) = self.contents.get() { + for r in bh.iter().nth(index) { + r.descend_into_self(context); + } + } + } +} + +impl<'a> Children<'a> for BTM<'a> { + fn count_children(&self) -> usize { + if let Some(m) = self.contents.get() { 2 * m.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost> + { + if let Some(ref bh) = self.contents.get() { + for (k, v) in bh.iter().nth(index / 2) { + [k, v][index % 2].descend_into_self(context); + } + } + } +} + +impl<'a> Children<'a> for BTS<'a> { + fn count_children(&self) -> usize { + if let Some(s) = self.contents.get() { s.iter().count() } else { 0 } + } + fn descend_one_child(&self, context: &mut C, index: usize) + where C: Context + PrePost> + { + if let Some(ref bh) = self.contents.get() { + for r in bh.iter().nth(index) { + r.descend_into_self(context); + } + } + } +} + +#[derive(Copy, Clone)] +struct ContextData { + curr_depth: usize, + max_depth: usize, + visited: usize, + max_visits: usize, + skipped: usize, + curr_mark: u32, + saw_prev_marked: bool, + control_bits: u64, +} + +impl Context for ContextData { + fn next_index(&mut self, len: usize) -> usize { + if len < 2 { return 0; } + let mut pow2 = len.next_power_of_two(); + let _pow2_orig = pow2; + let mut idx = 0; + let mut bits = self.control_bits; + while pow2 > 1 { + idx = (idx << 1) | (bits & 1) as usize; + bits = bits >> 1; + pow2 = pow2 >> 1; + } + idx = idx % len; + // println!("next_index({} [{:b}]) says {}, pre(bits): {:b} post(bits): {:b}", + // len, _pow2_orig, idx, self.control_bits, bits); + self.control_bits = bits; + return idx; + } + fn should_act(&self) -> bool { + self.curr_depth < self.max_depth && self.visited < self.max_visits + } + fn increase_visited(&mut self) { self.visited += 1; } + fn increase_skipped(&mut self) { self.skipped += 1; } + fn increase_depth(&mut self) { self.curr_depth += 1; } + fn decrease_depth(&mut self) { self.curr_depth -= 1; } +} + +impl> PrePost for ContextData { + fn pre(&mut self, t: &T) { + for _ in 0..self.curr_depth { + if PRINT { print!(" "); } + } + if PRINT { println!("prev {}", t.name()); } + if t.mark() == self.curr_mark { + for _ in 0..self.curr_depth { + if PRINT { print!(" "); } + } + if PRINT { println!("(probably previously marked)"); } + self.saw_prev_marked = true; + } + t.set_mark(self.curr_mark); + } + fn post(&mut self, t: &T) { + for _ in 0..self.curr_depth { + if PRINT { print!(" "); } + } + if PRINT { println!("post {}", t.name()); } + } + fn hit_limit(&mut self, t: &T) { + for _ in 0..self.curr_depth { + if PRINT { print!(" "); } + } + if PRINT { println!("LIMIT {}", t.name()); } + } +} diff --git a/src/test/run-pass/drop/dynamic-drop.rs b/src/test/run-pass/drop/dynamic-drop.rs new file mode 100644 index 00000000000..de10c9f2403 --- /dev/null +++ b/src/test/run-pass/drop/dynamic-drop.rs @@ -0,0 +1,355 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// revisions:lexical nll +#![cfg_attr(nll, feature(nll))] + +// ignore-wasm32-bare compiled with panic=abort by default + +#![feature(generators, generator_trait, untagged_unions)] +#![feature(slice_patterns)] + +use std::cell::{Cell, RefCell}; +use std::ops::Generator; +use std::panic; +use std::usize; + +struct InjectedFailure; + +struct Allocator { + data: RefCell>, + failing_op: usize, + cur_ops: Cell, +} + +impl panic::UnwindSafe for Allocator {} +impl panic::RefUnwindSafe for Allocator {} + +impl Drop for Allocator { + fn drop(&mut self) { + let data = self.data.borrow(); + if data.iter().any(|d| *d) { + panic!("missing free: {:?}", data); + } + } +} + +impl Allocator { + fn new(failing_op: usize) -> Self { + Allocator { + failing_op: failing_op, + cur_ops: Cell::new(0), + data: RefCell::new(vec![]) + } + } + fn alloc(&self) -> Ptr { + self.cur_ops.set(self.cur_ops.get() + 1); + + if self.cur_ops.get() == self.failing_op { + panic!(InjectedFailure); + } + + let mut data = self.data.borrow_mut(); + let addr = data.len(); + data.push(true); + Ptr(addr, self) + } +} + +struct Ptr<'a>(usize, &'a Allocator); +impl<'a> Drop for Ptr<'a> { + fn drop(&mut self) { + match self.1.data.borrow_mut()[self.0] { + false => { + panic!("double free at index {:?}", self.0) + } + ref mut d => *d = false + } + + self.1.cur_ops.set(self.1.cur_ops.get()+1); + + if self.1.cur_ops.get() == self.1.failing_op { + panic!(InjectedFailure); + } + } +} + +fn dynamic_init(a: &Allocator, c: bool) { + let _x; + if c { + _x = Some(a.alloc()); + } +} + +fn dynamic_drop(a: &Allocator, c: bool) { + let x = a.alloc(); + if c { + Some(x) + } else { + None + }; +} + +struct TwoPtrs<'a>(Ptr<'a>, Ptr<'a>); +fn struct_dynamic_drop(a: &Allocator, c0: bool, c1: bool, c: bool) { + for i in 0..2 { + let x; + let y; + if (c0 && i == 0) || (c1 && i == 1) { + x = (a.alloc(), a.alloc(), a.alloc()); + y = TwoPtrs(a.alloc(), a.alloc()); + if c { + drop(x.1); + drop(y.0); + } + } + } +} + +fn field_assignment(a: &Allocator, c0: bool) { + let mut x = (TwoPtrs(a.alloc(), a.alloc()), a.alloc()); + + x.1 = a.alloc(); + x.1 = a.alloc(); + + let f = (x.0).0; + if c0 { + (x.0).0 = f; + } +} + +fn assignment2(a: &Allocator, c0: bool, c1: bool) { + let mut _v = a.alloc(); + let mut _w = a.alloc(); + if c0 { + drop(_v); + } + _v = _w; + if c1 { + _w = a.alloc(); + } +} + +fn assignment1(a: &Allocator, c0: bool) { + let mut _v = a.alloc(); + let mut _w = a.alloc(); + if c0 { + drop(_v); + } + _v = _w; +} + +#[allow(unions_with_drop_fields)] +union Boxy { + a: T, + b: T, +} + +fn union1(a: &Allocator) { + unsafe { + let mut u = Boxy { a: a.alloc() }; + u.b = a.alloc(); + drop(u.a); + } +} + +fn array_simple(a: &Allocator) { + let _x = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; +} + +fn vec_simple(a: &Allocator) { + let _x = vec![a.alloc(), a.alloc(), a.alloc(), a.alloc()]; +} + +fn generator(a: &Allocator, run_count: usize) { + assert!(run_count < 4); + + let mut gen = || { + (a.alloc(), + yield a.alloc(), + a.alloc(), + yield a.alloc() + ); + }; + for _ in 0..run_count { + unsafe { gen.resume(); } + } +} + +fn mixed_drop_and_nondrop(a: &Allocator) { + // check that destructor panics handle drop + // and non-drop blocks in the same scope correctly. + // + // Surprisingly enough, this used to not work. + let (x, y, z); + x = a.alloc(); + y = 5; + z = a.alloc(); +} + +#[allow(unreachable_code)] +fn vec_unreachable(a: &Allocator) { + let _x = vec![a.alloc(), a.alloc(), a.alloc(), return]; +} + +fn slice_pattern_first(a: &Allocator) { + let[_x, ..] = [a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_middle(a: &Allocator) { + let[_, _x, _] = [a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_two(a: &Allocator) { + let[_x, _, _y, _] = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_last(a: &Allocator) { + let[.., _y] = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; +} + +fn slice_pattern_one_of(a: &Allocator, i: usize) { + let array = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; + let _x = match i { + 0 => { let [a, ..] = array; a } + 1 => { let [_, a, ..] = array; a } + 2 => { let [_, _, a, _] = array; a } + 3 => { let [_, _, _, a] = array; a } + _ => panic!("unmatched"), + }; +} + +fn subslice_pattern_from_end(a: &Allocator, arg: bool) { + let a = [a.alloc(), a.alloc(), a.alloc()]; + if arg { + let[.., _x, _] = a; + } else { + let[_, _y..] = a; + } +} + +fn subslice_pattern_from_end_with_drop(a: &Allocator, arg: bool, arg2: bool) { + let a = [a.alloc(), a.alloc(), a.alloc(), a.alloc(), a.alloc()]; + if arg2 { + drop(a); + return; + } + + if arg { + let[.., _x, _] = a; + } else { + let[_, _y..] = a; + } +} + +fn slice_pattern_reassign(a: &Allocator) { + let mut ar = [a.alloc(), a.alloc()]; + let[_, _x] = ar; + ar = [a.alloc(), a.alloc()]; + let[.., _y] = ar; +} + +fn subslice_pattern_reassign(a: &Allocator) { + let mut ar = [a.alloc(), a.alloc(), a.alloc()]; + let[_, _, _x] = ar; + ar = [a.alloc(), a.alloc(), a.alloc()]; + let[_, _y..] = ar; +} + +fn run_test(mut f: F) + where F: FnMut(&Allocator) +{ + let first_alloc = Allocator::new(usize::MAX); + f(&first_alloc); + + for failing_op in 1..first_alloc.cur_ops.get()+1 { + let alloc = Allocator::new(failing_op); + let alloc = &alloc; + let f = panic::AssertUnwindSafe(&mut f); + let result = panic::catch_unwind(move || { + f.0(alloc); + }); + match result { + Ok(..) => panic!("test executed {} ops but now {}", + first_alloc.cur_ops.get(), alloc.cur_ops.get()), + Err(e) => { + if e.downcast_ref::().is_none() { + panic::resume_unwind(e); + } + } + } + } +} + +fn run_test_nopanic(mut f: F) + where F: FnMut(&Allocator) +{ + let first_alloc = Allocator::new(usize::MAX); + f(&first_alloc); +} + +fn main() { + run_test(|a| dynamic_init(a, false)); + run_test(|a| dynamic_init(a, true)); + run_test(|a| dynamic_drop(a, false)); + run_test(|a| dynamic_drop(a, true)); + + run_test(|a| assignment2(a, false, false)); + run_test(|a| assignment2(a, false, true)); + run_test(|a| assignment2(a, true, false)); + run_test(|a| assignment2(a, true, true)); + + run_test(|a| assignment1(a, false)); + run_test(|a| assignment1(a, true)); + + run_test(|a| array_simple(a)); + run_test(|a| vec_simple(a)); + run_test(|a| vec_unreachable(a)); + + run_test(|a| struct_dynamic_drop(a, false, false, false)); + run_test(|a| struct_dynamic_drop(a, false, false, true)); + run_test(|a| struct_dynamic_drop(a, false, true, false)); + run_test(|a| struct_dynamic_drop(a, false, true, true)); + run_test(|a| struct_dynamic_drop(a, true, false, false)); + run_test(|a| struct_dynamic_drop(a, true, false, true)); + run_test(|a| struct_dynamic_drop(a, true, true, false)); + run_test(|a| struct_dynamic_drop(a, true, true, true)); + + run_test(|a| field_assignment(a, false)); + run_test(|a| field_assignment(a, true)); + + run_test(|a| generator(a, 0)); + run_test(|a| generator(a, 1)); + run_test(|a| generator(a, 2)); + run_test(|a| generator(a, 3)); + + run_test(|a| mixed_drop_and_nondrop(a)); + + run_test(|a| slice_pattern_first(a)); + run_test(|a| slice_pattern_middle(a)); + run_test(|a| slice_pattern_two(a)); + run_test(|a| slice_pattern_last(a)); + run_test(|a| slice_pattern_one_of(a, 0)); + run_test(|a| slice_pattern_one_of(a, 1)); + run_test(|a| slice_pattern_one_of(a, 2)); + run_test(|a| slice_pattern_one_of(a, 3)); + + run_test(|a| subslice_pattern_from_end(a, true)); + run_test(|a| subslice_pattern_from_end(a, false)); + run_test(|a| subslice_pattern_from_end_with_drop(a, true, true)); + run_test(|a| subslice_pattern_from_end_with_drop(a, true, false)); + run_test(|a| subslice_pattern_from_end_with_drop(a, false, true)); + run_test(|a| subslice_pattern_from_end_with_drop(a, false, false)); + run_test(|a| slice_pattern_reassign(a)); + run_test(|a| subslice_pattern_reassign(a)); + + run_test_nopanic(|a| union1(a)); +} diff --git a/src/test/run-pass/drop/no-drop-flag-size.rs b/src/test/run-pass/drop/no-drop-flag-size.rs new file mode 100644 index 00000000000..abaaf7d701e --- /dev/null +++ b/src/test/run-pass/drop/no-drop-flag-size.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem::size_of; + +struct Test { + a: T +} + +impl Drop for Test { + fn drop(&mut self) { } +} + +pub fn main() { + assert_eq!(size_of::(), size_of::>()); +} diff --git a/src/test/run-pass/drop/nondrop-cycle.rs b/src/test/run-pass/drop/nondrop-cycle.rs new file mode 100644 index 00000000000..7e2bb38f5bd --- /dev/null +++ b/src/test/run-pass/drop/nondrop-cycle.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::cell::Cell; + +struct C<'a> { + p: Cell>>, +} + +impl<'a> C<'a> { + fn new() -> C<'a> { C { p: Cell::new(None) } } +} + +fn f1() { + let (c1, c2) = (C::new(), C::new()); + c1.p.set(Some(&c2)); + c2.p.set(Some(&c1)); +} + +fn f2() { + let (c1, c2); + c1 = C::new(); + c2 = C::new(); + c1.p.set(Some(&c2)); + c2.p.set(Some(&c1)); +} + +fn main() { + f1(); + f2(); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs new file mode 100644 index 00000000000..affc569c63d --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-custom.rs @@ -0,0 +1,53 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a very simple custom DST coercion. + +#![feature(unsize, coerce_unsized)] + +use std::ops::CoerceUnsized; +use std::marker::Unsize; + +struct Bar { + x: *const T, +} + +impl, U: ?Sized> CoerceUnsized> for Bar {} + +trait Baz { + fn get(&self) -> i32; +} + +impl Baz for i32 { + fn get(&self) -> i32 { + *self + } +} + +fn main() { + // Arrays. + let a: Bar<[i32; 3]> = Bar { x: &[1, 2, 3] }; + // This is the actual coercion. + let b: Bar<[i32]> = a; + + unsafe { + assert_eq!((*b.x)[0], 1); + assert_eq!((*b.x)[1], 2); + assert_eq!((*b.x)[2], 3); + } + + // Trait objects. + let a: Bar = Bar { x: &42 }; + let b: Bar = a; + unsafe { + assert_eq!((*b.x).get(), 42); + } +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs new file mode 100644 index 00000000000..fb7b2bc8bf7 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +// Test a very simple custom DST coercion. + +#![feature(core, rc_weak)] + +use std::cell::RefCell; +use std::rc::{Rc, Weak}; + +trait Baz { + fn get(&self) -> i32; +} + +impl Baz for i32 { + fn get(&self) -> i32 { + *self + } +} + +fn main() { + let a: Rc<[i32; 3]> = Rc::new([1, 2, 3]); + let b: Rc<[i32]> = a; + assert_eq!(b[0], 1); + assert_eq!(b[1], 2); + assert_eq!(b[2], 3); + + let a: Rc = Rc::new(42); + let b: Rc = a.clone(); + assert_eq!(b.get(), 42); + + let c: Weak = Rc::downgrade(&a); + let d: Weak = c.clone(); + + let _c = b.clone(); + + let a: Rc> = Rc::new(RefCell::new(42)); + let b: Rc> = a.clone(); + assert_eq!(b.borrow().get(), 42); + // FIXME + let c: Weak> = Rc::downgrade(&a) as Weak<_>; +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs new file mode 100644 index 00000000000..21170403d43 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test coercions involving DST and/or raw pointers + +// pretty-expanded FIXME #23616 + +struct S; +trait T { fn dummy(&self) { } } +impl T for S {} + +pub fn main() { + let x: &T = &S; + // Test we can convert from &-ptr to *-ptr of trait objects + let x: *const T = &S; + + // Test we can convert from &-ptr to *-ptr of struct pointer (not DST) + let x: *const S = &S; + + // As above, but mut + let x: &mut T = &mut S; + let x: *mut T = &mut S; + + let x: *mut S = &mut S; + + // Test we can change the mutability from mut to const. + let x: &T = &mut S; + let x: *const T = &mut S; +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs b/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs new file mode 100644 index 00000000000..a2c0a8c9beb --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-deref-mut.rs @@ -0,0 +1,45 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a custom deref with a fat pointer return type does not ICE + + +use std::ops::{Deref, DerefMut}; + +pub struct Arr { + ptr: Box<[usize]> +} + +impl Deref for Arr { + type Target = [usize]; + + fn deref(&self) -> &[usize] { + panic!(); + } +} + +impl DerefMut for Arr { + fn deref_mut(&mut self) -> &mut [usize] { + &mut *self.ptr + } +} + +pub fn foo(arr: &mut Arr) { + let x: &mut [usize] = &mut **arr; + assert_eq!(x[0], 1); + assert_eq!(x[1], 2); + assert_eq!(x[2], 3); +} + +fn main() { + let mut a = Arr { ptr: Box::new([1, 2, 3]) }; + foo(&mut a); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-deref.rs b/src/test/run-pass/dynamically-sized-types/dst-deref.rs new file mode 100644 index 00000000000..db9ef399f0e --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-deref.rs @@ -0,0 +1,40 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a custom deref with a fat pointer return type does not ICE + + +use std::ops::Deref; + +pub struct Arr { + ptr: Box<[usize]> +} + +impl Deref for Arr { + type Target = [usize]; + + fn deref(&self) -> &[usize] { + &*self.ptr + } +} + +pub fn foo(arr: &Arr) { + assert_eq!(arr.len(), 3); + let x: &[usize] = &**arr; + assert_eq!(x[0], 1); + assert_eq!(x[1], 2); + assert_eq!(x[2], 3); +} + +fn main() { + let a = Arr { ptr: Box::new([1, 2, 3]) }; + foo(&a); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs new file mode 100644 index 00000000000..1537050593c --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs @@ -0,0 +1,76 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + a: u16, + b: T +} + +trait Bar { + fn get(&self) -> usize; +} + +impl Bar for usize { + fn get(&self) -> usize { *self } +} + +struct Baz { + a: T +} + +struct HasDrop { + ptr: Box, + data: T +} + +fn main() { + // Test that zero-offset works properly + let b : Baz = Baz { a: 7 }; + assert_eq!(b.a.get(), 7); + let b : &Baz = &b; + assert_eq!(b.a.get(), 7); + + // Test that the field is aligned properly + let f : Foo = Foo { a: 0, b: 11 }; + assert_eq!(f.b.get(), 11); + let ptr1 : *const u8 = &f.b as *const _ as *const u8; + + let f : &Foo = &f; + let ptr2 : *const u8 = &f.b as *const _ as *const u8; + assert_eq!(f.b.get(), 11); + + // The pointers should be the same + assert_eq!(ptr1, ptr2); + + // Test that nested DSTs work properly + let f : Foo> = Foo { a: 0, b: Foo { a: 1, b: 17 }}; + assert_eq!(f.b.b.get(), 17); + let f : &Foo> = &f; + assert_eq!(f.b.b.get(), 17); + + // Test that get the pointer via destructuring works + + let f : Foo = Foo { a: 0, b: 11 }; + let f : &Foo = &f; + let &Foo { a: _, b: ref bar } = f; + assert_eq!(bar.get(), 11); + + // Make sure that drop flags don't screw things up + + let d : HasDrop> = HasDrop { + ptr: Box::new(0), + data: Baz { a: [1,2,3,4] } + }; + assert_eq!([1,2,3,4], d.data.a); + + let d : &HasDrop> = &d; + assert_eq!(&[1,2,3,4], &d.data.a); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-index.rs b/src/test/run-pass/dynamically-sized-types/dst-index.rs new file mode 100644 index 00000000000..56323816b4c --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-index.rs @@ -0,0 +1,43 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that overloaded index expressions with DST result types +// work and don't ICE. + +use std::ops::Index; +use std::fmt::Debug; + +struct S; + +impl Index for S { + type Output = str; + + fn index<'a>(&'a self, _: usize) -> &'a str { + "hello" + } +} + +struct T; + +impl Index for T { + type Output = Debug + 'static; + + fn index<'a>(&'a self, idx: usize) -> &'a (Debug + 'static) { + static X: usize = 42; + &X as &(Debug + 'static) + } +} + +fn main() { + assert_eq!(&S[0], "hello"); + &T[0]; + // let x = &x as &Debug; +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs b/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs new file mode 100644 index 00000000000..031aa7c04e6 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(unsized_tuple_coercion)] + +struct Test(T); + +fn main() { + let x = Test([1,2,3]); + let x : &Test<[i32]> = &x; + + let & ref _y = x; + + // Make sure binding to a fat pointer behind a reference + // still works + let slice = &[1,2,3]; + let x = Test(&slice); + let Test(&_slice) = x; + + + let x = (10, [1,2,3]); + let x : &(i32, [i32]) = &x; + + let & ref _y = x; + + let slice = &[1,2,3]; + let x = (10, &slice); + let (_, &_slice) = x; +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-raw.rs b/src/test/run-pass/dynamically-sized-types/dst-raw.rs new file mode 100644 index 00000000000..96b19b9e4d9 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-raw.rs @@ -0,0 +1,148 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test DST raw pointers + + +#![feature(unsized_tuple_coercion)] + +trait Trait { + fn foo(&self) -> isize; +} + +struct A { + f: isize +} +impl Trait for A { + fn foo(&self) -> isize { + self.f + } +} + +struct Foo { + f: T +} + +pub fn main() { + // raw trait object + let x = A { f: 42 }; + let z: *const Trait = &x; + let r = unsafe { + (&*z).foo() + }; + assert_eq!(r, 42); + + // raw DST struct + let p = Foo {f: A { f: 42 }}; + let o: *const Foo = &p; + let r = unsafe { + (&*o).f.foo() + }; + assert_eq!(r, 42); + + // raw DST tuple + let p = (A { f: 42 },); + let o: *const (Trait,) = &p; + let r = unsafe { + (&*o).0.foo() + }; + assert_eq!(r, 42); + + // raw slice + let a: *const [_] = &[1, 2, 3]; + unsafe { + let b = (*a)[2]; + assert_eq!(b, 3); + let len = (*a).len(); + assert_eq!(len, 3); + } + + // raw slice with explicit cast + let a = &[1, 2, 3] as *const [i32]; + unsafe { + let b = (*a)[2]; + assert_eq!(b, 3); + let len = (*a).len(); + assert_eq!(len, 3); + } + + // raw DST struct with slice + let c: *const Foo<[_]> = &Foo {f: [1, 2, 3]}; + unsafe { + let b = (&*c).f[0]; + assert_eq!(b, 1); + let len = (&*c).f.len(); + assert_eq!(len, 3); + } + + // raw DST tuple with slice + let c: *const ([_],) = &([1, 2, 3],); + unsafe { + let b = (&*c).0[0]; + assert_eq!(b, 1); + let len = (&*c).0.len(); + assert_eq!(len, 3); + } + + // all of the above with *mut + let mut x = A { f: 42 }; + let z: *mut Trait = &mut x; + let r = unsafe { + (&*z).foo() + }; + assert_eq!(r, 42); + + let mut p = Foo {f: A { f: 42 }}; + let o: *mut Foo = &mut p; + let r = unsafe { + (&*o).f.foo() + }; + assert_eq!(r, 42); + + let mut p = (A { f: 42 },); + let o: *mut (Trait,) = &mut p; + let r = unsafe { + (&*o).0.foo() + }; + assert_eq!(r, 42); + + let a: *mut [_] = &mut [1, 2, 3]; + unsafe { + let b = (*a)[2]; + assert_eq!(b, 3); + let len = (*a).len(); + assert_eq!(len, 3); + } + + let a = &mut [1, 2, 3] as *mut [i32]; + unsafe { + let b = (*a)[2]; + assert_eq!(b, 3); + let len = (*a).len(); + assert_eq!(len, 3); + } + + let c: *mut Foo<[_]> = &mut Foo {f: [1, 2, 3]}; + unsafe { + let b = (&*c).f[0]; + assert_eq!(b, 1); + let len = (&*c).f.len(); + assert_eq!(len, 3); + } + + let c: *mut ([_],) = &mut ([1, 2, 3],); + unsafe { + let b = (&*c).0[0]; + assert_eq!(b, 1); + let len = (&*c).0.len(); + assert_eq!(len, 3); + } +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs b/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs new file mode 100644 index 00000000000..9959b5bf5bb --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-struct-sole.rs @@ -0,0 +1,86 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// As dst-struct.rs, but the unsized field is the only field in the struct. + + +struct Fat { + ptr: T +} + +// x is a fat pointer +fn foo(x: &Fat<[isize]>) { + let y = &x.ptr; + assert_eq!(x.ptr.len(), 3); + assert_eq!(y[0], 1); + assert_eq!(x.ptr[1], 2); +} + +fn foo2(x: &Fat<[T]>) { + let y = &x.ptr; + let bar = Bar; + assert_eq!(x.ptr.len(), 3); + assert_eq!(y[0].to_bar(), bar); + assert_eq!(x.ptr[1].to_bar(), bar); +} + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +struct Bar; + +trait ToBar { + fn to_bar(&self) -> Bar; +} + +impl ToBar for Bar { + fn to_bar(&self) -> Bar { + *self + } +} + +pub fn main() { + // With a vec of ints. + let f1 = Fat { ptr: [1, 2, 3] }; + foo(&f1); + let f2 = &f1; + foo(f2); + let f3: &Fat<[isize]> = f2; + foo(f3); + let f4: &Fat<[isize]> = &f1; + foo(f4); + let f5: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; + foo(f5); + + // With a vec of Bars. + let bar = Bar; + let f1 = Fat { ptr: [bar, bar, bar] }; + foo2(&f1); + let f2 = &f1; + foo2(f2); + let f3: &Fat<[Bar]> = f2; + foo2(f3); + let f4: &Fat<[Bar]> = &f1; + foo2(f4); + let f5: &Fat<[Bar]> = &Fat { ptr: [bar, bar, bar] }; + foo2(f5); + + // Assignment. + let f5: &mut Fat<[isize]> = &mut Fat { ptr: [1, 2, 3] }; + f5.ptr[1] = 34; + assert_eq!(f5.ptr[0], 1); + assert_eq!(f5.ptr[1], 34); + assert_eq!(f5.ptr[2], 3); + + // Zero size vec. + let f5: &Fat<[isize]> = &Fat { ptr: [] }; + assert!(f5.ptr.is_empty()); + let f5: &Fat<[Bar]> = &Fat { ptr: [] }; + assert!(f5.ptr.is_empty()); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-struct.rs b/src/test/run-pass/dynamically-sized-types/dst-struct.rs new file mode 100644 index 00000000000..1853c6a04d8 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-struct.rs @@ -0,0 +1,132 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Fat { + f1: isize, + f2: &'static str, + ptr: T +} + +// x is a fat pointer +fn foo(x: &Fat<[isize]>) { + let y = &x.ptr; + assert_eq!(x.ptr.len(), 3); + assert_eq!(y[0], 1); + assert_eq!(x.ptr[1], 2); + assert_eq!(x.f1, 5); + assert_eq!(x.f2, "some str"); +} + +fn foo2(x: &Fat<[T]>) { + let y = &x.ptr; + let bar = Bar; + assert_eq!(x.ptr.len(), 3); + assert_eq!(y[0].to_bar(), bar); + assert_eq!(x.ptr[1].to_bar(), bar); + assert_eq!(x.f1, 5); + assert_eq!(x.f2, "some str"); +} + +fn foo3(x: &Fat>) { + let y = &x.ptr.ptr; + assert_eq!(x.f1, 5); + assert_eq!(x.f2, "some str"); + assert_eq!(x.ptr.f1, 8); + assert_eq!(x.ptr.f2, "deep str"); + assert_eq!(x.ptr.ptr.len(), 3); + assert_eq!(y[0], 1); + assert_eq!(x.ptr.ptr[1], 2); +} + + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +struct Bar; + +trait ToBar { + fn to_bar(&self) -> Bar; +} + +impl ToBar for Bar { + fn to_bar(&self) -> Bar { + *self + } +} + +pub fn main() { + // With a vec of ints. + let f1 = Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + foo(&f1); + let f2 = &f1; + foo(f2); + let f3: &Fat<[isize]> = f2; + foo(f3); + let f4: &Fat<[isize]> = &f1; + foo(f4); + let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + foo(f5); + + // With a vec of Bars. + let bar = Bar; + let f1 = Fat { f1: 5, f2: "some str", ptr: [bar, bar, bar] }; + foo2(&f1); + let f2 = &f1; + foo2(f2); + let f3: &Fat<[Bar]> = f2; + foo2(f3); + let f4: &Fat<[Bar]> = &f1; + foo2(f4); + let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [bar, bar, bar] }; + foo2(f5); + + // Assignment. + let f5: &mut Fat<[isize]> = &mut Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + f5.ptr[1] = 34; + assert_eq!(f5.ptr[0], 1); + assert_eq!(f5.ptr[1], 34); + assert_eq!(f5.ptr[2], 3); + + // Zero size vec. + let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [] }; + assert!(f5.ptr.is_empty()); + let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [] }; + assert!(f5.ptr.is_empty()); + + // Deeply nested. + let f1 = Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} }; + foo3(&f1); + let f2 = &f1; + foo3(f2); + let f3: &Fat> = f2; + foo3(f3); + let f4: &Fat> = &f1; + foo3(f4); + let f5: &Fat> = + &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} }; + foo3(f5); + + // Box. + let f1 = Box::new([1, 2, 3]); + assert_eq!((*f1)[1], 2); + let f2: Box<[isize]> = f1; + assert_eq!((*f2)[1], 2); + + // Nested Box. + let f1 : Box> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; + foo(&*f1); + let f2 : Box> = f1; + foo(&*f2); + + let f3 : Box> = + Box::>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); + foo(&*f3); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs b/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs new file mode 100644 index 00000000000..4083f0e2b09 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-trait-tuple.rs @@ -0,0 +1,113 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(type_alias_bounds)] + +#![allow(unused_features)] +#![feature(box_syntax)] +#![feature(unsized_tuple_coercion)] + +type Fat = (isize, &'static str, T); + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +struct Bar; + +#[derive(Copy, Clone, PartialEq, Eq)] +struct Bar1 { + f: isize +} + +trait ToBar { + fn to_bar(&self) -> Bar; + fn to_val(&self) -> isize; +} + +impl ToBar for Bar { + fn to_bar(&self) -> Bar { + *self + } + fn to_val(&self) -> isize { + 0 + } +} +impl ToBar for Bar1 { + fn to_bar(&self) -> Bar { + Bar + } + fn to_val(&self) -> isize { + self.f + } +} + +// x is a fat pointer +fn foo(x: &Fat) { + assert_eq!(x.0, 5); + assert_eq!(x.1, "some str"); + assert_eq!(x.2.to_bar(), Bar); + assert_eq!(x.2.to_val(), 42); + + let y = &x.2; + assert_eq!(y.to_bar(), Bar); + assert_eq!(y.to_val(), 42); +} + +fn bar(x: &ToBar) { + assert_eq!(x.to_bar(), Bar); + assert_eq!(x.to_val(), 42); +} + +fn baz(x: &Fat>) { + assert_eq!(x.0, 5); + assert_eq!(x.1, "some str"); + assert_eq!((x.2).0, 8); + assert_eq!((x.2).1, "deep str"); + assert_eq!((x.2).2.to_bar(), Bar); + assert_eq!((x.2).2.to_val(), 42); + + let y = &(x.2).2; + assert_eq!(y.to_bar(), Bar); + assert_eq!(y.to_val(), 42); + +} + +pub fn main() { + let f1 = (5, "some str", Bar1 {f :42}); + foo(&f1); + let f2 = &f1; + foo(f2); + let f3: &Fat = f2; + foo(f3); + let f4: &Fat = &f1; + foo(f4); + let f5: &Fat = &(5, "some str", Bar1 {f :42}); + foo(f5); + + // Zero size object. + let f6: &Fat = &(5, "some str", Bar); + assert_eq!(f6.2.to_bar(), Bar); + + // &* + // + let f7: Box = Box::new(Bar1 {f :42}); + bar(&*f7); + + // Deep nesting + let f1 = (5, "some str", (8, "deep str", Bar1 {f :42})); + baz(&f1); + let f2 = &f1; + baz(f2); + let f3: &Fat> = f2; + baz(f3); + let f4: &Fat> = &f1; + baz(f4); + let f5: &Fat> = &(5, "some str", (8, "deep str", Bar1 {f :42})); + baz(f5); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-trait.rs b/src/test/run-pass/dynamically-sized-types/dst-trait.rs new file mode 100644 index 00000000000..3ce2cffbe09 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-trait.rs @@ -0,0 +1,115 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Fat { + f1: isize, + f2: &'static str, + ptr: T +} + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +struct Bar; + +#[derive(Copy, Clone, PartialEq, Eq)] +struct Bar1 { + f: isize +} + +trait ToBar { + fn to_bar(&self) -> Bar; + fn to_val(&self) -> isize; +} + +impl ToBar for Bar { + fn to_bar(&self) -> Bar { + *self + } + fn to_val(&self) -> isize { + 0 + } +} +impl ToBar for Bar1 { + fn to_bar(&self) -> Bar { + Bar + } + fn to_val(&self) -> isize { + self.f + } +} + +// x is a fat pointer +fn foo(x: &Fat) { + assert_eq!(x.f1, 5); + assert_eq!(x.f2, "some str"); + assert_eq!(x.ptr.to_bar(), Bar); + assert_eq!(x.ptr.to_val(), 42); + + let y = &x.ptr; + assert_eq!(y.to_bar(), Bar); + assert_eq!(y.to_val(), 42); +} + +fn bar(x: &ToBar) { + assert_eq!(x.to_bar(), Bar); + assert_eq!(x.to_val(), 42); +} + +fn baz(x: &Fat>) { + assert_eq!(x.f1, 5); + assert_eq!(x.f2, "some str"); + assert_eq!(x.ptr.f1, 8); + assert_eq!(x.ptr.f2, "deep str"); + assert_eq!(x.ptr.ptr.to_bar(), Bar); + assert_eq!(x.ptr.ptr.to_val(), 42); + + let y = &x.ptr.ptr; + assert_eq!(y.to_bar(), Bar); + assert_eq!(y.to_val(), 42); + +} + +pub fn main() { + let f1 = Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + foo(&f1); + let f2 = &f1; + foo(f2); + let f3: &Fat = f2; + foo(f3); + let f4: &Fat = &f1; + foo(f4); + let f5: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; + foo(f5); + + // Zero size object. + let f6: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar }; + assert_eq!(f6.ptr.to_bar(), Bar); + + // &* + // + let f7: Box = Box::new(Bar1 {f :42}); + bar(&*f7); + + // Deep nesting + let f1 = + Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: Bar1 {f :42}} }; + baz(&f1); + let f2 = &f1; + baz(f2); + let f3: &Fat> = f2; + baz(f3); + let f4: &Fat> = &f1; + baz(f4); + let f5: &Fat> = + &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: Bar1 {f :42}} }; + baz(f5); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs b/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs new file mode 100644 index 00000000000..43a1bacec31 --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-tuple-sole.rs @@ -0,0 +1,89 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +#![allow(type_alias_bounds)] + +// As dst-tuple.rs, but the unsized field is the only field in the tuple. + + +#![feature(unsized_tuple_coercion)] + +type Fat = (T,); + +// x is a fat pointer +fn foo(x: &Fat<[isize]>) { + let y = &x.0; + assert_eq!(x.0.len(), 3); + assert_eq!(y[0], 1); + assert_eq!(x.0[1], 2); +} + +fn foo2(x: &Fat<[T]>) { + let y = &x.0; + let bar = Bar; + assert_eq!(x.0.len(), 3); + assert_eq!(y[0].to_bar(), bar); + assert_eq!(x.0[1].to_bar(), bar); +} + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +struct Bar; + +trait ToBar { + fn to_bar(&self) -> Bar; +} + +impl ToBar for Bar { + fn to_bar(&self) -> Bar { + *self + } +} + +pub fn main() { + // With a vec of ints. + let f1 = ([1, 2, 3],); + foo(&f1); + let f2 = &f1; + foo(f2); + let f3: &Fat<[isize]> = f2; + foo(f3); + let f4: &Fat<[isize]> = &f1; + foo(f4); + let f5: &Fat<[isize]> = &([1, 2, 3],); + foo(f5); + + // With a vec of Bars. + let bar = Bar; + let f1 = ([bar, bar, bar],); + foo2(&f1); + let f2 = &f1; + foo2(f2); + let f3: &Fat<[Bar]> = f2; + foo2(f3); + let f4: &Fat<[Bar]> = &f1; + foo2(f4); + let f5: &Fat<[Bar]> = &([bar, bar, bar],); + foo2(f5); + + // Assignment. + let f5: &mut Fat<[isize]> = &mut ([1, 2, 3],); + f5.0[1] = 34; + assert_eq!(f5.0[0], 1); + assert_eq!(f5.0[1], 34); + assert_eq!(f5.0[2], 3); + + // Zero size vec. + let f5: &Fat<[isize]> = &([],); + assert!(f5.0.is_empty()); + let f5: &Fat<[Bar]> = &([],); + assert!(f5.0.is_empty()); +} diff --git a/src/test/run-pass/dynamically-sized-types/dst-tuple.rs b/src/test/run-pass/dynamically-sized-types/dst-tuple.rs new file mode 100644 index 00000000000..753203d250d --- /dev/null +++ b/src/test/run-pass/dynamically-sized-types/dst-tuple.rs @@ -0,0 +1,130 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(type_alias_bounds)] + +#![feature(box_syntax)] +#![feature(unsized_tuple_coercion)] + +type Fat = (isize, &'static str, T); + +// x is a fat pointer +fn foo(x: &Fat<[isize]>) { + let y = &x.2; + assert_eq!(x.2.len(), 3); + assert_eq!(y[0], 1); + assert_eq!(x.2[1], 2); + assert_eq!(x.0, 5); + assert_eq!(x.1, "some str"); +} + +fn foo2(x: &Fat<[T]>) { + let y = &x.2; + let bar = Bar; + assert_eq!(x.2.len(), 3); + assert_eq!(y[0].to_bar(), bar); + assert_eq!(x.2[1].to_bar(), bar); + assert_eq!(x.0, 5); + assert_eq!(x.1, "some str"); +} + +fn foo3(x: &Fat>) { + let y = &(x.2).2; + assert_eq!(x.0, 5); + assert_eq!(x.1, "some str"); + assert_eq!((x.2).0, 8); + assert_eq!((x.2).1, "deep str"); + assert_eq!((x.2).2.len(), 3); + assert_eq!(y[0], 1); + assert_eq!((x.2).2[1], 2); +} + + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +struct Bar; + +trait ToBar { + fn to_bar(&self) -> Bar; +} + +impl ToBar for Bar { + fn to_bar(&self) -> Bar { + *self + } +} + +pub fn main() { + // With a vec of ints. + let f1 = (5, "some str", [1, 2, 3]); + foo(&f1); + let f2 = &f1; + foo(f2); + let f3: &Fat<[isize]> = f2; + foo(f3); + let f4: &Fat<[isize]> = &f1; + foo(f4); + let f5: &Fat<[isize]> = &(5, "some str", [1, 2, 3]); + foo(f5); + + // With a vec of Bars. + let bar = Bar; + let f1 = (5, "some str", [bar, bar, bar]); + foo2(&f1); + let f2 = &f1; + foo2(f2); + let f3: &Fat<[Bar]> = f2; + foo2(f3); + let f4: &Fat<[Bar]> = &f1; + foo2(f4); + let f5: &Fat<[Bar]> = &(5, "some str", [bar, bar, bar]); + foo2(f5); + + // Assignment. + let f5: &mut Fat<[isize]> = &mut (5, "some str", [1, 2, 3]); + f5.2[1] = 34; + assert_eq!(f5.2[0], 1); + assert_eq!(f5.2[1], 34); + assert_eq!(f5.2[2], 3); + + // Zero size vec. + let f5: &Fat<[isize]> = &(5, "some str", []); + assert!(f5.2.is_empty()); + let f5: &Fat<[Bar]> = &(5, "some str", []); + assert!(f5.2.is_empty()); + + // Deeply nested. + let f1 = (5, "some str", (8, "deep str", [1, 2, 3])); + foo3(&f1); + let f2 = &f1; + foo3(f2); + let f3: &Fat> = f2; + foo3(f3); + let f4: &Fat> = &f1; + foo3(f4); + let f5: &Fat> = &(5, "some str", (8, "deep str", [1, 2, 3])); + foo3(f5); + + // Box. + let f1 = Box::new([1, 2, 3]); + assert_eq!((*f1)[1], 2); + let f2: Box<[isize]> = f1; + assert_eq!((*f2)[1], 2); + + // Nested Box. + let f1 : Box> = box (5, "some str", [1, 2, 3]); + foo(&*f1); + let f2 : Box> = f1; + foo(&*f2); + + let f3 : Box> = + Box::>::new((5, "some str", [1, 2, 3])); + foo(&*f3); +} diff --git a/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs b/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs new file mode 100644 index 00000000000..150dffeea88 --- /dev/null +++ b/src/test/run-pass/extern/auxiliary/extern-crosscrate-source.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="externcallback"] +#![crate_type = "lib"] +#![feature(libc)] + +extern crate libc; + +pub mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, + data: libc::uintptr_t) + -> libc::uintptr_t; + } +} + +pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t { + unsafe { + println!("n = {}", n); + rustrt::rust_dbg_call(cb, n) + } +} + +pub extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { + if data == 1 { + data + } else { + fact(data - 1) * data + } +} diff --git a/src/test/run-pass/extern/auxiliary/extern-take-value.rs b/src/test/run-pass/extern/auxiliary/extern-take-value.rs new file mode 100644 index 00000000000..500c455136b --- /dev/null +++ b/src/test/run-pass/extern/auxiliary/extern-take-value.rs @@ -0,0 +1,15 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub extern fn f() -> i32 { 1 } +pub extern fn g() -> i32 { 2 } + +pub fn get_f() -> extern fn() -> i32 { f } +pub fn get_g() -> extern fn() -> i32 { g } diff --git a/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs b/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs new file mode 100644 index 00000000000..55a4226c663 --- /dev/null +++ b/src/test/run-pass/extern/auxiliary/extern_calling_convention.rs @@ -0,0 +1,36 @@ +// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Make sure Rust generates the correct calling convention for extern +// functions. + +#[inline(never)] +#[cfg(target_arch = "x86_64")] +pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + assert_eq!(d, 4); + + println!("a: {}, b: {}, c: {}, d: {}", + a, b, c, d) +} + +#[inline(never)] +#[cfg(not(target_arch = "x86_64"))] +pub extern fn foo(a: isize, b: isize, c: isize, d: isize) { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + assert_eq!(d, 4); + + println!("a: {}, b: {}, c: {}, d: {}", + a, b, c, d) +} diff --git a/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs b/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs new file mode 100644 index 00000000000..0fb6adfcda1 --- /dev/null +++ b/src/test/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub mod extern_mod_ordering_lib { + pub fn f() {} +} diff --git a/src/test/run-pass/extern/auxiliary/fat_drop.rs b/src/test/run-pass/extern/auxiliary/fat_drop.rs new file mode 100644 index 00000000000..1f944b6ed32 --- /dev/null +++ b/src/test/run-pass/extern/auxiliary/fat_drop.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub static mut DROPPED: bool = false; + +pub struct S { + _unsized: [u8] +} + +impl Drop for S { + fn drop(&mut self) { + unsafe { + DROPPED = true; + } + } +} diff --git a/src/test/run-pass/extern/extern-1.rs b/src/test/run-pass/extern/extern-1.rs new file mode 100644 index 00000000000..c3168aaf869 --- /dev/null +++ b/src/test/run-pass/extern/extern-1.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern fn f() { +} + +pub fn main() { +} diff --git a/src/test/run-pass/extern/extern-call-deep.rs b/src/test/run-pass/extern/extern-call-deep.rs new file mode 100644 index 00000000000..6e8d94becbd --- /dev/null +++ b/src/test/run-pass/extern/extern-call-deep.rs @@ -0,0 +1,48 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +extern crate libc; + +mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, + data: libc::uintptr_t) + -> libc::uintptr_t; + } +} + +extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { + if data == 1 { + data + } else { + count(data - 1) + 1 + } +} + +fn count(n: libc::uintptr_t) -> libc::uintptr_t { + unsafe { + println!("n = {}", n); + rustrt::rust_dbg_call(cb, n) + } +} + +pub fn main() { + let result = count(1000); + println!("result = {}", result); + assert_eq!(result, 1000); +} diff --git a/src/test/run-pass/extern/extern-call-deep2.rs b/src/test/run-pass/extern/extern-call-deep2.rs new file mode 100644 index 00000000000..e11e73a2b0f --- /dev/null +++ b/src/test/run-pass/extern/extern-call-deep2.rs @@ -0,0 +1,53 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(libc)] + +extern crate libc; +use std::thread; + +mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, + data: libc::uintptr_t) + -> libc::uintptr_t; + } +} + +extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { + if data == 1 { + data + } else { + count(data - 1) + 1 + } +} + +fn count(n: libc::uintptr_t) -> libc::uintptr_t { + unsafe { + println!("n = {}", n); + rustrt::rust_dbg_call(cb, n) + } +} + +pub fn main() { + // Make sure we're on a thread with small Rust stacks (main currently + // has a large stack) + thread::spawn(move|| { + let result = count(1000); + println!("result = {}", result); + assert_eq!(result, 1000); + }).join(); +} diff --git a/src/test/run-pass/extern/extern-call-direct.rs b/src/test/run-pass/extern/extern-call-direct.rs new file mode 100644 index 00000000000..55300a44c1b --- /dev/null +++ b/src/test/run-pass/extern/extern-call-direct.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test direct calls to extern fns. + + +extern fn f(x: usize) -> usize { x * 2 } + +pub fn main() { + let x = f(22); + assert_eq!(x, 44); +} diff --git a/src/test/run-pass/extern/extern-call-indirect.rs b/src/test/run-pass/extern/extern-call-indirect.rs new file mode 100644 index 00000000000..1badb10364e --- /dev/null +++ b/src/test/run-pass/extern/extern-call-indirect.rs @@ -0,0 +1,48 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +extern crate libc; + +mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, + data: libc::uintptr_t) + -> libc::uintptr_t; + } +} + +extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { + if data == 1 { + data + } else { + fact(data - 1) * data + } +} + +fn fact(n: libc::uintptr_t) -> libc::uintptr_t { + unsafe { + println!("n = {}", n); + rustrt::rust_dbg_call(cb, n) + } +} + +pub fn main() { + let result = fact(10); + println!("result = {}", result); + assert_eq!(result, 3628800); +} diff --git a/src/test/run-pass/extern/extern-call-scrub.rs b/src/test/run-pass/extern/extern-call-scrub.rs new file mode 100644 index 00000000000..1e564e66871 --- /dev/null +++ b/src/test/run-pass/extern/extern-call-scrub.rs @@ -0,0 +1,57 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This time we're testing repeatedly going up and down both stacks to +// make sure the stack pointers are maintained properly in both +// directions + +// ignore-emscripten no threads support + +#![feature(libc)] + +extern crate libc; +use std::thread; + +mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, + data: libc::uintptr_t) + -> libc::uintptr_t; + } +} + +extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { + if data == 1 { + data + } else { + count(data - 1) + count(data - 1) + } +} + +fn count(n: libc::uintptr_t) -> libc::uintptr_t { + unsafe { + println!("n = {}", n); + rustrt::rust_dbg_call(cb, n) + } +} + +pub fn main() { + // Make sure we're on a thread with small Rust stacks (main currently + // has a large stack) + thread::spawn(move|| { + let result = count(12); + println!("result = {}", result); + assert_eq!(result, 2048); + }).join(); +} diff --git a/src/test/run-pass/extern/extern-calling-convention-test.rs b/src/test/run-pass/extern/extern-calling-convention-test.rs new file mode 100644 index 00000000000..ed1657db759 --- /dev/null +++ b/src/test/run-pass/extern/extern-calling-convention-test.rs @@ -0,0 +1,22 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:extern_calling_convention.rs + +// pretty-expanded FIXME #23616 + +extern crate extern_calling_convention; + +use extern_calling_convention::foo; + +pub fn main() { + foo(1, 2, 3, 4); +} diff --git a/src/test/run-pass/extern/extern-compare-with-return-type.rs b/src/test/run-pass/extern/extern-compare-with-return-type.rs new file mode 100644 index 00000000000..451b87f575a --- /dev/null +++ b/src/test/run-pass/extern/extern-compare-with-return-type.rs @@ -0,0 +1,35 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that we can compare various kinds of extern fn signatures. +#![allow(non_camel_case_types)] + +extern fn voidret1() {} +extern fn voidret2() {} + +extern fn uintret() -> usize { 22 } + +extern fn uintvoidret(_x: usize) {} + +extern fn uintuintuintuintret(x: usize, y: usize, z: usize) -> usize { x+y+z } +type uintuintuintuintret = extern fn(usize,usize,usize) -> usize; + +pub fn main() { + assert!(voidret1 as extern fn() == voidret1 as extern fn()); + assert!(voidret1 as extern fn() != voidret2 as extern fn()); + + assert!(uintret as extern fn() -> usize == uintret as extern fn() -> usize); + + assert!(uintvoidret as extern fn(usize) == uintvoidret as extern fn(usize)); + + assert!(uintuintuintuintret as uintuintuintuintret == + uintuintuintuintret as uintuintuintuintret); +} diff --git a/src/test/run-pass/extern/extern-crosscrate.rs b/src/test/run-pass/extern/extern-crosscrate.rs new file mode 100644 index 00000000000..c6fccbe003c --- /dev/null +++ b/src/test/run-pass/extern/extern-crosscrate.rs @@ -0,0 +1,31 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:extern-crosscrate-source.rs +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +extern crate externcallback; +extern crate libc; + +fn fact(n: libc::uintptr_t) -> libc::uintptr_t { + unsafe { + println!("n = {}", n); + externcallback::rustrt::rust_dbg_call(externcallback::cb, n) + } +} + +pub fn main() { + let result = fact(10); + println!("result = {}", result); + assert_eq!(result, 3628800); +} diff --git a/src/test/run-pass/extern/extern-foreign-crate.rs b/src/test/run-pass/extern/extern-foreign-crate.rs new file mode 100644 index 00000000000..615b07619c2 --- /dev/null +++ b/src/test/run-pass/extern/extern-foreign-crate.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern crate std as mystd; + +pub fn main() {} diff --git a/src/test/run-pass/extern/extern-methods.rs b/src/test/run-pass/extern/extern-methods.rs new file mode 100644 index 00000000000..872391612ad --- /dev/null +++ b/src/test/run-pass/extern/extern-methods.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-arm +// ignore-aarch64 + +trait A { + extern "fastcall" fn test1(i: i32); + extern fn test2(i: i32); +} + +struct S; +impl S { + extern "stdcall" fn test3(i: i32) { + assert_eq!(i, 3); + } +} + +impl A for S { + extern "fastcall" fn test1(i: i32) { + assert_eq!(i, 1); + } + extern fn test2(i: i32) { + assert_eq!(i, 2); + } +} + +fn main() { + ::test1(1); + ::test2(2); + S::test3(3); +} diff --git a/src/test/run-pass/extern/extern-mod-abi.rs b/src/test/run-pass/extern/extern-mod-abi.rs new file mode 100644 index 00000000000..fcff3ed251e --- /dev/null +++ b/src/test/run-pass/extern/extern-mod-abi.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern "C" { + fn pow(x: f64, y: f64) -> f64; +} + +pub fn main() {} diff --git a/src/test/run-pass/extern/extern-mod-ordering-exe.rs b/src/test/run-pass/extern/extern-mod-ordering-exe.rs new file mode 100644 index 00000000000..42b8791f921 --- /dev/null +++ b/src/test/run-pass/extern/extern-mod-ordering-exe.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:extern_mod_ordering_lib.rs + +// pretty-expanded FIXME #23616 + +extern crate extern_mod_ordering_lib; + +use extern_mod_ordering_lib::extern_mod_ordering_lib as the_lib; + +pub fn main() { + the_lib::f(); +} diff --git a/src/test/run-pass/extern/extern-pass-TwoU16s.rs b/src/test/run-pass/extern/extern-pass-TwoU16s.rs new file mode 100644 index 00000000000..042c27d0902 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-TwoU16s.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc for ffi testing + +// Test a foreign function that accepts and returns a struct +// by value. + +#[derive(Copy, Clone, PartialEq, Debug)] +pub struct TwoU16s { + one: u16, two: u16 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s; +} + +pub fn main() { + unsafe { + let x = TwoU16s {one: 22, two: 23}; + let y = rust_dbg_extern_identity_TwoU16s(x); + assert_eq!(x, y); + } +} diff --git a/src/test/run-pass/extern/extern-pass-TwoU32s.rs b/src/test/run-pass/extern/extern-pass-TwoU32s.rs new file mode 100644 index 00000000000..de1819a1fbd --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-TwoU32s.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc for ffi testing + +// Test a foreign function that accepts and returns a struct +// by value. + +#[derive(Copy, Clone, PartialEq, Debug)] +pub struct TwoU32s { + one: u32, two: u32 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s; +} + +pub fn main() { + unsafe { + let x = TwoU32s {one: 22, two: 23}; + let y = rust_dbg_extern_identity_TwoU32s(x); + assert_eq!(x, y); + } +} diff --git a/src/test/run-pass/extern/extern-pass-TwoU64s.rs b/src/test/run-pass/extern/extern-pass-TwoU64s.rs new file mode 100644 index 00000000000..5e4b3823b14 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-TwoU64s.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc for ffi testing + +// Test a foreign function that accepts and returns a struct +// by value. + +#[derive(Copy, Clone, PartialEq, Debug)] +pub struct TwoU64s { + one: u64, two: u64 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s; +} + +pub fn main() { + unsafe { + let x = TwoU64s {one: 22, two: 23}; + let y = rust_dbg_extern_identity_TwoU64s(x); + assert_eq!(x, y); + } +} diff --git a/src/test/run-pass/extern/extern-pass-TwoU8s.rs b/src/test/run-pass/extern/extern-pass-TwoU8s.rs new file mode 100644 index 00000000000..affcf62af70 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-TwoU8s.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc for ffi testing + +// Test a foreign function that accepts and returns a struct +// by value. + +#[derive(Copy, Clone, PartialEq, Debug)] +pub struct TwoU8s { + one: u8, two: u8 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s; +} + +pub fn main() { + unsafe { + let x = TwoU8s {one: 22, two: 23}; + let y = rust_dbg_extern_identity_TwoU8s(x); + assert_eq!(x, y); + } +} diff --git a/src/test/run-pass/extern/extern-pass-char.rs b/src/test/run-pass/extern/extern-pass-char.rs new file mode 100644 index 00000000000..95999b8d983 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-char.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc for ffi testing + +// Test a function that takes/returns a u8. + + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_u8(v: u8) -> u8; +} + +pub fn main() { + unsafe { + assert_eq!(22, rust_dbg_extern_identity_u8(22)); + } +} diff --git a/src/test/run-pass/extern/extern-pass-double.rs b/src/test/run-pass/extern/extern-pass-double.rs new file mode 100644 index 00000000000..ce94790c6d3 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-double.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc for ffi testing + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_double(v: f64) -> f64; +} + +pub fn main() { + unsafe { + assert_eq!(22.0_f64, rust_dbg_extern_identity_double(22.0_f64)); + } +} diff --git a/src/test/run-pass/extern/extern-pass-empty.rs b/src/test/run-pass/extern/extern-pass-empty.rs new file mode 100644 index 00000000000..ff2e4e61a74 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-empty.rs @@ -0,0 +1,65 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] // FIXME: this test is inherently not FFI-safe. + +// Test a foreign function that accepts empty struct. + +// pretty-expanded FIXME #23616 +// ignore-msvc +// ignore-emscripten emcc asserts on an empty struct as an argument + +#[repr(C)] +struct TwoU8s { + one: u8, + two: u8, +} + +#[repr(C)] +struct ManyInts { + arg1: i8, + arg2: i16, + arg3: i32, + arg4: i16, + arg5: i8, + arg6: TwoU8s, +} + +#[repr(C)] +struct Empty; + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + fn rust_dbg_extern_empty_struct(v1: ManyInts, e: Empty, v2: ManyInts); +} + +pub fn main() { + unsafe { + let x = ManyInts { + arg1: 2, + arg2: 3, + arg3: 4, + arg4: 5, + arg5: 6, + arg6: TwoU8s { one: 7, two: 8, } + }; + let y = ManyInts { + arg1: 1, + arg2: 2, + arg3: 3, + arg4: 4, + arg5: 5, + arg6: TwoU8s { one: 6, two: 7, } + }; + let empty = Empty; + rust_dbg_extern_empty_struct(x, empty, y); + } +} diff --git a/src/test/run-pass/extern/extern-pass-u32.rs b/src/test/run-pass/extern/extern-pass-u32.rs new file mode 100644 index 00000000000..9500ad391c7 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-u32.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc for ffi testing + +// Test a function that takes/returns a u32. + + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_u32(v: u32) -> u32; +} + +pub fn main() { + unsafe { + assert_eq!(22, rust_dbg_extern_identity_u32(22)); + } +} diff --git a/src/test/run-pass/extern/extern-pass-u64.rs b/src/test/run-pass/extern/extern-pass-u64.rs new file mode 100644 index 00000000000..bc4cf767087 --- /dev/null +++ b/src/test/run-pass/extern/extern-pass-u64.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc for ffi testing + +// Test a call to a function that takes/returns a u64. + + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; +} + +pub fn main() { + unsafe { + assert_eq!(22, rust_dbg_extern_identity_u64(22)); + } +} diff --git a/src/test/run-pass/extern/extern-prelude-core.rs b/src/test/run-pass/extern/extern-prelude-core.rs new file mode 100644 index 00000000000..67579fd9911 --- /dev/null +++ b/src/test/run-pass/extern/extern-prelude-core.rs @@ -0,0 +1,28 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(extern_prelude, lang_items, start, alloc)] +#![no_std] + +extern crate std as other; + +mod foo { + pub fn test() { + let x = core::cmp::min(2, 3); + assert_eq!(x, 2); + } +} + +#[start] +fn start(_argc: isize, _argv: *const *const u8) -> isize { + foo::test(); + 0 +} diff --git a/src/test/run-pass/extern/extern-prelude-core.stderr b/src/test/run-pass/extern/extern-prelude-core.stderr new file mode 100644 index 00000000000..f7699531857 --- /dev/null +++ b/src/test/run-pass/extern/extern-prelude-core.stderr @@ -0,0 +1,8 @@ +warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable + --> $DIR/extern-prelude-core.rs:12:12 + | +LL | #![feature(extern_prelude, lang_items, start, alloc)] + | ^^^^^^^^^^^^^^ + | + = note: #[warn(stable_features)] on by default + diff --git a/src/test/run-pass/extern/extern-prelude-no-speculative.rs b/src/test/run-pass/extern/extern-prelude-no-speculative.rs new file mode 100644 index 00000000000..8d4219ccf44 --- /dev/null +++ b/src/test/run-pass/extern/extern-prelude-no-speculative.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --extern LooksLikeExternCrate=/path/to/nowhere + +mod m { + pub struct LooksLikeExternCrate; +} + +fn main() { + // OK, speculative resolution for `unused_qualifications` doesn't try + // to resolve this as an extern crate and load that crate + let s = m::LooksLikeExternCrate {}; +} diff --git a/src/test/run-pass/extern/extern-prelude-std.rs b/src/test/run-pass/extern/extern-prelude-std.rs new file mode 100644 index 00000000000..226635dcb7c --- /dev/null +++ b/src/test/run-pass/extern/extern-prelude-std.rs @@ -0,0 +1,23 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(extern_prelude)] + +mod foo { + pub fn test() { + let x = std::cmp::min(2, 3); + assert_eq!(x, 2); + } +} + +fn main() { + foo::test(); +} diff --git a/src/test/run-pass/extern/extern-prelude-std.stderr b/src/test/run-pass/extern/extern-prelude-std.stderr new file mode 100644 index 00000000000..8c059b4ebeb --- /dev/null +++ b/src/test/run-pass/extern/extern-prelude-std.stderr @@ -0,0 +1,8 @@ +warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable + --> $DIR/extern-prelude-std.rs:12:12 + | +LL | #![feature(extern_prelude)] + | ^^^^^^^^^^^^^^ + | + = note: #[warn(stable_features)] on by default + diff --git a/src/test/run-pass/extern/extern-pub.rs b/src/test/run-pass/extern/extern-pub.rs new file mode 100644 index 00000000000..dfe017d4c33 --- /dev/null +++ b/src/test/run-pass/extern/extern-pub.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern { + pub fn free(p: *const u8); +} + +pub fn main() { +} diff --git a/src/test/run-pass/extern/extern-return-TwoU16s.rs b/src/test/run-pass/extern/extern-return-TwoU16s.rs new file mode 100644 index 00000000000..826b5083676 --- /dev/null +++ b/src/test/run-pass/extern/extern-return-TwoU16s.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc to test ffi with + +pub struct TwoU16s { + one: u16, two: u16 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s; +} + +pub fn main() { + unsafe { + let y = rust_dbg_extern_return_TwoU16s(); + assert_eq!(y.one, 10); + assert_eq!(y.two, 20); + } +} diff --git a/src/test/run-pass/extern/extern-return-TwoU32s.rs b/src/test/run-pass/extern/extern-return-TwoU32s.rs new file mode 100644 index 00000000000..15584f28d07 --- /dev/null +++ b/src/test/run-pass/extern/extern-return-TwoU32s.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc to test ffi with + +pub struct TwoU32s { + one: u32, two: u32 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s; +} + +pub fn main() { + unsafe { + let y = rust_dbg_extern_return_TwoU32s(); + assert_eq!(y.one, 10); + assert_eq!(y.two, 20); + } +} diff --git a/src/test/run-pass/extern/extern-return-TwoU64s.rs b/src/test/run-pass/extern/extern-return-TwoU64s.rs new file mode 100644 index 00000000000..94378522a1b --- /dev/null +++ b/src/test/run-pass/extern/extern-return-TwoU64s.rs @@ -0,0 +1,31 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc to test ffi with + +pub struct TwoU64s { + one: u64, two: u64 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s; +} + +pub fn main() { + unsafe { + let y = rust_dbg_extern_return_TwoU64s(); + assert_eq!(y.one, 10); + assert_eq!(y.two, 20); + } +} diff --git a/src/test/run-pass/extern/extern-return-TwoU8s.rs b/src/test/run-pass/extern/extern-return-TwoU8s.rs new file mode 100644 index 00000000000..a66098c9774 --- /dev/null +++ b/src/test/run-pass/extern/extern-return-TwoU8s.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc to test ffi with + +pub struct TwoU8s { + one: u8, two: u8 +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s; +} + +pub fn main() { + unsafe { + let y = rust_dbg_extern_return_TwoU8s(); + assert_eq!(y.one, 10); + assert_eq!(y.two, 20); + } +} diff --git a/src/test/run-pass/extern/extern-rust.rs b/src/test/run-pass/extern/extern-rust.rs new file mode 100644 index 00000000000..8446d9c40c2 --- /dev/null +++ b/src/test/run-pass/extern/extern-rust.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[repr(C)] +pub struct Foo(u32); + +// ICE trigger, bad handling of differing types between rust and external ABIs +pub extern fn bar() -> Foo { + Foo(0) +} + +fn main() {} diff --git a/src/test/run-pass/extern/extern-take-value.rs b/src/test/run-pass/extern/extern-take-value.rs new file mode 100644 index 00000000000..398a968ac18 --- /dev/null +++ b/src/test/run-pass/extern/extern-take-value.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:extern-take-value.rs + +extern crate extern_take_value; + +pub fn main() { + let a: extern "C" fn() -> i32 = extern_take_value::get_f(); + let b: extern "C" fn() -> i32 = extern_take_value::get_f(); + let c: extern "C" fn() -> i32 = extern_take_value::get_g(); + + assert!(a == b); + assert!(a != c); +} diff --git a/src/test/run-pass/extern/extern-thiscall.rs b/src/test/run-pass/extern/extern-thiscall.rs new file mode 100644 index 00000000000..66aa261fecb --- /dev/null +++ b/src/test/run-pass/extern/extern-thiscall.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-arm +// ignore-aarch64 + +#![feature(abi_thiscall)] + +trait A { + extern "thiscall" fn test1(i: i32); +} + +struct S; + +impl A for S { + extern "thiscall" fn test1(i: i32) { + assert_eq!(i, 1); + } +} + +extern "thiscall" fn test2(i: i32) { + assert_eq!(i, 2); +} + +fn main() { + ::test1(1); + test2(2); +} diff --git a/src/test/run-pass/extern/extern-types-inherent-impl.rs b/src/test/run-pass/extern/extern-types-inherent-impl.rs new file mode 100644 index 00000000000..efe55442e0b --- /dev/null +++ b/src/test/run-pass/extern/extern-types-inherent-impl.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that inherent impls can be defined for extern types. + +#![feature(extern_types)] + +extern { + type A; +} + +impl A { + fn foo(&self) { } +} + +fn use_foo(x: &A) { + x.foo(); +} + +fn main() { } diff --git a/src/test/run-pass/extern/extern-types-manual-sync-send.rs b/src/test/run-pass/extern/extern-types-manual-sync-send.rs new file mode 100644 index 00000000000..707516bd0de --- /dev/null +++ b/src/test/run-pass/extern/extern-types-manual-sync-send.rs @@ -0,0 +1,29 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that unsafe impl for Sync/Send can be provided for extern types. + +#![feature(extern_types)] + +extern { + type A; +} + +unsafe impl Sync for A { } +unsafe impl Send for A { } + +fn assert_sync() { } +fn assert_send() { } + +fn main() { + assert_sync::(); + assert_send::(); +} diff --git a/src/test/run-pass/extern/extern-types-pointer-cast.rs b/src/test/run-pass/extern/extern-types-pointer-cast.rs new file mode 100644 index 00000000000..7905c7ba002 --- /dev/null +++ b/src/test/run-pass/extern/extern-types-pointer-cast.rs @@ -0,0 +1,41 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that pointers to extern types can be cast from/to usize, +// despite being !Sized. + +#![feature(extern_types)] + +extern { + type A; +} + +struct Foo { + x: u8, + tail: A, +} + +struct Bar { + x: u8, + tail: T, +} + +#[cfg(target_pointer_width = "32")] +const MAGIC: usize = 0xdeadbeef; +#[cfg(target_pointer_width = "64")] +const MAGIC: usize = 0x12345678deadbeef; + +fn main() { + assert_eq!((MAGIC as *const A) as usize, MAGIC); + assert_eq!((MAGIC as *const Foo) as usize, MAGIC); + assert_eq!((MAGIC as *const Bar) as usize, MAGIC); + assert_eq!((MAGIC as *const Bar>) as usize, MAGIC); +} diff --git a/src/test/run-pass/extern/extern-types-size_of_val.rs b/src/test/run-pass/extern/extern-types-size_of_val.rs new file mode 100644 index 00000000000..3f9e603f72e --- /dev/null +++ b/src/test/run-pass/extern/extern-types-size_of_val.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(extern_types)] + +use std::mem::{size_of_val, align_of_val}; + +extern { + type A; +} + +fn main() { + let x: &A = unsafe { + &*(1usize as *const A) + }; + + assert_eq!(size_of_val(x), 0); + assert_eq!(align_of_val(x), 1); +} diff --git a/src/test/run-pass/extern/extern-types-thin-pointer.rs b/src/test/run-pass/extern/extern-types-thin-pointer.rs new file mode 100644 index 00000000000..08fbadf3d2b --- /dev/null +++ b/src/test/run-pass/extern/extern-types-thin-pointer.rs @@ -0,0 +1,52 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that pointers and references to extern types are thin, ie they have the same size and +// alignment as a pointer to (). + +#![feature(extern_types)] + +use std::mem::{align_of, size_of}; + +extern { + type A; +} + +struct Foo { + x: u8, + tail: A, +} + +struct Bar { + x: u8, + tail: T, +} + +fn assert_thin() { + assert_eq!(size_of::<*const T>(), size_of::<*const ()>()); + assert_eq!(align_of::<*const T>(), align_of::<*const ()>()); + + assert_eq!(size_of::<*mut T>(), size_of::<*mut ()>()); + assert_eq!(align_of::<*mut T>(), align_of::<*mut ()>()); + + assert_eq!(size_of::<&T>(), size_of::<&()>()); + assert_eq!(align_of::<&T>(), align_of::<&()>()); + + assert_eq!(size_of::<&mut T>(), size_of::<&mut ()>()); + assert_eq!(align_of::<&mut T>(), align_of::<&mut ()>()); +} + +fn main() { + assert_thin::(); + assert_thin::(); + assert_thin::>(); + assert_thin::>>(); +} diff --git a/src/test/run-pass/extern/extern-types-trait-impl.rs b/src/test/run-pass/extern/extern-types-trait-impl.rs new file mode 100644 index 00000000000..b8eb4b6a98b --- /dev/null +++ b/src/test/run-pass/extern/extern-types-trait-impl.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that traits can be implemented for extern types. + +#![feature(extern_types)] + +extern { + type A; +} + +trait Foo { + fn foo(&self) { } +} + +impl Foo for A { + fn foo(&self) { } +} + +fn assert_foo() { } + +fn use_foo(x: &Foo) { + x.foo(); +} + +fn main() { + assert_foo::(); +} diff --git a/src/test/run-pass/extern/extern-vectorcall.rs b/src/test/run-pass/extern/extern-vectorcall.rs new file mode 100644 index 00000000000..00f453c7166 --- /dev/null +++ b/src/test/run-pass/extern/extern-vectorcall.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-arm +// ignore-aarch64 + +#![feature(abi_vectorcall)] + +trait A { + extern "vectorcall" fn test1(i: i32); +} + +struct S; + +impl A for S { + extern "vectorcall" fn test1(i: i32) { + assert_eq!(i, 1); + } +} + +extern "vectorcall" fn test2(i: i32) { + assert_eq!(i, 2); +} + +fn main() { + ::test1(1); + test2(2); +} diff --git a/src/test/run-pass/extern/extern_fat_drop.rs b/src/test/run-pass/extern/extern_fat_drop.rs new file mode 100644 index 00000000000..0373abcda72 --- /dev/null +++ b/src/test/run-pass/extern/extern_fat_drop.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:fat_drop.rs + +extern crate fat_drop; + +fn main() { + unsafe { + let data: &mut [u8] = &mut [0]; + let s: &mut fat_drop::S = std::mem::transmute::<&mut [u8], _>(data); + std::ptr::drop_in_place(s); + assert!(fat_drop::DROPPED); + } +} diff --git a/src/test/run-pass/for-loop-while/auto-loop.rs b/src/test/run-pass/for-loop-while/auto-loop.rs new file mode 100644 index 00000000000..0bc046cbcb7 --- /dev/null +++ b/src/test/run-pass/for-loop-while/auto-loop.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let mut sum = 0; + let xs = vec![1, 2, 3, 4, 5]; + for x in &xs { + sum += *x; + } + assert_eq!(sum, 15); +} diff --git a/src/test/run-pass/for-loop-while/break-value.rs b/src/test/run-pass/for-loop-while/break-value.rs new file mode 100644 index 00000000000..c77e9a209dd --- /dev/null +++ b/src/test/run-pass/for-loop-while/break-value.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn int_id(x: isize) -> isize { return x; } + +pub fn main() { loop { int_id(break); } } diff --git a/src/test/run-pass/for-loop-while/break.rs b/src/test/run-pass/for-loop-while/break.rs new file mode 100644 index 00000000000..cffec660104 --- /dev/null +++ b/src/test/run-pass/for-loop-while/break.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let mut i = 0; + while i < 20 { i += 1; if i == 10 { break; } } + assert_eq!(i, 10); + loop { i += 1; if i == 20 { break; } } + assert_eq!(i, 20); + let xs = [1, 2, 3, 4, 5, 6]; + for x in &xs { + if *x == 3 { break; } assert!((*x <= 3)); + } + i = 0; + while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); } + i = 0; + loop { + i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); + if i >= 10 { break; } + } + let ys = vec![1, 2, 3, 4, 5, 6]; + for x in &ys { + if *x % 2 == 0 { continue; } + assert!((*x % 2 != 0)); + } +} diff --git a/src/test/run-pass/for-loop-while/for-destruct.rs b/src/test/run-pass/for-loop-while/for-destruct.rs new file mode 100644 index 00000000000..97fa90530b6 --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-destruct.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Pair { x: isize, y: isize } + +pub fn main() { + for elt in &(vec![Pair {x: 10, y: 20}, Pair {x: 30, y: 0}]) { + assert_eq!(elt.x + elt.y, 30); + } +} diff --git a/src/test/run-pass/for-loop-while/for-loop-goofiness.rs b/src/test/run-pass/for-loop-while/for-loop-goofiness.rs new file mode 100644 index 00000000000..ade51c4abbc --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-goofiness.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum BogusOption { + None, + Some(T), +} + +type Iterator = isize; + +pub fn main() { + let x = [ 3, 3, 3 ]; + for i in &x { + assert_eq!(*i, 3); + } +} diff --git a/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs b/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs new file mode 100644 index 00000000000..a94894a4798 --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-has-unit-body.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + // Check that the tail statement in the body unifies with something + for _ in 0..3 { + unsafe { std::mem::uninitialized() } + } + + // Check that the tail statement in the body can be unit + for _ in 0..3 { + () + } +} diff --git a/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs b/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs new file mode 100644 index 00000000000..ef116b9f3d7 --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-into-iterator.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that for loops can do what RFC #235 claims + + +fn main() { + let mut v = vec![1]; + + for x in &v { + assert_eq!(x, &1); + } + + for x in &mut v { + assert_eq!(x, &mut 1); + } + + for x in v { + assert_eq!(x, 1); + } +} diff --git a/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs b/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs new file mode 100644 index 00000000000..fb12a449a7a --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs @@ -0,0 +1,44 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test when destructors run in a for loop. The intention is +// that the value for each iteration is dropped *after* the loop +// body has executed. This is true even when the value is assigned +// to a `_` pattern (and hence ignored). + +use std::cell::Cell; + +struct Flag<'a>(&'a Cell); + +impl<'a> Drop for Flag<'a> { + fn drop(&mut self) { + self.0.set(false) + } +} + +fn main() { + let alive2 = Cell::new(true); + for _i in std::iter::once(Flag(&alive2)) { + // The Flag value should be alive in the for loop body + assert_eq!(alive2.get(), true); + } + // The Flag value should be dead outside of the loop + assert_eq!(alive2.get(), false); + + let alive = Cell::new(true); + for _ in std::iter::once(Flag(&alive)) { + // The Flag value should be alive in the for loop body even if it wasn't + // bound by the for loop + assert_eq!(alive.get(), true); + } + // The Flag value should be dead outside of the loop + assert_eq!(alive.get(), false); +} diff --git a/src/test/run-pass/for-loop-while/for-loop-macro.rs b/src/test/run-pass/for-loop-while/for-loop-macro.rs new file mode 100644 index 00000000000..ac29efbb7c8 --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-macro.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! var { + ( $name:ident ) => ( $name ); +} + +pub fn main() { + let x = [ 3, 3, 3 ]; + for var!(i) in &x { + assert_eq!(*i, 3); + } +} diff --git a/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs b/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs new file mode 100644 index 00000000000..e80f244bd26 --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-mut-ref-element.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that for loops can bind elements as mutable references + +fn main() { + for ref mut _a in std::iter::once(true) {} +} diff --git a/src/test/run-pass/for-loop-while/for-loop-no-std.rs b/src/test/run-pass/for-loop-while/for-loop-no-std.rs new file mode 100644 index 00000000000..dc03a500f8c --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-no-std.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(lang_items, start, alloc)] +#![no_std] + +extern crate std as other; + +#[macro_use] extern crate alloc; + +#[start] +fn start(_argc: isize, _argv: *const *const u8) -> isize { + for _ in [1,2,3].iter() { } + 0 +} diff --git a/src/test/run-pass/for-loop-while/for-loop-panic.rs b/src/test/run-pass/for-loop-while/for-loop-panic.rs new file mode 100644 index 00000000000..18c52237c2e --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-panic.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { let x: Vec = Vec::new(); for _ in &x { panic!("moop"); } } diff --git a/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs b/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs new file mode 100644 index 00000000000..408900ea706 --- /dev/null +++ b/src/test/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the type of `sum` falls back to `i32` here, +// and that the for loop desugaring doesn't interfere with +// that. + +fn main() { + let mut sum = 0; + for i in Vec::new() { + sum += &i; + } +} diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs new file mode 100644 index 00000000000..1668031cb89 --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-break.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = [1; 100]; + let mut y = 0; + for i in &x[..] { + if y > 10 { + break; + } + y += *i; + } + assert_eq!(y, 11); +} diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs new file mode 100644 index 00000000000..15df3bed030 --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::collections::HashMap; + +// This is a fancy one: it uses an external iterator established +// outside the loop, breaks, then _picks back up_ and continues +// iterating with it. + +pub fn main() { + let mut h = HashMap::new(); + let kvs = [(1, 10), (2, 20), (3, 30)]; + for &(k,v) in &kvs { + h.insert(k,v); + } + let mut x = 0; + let mut y = 0; + + let mut i = h.iter(); + + for (&k,&v) in i.by_ref() { + x += k; + y += v; + break; + } + + for (&k,&v) in i { + x += k; + y += v; + } + + assert_eq!(x, 6); + assert_eq!(y, 60); +} diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs new file mode 100644 index 00000000000..1364b4ca97c --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::collections::HashMap; + +pub fn main() { + let mut h = HashMap::new(); + let kvs = [(1, 10), (2, 20), (3, 30)]; + for &(k,v) in &kvs { + h.insert(k,v); + } + let mut x = 0; + let mut y = 0; + for (&k,&v) in &h { + x += k; + y += v; + } + assert_eq!(x, 6); + assert_eq!(y, 60); +} diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs new file mode 100644 index 00000000000..fe96bf1a3b7 --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-loop.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = [1; 100]; + let mut y = 0; + for (n,i) in x.iter().enumerate() { + if n < 10 { + continue; + } + y += *i; + } + assert_eq!(y, 90); +} diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs new file mode 100644 index 00000000000..0465e321948 --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators-nested.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = [1; 100]; + let y = [2; 100]; + let mut p = 0; + let mut q = 0; + for i in &x[..] { + for j in &y[..] { + p += *j; + } + q += *i + p; + } + assert_eq!(q, 1010100); +} diff --git a/src/test/run-pass/for-loop-while/foreach-external-iterators.rs b/src/test/run-pass/for-loop-while/foreach-external-iterators.rs new file mode 100644 index 00000000000..906156c35f7 --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-external-iterators.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = [1; 100]; + let mut y = 0; + for i in &x[..] { + y += *i + } + assert_eq!(y, 100); +} diff --git a/src/test/run-pass/for-loop-while/foreach-nested.rs b/src/test/run-pass/for-loop-while/foreach-nested.rs new file mode 100644 index 00000000000..ca1da10a5df --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-nested.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn two(mut it: F) where F: FnMut(isize) { it(0); it(1); } + +pub fn main() { + let mut a: Vec = vec![-1, -1, -1, -1]; + let mut p: isize = 0; + two(|i| { + two(|j| { a[p as usize] = 10 * i + j; p += 1; }) + }); + assert_eq!(a[0], 0); + assert_eq!(a[1], 1); + assert_eq!(a[2], 10); + assert_eq!(a[3], 11); +} diff --git a/src/test/run-pass/for-loop-while/foreach-put-structured.rs b/src/test/run-pass/for-loop-while/foreach-put-structured.rs new file mode 100644 index 00000000000..d8ccdd8959f --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-put-structured.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn pairs(mut it: F) where F: FnMut((isize, isize)) { + let mut i: isize = 0; + let mut j: isize = 0; + while i < 10 { it((i, j)); i += 1; j += i; } +} + +pub fn main() { + let mut i: isize = 10; + let mut j: isize = 0; + pairs(|p| { + let (_0, _1) = p; + println!("{}", _0); + println!("{}", _1); + assert_eq!(_0 + 10, i); + i += 1; + j = _1; + }); + assert_eq!(j, 45); +} diff --git a/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs b/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs new file mode 100644 index 00000000000..d00b7e9d0fc --- /dev/null +++ b/src/test/run-pass/for-loop-while/foreach-simple-outer-slot.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let mut sum: isize = 0; + first_ten(|i| { println!("main"); println!("{}", i); sum = sum + i; }); + println!("sum"); + println!("{}", sum); + assert_eq!(sum, 45); +} + +fn first_ten(mut it: F) where F: FnMut(isize) { + let mut i: isize = 0; + while i < 10 { println!("first_ten"); it(i); i = i + 1; } +} diff --git a/src/test/run-pass/for-loop-while/label_break_value.rs b/src/test/run-pass/for-loop-while/label_break_value.rs new file mode 100644 index 00000000000..831b23b03c3 --- /dev/null +++ b/src/test/run-pass/for-loop-while/label_break_value.rs @@ -0,0 +1,124 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(label_break_value)] + +// Test control flow to follow label_break_value semantics +fn label_break(a: bool, b: bool) -> u32 { + let mut v = 0; + 'b: { + v = 1; + if a { + break 'b; + } + v = 2; + if b { + break 'b; + } + v = 3; + } + return v; +} + +// Test that values can be returned +fn break_value(a: bool, b: bool) -> u32 { + let result = 'block: { + if a { break 'block 1; } + if b { break 'block 2; } + 3 + }; + result +} + +// Test nesting of labeled blocks +// here we only check that it compiles +fn label_break_nested() { + 'b: { + println!("hi"); + if false { + break 'b; + } + 'c: { + if false { + break 'b; + } + break 'c; + } + println!("hello"); + if true { + break 'b; + } + } +} + +// Tests for mixing labeled blocks with loop constructs +// This function should be the identity function +fn label_break_mixed(v: u32) -> u32 { + let mut r = 0; + 'b: { + // Unlabeled break still works + // (only crossing boundaries is an error) + loop { + break; + } + if v == 0 { + break 'b; + } + // Labeled breaking an inner loop still works + 'c: loop { + if r == 1 { + break 'c; + } + r += 1; + } + assert_eq!(r, 1); + if v == 1 { + break 'b; + } + // Labeled breaking an outer loop still works + 'd: loop { + 'e: { + if v == r { + break 'b; + } + if r == 5 { + break 'd; + } + r += 1; + } + } + assert_eq!(r, 5); + assert!(v > r); + // Here we test return from inside a labeled block + return v; + } + r +} + +pub fn main() { + assert_eq!(label_break(true, false), 1); + assert_eq!(label_break(false, true), 2); + assert_eq!(label_break(false, false), 3); + + assert_eq!(break_value(true, false), 1); + assert_eq!(break_value(false, true), 2); + assert_eq!(break_value(false, false), 3); + + assert_eq!(label_break_mixed(0), 0); + assert_eq!(label_break_mixed(1), 1); + assert_eq!(label_break_mixed(2), 2); + assert_eq!(label_break_mixed(3), 3); + assert_eq!(label_break_mixed(4), 4); + assert_eq!(label_break_mixed(5), 5); + assert_eq!(label_break_mixed(6), 6); + + // FIXME: ensure that labeled blocks work if produced by macros and in match arms +} diff --git a/src/test/run-pass/for-loop-while/labeled-break.rs b/src/test/run-pass/for-loop-while/labeled-break.rs new file mode 100644 index 00000000000..d00b943313e --- /dev/null +++ b/src/test/run-pass/for-loop-while/labeled-break.rs @@ -0,0 +1,32 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + 'foo: loop { + loop { + break 'foo; + } + } + + 'bar: for _ in 0..100 { + loop { + break 'bar; + } + } + + 'foobar: while 1 + 1 == 2 { + loop { + break 'foobar; + } + } +} diff --git a/src/test/run-pass/for-loop-while/linear-for-loop.rs b/src/test/run-pass/for-loop-while/linear-for-loop.rs new file mode 100644 index 00000000000..e1a70822290 --- /dev/null +++ b/src/test/run-pass/for-loop-while/linear-for-loop.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let x = vec![1, 2, 3]; + let mut y = 0; + for i in &x { println!("{}", *i); y += *i; } + println!("{}", y); + assert_eq!(y, 6); + let s = "hello there".to_string(); + let mut i: isize = 0; + for c in s.bytes() { + if i == 0 { assert_eq!(c, 'h' as u8); } + if i == 1 { assert_eq!(c, 'e' as u8); } + if i == 2 { assert_eq!(c, 'l' as u8); } + if i == 3 { assert_eq!(c, 'l' as u8); } + if i == 4 { assert_eq!(c, 'o' as u8); } + // ... + + i += 1; + println!("{}", i); + println!("{}", c); + } + assert_eq!(i, 11); +} diff --git a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs new file mode 100644 index 00000000000..fd0b234c7b3 --- /dev/null +++ b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unreachable_code)] +#![allow(unused_variables)] + +fn test(_cond: bool) { + let v: isize; + v = 1; + loop { } // loop never terminates, so no error is reported + v = 2; +} + +pub fn main() { + // note: don't call test()... :) +} diff --git a/src/test/run-pass/for-loop-while/liveness-loop-break.rs b/src/test/run-pass/for-loop-while/liveness-loop-break.rs new file mode 100644 index 00000000000..7323f9147fa --- /dev/null +++ b/src/test/run-pass/for-loop-while/liveness-loop-break.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn test() { + let v; + loop { + v = 3; + break; + } + println!("{}", v); +} + +pub fn main() { + test(); +} diff --git a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs new file mode 100644 index 00000000000..b5da1c1e221 --- /dev/null +++ b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +fn take(x: isize) -> isize {x} + +fn the_loop() { + let mut list = Vec::new(); + loop { + let x = 5; + if x > 3 { + list.push(take(x)); + } else { + break; + } + } +} + +pub fn main() {} diff --git a/src/test/run-pass/for-loop-while/loop-break-cont-1.rs b/src/test/run-pass/for-loop-while/loop-break-cont-1.rs new file mode 100644 index 00000000000..f56b2b4ef4d --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-break-cont-1.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let _i = 0_usize; + loop { + break; + } + assert!(true); +} diff --git a/src/test/run-pass/for-loop-while/loop-break-cont.rs b/src/test/run-pass/for-loop-while/loop-break-cont.rs new file mode 100644 index 00000000000..fb32132b493 --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-break-cont.rs @@ -0,0 +1,49 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let mut i = 0_usize; + loop { + println!("a"); + i += 1_usize; + if i == 10_usize { + break; + } + } + assert_eq!(i, 10_usize); + let mut is_even = false; + loop { + if i == 21_usize { + break; + } + println!("b"); + is_even = false; + i += 1_usize; + if i % 2_usize != 0_usize { + continue; + } + is_even = true; + } + assert!(!is_even); + loop { + println!("c"); + if i == 22_usize { + break; + } + is_even = false; + i += 1_usize; + if i % 2_usize != 0_usize { + continue; + } + is_even = true; + } + assert!(is_even); +} diff --git a/src/test/run-pass/for-loop-while/loop-break-value.rs b/src/test/run-pass/for-loop-while/loop-break-value.rs new file mode 100644 index 00000000000..9f23b4e93e6 --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-break-value.rs @@ -0,0 +1,147 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(never_type)] + +#[allow(unused)] +fn never_returns() { + loop { + break loop {}; + } +} + +pub fn main() { + let value = 'outer: loop { + if 1 == 1 { + break 13; + } else { + let _never: ! = loop { + break loop { + break 'outer panic!(); + } + }; + } + }; + assert_eq!(value, 13); + + let x = [1, 3u32, 5]; + let y = [17]; + let z = []; + let coerced: &[_] = loop { + match 2 { + 1 => break &x, + 2 => break &y, + 3 => break &z, + _ => (), + } + }; + assert_eq!(coerced, &[17u32]); + + let trait_unified = loop { + break if true { + break Default::default() + } else { + break [13, 14] + }; + }; + assert_eq!(trait_unified, [0, 0]); + + let trait_unified_2 = loop { + if false { + break [String::from("Hello")] + } else { + break Default::default() + }; + }; + assert_eq!(trait_unified_2, [""]); + + let trait_unified_3 = loop { + break if false { + break [String::from("Hello")] + } else { + ["Yes".into()] + }; + }; + assert_eq!(trait_unified_3, ["Yes"]); + + let regular_break = loop { + if true { + break; + } else { + break break Default::default(); + } + }; + assert_eq!(regular_break, ()); + + let regular_break_2 = loop { + if true { + break Default::default(); + } else { + break; + } + }; + assert_eq!(regular_break_2, ()); + + let regular_break_3 = loop { + break if true { + Default::default() + } else { + break; + } + }; + assert_eq!(regular_break_3, ()); + + let regular_break_4 = loop { + break (); + break; + }; + assert_eq!(regular_break_4, ()); + + let regular_break_5 = loop { + break; + break (); + }; + assert_eq!(regular_break_5, ()); + + let nested_break_value = 'outer2: loop { + let _a: u32 = 'inner: loop { + if true { + break 'outer2 "hello"; + } else { + break 'inner 17; + } + }; + panic!(); + }; + assert_eq!(nested_break_value, "hello"); + + let break_from_while_cond = loop { + 'inner_loop: while break 'inner_loop { + panic!(); + } + break 123; + }; + assert_eq!(break_from_while_cond, 123); + + let break_from_while_to_outer = 'outer_loop: loop { + while break 'outer_loop 567 { + panic!("from_inner"); + } + panic!("from outer"); + }; + assert_eq!(break_from_while_to_outer, 567); + + let rust = true; + let value = loop { + break rust; + }; + assert!(value); +} diff --git a/src/test/run-pass/for-loop-while/loop-diverges.rs b/src/test/run-pass/for-loop-while/loop-diverges.rs new file mode 100644 index 00000000000..86ff4c05438 --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-diverges.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +/* Make sure a loop{} can be the tailexpr in the body +of a diverging function */ + +fn forever() -> ! { + loop{} +} + +pub fn main() { + if (1 == 2) { forever(); } +} diff --git a/src/test/run-pass/for-loop-while/loop-label-shadowing.rs b/src/test/run-pass/for-loop-while/loop-label-shadowing.rs new file mode 100644 index 00000000000..18cad7541aa --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-label-shadowing.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #12512. + +// pretty-expanded FIXME #23616 + +fn main() { + let mut foo = Vec::new(); + 'foo: for i in &[1, 2, 3] { + foo.push(*i); + } +} diff --git a/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs b/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs new file mode 100644 index 00000000000..a8fe26abf9a --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-labeled-break-value.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + 'outer: loop { + let _: i32 = loop { break 'outer }; + } + 'outer2: loop { + let _: i32 = loop { loop { break 'outer2 } }; + } +} diff --git a/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs b/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs new file mode 100644 index 00000000000..95bb8e8aa64 --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs @@ -0,0 +1,44 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct S; +// Ensure S is moved, not copied, on assignment. +impl Drop for S { fn drop(&mut self) { } } + +// user-defined function "returning" bottom (i.e. no return at all). +fn my_panic() -> ! { loop {} } + +pub fn step(f: bool) { + let mut g = S; + let mut i = 0; + loop + { + if i > 10 { break; } else { i += 1; } + + let _g = g; + + if f { + // re-initialize g, but only before restarting loop. + g = S; + continue; + } + + my_panic(); + + // we never get here, so we do not need to re-initialize g. + } +} + +pub fn main() { + step(true); +} diff --git a/src/test/run-pass/for-loop-while/loop-scope.rs b/src/test/run-pass/for-loop-while/loop-scope.rs new file mode 100644 index 00000000000..e8987b1a593 --- /dev/null +++ b/src/test/run-pass/for-loop-while/loop-scope.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = vec![10, 20, 30]; + let mut sum = 0; + for x in &x { sum += *x; } + assert_eq!(sum, 60); +} diff --git a/src/test/run-pass/for-loop-while/while-cont.rs b/src/test/run-pass/for-loop-while/while-cont.rs new file mode 100644 index 00000000000..23d74f440ba --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-cont.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #825: Should recheck the loop condition after continuing +pub fn main() { + let mut i = 1; + while i > 0 { + assert!((i > 0)); + println!("{}", i); + i -= 1; + continue; + } +} diff --git a/src/test/run-pass/for-loop-while/while-flow-graph.rs b/src/test/run-pass/for-loop-while/while-flow-graph.rs new file mode 100644 index 00000000000..9abdf45d18d --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-flow-graph.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +// pretty-expanded FIXME #23616 + +pub fn main() { let x: isize = 10; while x == 10 && x == 11 { let _y = 0xf00_usize; } } diff --git a/src/test/run-pass/for-loop-while/while-label.rs b/src/test/run-pass/for-loop-while/while-label.rs new file mode 100644 index 00000000000..da0cf295ba0 --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-label.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let mut i = 100; + 'w: while 1 + 1 == 2 { + i -= 1; + if i == 95 { + break 'w; + panic!("Should have broken out of loop"); + } + } + assert_eq!(i, 95); +} diff --git a/src/test/run-pass/for-loop-while/while-let.rs b/src/test/run-pass/for-loop-while/while-let.rs new file mode 100644 index 00000000000..ea334df54c4 --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-let.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::collections::BinaryHeap; + +fn make_pq() -> BinaryHeap { + BinaryHeap::from(vec![1,2,3]) +} + +pub fn main() { + let mut pq = make_pq(); + let mut sum = 0; + while let Some(x) = pq.pop() { + sum += x; + } + assert_eq!(sum, 6); + + pq = make_pq(); + sum = 0; + 'a: while let Some(x) = pq.pop() { + sum += x; + if x == 2 { + break 'a; + } + } + assert_eq!(sum, 5); + + pq = make_pq(); + sum = 0; + 'a2: while let Some(x) = pq.pop() { + if x == 3 { + continue 'a2; + } + sum += x; + } + assert_eq!(sum, 3); + + let mut pq1 = make_pq(); + sum = 0; + while let Some(x) = pq1.pop() { + let mut pq2 = make_pq(); + while let Some(y) = pq2.pop() { + sum += x * y; + } + } + assert_eq!(sum, 6 + 12 + 18); +} diff --git a/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs b/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs new file mode 100644 index 00000000000..802f7be543a --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_variables)] + +pub fn main() { + let mut y: isize = 42; + let mut z: isize = 42; + let mut x: isize; + while z < 50 { + z += 1; + while false { x = y; y = z; } + println!("{}", y); + } + assert!((y == 42 && z == 50)); +} diff --git a/src/test/run-pass/for-loop-while/while-prelude-drop.rs b/src/test/run-pass/for-loop-while/while-prelude-drop.rs new file mode 100644 index 00000000000..8c6c8994398 --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-prelude-drop.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::string::String; + +#[derive(PartialEq)] +enum t { a, b(String), } + +fn make(i: isize) -> t { + if i > 10 { return t::a; } + let mut s = String::from("hello"); + // Ensure s is non-const. + + s.push_str("there"); + return t::b(s); +} + +pub fn main() { + let mut i = 0; + + + // The auto slot for the result of make(i) should not leak. + while make(i) != t::a { i += 1; } +} diff --git a/src/test/run-pass/for-loop-while/while-with-break.rs b/src/test/run-pass/for-loop-while/while-with-break.rs new file mode 100644 index 00000000000..0981ce91f3c --- /dev/null +++ b/src/test/run-pass/for-loop-while/while-with-break.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let mut i: isize = 90; + while i < 100 { + println!("{}", i); + i = i + 1; + if i == 95 { + let _v: Vec = + vec![1, 2, 3, 4, 5]; // we check that it is freed by break + + println!("breaking"); + break; + } + } + assert_eq!(i, 95); +} diff --git a/src/test/run-pass/for-loop-while/while.rs b/src/test/run-pass/for-loop-while/while.rs new file mode 100644 index 00000000000..ba71ba1fd52 --- /dev/null +++ b/src/test/run-pass/for-loop-while/while.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let mut x: isize = 10; + let mut y: isize = 0; + while y < x { println!("{}", y); println!("hello"); y = y + 1; } + while x > 0 { + println!("goodbye"); + x = x - 1; + println!("{}", x); + } +} diff --git a/src/test/run-pass/foreign/auxiliary/fn-abi.rs b/src/test/run-pass/foreign/auxiliary/fn-abi.rs new file mode 100644 index 00000000000..5d380ea6a5a --- /dev/null +++ b/src/test/run-pass/foreign/auxiliary/fn-abi.rs @@ -0,0 +1,12 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[no_mangle] +pub extern fn foo() {} diff --git a/src/test/run-pass/foreign/auxiliary/foreign_lib.rs b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs new file mode 100644 index 00000000000..cef36274c62 --- /dev/null +++ b/src/test/run-pass/foreign/auxiliary/foreign_lib.rs @@ -0,0 +1,48 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="foreign_lib"] + +#![feature(libc)] + +pub mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_get_test_int() -> libc::intptr_t; + } +} + +pub mod rustrt2 { + extern crate libc; + + extern { + pub fn rust_get_test_int() -> libc::intptr_t; + } +} + +pub mod rustrt3 { + // Different type, but same ABI (on all supported platforms). + // Ensures that we don't ICE or trigger LLVM asserts when + // importing the same symbol under different types. + // See https://github.com/rust-lang/rust/issues/32740. + extern { + pub fn rust_get_test_int() -> *const u8; + } +} + +pub fn local_uses() { + unsafe { + let x = rustrt::rust_get_test_int(); + assert_eq!(x, rustrt2::rust_get_test_int()); + assert_eq!(x as *const _, rustrt3::rust_get_test_int()); + } +} diff --git a/src/test/run-pass/foreign/foreign-call-no-runtime.rs b/src/test/run-pass/foreign/foreign-call-no-runtime.rs new file mode 100644 index 00000000000..4837f78ce3b --- /dev/null +++ b/src/test/run-pass/foreign/foreign-call-no-runtime.rs @@ -0,0 +1,65 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(libc)] + +extern crate libc; + +use std::mem; +use std::thread; + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t), + data: libc::uintptr_t) -> libc::uintptr_t; +} + +pub fn main() { + unsafe { + thread::spawn(move|| { + let i: isize = 100; + rust_dbg_call(callback_isize, mem::transmute(&i)); + }).join().unwrap(); + + thread::spawn(move|| { + let i: i32 = 100; + rust_dbg_call(callback_i32, mem::transmute(&i)); + }).join().unwrap(); + + thread::spawn(move|| { + let i: i64 = 100; + rust_dbg_call(callback_i64, mem::transmute(&i)); + }).join().unwrap(); + } +} + +extern fn callback_isize(data: libc::uintptr_t) { + unsafe { + let data: *const isize = mem::transmute(data); + assert_eq!(*data, 100); + } +} + +extern fn callback_i64(data: libc::uintptr_t) { + unsafe { + let data: *const i64 = mem::transmute(data); + assert_eq!(*data, 100); + } +} + +extern fn callback_i32(data: libc::uintptr_t) { + unsafe { + let data: *const i32 = mem::transmute(data); + assert_eq!(*data, 100); + } +} diff --git a/src/test/run-pass/foreign/foreign-dupe.rs b/src/test/run-pass/foreign/foreign-dupe.rs new file mode 100644 index 00000000000..296459c399f --- /dev/null +++ b/src/test/run-pass/foreign/foreign-dupe.rs @@ -0,0 +1,27 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:foreign_lib.rs +// ignore-wasm32-bare no libc to test ffi with + +// Check that we can still call duplicated extern (imported) functions +// which were declared in another crate. See issues #32740 and #32783. + + +extern crate foreign_lib; + +pub fn main() { + unsafe { + let x = foreign_lib::rustrt::rust_get_test_int(); + assert_eq!(x, foreign_lib::rustrt2::rust_get_test_int()); + assert_eq!(x as *const _, foreign_lib::rustrt3::rust_get_test_int()); + } +} diff --git a/src/test/run-pass/foreign/foreign-fn-linkname.rs b/src/test/run-pass/foreign/foreign-fn-linkname.rs new file mode 100644 index 00000000000..75876607603 --- /dev/null +++ b/src/test/run-pass/foreign/foreign-fn-linkname.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +extern crate libc; +use std::ffi::CString; + +mod mlibc { + use libc::{c_char, size_t}; + + extern { + #[link_name = "strlen"] + pub fn my_strlen(str: *const c_char) -> size_t; + } +} + +fn strlen(str: String) -> usize { + // C string is terminated with a zero + let s = CString::new(str).unwrap(); + unsafe { + mlibc::my_strlen(s.as_ptr()) as usize + } +} + +pub fn main() { + let len = strlen("Rust".to_string()); + assert_eq!(len, 4); +} diff --git a/src/test/run-pass/foreign/foreign-fn-with-byval.rs b/src/test/run-pass/foreign/foreign-fn-with-byval.rs new file mode 100644 index 00000000000..1c8d1bd2566 --- /dev/null +++ b/src/test/run-pass/foreign/foreign-fn-with-byval.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc to test ffi with + +#[derive(Copy, Clone)] +pub struct S { + x: u64, + y: u64, + z: u64, +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn get_x(x: S) -> u64; + pub fn get_y(x: S) -> u64; + pub fn get_z(x: S) -> u64; +} + +#[inline(never)] +fn indirect_call(func: unsafe extern fn(s: S) -> u64, s: S) -> u64 { + unsafe { + func(s) + } +} + +fn main() { + let s = S { x: 1, y: 2, z: 3 }; + assert_eq!(s.x, indirect_call(get_x, s)); + assert_eq!(s.y, indirect_call(get_y, s)); + assert_eq!(s.z, indirect_call(get_z, s)); +} diff --git a/src/test/run-pass/foreign/foreign-int-types.rs b/src/test/run-pass/foreign/foreign-int-types.rs new file mode 100644 index 00000000000..d7bcf655990 --- /dev/null +++ b/src/test/run-pass/foreign/foreign-int-types.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![forbid(improper_ctypes)] +#![allow(dead_code)] + +mod xx { + extern { + pub fn strlen(str: *const u8) -> usize; + pub fn foo(x: isize, y: usize); + } +} + +fn main() { +} diff --git a/src/test/run-pass/foreign/foreign-mod-src/compiletest-ignore-dir b/src/test/run-pass/foreign/foreign-mod-src/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/foreign/foreign-mod-src/inner.rs b/src/test/run-pass/foreign/foreign-mod-src/inner.rs new file mode 100644 index 00000000000..3c5f6ab8064 --- /dev/null +++ b/src/test/run-pass/foreign/foreign-mod-src/inner.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let f = "Makefile"; + let s = rustrt.str_buf(f); + let buf = libc.malloc(1024); + let fd = libc.open(s, 0, 0); + libc.read(fd, buf, 1024); + libc.write(1, buf, 1024); + libc.close(fd); + libc.free(buf); +} diff --git a/src/test/run-pass/foreign/foreign-mod-unused-const.rs b/src/test/run-pass/foreign/foreign-mod-unused-const.rs new file mode 100644 index 00000000000..61d537c692c --- /dev/null +++ b/src/test/run-pass/foreign/foreign-mod-unused-const.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod foo { + extern { + pub static errno: u32; + } +} + +pub fn main() { +} diff --git a/src/test/run-pass/foreign/foreign-no-abi.rs b/src/test/run-pass/foreign/foreign-no-abi.rs new file mode 100644 index 00000000000..1d35f08a11f --- /dev/null +++ b/src/test/run-pass/foreign/foreign-no-abi.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ABI is cdecl by default + +// ignore-wasm32-bare no libc to test ffi with +// pretty-expanded FIXME #23616 + +#![feature(libc)] + +mod rustrt { + extern crate libc; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_get_test_int() -> libc::intptr_t; + } +} + +pub fn main() { + unsafe { + rustrt::rust_get_test_int(); + } +} diff --git a/src/test/run-pass/foreign/foreign-src/compiletest-ignore-dir b/src/test/run-pass/foreign/foreign-src/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/foreign/foreign-src/foreign.rs b/src/test/run-pass/foreign/foreign-src/foreign.rs new file mode 100644 index 00000000000..5cf8f5a22dd --- /dev/null +++ b/src/test/run-pass/foreign/foreign-src/foreign.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + libc.puts(rustrt.str_buf("hello, extern world 1")); + libc.puts(rustrt.str_buf("hello, extern world 2")); + libc.puts(rustrt.str_buf("hello, extern world 3")); +} diff --git a/src/test/run-pass/foreign/foreign-truncated-arguments.rs b/src/test/run-pass/foreign/foreign-truncated-arguments.rs new file mode 100644 index 00000000000..5e7d4487382 --- /dev/null +++ b/src/test/run-pass/foreign/foreign-truncated-arguments.rs @@ -0,0 +1,30 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -O +// Regression test for https://github.com/rust-lang/rust/issues/33868 + +#[repr(C)] +pub struct S { + a: u32, + b: f32, + c: u32 +} + +#[no_mangle] +#[inline(never)] +pub extern "C" fn test(s: S) -> u32 { + s.c +} + +fn main() { + assert_eq!(test(S{a: 0, b: 0.0, c: 42}), 42); +} diff --git a/src/test/run-pass/foreign/foreign2.rs b/src/test/run-pass/foreign/foreign2.rs new file mode 100644 index 00000000000..307e6b182e7 --- /dev/null +++ b/src/test/run-pass/foreign/foreign2.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with +// pretty-expanded FIXME #23616 + +#![feature(libc)] + +extern crate libc; + +mod bar { + extern {} +} + +mod zed { + extern {} +} + +mod mlibc { + use libc::{c_int, c_void, size_t, ssize_t}; + + extern { + pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; + } +} + +mod baz { + extern {} +} + +pub fn main() { } diff --git a/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs b/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs new file mode 100644 index 00000000000..5d380ea6a5a --- /dev/null +++ b/src/test/run-pass/functions-closures/auxiliary/fn-abi.rs @@ -0,0 +1,12 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[no_mangle] +pub extern fn foo() {} diff --git a/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs b/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs new file mode 100644 index 00000000000..d31420f338d --- /dev/null +++ b/src/test/run-pass/functions-closures/call-closure-from-overloaded-op.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn foo() -> isize { 22 } + +pub fn main() { + let mut x: Vec isize> = Vec::new(); + x.push(foo); + assert_eq!((x[0])(), 22); +} diff --git a/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs b/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs new file mode 100644 index 00000000000..21b71c9c380 --- /dev/null +++ b/src/test/run-pass/functions-closures/capture-clauses-boxed-closures.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn each(x: &[T], mut f: F) where F: FnMut(&T) { + for val in x { + f(val) + } +} + +fn main() { + let mut sum = 0_usize; + let elems = [ 1_usize, 2, 3, 4, 5 ]; + each(&elems, |val| sum += *val); + assert_eq!(sum, 15); +} diff --git a/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs b/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs new file mode 100644 index 00000000000..d18d8d37c02 --- /dev/null +++ b/src/test/run-pass/functions-closures/capture-clauses-unboxed-closures.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) { + for val in x { + f(val) + } +} + +fn main() { + let mut sum = 0; + let elems = [ 1, 2, 3, 4, 5 ]; + each(&elems, |val: &usize| sum += *val); + assert_eq!(sum, 15); +} diff --git a/src/test/run-pass/functions-closures/clone-closure.rs b/src/test/run-pass/functions-closures/clone-closure.rs new file mode 100644 index 00000000000..49350266a6e --- /dev/null +++ b/src/test/run-pass/functions-closures/clone-closure.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that closures implement `Clone`. + +#[derive(Clone)] +struct S(i32); + +fn main() { + let mut a = S(5); + let mut hello = move || { + a.0 += 1; + println!("Hello {}", a.0); + a.0 + }; + + let mut hello2 = hello.clone(); + assert_eq!(6, hello2()); + assert_eq!(6, hello()); +} diff --git a/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs b/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs new file mode 100644 index 00000000000..7c1230d4e90 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-bounds-can-capture-chan.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::sync::mpsc::channel; + +fn foo(blk: F) { + blk(); +} + +pub fn main() { + let (tx, rx) = channel(); + foo(move || { + tx.send(()).unwrap(); + }); + rx.recv().unwrap(); +} diff --git a/src/test/run-pass/functions-closures/closure-expected-type/README.md b/src/test/run-pass/functions-closures/closure-expected-type/README.md new file mode 100644 index 00000000000..fd493e1ff37 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-expected-type/README.md @@ -0,0 +1,8 @@ +Some tests targeted at how we deduce the types of closure arguments. +This process is a result of some heuristics aimed at combining the +*expected type* we have with the *actual types* that we get from +inputs. This investigation was kicked off by #38714, which revealed +some pretty deep flaws in the ad-hoc way that we were doing things +before. + +See also `src/test/compile-fail/closure-expected-type`. diff --git a/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs b/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs new file mode 100644 index 00000000000..a58b9ba567b --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn with_closure(_: F) + where F: FnOnce(Vec, A) +{ +} + +fn expect_free_supply_free<'x>(x: &'x u32) { + with_closure(|mut x: Vec<_>, y| { + // Shows that the call to `x.push()` is influencing type of `y`... + x.push(22_u32); + + // ...since we now know the type of `y` and can resolve the method call. + y.wrapping_add(1); + }); +} + +fn main() { } diff --git a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs new file mode 100644 index 00000000000..3304b2e2600 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct UsizeRef<'a> { + a: &'a usize +} + +type RefTo = Box Fn(&'r Vec) -> UsizeRef<'r>>; + +fn ref_to<'a>(vec: &'a Vec) -> UsizeRef<'a> { + UsizeRef{ a: &vec[0]} +} + +fn main() { + // Regression test: this was causing ICEs; it should compile. + let a: RefTo = Box::new(|vec: &Vec| { + UsizeRef{ a: &vec[0] } + }); +} diff --git a/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs b/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs new file mode 100644 index 00000000000..30e81746db6 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn with_closure(f: F) -> Result + where F: FnOnce(&char) -> Result, +{ + f(&'a') +} + +fn main() { + // Test that supplying the `-> Result` manually here + // (which is needed to constrain `R`) still allows us to figure + // out that the type of `x` is `&'a char` where `'a` is bound in + // the closure (if we didn't, we'd get a type-error because + // `with_closure` requires a bound region). + // + // This pattern was found in the wild. + let z = with_closure(|x| -> Result { Ok(*x) }); + assert_eq!(z.unwrap(), 'a'); + + // It also works with `_`: + let z = with_closure(|x: _| -> Result { Ok(*x) }); + assert_eq!(z.unwrap(), 'a'); + + // It also works with `&_`: + let z = with_closure(|x: &_| -> Result { Ok(*x) }); + assert_eq!(z.unwrap(), 'a'); +} diff --git a/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs b/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs new file mode 100644 index 00000000000..9035bca50b9 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-expected-type/supply-nothing.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn with_closure(f: F) -> u32 + where F: FnOnce(&u32, &u32) -> u32 +{ + f(&22, &44) +} + +fn main() { + let z = with_closure(|x, y| x + y).wrapping_add(1); + assert_eq!(z, 22 + 44 + 1); +} diff --git a/src/test/run-pass/functions-closures/closure-immediate.rs b/src/test/run-pass/functions-closures/closure-immediate.rs new file mode 100644 index 00000000000..9a729532eff --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-immediate.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// After the work to reoptimize structs, it became possible for immediate logic to fail. +// This test verifies that it actually works. + +fn main() { + let c = |a: u8, b: u16, c: u8| { + assert_eq!(a, 1); + assert_eq!(b, 2); + assert_eq!(c, 3); + }; + c(1, 2, 3); +} diff --git a/src/test/run-pass/functions-closures/closure-inference.rs b/src/test/run-pass/functions-closures/closure-inference.rs new file mode 100644 index 00000000000..e8554d27650 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-inference.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn foo(i: isize) -> isize { i + 1 } + +fn apply(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) } + +pub fn main() { + let f = {|i| foo(i)}; + assert_eq!(apply(f, 2), 3); +} diff --git a/src/test/run-pass/functions-closures/closure-inference2.rs b/src/test/run-pass/functions-closures/closure-inference2.rs new file mode 100644 index 00000000000..65da36e206b --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-inference2.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a rather underspecified example: + + +pub fn main() { + let f = {|i| i}; + assert_eq!(f(2), 2); + assert_eq!(f(5), 5); +} diff --git a/src/test/run-pass/functions-closures/closure-reform.rs b/src/test/run-pass/functions-closures/closure-reform.rs new file mode 100644 index 00000000000..52e0e56026b --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-reform.rs @@ -0,0 +1,65 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +/* Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/publicdomain/zero/1.0/ */ + +fn call_it(f: F) + where F : FnOnce(String) -> String +{ + println!("{}", f("Fred".to_string())) +} + +fn call_a_thunk(f: F) where F: FnOnce() { + f(); +} + +fn call_this(f: F) where F: FnOnce(&str) + Send { + f("Hello!"); +} + +fn call_bare(f: fn(&str)) { + f("Hello world!") +} + +fn call_bare_again(f: extern "Rust" fn(&str)) { + f("Goodbye world!") +} + +pub fn main() { + // Procs + + let greeting = "Hello ".to_string(); + call_it(|s| { + format!("{}{}", greeting, s) + }); + + let greeting = "Goodbye ".to_string(); + call_it(|s| format!("{}{}", greeting, s)); + + let greeting = "How's life, ".to_string(); + call_it(|s: String| -> String { + format!("{}{}", greeting, s) + }); + + // Closures + + call_a_thunk(|| println!("Hello world!")); + + call_this(|s| println!("{}", s)); + + // External functions + + fn foo(s: &str) {} + call_bare(foo); + + call_bare_again(foo); +} diff --git a/src/test/run-pass/functions-closures/closure-returning-closure.rs b/src/test/run-pass/functions-closures/closure-returning-closure.rs new file mode 100644 index 00000000000..08e7ebe5588 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-returning-closure.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let f = |_||x, y| x+y; + assert_eq!(f(())(1, 2), 3); +} diff --git a/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs b/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs new file mode 100644 index 00000000000..15a46f0eca5 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure-to-fn-coercion.rs @@ -0,0 +1,45 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; + +const FOO: fn(u8) -> u8 = |v: u8| { v }; + +const BAR: [fn(&mut u32); 5] = [ + |_: &mut u32| {}, + |v: &mut u32| *v += 1, + |v: &mut u32| *v += 2, + |v: &mut u32| *v += 3, + |v: &mut u32| *v += 4, +]; +fn func_specific() -> (fn() -> u32) { + || return 42 +} + +fn generic(_: T) -> fn() -> usize { + || mem::size_of::() +} + +fn main() { + // Items + assert_eq!(func_specific()(), 42); + let foo: fn(u8) -> u8 = |v: u8| { v }; + assert_eq!(foo(31), 31); + // Constants + assert_eq!(FOO(31), 31); + let mut a: u32 = 0; + assert_eq!({ BAR[0](&mut a); a }, 0); + assert_eq!({ BAR[1](&mut a); a }, 1); + assert_eq!({ BAR[2](&mut a); a }, 3); + assert_eq!({ BAR[3](&mut a); a }, 6); + assert_eq!({ BAR[4](&mut a); a }, 10); + assert_eq!(generic(0i8)(), 1); +} diff --git a/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs b/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs new file mode 100644 index 00000000000..e2e2b325177 --- /dev/null +++ b/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensure that we deduce expected argument types when a `fn()` type is expected (#41755) + +fn foo(f: fn(Vec) -> usize) { } + +fn main() { + foo(|x| x.len()) +} diff --git a/src/test/run-pass/functions-closures/copy-closure.rs b/src/test/run-pass/functions-closures/copy-closure.rs new file mode 100644 index 00000000000..73971431d58 --- /dev/null +++ b/src/test/run-pass/functions-closures/copy-closure.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that closures implement `Copy`. + +fn call T>(f: F) -> T { f() } + +fn main() { + let a = 5; + let hello = || { + println!("Hello {}", a); + a + }; + + assert_eq!(5, call(hello.clone())); + assert_eq!(5, call(hello)); + assert_eq!(5, call(hello)); +} diff --git a/src/test/run-pass/functions-closures/fn-abi.rs b/src/test/run-pass/functions-closures/fn-abi.rs new file mode 100644 index 00000000000..4e97dec2189 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-abi.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensure that declarations and types which use `extern fn` both have the same +// ABI (#9309). + +// pretty-expanded FIXME #23616 +// aux-build:fn-abi.rs + +extern crate fn_abi; + +extern { + fn foo(); +} + +pub fn main() { + // Will only type check if the type of _p and the decl of foo use the + // same ABI + let _p: unsafe extern fn() = foo; +} diff --git a/src/test/run-pass/functions-closures/fn-bare-assign.rs b/src/test/run-pass/functions-closures/fn-bare-assign.rs new file mode 100644 index 00000000000..4bf83461ed2 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-bare-assign.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn f(i: isize, called: &mut bool) { + assert_eq!(i, 10); + *called = true; +} + +fn g(f: fn(isize, v: &mut bool), called: &mut bool) { + f(10, called); +} + +pub fn main() { + let mut called = false; + let h = f; + g(h, &mut called); + assert_eq!(called, true); +} diff --git a/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs b/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs new file mode 100644 index 00000000000..4aba898a768 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-bare-coerce-to-block.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn bare() {} + +fn likes_block(f: F) where F: FnOnce() { f() } + +pub fn main() { + likes_block(bare); +} diff --git a/src/test/run-pass/functions-closures/fn-bare-item.rs b/src/test/run-pass/functions-closures/fn-bare-item.rs new file mode 100644 index 00000000000..0a8241d6fce --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-bare-item.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn f() { + println!("This is a bare function"); +} + +pub fn main() { + f(); +} diff --git a/src/test/run-pass/functions-closures/fn-bare-size.rs b/src/test/run-pass/functions-closures/fn-bare-size.rs new file mode 100644 index 00000000000..eff13b7521f --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-bare-size.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem; + +pub fn main() { + // Bare functions should just be a pointer + assert_eq!(mem::size_of::(), mem::size_of::()); +} diff --git a/src/test/run-pass/functions-closures/fn-bare-spawn.rs b/src/test/run-pass/functions-closures/fn-bare-spawn.rs new file mode 100644 index 00000000000..50dc51f82e6 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-bare-spawn.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is what the signature to spawn should look like with bare functions + + +fn spawn(val: T, f: fn(T)) { + f(val); +} + +fn f(i: isize) { + assert_eq!(i, 100); +} + +pub fn main() { + spawn(100, f); +} diff --git a/src/test/run-pass/functions-closures/fn-coerce-field.rs b/src/test/run-pass/functions-closures/fn-coerce-field.rs new file mode 100644 index 00000000000..5845af6b60d --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-coerce-field.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] + +struct r where F: FnOnce() { + field: F, +} + +pub fn main() { + fn f() {} + let _i: r = r {field: f as fn()}; +} diff --git a/src/test/run-pass/functions-closures/fn-item-type-cast.rs b/src/test/run-pass/functions-closures/fn-item-type-cast.rs new file mode 100644 index 00000000000..0c032bd79fd --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-item-type-cast.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test explicit coercions from a fn item type to a fn pointer type. + + +fn foo(x: isize) -> isize { x * 2 } +fn bar(x: isize) -> isize { x * 4 } +type IntMap = fn(isize) -> isize; + +fn eq(x: T, y: T) { } + +static TEST: Option = Some(foo as IntMap); + +fn main() { + let f = foo as IntMap; + + let f = if true { foo as IntMap } else { bar as IntMap }; + assert_eq!(f(4), 8); + + eq(foo as IntMap, bar as IntMap); +} diff --git a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs new file mode 100644 index 00000000000..3b0cd1ec1e5 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test implicit coercions from a fn item type to a fn pointer type. + +// pretty-expanded FIXME #23616 + +fn foo(x: isize) -> isize { x * 2 } +fn bar(x: isize) -> isize { x * 4 } +type IntMap = fn(isize) -> isize; + +fn eq(x: T, y: T) { } + +fn main() { + let f: IntMap = foo; + + eq::(foo, bar); +} diff --git a/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs b/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs new file mode 100644 index 00000000000..0e952fe2761 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-item-type-zero-sized.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that fn item types are zero-sized. + +use std::mem::{size_of, size_of_val}; + +fn main() { + assert_eq!(size_of_val(&main), 0); + + let (a, b) = (size_of::, size_of::); + assert_eq!(size_of_val(&a), 0); + assert_eq!(size_of_val(&b), 0); + assert_eq!((a(), b()), (1, 2)); +} diff --git a/src/test/run-pass/functions-closures/fn-lval.rs b/src/test/run-pass/functions-closures/fn-lval.rs new file mode 100644 index 00000000000..806ae182256 --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-lval.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +// pretty-expanded FIXME #23616 + +fn foo(_f: fn(isize) -> isize) { } + +fn id(x: isize) -> isize { return x; } + +pub fn main() { foo(id); } diff --git a/src/test/run-pass/functions-closures/fn-type-infer.rs b/src/test/run-pass/functions-closures/fn-type-infer.rs new file mode 100644 index 00000000000..5eea37cdc8c --- /dev/null +++ b/src/test/run-pass/functions-closures/fn-type-infer.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +pub fn main() { + // We should be able to type infer inside of ||s. + let _f = || { + let i = 10; + }; +} diff --git a/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs b/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs new file mode 100644 index 00000000000..4277dcc149e --- /dev/null +++ b/src/test/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to handle the relationships between free +// regions bound in a closure callback. + +#[derive(Copy, Clone)] +struct MyCx<'short, 'long: 'short> { + short: &'short u32, + long: &'long u32, +} + +impl<'short, 'long> MyCx<'short, 'long> { + fn short(self) -> &'short u32 { self.short } + fn long(self) -> &'long u32 { self.long } + fn set_short(&mut self, v: &'short u32) { self.short = v; } +} + +fn with(op: F) -> R +where + F: for<'short, 'long> FnOnce(MyCx<'short, 'long>) -> R, +{ + op(MyCx { + short: &22, + long: &22, + }) +} + +fn main() { + with(|mut cx| { + // For this to type-check, we need to be able to deduce that + // the lifetime of `l` can be `'short`, even though it has + // input from `'long`. + let l = if true { cx.long() } else { cx.short() }; + cx.set_short(l); + }); +} diff --git a/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs b/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs new file mode 100644 index 00000000000..2122bb897a0 --- /dev/null +++ b/src/test/run-pass/functions-closures/nullable-pointer-opt-closures.rs @@ -0,0 +1,44 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem; + +pub fn main() { + // By Ref Capture + let a = 10i32; + let b = Some(|| println!("{}", a)); + // When we capture by reference we can use any of the + // captures as the discriminant since they're all + // behind a pointer. + assert_eq!(mem::size_of_val(&b), mem::size_of::()); + + // By Value Capture + let a = Box::new(12i32); + let b = Some(move || println!("{}", a)); + // We captured `a` by value and since it's a `Box` we can use it + // as the discriminant. + assert_eq!(mem::size_of_val(&b), mem::size_of::>()); + + // By Value Capture - Transitive case + let a = "Hello".to_string(); // String -> Vec -> Unique -> NonZero + let b = Some(move || println!("{}", a)); + // We captured `a` by value and since down the chain it contains + // a `NonZero` field, we can use it as the discriminant. + assert_eq!(mem::size_of_val(&b), mem::size_of::()); + + // By Value - No Optimization + let a = 14i32; + let b = Some(move || println!("{}", a)); + // We captured `a` by value but we can't use it as the discriminant + // thus we end up with an extra field for the discriminant + assert_eq!(mem::size_of_val(&b), mem::size_of::<(i32, i32)>()); +} diff --git a/src/test/run-pass/functions-closures/parallel-codegen-closures.rs b/src/test/run-pass/functions-closures/parallel-codegen-closures.rs new file mode 100644 index 00000000000..0b8604f66f9 --- /dev/null +++ b/src/test/run-pass/functions-closures/parallel-codegen-closures.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// Tests parallel codegen - this can fail if the symbol for the anonymous +// closure in `sum` pollutes the second codegen unit from the first. + +// ignore-bitrig +// compile-flags: -C codegen_units=2 + +#![feature(iter_arith)] + +mod a { + fn foo() { + let x = ["a", "bob", "c"]; + let len: usize = x.iter().map(|s| s.len()).sum(); + } +} + +mod b { + fn bar() { + let x = ["a", "bob", "c"]; + let len: usize = x.iter().map(|s| s.len()).sum(); + } +} + +fn main() { +} diff --git a/src/test/run-pass/functions-closures/return-from-closure.rs b/src/test/run-pass/functions-closures/return-from-closure.rs new file mode 100644 index 00000000000..c66bdb5fa8b --- /dev/null +++ b/src/test/run-pass/functions-closures/return-from-closure.rs @@ -0,0 +1,43 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] +// just to make sure that `return` is only returning from the closure, +// not the surrounding function. + +static mut calls: usize = 0; + +fn surrounding() { + let return_works = |n: isize| { + unsafe { calls += 1 } + + if n >= 0 { return; } + panic!() + }; + + return_works(10); + return_works(20); + + let return_works_proc = |n: isize| { + unsafe { calls += 1 } + + if n >= 0 { return; } + panic!() + }; + + return_works_proc(10); +} + +pub fn main() { + surrounding(); + + assert_eq!(unsafe {calls}, 3); +} diff --git a/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs b/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs new file mode 100644 index 00000000000..91e43537cc2 --- /dev/null +++ b/src/test/run-pass/generator/auxiliary/xcrate-reachable.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +fn msg() -> u32 { + 0 +} + +pub fn foo() -> impl Generator { + || { + yield; + return msg(); + } +} diff --git a/src/test/run-pass/generator/auxiliary/xcrate.rs b/src/test/run-pass/generator/auxiliary/xcrate.rs new file mode 100644 index 00000000000..fcfe0b754b6 --- /dev/null +++ b/src/test/run-pass/generator/auxiliary/xcrate.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +pub fn foo() -> impl Generator { + || { + if false { + yield; + } + } +} + +pub fn bar(t: T) -> Box> { + Box::new(|| { + yield t; + }) +} diff --git a/src/test/run-pass/generator/borrow-in-tail-expr.rs b/src/test/run-pass/generator/borrow-in-tail-expr.rs new file mode 100644 index 00000000000..3ac501d0117 --- /dev/null +++ b/src/test/run-pass/generator/borrow-in-tail-expr.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] + +fn main() { + let _a = || { + yield; + let a = String::new(); + a.len() + }; +} diff --git a/src/test/run-pass/generator/conditional-drop.rs b/src/test/run-pass/generator/conditional-drop.rs new file mode 100644 index 00000000000..ca8689ca842 --- /dev/null +++ b/src/test/run-pass/generator/conditional-drop.rs @@ -0,0 +1,67 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::Generator; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; + +static A: AtomicUsize = ATOMIC_USIZE_INIT; + +struct B; + +impl Drop for B { + fn drop(&mut self) { + A.fetch_add(1, Ordering::SeqCst); + } +} + + +fn test() -> bool { true } +fn test2() -> bool { false } + +fn main() { + t1(); + t2(); +} + +fn t1() { + let mut a = || { + let b = B; + if test() { + drop(b); + } + yield; + }; + + let n = A.load(Ordering::SeqCst); + unsafe { a.resume() }; + assert_eq!(A.load(Ordering::SeqCst), n + 1); + unsafe { a.resume() }; + assert_eq!(A.load(Ordering::SeqCst), n + 1); +} + +fn t2() { + let mut a = || { + let b = B; + if test2() { + drop(b); + } + yield; + }; + + let n = A.load(Ordering::SeqCst); + unsafe { a.resume() }; + assert_eq!(A.load(Ordering::SeqCst), n); + unsafe { a.resume() }; + assert_eq!(A.load(Ordering::SeqCst), n + 1); +} diff --git a/src/test/run-pass/generator/control-flow.rs b/src/test/run-pass/generator/control-flow.rs new file mode 100644 index 00000000000..b1560b83cdc --- /dev/null +++ b/src/test/run-pass/generator/control-flow.rs @@ -0,0 +1,58 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::{GeneratorState, Generator}; + +fn finish(mut amt: usize, mut t: T) -> T::Return + where T: Generator +{ + loop { + match unsafe { t.resume() } { + GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(), + GeneratorState::Complete(ret) => { + assert_eq!(amt, 0); + return ret + } + } + } + +} + +fn main() { + finish(1, || yield); + finish(8, || { + for _ in 0..8 { + yield; + } + }); + finish(1, || { + if true { + yield; + } else { + } + }); + finish(1, || { + if false { + } else { + yield; + } + }); + finish(2, || { + if { yield; false } { + yield; + panic!() + } + yield + }); +} diff --git a/src/test/run-pass/generator/drop-env.rs b/src/test/run-pass/generator/drop-env.rs new file mode 100644 index 00000000000..9bdee027097 --- /dev/null +++ b/src/test/run-pass/generator/drop-env.rs @@ -0,0 +1,72 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::Generator; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; + +static A: AtomicUsize = ATOMIC_USIZE_INIT; + +struct B; + +impl Drop for B { + fn drop(&mut self) { + A.fetch_add(1, Ordering::SeqCst); + } +} + +fn main() { + t1(); + t2(); + t3(); +} + +fn t1() { + let b = B; + let mut foo = || { + yield; + drop(b); + }; + + let n = A.load(Ordering::SeqCst); + drop(unsafe { foo.resume() }); + assert_eq!(A.load(Ordering::SeqCst), n); + drop(foo); + assert_eq!(A.load(Ordering::SeqCst), n + 1); +} + +fn t2() { + let b = B; + let mut foo = || { + yield b; + }; + + let n = A.load(Ordering::SeqCst); + drop(unsafe { foo.resume() }); + assert_eq!(A.load(Ordering::SeqCst), n + 1); + drop(foo); + assert_eq!(A.load(Ordering::SeqCst), n + 1); +} + +fn t3() { + let b = B; + let foo = || { + yield; + drop(b); + }; + + let n = A.load(Ordering::SeqCst); + assert_eq!(A.load(Ordering::SeqCst), n); + drop(foo); + assert_eq!(A.load(Ordering::SeqCst), n + 1); +} diff --git a/src/test/run-pass/generator/issue-44197.rs b/src/test/run-pass/generator/issue-44197.rs new file mode 100644 index 00000000000..7ddc3c6e83c --- /dev/null +++ b/src/test/run-pass/generator/issue-44197.rs @@ -0,0 +1,44 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::{ Generator, GeneratorState }; + +fn foo(_: &str) -> String { + String::new() +} + +fn bar(baz: String) -> impl Generator { + move || { + yield foo(&baz); + } +} + +fn foo2(_: &str) -> Result { + Err(()) +} + +fn bar2(baz: String) -> impl Generator { + move || { + if let Ok(quux) = foo2(&baz) { + yield quux; + } + } +} + +fn main() { + unsafe { + assert_eq!(bar(String::new()).resume(), GeneratorState::Yielded(String::new())); + assert_eq!(bar2(String::new()).resume(), GeneratorState::Complete(())); + } +} diff --git a/src/test/run-pass/generator/issue-52398.rs b/src/test/run-pass/generator/issue-52398.rs new file mode 100644 index 00000000000..9ed65a0eee0 --- /dev/null +++ b/src/test/run-pass/generator/issue-52398.rs @@ -0,0 +1,37 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] + +use std::cell::RefCell; + +struct A; + +impl A { + fn test(&self, a: ()) {} +} + +fn main() { + // Test that the MIR local with type &A created for the auto-borrow adjustment + // is caught by typeck + move || { + A.test(yield); + }; + + // Test that the std::cell::Ref temporary returned from the `borrow` call + // is caught by typeck + let y = RefCell::new(true); + static move || { + yield *y.borrow(); + return "Done"; + }; +} diff --git a/src/test/run-pass/generator/iterator-count.rs b/src/test/run-pass/generator/iterator-count.rs new file mode 100644 index 00000000000..b9d877b6498 --- /dev/null +++ b/src/test/run-pass/generator/iterator-count.rs @@ -0,0 +1,52 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::{GeneratorState, Generator}; + +struct W(T); + +// This impl isn't safe in general, but the generator used in this test is movable +// so it won't cause problems. +impl> Iterator for W { + type Item = T::Yield; + + fn next(&mut self) -> Option { + match unsafe { self.0.resume() } { + GeneratorState::Complete(..) => None, + GeneratorState::Yielded(v) => Some(v), + } + } +} + +fn test() -> impl Generator { + || { + for i in 1..6 { + yield i + } + } +} + +fn main() { + let end = 11; + + let closure_test = |start| { + move || { + for i in start..end { + yield i + } + } + }; + + assert!(W(test()).chain(W(closure_test(6))).eq(1..11)); +} diff --git a/src/test/run-pass/generator/live-upvar-across-yield.rs b/src/test/run-pass/generator/live-upvar-across-yield.rs new file mode 100644 index 00000000000..f560c521533 --- /dev/null +++ b/src/test/run-pass/generator/live-upvar-across-yield.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::Generator; + +fn main() { + let b = |_| 3; + let mut a = || { + b(yield); + }; + unsafe { a.resume() }; +} diff --git a/src/test/run-pass/generator/match-bindings.rs b/src/test/run-pass/generator/match-bindings.rs new file mode 100644 index 00000000000..10d8bb8c9a7 --- /dev/null +++ b/src/test/run-pass/generator/match-bindings.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] + +enum Enum { + A(String), + B +} + +fn main() { + || { + loop { + if let true = true { + match Enum::A(String::new()) { + Enum::A(_var) => {} + Enum::B => {} + } + } + yield; + } + }; +} diff --git a/src/test/run-pass/generator/nested_generators.rs b/src/test/run-pass/generator/nested_generators.rs new file mode 100644 index 00000000000..e73f3f197db --- /dev/null +++ b/src/test/run-pass/generator/nested_generators.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] +#![feature(generator_trait)] + +use std::ops::Generator; +use std::ops::GeneratorState; + +fn main() { + let _generator = || { + let mut sub_generator = || { + yield 2; + }; + + match unsafe { sub_generator.resume() } { + GeneratorState::Yielded(x) => { + yield x; + } + _ => panic!(), + }; + }; +} diff --git a/src/test/run-pass/generator/panic-drops.rs b/src/test/run-pass/generator/panic-drops.rs new file mode 100644 index 00000000000..34efd43c505 --- /dev/null +++ b/src/test/run-pass/generator/panic-drops.rs @@ -0,0 +1,66 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-wasm32-bare compiled as panic=abort by default + +#![feature(generators, generator_trait)] + +use std::ops::Generator; +use std::panic; +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; + +static A: AtomicUsize = ATOMIC_USIZE_INIT; + +struct B; + +impl Drop for B { + fn drop(&mut self) { + A.fetch_add(1, Ordering::SeqCst); + } +} + +fn bool_true() -> bool { + true +} + +fn main() { + let b = B; + let mut foo = || { + if bool_true() { + panic!(); + } + drop(b); + yield; + }; + + assert_eq!(A.load(Ordering::SeqCst), 0); + let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { + unsafe { foo.resume() } + })); + assert!(res.is_err()); + assert_eq!(A.load(Ordering::SeqCst), 1); + + let mut foo = || { + if bool_true() { + panic!(); + } + drop(B); + yield; + }; + + assert_eq!(A.load(Ordering::SeqCst), 1); + let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { + unsafe { foo.resume() } + })); + assert!(res.is_err()); + assert_eq!(A.load(Ordering::SeqCst), 1); +} diff --git a/src/test/run-pass/generator/panic-safe.rs b/src/test/run-pass/generator/panic-safe.rs new file mode 100644 index 00000000000..f1aa5de9689 --- /dev/null +++ b/src/test/run-pass/generator/panic-safe.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-wasm32-bare compiled with panic=abort by default + +#![feature(generators, generator_trait)] + +use std::ops::Generator; +use std::panic; + +fn main() { + let mut foo = || { + if true { + panic!(); + } + yield; + }; + + let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { + unsafe { foo.resume() } + })); + assert!(res.is_err()); + + for _ in 0..10 { + let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { + unsafe { foo.resume() } + })); + assert!(res.is_err()); + } +} diff --git a/src/test/run-pass/generator/reborrow-mut-upvar.rs b/src/test/run-pass/generator/reborrow-mut-upvar.rs new file mode 100644 index 00000000000..582b5ad575b --- /dev/null +++ b/src/test/run-pass/generator/reborrow-mut-upvar.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] + +fn _run(bar: &mut i32) { + || { + { + let _baz = &*bar; + yield; + } + + *bar = 2; + }; +} + +fn main() {} diff --git a/src/test/run-pass/generator/resume-after-return.rs b/src/test/run-pass/generator/resume-after-return.rs new file mode 100644 index 00000000000..67c653f102d --- /dev/null +++ b/src/test/run-pass/generator/resume-after-return.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-wasm32-bare compiled with panic=abort by default + +#![feature(generators, generator_trait)] + +use std::ops::{GeneratorState, Generator}; +use std::panic; + +fn main() { + let mut foo = || { + if true { + return + } + yield; + }; + + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } + + match panic::catch_unwind(move || unsafe { foo.resume() }) { + Ok(_) => panic!("generator successfully resumed"), + Err(_) => {} + } +} diff --git a/src/test/run-pass/generator/smoke.rs b/src/test/run-pass/generator/smoke.rs new file mode 100644 index 00000000000..2651000e8b4 --- /dev/null +++ b/src/test/run-pass/generator/smoke.rs @@ -0,0 +1,183 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-emscripten no threads support +// compile-flags: --test + +#![feature(generators, generator_trait)] + +use std::ops::{GeneratorState, Generator}; +use std::thread; + +#[test] +fn simple() { + let mut foo = || { + if false { + yield; + } + }; + + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } +} + +#[test] +fn return_capture() { + let a = String::from("foo"); + let mut foo = || { + if false { + yield; + } + a + }; + + match unsafe { foo.resume() } { + GeneratorState::Complete(ref s) if *s == "foo" => {} + s => panic!("bad state: {:?}", s), + } +} + +#[test] +fn simple_yield() { + let mut foo = || { + yield; + }; + + match unsafe { foo.resume() } { + GeneratorState::Yielded(()) => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } +} + +#[test] +fn yield_capture() { + let b = String::from("foo"); + let mut foo = || { + yield b; + }; + + match unsafe { foo.resume() } { + GeneratorState::Yielded(ref s) if *s == "foo" => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } +} + +#[test] +fn simple_yield_value() { + let mut foo = || { + yield String::from("bar"); + return String::from("foo") + }; + + match unsafe { foo.resume() } { + GeneratorState::Yielded(ref s) if *s == "bar" => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(ref s) if *s == "foo" => {} + s => panic!("bad state: {:?}", s), + } +} + +#[test] +fn return_after_yield() { + let a = String::from("foo"); + let mut foo = || { + yield; + return a + }; + + match unsafe { foo.resume() } { + GeneratorState::Yielded(()) => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(ref s) if *s == "foo" => {} + s => panic!("bad state: {:?}", s), + } +} + +#[test] +fn send_and_sync() { + assert_send_sync(|| { + yield + }); + assert_send_sync(|| { + yield String::from("foo"); + }); + assert_send_sync(|| { + yield; + return String::from("foo"); + }); + let a = 3; + assert_send_sync(|| { + yield a; + return + }); + let a = 3; + assert_send_sync(move || { + yield a; + return + }); + let a = String::from("a"); + assert_send_sync(|| { + yield ; + drop(a); + return + }); + let a = String::from("a"); + assert_send_sync(move || { + yield ; + drop(a); + return + }); + + fn assert_send_sync(_: T) {} +} + +#[test] +fn send_over_threads() { + let mut foo = || { yield }; + thread::spawn(move || { + match unsafe { foo.resume() } { + GeneratorState::Yielded(()) => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } + }).join().unwrap(); + + let a = String::from("a"); + let mut foo = || { yield a }; + thread::spawn(move || { + match unsafe { foo.resume() } { + GeneratorState::Yielded(ref s) if *s == "a" => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } + }).join().unwrap(); +} diff --git a/src/test/run-pass/generator/static-generators.rs b/src/test/run-pass/generator/static-generators.rs new file mode 100644 index 00000000000..9c659b53a06 --- /dev/null +++ b/src/test/run-pass/generator/static-generators.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators, generator_trait)] + +use std::ops::{Generator, GeneratorState}; + +fn main() { + let mut generator = static || { + let a = true; + let b = &a; + yield; + assert_eq!(b as *const _, &a as *const _); + }; + unsafe { + assert_eq!(generator.resume(), GeneratorState::Yielded(())); + assert_eq!(generator.resume(), GeneratorState::Complete(())); + } +} diff --git a/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs b/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs new file mode 100644 index 00000000000..81a5f571202 --- /dev/null +++ b/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs @@ -0,0 +1,30 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] + +fn main() { + unsafe { + static move || { + // Tests that the generator transformation finds out that `a` is not live + // during the yield expression. Type checking will also compute liveness + // and it should also find out that `a` is not live. + // The compiler will panic if the generator transformation finds that + // `a` is live and type checking finds it dead. + let a = { + yield (); + 4i32 + }; + &a; + }; + } +} diff --git a/src/test/run-pass/generator/xcrate-reachable.rs b/src/test/run-pass/generator/xcrate-reachable.rs new file mode 100644 index 00000000000..c14b3c3328a --- /dev/null +++ b/src/test/run-pass/generator/xcrate-reachable.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:xcrate-reachable.rs + +#![feature(generator_trait)] + +extern crate xcrate_reachable as foo; + +use std::ops::Generator; + +fn main() { + unsafe { foo::foo().resume(); } +} diff --git a/src/test/run-pass/generator/xcrate.rs b/src/test/run-pass/generator/xcrate.rs new file mode 100644 index 00000000000..af4a84dd1db --- /dev/null +++ b/src/test/run-pass/generator/xcrate.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:xcrate.rs + +#![feature(generators, generator_trait)] + +extern crate xcrate; + +use std::ops::{GeneratorState, Generator}; + +fn main() { + let mut foo = xcrate::foo(); + + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } + + let mut foo = xcrate::bar(3); + + match unsafe { foo.resume() } { + GeneratorState::Yielded(3) => {} + s => panic!("bad state: {:?}", s), + } + match unsafe { foo.resume() } { + GeneratorState::Complete(()) => {} + s => panic!("bad state: {:?}", s), + } +} diff --git a/src/test/run-pass/generator/yield-in-args-rev.rs b/src/test/run-pass/generator/yield-in-args-rev.rs new file mode 100644 index 00000000000..3048b1225d3 --- /dev/null +++ b/src/test/run-pass/generator/yield-in-args-rev.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that a borrow that occurs after a yield in the same +// argument list is not treated as live across the yield by +// type-checking. + +#![feature(generators)] + +fn foo(_a: (), _b: &bool) {} + +fn bar() { + || { + let b = true; + foo(yield, &b); + }; +} + +fn main() { } diff --git a/src/test/run-pass/generator/yield-in-box.rs b/src/test/run-pass/generator/yield-in-box.rs new file mode 100644 index 00000000000..a5ba3a25e87 --- /dev/null +++ b/src/test/run-pass/generator/yield-in-box.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that box-statements with yields in them work. + +#![feature(generators, box_syntax)] + +fn main() { + let x = 0i32; + || { + let y = 2u32; + { + let _t = box (&x, yield 0, &y); + } + match box (&x, yield 0, &y) { + _t => {} + } + }; +} diff --git a/src/test/run-pass/generator/yield-in-initializer.rs b/src/test/run-pass/generator/yield-in-initializer.rs new file mode 100644 index 00000000000..00045e6d3f6 --- /dev/null +++ b/src/test/run-pass/generator/yield-in-initializer.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(generators)] + +fn main() { + static || { + loop { + // Test that `opt` is not live across the yield, even when borrowed in a loop + // See https://github.com/rust-lang/rust/issues/52792 + let opt = { + yield; + true + }; + &opt; + } + }; +} diff --git a/src/test/run-pass/generator/yield-subtype.rs b/src/test/run-pass/generator/yield-subtype.rs new file mode 100644 index 00000000000..62d3a59ab78 --- /dev/null +++ b/src/test/run-pass/generator/yield-subtype.rs @@ -0,0 +1,29 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// revisions:lexical nll +//[nll]compile-flags: -Z disable-nll-user-type-assert +#![cfg_attr(nll, feature(nll))] + +#![feature(generators)] + +fn bar<'a>() { + let a: &'static str = "hi"; + let b: &'a str = a; + + || { + yield a; + yield b; + }; +} + +fn main() {} diff --git a/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs b/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs new file mode 100644 index 00000000000..fe852e5d8ea --- /dev/null +++ b/src/test/run-pass/generics/auxiliary/default_type_params_xc.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Heap; + +pub struct FakeHeap; + +pub struct FakeVec { pub f: Option<(T,A)> } diff --git a/src/test/run-pass/generics/generic-alias-unique.rs b/src/test/run-pass/generics/generic-alias-unique.rs new file mode 100644 index 00000000000..a141ae049cc --- /dev/null +++ b/src/test/run-pass/generics/generic-alias-unique.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn id(t: T) -> T { return t; } + +pub fn main() { + let expected: Box<_> = box 100; + let actual = id::>(expected.clone()); + println!("{}", *actual); + assert_eq!(*expected, *actual); +} diff --git a/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs b/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs new file mode 100644 index 00000000000..762ea4c6760 --- /dev/null +++ b/src/test/run-pass/generics/generic-default-type-params-cross-crate.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:default_type_params_xc.rs + +// pretty-expanded FIXME #23616 + +extern crate default_type_params_xc; + +struct Vec(Option<(T,A)>); + +struct Foo; + +fn main() { + let _a = Vec::(None); + let _b = Vec::(None); + let _c = default_type_params_xc::FakeVec:: { f: None }; + let _d = default_type_params_xc::FakeVec:: { f: None }; +} diff --git a/src/test/run-pass/generics/generic-default-type-params.rs b/src/test/run-pass/generics/generic-default-type-params.rs new file mode 100644 index 00000000000..6a5ae7b664f --- /dev/null +++ b/src/test/run-pass/generics/generic-default-type-params.rs @@ -0,0 +1,63 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + a: A +} + +impl Foo { + fn bar_int(&self) -> isize { + self.a + } +} + +impl Foo { + fn bar_char(&self) -> char { + self.a + } +} + +impl Foo { + fn bar(&self) { + let (i, c): (isize, char) = self.a; + assert_eq!(Foo { a: i }.bar_int(), i); + assert_eq!(Foo { a: c }.bar_char(), c); + } +} + +impl Foo { + fn baz(&self) -> A { + self.a.clone() + } +} + +fn default_foo(x: Foo) { + let (i, c): (isize, char) = x.a; + assert_eq!(i, 1); + assert_eq!(c, 'a'); + + x.bar(); + assert_eq!(x.baz(), (1, 'a')); +} + +#[derive(PartialEq, Debug)] +struct BazHelper(T); + +#[derive(PartialEq, Debug)] +// Ensure that we can use previous type parameters in defaults. +struct Baz, V = Option>(T, U, V); + +fn main() { + default_foo(Foo { a: (1, 'a') }); + + let x: Baz = Baz(true, BazHelper(false), Some(BazHelper(true))); + assert_eq!(x, Baz(true, BazHelper(false), Some(BazHelper(true)))); +} diff --git a/src/test/run-pass/generics/generic-derived-type.rs b/src/test/run-pass/generics/generic-derived-type.rs new file mode 100644 index 00000000000..76f638ca75e --- /dev/null +++ b/src/test/run-pass/generics/generic-derived-type.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn g(x: X) -> X { return x; } + +#[derive(Clone)] +struct Pair { + a: T, + b: T +} + +fn f(t: T) -> Pair { + let x: Pair = Pair {a: t.clone(), b: t}; + return g::>(x); +} + +pub fn main() { + let b = f::(10); + println!("{}" ,b.a); + println!("{}", b.b); + assert_eq!(b.a, 10); + assert_eq!(b.b, 10); +} diff --git a/src/test/run-pass/generics/generic-exterior-unique.rs b/src/test/run-pass/generics/generic-exterior-unique.rs new file mode 100644 index 00000000000..960d578138f --- /dev/null +++ b/src/test/run-pass/generics/generic-exterior-unique.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Recbox {x: Box} + +fn reclift(t: T) -> Recbox { return Recbox {x: box t}; } + +pub fn main() { + let foo: isize = 17; + let rbfoo: Recbox = reclift::(foo); + assert_eq!(*rbfoo.x, foo); +} diff --git a/src/test/run-pass/generics/generic-extern-mangle.rs b/src/test/run-pass/generics/generic-extern-mangle.rs new file mode 100644 index 00000000000..b935922a0cd --- /dev/null +++ b/src/test/run-pass/generics/generic-extern-mangle.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Add; + +extern "C" fn foo(a: T, b: T) -> T::Output { a + b } + +fn main() { + assert_eq!(100u8, foo(0u8, 100u8)); + assert_eq!(100u16, foo(0u16, 100u16)); +} diff --git a/src/test/run-pass/generics/generic-fn-infer.rs b/src/test/run-pass/generics/generic-fn-infer.rs new file mode 100644 index 00000000000..5db9228cc3c --- /dev/null +++ b/src/test/run-pass/generics/generic-fn-infer.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +// Issue #45: infer type parameters in function applications + +fn id(x: T) -> T { return x; } + +pub fn main() { let x: isize = 42; let y: isize = id(x); assert_eq!(x, y); } diff --git a/src/test/run-pass/generics/generic-fn-twice.rs b/src/test/run-pass/generics/generic-fn-twice.rs new file mode 100644 index 00000000000..d385a153830 --- /dev/null +++ b/src/test/run-pass/generics/generic-fn-twice.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +// pretty-expanded FIXME #23616 + +mod foomod { + pub fn foo() { } +} + +pub fn main() { foomod::foo::(); foomod::foo::(); } diff --git a/src/test/run-pass/generics/generic-fn-unique.rs b/src/test/run-pass/generics/generic-fn-unique.rs new file mode 100644 index 00000000000..0e0ffa63f61 --- /dev/null +++ b/src/test/run-pass/generics/generic-fn-unique.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f(x: Box) -> Box { return x; } + +pub fn main() { let x = f(box 3); println!("{}", *x); } diff --git a/src/test/run-pass/generics/generic-fn.rs b/src/test/run-pass/generics/generic-fn.rs new file mode 100644 index 00000000000..ae26ea1b155 --- /dev/null +++ b/src/test/run-pass/generics/generic-fn.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn id(x: T) -> T { return x; } + +#[derive(Copy, Clone)] +struct Triple {x: isize, y: isize, z: isize} + +pub fn main() { + let mut x = 62; + let mut y = 63; + let a = 'a'; + let mut b = 'b'; + let p: Triple = Triple {x: 65, y: 66, z: 67}; + let mut q: Triple = Triple {x: 68, y: 69, z: 70}; + y = id::(x); + println!("{}", y); + assert_eq!(x, y); + b = id::(a); + println!("{}", b); + assert_eq!(a, b); + q = id::(p); + x = p.z; + y = q.z; + println!("{}", y); + assert_eq!(x, y); +} diff --git a/src/test/run-pass/generics/generic-ivec-leak.rs b/src/test/run-pass/generics/generic-ivec-leak.rs new file mode 100644 index 00000000000..555f5297dde --- /dev/null +++ b/src/test/run-pass/generics/generic-ivec-leak.rs @@ -0,0 +1,15 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +enum wrapper { wrapped(T), } + +pub fn main() { let _w = wrapper::wrapped(vec![1, 2, 3, 4, 5]); } diff --git a/src/test/run-pass/generics/generic-newtype-struct.rs b/src/test/run-pass/generics/generic-newtype-struct.rs new file mode 100644 index 00000000000..fc54a3bab54 --- /dev/null +++ b/src/test/run-pass/generics/generic-newtype-struct.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct S(T); + +pub fn main() { + let _s = S(2); +} diff --git a/src/test/run-pass/generics/generic-object.rs b/src/test/run-pass/generics/generic-object.rs new file mode 100644 index 00000000000..4745b8d2cb8 --- /dev/null +++ b/src/test/run-pass/generics/generic-object.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +trait Foo { + fn get(&self) -> T; +} + +struct S { + x: isize +} + +impl Foo for S { + fn get(&self) -> isize { + self.x + } +} + +pub fn main() { + let x = box S { x: 1 }; + let y = x as Box>; + assert_eq!(y.get(), 1); +} diff --git a/src/test/run-pass/generics/generic-recursive-tag.rs b/src/test/run-pass/generics/generic-recursive-tag.rs new file mode 100644 index 00000000000..3830177f0ad --- /dev/null +++ b/src/test/run-pass/generics/generic-recursive-tag.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +enum list { cons(Box, Box>), nil, } + +pub fn main() { + let _a: list = + list::cons::(box 10, + box list::cons::(box 12, + box list::cons::(box 13, + box list::nil::))); +} diff --git a/src/test/run-pass/generics/generic-static-methods.rs b/src/test/run-pass/generics/generic-static-methods.rs new file mode 100644 index 00000000000..2fe903866c2 --- /dev/null +++ b/src/test/run-pass/generics/generic-static-methods.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +trait vec_utils { + fn map_(x: &Self, f: F) -> Vec where F: FnMut(&T) -> U; +} + +impl vec_utils for Vec { + fn map_(x: &Vec , mut f: F) -> Vec where F: FnMut(&T) -> U { + let mut r = Vec::new(); + for elt in x { + r.push(f(elt)); + } + r + } +} + +pub fn main() { + assert_eq!(vec_utils::map_(&vec![1,2,3], |&x| x+1), [2,3,4]); +} diff --git a/src/test/run-pass/generics/generic-tag-corruption.rs b/src/test/run-pass/generics/generic-tag-corruption.rs new file mode 100644 index 00000000000..6f02be5d106 --- /dev/null +++ b/src/test/run-pass/generics/generic-tag-corruption.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +// This used to cause memory corruption in stage 0. +// pretty-expanded FIXME #23616 + +enum thing { some(K), } + +pub fn main() { let _x = thing::some("hi".to_string()); } diff --git a/src/test/run-pass/generics/generic-tag-local.rs b/src/test/run-pass/generics/generic-tag-local.rs new file mode 100644 index 00000000000..a0429693fd9 --- /dev/null +++ b/src/test/run-pass/generics/generic-tag-local.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum clam { a(T), } + +pub fn main() { let _c = clam::a(3); } diff --git a/src/test/run-pass/generics/generic-tag-match.rs b/src/test/run-pass/generics/generic-tag-match.rs new file mode 100644 index 00000000000..7f0bfe8ba31 --- /dev/null +++ b/src/test/run-pass/generics/generic-tag-match.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum foo { arm(T), } + +fn altfoo(f: foo) { + let mut hit = false; + match f { foo::arm::(_x) => { println!("in arm"); hit = true; } } + assert!((hit)); +} + +pub fn main() { altfoo::(foo::arm::(10)); } diff --git a/src/test/run-pass/generics/generic-tag-values.rs b/src/test/run-pass/generics/generic-tag-values.rs new file mode 100644 index 00000000000..66a1268e2f8 --- /dev/null +++ b/src/test/run-pass/generics/generic-tag-values.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum noption { some(T), } + +struct Pair { x: isize, y: isize } + +pub fn main() { + let nop: noption = noption::some::(5); + match nop { noption::some::(n) => { println!("{}", n); assert_eq!(n, 5); } } + let nop2: noption = noption::some(Pair{x: 17, y: 42}); + match nop2 { + noption::some(t) => { + println!("{}", t.x); + println!("{}", t.y); + assert_eq!(t.x, 17); + assert_eq!(t.y, 42); + } + } +} diff --git a/src/test/run-pass/generics/generic-tag.rs b/src/test/run-pass/generics/generic-tag.rs new file mode 100644 index 00000000000..54a006a163e --- /dev/null +++ b/src/test/run-pass/generics/generic-tag.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] +#![feature(box_syntax)] + +enum option { some(Box), none, } + +pub fn main() { + let mut a: option = option::some::(box 10); + a = option::none::; +} diff --git a/src/test/run-pass/generics/generic-temporary.rs b/src/test/run-pass/generics/generic-temporary.rs new file mode 100644 index 00000000000..32ff16710cf --- /dev/null +++ b/src/test/run-pass/generics/generic-temporary.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn mk() -> isize { return 1; } + +fn chk(a: isize) { println!("{}", a); assert_eq!(a, 1); } + +fn apply(produce: fn() -> T, + consume: fn(T)) { + consume(produce()); +} + +pub fn main() { + let produce: fn() -> isize = mk; + let consume: fn(v: isize) = chk; + apply::(produce, consume); +} diff --git a/src/test/run-pass/generics/generic-tup.rs b/src/test/run-pass/generics/generic-tup.rs new file mode 100644 index 00000000000..677e2f8349f --- /dev/null +++ b/src/test/run-pass/generics/generic-tup.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } + +pub fn main() { + println!("{}", get_third((1, 2, 3))); + assert_eq!(get_third((1, 2, 3)), 3); + assert_eq!(get_third((5u8, 6u8, 7u8)), 7u8); +} diff --git a/src/test/run-pass/generics/generic-type-synonym.rs b/src/test/run-pass/generics/generic-type-synonym.rs new file mode 100644 index 00000000000..518480301b9 --- /dev/null +++ b/src/test/run-pass/generics/generic-type-synonym.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +// pretty-expanded FIXME #23616 + +struct Foo { + a: T +} + +type Bar = Foo; + +fn takebar(_b: Bar) { } + +pub fn main() { } diff --git a/src/test/run-pass/generics/generic-type.rs b/src/test/run-pass/generics/generic-type.rs new file mode 100644 index 00000000000..4f83d437dc6 --- /dev/null +++ b/src/test/run-pass/generics/generic-type.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +struct Pair {x: T, y: T} + +pub fn main() { + let x: Pair = Pair {x: 10, y: 12}; + assert_eq!(x.x, 10); + assert_eq!(x.y, 12); +} diff --git a/src/test/run-pass/generics/generic-unique.rs b/src/test/run-pass/generics/generic-unique.rs new file mode 100644 index 00000000000..c21a0be3d39 --- /dev/null +++ b/src/test/run-pass/generics/generic-unique.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Triple { x: T, y: T, z: T } + +fn box_it(x: Triple) -> Box> { return box x; } + +pub fn main() { + let x: Box> = box_it::(Triple{x: 1, y: 2, z: 3}); + assert_eq!(x.y, 2); +} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs new file mode 100644 index 00000000000..641912269a1 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we handle binder levels in object types correctly. +// Initially, the reference to `'tcx` in the object type +// `&Typer<'tcx>` was getting an incorrect binder level, yielding +// weird compilation ICEs and so forth. + +// pretty-expanded FIXME #23616 + +trait Typer<'tcx> { + fn method(&self, data: &'tcx isize) -> &'tcx isize { data } +} + +struct Tcx<'tcx> { + fields: &'tcx isize +} + +impl<'tcx> Typer<'tcx> for Tcx<'tcx> { +} + +fn g<'tcx>(typer: &Typer<'tcx>) { +} + +fn check_static_type<'x>(tcx: &Tcx<'x>) { + g(tcx) +} + +fn main() { } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs new file mode 100644 index 00000000000..19c7c8c489a --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Typer<'tcx> { + fn method(&self, data: &'tcx isize) -> &'tcx isize { data } + fn dummy(&self) { } +} + +fn g(_: F) where F: FnOnce(&Typer) {} + +fn h() { + g(|typer| typer.dummy()) +} + +fn main() { } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs new file mode 100644 index 00000000000..bd61c42dd37 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A basic test of using a higher-ranked trait bound. + + +trait FnLike { + fn call(&self, arg: A) -> R; +} + +type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b; + +struct Identity; + +impl<'a, T> FnLike<&'a T, &'a T> for Identity { + fn call(&self, arg: &'a T) -> &'a T { + arg + } +} + +fn call_repeatedly(f: &FnObject) { + let x = 3; + let y = f.call(&x); + assert_eq!(3, *y); +} + +fn main() { + call_repeatedly(&Identity); +} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs new file mode 100644 index 00000000000..24ae5e1f343 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A basic test of using a higher-ranked trait bound. + + +trait FnLike { + fn call(&self, arg: A) -> R; +} + +struct Identity; + +impl<'a, T> FnLike<&'a T, &'a T> for Identity { + fn call(&self, arg: &'a T) -> &'a T { + arg + } +} + +fn call_repeatedly(f: F) + where F : for<'a> FnLike<&'a isize, &'a isize> +{ + let x = 3; + let y = f.call(&x); + assert_eq!(3, *y); +} + +fn main() { + call_repeatedly(Identity); +} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs new file mode 100644 index 00000000000..3eafc5aabda --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs @@ -0,0 +1,38 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we handle binder levels correctly when checking whether a +// type can implement `Copy`. In particular, we had a bug where we failed to +// liberate the late-bound regions from the impl, and thus wound up +// searching for an impl of `for<'tcx> Foo<&'tcx T>`. The impl that +// exists however is `impl Copy for Foo` and the current rules +// did not consider that a match (something I would like to revise in +// a later PR). + +#![allow(dead_code)] + +use std::marker::PhantomData; + +#[derive(Copy, Clone)] +struct Foo { x: T } + +type Ty<'tcx> = &'tcx TyS<'tcx>; + +enum TyS<'tcx> { + Boop(PhantomData<*mut &'tcx ()>) +} + +#[derive(Copy, Clone)] +enum Bar<'tcx> { + Baz(Foo>) +} + +fn main() { } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs new file mode 100644 index 00000000000..cdc83b04788 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-parse.rs @@ -0,0 +1,46 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can parse all the various places that a `for` keyword +// can appear representing universal quantification. + +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] +#![allow(dead_code)] + +trait Get { + fn get(&self, arg: A) -> R; +} + +// Parse HRTB with explicit `for` in a where-clause: + +fn foo00(t: T) + where T : for<'a> Get<&'a i32, &'a i32> +{ +} + +fn foo01 Get<&'a i32, &'a i32>>(t: T) +{ +} + +// Parse HRTB with explicit `for` in various sorts of types: + +fn foo10(t: Box Get>) { } +fn foo11(t: Box Fn(i32) -> i32>) { } + +fn foo20(t: for<'a> fn(i32) -> i32) { } +fn foo21(t: for<'a> unsafe fn(i32) -> i32) { } +fn foo22(t: for<'a> extern "C" fn(i32) -> i32) { } +fn foo23(t: for<'a> unsafe extern "C" fn(i32) -> i32) { } + +fn main() { +} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs new file mode 100644 index 00000000000..32abdde39ab --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +// Test that `F : Fn(isize) -> isize + Send` is interpreted as two +// distinct bounds on `F`. + +fn foo1(f: F) + where F : FnOnce(isize) -> isize + Send +{ + bar(f); +} + +fn foo2(f: F) + where F : FnOnce(isize) -> isize + Send +{ + baz(f); +} + +fn bar(f: F) { } + +fn baz isize>(f: F) { } + +fn main() {} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs new file mode 100644 index 00000000000..5d29115d35e --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) + +// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would +// cause a compilation error. Issue #18772. + +fn adder(y: isize) -> Box isize + 'static> { + Box::new(move |x| y + x) +} + +fn main() {} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs new file mode 100644 index 00000000000..3f940cd4cd7 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A basic test of using a higher-ranked trait bound. + +// pretty-expanded FIXME #23616 + +trait FnLike { + fn call(&self, arg: A) -> R; +} + +type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b; + +fn main() { +} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs new file mode 100644 index 00000000000..5dc548fd341 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A basic test of using a higher-ranked trait bound. + +trait FnLike { + fn call(&self, arg: A) -> R; +} + +type FnObject<'b> = for<'a> FnLike<(&'a i32,), &'a i32> + 'b; + +struct Identity; + +impl<'a, T> FnLike<(&'a T,), &'a T> for Identity { + fn call(&self, (arg,): (&'a T,)) -> &'a T { + arg + } +} + +fn call_repeatedly(f: &FnObject) { + let x = 3; + let y = f.call((&x,)); + assert_eq!(3, *y); +} + +fn main() { + call_repeatedly(&Identity); +} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs new file mode 100644 index 00000000000..2274fdc5684 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that `&PrinterSupport`, which is really short for `&'a +// PrinterSupport<'b>`, gets properly expanded when it appears in a +// closure type. This used to result in messed up De Bruijn indices. + +// pretty-expanded FIXME #23616 + +trait PrinterSupport<'ast> { + fn ast_map(&self) -> Option<&'ast usize> { None } +} + +struct NoAnn<'ast> { + f: Option<&'ast usize> +} + +impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> { +} + +fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&PrinterSupport) { + let annotation = NoAnn { f: f }; + g(&annotation) +} + +fn main() {} diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs new file mode 100644 index 00000000000..f36533629cd --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test what happens when a HR obligation is applied to an impl with +// "outlives" bounds. Currently we're pretty conservative here; this +// will probably improve in time. + +trait Foo { + fn foo(&self, x: X) { } +} + +fn want_foo() + where T : for<'a> Foo<&'a isize> +{ +} + +/////////////////////////////////////////////////////////////////////////// +// Expressed as a where clause + +struct SomeStruct { + x: X +} + +impl<'a,X> Foo<&'a isize> for SomeStruct + where X : 'a +{ +} + +fn one() { + want_foo::>(); +} + +/////////////////////////////////////////////////////////////////////////// +// Expressed as shorthand + +struct AnotherStruct { + x: X +} + +impl<'a,X:'a> Foo<&'a isize> for AnotherStruct +{ +} + +fn two() { + want_foo::>(); +} + +fn main() { } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs new file mode 100644 index 00000000000..56af5df0105 --- /dev/null +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test HRTB used with the `Fn` trait. + +fn foo(f: F) { + let x = 22; + f(&x); +} + +fn main() { + foo(|x: &isize| println!("{}", *x)); +} diff --git a/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs b/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs new file mode 100644 index 00000000000..75f81c56db2 --- /dev/null +++ b/src/test/run-pass/hygiene/auxiliary/legacy_interaction.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#[macro_export] +macro_rules! m { + () => { + fn f() {} // (2) + g(); // (1) + } +} diff --git a/src/test/run-pass/hygiene/auxiliary/my_crate.rs b/src/test/run-pass/hygiene/auxiliary/my_crate.rs new file mode 100644 index 00000000000..10dbaa9e9ad --- /dev/null +++ b/src/test/run-pass/hygiene/auxiliary/my_crate.rs @@ -0,0 +1,12 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn f() {} diff --git a/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs b/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs new file mode 100644 index 00000000000..589e8b579b7 --- /dev/null +++ b/src/test/run-pass/hygiene/auxiliary/unhygienic_example.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![crate_type = "lib"] + +extern crate my_crate; + +pub fn g() {} // (a) + +#[macro_export] +macro_rules! unhygienic_macro { + () => { + // (1) unhygienic: depends on `my_crate` in the crate root at the invocation site. + ::my_crate::f(); + + // (2) unhygienic: defines `f` at the invocation site (in addition to the above point). + use my_crate::f; + f(); + + g(); // (3) unhygienic: `g` needs to be in scope at use site. + + $crate::g(); // (4) hygienic: this always resolves to (a) + } +} + +#[allow(unused)] +fn test_unhygienic() { + unhygienic_macro!(); + f(); // `f` was defined at the use site +} diff --git a/src/test/run-pass/hygiene/auxiliary/xcrate.rs b/src/test/run-pass/hygiene/auxiliary/xcrate.rs new file mode 100644 index 00000000000..f469d87f423 --- /dev/null +++ b/src/test/run-pass/hygiene/auxiliary/xcrate.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(decl_macro)] +#![allow(unused)] + +pub use bar::test; + +extern crate std as foo; + +pub fn f() {} +use f as f2; + +mod bar { + pub fn g() {} + use baz::h; + + pub macro test() { + use std::mem; + use foo::cell; + ::f(); + ::f2(); + g(); + h(); + ::bar::h(); + } +} + +mod baz { + pub fn h() {} +} diff --git a/src/test/run-pass/hygiene/hygiene-dodging-1.rs b/src/test/run-pass/hygiene/hygiene-dodging-1.rs new file mode 100644 index 00000000000..bbb46d85d18 --- /dev/null +++ b/src/test/run-pass/hygiene/hygiene-dodging-1.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod x { + pub fn g() -> usize {14} +} + +pub fn main(){ + // should *not* shadow the module x: + let x = 9; + // use it to avoid warnings: + x+3; + assert_eq!(x::g(),14); +} diff --git a/src/test/run-pass/hygiene/hygiene.rs b/src/test/run-pass/hygiene/hygiene.rs new file mode 100644 index 00000000000..c6b5f9c3974 --- /dev/null +++ b/src/test/run-pass/hygiene/hygiene.rs @@ -0,0 +1,124 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused)] + +fn f() { + let x = 0; + macro_rules! foo { () => { + assert_eq!(x, 0); + } } + + let x = 1; + foo!(); +} + +fn g() { + let x = 0; + macro_rules! m { ($m1:ident, $m2:ident, $x:ident) => { + macro_rules! $m1 { () => { ($x, x) } } + let x = 1; + macro_rules! $m2 { () => { ($x, x) } } + } } + + let x = 2; + m!(m2, m3, x); + + let x = 3; + assert_eq!(m2!(), (2, 0)); + assert_eq!(m3!(), (2, 1)); + + let x = 4; + m!(m4, m5, x); + assert_eq!(m4!(), (4, 0)); + assert_eq!(m5!(), (4, 1)); +} + +mod foo { + macro_rules! m { + ($f:ident : |$x:ident| $e:expr) => { + pub fn $f() -> (i32, i32) { + let x = 0; + let $x = 1; + (x, $e) + } + } + } + + m!(f: |x| x + 10); +} + +fn interpolated_pattern() { + let x = 0; + macro_rules! m { + ($p:pat, $e:expr) => { + let $p = 1; + assert_eq!((x, $e), (0, 1)); + } + } + + m!(x, x); +} + +fn patterns_in_macro_generated_macros() { + let x = 0; + macro_rules! m { + ($a:expr, $b:expr) => { + assert_eq!(x, 0); + let x = $a; + macro_rules! n { + () => { + (x, $b) + } + } + } + } + + let x = 1; + m!(2, x); + + let x = 3; + assert_eq!(n!(), (2, 1)); +} + +fn match_hygiene() { + let x = 0; + + macro_rules! m { + ($p:pat, $e:expr) => { + for result in &[Ok(1), Err(1)] { + match *result { + $p => { assert_eq!(($e, x), (1, 0)); } + Err(x) => { assert_eq!(($e, x), (2, 1)); } + } + } + } + } + + let x = 2; + m!(Ok(x), x); +} + +fn label_hygiene() { + 'a: loop { + macro_rules! m { () => { break 'a; } } + m!(); + } +} + +fn main() { + f(); + g(); + assert_eq!(foo::f(), (0, 11)); + interpolated_pattern(); + patterns_in_macro_generated_macros(); + match_hygiene(); +} diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs new file mode 100644 index 00000000000..d68809a1c6e --- /dev/null +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs @@ -0,0 +1,83 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that labels injected by macros do not break hygiene. This +// checks cases where the macros invocations are under the rhs of a +// let statement. + +// Issue #24278: The label/lifetime shadowing checker from #24162 +// conservatively ignores hygiene, and thus issues warnings that are +// both true- and false-positives for this test. + +macro_rules! loop_x { + ($e: expr) => { + // $e shouldn't be able to interact with this 'x + 'x: loop { $e } + } +} + +macro_rules! while_true { + ($e: expr) => { + // $e shouldn't be able to interact with this 'x + 'x: while 1 + 1 == 2 { $e } + } +} + +macro_rules! run_once { + ($e: expr) => { + // ditto + 'x: for _ in 0..1 { $e } + } +} + +pub fn main() { + let mut i = 0; + + let j: isize = { + 'x: loop { + // this 'x should refer to the outer loop, lexically + loop_x!(break 'x); + i += 1; + } + i + 1 + }; + assert_eq!(j, 1); + + let k: isize = { + 'x: for _ in 0..1 { + // ditto + loop_x!(break 'x); + i += 1; + } + i + 1 + }; + assert_eq!(k, 1); + + let l: isize = { + 'x: for _ in 0..1 { + // ditto + while_true!(break 'x); + i += 1; + } + i + 1 + }; + assert_eq!(l, 1); + + let n: isize = { + 'x: for _ in 0..1 { + // ditto + run_once!(continue 'x); + i += 1; + } + i + 1 + }; + assert_eq!(n, 1); +} diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr b/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr new file mode 100644 index 00000000000..d96b99746a7 --- /dev/null +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr @@ -0,0 +1,300 @@ +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +LL | // this 'x should refer to the outer loop, lexically +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:55:9 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:55:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ + | | + | first declared here + | lifetime 'x already in scope +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:23:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:65:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:30:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | while_true!(break 'x); + | ---------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:75:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels-in-let.rs:37:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + diff --git a/src/test/run-pass/hygiene/hygienic-labels.rs b/src/test/run-pass/hygiene/hygienic-labels.rs new file mode 100644 index 00000000000..723ffb30b7f --- /dev/null +++ b/src/test/run-pass/hygiene/hygienic-labels.rs @@ -0,0 +1,62 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that labels injected by macros do not break hygiene. + +// Issue #24278: The label/lifetime shadowing checker from #24162 +// conservatively ignores hygiene, and thus issues warnings that are +// both true- and false-positives for this test. + +macro_rules! loop_x { + ($e: expr) => { + // $e shouldn't be able to interact with this 'x + 'x: loop { $e } + } +} + +macro_rules! run_once { + ($e: expr) => { + // ditto + 'x: for _ in 0..1 { $e } + } +} + +macro_rules! while_x { + ($e: expr) => { + // ditto + 'x: while 1 + 1 == 2 { $e } + } +} + +pub fn main() { + 'x: for _ in 0..1 { + // this 'x should refer to the outer loop, lexically + loop_x!(break 'x); + panic!("break doesn't act hygienically inside for loop"); + } + + 'x: loop { + // ditto + loop_x!(break 'x); + panic!("break doesn't act hygienically inside infinite loop"); + } + + 'x: while 1 + 1 == 2 { + while_x!(break 'x); + panic!("break doesn't act hygienically inside infinite while loop"); + } + + 'x: for _ in 0..1 { + // ditto + run_once!(continue 'x); + panic!("continue doesn't act hygienically inside for loop"); + } +} diff --git a/src/test/run-pass/hygiene/hygienic-labels.stderr b/src/test/run-pass/hygiene/hygienic-labels.stderr new file mode 100644 index 00000000000..45c0cacde9a --- /dev/null +++ b/src/test/run-pass/hygiene/hygienic-labels.stderr @@ -0,0 +1,299 @@ +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // this 'x should refer to the outer loop, lexically +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:46:5 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: loop { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:46:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: loop { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ + | | + | first declared here + | lifetime 'x already in scope +... +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:21:9 + | +LL | 'x: loop { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +LL | // ditto +LL | loop_x!(break 'x); + | ------------------ in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:52:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:35:9 + | +LL | 'x: while 1 + 1 == 2 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: while 1 + 1 == 2 { + | -- first declared here +LL | while_x!(break 'x); + | ------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: loop { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: while 1 + 1 == 2 { + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:57:5 + | +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { + | ^^ lifetime 'x already in scope + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: loop { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: loop { $e } + | -- first declared here +... +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: while 1 + 1 == 2 { + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: while 1 + 1 == 2 { $e } + | -- first declared here +... +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + +warning: label name `'x` shadows a label name that is already in scope + --> $DIR/hygienic-labels.rs:28:9 + | +LL | 'x: for _ in 0..1 { $e } + | ^^ lifetime 'x already in scope +... +LL | 'x: for _ in 0..1 { + | -- first declared here +LL | // ditto +LL | run_once!(continue 'x); + | ----------------------- in this macro invocation + diff --git a/src/test/run-pass/hygiene/issue-44128.rs b/src/test/run-pass/hygiene/issue-44128.rs new file mode 100644 index 00000000000..879cd851434 --- /dev/null +++ b/src/test/run-pass/hygiene/issue-44128.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(decl_macro)] + +pub macro create_struct($a:ident) { + struct $a; + impl Clone for $a { + fn clone(&self) -> Self { + $a + } + } +} + +fn main() { + create_struct!(Test); + Test.clone(); +} diff --git a/src/test/run-pass/hygiene/issue-47311.rs b/src/test/run-pass/hygiene/issue-47311.rs new file mode 100644 index 00000000000..43c4fc747e7 --- /dev/null +++ b/src/test/run-pass/hygiene/issue-47311.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] +#![allow(unused)] + +macro m($S:ident, $x:ident) { + $S { $x: 0 } +} + +mod foo { + struct S { x: i32 } + + fn f() { ::m!(S, x); } +} + +fn main() {} diff --git a/src/test/run-pass/hygiene/issue-47312.rs b/src/test/run-pass/hygiene/issue-47312.rs new file mode 100644 index 00000000000..68166912f5f --- /dev/null +++ b/src/test/run-pass/hygiene/issue-47312.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] +#![allow(unused)] + +mod foo { + pub macro m($s:tt, $i:tt) { + $s.$i + } +} + +mod bar { + struct S(i32); + fn f() { + let s = S(0); + ::foo::m!(s, 0); + } +} + +fn main() {} diff --git a/src/test/run-pass/hygiene/items.rs b/src/test/run-pass/hygiene/items.rs new file mode 100644 index 00000000000..1c215523892 --- /dev/null +++ b/src/test/run-pass/hygiene/items.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] + +pub macro m($foo:ident, $f:ident, $e:expr) { + mod foo { + pub fn f() -> u32 { 0 } + pub fn $f() -> u64 { 0 } + } + + mod $foo { + pub fn f() -> i32 { 0 } + pub fn $f() -> i64 { 0 } + } + + let _: u32 = foo::f(); + let _: u64 = foo::$f(); + let _: i32 = $foo::f(); + let _: i64 = $foo::$f(); + let _: i64 = $e; +} + +fn main() { + m!(foo, f, foo::f()); + let _: i64 = foo::f(); +} diff --git a/src/test/run-pass/hygiene/legacy_interaction.rs b/src/test/run-pass/hygiene/legacy_interaction.rs new file mode 100644 index 00000000000..d0845b5802b --- /dev/null +++ b/src/test/run-pass/hygiene/legacy_interaction.rs @@ -0,0 +1,51 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +// aux-build:legacy_interaction.rs + +#![feature(decl_macro)] +#[allow(unused)] + +extern crate legacy_interaction; +// ^ defines +// ```rust +// macro_rules! m { +// () => { +// fn f() // (1) +// g() // (2) +// } +// } +// ```rust + +mod def_site { + // Unless this macro opts out of hygiene, it should resolve the same wherever it is invoked. + pub macro m2() { + ::legacy_interaction::m!(); + f(); // This should resolve to (1) + fn g() {} // We want (2) resolve to this, not to (4) + } +} + +mod use_site { + fn test() { + fn f() -> bool { true } // (3) + fn g() -> bool { true } // (4) + + ::def_site::m2!(); + + let _: bool = f(); // This should resolve to (3) + let _: bool = g(); // This should resolve to (4) + } +} + +fn main() {} diff --git a/src/test/run-pass/hygiene/lexical.rs b/src/test/run-pass/hygiene/lexical.rs new file mode 100644 index 00000000000..9dc116d3af7 --- /dev/null +++ b/src/test/run-pass/hygiene/lexical.rs @@ -0,0 +1,34 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] + +mod bar { + mod baz { + pub fn f() {} + } + + pub macro m($f:ident) { + baz::f(); + let _: i32 = $f(); + { + fn $f() -> u32 { 0 } + let _: u32 = $f(); + } + } +} + +fn main() { + fn f() -> i32 { 0 } + bar::m!(f); +} diff --git a/src/test/run-pass/hygiene/specialization.rs b/src/test/run-pass/hygiene/specialization.rs new file mode 100644 index 00000000000..a1ab5b78ca0 --- /dev/null +++ b/src/test/run-pass/hygiene/specialization.rs @@ -0,0 +1,35 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] + +trait Tr { + fn f(&self) -> &'static str { + "This shouldn't happen" + } +} + +pub macro m($t:ty) { + impl Tr for $t { + fn f(&self) -> &'static str { + "Run me" + } + } +} + +struct S; +m!(S); + +fn main() { + assert_eq!(S.f(), "Run me"); +} diff --git a/src/test/run-pass/hygiene/trait_items.rs b/src/test/run-pass/hygiene/trait_items.rs new file mode 100644 index 00000000000..4007f5b5c8f --- /dev/null +++ b/src/test/run-pass/hygiene/trait_items.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] + +macro m($T:ident, $f:ident) { + pub trait $T { + fn f(&self) -> u32 { 0 } + fn $f(&self) -> i32 { 0 } + } + impl $T for () {} + + let _: u32 = ().f(); + let _: i32 = ().$f(); +} + +fn main() { + m!(T, f); + let _: i32 = ().f(); +} diff --git a/src/test/run-pass/hygiene/ty_params.rs b/src/test/run-pass/hygiene/ty_params.rs new file mode 100644 index 00000000000..a057f2fc5ce --- /dev/null +++ b/src/test/run-pass/hygiene/ty_params.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +#![feature(decl_macro)] + +macro m($T:ident) { + fn f(t: T, t2: $T) -> (T, $T) { + (t, t2) + } +} + +m!(T); + +fn main() {} diff --git a/src/test/run-pass/hygiene/wrap_unhygienic_example.rs b/src/test/run-pass/hygiene/wrap_unhygienic_example.rs new file mode 100644 index 00000000000..9516bfe50b6 --- /dev/null +++ b/src/test/run-pass/hygiene/wrap_unhygienic_example.rs @@ -0,0 +1,44 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +// aux-build:my_crate.rs +// aux-build:unhygienic_example.rs + +#![feature(decl_macro)] + +extern crate unhygienic_example; +extern crate my_crate; // (b) + +// Hygienic version of `unhygienic_macro`. +pub macro hygienic_macro() { + fn g() {} // (c) + ::unhygienic_example::unhygienic_macro!(); + // ^ Even though we invoke an unhygienic macro, `hygienic_macro` remains hygienic. + // In the above expansion: + // (1) `my_crate` always resolves to (b) regardless of invocation site. + // (2) The defined function `f` is only usable inside this macro definition. + // (3) `g` always resolves to (c) regardless of invocation site. + // (4) `$crate::g` remains hygienic and continues to resolve to (a). + + f(); +} + +#[allow(unused)] +fn test_hygienic_macro() { + hygienic_macro!(); + + fn f() {} // (d) no conflict + f(); // resolves to (d) +} + +fn main() {} diff --git a/src/test/run-pass/hygiene/xcrate.rs b/src/test/run-pass/hygiene/xcrate.rs new file mode 100644 index 00000000000..3e330fe3862 --- /dev/null +++ b/src/test/run-pass/hygiene/xcrate.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty pretty-printing is unhygienic + +// aux-build:xcrate.rs + +#![feature(decl_macro)] + +extern crate xcrate; + +fn main() { + xcrate::test!(); +} diff --git a/src/test/run-pass/impl-trait/auto-trait-leak.rs b/src/test/run-pass/impl-trait/auto-trait-leak.rs new file mode 100644 index 00000000000..fb252b01f85 --- /dev/null +++ b/src/test/run-pass/impl-trait/auto-trait-leak.rs @@ -0,0 +1,31 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Fast path, main can see the concrete type returned. +fn before() -> impl FnMut(i32) { + let mut p = Box::new(0); + move |x| *p = x +} + +fn send(_: T) {} + +fn main() { + send(before()); + send(after()); +} + +// Deferred path, main has to wait until typeck finishes, +// to check if the return type of after is Send. +fn after() -> impl FnMut(i32) { + let mut p = Box::new(0); + move |x| *p = x +} diff --git a/src/test/run-pass/impl-trait/auxiliary/xcrate.rs b/src/test/run-pass/impl-trait/auxiliary/xcrate.rs new file mode 100644 index 00000000000..c57c1cfe74f --- /dev/null +++ b/src/test/run-pass/impl-trait/auxiliary/xcrate.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// NOTE commented out due to issue #45994 +//pub fn fourway_add(a: i32) -> impl Fn(i32) -> impl Fn(i32) -> impl Fn(i32) -> i32 { +// move |b| move |c| move |d| a + b + c + d +//} + +fn some_internal_fn() -> u32 { + 1 +} + +fn other_internal_fn() -> u32 { + 1 +} + +// See #40839 +pub fn return_closure_accessing_internal_fn() -> impl Fn() -> u32 { + || { + some_internal_fn() + 1 + } +} + +pub fn return_internal_fn() -> impl Fn() -> u32 { + other_internal_fn +} diff --git a/src/test/run-pass/impl-trait/bounds_regression.rs b/src/test/run-pass/impl-trait/bounds_regression.rs new file mode 100644 index 00000000000..b6abfdebfa8 --- /dev/null +++ b/src/test/run-pass/impl-trait/bounds_regression.rs @@ -0,0 +1,34 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub trait FakeGenerator { + type Yield; + type Return; +} + +pub trait FakeFuture { + type Output; +} + +pub fn future_from_generator< + T: FakeGenerator +>(x: T) -> impl FakeFuture { + GenFuture(x) +} + +struct GenFuture>(T); + +impl> FakeFuture for GenFuture { + type Output = T::Return; +} + +fn main() {} diff --git a/src/test/run-pass/impl-trait/equality.rs b/src/test/run-pass/impl-trait/equality.rs new file mode 100644 index 00000000000..5026f10b6f8 --- /dev/null +++ b/src/test/run-pass/impl-trait/equality.rs @@ -0,0 +1,58 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +trait Foo: std::fmt::Debug + Eq {} + +impl Foo for T {} + +fn hide(x: T) -> impl Foo { + x +} + +trait Leak: Sized { + fn leak(self) -> T; +} +impl Leak for U { + default fn leak(self) -> T { panic!("type mismatch") } +} +impl Leak for T { + fn leak(self) -> T { self } +} + +trait CheckIfSend: Sized { + type T: Default; + fn check(self) -> Self::T { Default::default() } +} +impl CheckIfSend for T { + default type T = (); +} +impl CheckIfSend for T { + type T = bool; +} + +fn lucky_seven() -> impl Fn(usize) -> u8 { + let a = [1, 2, 3, 4, 5, 6, 7]; + move |i| a[i] +} + +fn main() { + assert_eq!(hide(42), hide(42)); + + assert_eq!(std::mem::size_of_val(&hide([0_u8; 5])), 5); + assert_eq!(std::mem::size_of_val(&lucky_seven()), 7); + + assert_eq!(Leak::::leak(hide(5_i32)), 5_i32); + + assert_eq!(CheckIfSend::check(hide(0_i32)), false); +} diff --git a/src/test/run-pass/impl-trait/example-calendar.rs b/src/test/run-pass/impl-trait/example-calendar.rs new file mode 100644 index 00000000000..6cf06d15621 --- /dev/null +++ b/src/test/run-pass/impl-trait/example-calendar.rs @@ -0,0 +1,894 @@ +// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// revisions: normal nll +//[nll] compile-flags:-Zborrowck=mir + +#![feature(fn_traits, + step_trait, + unboxed_closures, +)] + +//! Derived from: . +//! +//! Originally converted to Rust by [Daniel Keep](https://github.com/DanielKeep). + +use std::fmt::Write; +use std::mem; + +/// Date representation. +#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +struct NaiveDate(i32, u32, u32); + +impl NaiveDate { + pub fn from_ymd(y: i32, m: u32, d: u32) -> NaiveDate { + assert!(1 <= m && m <= 12, "m = {:?}", m); + assert!(1 <= d && d <= NaiveDate(y, m, 1).days_in_month(), "d = {:?}", d); + NaiveDate(y, m, d) + } + + pub fn year(&self) -> i32 { + self.0 + } + + pub fn month(&self) -> u32 { + self.1 + } + + pub fn day(&self) -> u32 { + self.2 + } + + pub fn succ(&self) -> NaiveDate { + let (mut y, mut m, mut d, n) = ( + self.year(), self.month(), self.day()+1, self.days_in_month()); + if d > n { + d = 1; + m += 1; + } + if m > 12 { + m = 1; + y += 1; + } + NaiveDate::from_ymd(y, m, d) + } + + pub fn weekday(&self) -> Weekday { + use Weekday::*; + + // 0 = Sunday + let year = self.year(); + let dow_jan_1 = (year*365 + ((year-1) / 4) - ((year-1) / 100) + ((year-1) / 400)) % 7; + let dow = (dow_jan_1 + (self.day_of_year() as i32 - 1)) % 7; + [Sun, Mon, Tue, Wed, Thu, Fri, Sat][dow as usize] + } + + pub fn isoweekdate(&self) -> (i32, u32, Weekday) { + let first_dow_mon_0 = self.year_first_day_of_week().num_days_from_monday(); + + // Work out this date's DOtY and week number, not including year adjustment. + let doy_0 = self.day_of_year() - 1; + let mut week_mon_0: i32 = ((first_dow_mon_0 + doy_0) / 7) as i32; + + if self.first_week_in_prev_year() { + week_mon_0 -= 1; + } + + let weeks_in_year = self.last_week_number(); + + // Work out the final result. + // If the week is -1 or >= weeks_in_year, we will need to adjust the year. + let year = self.year(); + let wd = self.weekday(); + + if week_mon_0 < 0 { + (year - 1, NaiveDate::from_ymd(year - 1, 1, 1).last_week_number(), wd) + } else if week_mon_0 >= weeks_in_year as i32 { + (year + 1, (week_mon_0 + 1 - weeks_in_year as i32) as u32, wd) + } else { + (year, (week_mon_0 + 1) as u32, wd) + } + } + + fn first_week_in_prev_year(&self) -> bool { + let first_dow_mon_0 = self.year_first_day_of_week().num_days_from_monday(); + + // Any day in the year *before* the first Monday of that year + // is considered to be in the last week of the previous year, + // assuming the first week has *less* than four days in it. + // Adjust the week appropriately. + ((7 - first_dow_mon_0) % 7) < 4 + } + + fn year_first_day_of_week(&self) -> Weekday { + NaiveDate::from_ymd(self.year(), 1, 1).weekday() + } + + fn weeks_in_year(&self) -> u32 { + let days_in_last_week = self.year_first_day_of_week().num_days_from_monday() + 1; + if days_in_last_week >= 4 { 53 } else { 52 } + } + + fn last_week_number(&self) -> u32 { + let wiy = self.weeks_in_year(); + if self.first_week_in_prev_year() { wiy - 1 } else { wiy } + } + + fn day_of_year(&self) -> u32 { + (1..self.1).map(|m| NaiveDate::from_ymd(self.year(), m, 1).days_in_month()) + .fold(0, |a,b| a+b) + self.day() + } + + fn is_leap_year(&self) -> bool { + let year = self.year(); + if year % 4 != 0 { + return false + } else if year % 100 != 0 { + return true + } else if year % 400 != 0 { + return false + } else { + return true + } + } + + fn days_in_month(&self) -> u32 { + match self.month() { + /* Jan */ 1 => 31, + /* Feb */ 2 => if self.is_leap_year() { 29 } else { 28 }, + /* Mar */ 3 => 31, + /* Apr */ 4 => 30, + /* May */ 5 => 31, + /* Jun */ 6 => 30, + /* Jul */ 7 => 31, + /* Aug */ 8 => 31, + /* Sep */ 9 => 30, + /* Oct */ 10 => 31, + /* Nov */ 11 => 30, + /* Dec */ 12 => 31, + _ => unreachable!() + } + } +} + +impl<'a, 'b> std::ops::Add<&'b NaiveDate> for &'a NaiveDate { + type Output = NaiveDate; + + fn add(self, other: &'b NaiveDate) -> NaiveDate { + assert_eq!(*other, NaiveDate(0, 0, 1)); + self.succ() + } +} + +impl std::iter::Step for NaiveDate { + fn steps_between(_: &Self, _: &Self) -> Option { + unimplemented!() + } + + fn replace_one(&mut self) -> Self { + mem::replace(self, NaiveDate(0, 0, 1)) + } + + fn replace_zero(&mut self) -> Self { + mem::replace(self, NaiveDate(0, 0, 0)) + } + + fn add_one(&self) -> Self { + self.succ() + } + + fn sub_one(&self) -> Self { + unimplemented!() + } + + fn add_usize(&self, _: usize) -> Option { + unimplemented!() + } +} + +#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +pub enum Weekday { + Mon, + Tue, + Wed, + Thu, + Fri, + Sat, + Sun, +} + +impl Weekday { + pub fn num_days_from_monday(&self) -> u32 { + use Weekday::*; + match *self { + Mon => 0, + Tue => 1, + Wed => 2, + Thu => 3, + Fri => 4, + Sat => 5, + Sun => 6, + } + } + + pub fn num_days_from_sunday(&self) -> u32 { + use Weekday::*; + match *self { + Sun => 0, + Mon => 1, + Tue => 2, + Wed => 3, + Thu => 4, + Fri => 5, + Sat => 6, + } + } +} + +/// GroupBy implementation. +struct GroupBy { + it: std::iter::Peekable, + f: F, +} + +impl Clone for GroupBy +where + It: Iterator + Clone, + It::Item: Clone, + F: Clone, +{ + fn clone(&self) -> Self { + GroupBy { + it: self.it.clone(), + f: self.f.clone(), + } + } +} + +impl<'a, G, It: 'a, F: 'a> Iterator for GroupBy +where It: Iterator + Clone, + It::Item: Clone, + F: Clone + FnMut(&It::Item) -> G, + G: Eq + Clone +{ + type Item = (G, InGroup, F, G>); + + fn next(&mut self) -> Option { + self.it.peek().map(&mut self.f).map(|key| { + let start = self.it.clone(); + while let Some(k) = self.it.peek().map(&mut self.f) { + if key != k { + break; + } + self.it.next(); + } + + (key.clone(), InGroup { + it: start, + f: self.f.clone(), + g: key + }) + }) + } +} + +#[derive(Copy, Clone)] +struct InGroup { + it: It, + f: F, + g: G +} + +impl G, G: Eq> Iterator for InGroup { + type Item = It::Item; + + fn next(&mut self) -> Option { + self.it.next().and_then(|x| { + if (self.f)(&x) == self.g { Some(x) } else { None } + }) + } +} + +trait IteratorExt: Iterator + Sized { + fn group_by(self, f: F) -> GroupBy + where F: Clone + FnMut(&Self::Item) -> G, + G: Eq + { + GroupBy { it: self.peekable(), f } + } + + fn join(mut self, sep: &str) -> String + where Self::Item: std::fmt::Display { + let mut s = String::new(); + if let Some(e) = self.next() { + write!(s, "{}", e); + for e in self { + s.push_str(sep); + write!(s, "{}", e); + } + } + s + } + + // HACK(eddyb) Only needed because `impl Trait` can't be + // used with trait methods: `.foo()` becomes `.__(foo)`. + fn __(self, f: F) -> R + where F: FnOnce(Self) -> R { + f(self) + } +} + +impl IteratorExt for It where It: Iterator {} + +/// +/// Generates an iterator that yields exactly n spaces. +/// +fn spaces(n: usize) -> std::iter::Take> { + std::iter::repeat(' ').take(n) +} + +fn test_spaces() { + assert_eq!(spaces(0).collect::(), ""); + assert_eq!(spaces(10).collect::(), " ") +} + +/// +/// Returns an iterator of dates in a given year. +/// +fn dates_in_year(year: i32) -> impl Iterator+Clone { + InGroup { + it: NaiveDate::from_ymd(year, 1, 1).., + f: |d: &NaiveDate| d.year(), + g: year + } +} + +fn test_dates_in_year() { + { + let mut dates = dates_in_year(2013); + assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 1))); + + // Check increment + assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 2))); + + // Check monthly rollover + for _ in 3..31 { + assert!(dates.next() != None); + } + + assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 31))); + assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 2, 1))); + } + + { + // Check length of year + let mut dates = dates_in_year(2013); + for _ in 0..365 { + assert!(dates.next() != None); + } + assert_eq!(dates.next(), None); + } + + { + // Check length of leap year + let mut dates = dates_in_year(1984); + for _ in 0..366 { + assert!(dates.next() != None); + } + assert_eq!(dates.next(), None); + } +} + +/// +/// Convenience trait for verifying that a given type iterates over +/// `NaiveDate`s. +/// +trait DateIterator: Iterator + Clone {} +impl DateIterator for It where It: Iterator + Clone {} + +fn test_group_by() { + let input = [ + [1, 1], + [1, 1], + [1, 2], + [2, 2], + [2, 3], + [2, 3], + [3, 3] + ]; + + let by_x = input.iter().cloned().group_by(|a| a[0]); + let expected_1: &[&[[i32; 2]]] = &[ + &[[1, 1], [1, 1], [1, 2]], + &[[2, 2], [2, 3], [2, 3]], + &[[3, 3]] + ]; + for ((_, a), b) in by_x.zip(expected_1.iter().cloned()) { + assert_eq!(&a.collect::>()[..], b); + } + + let by_y = input.iter().cloned().group_by(|a| a[1]); + let expected_2: &[&[[i32; 2]]] = &[ + &[[1, 1], [1, 1]], + &[[1, 2], [2, 2]], + &[[2, 3], [2, 3], [3, 3]] + ]; + for ((_, a), b) in by_y.zip(expected_2.iter().cloned()) { + assert_eq!(&a.collect::>()[..], b); + } +} + +/// +/// Groups an iterator of dates by month. +/// +fn by_month(it: impl Iterator + Clone) + -> impl Iterator + Clone)> + Clone +{ + it.group_by(|d| d.month()) +} + +fn test_by_month() { + let mut months = dates_in_year(2013).__(by_month); + for (month, (_, mut date)) in (1..13).zip(&mut months) { + assert_eq!(date.nth(0).unwrap(), NaiveDate::from_ymd(2013, month, 1)); + } + assert!(months.next().is_none()); +} + +/// +/// Groups an iterator of dates by week. +/// +fn by_week(it: impl DateIterator) + -> impl Iterator + Clone +{ + // We go forward one day because `isoweekdate` considers the week to start on a Monday. + it.group_by(|d| d.succ().isoweekdate().1) +} + +fn test_isoweekdate() { + fn weeks_uniq(year: i32) -> Vec<((i32, u32), u32)> { + let mut weeks = dates_in_year(year).map(|d| d.isoweekdate()) + .map(|(y,w,_)| (y,w)); + let mut result = vec![]; + let mut accum = (weeks.next().unwrap(), 1); + for yw in weeks { + if accum.0 == yw { + accum.1 += 1; + } else { + result.push(accum); + accum = (yw, 1); + } + } + result.push(accum); + result + } + + let wu_1984 = weeks_uniq(1984); + assert_eq!(&wu_1984[..2], &[((1983, 52), 1), ((1984, 1), 7)]); + assert_eq!(&wu_1984[wu_1984.len()-2..], &[((1984, 52), 7), ((1985, 1), 1)]); + + let wu_2013 = weeks_uniq(2013); + assert_eq!(&wu_2013[..2], &[((2013, 1), 6), ((2013, 2), 7)]); + assert_eq!(&wu_2013[wu_2013.len()-2..], &[((2013, 52), 7), ((2014, 1), 2)]); + + let wu_2015 = weeks_uniq(2015); + assert_eq!(&wu_2015[..2], &[((2015, 1), 4), ((2015, 2), 7)]); + assert_eq!(&wu_2015[wu_2015.len()-2..], &[((2015, 52), 7), ((2015, 53), 4)]); +} + +fn test_by_week() { + let mut weeks = dates_in_year(2013).__(by_week); + assert_eq!( + &*weeks.next().unwrap().1.collect::>(), + &[ + NaiveDate::from_ymd(2013, 1, 1), + NaiveDate::from_ymd(2013, 1, 2), + NaiveDate::from_ymd(2013, 1, 3), + NaiveDate::from_ymd(2013, 1, 4), + NaiveDate::from_ymd(2013, 1, 5), + ] + ); + assert_eq!( + &*weeks.next().unwrap().1.collect::>(), + &[ + NaiveDate::from_ymd(2013, 1, 6), + NaiveDate::from_ymd(2013, 1, 7), + NaiveDate::from_ymd(2013, 1, 8), + NaiveDate::from_ymd(2013, 1, 9), + NaiveDate::from_ymd(2013, 1, 10), + NaiveDate::from_ymd(2013, 1, 11), + NaiveDate::from_ymd(2013, 1, 12), + ] + ); + assert_eq!(weeks.next().unwrap().1.nth(0).unwrap(), NaiveDate::from_ymd(2013, 1, 13)); +} + +/// The number of columns per day in the formatted output. +const COLS_PER_DAY: u32 = 3; + +/// The number of columns per week in the formatted output. +const COLS_PER_WEEK: u32 = 7 * COLS_PER_DAY; + +/// +/// Formats an iterator of weeks into an iterator of strings. +/// +fn format_weeks(it: impl Iterator) -> impl Iterator { + it.map(|week| { + let mut buf = String::with_capacity((COLS_PER_DAY * COLS_PER_WEEK + 2) as usize); + + // Format each day into its own cell and append to target string. + let mut last_day = 0; + let mut first = true; + for d in week { + last_day = d.weekday().num_days_from_sunday(); + + // Insert enough filler to align the first day with its respective day-of-week. + if first { + buf.extend(spaces((COLS_PER_DAY * last_day) as usize)); + first = false; + } + + write!(buf, " {:>2}", d.day()); + } + + // Insert more filler at the end to fill up the remainder of the week, + // if its a short week (e.g. at the end of the month). + buf.extend(spaces((COLS_PER_DAY * (6 - last_day)) as usize)); + buf + }) +} + +fn test_format_weeks() { + let jan_2013 = dates_in_year(2013) + .__(by_month).next() // pick January 2013 for testing purposes + // NOTE: This `map` is because `next` returns an `Option<_>`. + .map(|(_, month)| + month.__(by_week) + .map(|(_, weeks)| weeks) + .__(format_weeks) + .join("\n")); + + assert_eq!( + jan_2013.as_ref().map(|s| &**s), + Some(" 1 2 3 4 5\n\ + \x20 6 7 8 9 10 11 12\n\ + \x2013 14 15 16 17 18 19\n\ + \x2020 21 22 23 24 25 26\n\ + \x2027 28 29 30 31 ") + ); +} + +/// +/// Formats the name of a month, centered on COLS_PER_WEEK. +/// +fn month_title(month: u32) -> String { + const MONTH_NAMES: &'static [&'static str] = &[ + "January", "February", "March", "April", "May", "June", + "July", "August", "September", "October", "November", "December" + ]; + assert_eq!(MONTH_NAMES.len(), 12); + + // Determine how many spaces before and after the month name + // we need to center it over the formatted weeks in the month. + let name = MONTH_NAMES[(month - 1) as usize]; + assert!(name.len() < COLS_PER_WEEK as usize); + let before = (COLS_PER_WEEK as usize - name.len()) / 2; + let after = COLS_PER_WEEK as usize - name.len() - before; + + // NOTE: Being slightly more verbose to avoid extra allocations. + let mut result = String::with_capacity(COLS_PER_WEEK as usize); + result.extend(spaces(before)); + result.push_str(name); + result.extend(spaces(after)); + result +} + +fn test_month_title() { + assert_eq!(month_title(1).len(), COLS_PER_WEEK as usize); +} + +/// +/// Formats a month. +/// +fn format_month(it: impl DateIterator) -> impl Iterator { + let mut month_days = it.peekable(); + let title = month_title(month_days.peek().unwrap().month()); + + Some(title).into_iter() + .chain(month_days.__(by_week) + .map(|(_, week)| week) + .__(format_weeks)) +} + +fn test_format_month() { + let month_fmt = dates_in_year(2013) + .__(by_month).next() // Pick January as a test case + .map(|(_, days)| days.into_iter() + .__(format_month) + .join("\n")); + + assert_eq!( + month_fmt.as_ref().map(|s| &**s), + Some(" January \n\ + \x20 1 2 3 4 5\n\ + \x20 6 7 8 9 10 11 12\n\ + \x2013 14 15 16 17 18 19\n\ + \x2020 21 22 23 24 25 26\n\ + \x2027 28 29 30 31 ") + ); +} + + +/// +/// Formats an iterator of months. +/// +fn format_months(it: impl Iterator) + -> impl Iterator> +{ + it.map(format_month) +} + +/// +/// Takes an iterator of iterators of strings; the sub-iterators are consumed +/// in lock-step, with their elements joined together. +/// +trait PasteBlocks: Iterator + Sized +where Self::Item: Iterator { + fn paste_blocks(self, sep_width: usize) -> PasteBlocksIter { + PasteBlocksIter { + iters: self.collect(), + cache: vec![], + col_widths: None, + sep_width: sep_width, + } + } +} + +impl PasteBlocks for It where It: Iterator, It::Item: Iterator {} + +struct PasteBlocksIter +where StrIt: Iterator { + iters: Vec, + cache: Vec>, + col_widths: Option>, + sep_width: usize, +} + +impl Iterator for PasteBlocksIter +where StrIt: Iterator { + type Item = String; + + fn next(&mut self) -> Option { + self.cache.clear(); + + // `cache` is now the next line from each iterator. + self.cache.extend(self.iters.iter_mut().map(|it| it.next())); + + // If every line in `cache` is `None`, we have nothing further to do. + if self.cache.iter().all(|e| e.is_none()) { return None } + + // Get the column widths if we haven't already. + let col_widths = match self.col_widths { + Some(ref v) => &**v, + None => { + self.col_widths = Some(self.cache.iter() + .map(|ms| ms.as_ref().map(|s| s.len()).unwrap_or(0)) + .collect()); + &**self.col_widths.as_ref().unwrap() + } + }; + + // Fill in any `None`s with spaces. + let mut parts = col_widths.iter().cloned().zip(self.cache.iter_mut()) + .map(|(w,ms)| ms.take().unwrap_or_else(|| spaces(w).collect())); + + // Join them all together. + let first = parts.next().unwrap_or(String::new()); + let sep_width = self.sep_width; + Some(parts.fold(first, |mut accum, next| { + accum.extend(spaces(sep_width)); + accum.push_str(&next); + accum + })) + } +} + +fn test_paste_blocks() { + let row = dates_in_year(2013) + .__(by_month).map(|(_, days)| days) + .take(3) + .__(format_months) + .paste_blocks(1) + .join("\n"); + assert_eq!( + &*row, + " January February March \n\ + \x20 1 2 3 4 5 1 2 1 2\n\ + \x20 6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9\n\ + \x2013 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16\n\ + \x2020 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23\n\ + \x2027 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30\n\ + \x20 31 " + ); +} + +/// +/// Produces an iterator that yields `n` elements at a time. +/// +trait Chunks: Iterator + Sized { + fn chunks(self, n: usize) -> ChunksIter { + assert!(n > 0); + ChunksIter { + it: self, + n: n, + } + } +} + +impl Chunks for It where It: Iterator {} + +struct ChunksIter +where It: Iterator { + it: It, + n: usize, +} + +// NOTE: `chunks` in Rust is more-or-less impossible without overhead of some kind. +// Aliasing rules mean you need to add dynamic borrow checking, and the design of +// `Iterator` means that you need to have the iterator's state kept in an allocation +// that is jointly owned by the iterator itself and the sub-iterator. +// As such, I've chosen to cop-out and just heap-allocate each chunk. + +impl Iterator for ChunksIter +where It: Iterator { + type Item = Vec; + + fn next(&mut self) -> Option> { + let first = match self.it.next() { + Some(e) => e, + None => return None + }; + + let mut result = Vec::with_capacity(self.n); + result.push(first); + + Some((&mut self.it).take(self.n-1) + .fold(result, |mut acc, next| { acc.push(next); acc })) + } +} + +fn test_chunks() { + let r = &[1, 2, 3, 4, 5, 6, 7]; + let c = r.iter().cloned().chunks(3).collect::>(); + assert_eq!(&*c, &[vec![1, 2, 3], vec![4, 5, 6], vec![7]]); +} + +/// +/// Formats a year. +/// +fn format_year(year: i32, months_per_row: usize) -> String { + const COL_SPACING: usize = 1; + + // Start by generating all dates for the given year. + dates_in_year(year) + + // Group them by month and throw away month number. + .__(by_month).map(|(_, days)| days) + + // Group the months into horizontal rows. + .chunks(months_per_row) + + // Format each row + .map(|r| r.into_iter() + // By formatting each month + .__(format_months) + + // Horizontally pasting each respective month's lines together. + .paste_blocks(COL_SPACING) + .join("\n") + ) + + // Insert a blank line between each row + .join("\n\n") +} + +fn test_format_year() { + const MONTHS_PER_ROW: usize = 3; + + macro_rules! assert_eq_cal { + ($lhs:expr, $rhs:expr) => { + if $lhs != $rhs { + println!("got:\n```\n{}\n```\n", $lhs.replace(" ", ".")); + println!("expected:\n```\n{}\n```", $rhs.replace(" ", ".")); + panic!("calendars didn't match!"); + } + } + } + + assert_eq_cal!(&format_year(1984, MONTHS_PER_ROW), "\ +\x20 January February March \n\ +\x20 1 2 3 4 5 6 7 1 2 3 4 1 2 3\n\ +\x20 8 9 10 11 12 13 14 5 6 7 8 9 10 11 4 5 6 7 8 9 10\n\ +\x2015 16 17 18 19 20 21 12 13 14 15 16 17 18 11 12 13 14 15 16 17\n\ +\x2022 23 24 25 26 27 28 19 20 21 22 23 24 25 18 19 20 21 22 23 24\n\ +\x2029 30 31 26 27 28 29 25 26 27 28 29 30 31\n\ +\n\ +\x20 April May June \n\ +\x20 1 2 3 4 5 6 7 1 2 3 4 5 1 2\n\ +\x20 8 9 10 11 12 13 14 6 7 8 9 10 11 12 3 4 5 6 7 8 9\n\ +\x2015 16 17 18 19 20 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16\n\ +\x2022 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23\n\ +\x2029 30 27 28 29 30 31 24 25 26 27 28 29 30\n\ +\n\ +\x20 July August September \n\ +\x20 1 2 3 4 5 6 7 1 2 3 4 1\n\ +\x20 8 9 10 11 12 13 14 5 6 7 8 9 10 11 2 3 4 5 6 7 8\n\ +\x2015 16 17 18 19 20 21 12 13 14 15 16 17 18 9 10 11 12 13 14 15\n\ +\x2022 23 24 25 26 27 28 19 20 21 22 23 24 25 16 17 18 19 20 21 22\n\ +\x2029 30 31 26 27 28 29 30 31 23 24 25 26 27 28 29\n\ +\x20 30 \n\ +\n\ +\x20 October November December \n\ +\x20 1 2 3 4 5 6 1 2 3 1\n\ +\x20 7 8 9 10 11 12 13 4 5 6 7 8 9 10 2 3 4 5 6 7 8\n\ +\x2014 15 16 17 18 19 20 11 12 13 14 15 16 17 9 10 11 12 13 14 15\n\ +\x2021 22 23 24 25 26 27 18 19 20 21 22 23 24 16 17 18 19 20 21 22\n\ +\x2028 29 30 31 25 26 27 28 29 30 23 24 25 26 27 28 29\n\ +\x20 30 31 "); + + assert_eq_cal!(&format_year(2015, MONTHS_PER_ROW), "\ +\x20 January February March \n\ +\x20 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7\n\ +\x20 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14\n\ +\x2011 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21\n\ +\x2018 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28\n\ +\x2025 26 27 28 29 30 31 29 30 31 \n\ +\n\ +\x20 April May June \n\ +\x20 1 2 3 4 1 2 1 2 3 4 5 6\n\ +\x20 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13\n\ +\x2012 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20\n\ +\x2019 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27\n\ +\x2026 27 28 29 30 24 25 26 27 28 29 30 28 29 30 \n\ +\x20 31 \n\ +\n\ +\x20 July August September \n\ +\x20 1 2 3 4 1 1 2 3 4 5\n\ +\x20 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12\n\ +\x2012 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19\n\ +\x2019 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26\n\ +\x2026 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30 \n\ +\x20 30 31 \n\ +\n\ +\x20 October November December \n\ +\x20 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5\n\ +\x20 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12\n\ +\x2011 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19\n\ +\x2018 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26\n\ +\x2025 26 27 28 29 30 31 29 30 27 28 29 30 31 "); +} + +fn main() { + // Run tests. + test_spaces(); + test_dates_in_year(); + test_group_by(); + test_by_month(); + test_isoweekdate(); + test_by_week(); + test_format_weeks(); + test_month_title(); + test_format_month(); + test_paste_blocks(); + test_chunks(); + test_format_year(); +} diff --git a/src/test/run-pass/impl-trait/example-st.rs b/src/test/run-pass/impl-trait/example-st.rs new file mode 100644 index 00000000000..014af37ccf9 --- /dev/null +++ b/src/test/run-pass/impl-trait/example-st.rs @@ -0,0 +1,40 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct State; +type Error = (); + +trait Bind { + type Output; + fn bind(self, f: F) -> Self::Output; +} + +fn bind(mut a: A, mut f: F) + -> impl FnMut(&mut State) -> Result +where F: FnMut(T) -> B, + A: FnMut(&mut State) -> Result, + B: FnMut(&mut State) -> Result +{ + move |state | { + let r = a(state)?; + f(r)(state) + } +} + +fn atom(x: T) -> impl FnMut(&mut State) -> Result { + let mut x = Some(x); + move |_| x.take().map_or(Err(()), Ok) +} + +fn main() { + assert_eq!(bind(atom(5), |x| atom(x > 4))(&mut State), Ok(true)); +} diff --git a/src/test/run-pass/impl-trait/existential-minimal.rs b/src/test/run-pass/impl-trait/existential-minimal.rs new file mode 100644 index 00000000000..bae4c685e7c --- /dev/null +++ b/src/test/run-pass/impl-trait/existential-minimal.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() {} + +fn foo() -> impl std::fmt::Debug { "cake" } diff --git a/src/test/run-pass/impl-trait/issue-42479.rs b/src/test/run-pass/impl-trait/issue-42479.rs new file mode 100644 index 00000000000..1da5cd36ca9 --- /dev/null +++ b/src/test/run-pass/impl-trait/issue-42479.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::iter::once; + +struct Foo { + x: i32, +} + +impl Foo { + fn inside(&self) -> impl Iterator { + once(&self.x) + } +} + +fn main() { + println!("hi"); +} diff --git a/src/test/run-pass/impl-trait/issue-49376.rs b/src/test/run-pass/impl-trait/issue-49376.rs new file mode 100644 index 00000000000..10379dad37d --- /dev/null +++ b/src/test/run-pass/impl-trait/issue-49376.rs @@ -0,0 +1,31 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Tests for nested self-reference which caused a stack overflow. + +use std::fmt::Debug; +use std::ops::*; + +fn gen() -> impl PartialOrd + PartialEq + Debug { } + +struct Bar {} +trait Foo {} +impl Foo for Bar {} + +fn foo() -> impl Foo { + Bar {} +} + +fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 } +fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 } + +fn main() {} diff --git a/src/test/run-pass/impl-trait/lifetimes.rs b/src/test/run-pass/impl-trait/lifetimes.rs new file mode 100644 index 00000000000..e5a98962ff3 --- /dev/null +++ b/src/test/run-pass/impl-trait/lifetimes.rs @@ -0,0 +1,128 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(warnings)] + +use std::fmt::Debug; + +fn any_lifetime<'a>() -> &'a u32 { &5 } + +fn static_lifetime() -> &'static u32 { &5 } + +fn any_lifetime_as_static_impl_trait() -> impl Debug { + any_lifetime() +} + +fn lifetimes_as_static_impl_trait() -> impl Debug { + static_lifetime() +} + +fn no_params_or_lifetimes_is_static() -> impl Debug + 'static { + lifetimes_as_static_impl_trait() +} + +fn static_input_type_is_static(x: T) -> impl Debug + 'static { x } + +fn type_outlives_reference_lifetime<'a, T: Debug>(x: &'a T) -> impl Debug + 'a { x } +fn type_outlives_reference_lifetime_elided(x: &T) -> impl Debug + '_ { x } + +trait SingleRegionTrait<'a> {} +impl<'a> SingleRegionTrait<'a> for u32 {} +impl<'a> SingleRegionTrait<'a> for &'a u32 {} +struct SingleRegionStruct<'a>(&'a u32); + +fn simple_type_hrtb<'b>() -> impl for<'a> SingleRegionTrait<'a> { 5 } +// FIXME(cramertj) add test after #45992 lands to ensure lint is triggered +fn elision_single_region_trait(x: &u32) -> impl SingleRegionTrait { x } +fn elision_single_region_struct(x: SingleRegionStruct) -> impl Into { x } + +fn closure_hrtb() -> impl for<'a> Fn(&'a u32) { |_| () } +fn closure_hr_elided() -> impl Fn(&u32) { |_| () } +fn closure_hr_elided_return() -> impl Fn(&u32) -> &u32 { |x| x } +fn closure_pass_through_elided_return(x: impl Fn(&u32) -> &u32) -> impl Fn(&u32) -> &u32 { x } +fn closure_pass_through_reference_elided(x: &impl Fn(&u32) -> &u32) -> &impl Fn(&u32) -> &u32 { x } + +fn nested_lifetime<'a>(input: &'a str) + -> impl Iterator + 'a> + 'a +{ + input.lines().map(|line| { + line.split_whitespace().map(|cell| cell.parse().unwrap()) + }) +} + +fn pass_through_elision(x: &u32) -> impl Into<&u32> { x } +fn pass_through_elision_with_fn_ptr(x: &fn(&u32) -> &u32) -> impl Into<&fn(&u32) -> &u32> { x } + +fn pass_through_elision_with_fn_path &u32>( + x: &T +) -> &impl Fn(&u32) -> &u32 { x } + +fn foo(x: &impl Debug) -> &impl Debug { x } +fn foo_explicit_lifetime<'a>(x: &'a impl Debug) -> &'a impl Debug { x } +fn foo_explicit_arg(x: &T) -> &impl Debug { x } + +fn mixed_lifetimes<'a>() -> impl for<'b> Fn(&'b &'a u32) { |_| () } +fn mixed_as_static() -> impl Fn(&'static &'static u32) { mixed_lifetimes() } + +trait MultiRegionTrait<'a, 'b>: Debug {} + +#[derive(Debug)] +struct MultiRegionStruct<'a, 'b>(&'a u32, &'b u32); +impl<'a, 'b> MultiRegionTrait<'a, 'b> for MultiRegionStruct<'a, 'b> {} + +#[derive(Debug)] +struct NoRegionStruct; +impl<'a, 'b> MultiRegionTrait<'a, 'b> for NoRegionStruct {} + +fn finds_least_region<'a: 'b, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> { + MultiRegionStruct(x, y) +} + +fn finds_explicit_bound<'a: 'b, 'b> + (x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> + 'b +{ + MultiRegionStruct(x, y) +} + +fn finds_explicit_bound_even_without_least_region<'a, 'b> + (x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> + 'b +{ + NoRegionStruct +} + +/* FIXME: `impl Trait<'a> + 'b` should live as long as 'b, even if 'b outlives 'a +fn outlives_bounds_even_with_contained_regions<'a, 'b> + (x: &'a u32, y: &'b u32) -> impl Debug + 'b +{ + finds_explicit_bound_even_without_least_region(x, y) +} +*/ + +fn unnamed_lifetimes_arent_contained_in_impl_trait_and_will_unify<'a, 'b> + (x: &'a u32, y: &'b u32) -> impl Debug +{ + fn deref<'lt>(x: &'lt u32) -> impl Debug { *x } + + if true { deref(x) } else { deref(y) } +} + +fn can_add_region_bound_to_static_type<'a, 'b>(_: &'a u32) -> impl Debug + 'a { 5 } + +struct MyVec(Vec>); + +impl<'unnecessary_lifetime> MyVec { + fn iter_doesnt_capture_unnecessary_lifetime<'s>(&'s self) -> impl Iterator { + self.0.iter().flat_map(|inner_vec| inner_vec.iter()) + } +} + +fn main() {} diff --git a/src/test/run-pass/impl-trait/nesting.rs b/src/test/run-pass/impl-trait/nesting.rs new file mode 100644 index 00000000000..f721ace0afe --- /dev/null +++ b/src/test/run-pass/impl-trait/nesting.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn foo(t: T) -> impl Into<[T; { const FOO: usize = 1; FOO }]> { + [t] +} + +fn bar() -> impl Into<[u8; { const FOO: usize = 1; FOO }]> { + [99] +} + +fn main() { + println!("{:?}", foo(42).into()); + println!("{:?}", bar().into()); +} diff --git a/src/test/run-pass/impl-trait/universal_hrtb_anon.rs b/src/test/run-pass/impl-trait/universal_hrtb_anon.rs new file mode 100644 index 00000000000..b78ec557d09 --- /dev/null +++ b/src/test/run-pass/impl-trait/universal_hrtb_anon.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn hrtb(f: impl Fn(&u32) -> u32) -> u32 { + f(&22) + f(&44) +} + +fn main() { + let sum = hrtb(|x| x * 2); + assert_eq!(sum, 22*2 + 44*2); +} diff --git a/src/test/run-pass/impl-trait/universal_hrtb_named.rs b/src/test/run-pass/impl-trait/universal_hrtb_named.rs new file mode 100644 index 00000000000..0bec594346b --- /dev/null +++ b/src/test/run-pass/impl-trait/universal_hrtb_named.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn hrtb(f: impl for<'a> Fn(&'a u32) -> &'a u32) -> u32 { + f(&22) + f(&44) +} + +fn main() { + let sum = hrtb(|x| x); + assert_eq!(sum, 22 + 44); +} diff --git a/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs b/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs new file mode 100644 index 00000000000..95e6a3efdf0 --- /dev/null +++ b/src/test/run-pass/impl-trait/universal_in_adt_in_parameters.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::fmt::Display; + +fn check_display_eq(iter: &Vec) { + let mut collected = String::new(); + for it in iter { + let disp = format!("{} ", it); + collected.push_str(&disp); + } + assert_eq!("0 3 27 823 4891 1 0", collected.trim()); +} + +fn main() { + let i32_list_vec = vec![0i32, 3, 27, 823, 4891, 1, 0]; + let u32_list_vec = vec![0u32, 3, 27, 823, 4891, 1, 0]; + let str_list_vec = vec!["0", "3", "27", "823", "4891", "1", "0"]; + + check_display_eq(&i32_list_vec); + check_display_eq(&u32_list_vec); + check_display_eq(&str_list_vec); +} diff --git a/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs b/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs new file mode 100644 index 00000000000..b9c68c280f1 --- /dev/null +++ b/src/test/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs @@ -0,0 +1,40 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::fmt::Display; + +fn check_display_eq(iter: impl IntoIterator) { + let mut collected = String::new(); + for it in iter { + let disp = format!("{} ", it); + collected.push_str(&disp); + } + assert_eq!("0 3 27 823 4891 1 0", collected.trim()); +} + +fn main() { + let i32_list = [0i32, 3, 27, 823, 4891, 1, 0]; + let i32_list_vec = vec![0i32, 3, 27, 823, 4891, 1, 0]; + let u32_list = [0u32, 3, 27, 823, 4891, 1, 0]; + let u32_list_vec = vec![0u32, 3, 27, 823, 4891, 1, 0]; + let u16_list = [0u16, 3, 27, 823, 4891, 1, 0]; + let str_list = ["0", "3", "27", "823", "4891", "1", "0"]; + let str_list_vec = vec!["0", "3", "27", "823", "4891", "1", "0"]; + + check_display_eq(&i32_list); + check_display_eq(i32_list_vec); + check_display_eq(&u32_list); + check_display_eq(u32_list_vec); + check_display_eq(&u16_list); + check_display_eq(&str_list); + check_display_eq(str_list_vec); +} diff --git a/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs b/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs new file mode 100644 index 00000000000..6fb44147c1c --- /dev/null +++ b/src/test/run-pass/impl-trait/universal_in_trait_defn_parameters.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::fmt::Debug; + +trait InTraitDefnParameters { + fn in_parameters(_: impl Debug) -> String; +} + +impl InTraitDefnParameters for () { + fn in_parameters(v: impl Debug) -> String { + format!("() + {:?}", v) + } +} + +fn main() { + let s = <() as InTraitDefnParameters>::in_parameters(22); + assert_eq!(s, "() + 22"); +} diff --git a/src/test/run-pass/impl-trait/universal_multiple_bounds.rs b/src/test/run-pass/impl-trait/universal_multiple_bounds.rs new file mode 100644 index 00000000000..9b1c2b92446 --- /dev/null +++ b/src/test/run-pass/impl-trait/universal_multiple_bounds.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::fmt::Display; + +fn foo(f: impl Display + Clone) -> String { + let g = f.clone(); + format!("{} + {}", f, g) +} + +fn main() { + let sum = foo(format!("22")); + assert_eq!(sum, r"22 + 22"); +} diff --git a/src/test/run-pass/impl-trait/xcrate.rs b/src/test/run-pass/impl-trait/xcrate.rs new file mode 100644 index 00000000000..aa5d3298f69 --- /dev/null +++ b/src/test/run-pass/impl-trait/xcrate.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:xcrate.rs + +extern crate xcrate; + +fn main() { +// NOTE line below commeted out due to issue #45994 +// assert_eq!(xcrate::fourway_add(1)(2)(3)(4), 10); + xcrate::return_closure_accessing_internal_fn()(); +} diff --git a/src/test/run-pass/impl-trait/xcrate_simple.rs b/src/test/run-pass/impl-trait/xcrate_simple.rs new file mode 100644 index 00000000000..8b7c8ada1c0 --- /dev/null +++ b/src/test/run-pass/impl-trait/xcrate_simple.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:xcrate.rs + +extern crate xcrate; + +fn main() { + xcrate::return_internal_fn()(); +} diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs new file mode 100644 index 00000000000..b37533d2da7 --- /dev/null +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] +// no-prefer-dynamic + +// compile-flags: -g + +#[macro_use] +mod crate_with_invalid_spans_macros; + +pub fn exported_generic(x: T, y: u32) -> (T, u32) { + // Using the add1 macro will produce an invalid span, because the `y` passed + // to the macro will have a span from this file, but the rest of the code + // generated from the macro will have spans from the macro-defining file. + // The AST node for the (1 + y) expression generated by the macro will then + // take it's `lo` span bound from the `1` literal in the macro-defining file + // and it's `hi` bound from `y` in this file, which should be lower than the + // `lo` and even lower than the lower bound of the FileMap it is supposedly + // contained in because the FileMap for this file was allocated earlier than + // the FileMap of the macro-defining file. + return (x, add1!(y)); +} diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs new file mode 100644 index 00000000000..112315af844 --- /dev/null +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! add1 { + ($e:expr) => ({ + let a = 1 + $e; + let b = $e + 1; + a + b - 1 + }) +} diff --git a/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs b/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs new file mode 100644 index 00000000000..990758d52ff --- /dev/null +++ b/src/test/run-pass/imports/import-crate-with-invalid-spans/main.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:crate_with_invalid_spans.rs + +// pretty-expanded FIXME #23616 + +extern crate crate_with_invalid_spans; + +fn main() { + // The AST of `exported_generic` stored in crate_with_invalid_spans's + // metadata should contain an invalid span where span.lo() > span.hi(). + // Let's make sure the compiler doesn't crash when encountering this. + let _ = crate_with_invalid_spans::exported_generic(32u32, 7u32); +} diff --git a/src/test/run-pass/imports/import-from.rs b/src/test/run-pass/imports/import-from.rs new file mode 100644 index 00000000000..5f498a48584 --- /dev/null +++ b/src/test/run-pass/imports/import-from.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use spam::{ham, eggs}; + +mod spam { + pub fn ham() { } + pub fn eggs() { } +} + +pub fn main() { ham(); eggs(); } diff --git a/src/test/run-pass/imports/import-glob-0.rs b/src/test/run-pass/imports/import-glob-0.rs new file mode 100644 index 00000000000..f72fb1f0b13 --- /dev/null +++ b/src/test/run-pass/imports/import-glob-0.rs @@ -0,0 +1,38 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use module_of_many_things::*; +use dug::too::greedily::and::too::deep::*; + +mod module_of_many_things { + pub fn f1() { println!("f1"); } + pub fn f2() { println!("f2"); } + fn f3() { println!("f3"); } + pub fn f4() { println!("f4"); } +} + +mod dug { + pub mod too { + pub mod greedily { + pub mod and { + pub mod too { + pub mod deep { + pub fn nameless_fear() { println!("Boo!"); } + pub fn also_redstone() { println!("Whatever."); } + } + } + } + } + } +} + + +pub fn main() { f1(); f2(); f4(); nameless_fear(); also_redstone(); } diff --git a/src/test/run-pass/imports/import-glob-1.rs b/src/test/run-pass/imports/import-glob-1.rs new file mode 100644 index 00000000000..b1f40d74917 --- /dev/null +++ b/src/test/run-pass/imports/import-glob-1.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This should resolve fine. Prior to fix, the last import +// was being tried too early, and marked as unrsolved before +// the glob import had a chance to be resolved. + +mod bar { + pub use self::middle::*; + + mod middle { + pub use self::baz::Baz; + + mod baz { + pub enum Baz { + Baz1, + Baz2 + } + } + } +} + +mod foo { + use bar::Baz::{Baz1, Baz2}; +} + +fn main() {} diff --git a/src/test/run-pass/imports/import-glob-crate.rs b/src/test/run-pass/imports/import-glob-crate.rs new file mode 100644 index 00000000000..4ec5e1bd945 --- /dev/null +++ b/src/test/run-pass/imports/import-glob-crate.rs @@ -0,0 +1,29 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem::*; + +pub fn main() { + assert_eq!(size_of::(), 1); + let (mut x, mut y) = (1, 2); + swap(&mut x, &mut y); + assert_eq!(x, 2); + assert_eq!(y, 1); +} + +#[allow(unused)] +fn f() { + mod foo { pub use *; } + mod bar { pub use ::*; } + + foo::main(); + bar::main(); +} diff --git a/src/test/run-pass/imports/import-in-block.rs b/src/test/run-pass/imports/import-in-block.rs new file mode 100644 index 00000000000..655bd31b4de --- /dev/null +++ b/src/test/run-pass/imports/import-in-block.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + use std::mem::replace; + let mut x = 5; + replace(&mut x, 6); + { + use std::mem::*; + let mut y = 6; + swap(&mut x, &mut y); + } +} diff --git a/src/test/run-pass/imports/import-prefix-macro.rs b/src/test/run-pass/imports/import-prefix-macro.rs new file mode 100644 index 00000000000..ceb662c6e3d --- /dev/null +++ b/src/test/run-pass/imports/import-prefix-macro.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +mod a { + pub mod b { + pub mod c { + pub struct S; + pub struct Z; + } + pub struct W; + } +} + +macro_rules! import { + (1 $p: path) => (use $p;); + (2 $p: path) => (use $p::{Z};); + (3 $p: path) => (use $p::*;); +} + +import! { 1 a::b::c::S } +import! { 2 a::b::c } +import! { 3 a::b } + +fn main() { + let s = S; + let z = Z; + let w = W; +} diff --git a/src/test/run-pass/imports/import-rename.rs b/src/test/run-pass/imports/import-rename.rs new file mode 100644 index 00000000000..8d4757f0a47 --- /dev/null +++ b/src/test/run-pass/imports/import-rename.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use foo::{x, y as fooy}; +use Maybe::{Yes as MaybeYes}; + +pub enum Maybe { Yes, No } +mod foo { + use super::Maybe::{self as MaybeFoo}; + pub fn x(a: MaybeFoo) {} + pub fn y(a: i32) { println!("{}", a); } +} + +pub fn main() { x(MaybeYes); fooy(10); } diff --git a/src/test/run-pass/imports/import-trailing-comma.rs b/src/test/run-pass/imports/import-trailing-comma.rs new file mode 100644 index 00000000000..6c3371b46c7 --- /dev/null +++ b/src/test/run-pass/imports/import-trailing-comma.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use foo::bar::{baz, quux,}; + +mod foo { + pub mod bar { + pub fn baz() { } + pub fn quux() { } + } +} + +pub fn main() { baz(); quux(); } diff --git a/src/test/run-pass/imports/import.rs b/src/test/run-pass/imports/import.rs new file mode 100644 index 00000000000..cb2152f5fac --- /dev/null +++ b/src/test/run-pass/imports/import.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +mod foo { + pub fn x(y: isize) { println!("{}", y); } +} + +mod bar { + use foo::x; + use foo::x as z; + pub fn thing() { x(10); z(10); } +} + +pub fn main() { bar::thing(); } diff --git a/src/test/run-pass/imports/import2.rs b/src/test/run-pass/imports/import2.rs new file mode 100644 index 00000000000..aaf65fc1c8c --- /dev/null +++ b/src/test/run-pass/imports/import2.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use zed::bar; + +mod zed { + pub fn bar() { println!("bar"); } +} + +pub fn main() { bar(); } diff --git a/src/test/run-pass/imports/import3.rs b/src/test/run-pass/imports/import3.rs new file mode 100644 index 00000000000..38e316f550b --- /dev/null +++ b/src/test/run-pass/imports/import3.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_imports)] + +use baz::zed; +use baz::zed::bar; + +mod baz { + pub mod zed { + pub fn bar() { println!("bar2"); } + } +} + +pub fn main() { bar(); } diff --git a/src/test/run-pass/imports/import4.rs b/src/test/run-pass/imports/import4.rs new file mode 100644 index 00000000000..057e1cb5e01 --- /dev/null +++ b/src/test/run-pass/imports/import4.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use zed::bar; + +mod zed { + pub fn bar() { println!("bar"); } +} + +pub fn main() { let _zed = 42; bar(); } diff --git a/src/test/run-pass/imports/import5.rs b/src/test/run-pass/imports/import5.rs new file mode 100644 index 00000000000..614c8c435c9 --- /dev/null +++ b/src/test/run-pass/imports/import5.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use foo::bar; +mod foo { + pub use foo::zed::bar; + pub mod zed { + pub fn bar() { println!("foo"); } + } +} + +pub fn main() { bar(); } diff --git a/src/test/run-pass/imports/import6.rs b/src/test/run-pass/imports/import6.rs new file mode 100644 index 00000000000..d98d5b3b0e1 --- /dev/null +++ b/src/test/run-pass/imports/import6.rs @@ -0,0 +1,25 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_imports)] + +use foo::zed; +use bar::baz; + +mod foo { + pub mod zed { + pub fn baz() { println!("baz"); } + } +} +mod bar { + pub use foo::zed::baz; +} +pub fn main() { baz(); } diff --git a/src/test/run-pass/imports/import7.rs b/src/test/run-pass/imports/import7.rs new file mode 100644 index 00000000000..67e41824e0d --- /dev/null +++ b/src/test/run-pass/imports/import7.rs @@ -0,0 +1,28 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_imports)] + +use foo::zed; +use bar::baz; + +mod foo { + pub mod zed { + pub fn baz() { println!("baz"); } + } +} +mod bar { + pub use foo::zed::baz; + pub mod foo { + pub mod zed {} + } +} +pub fn main() { baz(); } diff --git a/src/test/run-pass/imports/import8.rs b/src/test/run-pass/imports/import8.rs new file mode 100644 index 00000000000..71dd7acac5a --- /dev/null +++ b/src/test/run-pass/imports/import8.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use foo::x; +use foo::x as z; + +mod foo { + pub fn x(y: isize) { println!("{}", y); } +} + +pub fn main() { x(10); z(10); } diff --git a/src/test/run-pass/imports/imports.rs b/src/test/run-pass/imports/imports.rs new file mode 100644 index 00000000000..7ca7ea1fd8c --- /dev/null +++ b/src/test/run-pass/imports/imports.rs @@ -0,0 +1,76 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused)] + +// Like other items, private imports can be imported and used non-lexically in paths. +mod a { + use a as foo; + use self::foo::foo as bar; + + mod b { + use super::bar; + } +} + +mod foo { pub fn f() {} } +mod bar { pub fn f() {} } + +pub fn f() -> bool { true } + +// Items and explicit imports shadow globs. +fn g() { + use foo::*; + use bar::*; + fn f() -> bool { true } + let _: bool = f(); +} + +fn h() { + use foo::*; + use bar::*; + use f; + let _: bool = f(); +} + +// Here, there appears to be shadowing but isn't because of namespaces. +mod b { + use foo::*; // This imports `f` in the value namespace. + use super::b as f; // This imports `f` only in the type namespace, + fn test() { self::f(); } // so the glob isn't shadowed. +} + +// Here, there is shadowing in one namespace, but not the other. +mod c { + mod test { + pub fn f() {} + pub mod f {} + } + use self::test::*; // This glob-imports `f` in both namespaces. + mod f { pub fn f() {} } // This shadows the glob only in the value namespace. + + fn test() { + self::f(); // Check that the glob-imported value isn't shadowed. + self::f::f(); // Check that the glob-imported module is shadowed. + } +} + +// Unused names can be ambiguous. +mod d { + pub use foo::*; // This imports `f` in the value namespace. + pub use bar::*; // This also imports `f` in the value namespace. +} + +mod e { + pub use d::*; // n.b. Since `e::f` is not used, this is not considered to be a use of `d::f`. +} + +fn main() {} diff --git a/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs b/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs new file mode 100644 index 00000000000..b6e69d29f70 --- /dev/null +++ b/src/test/run-pass/intrinsics/auxiliary/cci_intrinsic.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(intrinsics)] + +pub mod rusti { + extern "rust-intrinsic" { + pub fn atomic_xchg(dst: *mut T, src: T) -> T; + } +} + +#[inline(always)] +pub fn atomic_xchg(dst: *mut isize, src: isize) -> isize { + unsafe { + rusti::atomic_xchg(dst, src) + } +} diff --git a/src/test/run-pass/intrinsics/intrinsic-alignment.rs b/src/test/run-pass/intrinsics/intrinsic-alignment.rs new file mode 100644 index 00000000000..0c1f7724ca8 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-alignment.rs @@ -0,0 +1,84 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare seems not important to test here + +#![feature(intrinsics, main)] + +mod rusti { + extern "rust-intrinsic" { + pub fn pref_align_of() -> usize; + pub fn min_align_of() -> usize; + } +} + +#[cfg(any(target_os = "android", + target_os = "cloudabi", + target_os = "dragonfly", + target_os = "emscripten", + target_os = "freebsd", + target_os = "linux", + target_os = "macos", + target_os = "netbsd", + target_os = "openbsd", + target_os = "solaris"))] +mod m { + #[main] + #[cfg(target_arch = "x86")] + pub fn main() { + unsafe { + assert_eq!(::rusti::pref_align_of::(), 8); + assert_eq!(::rusti::min_align_of::(), 4); + } + } + + #[main] + #[cfg(not(target_arch = "x86"))] + pub fn main() { + unsafe { + assert_eq!(::rusti::pref_align_of::(), 8); + assert_eq!(::rusti::min_align_of::(), 8); + } + } +} + +#[cfg(target_os = "bitrig")] +mod m { + #[main] + #[cfg(target_arch = "x86_64")] + pub fn main() { + unsafe { + assert_eq!(::rusti::pref_align_of::(), 8); + assert_eq!(::rusti::min_align_of::(), 8); + } + } +} + +#[cfg(target_os = "windows")] +mod m { + #[main] + #[cfg(target_arch = "x86")] + pub fn main() { + unsafe { + assert_eq!(::rusti::pref_align_of::(), 8); + assert_eq!(::rusti::min_align_of::(), 8); + } + } + + #[main] + #[cfg(target_arch = "x86_64")] + pub fn main() { + unsafe { + assert_eq!(::rusti::pref_align_of::(), 8); + assert_eq!(::rusti::min_align_of::(), 8); + } + } +} diff --git a/src/test/run-pass/intrinsics/intrinsic-assume.rs b/src/test/run-pass/intrinsics/intrinsic-assume.rs new file mode 100644 index 00000000000..e428c0e50ab --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-assume.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] + +use std::intrinsics::assume; + +unsafe fn f(x: i32) -> i32 { + assume(x == 34); + match x { + 34 => 42, + _ => 30 + } +} + +fn main() { + let x = unsafe { f(34) }; + assert_eq!(x, 42); +} diff --git a/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs b/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs new file mode 100644 index 00000000000..ce8b07c9075 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-atomics-cc.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_intrinsic.rs + + +extern crate cci_intrinsic; +use cci_intrinsic::atomic_xchg; + +pub fn main() { + let mut x = 1; + atomic_xchg(&mut x, 5); + assert_eq!(x, 5); +} diff --git a/src/test/run-pass/intrinsics/intrinsic-atomics.rs b/src/test/run-pass/intrinsics/intrinsic-atomics.rs new file mode 100644 index 00000000000..d238a57a076 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-atomics.rs @@ -0,0 +1,113 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] +#![feature(intrinsics)] + +mod rusti { + extern "rust-intrinsic" { + pub fn atomic_cxchg(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchg_acq(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchg_rel(dst: *mut T, old: T, src: T) -> (T, bool); + + pub fn atomic_cxchgweak(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchgweak_acq(dst: *mut T, old: T, src: T) -> (T, bool); + pub fn atomic_cxchgweak_rel(dst: *mut T, old: T, src: T) -> (T, bool); + + pub fn atomic_load(src: *const T) -> T; + pub fn atomic_load_acq(src: *const T) -> T; + + pub fn atomic_store(dst: *mut T, val: T); + pub fn atomic_store_rel(dst: *mut T, val: T); + + pub fn atomic_xchg(dst: *mut T, src: T) -> T; + pub fn atomic_xchg_acq(dst: *mut T, src: T) -> T; + pub fn atomic_xchg_rel(dst: *mut T, src: T) -> T; + + pub fn atomic_xadd(dst: *mut T, src: T) -> T; + pub fn atomic_xadd_acq(dst: *mut T, src: T) -> T; + pub fn atomic_xadd_rel(dst: *mut T, src: T) -> T; + + pub fn atomic_xsub(dst: *mut T, src: T) -> T; + pub fn atomic_xsub_acq(dst: *mut T, src: T) -> T; + pub fn atomic_xsub_rel(dst: *mut T, src: T) -> T; + } +} + +pub fn main() { + unsafe { + let mut x: Box<_> = box 1; + + assert_eq!(rusti::atomic_load(&*x), 1); + *x = 5; + assert_eq!(rusti::atomic_load_acq(&*x), 5); + + rusti::atomic_store(&mut *x,3); + assert_eq!(*x, 3); + rusti::atomic_store_rel(&mut *x,1); + assert_eq!(*x, 1); + + assert_eq!(rusti::atomic_cxchg(&mut *x, 1, 2), (1, true)); + assert_eq!(*x, 2); + + assert_eq!(rusti::atomic_cxchg_acq(&mut *x, 1, 3), (2, false)); + assert_eq!(*x, 2); + + assert_eq!(rusti::atomic_cxchg_rel(&mut *x, 2, 1), (2, true)); + assert_eq!(*x, 1); + + assert_eq!(rusti::atomic_xchg(&mut *x, 0), 1); + assert_eq!(*x, 0); + + assert_eq!(rusti::atomic_xchg_acq(&mut *x, 1), 0); + assert_eq!(*x, 1); + + assert_eq!(rusti::atomic_xchg_rel(&mut *x, 0), 1); + assert_eq!(*x, 0); + + assert_eq!(rusti::atomic_xadd(&mut *x, 1), 0); + assert_eq!(rusti::atomic_xadd_acq(&mut *x, 1), 1); + assert_eq!(rusti::atomic_xadd_rel(&mut *x, 1), 2); + assert_eq!(*x, 3); + + assert_eq!(rusti::atomic_xsub(&mut *x, 1), 3); + assert_eq!(rusti::atomic_xsub_acq(&mut *x, 1), 2); + assert_eq!(rusti::atomic_xsub_rel(&mut *x, 1), 1); + assert_eq!(*x, 0); + + loop { + let res = rusti::atomic_cxchgweak(&mut *x, 0, 1); + assert_eq!(res.0, 0); + if res.1 { + break; + } + } + assert_eq!(*x, 1); + + loop { + let res = rusti::atomic_cxchgweak_acq(&mut *x, 1, 2); + assert_eq!(res.0, 1); + if res.1 { + break; + } + } + assert_eq!(*x, 2); + + loop { + let res = rusti::atomic_cxchgweak_rel(&mut *x, 2, 3); + assert_eq!(res.0, 2); + if res.1 { + break; + } + } + assert_eq!(*x, 3); + } +} diff --git a/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs b/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs new file mode 100644 index 00000000000..5b04daeb332 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs @@ -0,0 +1,198 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support +#![allow(stable_features)] + +// This test is checking that the move_val_init intrinsic is +// respecting cleanups for both of its argument expressions. +// +// In other words, if either DEST or SOURCE in +// +// `intrinsics::move_val_init(DEST, SOURCE) +// +// introduce temporaries that require cleanup, and SOURCE panics, then +// make sure the cleanups still occur. + +#![feature(core_intrinsics, sync_poison)] + +use std::cell::RefCell; +use std::intrinsics; +use std::sync::{Arc, LockResult, Mutex, MutexGuard}; +use std::thread; + +type LogEntry = (&'static str, i32); +type Guarded = RefCell>; +#[derive(Clone)] +struct Log(Arc>); +struct Acquired<'a>(MutexGuard<'a, Guarded>); +type LogState = (MutexWas, &'static [LogEntry]); + +#[derive(Copy, Clone, PartialEq, Eq, Debug)] +enum MutexWas { Poisoned, NotPoisoned } + +impl Log { + fn lock(&self) -> LockResult>>> { self.0.lock() } + fn acquire(&self) -> Acquired { Acquired(self.0.lock().unwrap()) } +} + +impl<'a> Acquired<'a> { + fn log(&self, s: &'static str, i: i32) { self.0.borrow_mut().push((s, i)); } +} + +const TEST1_EXPECT: LogState = (MutexWas::NotPoisoned, + &[("double-check non-poisoning path", 1) + ]); + +fn test1(log: Log) { + { + let acq = log.acquire(); + acq.log("double-check non-poisoning path", 1); + } + panic!("every test ends in a panic"); +} + +const TEST2_EXPECT: LogState = (MutexWas::Poisoned, + &[("double-check poisoning path", 1), + ("and multiple log entries", 2), + ]); +fn test2(log: Log) { + let acq = log.acquire(); + acq.log("double-check poisoning path", 1); + acq.log("and multiple log entries", 2); + panic!("every test ends in a panic"); +} + +struct LogOnDrop<'a>(&'a Acquired<'a>, &'static str, i32); +impl<'a> Drop for LogOnDrop<'a> { + fn drop(&mut self) { + self.0.log(self.1, self.2); + } +} + +const TEST3_EXPECT: LogState = (MutexWas::Poisoned, + &[("double-check destructors can log", 1), + ("drop d2", 2), + ("drop d1", 3), + ]); +fn test3(log: Log) { + let acq = log.acquire(); + acq.log("double-check destructors can log", 1); + let _d1 = LogOnDrop(&acq, "drop d1", 3); + let _d2 = LogOnDrop(&acq, "drop d2", 2); + panic!("every test ends in a panic"); +} + +// The *real* tests of panic-handling for move_val_init intrinsic +// start here. + +const TEST4_EXPECT: LogState = (MutexWas::Poisoned, + &[("neither arg panics", 1), + ("drop temp LOD", 2), + ("drop temp LOD", 3), + ("drop dest_b", 4), + ("drop dest_a", 5), + ]); +fn test4(log: Log) { + let acq = log.acquire(); + acq.log("neither arg panics", 1); + let mut dest_a = LogOnDrop(&acq, "a will be overwritten, not dropped", 0); + let mut dest_b = LogOnDrop(&acq, "b will be overwritten, not dropped", 0); + unsafe { + intrinsics::move_val_init({ LogOnDrop(&acq, "drop temp LOD", 2); &mut dest_a }, + LogOnDrop(&acq, "drop dest_a", 5)); + intrinsics::move_val_init(&mut dest_b, { LogOnDrop(&acq, "drop temp LOD", 3); + LogOnDrop(&acq, "drop dest_b", 4) }); + } + panic!("every test ends in a panic"); +} + + +// Check that move_val_init(PANIC, SOURCE_EXPR) never evaluates SOURCE_EXPR +const TEST5_EXPECT: LogState = (MutexWas::Poisoned, + &[("first arg panics", 1), + ("drop orig dest_a", 2), + ]); +fn test5(log: Log) { + let acq = log.acquire(); + acq.log("first arg panics", 1); + let mut _dest_a = LogOnDrop(&acq, "drop orig dest_a", 2); + unsafe { + intrinsics::move_val_init({ panic!("every test ends in a panic") }, + LogOnDrop(&acq, "we never get here", 0)); + } +} + +// Check that move_val_init(DEST_EXPR, PANIC) cleans up temps from DEST_EXPR. +const TEST6_EXPECT: LogState = (MutexWas::Poisoned, + &[("second arg panics", 1), + ("drop temp LOD", 2), + ("drop orig dest_a", 3), + ]); +fn test6(log: Log) { + let acq = log.acquire(); + acq.log("second arg panics", 1); + let mut dest_a = LogOnDrop(&acq, "drop orig dest_a", 3); + unsafe { + intrinsics::move_val_init({ LogOnDrop(&acq, "drop temp LOD", 2); &mut dest_a }, + { panic!("every test ends in a panic"); }); + } +} + +// Check that move_val_init(DEST_EXPR, COMPLEX_PANIC) cleans up temps from COMPLEX_PANIC. +const TEST7_EXPECT: LogState = (MutexWas::Poisoned, + &[("second arg panics", 1), + ("drop temp LOD", 2), + ("drop temp LOD", 3), + ("drop orig dest_a", 4), + ]); +fn test7(log: Log) { + let acq = log.acquire(); + acq.log("second arg panics", 1); + let mut dest_a = LogOnDrop(&acq, "drop orig dest_a", 4); + unsafe { + intrinsics::move_val_init({ LogOnDrop(&acq, "drop temp LOD", 2); &mut dest_a }, + { LogOnDrop(&acq, "drop temp LOD", 3); + panic!("every test ends in a panic"); }); + } +} + +const TEST_SUITE: &'static [(&'static str, fn (Log), LogState)] = + &[("test1", test1, TEST1_EXPECT), + ("test2", test2, TEST2_EXPECT), + ("test3", test3, TEST3_EXPECT), + ("test4", test4, TEST4_EXPECT), + ("test5", test5, TEST5_EXPECT), + ("test6", test6, TEST6_EXPECT), + ("test7", test7, TEST7_EXPECT), + ]; + +fn main() { + for &(name, test, expect) in TEST_SUITE { + let log = Log(Arc::new(Mutex::new(RefCell::new(Vec::new())))); + let ret = { let log = log.clone(); thread::spawn(move || test(log)).join() }; + assert!(ret.is_err(), "{} must end with panic", name); + { + let l = log.lock(); + match l { + Ok(acq) => { + assert_eq!((MutexWas::NotPoisoned, &acq.borrow()[..]), expect); + println!("{} (unpoisoned) log: {:?}", name, *acq); + } + Err(e) => { + let acq = e.into_inner(); + assert_eq!((MutexWas::Poisoned, &acq.borrow()[..]), expect); + println!("{} (poisoned) log: {:?}", name, *acq); + } + } + } + } +} diff --git a/src/test/run-pass/intrinsics/intrinsic-move-val.rs b/src/test/run-pass/intrinsics/intrinsic-move-val.rs new file mode 100644 index 00000000000..dcc495e5923 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-move-val.rs @@ -0,0 +1,92 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(box_syntax)] +#![feature(intrinsics)] + +mod rusti { + extern "rust-intrinsic" { + pub fn init() -> T; + pub fn move_val_init(dst: *mut T, src: T); + } +} + +pub fn main() { + unsafe { + // sanity check + check_drops_state(0, None); + + let mut x: Box = box D(1); + assert_eq!(x.0, 1); + + // A normal overwrite, to demonstrate `check_drops_state`. + x = box D(2); + + // At this point, one destructor has run, because the + // overwrite of `x` drops its initial value. + check_drops_state(1, Some(1)); + + let mut y: Box = rusti::init(); + + // An initial binding does not overwrite anything. + check_drops_state(1, Some(1)); + + // Since `y` has been initialized via the `init` intrinsic, it + // would be unsound to directly overwrite its value via normal + // assignment. + // + // The code currently generated by the compiler is overly + // accepting, however, in that it will check if `y` is itself + // null and thus avoid the unsound action of attempting to + // free null. In other words, if we were to do a normal + // assignment like `y = box D(4);` here, it probably would not + // crash today. But the plan is that it may well crash in the + // future, (I believe). + + // `x` is moved here; the manner in which this is tracked by the + // compiler is hidden. + rusti::move_val_init(&mut y, x); + + // But what we *can* observe is how many times the destructor + // for `D` is invoked, and what the last value we saw was + // during such a destructor call. We do so after the end of + // this scope. + + assert_eq!(y.0, 2); + y.0 = 3; + assert_eq!(y.0, 3); + + check_drops_state(1, Some(1)); + } + + check_drops_state(2, Some(3)); +} + +static mut NUM_DROPS: i32 = 0; +static mut LAST_DROPPED: Option = None; + +fn check_drops_state(num_drops: i32, last_dropped: Option) { + unsafe { + assert_eq!(NUM_DROPS, num_drops); + assert_eq!(LAST_DROPPED, last_dropped); + } +} + +struct D(i32); +impl Drop for D { + fn drop(&mut self) { + unsafe { + NUM_DROPS += 1; + LAST_DROPPED = Some(self.0); + } + } +} diff --git a/src/test/run-pass/intrinsics/intrinsic-uninit.rs b/src/test/run-pass/intrinsics/intrinsic-uninit.rs new file mode 100644 index 00000000000..0f58bdbb9c5 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-uninit.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(intrinsics)] + +mod rusti { + extern "rust-intrinsic" { + pub fn uninit() -> T; + } +} +pub fn main() { + let _a : isize = unsafe {rusti::uninit()}; +} diff --git a/src/test/run-pass/intrinsics/intrinsic-unreachable.rs b/src/test/run-pass/intrinsics/intrinsic-unreachable.rs new file mode 100644 index 00000000000..586d0a352f9 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsic-unreachable.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] + +use std::intrinsics; + +// See also src/test/run-make/intrinsic-unreachable. + +unsafe fn f(x: usize) -> usize { + match x { + 17 => 23, + _ => intrinsics::unreachable(), + } +} + +fn main() { + assert_eq!(unsafe { f(17) }, 23); +} diff --git a/src/test/run-pass/intrinsics/intrinsics-integer.rs b/src/test/run-pass/intrinsics/intrinsics-integer.rs new file mode 100644 index 00000000000..97c1c93cfd4 --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsics-integer.rs @@ -0,0 +1,180 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no i128 support + +#![feature(intrinsics)] + +mod rusti { + extern "rust-intrinsic" { + pub fn ctpop(x: T) -> T; + pub fn ctlz(x: T) -> T; + pub fn ctlz_nonzero(x: T) -> T; + pub fn cttz(x: T) -> T; + pub fn cttz_nonzero(x: T) -> T; + pub fn bswap(x: T) -> T; + pub fn bitreverse(x: T) -> T; + } +} + +pub fn main() { + unsafe { + use rusti::*; + + assert_eq!(ctpop(0u8), 0); assert_eq!(ctpop(0i8), 0); + assert_eq!(ctpop(0u16), 0); assert_eq!(ctpop(0i16), 0); + assert_eq!(ctpop(0u32), 0); assert_eq!(ctpop(0i32), 0); + assert_eq!(ctpop(0u64), 0); assert_eq!(ctpop(0i64), 0); + assert_eq!(ctpop(0u128), 0); assert_eq!(ctpop(0i128), 0); + + assert_eq!(ctpop(1u8), 1); assert_eq!(ctpop(1i8), 1); + assert_eq!(ctpop(1u16), 1); assert_eq!(ctpop(1i16), 1); + assert_eq!(ctpop(1u32), 1); assert_eq!(ctpop(1i32), 1); + assert_eq!(ctpop(1u64), 1); assert_eq!(ctpop(1i64), 1); + assert_eq!(ctpop(1u128), 1); assert_eq!(ctpop(1i128), 1); + + assert_eq!(ctpop(10u8), 2); assert_eq!(ctpop(10i8), 2); + assert_eq!(ctpop(10u16), 2); assert_eq!(ctpop(10i16), 2); + assert_eq!(ctpop(10u32), 2); assert_eq!(ctpop(10i32), 2); + assert_eq!(ctpop(10u64), 2); assert_eq!(ctpop(10i64), 2); + assert_eq!(ctpop(10u128), 2); assert_eq!(ctpop(10i128), 2); + + assert_eq!(ctpop(100u8), 3); assert_eq!(ctpop(100i8), 3); + assert_eq!(ctpop(100u16), 3); assert_eq!(ctpop(100i16), 3); + assert_eq!(ctpop(100u32), 3); assert_eq!(ctpop(100i32), 3); + assert_eq!(ctpop(100u64), 3); assert_eq!(ctpop(100i64), 3); + assert_eq!(ctpop(100u128), 3); assert_eq!(ctpop(100i128), 3); + + assert_eq!(ctpop(-1i8 as u8), 8); assert_eq!(ctpop(-1i8), 8); + assert_eq!(ctpop(-1i16 as u16), 16); assert_eq!(ctpop(-1i16), 16); + assert_eq!(ctpop(-1i32 as u32), 32); assert_eq!(ctpop(-1i32), 32); + assert_eq!(ctpop(-1i64 as u64), 64); assert_eq!(ctpop(-1i64), 64); + assert_eq!(ctpop(-1i128 as u128), 128); assert_eq!(ctpop(-1i128), 128); + + assert_eq!(ctlz(0u8), 8); assert_eq!(ctlz(0i8), 8); + assert_eq!(ctlz(0u16), 16); assert_eq!(ctlz(0i16), 16); + assert_eq!(ctlz(0u32), 32); assert_eq!(ctlz(0i32), 32); + assert_eq!(ctlz(0u64), 64); assert_eq!(ctlz(0i64), 64); + assert_eq!(ctlz(0u128), 128); assert_eq!(ctlz(0i128), 128); + + assert_eq!(ctlz(1u8), 7); assert_eq!(ctlz(1i8), 7); + assert_eq!(ctlz(1u16), 15); assert_eq!(ctlz(1i16), 15); + assert_eq!(ctlz(1u32), 31); assert_eq!(ctlz(1i32), 31); + assert_eq!(ctlz(1u64), 63); assert_eq!(ctlz(1i64), 63); + assert_eq!(ctlz(1u128), 127); assert_eq!(ctlz(1i128), 127); + + assert_eq!(ctlz(10u8), 4); assert_eq!(ctlz(10i8), 4); + assert_eq!(ctlz(10u16), 12); assert_eq!(ctlz(10i16), 12); + assert_eq!(ctlz(10u32), 28); assert_eq!(ctlz(10i32), 28); + assert_eq!(ctlz(10u64), 60); assert_eq!(ctlz(10i64), 60); + assert_eq!(ctlz(10u128), 124); assert_eq!(ctlz(10i128), 124); + + assert_eq!(ctlz(100u8), 1); assert_eq!(ctlz(100i8), 1); + assert_eq!(ctlz(100u16), 9); assert_eq!(ctlz(100i16), 9); + assert_eq!(ctlz(100u32), 25); assert_eq!(ctlz(100i32), 25); + assert_eq!(ctlz(100u64), 57); assert_eq!(ctlz(100i64), 57); + assert_eq!(ctlz(100u128), 121); assert_eq!(ctlz(100i128), 121); + + assert_eq!(ctlz_nonzero(1u8), 7); assert_eq!(ctlz_nonzero(1i8), 7); + assert_eq!(ctlz_nonzero(1u16), 15); assert_eq!(ctlz_nonzero(1i16), 15); + assert_eq!(ctlz_nonzero(1u32), 31); assert_eq!(ctlz_nonzero(1i32), 31); + assert_eq!(ctlz_nonzero(1u64), 63); assert_eq!(ctlz_nonzero(1i64), 63); + assert_eq!(ctlz_nonzero(1u128), 127); assert_eq!(ctlz_nonzero(1i128), 127); + + assert_eq!(ctlz_nonzero(10u8), 4); assert_eq!(ctlz_nonzero(10i8), 4); + assert_eq!(ctlz_nonzero(10u16), 12); assert_eq!(ctlz_nonzero(10i16), 12); + assert_eq!(ctlz_nonzero(10u32), 28); assert_eq!(ctlz_nonzero(10i32), 28); + assert_eq!(ctlz_nonzero(10u64), 60); assert_eq!(ctlz_nonzero(10i64), 60); + assert_eq!(ctlz_nonzero(10u128), 124); assert_eq!(ctlz_nonzero(10i128), 124); + + assert_eq!(ctlz_nonzero(100u8), 1); assert_eq!(ctlz_nonzero(100i8), 1); + assert_eq!(ctlz_nonzero(100u16), 9); assert_eq!(ctlz_nonzero(100i16), 9); + assert_eq!(ctlz_nonzero(100u32), 25); assert_eq!(ctlz_nonzero(100i32), 25); + assert_eq!(ctlz_nonzero(100u64), 57); assert_eq!(ctlz_nonzero(100i64), 57); + assert_eq!(ctlz_nonzero(100u128), 121); assert_eq!(ctlz_nonzero(100i128), 121); + + assert_eq!(cttz(-1i8 as u8), 0); assert_eq!(cttz(-1i8), 0); + assert_eq!(cttz(-1i16 as u16), 0); assert_eq!(cttz(-1i16), 0); + assert_eq!(cttz(-1i32 as u32), 0); assert_eq!(cttz(-1i32), 0); + assert_eq!(cttz(-1i64 as u64), 0); assert_eq!(cttz(-1i64), 0); + assert_eq!(cttz(-1i128 as u128), 0); assert_eq!(cttz(-1i128), 0); + + assert_eq!(cttz(0u8), 8); assert_eq!(cttz(0i8), 8); + assert_eq!(cttz(0u16), 16); assert_eq!(cttz(0i16), 16); + assert_eq!(cttz(0u32), 32); assert_eq!(cttz(0i32), 32); + assert_eq!(cttz(0u64), 64); assert_eq!(cttz(0i64), 64); + assert_eq!(cttz(0u128), 128); assert_eq!(cttz(0i128), 128); + + assert_eq!(cttz(1u8), 0); assert_eq!(cttz(1i8), 0); + assert_eq!(cttz(1u16), 0); assert_eq!(cttz(1i16), 0); + assert_eq!(cttz(1u32), 0); assert_eq!(cttz(1i32), 0); + assert_eq!(cttz(1u64), 0); assert_eq!(cttz(1i64), 0); + assert_eq!(cttz(1u128), 0); assert_eq!(cttz(1i128), 0); + + assert_eq!(cttz(10u8), 1); assert_eq!(cttz(10i8), 1); + assert_eq!(cttz(10u16), 1); assert_eq!(cttz(10i16), 1); + assert_eq!(cttz(10u32), 1); assert_eq!(cttz(10i32), 1); + assert_eq!(cttz(10u64), 1); assert_eq!(cttz(10i64), 1); + assert_eq!(cttz(10u128), 1); assert_eq!(cttz(10i128), 1); + + assert_eq!(cttz(100u8), 2); assert_eq!(cttz(100i8), 2); + assert_eq!(cttz(100u16), 2); assert_eq!(cttz(100i16), 2); + assert_eq!(cttz(100u32), 2); assert_eq!(cttz(100i32), 2); + assert_eq!(cttz(100u64), 2); assert_eq!(cttz(100i64), 2); + assert_eq!(cttz(100u128), 2); assert_eq!(cttz(100i128), 2); + + assert_eq!(cttz_nonzero(-1i8 as u8), 0); assert_eq!(cttz_nonzero(-1i8), 0); + assert_eq!(cttz_nonzero(-1i16 as u16), 0); assert_eq!(cttz_nonzero(-1i16), 0); + assert_eq!(cttz_nonzero(-1i32 as u32), 0); assert_eq!(cttz_nonzero(-1i32), 0); + assert_eq!(cttz_nonzero(-1i64 as u64), 0); assert_eq!(cttz_nonzero(-1i64), 0); + assert_eq!(cttz_nonzero(-1i128 as u128), 0); assert_eq!(cttz_nonzero(-1i128), 0); + + assert_eq!(cttz_nonzero(1u8), 0); assert_eq!(cttz_nonzero(1i8), 0); + assert_eq!(cttz_nonzero(1u16), 0); assert_eq!(cttz_nonzero(1i16), 0); + assert_eq!(cttz_nonzero(1u32), 0); assert_eq!(cttz_nonzero(1i32), 0); + assert_eq!(cttz_nonzero(1u64), 0); assert_eq!(cttz_nonzero(1i64), 0); + assert_eq!(cttz_nonzero(1u128), 0); assert_eq!(cttz_nonzero(1i128), 0); + + assert_eq!(cttz_nonzero(10u8), 1); assert_eq!(cttz_nonzero(10i8), 1); + assert_eq!(cttz_nonzero(10u16), 1); assert_eq!(cttz_nonzero(10i16), 1); + assert_eq!(cttz_nonzero(10u32), 1); assert_eq!(cttz_nonzero(10i32), 1); + assert_eq!(cttz_nonzero(10u64), 1); assert_eq!(cttz_nonzero(10i64), 1); + assert_eq!(cttz_nonzero(10u128), 1); assert_eq!(cttz_nonzero(10i128), 1); + + assert_eq!(cttz_nonzero(100u8), 2); assert_eq!(cttz_nonzero(100i8), 2); + assert_eq!(cttz_nonzero(100u16), 2); assert_eq!(cttz_nonzero(100i16), 2); + assert_eq!(cttz_nonzero(100u32), 2); assert_eq!(cttz_nonzero(100i32), 2); + assert_eq!(cttz_nonzero(100u64), 2); assert_eq!(cttz_nonzero(100i64), 2); + assert_eq!(cttz_nonzero(100u128), 2); assert_eq!(cttz_nonzero(100i128), 2); + + assert_eq!(bswap(0x0Au8), 0x0A); // no-op + assert_eq!(bswap(0x0Ai8), 0x0A); // no-op + assert_eq!(bswap(0x0A0Bu16), 0x0B0A); + assert_eq!(bswap(0x0A0Bi16), 0x0B0A); + assert_eq!(bswap(0x0ABBCC0Du32), 0x0DCCBB0A); + assert_eq!(bswap(0x0ABBCC0Di32), 0x0DCCBB0A); + assert_eq!(bswap(0x0122334455667708u64), 0x0877665544332201); + assert_eq!(bswap(0x0122334455667708i64), 0x0877665544332201); + assert_eq!(bswap(0x0122334455667708u128), 0x08776655443322010000000000000000); + assert_eq!(bswap(0x0122334455667708i128), 0x08776655443322010000000000000000); + + assert_eq!(bitreverse(0x0Au8), 0x50); + assert_eq!(bitreverse(0x0Ai8), 0x50); + assert_eq!(bitreverse(0x0A0Cu16), 0x3050); + assert_eq!(bitreverse(0x0A0Ci16), 0x3050); + assert_eq!(bitreverse(0x0ABBCC0Eu32), 0x7033DD50); + assert_eq!(bitreverse(0x0ABBCC0Ei32), 0x7033DD50); + assert_eq!(bitreverse(0x0122334455667708u64), 0x10EE66AA22CC4480); + assert_eq!(bitreverse(0x0122334455667708i64), 0x10EE66AA22CC4480); + assert_eq!(bitreverse(0x0122334455667708u128), 0x10EE66AA22CC44800000000000000000); + assert_eq!(bitreverse(0x0122334455667708i128), 0x10EE66AA22CC44800000000000000000); + } +} diff --git a/src/test/run-pass/intrinsics/intrinsics-math.rs b/src/test/run-pass/intrinsics/intrinsics-math.rs new file mode 100644 index 00000000000..d08386beb9e --- /dev/null +++ b/src/test/run-pass/intrinsics/intrinsics-math.rs @@ -0,0 +1,70 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten fma not implemented in emscripten + +macro_rules! assert_approx_eq { + ($a:expr, $b:expr) => ({ + let (a, b) = (&$a, &$b); + assert!((*a - *b).abs() < 1.0e-6, + "{} is not approximately equal to {}", *a, *b); + }) +} + +pub fn main() { + use std::f32; + use std::f64; + + assert_approx_eq!(64f32.sqrt(), 8f32); + assert_approx_eq!(64f64.sqrt(), 8f64); + + assert_approx_eq!(25f32.powi(-2), 0.0016f32); + assert_approx_eq!(23.2f64.powi(2), 538.24f64); + + assert_approx_eq!(0f32.sin(), 0f32); + assert_approx_eq!((f64::consts::PI / 2f64).sin(), 1f64); + + assert_approx_eq!(0f32.cos(), 1f32); + assert_approx_eq!((f64::consts::PI * 2f64).cos(), 1f64); + + assert_approx_eq!(25f32.powf(-2f32), 0.0016f32); + assert_approx_eq!(400f64.powf(0.5f64), 20f64); + + assert_approx_eq!((1f32.exp() - f32::consts::E).abs(), 0f32); + assert_approx_eq!(1f64.exp(), f64::consts::E); + + assert_approx_eq!(10f32.exp2(), 1024f32); + assert_approx_eq!(50f64.exp2(), 1125899906842624f64); + + assert_approx_eq!((f32::consts::E.ln() - 1f32).abs(), 0f32); + assert_approx_eq!(1f64.ln(), 0f64); + + assert_approx_eq!(10f32.log10(), 1f32); + assert_approx_eq!(f64::consts::E.log10(), f64::consts::LOG10_E); + + assert_approx_eq!(8f32.log2(), 3f32); + assert_approx_eq!(f64::consts::E.log2(), f64::consts::LOG2_E); + + assert_approx_eq!(1.0f32.mul_add(2.0f32, 5.0f32), 7.0f32); + assert_approx_eq!(0.0f64.mul_add(-2.0f64, f64::consts::E), f64::consts::E); + + assert_approx_eq!((-1.0f32).abs(), 1.0f32); + assert_approx_eq!(34.2f64.abs(), 34.2f64); + + assert_approx_eq!(3.8f32.floor(), 3.0f32); + assert_approx_eq!((-1.1f64).floor(), -2.0f64); + + assert_approx_eq!((-2.3f32).ceil(), -2.0f32); + assert_approx_eq!(3.8f64.ceil(), 4.0f64); + + assert_approx_eq!(0.1f32.trunc(), 0.0f32); + assert_approx_eq!((-0.1f64).trunc(), 0.0f64); +} diff --git a/src/test/run-pass/issues/.gitattributes b/src/test/run-pass/issues/.gitattributes new file mode 100644 index 00000000000..4517a4a2f1e --- /dev/null +++ b/src/test/run-pass/issues/.gitattributes @@ -0,0 +1 @@ +issue-16278.rs -text diff --git a/src/test/run-pass/issues/auxiliary/cgu_test.rs b/src/test/run-pass/issues/auxiliary/cgu_test.rs new file mode 100644 index 00000000000..7c88d3d37e3 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/cgu_test.rs @@ -0,0 +1,16 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +// compile-flags: --crate-type=lib + +pub fn id(t: T) -> T { + t +} diff --git a/src/test/run-pass/issues/auxiliary/cgu_test_a.rs b/src/test/run-pass/issues/auxiliary/cgu_test_a.rs new file mode 100644 index 00000000000..0f0d1cd87e1 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/cgu_test_a.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +// compile-flags: -Ccodegen-units=2 --crate-type=lib + +extern crate cgu_test; + +pub mod a { + pub fn a() { + ::cgu_test::id(0); + } +} +pub mod b { + pub fn a() { + ::cgu_test::id(0); + } +} diff --git a/src/test/run-pass/issues/auxiliary/cgu_test_b.rs b/src/test/run-pass/issues/auxiliary/cgu_test_b.rs new file mode 100644 index 00000000000..0f0d1cd87e1 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/cgu_test_b.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +// compile-flags: -Ccodegen-units=2 --crate-type=lib + +extern crate cgu_test; + +pub mod a { + pub fn a() { + ::cgu_test::id(0); + } +} +pub mod b { + pub fn a() { + ::cgu_test::id(0); + } +} diff --git a/src/test/run-pass/issues/auxiliary/i8.rs b/src/test/run-pass/issues/auxiliary/i8.rs new file mode 100644 index 00000000000..44e62b99a96 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/i8.rs @@ -0,0 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// A crate named after a built-in type. + +pub struct Test; diff --git a/src/test/run-pass/issues/auxiliary/iss.rs b/src/test/run-pass/issues/auxiliary/iss.rs new file mode 100644 index 00000000000..b231efa0fec --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/iss.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="issue6919_3"] + +// part of issue-6919.rs + +pub struct C where K: FnOnce() { + pub k: K, +} + +fn no_op() { } +pub const D : C = C { + k: no_op as fn() +}; diff --git a/src/test/run-pass/issues/auxiliary/issue-10028.rs b/src/test/run-pass/issues/auxiliary/issue-10028.rs new file mode 100644 index 00000000000..ed42ad6e875 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-10028.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct ZeroLengthThingWithDestructor; +impl Drop for ZeroLengthThingWithDestructor { + fn drop(&mut self) {} +} +impl ZeroLengthThingWithDestructor { + pub fn new() -> ZeroLengthThingWithDestructor { + ZeroLengthThingWithDestructor + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-11224.rs b/src/test/run-pass/issues/auxiliary/issue-11224.rs new file mode 100644 index 00000000000..15b72b37781 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-11224.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![deny(dead_code)] + +mod inner { + pub trait Trait { + fn f(&self) { f(); } + } + + impl Trait for isize {} + + fn f() {} +} + +pub fn foo() { + let a = &1isize as &inner::Trait; + a.f(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-11225-1.rs b/src/test/run-pass/issues/auxiliary/issue-11225-1.rs new file mode 100644 index 00000000000..e1ec15be927 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-11225-1.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +mod inner { + pub trait Trait { + fn f(&self) { f(); } + fn f_ufcs(&self) { f_ufcs(); } + } + + impl Trait for isize {} + + fn f() {} + fn f_ufcs() {} +} + +pub fn foo(t: T) { + t.f(); +} +pub fn foo_ufcs(t: T) { + T::f_ufcs(&t); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-11225-2.rs b/src/test/run-pass/issues/auxiliary/issue-11225-2.rs new file mode 100644 index 00000000000..25110edda27 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-11225-2.rs @@ -0,0 +1,38 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use inner::Trait; + +mod inner { + pub struct Foo; + pub trait Trait { + fn f(&self); + fn f_ufcs(&self); + } + + impl Trait for Foo { + fn f(&self) { } + fn f_ufcs(&self) { } + } +} + +pub trait Outer { + fn foo(&self, t: T) { t.f(); } + fn foo_ufcs(&self, t: T) { T::f(&t); } +} + +impl Outer for isize {} + +pub fn foo(t: T) { + t.foo(inner::Foo); +} +pub fn foo_ufcs(t: T) { + T::foo_ufcs(&t, inner::Foo) +} diff --git a/src/test/run-pass/issues/auxiliary/issue-11225-3.rs b/src/test/run-pass/issues/auxiliary/issue-11225-3.rs new file mode 100644 index 00000000000..d48fb68ba0f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-11225-3.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait PrivateTrait { + fn private_trait_method(&self); + fn private_trait_method_ufcs(&self); +} + +struct PrivateStruct; + +impl PrivateStruct { + fn private_inherent_method(&self) { } + fn private_inherent_method_ufcs(&self) { } +} + +impl PrivateTrait for PrivateStruct { + fn private_trait_method(&self) { } + fn private_trait_method_ufcs(&self) { } +} + +#[inline] +pub fn public_inlinable_function() { + PrivateStruct.private_trait_method(); + PrivateStruct.private_inherent_method(); +} + +#[inline] +pub fn public_inlinable_function_ufcs() { + PrivateStruct::private_trait_method(&PrivateStruct); + PrivateStruct::private_inherent_method(&PrivateStruct); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-11508.rs b/src/test/run-pass/issues/auxiliary/issue-11508.rs new file mode 100644 index 00000000000..c5dc3439f2f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-11508.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Closed01(pub F); + +pub trait Bar { fn new() -> Self; } + +impl Bar for Closed01 { + fn new() -> Closed01 { Closed01(Bar::new()) } +} +impl Bar for f32 { fn new() -> f32 { 1.0 } } + +pub fn random() -> T { Bar::new() } diff --git a/src/test/run-pass/issues/auxiliary/issue-11529.rs b/src/test/run-pass/issues/auxiliary/issue-11529.rs new file mode 100644 index 00000000000..21ef99e3c3d --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-11529.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct A<'a>(pub &'a isize); diff --git a/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs b/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs new file mode 100644 index 00000000000..ea22258f67d --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-12133-dylib.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "dylib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs b/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs new file mode 100644 index 00000000000..fa5722ae6a3 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-12133-dylib2.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "dylib"] + +extern crate issue_12133_rlib as a; +extern crate issue_12133_dylib as b; diff --git a/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs b/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs new file mode 100644 index 00000000000..8e46acca124 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-12133-rlib.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] diff --git a/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs b/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs new file mode 100644 index 00000000000..9f2bd5d0e93 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-12660-aux.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] +#![crate_name="issue12660aux"] + +pub use my_mod::{MyStruct, my_fn}; + +mod my_mod { + pub struct MyStruct; + + pub fn my_fn(my_struct: MyStruct) { + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-13620-1.rs b/src/test/run-pass/issues/auxiliary/issue-13620-1.rs new file mode 100644 index 00000000000..e373421fabf --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-13620-1.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo { + pub foo: extern fn() +} + +extern fn the_foo() {} + +pub const FOO: Foo = Foo { + foo: the_foo +}; diff --git a/src/test/run-pass/issues/auxiliary/issue-13620-2.rs b/src/test/run-pass/issues/auxiliary/issue-13620-2.rs new file mode 100644 index 00000000000..554170bc130 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-13620-2.rs @@ -0,0 +1,13 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate issue_13620_1 as crate1; + +pub static FOO2: crate1::Foo = crate1::FOO; diff --git a/src/test/run-pass/issues/auxiliary/issue-13872-1.rs b/src/test/run-pass/issues/auxiliary/issue-13872-1.rs new file mode 100644 index 00000000000..941b67eb2da --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-13872-1.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub enum A { B } diff --git a/src/test/run-pass/issues/auxiliary/issue-13872-2.rs b/src/test/run-pass/issues/auxiliary/issue-13872-2.rs new file mode 100644 index 00000000000..bb51417528a --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-13872-2.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate issue_13872_1 as foo; + +pub use foo::A::B; diff --git a/src/test/run-pass/issues/auxiliary/issue-13872-3.rs b/src/test/run-pass/issues/auxiliary/issue-13872-3.rs new file mode 100644 index 00000000000..e20618f1ec0 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-13872-3.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate issue_13872_2 as bar; + +use bar::B; + +pub fn foo() { + match B { + B => {} + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-14344-1.rs b/src/test/run-pass/issues/auxiliary/issue-14344-1.rs new file mode 100644 index 00000000000..78c03bac33f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-14344-1.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn foo() {} diff --git a/src/test/run-pass/issues/auxiliary/issue-14344-2.rs b/src/test/run-pass/issues/auxiliary/issue-14344-2.rs new file mode 100644 index 00000000000..9df35e50adb --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-14344-2.rs @@ -0,0 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate issue_14344_1; + +pub fn bar() {} diff --git a/src/test/run-pass/issues/auxiliary/issue-14421.rs b/src/test/run-pass/issues/auxiliary/issue-14421.rs new file mode 100644 index 00000000000..a48088609f9 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-14421.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] +#![deny(warnings)] +#![allow(dead_code)] + +pub use src::aliases::B; +pub use src::hidden_core::make; + +mod src { + pub mod aliases { + use super::hidden_core::A; + pub type B = A; + } + + pub mod hidden_core { + use super::aliases::B; + + pub struct A { t: T } + + pub fn make() -> B { A { t: 1.0 } } + + impl A { + pub fn foo(&mut self) { println!("called foo"); } + } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-14422.rs b/src/test/run-pass/issues/auxiliary/issue-14422.rs new file mode 100644 index 00000000000..32af6d9255e --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-14422.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] +#![deny(warnings)] + +pub use src::aliases::B; +pub use src::hidden_core::make; + +mod src { + pub mod aliases { + use super::hidden_core::A; + pub type B = A; + } + + pub mod hidden_core { + use super::aliases::B; + + #[derive(Copy, Clone)] + pub struct A; + + pub fn make() -> B { A } + + impl A { + pub fn foo(&mut self) { println!("called foo"); } + } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-15562.rs b/src/test/run-pass/issues/auxiliary/issue-15562.rs new file mode 100644 index 00000000000..76243d3bced --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-15562.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +extern { + pub fn transmute(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-16643.rs b/src/test/run-pass/issues/auxiliary/issue-16643.rs new file mode 100644 index 00000000000..b590160a0c2 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-16643.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub struct TreeBuilder { pub h: H } + +impl TreeBuilder { + pub fn process_token(&mut self) { + match self { + _ => for _y in self.by_ref() {} + } + } +} + +impl Iterator for TreeBuilder { + type Item = H; + + fn next(&mut self) -> Option { + None + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-17662.rs b/src/test/run-pass/issues/auxiliary/issue-17662.rs new file mode 100644 index 00000000000..fb55a077005 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-17662.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub trait Foo<'a, T> { + fn foo(&'a self) -> T; +} + +pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T { + let x: &'a Foo = x; + // ^ the lifetime parameter of Foo is left to be inferred. + x.foo() + // ^ encoding this method call in metadata triggers an ICE. +} diff --git a/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs b/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs new file mode 100644 index 00000000000..2bc8b4b7ba0 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-17718-aux.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::sync::atomic; + +pub const C1: usize = 1; +pub const C2: atomic::AtomicUsize = atomic::AtomicUsize::new(0); +pub const C3: fn() = { fn foo() {} foo }; +pub const C4: usize = C1 * C1 + C1 / C1; +pub const C5: &'static usize = &C4; + +pub static S1: usize = 3; +pub static S2: atomic::AtomicUsize = atomic::AtomicUsize::new(0); + diff --git a/src/test/run-pass/issues/auxiliary/issue-18501.rs b/src/test/run-pass/issues/auxiliary/issue-18501.rs new file mode 100644 index 00000000000..af3bc20378c --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-18501.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] +struct Foo; + +trait Tr { + fn tr(&self); +} + +impl Tr for Foo { + fn tr(&self) {} +} + +fn take_method(f: fn(&T), t: &T) {} + +#[inline] +pub fn pass_method() { + take_method(Tr::tr, &Foo); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-18514.rs b/src/test/run-pass/issues/auxiliary/issue-18514.rs new file mode 100644 index 00000000000..2a5e07a3285 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-18514.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] + +pub trait Tr { + fn tr(&self); +} + +pub struct St(pub Vec); + +impl Tr for St { + fn tr(&self) { + match self { + &St(ref v) => { + v.iter(); + } + } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-18711.rs b/src/test/run-pass/issues/auxiliary/issue-18711.rs new file mode 100644 index 00000000000..c247c0223fc --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-18711.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] + +pub fn inner(f: F) -> F { + (move || f)() +} diff --git a/src/test/run-pass/issues/auxiliary/issue-18913-1.rs b/src/test/run-pass/issues/auxiliary/issue-18913-1.rs new file mode 100644 index 00000000000..4315e27797f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-18913-1.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![crate_name = "foo"] + +pub fn foo() -> i32 { 0 } diff --git a/src/test/run-pass/issues/auxiliary/issue-18913-2.rs b/src/test/run-pass/issues/auxiliary/issue-18913-2.rs new file mode 100644 index 00000000000..dcdeaec48f5 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-18913-2.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] +#![crate_name = "foo"] + +pub fn foo() -> i32 { 1 } diff --git a/src/test/run-pass/issues/auxiliary/issue-19340-1.rs b/src/test/run-pass/issues/auxiliary/issue-19340-1.rs new file mode 100644 index 00000000000..fc61b78d8a7 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-19340-1.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub enum Homura { + Madoka { name: String }, +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2380.rs b/src/test/run-pass/issues/auxiliary/issue-2380.rs new file mode 100644 index 00000000000..b3e0f061485 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2380.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="a"] +#![crate_type = "lib"] + +#![feature(box_syntax)] + +pub trait i +{ + fn dummy(&self, t: T) -> T { panic!() } +} + +pub fn f() -> Box+'static> { + impl i for () { } + + box () as Box+'static> +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2414-a.rs b/src/test/run-pass/issues/auxiliary/issue-2414-a.rs new file mode 100644 index 00000000000..8c414193bd6 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2414-a.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="a"] +#![crate_type = "lib"] + +type t1 = usize; + +trait foo { + fn foo(&self); +} + +impl foo for String { + fn foo(&self) {} +} diff --git a/src/test/run-pass/issues/auxiliary/issue-2414-b.rs b/src/test/run-pass/issues/auxiliary/issue-2414-b.rs new file mode 100644 index 00000000000..b1c95bcb430 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2414-b.rs @@ -0,0 +1,15 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +#![crate_name="b"] +#![crate_type = "lib"] + +extern crate a; diff --git a/src/test/run-pass/issues/auxiliary/issue-25185-1.rs b/src/test/run-pass/issues/auxiliary/issue-25185-1.rs new file mode 100644 index 00000000000..b9da39cbbcb --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-25185-1.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + pub fn rust_dbg_extern_identity_u32(u: u32) -> u32; +} diff --git a/src/test/run-pass/issues/auxiliary/issue-25185-2.rs b/src/test/run-pass/issues/auxiliary/issue-25185-2.rs new file mode 100644 index 00000000000..00b5277d6c0 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-25185-2.rs @@ -0,0 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate issue_25185_1; + +pub use issue_25185_1::rust_dbg_extern_identity_u32; diff --git a/src/test/run-pass/issues/auxiliary/issue-2526.rs b/src/test/run-pass/issues/auxiliary/issue-2526.rs new file mode 100644 index 00000000000..3d777d01d50 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2526.rs @@ -0,0 +1,54 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="issue_2526"] +#![crate_type = "lib"] + +use std::marker; + +pub struct arc_destruct { + _data: isize, + _marker: marker::PhantomData +} + +impl Drop for arc_destruct { + fn drop(&mut self) {} +} + +fn arc_destruct(data: isize) -> arc_destruct { + arc_destruct { + _data: data, + _marker: marker::PhantomData + } +} + +fn arc(_data: T) -> arc_destruct { + arc_destruct(0) +} + +fn init() -> arc_destruct { + arc(context_res()) +} + +pub struct context_res { + ctx : isize, +} + +impl Drop for context_res { + fn drop(&mut self) {} +} + +fn context_res() -> context_res { + context_res { + ctx: 0 + } +} + +pub type context = arc_destruct; diff --git a/src/test/run-pass/issues/auxiliary/issue-25467.rs b/src/test/run-pass/issues/auxiliary/issue-25467.rs new file mode 100644 index 00000000000..e358cde1573 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-25467.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub trait Trait { + // the issue is sensitive to interning order - so use names + // unlikely to appear in libstd. + type Issue25467FooT; + type Issue25467BarT; +} + +pub type Object = Option>>; diff --git a/src/test/run-pass/issues/auxiliary/issue-2631-a.rs b/src/test/run-pass/issues/auxiliary/issue-2631-a.rs new file mode 100644 index 00000000000..604a3e69a21 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-2631-a.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="req"] +#![crate_type = "lib"] + +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +pub type header_map = HashMap>>>>; + +// the unused ty param is necessary so this gets monomorphized +pub fn request(req: &header_map) { + let data = req[&"METHOD".to_string()].clone(); + let _x = data.borrow().clone()[0].clone(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue-29485.rs b/src/test/run-pass/issues/auxiliary/issue-29485.rs new file mode 100644 index 00000000000..825c4497021 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-29485.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="a"] +#![crate_type = "lib"] + +pub struct X(pub u8); + +impl Drop for X { + fn drop(&mut self) { + assert_eq!(self.0, 1) + } +} + +pub fn f(x: &mut X, g: fn()) { + x.0 = 1; + g(); + x.0 = 0; +} diff --git a/src/test/run-pass/issues/auxiliary/issue-3012-1.rs b/src/test/run-pass/issues/auxiliary/issue-3012-1.rs new file mode 100644 index 00000000000..f34a97519e7 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-3012-1.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="socketlib"] +#![crate_type = "lib"] + +pub mod socket { + pub struct socket_handle { + sockfd: u32, + } + + impl Drop for socket_handle { + fn drop(&mut self) { + /* c::close(self.sockfd); */ + } + } + + pub fn socket_handle(x: u32) -> socket_handle { + socket_handle { + sockfd: x + } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-36954.rs b/src/test/run-pass/issues/auxiliary/issue-36954.rs new file mode 100644 index 00000000000..5351a40916b --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-36954.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(min_const_fn)] +#![crate_type = "lib"] + +const fn foo(i: i32) -> i32 { + i +} + +pub const FOO: i32 = foo(1); diff --git a/src/test/run-pass/issues/auxiliary/issue-41394.rs b/src/test/run-pass/issues/auxiliary/issue-41394.rs new file mode 100644 index 00000000000..f06b81279ac --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-41394.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +#[repr(u32)] +pub enum Foo { + Foo = Private::Variant as u32 +} + +#[repr(u8)] +enum Private { + Variant = 42 +} + +#[inline(always)] +pub fn foo() -> Foo { + Foo::Foo +} diff --git a/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs b/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs new file mode 100644 index 00000000000..a7c1633784d --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-4208-cc.rs @@ -0,0 +1,20 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="numeric"] +#![crate_type = "lib"] + +pub trait Trig { + fn sin(&self) -> T; +} + +pub fn sin, R>(theta: &T) -> R { theta.sin() } + +pub trait Angle: Trig {} diff --git a/src/test/run-pass/issues/auxiliary/issue-4545.rs b/src/test/run-pass/issues/auxiliary/issue-4545.rs new file mode 100644 index 00000000000..29feeaa7d92 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-4545.rs @@ -0,0 +1,12 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct S(Option); +pub fn mk() -> S { S(None) } diff --git a/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs b/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs new file mode 100644 index 00000000000..6290279701e --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-48984-aux.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] +#![crate_name = "issue48984aux"] + +pub trait Foo { type Item; } + +pub trait Bar: Foo { } diff --git a/src/test/run-pass/issues/auxiliary/issue-5518.rs b/src/test/run-pass/issues/auxiliary/issue-5518.rs new file mode 100644 index 00000000000..cea227e050f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-5518.rs @@ -0,0 +1,14 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait A<'a, T> { + fn f(&mut self) -> &'a mut T; + fn p() -> T; +} diff --git a/src/test/run-pass/issues/auxiliary/issue-5521.rs b/src/test/run-pass/issues/auxiliary/issue-5521.rs new file mode 100644 index 00000000000..82bd2b64204 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-5521.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +use std::collections::HashMap; + +pub type map = Box>; diff --git a/src/test/run-pass/issues/auxiliary/issue-7178.rs b/src/test/run-pass/issues/auxiliary/issue-7178.rs new file mode 100644 index 00000000000..18b464bd924 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-7178.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo<'a, A:'a>(&'a A); + +impl<'a, A> Foo<'a, A> { + pub fn new(a: &'a A) -> Foo<'a, A> { + Foo(a) + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-7899.rs b/src/test/run-pass/issues/auxiliary/issue-7899.rs new file mode 100644 index 00000000000..e197e84442b --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-7899.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct V2(pub T, pub T); diff --git a/src/test/run-pass/issues/auxiliary/issue-8044.rs b/src/test/run-pass/issues/auxiliary/issue-8044.rs new file mode 100644 index 00000000000..8f328699ae0 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-8044.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct BTree { + pub node: TreeItem, +} + +pub enum TreeItem { + TreeLeaf { value: V }, +} + +pub fn leaf(value: V) -> TreeItem { + TreeItem::TreeLeaf { value: value } +} + +fn main() { + BTree:: { node: leaf(1) }; +} diff --git a/src/test/run-pass/issues/auxiliary/issue-8259.rs b/src/test/run-pass/issues/auxiliary/issue-8259.rs new file mode 100644 index 00000000000..91167e8e32b --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-8259.rs @@ -0,0 +1,15 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub enum Foo<'a> { + A, + B(&'a str), +} diff --git a/src/test/run-pass/issues/auxiliary/issue-9906.rs b/src/test/run-pass/issues/auxiliary/issue-9906.rs new file mode 100644 index 00000000000..5eb48985bf9 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-9906.rs @@ -0,0 +1,25 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use other::FooBar; +pub use other::foo; + +mod other { + pub struct FooBar{value: isize} + impl FooBar{ + pub fn new(val: isize) -> FooBar { + FooBar{value: val} + } + } + + pub fn foo(){ + 1+1; + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue-9968.rs b/src/test/run-pass/issues/auxiliary/issue-9968.rs new file mode 100644 index 00000000000..d04d761e112 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue-9968.rs @@ -0,0 +1,32 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use internal::core::{Trait, Struct}; + +mod internal { + pub mod core { + pub struct Struct; + impl Struct { + pub fn init() -> Struct { + Struct + } + } + + pub trait Trait { + fn test(&self) { + private(); + } + } + + impl Trait for Struct {} + + fn private() { } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue13507.rs b/src/test/run-pass/issues/auxiliary/issue13507.rs new file mode 100644 index 00000000000..87b01ed9900 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue13507.rs @@ -0,0 +1,97 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod testtypes { + use std::any::TypeId; + + pub fn type_ids() -> Vec { + vec![ + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::() + ] + } + + // Tests Bool + pub type FooBool = bool; + + // Tests Char + pub type FooChar = char; + + // Tests Int (does not test all variants of IntTy) + pub type FooInt = isize; + + // Tests Uint (does not test all variants of UintTy) + pub type FooUint = usize; + + // Tests Float (does not test all variants of FloatTy) + pub type FooFloat = f64; + + // Tests Str + pub type FooStr = str; + + // Tests Array + pub type FooArray = [u8; 1]; + + // Tests Slice + pub type FooSlice = [u8]; + + // Tests Box (of u8) + pub type FooBox = Box; + + // Tests RawPtr + pub type FooPtr = *const u8; + + // Tests Ref + pub type FooRef = &'static u8; + + // Tests FnPtr + pub type FooFnPtr = fn(u8) -> bool; + + // Tests Dynamic + pub trait FooTrait { + fn foo_method(&self) -> usize; + } + + // Tests struct + pub struct FooStruct { + pub pub_foo_field: usize, + foo_field: usize + } + + // Tests enum + pub enum FooEnum { + VarA(usize), + VarB(usize, usize) + } + + // Tests Tuple + pub type FooNil = (); + pub type FooTuple = (u8, i8, bool); + + // Skipping Param + + // Skipping Infer + + // Skipping Error +} diff --git a/src/test/run-pass/issues/auxiliary/issue2170lib.rs b/src/test/run-pass/issues/auxiliary/issue2170lib.rs new file mode 100644 index 00000000000..b311ee35674 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue2170lib.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn foo(_x: i32) { +} + +pub struct rsrc { + x: i32, +} + +impl Drop for rsrc { + fn drop(&mut self) { + foo(self.x); + } +} + +pub fn rsrc(x: i32) -> rsrc { + rsrc { + x: x + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue34796aux.rs b/src/test/run-pass/issues/auxiliary/issue34796aux.rs new file mode 100644 index 00000000000..9131b609c4c --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue34796aux.rs @@ -0,0 +1,30 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] +pub trait Future { + type Item; + type Error; +} + +impl Future for u32 { + type Item = (); + type Error = Box<()>; +} + +fn foo() -> Box>> { + Box::new(0u32) +} + +pub fn bar(_s: F) + where F: Fn(A) -> B, +{ + foo(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs b/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs new file mode 100644 index 00000000000..f0f1af2e3a3 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_10031_aux.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Wrap(pub A); diff --git a/src/test/run-pass/issues/auxiliary/issue_12612_1.rs b/src/test/run-pass/issues/auxiliary/issue_12612_1.rs new file mode 100644 index 00000000000..a0234c1185a --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_12612_1.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod bar { + pub fn foo() {} +} diff --git a/src/test/run-pass/issues/auxiliary/issue_12612_2.rs b/src/test/run-pass/issues/auxiliary/issue_12612_2.rs new file mode 100644 index 00000000000..b4ae4374b2e --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_12612_2.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn baz() {} diff --git a/src/test/run-pass/issues/auxiliary/issue_19293.rs b/src/test/run-pass/issues/auxiliary/issue_19293.rs new file mode 100644 index 00000000000..12894ad72e1 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_19293.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo (pub isize); +pub enum MyEnum { + Foo(Foo), +} diff --git a/src/test/run-pass/issues/auxiliary/issue_20389.rs b/src/test/run-pass/issues/auxiliary/issue_20389.rs new file mode 100644 index 00000000000..4ce7e3079e3 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_20389.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait T { + type C; + fn dummy(&self) { } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_2316_a.rs b/src/test/run-pass/issues/auxiliary/issue_2316_a.rs new file mode 100644 index 00000000000..6bd1e7335ad --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_2316_a.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +enum cat { + tabby, calico, tortoiseshell +} diff --git a/src/test/run-pass/issues/auxiliary/issue_2316_b.rs b/src/test/run-pass/issues/auxiliary/issue_2316_b.rs new file mode 100644 index 00000000000..8a212f6e5a9 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_2316_b.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(unused_imports)] + +extern crate issue_2316_a; + +pub mod cloth { + use issue_2316_a::*; + + pub enum fabric { + gingham, flannel, calico + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_2472_b.rs b/src/test/run-pass/issues/auxiliary/issue_2472_b.rs new file mode 100644 index 00000000000..5f55476427f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_2472_b.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub struct S(pub ()); + +impl S { + pub fn foo(&self) { } +} + +pub trait T { + fn bar(&self); +} + +impl T for S { + fn bar(&self) { } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_2723_a.rs b/src/test/run-pass/issues/auxiliary/issue_2723_a.rs new file mode 100644 index 00000000000..44bea136a7c --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_2723_a.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub unsafe fn f(xs: Vec ) { + xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::>(); +} diff --git a/src/test/run-pass/issues/auxiliary/issue_3136_a.rc b/src/test/run-pass/issues/auxiliary/issue_3136_a.rc new file mode 100644 index 00000000000..320e0ceed0f --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_3136_a.rc @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub mod issue_3136_a; diff --git a/src/test/run-pass/issues/auxiliary/issue_3136_a.rs b/src/test/run-pass/issues/auxiliary/issue_3136_a.rs new file mode 100644 index 00000000000..55de208cc90 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_3136_a.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +trait x { + fn use_x(&self); +} +struct y(()); +impl x for y { + fn use_x(&self) { + struct foo { //~ ERROR quux + i: () + } + fn new_foo(i: ()) -> foo { + foo { i: i } + } + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_38190.rs b/src/test/run-pass/issues/auxiliary/issue_38190.rs new file mode 100644 index 00000000000..7fc4390d6dc --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_38190.rs @@ -0,0 +1,12 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_export] +macro_rules! m { ([$i:item]) => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs b/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs new file mode 100644 index 00000000000..d48a9733685 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_38226_aux.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="rlib"] + +#[inline(never)] +pub fn foo() { + let _: Box = Box::new(SomeTraitImpl); +} + +pub fn bar() { + SomeTraitImpl.bar(); +} + +mod submod { + pub trait SomeTrait { + fn bar(&self) { + panic!("NO") + } + } +} + +use self::submod::SomeTrait; + +pub struct SomeTraitImpl; +impl SomeTrait for SomeTraitImpl {} diff --git a/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs b/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs new file mode 100644 index 00000000000..7f14b2c4659 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_38715-modern.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(duplicate_macro_exports)] + +#[macro_export] +macro_rules! foo_modern { ($i:ident) => {} } + +#[macro_export] +macro_rules! foo_modern { () => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_38715.rs b/src/test/run-pass/issues/auxiliary/issue_38715.rs new file mode 100644 index 00000000000..cf4fee0e515 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_38715.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![allow(duplicate_macro_exports)] + +#[macro_export] +macro_rules! foo { ($i:ident) => {} } + +#[macro_export] +macro_rules! foo { () => {} } diff --git a/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs b/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs new file mode 100644 index 00000000000..46035731c30 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_3979_traits.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="issue_3979_traits"] + +#![crate_type = "lib"] + +pub trait Positioned { + fn SetX(&mut self, _: isize); + fn X(&self) -> isize; +} + +pub trait Movable: Positioned { + fn translate(&mut self, dx: isize) { + let x = self.X() + dx; + self.SetX(x); + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_39823.rs b/src/test/run-pass/issues/auxiliary/issue_39823.rs new file mode 100644 index 00000000000..5342601ac14 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_39823.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="rlib"] + +#[derive(Debug, PartialEq)] +pub struct RemoteC(pub u32); + +#[derive(Debug, PartialEq)] +pub struct RemoteG(pub T); diff --git a/src/test/run-pass/issues/auxiliary/issue_40469.rs b/src/test/run-pass/issues/auxiliary/issue_40469.rs new file mode 100644 index 00000000000..4970bba431a --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_40469.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! m { () => { $crate::main(); } } diff --git a/src/test/run-pass/issues/auxiliary/issue_41053.rs b/src/test/run-pass/issues/auxiliary/issue_41053.rs new file mode 100644 index 00000000000..68e92b10429 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_41053.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Test; diff --git a/src/test/run-pass/issues/auxiliary/issue_42007_s.rs b/src/test/run-pass/issues/auxiliary/issue_42007_s.rs new file mode 100644 index 00000000000..91ad9869ed8 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_42007_s.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[repr(u8)] +pub enum E { + B = 1 as u8, +} diff --git a/src/test/run-pass/issues/auxiliary/issue_8401.rs b/src/test/run-pass/issues/auxiliary/issue_8401.rs new file mode 100644 index 00000000000..40e01c1474a --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_8401.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// for this issue, this code must be built in a library + +use std::mem; + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +fn bar(_: &mut A, _: &T) {} + +fn foo(t: &T) { + let mut b = B; + bar(&mut b as &mut A, t) +} diff --git a/src/test/run-pass/issues/auxiliary/issue_9123.rs b/src/test/run-pass/issues/auxiliary/issue_9123.rs new file mode 100644 index 00000000000..8c2546e76cf --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_9123.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub trait X { + fn x() { + fn f() { } + f(); + } + fn dummy(&self) { } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_9155.rs b/src/test/run-pass/issues/auxiliary/issue_9155.rs new file mode 100644 index 00000000000..486eb8fd6f6 --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_9155.rs @@ -0,0 +1,17 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo(T); + +impl Foo { + pub fn new(t: T) -> Foo { + Foo(t) + } +} diff --git a/src/test/run-pass/issues/auxiliary/issue_9188.rs b/src/test/run-pass/issues/auxiliary/issue_9188.rs new file mode 100644 index 00000000000..8ff85cc359d --- /dev/null +++ b/src/test/run-pass/issues/auxiliary/issue_9188.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() -> &'static isize { + if false { + static a: isize = 4; + return &a; + } else { + static a: isize = 5; + return &a; + } +} + +pub fn bar() -> &'static isize { + foo::() +} diff --git a/src/test/run-pass/issues/issue-10025.rs b/src/test/run-pass/issues/issue-10025.rs new file mode 100644 index 00000000000..bd286bca938 --- /dev/null +++ b/src/test/run-pass/issues/issue-10025.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +unsafe extern fn foo() {} +unsafe extern "C" fn bar() {} + +fn main() { + let _a: unsafe extern fn() = foo; + let _a: unsafe extern "C" fn() = foo; +} diff --git a/src/test/run-pass/issues/issue-10028.rs b/src/test/run-pass/issues/issue-10028.rs new file mode 100644 index 00000000000..b89ecb0b9df --- /dev/null +++ b/src/test/run-pass/issues/issue-10028.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-10028.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_10028 as issue10028; + +use issue10028::ZeroLengthThingWithDestructor; + +struct Foo { + zero_length_thing: ZeroLengthThingWithDestructor +} + +fn make_foo() -> Foo { + Foo { zero_length_thing: ZeroLengthThingWithDestructor::new() } +} + +fn main() { + let _f:Foo = make_foo(); +} diff --git a/src/test/run-pass/issues/issue-10031.rs b/src/test/run-pass/issues/issue-10031.rs new file mode 100644 index 00000000000..215760343f0 --- /dev/null +++ b/src/test/run-pass/issues/issue-10031.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_10031_aux.rs +// pretty-expanded FIXME #23616 + +extern crate issue_10031_aux; + +pub fn main() { + let _ = issue_10031_aux::Wrap(()); +} diff --git a/src/test/run-pass/issues/issue-10228.rs b/src/test/run-pass/issues/issue-10228.rs new file mode 100644 index 00000000000..7ed8f5be936 --- /dev/null +++ b/src/test/run-pass/issues/issue-10228.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum StdioContainer { + CreatePipe(bool) +} + +struct Test<'a> { + args: &'a [String], + io: &'a [StdioContainer] +} + +pub fn main() { + let test = Test { + args: &[], + io: &[StdioContainer::CreatePipe(true)] + }; +} diff --git a/src/test/run-pass/issues/issue-10392.rs b/src/test/run-pass/issues/issue-10392.rs new file mode 100644 index 00000000000..65c88f445c2 --- /dev/null +++ b/src/test/run-pass/issues/issue-10392.rs @@ -0,0 +1,39 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct A { foo: isize } +struct B { a: isize, b: isize, c: isize } + +fn mka() -> A { panic!() } +fn mkb() -> B { panic!() } + +fn test() { + let A { foo, } = mka(); + let A { + foo, + } = mka(); + + let B { a, b, c, } = mkb(); + + match mka() { + A { foo: _foo, } => {} + } + + match Some(mka()) { + Some(A { foo: _foo, }) => {} + None => {} + } +} + +pub fn main() { + if false { test() } +} diff --git a/src/test/run-pass/issues/issue-10396.rs b/src/test/run-pass/issues/issue-10396.rs new file mode 100644 index 00000000000..f0b3b276fcf --- /dev/null +++ b/src/test/run-pass/issues/issue-10396.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +enum Foo<'s> { + V(&'s str) +} + +fn f(arr: &[&Foo]) { + for &f in arr { + println!("{:?}", f); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-10436.rs b/src/test/run-pass/issues/issue-10436.rs new file mode 100644 index 00000000000..f7f890d8188 --- /dev/null +++ b/src/test/run-pass/issues/issue-10436.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn works(x: T) -> Vec { vec![x] } + +fn also_works(x: T) -> Vec { vec![x] } + +fn main() { + let _: Vec = works(0); + let _: Vec = also_works(0); + let _ = works(0); + let _ = also_works(0); +} diff --git a/src/test/run-pass/issues/issue-10456.rs b/src/test/run-pass/issues/issue-10456.rs new file mode 100644 index 00000000000..66b813f82a4 --- /dev/null +++ b/src/test/run-pass/issues/issue-10456.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub struct Foo; + +pub trait Bar { + fn bar(&self); +} + +pub trait Baz { + fn baz(&self) { } +} + +impl Bar for T { + fn bar(&self) {} +} + +impl Baz for Foo {} + +pub fn foo(t: Box) { + t.bar(); // ~Foo doesn't implement Baz + (*t).bar(); // ok b/c Foo implements Baz +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-10626.rs b/src/test/run-pass/issues/issue-10626.rs new file mode 100644 index 00000000000..75c2368d9da --- /dev/null +++ b/src/test/run-pass/issues/issue-10626.rs @@ -0,0 +1,36 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +// Make sure that if a process doesn't have its stdio/stderr descriptors set up +// that we don't die in a large ball of fire + +use std::env; +use std::process::{Command, Stdio}; + +pub fn main () { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + for _ in 0..1000 { + println!("hello?"); + } + for _ in 0..1000 { + println!("hello?"); + } + return; + } + + let mut p = Command::new(&args[0]); + p.arg("child").stdout(Stdio::null()).stderr(Stdio::null()); + println!("{:?}", p.spawn().unwrap().wait()); +} diff --git a/src/test/run-pass/issues/issue-10638.rs b/src/test/run-pass/issues/issue-10638.rs new file mode 100644 index 00000000000..8648a54159f --- /dev/null +++ b/src/test/run-pass/issues/issue-10638.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + //// I am not a doc comment! + ////////////////// still not a doc comment + /////**** nope, me neither */ + /*** And neither am I! */ + 5; + /*****! certainly not I */ +} diff --git a/src/test/run-pass/issues/issue-10682.rs b/src/test/run-pass/issues/issue-10682.rs new file mode 100644 index 00000000000..e7c23b393f0 --- /dev/null +++ b/src/test/run-pass/issues/issue-10682.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #10682 +// Nested `proc` usage can't use outer owned data + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +fn work(_: Box) {} +fn foo(_: F) {} + +pub fn main() { + let a = box 1; + foo(move|| { foo(move|| { work(a) }) }) +} diff --git a/src/test/run-pass/issues/issue-10683.rs b/src/test/run-pass/issues/issue-10683.rs new file mode 100644 index 00000000000..f25072538ad --- /dev/null +++ b/src/test/run-pass/issues/issue-10683.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +static NAME: &'static str = "hello world"; + +fn main() { + match &*NAME.to_ascii_lowercase() { + "foo" => {} + _ => {} + } +} diff --git a/src/test/run-pass/issues/issue-10718.rs b/src/test/run-pass/issues/issue-10718.rs new file mode 100644 index 00000000000..546c06d0451 --- /dev/null +++ b/src/test/run-pass/issues/issue-10718.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn f(p: F) { + p(); +} + +pub fn main() { + let p = || (); + f(p); +} diff --git a/src/test/run-pass/issues/issue-10734.rs b/src/test/run-pass/issues/issue-10734.rs new file mode 100644 index 00000000000..6504cca474f --- /dev/null +++ b/src/test/run-pass/issues/issue-10734.rs @@ -0,0 +1,46 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +static mut drop_count: usize = 0; + +struct Foo { + dropped: bool +} + +impl Drop for Foo { + fn drop(&mut self) { + // Test to make sure we haven't dropped already + assert!(!self.dropped); + self.dropped = true; + // And record the fact that we dropped for verification later + unsafe { drop_count += 1; } + } +} + +pub fn main() { + // An `if true { expr }` statement should compile the same as `{ expr }`. + if true { + let _a = Foo{ dropped: false }; + } + // Check that we dropped already (as expected from a `{ expr }`). + unsafe { assert_eq!(drop_count, 1); } + + // An `if false {} else { expr }` statement should compile the same as `{ expr }`. + if false { + panic!(); + } else { + let _a = Foo{ dropped: false }; + } + // Check that we dropped already (as expected from a `{ expr }`). + unsafe { assert_eq!(drop_count, 2); } +} diff --git a/src/test/run-pass/issues/issue-10763.rs b/src/test/run-pass/issues/issue-10763.rs new file mode 100644 index 00000000000..9f03cd34114 --- /dev/null +++ b/src/test/run-pass/issues/issue-10763.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern "Rust" fn foo() {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-10764.rs b/src/test/run-pass/issues/issue-10764.rs new file mode 100644 index 00000000000..0d912ed467a --- /dev/null +++ b/src/test/run-pass/issues/issue-10764.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern "Rust" fn main() {} diff --git a/src/test/run-pass/issues/issue-10767.rs b/src/test/run-pass/issues/issue-10767.rs new file mode 100644 index 00000000000..58cb663a721 --- /dev/null +++ b/src/test/run-pass/issues/issue-10767.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { + fn f() { + }; + let _: Box = box (f as fn()); +} diff --git a/src/test/run-pass/issues/issue-10802.rs b/src/test/run-pass/issues/issue-10802.rs new file mode 100644 index 00000000000..3967ee44583 --- /dev/null +++ b/src/test/run-pass/issues/issue-10802.rs @@ -0,0 +1,55 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct DroppableStruct; +enum DroppableEnum { + DroppableVariant1, DroppableVariant2 +} + +static mut DROPPED: bool = false; + +impl Drop for DroppableStruct { + fn drop(&mut self) { + unsafe { DROPPED = true; } + } +} +impl Drop for DroppableEnum { + fn drop(&mut self) { + unsafe { DROPPED = true; } + } +} + +trait MyTrait { fn dummy(&self) { } } +impl MyTrait for Box {} +impl MyTrait for Box {} + +struct Whatever { w: Box } +impl Whatever { + fn new(w: Box) -> Whatever { + Whatever { w: w } + } +} + +fn main() { + { + let f: Box<_> = box DroppableStruct; + let _a = Whatever::new(box f as Box); + } + assert!(unsafe { DROPPED }); + unsafe { DROPPED = false; } + { + let f: Box<_> = box DroppableEnum::DroppableVariant1; + let _a = Whatever::new(box f as Box); + } + assert!(unsafe { DROPPED }); +} diff --git a/src/test/run-pass/issues/issue-10806.rs b/src/test/run-pass/issues/issue-10806.rs new file mode 100644 index 00000000000..3cfbd703954 --- /dev/null +++ b/src/test/run-pass/issues/issue-10806.rs @@ -0,0 +1,47 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +pub fn foo() -> isize { + 3 +} +pub fn bar() -> isize { + 4 +} + +pub mod baz { + use {foo, bar}; + pub fn quux() -> isize { + foo() + bar() + } +} + +pub mod grault { + use {foo}; + pub fn garply() -> isize { + foo() + } +} + +pub mod waldo { + use {}; + pub fn plugh() -> isize { + 0 + } +} + +pub fn main() { + let _x = baz::quux(); + let _y = grault::garply(); + let _z = waldo::plugh(); +} diff --git a/src/test/run-pass/issues/issue-10853.rs b/src/test/run-pass/issues/issue-10853.rs new file mode 100644 index 00000000000..4a67d256f5d --- /dev/null +++ b/src/test/run-pass/issues/issue-10853.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![deny(missing_docs)] +#![doc="module"] + +#[doc="struct"] +pub struct Foo; + +pub fn foo() { + #![doc="fn"] +} + +#[doc="main"] +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-10902.rs b/src/test/run-pass/issues/issue-10902.rs new file mode 100644 index 00000000000..f27b4576d03 --- /dev/null +++ b/src/test/run-pass/issues/issue-10902.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub mod two_tuple { + pub trait T { fn dummy(&self) { } } + pub struct P<'a>(&'a (T + 'a), &'a (T + 'a)); + pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { + P(car, cdr) + } +} + +pub mod two_fields { + pub trait T { fn dummy(&self) { } } + pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) } + pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { + P{ car: car, cdr: cdr } + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-11047.rs b/src/test/run-pass/issues/issue-11047.rs new file mode 100644 index 00000000000..6ff9367aed5 --- /dev/null +++ b/src/test/run-pass/issues/issue-11047.rs @@ -0,0 +1,36 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that static methods can be invoked on `type` aliases + +#![allow(unused_variables)] + +pub mod foo { + pub mod bar { + pub mod baz { + pub struct Qux; + + impl Qux { + pub fn new() {} + } + } + } +} + +fn main() { + + type Ham = foo::bar::baz::Qux; + let foo = foo::bar::baz::Qux::new(); // invoke directly + let bar = Ham::new(); // invoke via type alias + + type StringVec = Vec; + let sv = StringVec::new(); +} diff --git a/src/test/run-pass/issues/issue-11085.rs b/src/test/run-pass/issues/issue-11085.rs new file mode 100644 index 00000000000..76a047e2a20 --- /dev/null +++ b/src/test/run-pass/issues/issue-11085.rs @@ -0,0 +1,55 @@ +// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg foo + +// pretty-expanded FIXME #23616 + +struct Foo { + #[cfg(fail)] + bar: baz, + foo: isize, +} + +struct Foo2 { + #[cfg(foo)] + foo: isize, +} + +enum Bar1 { + Bar1_1, + #[cfg(fail)] + Bar1_2(NotAType), +} + +enum Bar2 { + #[cfg(fail)] + Bar2_1(NotAType), +} + +enum Bar3 { + Bar3_1 { + #[cfg(fail)] + foo: isize, + bar: isize, + } +} + +pub fn main() { + let _f = Foo { foo: 3 }; + let _f = Foo2 { foo: 3 }; + + match Bar1::Bar1_1 { + Bar1::Bar1_1 => {} + } + + let _f = Bar3::Bar3_1 { bar: 3 }; +} diff --git a/src/test/run-pass/issues/issue-1112.rs b/src/test/run-pass/issues/issue-1112.rs new file mode 100644 index 00000000000..ee1711b1333 --- /dev/null +++ b/src/test/run-pass/issues/issue-1112.rs @@ -0,0 +1,46 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #1112 +// Alignment of interior pointers to dynamic-size types + + +struct X { + a: T, + b: u8, + c: bool, + d: u8, + e: u16, + f: u8, + g: u8 +} + +pub fn main() { + let x: X = X { + a: 12345678, + b: 9, + c: true, + d: 10, + e: 11, + f: 12, + g: 13 + }; + bar(x); +} + +fn bar(x: X) { + assert_eq!(x.b, 9); + assert_eq!(x.c, true); + assert_eq!(x.d, 10); + assert_eq!(x.e, 11); + assert_eq!(x.f, 12); + assert_eq!(x.g, 13); +} diff --git a/src/test/run-pass/issues/issue-11205.rs b/src/test/run-pass/issues/issue-11205.rs new file mode 100644 index 00000000000..bb7d1768f04 --- /dev/null +++ b/src/test/run-pass/issues/issue-11205.rs @@ -0,0 +1,95 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Foo { fn dummy(&self) { } } +impl Foo for isize {} +fn foo(_: [&Foo; 2]) {} +fn foos(_: &[&Foo]) {} +fn foog(_: &[T], _: &[T]) {} + +fn bar(_: [Box; 2]) {} +fn bars(_: &[Box]) {} + +fn main() { + let x: [&Foo; 2] = [&1, &2]; + foo(x); + foo([&1, &2]); + + let r = &1; + let x: [&Foo; 2] = [r; 2]; + foo(x); + foo([&1; 2]); + + let x: &[&Foo] = &[&1, &2]; + foos(x); + foos(&[&1, &2]); + + let x: &[&Foo] = &[&1, &2]; + let r = &1; + foog(x, &[r]); + + let x: [Box; 2] = [Box::new(1), Box::new(2)]; + bar(x); + bar([Box::new(1), Box::new(2)]); + + let x: &[Box] = &[Box::new(1), Box::new(2)]; + bars(x); + bars(&[Box::new(1), Box::new(2)]); + + let x: &[Box] = &[Box::new(1), Box::new(2)]; + foog(x, &[Box::new(1)]); + + struct T<'a> { + t: [&'a (Foo+'a); 2] + } + let _n = T { + t: [&1, &2] + }; + let r = &1; + let _n = T { + t: [r; 2] + }; + let x: [&Foo; 2] = [&1, &2]; + let _n = T { + t: x + }; + + struct F<'b> { + t: &'b [&'b (Foo+'b)] + } + let _n = F { + t: &[&1, &2] + }; + let r = &1; + let r: [&Foo; 2] = [r; 2]; + let _n = F { + t: &r + }; + let x: [&Foo; 2] = [&1, &2]; + let _n = F { + t: &x + }; + + struct M<'a> { + t: &'a [Box] + } + let _n = M { + t: &[Box::new(1), Box::new(2)] + }; + let x: [Box; 2] = [Box::new(1), Box::new(2)]; + let _n = M { + t: &x + }; +} diff --git a/src/test/run-pass/issues/issue-11224.rs b/src/test/run-pass/issues/issue-11224.rs new file mode 100644 index 00000000000..944983a2453 --- /dev/null +++ b/src/test/run-pass/issues/issue-11224.rs @@ -0,0 +1,18 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-11224.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11224 as unused; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-11225-1.rs b/src/test/run-pass/issues/issue-11225-1.rs new file mode 100644 index 00000000000..3c67d9cdd37 --- /dev/null +++ b/src/test/run-pass/issues/issue-11225-1.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-11225-1.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11225_1 as foo; + +pub fn main() { + foo::foo(1); + foo::foo_ufcs(1); +} diff --git a/src/test/run-pass/issues/issue-11225-2.rs b/src/test/run-pass/issues/issue-11225-2.rs new file mode 100644 index 00000000000..9e66e6e8672 --- /dev/null +++ b/src/test/run-pass/issues/issue-11225-2.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-11225-2.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11225_2 as foo; + +pub fn main() { + foo::foo(1); + foo::foo_ufcs(1); +} diff --git a/src/test/run-pass/issues/issue-11225-3.rs b/src/test/run-pass/issues/issue-11225-3.rs new file mode 100644 index 00000000000..d6e9b1378a0 --- /dev/null +++ b/src/test/run-pass/issues/issue-11225-3.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-11225-3.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11225_3; + +pub fn main() { + issue_11225_3::public_inlinable_function(); + issue_11225_3::public_inlinable_function_ufcs(); +} diff --git a/src/test/run-pass/issues/issue-11267.rs b/src/test/run-pass/issues/issue-11267.rs new file mode 100644 index 00000000000..37bf64c17eb --- /dev/null +++ b/src/test/run-pass/issues/issue-11267.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that unary structs can be mutably borrowed. + +struct Empty; + +trait T { + fn next(&mut self) -> Option; +} +impl T for Empty { + fn next(&mut self) -> Option { None } +} + +fn do_something_with(a : &mut T) { + println!("{:?}", a.next()) +} + +pub fn main() { + do_something_with(&mut Empty); +} diff --git a/src/test/run-pass/issues/issue-11382.rs b/src/test/run-pass/issues/issue-11382.rs new file mode 100644 index 00000000000..fc8f283fc8e --- /dev/null +++ b/src/test/run-pass/issues/issue-11382.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + println!("{}", 1.2); +} diff --git a/src/test/run-pass/issues/issue-11384.rs b/src/test/run-pass/issues/issue-11384.rs new file mode 100644 index 00000000000..5f11bf2841e --- /dev/null +++ b/src/test/run-pass/issues/issue-11384.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Common { fn dummy(&self) { } } + +impl<'t, T> Common for (T, &'t T) {} + +impl<'t, T> Common for (&'t T, T) {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-11508.rs b/src/test/run-pass/issues/issue-11508.rs new file mode 100644 index 00000000000..d5a1214ffa4 --- /dev/null +++ b/src/test/run-pass/issues/issue-11508.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-11508.rs + +extern crate issue_11508 as rand; + +use rand::{Closed01, random}; + +fn main() { + let Closed01(val) = random::>(); + println!("{}", val); +} diff --git a/src/test/run-pass/issues/issue-11529.rs b/src/test/run-pass/issues/issue-11529.rs new file mode 100644 index 00000000000..e046956297d --- /dev/null +++ b/src/test/run-pass/issues/issue-11529.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-11529.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_11529 as a; + +fn main() { + let one = 1; + let _a = a::A(&one); +} diff --git a/src/test/run-pass/issues/issue-11552.rs b/src/test/run-pass/issues/issue-11552.rs new file mode 100644 index 00000000000..38dc58a2f12 --- /dev/null +++ b/src/test/run-pass/issues/issue-11552.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_patterns)] +#![feature(box_syntax)] + +#[derive(Clone)] +enum Noun +{ + Atom(isize), + Cell(Box, Box) +} + +fn fas(n: &Noun) -> Noun +{ + match n { + &Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(), + _ => panic!("Invalid fas pattern") + } +} + +pub fn main() { + fas(&Noun::Cell(box Noun::Atom(2), box Noun::Cell(box Noun::Atom(2), box Noun::Atom(3)))); +} diff --git a/src/test/run-pass/issues/issue-11577.rs b/src/test/run-pass/issues/issue-11577.rs new file mode 100644 index 00000000000..1fee0d40206 --- /dev/null +++ b/src/test/run-pass/issues/issue-11577.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Destructuring struct variants would ICE where regular structs wouldn't + +enum Foo { + VBar { num: isize } +} + +struct SBar { num: isize } + +pub fn main() { + let vbar = Foo::VBar { num: 1 }; + let Foo::VBar { num } = vbar; + assert_eq!(num, 1); + + let sbar = SBar { num: 2 }; + let SBar { num } = sbar; + assert_eq!(num, 2); +} diff --git a/src/test/run-pass/issues/issue-11592.rs b/src/test/run-pass/issues/issue-11592.rs new file mode 100644 index 00000000000..1157f9b7e76 --- /dev/null +++ b/src/test/run-pass/issues/issue-11592.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +//! Ensure the private trait Bar isn't complained about. + +#![deny(missing_docs)] + +mod foo { + trait Bar { fn bar(&self) { } } + impl Bar for i8 { fn bar(&self) { } } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-11612.rs b/src/test/run-pass/issues/issue-11612.rs new file mode 100644 index 00000000000..763e538fb8f --- /dev/null +++ b/src/test/run-pass/issues/issue-11612.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #11612 +// We weren't updating the auto adjustments with all the resolved +// type information after type check. + +// pretty-expanded FIXME #23616 + +trait A { fn dummy(&self) { } } + +struct B<'a, T:'a> { + f: &'a T +} + +impl<'a, T> A for B<'a, T> {} + +fn foo(_: &A) {} + +fn bar(b: &B) { + foo(b); // Coercion should work + foo(b as &A); // Explicit cast should work as well +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-11677.rs b/src/test/run-pass/issues/issue-11677.rs new file mode 100644 index 00000000000..a4d4feb4f8a --- /dev/null +++ b/src/test/run-pass/issues/issue-11677.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(dead_code)] + +// this code used to cause an ICE + +use std::marker; + +trait X { + fn dummy(&self) -> T { panic!() } +} + +struct S {f: Box+'static>, + g: Box+'static>} + +struct F; +impl X for F { +} + +fn main() { + S {f: Box::new(F), g: Box::new(F) }; +} diff --git a/src/test/run-pass/issues/issue-11709.rs b/src/test/run-pass/issues/issue-11709.rs new file mode 100644 index 00000000000..ffd6f1dfb55 --- /dev/null +++ b/src/test/run-pass/issues/issue-11709.rs @@ -0,0 +1,47 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37199 + +// Don't panic on blocks without results +// There are several tests in this run-pass that raised +// when this bug was opened. The cases where the compiler +// panics before the fix have a comment. + +struct S {x:()} + +fn test(slot: &mut Option Box>>) -> () { + let a = slot.take(); + let _a = match a { + // `{let .. a(); }` would break + Some(mut a) => { let _a = a(); }, + None => (), + }; +} + +fn not(b: bool) -> bool { + if b { + !b + } else { + // `panic!(...)` would break + panic!("Break the compiler"); + } +} + +pub fn main() { + // {} would break + let _r = {}; + let mut slot = None; + // `{ test(...); }` would break + let _s : S = S{ x: { test(&mut slot); } }; + + let _b = not(true); +} diff --git a/src/test/run-pass/issues/issue-11820.rs b/src/test/run-pass/issues/issue-11820.rs new file mode 100644 index 00000000000..4546529a902 --- /dev/null +++ b/src/test/run-pass/issues/issue-11820.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct NoClone; + +fn main() { + let rnc = &NoClone; + let rsnc = &Some(NoClone); + + let _: &NoClone = rnc.clone(); + let _: &Option = rsnc.clone(); +} diff --git a/src/test/run-pass/issues/issue-11869.rs b/src/test/run-pass/issues/issue-11869.rs new file mode 100644 index 00000000000..be20f7a0fec --- /dev/null +++ b/src/test/run-pass/issues/issue-11869.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct A { + a: String +} + +fn borrow<'a>(binding: &'a A) -> &'a str { + match &*binding.a { + "in" => "in_", + "ref" => "ref_", + ident => ident + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-11940.rs b/src/test/run-pass/issues/issue-11940.rs new file mode 100644 index 00000000000..8f2dae938e0 --- /dev/null +++ b/src/test/run-pass/issues/issue-11940.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const TEST_STR: &'static str = "abcd"; + +fn main() { + let s = "abcd"; + match s { + TEST_STR => (), + _ => unreachable!() + } +} diff --git a/src/test/run-pass/issues/issue-11958.rs b/src/test/run-pass/issues/issue-11958.rs new file mode 100644 index 00000000000..6702aa38fd9 --- /dev/null +++ b/src/test/run-pass/issues/issue-11958.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![forbid(warnings)] + +// We shouldn't need to rebind a moved upvar as mut if it's already +// marked as mut + +pub fn main() { + let mut x = 1; + let _thunk = Box::new(move|| { x = 2; }); +} diff --git a/src/test/run-pass/issues/issue-12033.rs b/src/test/run-pass/issues/issue-12033.rs new file mode 100644 index 00000000000..214dfa5a446 --- /dev/null +++ b/src/test/run-pass/issues/issue-12033.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cell::RefCell; + +fn main() { + let x = RefCell::new(0); + if *x.borrow() == 0 {} else {} +} diff --git a/src/test/run-pass/issues/issue-12133-1.rs b/src/test/run-pass/issues/issue-12133-1.rs new file mode 100644 index 00000000000..7f896f6a6df --- /dev/null +++ b/src/test/run-pass/issues/issue-12133-1.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-12133-rlib.rs +// aux-build:issue-12133-dylib.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_12133_rlib as a; +extern crate issue_12133_dylib as b; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-12133-2.rs b/src/test/run-pass/issues/issue-12133-2.rs new file mode 100644 index 00000000000..c2f12fda193 --- /dev/null +++ b/src/test/run-pass/issues/issue-12133-2.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-12133-rlib.rs +// aux-build:issue-12133-dylib.rs +// no-prefer-dynamic + +// pretty-expanded FIXME #23616 + +extern crate issue_12133_rlib as a; +extern crate issue_12133_dylib as b; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-12133-3.rs b/src/test/run-pass/issues/issue-12133-3.rs new file mode 100644 index 00000000000..51c39f8f9c7 --- /dev/null +++ b/src/test/run-pass/issues/issue-12133-3.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-12133-rlib.rs +// aux-build:issue-12133-dylib.rs +// aux-build:issue-12133-dylib2.rs +// ignore-cloudabi no dylib support +// ignore-emscripten no dylib support +// ignore-musl + +// pretty-expanded FIXME #23616 + +extern crate issue_12133_dylib2 as other; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-12285.rs b/src/test/run-pass/issues/issue-12285.rs new file mode 100644 index 00000000000..6391f13d936 --- /dev/null +++ b/src/test/run-pass/issues/issue-12285.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct S; + +fn main() { + match Some(&S) { + Some(&S) => {}, + _x => unreachable!() + } + match Some(&S) { + Some(&S) => {}, + None => unreachable!() + } +} diff --git a/src/test/run-pass/issues/issue-1251.rs b/src/test/run-pass/issues/issue-1251.rs new file mode 100644 index 00000000000..a7bc8718003 --- /dev/null +++ b/src/test/run-pass/issues/issue-1251.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +#![crate_id="rust_get_test_int"] + +mod rustrt { + extern crate libc; + + extern { + pub fn rust_get_test_int() -> libc::intptr_t; + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-1257.rs b/src/test/run-pass/issues/issue-1257.rs new file mode 100644 index 00000000000..8361151c24e --- /dev/null +++ b/src/test/run-pass/issues/issue-1257.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main () { + let mut line = "".to_string(); + let mut i = 0; + while line != "exit".to_string() { + line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; + i += 1; + } +} diff --git a/src/test/run-pass/issues/issue-12582.rs b/src/test/run-pass/issues/issue-12582.rs new file mode 100644 index 00000000000..dd77e7287ca --- /dev/null +++ b/src/test/run-pass/issues/issue-12582.rs @@ -0,0 +1,31 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = 1; + let y = 2; + + assert_eq!(3, match (x, y) { + (1, 1) => 1, + (2, 2) => 2, + (1..=2, 2) => 3, + _ => 4, + }); + + // nested tuple + assert_eq!(3, match ((x, y),) { + ((1, 1),) => 1, + ((2, 2),) => 2, + ((1..=2, 2),) => 3, + _ => 4, + }); +} diff --git a/src/test/run-pass/issues/issue-12612.rs b/src/test/run-pass/issues/issue-12612.rs new file mode 100644 index 00000000000..dd9c9abaf65 --- /dev/null +++ b/src/test/run-pass/issues/issue-12612.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_12612_1.rs +// aux-build:issue_12612_2.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_12612_1 as foo; +extern crate issue_12612_2 as bar; + +mod test { + use bar::baz; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-12660.rs b/src/test/run-pass/issues/issue-12660.rs new file mode 100644 index 00000000000..2713543963e --- /dev/null +++ b/src/test/run-pass/issues/issue-12660.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-12660-aux.rs + +// pretty-expanded FIXME #23616 + +extern crate issue12660aux; + +use issue12660aux::{my_fn, MyStruct}; + +#[allow(path_statements)] +fn main() { + my_fn(MyStruct); + MyStruct; +} diff --git a/src/test/run-pass/issues/issue-12677.rs b/src/test/run-pass/issues/issue-12677.rs new file mode 100644 index 00000000000..e4d29a59ba1 --- /dev/null +++ b/src/test/run-pass/issues/issue-12677.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let s = "Hello"; + let first = s.bytes(); + let second = first.clone(); + + assert_eq!(first.collect::>(), second.collect::>()) +} diff --git a/src/test/run-pass/issues/issue-12699.rs b/src/test/run-pass/issues/issue-12699.rs new file mode 100644 index 00000000000..eaaa2364f68 --- /dev/null +++ b/src/test/run-pass/issues/issue-12699.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare can't block the thread +#![allow(deprecated)] + +use std::thread; + +fn main() { + thread::sleep_ms(250); +} diff --git a/src/test/run-pass/issues/issue-12729.rs b/src/test/run-pass/issues/issue-12729.rs new file mode 100644 index 00000000000..f75090c4223 --- /dev/null +++ b/src/test/run-pass/issues/issue-12729.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub struct Foo; + +mod bar { + use Foo; + + impl Foo { + fn baz(&self) {} + } +} +fn main() {} diff --git a/src/test/run-pass/issues/issue-12744.rs b/src/test/run-pass/issues/issue-12744.rs new file mode 100644 index 00000000000..c0af7bdcbdf --- /dev/null +++ b/src/test/run-pass/issues/issue-12744.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + fn test() -> Box { Box::new(1) } + println!("{:?}", test()) +} diff --git a/src/test/run-pass/issues/issue-12860.rs b/src/test/run-pass/issues/issue-12860.rs new file mode 100644 index 00000000000..fba1532e00f --- /dev/null +++ b/src/test/run-pass/issues/issue-12860.rs @@ -0,0 +1,59 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::HashSet; + +#[derive(Copy, Clone, PartialEq, Eq, Hash)] +struct XYZ { + x: isize, + y: isize, + z: isize +} + +fn main() { + let mut connected = HashSet::new(); + let mut border = HashSet::new(); + + let middle = XYZ{x: 0, y: 0, z: 0}; + border.insert(middle); + + while !border.is_empty() && connected.len() < 10000 { + let choice = *(border.iter().next().unwrap()); + border.remove(&choice); + connected.insert(choice); + + let cxp = XYZ{x: choice.x + 1, y: choice.y, z: choice.z}; + let cxm = XYZ{x: choice.x - 1, y: choice.y, z: choice.z}; + let cyp = XYZ{x: choice.x, y: choice.y + 1, z: choice.z}; + let cym = XYZ{x: choice.x, y: choice.y - 1, z: choice.z}; + let czp = XYZ{x: choice.x, y: choice.y, z: choice.z + 1}; + let czm = XYZ{x: choice.x, y: choice.y, z: choice.z - 1}; + + if !connected.contains(&cxp) { + border.insert(cxp); + } + if !connected.contains(&cxm){ + border.insert(cxm); + } + if !connected.contains(&cyp){ + border.insert(cyp); + } + if !connected.contains(&cym) { + border.insert(cym); + } + if !connected.contains(&czp){ + border.insert(czp); + } + if !connected.contains(&czm) { + border.insert(czm); + } + } +} diff --git a/src/test/run-pass/issues/issue-12909.rs b/src/test/run-pass/issues/issue-12909.rs new file mode 100644 index 00000000000..d4db01a5e58 --- /dev/null +++ b/src/test/run-pass/issues/issue-12909.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::collections::HashMap; + +fn copy(&x: &T) -> T { + x +} + +fn main() { + let arr = [(1, 1), (2, 2), (3, 3)]; + + let v1: Vec<&_> = arr.iter().collect(); + let v2: Vec<_> = arr.iter().map(copy).collect(); + + let m1: HashMap<_, _> = arr.iter().map(copy).collect(); + let m2: HashMap = arr.iter().map(copy).collect(); + let m3: HashMap<_, usize> = arr.iter().map(copy).collect(); +} diff --git a/src/test/run-pass/issues/issue-13027.rs b/src/test/run-pass/issues/issue-13027.rs new file mode 100644 index 00000000000..7caf1589aed --- /dev/null +++ b/src/test/run-pass/issues/issue-13027.rs @@ -0,0 +1,188 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Tests that match expression handles overlapped literal and range +// properly in the presence of guard function. + +fn val() -> usize { 1 } + +static CONST: usize = 1; + +pub fn main() { + lit_shadow_range(); + range_shadow_lit(); + range_shadow_range(); + multi_pats_shadow_lit(); + multi_pats_shadow_range(); + lit_shadow_multi_pats(); + range_shadow_multi_pats(); + misc(); +} + +fn lit_shadow_range() { + assert_eq!(2, match 1 { + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + assert_eq!(2, match val() { + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + assert_eq!(2, match CONST { + 0 => 0, + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); + + // value is out of the range of second arm, should match wildcard pattern + assert_eq!(3, match 3 { + 1 if false => 1, + 1..=2 => 2, + _ => 3 + }); +} + +fn range_shadow_lit() { + assert_eq!(2, match 1 { + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + let x = 0; + assert_eq!(2, match x+1 { + 0 => 0, + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + assert_eq!(2, match val() { + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + assert_eq!(2, match CONST { + 0 => 0, + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); + + // ditto + assert_eq!(3, match 3 { + 1..=2 if false => 1, + 1 => 2, + _ => 3 + }); +} + +fn range_shadow_range() { + assert_eq!(2, match 1 { + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + let x = 0; + assert_eq!(2, match x+1 { + 100 => 0, + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + assert_eq!(2, match val() { + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + assert_eq!(2, match CONST { + 100 => 0, + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); + + // ditto + assert_eq!(3, match 5 { + 0..=2 if false => 1, + 1..=3 => 2, + _ => 3, + }); +} + +fn multi_pats_shadow_lit() { + assert_eq!(2, match 1 { + 100 => 0, + 0 | 1..=10 if false => 1, + 1 => 2, + _ => 3, + }); +} + +fn multi_pats_shadow_range() { + assert_eq!(2, match 1 { + 100 => 0, + 0 | 1..=10 if false => 1, + 1..=3 => 2, + _ => 3, + }); +} + +fn lit_shadow_multi_pats() { + assert_eq!(2, match 1 { + 100 => 0, + 1 if false => 1, + 0 | 1..=10 => 2, + _ => 3, + }); +} + +fn range_shadow_multi_pats() { + assert_eq!(2, match 1 { + 100 => 0, + 1..=3 if false => 1, + 0 | 1..=10 => 2, + _ => 3, + }); +} + +fn misc() { + enum Foo { + Bar(usize, bool) + } + // This test basically mimics how trace_macros! macro is implemented, + // which is a rare combination of vector patterns, multiple wild-card + // patterns and guard functions. + let r = match [Foo::Bar(0, false)] { + [Foo::Bar(_, pred)] if pred => 1, + [Foo::Bar(_, pred)] if !pred => 2, + _ => 0, + }; + assert_eq!(2, r); +} diff --git a/src/test/run-pass/issues/issue-13105.rs b/src/test/run-pass/issues/issue-13105.rs new file mode 100644 index 00000000000..906f8ca5e7d --- /dev/null +++ b/src/test/run-pass/issues/issue-13105.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Foo { + #[allow(anonymous_parameters)] + fn quux(u8) {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-13167.rs b/src/test/run-pass/issues/issue-13167.rs new file mode 100644 index 00000000000..ac0645cd403 --- /dev/null +++ b/src/test/run-pass/issues/issue-13167.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::slice; + +pub struct PhfMapEntries<'a, T: 'a> { + iter: slice::Iter<'a, (&'static str, T)>, +} + +impl<'a, T> Iterator for PhfMapEntries<'a, T> { + type Item = (&'static str, &'a T); + + fn next(&mut self) -> Option<(&'static str, &'a T)> { + self.iter.by_ref().map(|&(key, ref value)| (key, value)).next() + } + + fn size_hint(&self) -> (usize, Option) { + self.iter.size_hint() + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-13204.rs b/src/test/run-pass/issues/issue-13204.rs new file mode 100644 index 00000000000..4aa2c49b428 --- /dev/null +++ b/src/test/run-pass/issues/issue-13204.rs @@ -0,0 +1,34 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that when instantiating trait default methods, typeck handles +// lifetime parameters defined on the method bound correctly. + + +pub trait Foo { + fn bar<'a, I: Iterator>(&self, it: I) -> usize { + let mut xs = it.filter(|_| true); + xs.count() + } +} + +pub struct Baz; + +impl Foo for Baz { + // When instantiating `Foo::bar` for `Baz` here, typeck used to + // ICE due to the lifetime parameter of `bar`. +} + +fn main() { + let x = Baz; + let y = vec![(), (), ()]; + assert_eq!(x.bar(y.iter()), 3); +} diff --git a/src/test/run-pass/issues/issue-13214.rs b/src/test/run-pass/issues/issue-13214.rs new file mode 100644 index 00000000000..634cbbb0417 --- /dev/null +++ b/src/test/run-pass/issues/issue-13214.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// defining static with struct that contains enum +// with &'static str variant used to cause ICE + +// pretty-expanded FIXME #23616 + +pub enum Foo { + Bar, + Baz(&'static str), +} + +pub static TEST: Test = Test { + foo: Foo::Bar, + c: 'a' +}; + +pub struct Test { + foo: Foo, + c: char, +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs b/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs new file mode 100644 index 00000000000..de18e09532b --- /dev/null +++ b/src/test/run-pass/issues/issue-13259-windows-tcb-trash.rs @@ -0,0 +1,52 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(libc)] + +extern crate libc; + +#[cfg(windows)] +mod imp { + type LPVOID = *mut u8; + type DWORD = u32; + type LPWSTR = *mut u16; + + extern "system" { + fn FormatMessageW(flags: DWORD, + lpSrc: LPVOID, + msgId: DWORD, + langId: DWORD, + buf: LPWSTR, + nsize: DWORD, + args: *const u8) + -> DWORD; + } + + pub fn test() { + let mut buf: [u16; 50] = [0; 50]; + let ret = unsafe { + FormatMessageW(0x1000, 0 as *mut _, 1, 0x400, + buf.as_mut_ptr(), buf.len() as u32, 0 as *const _) + }; + // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented + // stacks taking control of pvArbitrary + assert!(ret != 0); + } +} + +#[cfg(not(windows))] +mod imp { + pub fn test() { } +} + +fn main() { + imp::test() +} diff --git a/src/test/run-pass/issues/issue-13264.rs b/src/test/run-pass/issues/issue-13264.rs new file mode 100644 index 00000000000..db6b80ad225 --- /dev/null +++ b/src/test/run-pass/issues/issue-13264.rs @@ -0,0 +1,84 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +use std::ops::Deref; + +struct Root { + jsref: JSRef +} + +impl Deref for Root { + type Target = JSRef; + + fn deref<'a>(&'a self) -> &'a JSRef { + &self.jsref + } +} + +#[derive(Copy, Clone)] +struct JSRef { + node: *const Node +} + +impl Deref for JSRef { + type Target = Node; + + fn deref<'a>(&'a self) -> &'a Node { + self.get() + } +} + +trait INode { + fn RemoveChild(&self); +} + +impl INode for JSRef { + fn RemoveChild(&self) { + self.get().RemoveChild(0) + } +} + +impl JSRef { + fn AddChild(&self) { + self.get().AddChild(0); + } + + fn get<'a>(&'a self) -> &'a Node { + unsafe { + &*self.node + } + } +} + +struct Node; + +impl Node { + fn RemoveChild(&self, _a: usize) { + } + + fn AddChild(&self, _a: usize) { + } +} + +fn main() { + let n = Node; + let jsref = JSRef { node: &n }; + let root = Root { jsref: jsref }; + + root.AddChild(); + jsref.AddChild(); + + root.RemoveChild(); + jsref.RemoveChild(); +} diff --git a/src/test/run-pass/issues/issue-13304.rs b/src/test/run-pass/issues/issue-13304.rs new file mode 100644 index 00000000000..117cb0bbe16 --- /dev/null +++ b/src/test/run-pass/issues/issue-13304.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::env; +use std::io::prelude::*; +use std::io; +use std::process::{Command, Stdio}; +use std::str; + +fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + child(); + } else { + parent(); + } +} + +fn parent() { + let args: Vec = env::args().collect(); + let mut p = Command::new(&args[0]).arg("child") + .stdout(Stdio::piped()) + .stdin(Stdio::piped()) + .spawn().unwrap(); + p.stdin.as_mut().unwrap().write_all(b"test1\ntest2\ntest3").unwrap(); + let out = p.wait_with_output().unwrap(); + assert!(out.status.success()); + let s = str::from_utf8(&out.stdout).unwrap(); + assert_eq!(s, "test1\ntest2\ntest3\n"); +} + +fn child() { + let mut stdin = io::stdin(); + for line in stdin.lock().lines() { + println!("{}", line.unwrap()); + } +} diff --git a/src/test/run-pass/issues/issue-13323.rs b/src/test/run-pass/issues/issue-13323.rs new file mode 100644 index 00000000000..b72abb8b7ac --- /dev/null +++ b/src/test/run-pass/issues/issue-13323.rs @@ -0,0 +1,69 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct StrWrap { + s: String +} + +impl StrWrap { + fn new(s: &str) -> StrWrap { + StrWrap { s: s.to_string() } + } + + fn get_s<'a>(&'a self) -> &'a str { + &self.s + } +} + +struct MyStruct { + s: StrWrap +} + +impl MyStruct { + fn new(s: &str) -> MyStruct { + MyStruct { s: StrWrap::new(s) } + } + + fn get_str_wrap<'a>(&'a self) -> &'a StrWrap { + &self.s + } +} + +trait Matcher { + fn matches(&self, actual: T) -> bool; +} + +fn assert_that>(actual: T, matcher: &U) { + assert!(matcher.matches(actual)); +} + +struct EqualTo { + expected: T +} + +impl Matcher for EqualTo { + fn matches(&self, actual: T) -> bool { + self.expected.eq(&actual) + } +} + +fn equal_to(expected: T) -> Box> { + box EqualTo { expected: expected } +} + +pub fn main() { + let my_struct = MyStruct::new("zomg"); + let s = my_struct.get_str_wrap(); + + assert_that(s.get_s(), &*equal_to("zomg")); +} diff --git a/src/test/run-pass/issues/issue-13405.rs b/src/test/run-pass/issues/issue-13405.rs new file mode 100644 index 00000000000..3b9fdf84b5d --- /dev/null +++ b/src/test/run-pass/issues/issue-13405.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo<'a> { + i: &'a bool, + j: Option<&'a isize>, +} + +impl<'a> Foo<'a> { + fn bar(&mut self, j: &isize) { + let child = Foo { + i: self.i, + j: Some(j) + }; + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-13434.rs b/src/test/run-pass/issues/issue-13434.rs new file mode 100644 index 00000000000..94d22b818e3 --- /dev/null +++ b/src/test/run-pass/issues/issue-13434.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct MyStruct; + +trait Repro { + fn repro(self, s: MyStruct) -> String; +} + +impl Repro for F where F: FnOnce(MyStruct) -> String { + fn repro(self, s: MyStruct) -> String { + self(s) + } +} + +fn do_stuff(r: R) -> String { + r.repro(MyStruct) +} + +pub fn main() { + assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); +} diff --git a/src/test/run-pass/issues/issue-13494.rs b/src/test/run-pass/issues/issue-13494.rs new file mode 100644 index 00000000000..553f3a7fec9 --- /dev/null +++ b/src/test/run-pass/issues/issue-13494.rs @@ -0,0 +1,43 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +// This test may not always fail, but it can be flaky if the race it used to +// expose is still present. + +#![feature(mpsc_select)] + +use std::sync::mpsc::{channel, Sender, Receiver}; +use std::thread; + +fn helper(rx: Receiver>) { + for tx in rx.iter() { + let _ = tx.send(()); + } +} + +fn main() { + let (tx, rx) = channel(); + let t = thread::spawn(move|| { helper(rx) }); + let (snd, rcv) = channel::(); + for _ in 1..100000 { + snd.send(1).unwrap(); + let (tx2, rx2) = channel(); + tx.send(tx2).unwrap(); + select! { + _ = rx2.recv() => (), + _ = rcv.recv() => () + } + } + drop(tx); + t.join(); +} diff --git a/src/test/run-pass/issues/issue-13507-2.rs b/src/test/run-pass/issues/issue-13507-2.rs new file mode 100644 index 00000000000..894cd7ac011 --- /dev/null +++ b/src/test/run-pass/issues/issue-13507-2.rs @@ -0,0 +1,45 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue13507.rs + +extern crate issue13507; +use issue13507::testtypes; + +use std::any::TypeId; + +pub fn type_ids() -> Vec { + use issue13507::testtypes::*; + vec![ + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::(), + TypeId::of::() + ] +} + +pub fn main() { + let othercrate = issue13507::testtypes::type_ids(); + let thiscrate = type_ids(); + assert_eq!(thiscrate, othercrate); +} diff --git a/src/test/run-pass/issues/issue-13620.rs b/src/test/run-pass/issues/issue-13620.rs new file mode 100644 index 00000000000..624aeaef782 --- /dev/null +++ b/src/test/run-pass/issues/issue-13620.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-13620-1.rs +// aux-build:issue-13620-2.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_13620_2 as crate2; + +fn main() { + (crate2::FOO2.foo)(); +} diff --git a/src/test/run-pass/issues/issue-13655.rs b/src/test/run-pass/issues/issue-13655.rs new file mode 100644 index 00000000000..9978819d7db --- /dev/null +++ b/src/test/run-pass/issues/issue-13655.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(fn_traits, unboxed_closures)] +use std::ops::Fn; + +struct Foo(T); + +impl Fn<()> for Foo { + extern "rust-call" fn call(&self, _: ()) -> T { + match *self { + Foo(t) => t + } + } +} + +impl FnMut<()> for Foo { + extern "rust-call" fn call_mut(&mut self, _: ()) -> T { + self.call(()) + } +} + +impl FnOnce<()> for Foo { + type Output = T; + + extern "rust-call" fn call_once(self, _: ()) -> T { + self.call(()) + } +} + +fn main() { + let t: u8 = 1; + println!("{}", Foo(t)()); +} diff --git a/src/test/run-pass/issues/issue-13665.rs b/src/test/run-pass/issues/issue-13665.rs new file mode 100644 index 00000000000..85e8ef57515 --- /dev/null +++ b/src/test/run-pass/issues/issue-13665.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo<'r>() { + let maybe_value_ref: Option<&'r u8> = None; + + let _ = maybe_value_ref.map(|& ref v| v); + let _ = maybe_value_ref.map(|& ref v| -> &'r u8 {v}); + let _ = maybe_value_ref.map(|& ref v: &'r u8| -> &'r u8 {v}); + let _ = maybe_value_ref.map(|& ref v: &'r u8| {v}); +} + +fn main() { + foo(); +} diff --git a/src/test/run-pass/issues/issue-13703.rs b/src/test/run-pass/issues/issue-13703.rs new file mode 100644 index 00000000000..d0f8be64ef3 --- /dev/null +++ b/src/test/run-pass/issues/issue-13703.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub struct Foo<'a, 'b: 'a> { foo: &'a &'b isize } +pub fn foo<'a, 'b>(x: Foo<'a, 'b>, _o: Option<& & ()>) { let _y = x.foo; } +fn main() {} diff --git a/src/test/run-pass/issues/issue-13763.rs b/src/test/run-pass/issues/issue-13763.rs new file mode 100644 index 00000000000..0b27e2fab31 --- /dev/null +++ b/src/test/run-pass/issues/issue-13763.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod u8 { + pub const BITS: usize = 8; +} + +const NUM: usize = u8::BITS; + +struct MyStruct { nums: [usize; 8] } + +fn main() { + let _s = MyStruct { nums: [0; NUM] }; +} diff --git a/src/test/run-pass/issues/issue-13775.rs b/src/test/run-pass/issues/issue-13775.rs new file mode 100644 index 00000000000..ae499229917 --- /dev/null +++ b/src/test/run-pass/issues/issue-13775.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Foo { + #[allow(anonymous_parameters)] + fn bar(&self, isize) {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-13808.rs b/src/test/run-pass/issues/issue-13808.rs new file mode 100644 index 00000000000..2d6b78c6b07 --- /dev/null +++ b/src/test/run-pass/issues/issue-13808.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo<'a> { + listener: Box, +} + +impl<'a> Foo<'a> { + fn new(listener: F) -> Foo<'a> where F: FnMut() + 'a { + Foo { listener: Box::new(listener) } + } +} + +fn main() { + let a = Foo::new(|| {}); +} diff --git a/src/test/run-pass/issues/issue-13837.rs b/src/test/run-pass/issues/issue-13837.rs new file mode 100644 index 00000000000..eaa17499850 --- /dev/null +++ b/src/test/run-pass/issues/issue-13837.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct TestStruct { + x: *const [isize; 2] +} + +unsafe impl Sync for TestStruct {} + +static TEST_VALUE : TestStruct = TestStruct{x: 0x1234 as *const [isize; 2]}; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-13867.rs b/src/test/run-pass/issues/issue-13867.rs new file mode 100644 index 00000000000..84d7e8a3bc4 --- /dev/null +++ b/src/test/run-pass/issues/issue-13867.rs @@ -0,0 +1,59 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that codegen works correctly when there are multiple refutable +// patterns in match expression. + + +enum Foo { + FooUint(usize), + FooNullary, +} + +fn main() { + let r = match (Foo::FooNullary, 'a') { + (Foo::FooUint(..), 'a'..='z') => 1, + (Foo::FooNullary, 'x') => 2, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match (Foo::FooUint(0), 'a') { + (Foo::FooUint(1), 'a'..='z') => 1, + (Foo::FooUint(..), 'x') => 2, + (Foo::FooNullary, 'a') => 3, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match ('a', Foo::FooUint(0)) { + ('a'..='z', Foo::FooUint(1)) => 1, + ('x', Foo::FooUint(..)) => 2, + ('a', Foo::FooNullary) => 3, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match ('a', 'a') { + ('a'..='z', 'b') => 1, + ('x', 'a'..='z') => 2, + _ => 0 + }; + assert_eq!(r, 0); + + let r = match ('a', 'a') { + ('a'..='z', 'b') => 1, + ('x', 'a'..='z') => 2, + ('a', 'a') => 3, + _ => 0 + }; + assert_eq!(r, 3); +} diff --git a/src/test/run-pass/issues/issue-13872.rs b/src/test/run-pass/issues/issue-13872.rs new file mode 100644 index 00000000000..e72eac8fbdd --- /dev/null +++ b/src/test/run-pass/issues/issue-13872.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-13872-1.rs +// aux-build:issue-13872-2.rs +// aux-build:issue-13872-3.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_13872_3 as other; + +fn main() { + other::foo(); +} diff --git a/src/test/run-pass/issues/issue-13902.rs b/src/test/run-pass/issues/issue-13902.rs new file mode 100644 index 00000000000..87413be05e5 --- /dev/null +++ b/src/test/run-pass/issues/issue-13902.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +const JSVAL_TAG_CLEAR: u32 = 0xFFFFFF80; +const JSVAL_TYPE_INT32: u8 = 0x01; +const JSVAL_TYPE_UNDEFINED: u8 = 0x02; +#[repr(u32)] +enum ValueTag { + JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | (JSVAL_TYPE_INT32 as u32), + JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | (JSVAL_TYPE_UNDEFINED as u32), +} + +fn main() { + let _ = ValueTag::JSVAL_TAG_INT32; +} diff --git a/src/test/run-pass/issues/issue-14082.rs b/src/test/run-pass/issues/issue-14082.rs new file mode 100644 index 00000000000..01d3c9534f2 --- /dev/null +++ b/src/test/run-pass/issues/issue-14082.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_imports, dead_code)] + +use foo::Foo; + +mod foo { + pub use m::Foo; // this should shadow d::Foo +} + +mod m { + pub struct Foo; +} + +mod d { + pub struct Foo; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-14229.rs b/src/test/run-pass/issues/issue-14229.rs new file mode 100644 index 00000000000..c09b2c79104 --- /dev/null +++ b/src/test/run-pass/issues/issue-14229.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo: Sized { + fn foo(self) {} +} + +trait Bar: Sized { + fn bar(self) {} +} + +struct S; + +impl<'l> Foo for &'l S {} + +impl Bar for T {} + +fn main() { + let s = S; + s.foo(); + (&s).bar(); + s.bar(); +} diff --git a/src/test/run-pass/issues/issue-14254.rs b/src/test/run-pass/issues/issue-14254.rs new file mode 100644 index 00000000000..4e03535f613 --- /dev/null +++ b/src/test/run-pass/issues/issue-14254.rs @@ -0,0 +1,103 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Foo: Sized { + fn bar(&self); + fn baz(&self) { } + fn bah(_: Option) { } +} + +struct BarTy { + x : isize, + y : f64, +} + +impl BarTy { + fn a() {} + fn b(&self) {} +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for *const BarTy { + fn bar(&self) { + self.baz(); + BarTy::a(); + Foo::bah(None::<*const BarTy>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a BarTy { + fn bar(&self) { + self.baz(); + self.x; + self.y; + BarTy::a(); + Foo::bah(None::<&BarTy>); + self.b(); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a mut BarTy { + fn bar(&self) { + self.baz(); + self.x; + self.y; + BarTy::a(); + Foo::bah(None::<&mut BarTy>); + self.b(); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for Box { + fn bar(&self) { + self.baz(); + Foo::bah(None::>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for *const isize { + fn bar(&self) { + self.baz(); + Foo::bah(None::<*const isize>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a isize { + fn bar(&self) { + self.baz(); + Foo::bah(None::<&isize>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl<'a> Foo for &'a mut isize { + fn bar(&self) { + self.baz(); + Foo::bah(None::<&mut isize>); + } +} + +// If these fail, it's necessary to update rustc_resolve and the cfail tests. +impl Foo for Box { + fn bar(&self) { + self.baz(); + Foo::bah(None::>); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-14308.rs b/src/test/run-pass/issues/issue-14308.rs new file mode 100644 index 00000000000..dce2c4aecd6 --- /dev/null +++ b/src/test/run-pass/issues/issue-14308.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct A(isize); + +fn main() { + let x = match A(3) { + A(..) => 1 + }; + assert_eq!(x, 1); + let x = match A(4) { + A(1) => 1, + A(..) => 2 + }; + assert_eq!(x, 2); +} diff --git a/src/test/run-pass/issues/issue-14330.rs b/src/test/run-pass/issues/issue-14330.rs new file mode 100644 index 00000000000..d50dc64f437 --- /dev/null +++ b/src/test/run-pass/issues/issue-14330.rs @@ -0,0 +1,16 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[macro_use] extern crate std as std2; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-14344.rs b/src/test/run-pass/issues/issue-14344.rs new file mode 100644 index 00000000000..842a5c1ad77 --- /dev/null +++ b/src/test/run-pass/issues/issue-14344.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-14344-1.rs +// aux-build:issue-14344-2.rs + +extern crate issue_14344_1; +extern crate issue_14344_2; + +fn main() { + issue_14344_1::foo(); + issue_14344_2::bar(); +} diff --git a/src/test/run-pass/issues/issue-14382.rs b/src/test/run-pass/issues/issue-14382.rs new file mode 100644 index 00000000000..7fdd5e2b0db --- /dev/null +++ b/src/test/run-pass/issues/issue-14382.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct Matrix4(S); +trait POrd {} + +fn translate>(s: S) -> Matrix4 { Matrix4(s) } + +impl POrd for f32 {} +impl POrd for f64 {} + +fn main() { + let x = 1.0; + let m : Matrix4 = translate(x); + println!("m: {:?}", m); +} diff --git a/src/test/run-pass/issues/issue-14393.rs b/src/test/run-pass/issues/issue-14393.rs new file mode 100644 index 00000000000..9dd3674f34f --- /dev/null +++ b/src/test/run-pass/issues/issue-14393.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + match ("", 1_usize) { + (_, 42_usize) => (), + ("", _) => (), + _ => () + } +} diff --git a/src/test/run-pass/issues/issue-14399.rs b/src/test/run-pass/issues/issue-14399.rs new file mode 100644 index 00000000000..76785212cd7 --- /dev/null +++ b/src/test/run-pass/issues/issue-14399.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #14399 +// We'd previously ICE if we had a method call whose return +// value was coerced to a trait object. (v.clone() returns Box +// which is coerced to Box). + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +#[derive(Clone)] +struct B1; + +trait A { fn foo(&self) {} } +impl A for B1 {} + +fn main() { + let v: Box<_> = box B1; + let _c: Box = v.clone(); +} diff --git a/src/test/run-pass/issues/issue-14421.rs b/src/test/run-pass/issues/issue-14421.rs new file mode 100644 index 00000000000..8920134bcbb --- /dev/null +++ b/src/test/run-pass/issues/issue-14421.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// aux-build:issue-14421.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_14421 as bug_lib; + +use bug_lib::B; +use bug_lib::make; + +pub fn main() { + let mut an_A: B = make(); + an_A.foo(); +} diff --git a/src/test/run-pass/issues/issue-14422.rs b/src/test/run-pass/issues/issue-14422.rs new file mode 100644 index 00000000000..dd1d74779d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-14422.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// aux-build:issue-14422.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_14422 as bug_lib; + +use bug_lib::B; +use bug_lib::make; + +pub fn main() { + let mut an_A: B = make(); + an_A.foo(); +} diff --git a/src/test/run-pass/issues/issue-14456.rs b/src/test/run-pass/issues/issue-14456.rs new file mode 100644 index 00000000000..27eb0ebcbfe --- /dev/null +++ b/src/test/run-pass/issues/issue-14456.rs @@ -0,0 +1,46 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::env; +use std::io::prelude::*; +use std::io; +use std::process::{Command, Stdio}; + +fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + return child() + } + + test(); +} + +fn child() { + writeln!(&mut io::stdout(), "foo").unwrap(); + writeln!(&mut io::stderr(), "bar").unwrap(); + let mut stdin = io::stdin(); + let mut s = String::new(); + stdin.lock().read_line(&mut s).unwrap(); + assert_eq!(s.len(), 0); +} + +fn test() { + let args: Vec = env::args().collect(); + let mut p = Command::new(&args[0]).arg("child") + .stdin(Stdio::piped()) + .stdout(Stdio::piped()) + .stderr(Stdio::piped()) + .spawn().unwrap(); + assert!(p.wait().unwrap().success()); +} diff --git a/src/test/run-pass/issues/issue-1451.rs b/src/test/run-pass/issues/issue-1451.rs new file mode 100644 index 00000000000..fb344c3b4b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-1451.rs @@ -0,0 +1,36 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_snake_case)] +#![allow(unused_variables)] + +struct T { f: extern "Rust" fn() } +struct S { f: extern "Rust" fn() } + +fn fooS(t: S) { +} + +fn fooT(t: T) { +} + +fn bar() { +} + +pub fn main() { + let x: extern "Rust" fn() = bar; + fooS(S {f: x}); + fooS(S {f: bar}); + + let x: extern "Rust" fn() = bar; + fooT(T {f: x}); + fooT(T {f: bar}); +} diff --git a/src/test/run-pass/issues/issue-14589.rs b/src/test/run-pass/issues/issue-14589.rs new file mode 100644 index 00000000000..78f47237ed6 --- /dev/null +++ b/src/test/run-pass/issues/issue-14589.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// All 3 expressions should work in that the argument gets +// coerced to a trait object + +// pretty-expanded FIXME #23616 + +fn main() { + send::>(Box::new(Output(0))); + Test::>::foo(Box::new(Output(0))); + Test::>::new().send(Box::new(Output(0))); +} + +fn send(_: T) {} + +struct Test { marker: std::marker::PhantomData } +impl Test { + fn new() -> Test { Test { marker: ::std::marker::PhantomData } } + fn foo(_: T) {} + fn send(&self, _: T) {} +} + +trait Foo { fn dummy(&self) { }} +struct Output(isize); +impl Foo for Output {} diff --git a/src/test/run-pass/issues/issue-1460.rs b/src/test/run-pass/issues/issue-1460.rs new file mode 100644 index 00000000000..85a87327355 --- /dev/null +++ b/src/test/run-pass/issues/issue-1460.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +pub fn main() { + {|i: u32| if 1 == i { }}; +} diff --git a/src/test/run-pass/issues/issue-14821.rs b/src/test/run-pass/issues/issue-14821.rs new file mode 100644 index 00000000000..c01ffb7d6b1 --- /dev/null +++ b/src/test/run-pass/issues/issue-14821.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait SomeTrait {} +struct Meow; +impl SomeTrait for Meow {} + +struct Foo<'a> { + x: &'a SomeTrait, + y: &'a SomeTrait, +} + +impl<'a> Foo<'a> { + pub fn new<'b>(x: &'b SomeTrait, y: &'b SomeTrait) -> Foo<'b> { Foo { x: x, y: y } } +} + +fn main() { + let r = Meow; + let s = Meow; + let q = Foo::new(&r as &SomeTrait, &s as &SomeTrait); +} diff --git a/src/test/run-pass/issues/issue-14837.rs b/src/test/run-pass/issues/issue-14837.rs new file mode 100644 index 00000000000..9945c6e4407 --- /dev/null +++ b/src/test/run-pass/issues/issue-14837.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[deny(dead_code)] +pub enum Foo { + Bar { + baz: isize + } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-14865.rs b/src/test/run-pass/issues/issue-14865.rs new file mode 100644 index 00000000000..4e278c66886 --- /dev/null +++ b/src/test/run-pass/issues/issue-14865.rs @@ -0,0 +1,32 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum X { + Foo(usize), + Bar(bool) +} + +fn main() { + let x = match X::Foo(42) { + X::Foo(..) => 1, + _ if true => 0, + X::Bar(..) => panic!("Oh dear") + }; + assert_eq!(x, 1); + + let x = match X::Foo(42) { + _ if true => 0, + X::Foo(..) => 1, + X::Bar(..) => panic!("Oh dear") + }; + assert_eq!(x, 0); +} diff --git a/src/test/run-pass/issues/issue-14875.rs b/src/test/run-pass/issues/issue-14875.rs new file mode 100644 index 00000000000..f983218dc8b --- /dev/null +++ b/src/test/run-pass/issues/issue-14875.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare always compiled as panic=abort right now + +// Check that values are not leaked when a dtor panics (#14875) + +use std::panic::{self, UnwindSafe}; + +struct SetInnerOnDrop<'a>(&'a mut bool); + +impl<'a> UnwindSafe for SetInnerOnDrop<'a> {} + +impl<'a> Drop for SetInnerOnDrop<'a> { + fn drop(&mut self) { + *self.0 = true; + } +} + +struct PanicOnDrop; +impl Drop for PanicOnDrop { + fn drop(&mut self) { + panic!("test panic"); + } +} + +fn main() { + let mut set_on_drop = false; + { + let set_inner_on_drop = SetInnerOnDrop(&mut set_on_drop); + let _ = panic::catch_unwind(|| { + let _set_inner_on_drop = set_inner_on_drop; + let _panic_on_drop = PanicOnDrop; + }); + } + assert!(set_on_drop); +} diff --git a/src/test/run-pass/issues/issue-14901.rs b/src/test/run-pass/issues/issue-14901.rs new file mode 100644 index 00000000000..7612c5bc855 --- /dev/null +++ b/src/test/run-pass/issues/issue-14901.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Reader {} + +enum Wrapper<'a> { + WrapReader(&'a (Reader + 'a)) +} + +trait Wrap<'a> { + fn wrap(self) -> Wrapper<'a>; +} + +impl<'a, R: Reader> Wrap<'a> for &'a mut R { + fn wrap(self) -> Wrapper<'a> { + Wrapper::WrapReader(self as &'a mut Reader) + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-14919.rs b/src/test/run-pass/issues/issue-14919.rs new file mode 100644 index 00000000000..a9768661256 --- /dev/null +++ b/src/test/run-pass/issues/issue-14919.rs @@ -0,0 +1,63 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Matcher { + fn next_match(&mut self) -> Option<(usize, usize)>; +} + +struct CharPredMatcher<'a, 'b> { + str: &'a str, + pred: Box bool + 'b>, +} + +impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> { + fn next_match(&mut self) -> Option<(usize, usize)> { + None + } +} + +trait IntoMatcher<'a, T> { + fn into_matcher(self, _: &'a str) -> T; +} + +impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b { + fn into_matcher(self, s: &'a str) -> CharPredMatcher<'a, 'b> { + CharPredMatcher { + str: s, + pred: Box::new(self), + } + } +} + +struct MatchIndices { + matcher: M +} + +impl Iterator for MatchIndices { + type Item = (usize, usize); + + fn next(&mut self) -> Option<(usize, usize)> { + self.matcher.next_match() + } +} + +fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndices { + let string_matcher = from.into_matcher(s); + MatchIndices { matcher: string_matcher } +} + +fn main() { + let s = "abcbdef"; + match_indices(s, |c: char| c == 'b') + .collect::>(); +} diff --git a/src/test/run-pass/issues/issue-14933.rs b/src/test/run-pass/issues/issue-14933.rs new file mode 100644 index 00000000000..30365bb3e4f --- /dev/null +++ b/src/test/run-pass/issues/issue-14933.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub type BigRat = T; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-14936.rs b/src/test/run-pass/issues/issue-14936.rs new file mode 100644 index 00000000000..3786b0408ad --- /dev/null +++ b/src/test/run-pass/issues/issue-14936.rs @@ -0,0 +1,57 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(asm)] + +type History = Vec<&'static str>; + +fn wrap(x:A, which: &'static str, history: &mut History) -> A { + history.push(which); + x +} + +macro_rules! demo { + ( $output_constraint:tt ) => { + { + let mut x: isize = 0; + let y: isize = 1; + + let mut history: History = vec![]; + unsafe { + asm!("mov ($1), $0" + : $output_constraint (*wrap(&mut x, "out", &mut history)) + : "r"(&wrap(y, "in", &mut history)) + :: "volatile"); + } + assert_eq!((x,y), (1,1)); + let b: &[_] = &["out", "in"]; + assert_eq!(history, b); + } + } +} + +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +fn main() { + fn out_write_only_expr_then_in_expr() { + demo!("=r") + } + + fn out_read_write_expr_then_in_expr() { + demo!("+r") + } + + out_write_only_expr_then_in_expr(); + out_read_write_expr_then_in_expr(); +} + +#[cfg(all(not(target_arch = "x86"), not(target_arch = "x86_64")))] +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-14940.rs b/src/test/run-pass/issues/issue-14940.rs new file mode 100644 index 00000000000..494b790b5bd --- /dev/null +++ b/src/test/run-pass/issues/issue-14940.rs @@ -0,0 +1,29 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::env; +use std::process::Command; +use std::io::{self, Write}; + +fn main() { + let mut args = env::args(); + if args.len() > 1 { + let mut out = io::stdout(); + out.write(&['a' as u8; 128 * 1024]).unwrap(); + } else { + let out = Command::new(&args.next().unwrap()).arg("child").output(); + let out = out.unwrap(); + assert!(out.status.success()); + } +} diff --git a/src/test/run-pass/issues/issue-14958.rs b/src/test/run-pass/issues/issue-14958.rs new file mode 100644 index 00000000000..90716488fab --- /dev/null +++ b/src/test/run-pass/issues/issue-14958.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(fn_traits, unboxed_closures)] + +trait Foo { fn dummy(&self) { }} + +struct Bar; + +impl<'a> std::ops::Fn<(&'a (Foo+'a),)> for Bar { + extern "rust-call" fn call(&self, _: (&'a Foo,)) {} +} + +impl<'a> std::ops::FnMut<(&'a (Foo+'a),)> for Bar { + extern "rust-call" fn call_mut(&mut self, a: (&'a Foo,)) { self.call(a) } +} + +impl<'a> std::ops::FnOnce<(&'a (Foo+'a),)> for Bar { + type Output = (); + extern "rust-call" fn call_once(self, a: (&'a Foo,)) { self.call(a) } +} + +struct Baz; + +impl Foo for Baz {} + +fn main() { + let bar = Bar; + let baz = &Baz; + bar(baz); +} diff --git a/src/test/run-pass/issues/issue-14959.rs b/src/test/run-pass/issues/issue-14959.rs new file mode 100644 index 00000000000..fc245fb4244 --- /dev/null +++ b/src/test/run-pass/issues/issue-14959.rs @@ -0,0 +1,65 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(fn_traits, unboxed_closures)] + +use std::ops::Fn; + +trait Response { fn dummy(&self) { } } +trait Request { fn dummy(&self) { } } +trait Ingot { + fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status; +} + +#[allow(dead_code)] +struct HelloWorld; + +struct SendFile; +struct Alloy; +enum Status { + Continue +} + +impl Alloy { + fn find(&self) -> Option { + None + } +} + +impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile { + extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {} +} + +impl<'b> FnMut<(&'b mut (Response+'b),)> for SendFile { + extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (Response+'b),)) { + self.call((_res,)) + } +} + +impl<'b> FnOnce<(&'b mut (Response+'b),)> for SendFile { + type Output = (); + + extern "rust-call" fn call_once(self, (_res,): (&'b mut (Response+'b),)) { + self.call((_res,)) + } +} + +impl Ingot for HelloWorld { + fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status { + let send_file = alloy.find::().unwrap(); + send_file(res); + Status::Continue + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-15043.rs b/src/test/run-pass/issues/issue-15043.rs new file mode 100644 index 00000000000..3ba4966a13e --- /dev/null +++ b/src/test/run-pass/issues/issue-15043.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(warnings)] + +struct S(T); + +static s1: S>=S(S(0)); +static s2: S=S(0); + +fn main() { + let foo: S>=S(S(0)); + let foo: S=S(0); +} diff --git a/src/test/run-pass/issues/issue-15063.rs b/src/test/run-pass/issues/issue-15063.rs new file mode 100644 index 00000000000..863dde1fc5e --- /dev/null +++ b/src/test/run-pass/issues/issue-15063.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Two { A, B} +impl Drop for Two { + fn drop(&mut self) { + println!("Dropping!"); + } +} +fn main() { + let k = Two::A; +} diff --git a/src/test/run-pass/issues/issue-15080.rs b/src/test/run-pass/issues/issue-15080.rs new file mode 100644 index 00000000000..ee8356b99e0 --- /dev/null +++ b/src/test/run-pass/issues/issue-15080.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn main() { + let mut x: &[_] = &[1, 2, 3, 4]; + + let mut result = vec![]; + loop { + x = match *x { + [1, n, 3, ref rest..] => { + result.push(n); + rest + } + [n, ref rest..] => { + result.push(n); + rest + } + [] => + break + } + } + assert_eq!(result, [2, 4]); +} diff --git a/src/test/run-pass/issues/issue-15104.rs b/src/test/run-pass/issues/issue-15104.rs new file mode 100644 index 00000000000..0cb1d69d186 --- /dev/null +++ b/src/test/run-pass/issues/issue-15104.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn main() { + assert_eq!(count_members(&[1, 2, 3, 4]), 4); +} + +fn count_members(v: &[usize]) -> usize { + match *v { + [] => 0, + [_] => 1, + [_, ref xs..] => 1 + count_members(xs) + } +} diff --git a/src/test/run-pass/issues/issue-15108.rs b/src/test/run-pass/issues/issue-15108.rs new file mode 100644 index 00000000000..7288ff23cb4 --- /dev/null +++ b/src/test/run-pass/issues/issue-15108.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() {} diff --git a/src/test/run-pass/issues/issue-15129.rs b/src/test/run-pass/issues/issue-15129.rs new file mode 100644 index 00000000000..b0ee797752a --- /dev/null +++ b/src/test/run-pass/issues/issue-15129.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub enum T { + T1(()), + T2(()) +} + +pub enum V { + V1(isize), + V2(bool) +} + +fn foo(x: (T, V)) -> String { + match x { + (T::T1(()), V::V1(i)) => format!("T1(()), V1({})", i), + (T::T2(()), V::V2(b)) => format!("T2(()), V2({})", b), + _ => String::new() + } +} + + +fn main() { + assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_string()); + assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_string()); +} diff --git a/src/test/run-pass/issues/issue-15155.rs b/src/test/run-pass/issues/issue-15155.rs new file mode 100644 index 00000000000..3abed1f5637 --- /dev/null +++ b/src/test/run-pass/issues/issue-15155.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait TraitWithSend: Send {} +trait IndirectTraitWithSend: TraitWithSend {} + +// Check struct instantiation (Box will only have Send if TraitWithSend has Send) +#[allow(dead_code)] +struct Blah { x: Box } +impl TraitWithSend for Blah {} + +// Struct instantiation 2-levels deep +#[allow(dead_code)] +struct IndirectBlah { x: Box } +impl TraitWithSend for IndirectBlah {} +impl IndirectTraitWithSend for IndirectBlah {} + +fn test_trait() { println!("got here!") } + +fn main() { + test_trait::(); + test_trait::(); +} diff --git a/src/test/run-pass/issues/issue-15189.rs b/src/test/run-pass/issues/issue-15189.rs new file mode 100644 index 00000000000..6c6a4404da9 --- /dev/null +++ b/src/test/run-pass/issues/issue-15189.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! third { + ($e:expr) => ({let x = 2; $e[x]}) +} + +fn main() { + let x = vec![10_usize,11_usize,12_usize,13_usize]; + let t = third!(x); + assert_eq!(t,12_usize); +} diff --git a/src/test/run-pass/issues/issue-15221.rs b/src/test/run-pass/issues/issue-15221.rs new file mode 100644 index 00000000000..25e163e3958 --- /dev/null +++ b/src/test/run-pass/issues/issue-15221.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +macro_rules! inner { + ($e:pat ) => ($e) +} + +macro_rules! outer { + ($e:pat ) => (inner!($e)) +} + +fn main() { + let outer!(g1) = 13; + g1; +} diff --git a/src/test/run-pass/issues/issue-15261.rs b/src/test/run-pass/issues/issue-15261.rs new file mode 100644 index 00000000000..b715a388d10 --- /dev/null +++ b/src/test/run-pass/issues/issue-15261.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 + +static mut n_mut: usize = 0; + +static n: &'static usize = unsafe{ &n_mut }; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-15444.rs b/src/test/run-pass/issues/issue-15444.rs new file mode 100644 index 00000000000..826ca40d63d --- /dev/null +++ b/src/test/run-pass/issues/issue-15444.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait MyTrait { + fn foo(&self); +} + +impl MyTrait for fn(A, B) -> C { + fn foo(&self) {} +} + +fn bar(t: &T) { + t.foo() +} + +fn thing(a: isize, b: isize) -> isize { + a + b +} + +fn main() { + let thing: fn(isize, isize) -> isize = thing; // coerce to fn type + bar(&thing); +} diff --git a/src/test/run-pass/issues/issue-15487.rs b/src/test/run-pass/issues/issue-15487.rs new file mode 100644 index 00000000000..de4de14ca33 --- /dev/null +++ b/src/test/run-pass/issues/issue-15487.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-windows +// ignore-wasm32-bare no libs to link + +#![feature(link_args)] + +#[link_args="-lc -lm"] +#[link_args=" -lc"] +#[link_args="-lc "] +extern {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-15523-big.rs b/src/test/run-pass/issues/issue-15523-big.rs new file mode 100644 index 00000000000..41a52283aac --- /dev/null +++ b/src/test/run-pass/issues/issue-15523-big.rs @@ -0,0 +1,49 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 15523: derive(PartialOrd) should use the provided +// discriminant values for the derived ordering. +// +// This test is checking corner cases that arise when you have +// 64-bit values in the variants. + +#[derive(PartialEq, PartialOrd)] +#[repr(u64)] +enum Eu64 { + Pos2 = 2, + PosMax = !0, + Pos1 = 1, +} + +#[derive(PartialEq, PartialOrd)] +#[repr(i64)] +enum Ei64 { + Pos2 = 2, + Neg1 = -1, + NegMin = 1 << 63, + PosMax = !(1 << 63), + Pos1 = 1, +} + +fn main() { + assert!(Eu64::Pos2 > Eu64::Pos1); + assert!(Eu64::Pos2 < Eu64::PosMax); + assert!(Eu64::Pos1 < Eu64::PosMax); + + + assert!(Ei64::Pos2 > Ei64::Pos1); + assert!(Ei64::Pos2 > Ei64::Neg1); + assert!(Ei64::Pos1 > Ei64::Neg1); + assert!(Ei64::Pos2 > Ei64::NegMin); + assert!(Ei64::Pos1 > Ei64::NegMin); + assert!(Ei64::Pos2 < Ei64::PosMax); + assert!(Ei64::Pos1 < Ei64::PosMax); +} diff --git a/src/test/run-pass/issues/issue-15523.rs b/src/test/run-pass/issues/issue-15523.rs new file mode 100644 index 00000000000..a8fc2153c66 --- /dev/null +++ b/src/test/run-pass/issues/issue-15523.rs @@ -0,0 +1,52 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 15523: derive(PartialOrd) should use the provided +// discriminant values for the derived ordering. +// +// This is checking the basic functionality. + +#[derive(PartialEq, PartialOrd)] +enum E1 { + Pos2 = 2, + Neg1 = -1, + Pos1 = 1, +} + +#[derive(PartialEq, PartialOrd)] +#[repr(u8)] +enum E2 { + Pos2 = 2, + PosMax = !0 as u8, + Pos1 = 1, +} + +#[derive(PartialEq, PartialOrd)] +#[repr(i8)] +enum E3 { + Pos2 = 2, + Neg1 = -1_i8, + Pos1 = 1, +} + +fn main() { + assert!(E1::Pos2 > E1::Pos1); + assert!(E1::Pos1 > E1::Neg1); + assert!(E1::Pos2 > E1::Neg1); + + assert!(E2::Pos2 > E2::Pos1); + assert!(E2::Pos1 < E2::PosMax); + assert!(E2::Pos2 < E2::PosMax); + + assert!(E3::Pos2 > E3::Pos1); + assert!(E3::Pos1 > E3::Neg1); + assert!(E3::Pos2 > E3::Neg1); +} diff --git a/src/test/run-pass/issues/issue-15562.rs b/src/test/run-pass/issues/issue-15562.rs new file mode 100644 index 00000000000..a3e3f528ff5 --- /dev/null +++ b/src/test/run-pass/issues/issue-15562.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-15562.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_15562 as i; + +pub fn main() { + unsafe { + transmute(); + i::transmute(); + } +} + +// We declare this so we don't run into unresolved symbol errors +// The above extern is NOT `extern "rust-intrinsic"` and thus +// means it'll try to find a corresponding symbol to link to. +#[no_mangle] +pub extern fn transmute() {} diff --git a/src/test/run-pass/issues/issue-15571.rs b/src/test/run-pass/issues/issue-15571.rs new file mode 100644 index 00000000000..41414b13a19 --- /dev/null +++ b/src/test/run-pass/issues/issue-15571.rs @@ -0,0 +1,68 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn match_on_local() { + let mut foo: Option> = Some(box 5); + match foo { + None => {}, + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); +} + +fn match_on_arg(mut foo: Option>) { + match foo { + None => {} + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); +} + +fn match_on_binding() { + match Some(Box::new(7)) { + mut foo => { + match foo { + None => {}, + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); + } + } +} + +fn match_on_upvar() { + let mut foo: Option> = Some(box 8); + let f = move|| { + match foo { + None => {}, + Some(x) => { + foo = Some(x); + } + } + println!("'{}'", foo.unwrap()); + }; + f(); +} + +fn main() { + match_on_local(); + match_on_arg(Some(box 6)); + match_on_binding(); + match_on_upvar(); +} diff --git a/src/test/run-pass/issues/issue-15673.rs b/src/test/run-pass/issues/issue-15673.rs new file mode 100644 index 00000000000..c706606cf6a --- /dev/null +++ b/src/test/run-pass/issues/issue-15673.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(iter_arith)] + +fn main() { + let x: [u64; 3] = [1, 2, 3]; + assert_eq!(6, (0..3).map(|i| x[i]).sum::()); +} diff --git a/src/test/run-pass/issues/issue-15689-1.rs b/src/test/run-pass/issues/issue-15689-1.rs new file mode 100644 index 00000000000..02bf687e74f --- /dev/null +++ b/src/test/run-pass/issues/issue-15689-1.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(PartialEq, Debug)] +enum Test<'a> { + Slice(&'a isize) +} + +fn main() { + assert_eq!(Test::Slice(&1), Test::Slice(&1)) +} diff --git a/src/test/run-pass/issues/issue-15689-2.rs b/src/test/run-pass/issues/issue-15689-2.rs new file mode 100644 index 00000000000..7b4d1e3e3e2 --- /dev/null +++ b/src/test/run-pass/issues/issue-15689-2.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Clone)] +enum Test<'a> { + Slice(&'a isize) +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-15730.rs b/src/test/run-pass/issues/issue-15730.rs new file mode 100644 index 00000000000..c2f5f9f2e60 --- /dev/null +++ b/src/test/run-pass/issues/issue-15730.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let mut array = [1, 2, 3]; + let pie_slice = &array[1..2]; +} diff --git a/src/test/run-pass/issues/issue-15734.rs b/src/test/run-pass/issues/issue-15734.rs new file mode 100644 index 00000000000..6b386ed0f8d --- /dev/null +++ b/src/test/run-pass/issues/issue-15734.rs @@ -0,0 +1,68 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// If `Index` used an associated type for its output, this test would +// work more smoothly. + +use std::ops::Index; + +struct Mat { data: Vec, cols: usize, } + +impl Mat { + fn new(data: Vec, cols: usize) -> Mat { + Mat { data: data, cols: cols } + } + fn row<'a>(&'a self, row: usize) -> Row<&'a Mat> { + Row { mat: self, row: row, } + } +} + +impl Index<(usize, usize)> for Mat { + type Output = T; + + fn index<'a>(&'a self, (row, col): (usize, usize)) -> &'a T { + &self.data[row * self.cols + col] + } +} + +impl<'a, T> Index<(usize, usize)> for &'a Mat { + type Output = T; + + fn index<'b>(&'b self, index: (usize, usize)) -> &'b T { + (*self).index(index) + } +} + +struct Row { mat: M, row: usize, } + +impl> Index for Row { + type Output = T; + + fn index<'a>(&'a self, col: usize) -> &'a T { + &self.mat[(self.row, col)] + } +} + +fn main() { + let m = Mat::new(vec![1, 2, 3, 4, 5, 6], 3); + let r = m.row(1); + + assert_eq!(r.index(2), &6); + assert_eq!(r[2], 6); + assert_eq!(r[2], 6); + assert_eq!(6, r[2]); + + let e = r[2]; + assert_eq!(e, 6); + + let e: usize = r[2]; + assert_eq!(e, 6); +} diff --git a/src/test/run-pass/issues/issue-15735.rs b/src/test/run-pass/issues/issue-15735.rs new file mode 100644 index 00000000000..9e95b173e89 --- /dev/null +++ b/src/test/run-pass/issues/issue-15735.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct A<'a> { + a: &'a i32, + b: &'a i32, +} + +impl <'a> A<'a> { + fn foo<'b>(&'b self) { + A { + a: self.a, + b: self.b, + }; + } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-15763.rs b/src/test/run-pass/issues/issue-15763.rs new file mode 100644 index 00000000000..f241efa74d3 --- /dev/null +++ b/src/test/run-pass/issues/issue-15763.rs @@ -0,0 +1,98 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +#[derive(PartialEq, Debug)] +struct Bar { + x: isize +} +impl Drop for Bar { + fn drop(&mut self) { + assert_eq!(self.x, 22); + } +} + +#[derive(PartialEq, Debug)] +struct Foo { + x: Bar, + a: isize +} + +fn foo() -> Result { + return Ok(Foo { + x: Bar { x: 22 }, + a: return Err(32) + }); +} + +fn baz() -> Result { + Ok(Foo { + x: Bar { x: 22 }, + a: return Err(32) + }) +} + +// explicit immediate return +fn aa() -> isize { + return 3; +} + +// implicit immediate return +fn bb() -> isize { + 3 +} + +// implicit outptr return +fn cc() -> Result { + Ok(3) +} + +// explicit outptr return +fn dd() -> Result { + return Ok(3); +} + +trait A { + fn aaa(&self) -> isize { + 3 + } + fn bbb(&self) -> isize { + return 3; + } + fn ccc(&self) -> Result { + Ok(3) + } + fn ddd(&self) -> Result { + return Ok(3); + } +} + +impl A for isize {} + +fn main() { + assert_eq!(foo(), Err(32)); + assert_eq!(baz(), Err(32)); + + assert_eq!(aa(), 3); + assert_eq!(bb(), 3); + assert_eq!(cc().unwrap(), 3); + assert_eq!(dd().unwrap(), 3); + + let i = box 32isize as Box; + assert_eq!(i.aaa(), 3); + let i = box 32isize as Box; + assert_eq!(i.bbb(), 3); + let i = box 32isize as Box; + assert_eq!(i.ccc().unwrap(), 3); + let i = box 32isize as Box; + assert_eq!(i.ddd().unwrap(), 3); +} diff --git a/src/test/run-pass/issues/issue-15774.rs b/src/test/run-pass/issues/issue-15774.rs new file mode 100644 index 00000000000..3e4845886e0 --- /dev/null +++ b/src/test/run-pass/issues/issue-15774.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![deny(warnings)] +#![allow(unused_imports)] + +pub enum Foo { A } +mod bar { + pub fn normal(x: ::Foo) { + use Foo::A; + match x { + A => {} + } + } + pub fn wrong(x: ::Foo) { + match x { + ::Foo::A => {} + } + } +} + +pub fn main() { + bar::normal(Foo::A); + bar::wrong(Foo::A); +} diff --git a/src/test/run-pass/issues/issue-15793.rs b/src/test/run-pass/issues/issue-15793.rs new file mode 100644 index 00000000000..97f4c0095ec --- /dev/null +++ b/src/test/run-pass/issues/issue-15793.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum NestedEnum { + First, + Second, + Third +} +enum Enum { + Variant1(bool), + Variant2(NestedEnum) +} + +#[inline(never)] +fn foo(x: Enum) -> isize { + match x { + Enum::Variant1(true) => 1, + Enum::Variant1(false) => 2, + Enum::Variant2(NestedEnum::Second) => 3, + Enum::Variant2(NestedEnum::Third) => 4, + Enum::Variant2(NestedEnum::First) => 5 + } +} + +fn main() { + assert_eq!(foo(Enum::Variant2(NestedEnum::Third)), 4); +} diff --git a/src/test/run-pass/issues/issue-15858.rs b/src/test/run-pass/issues/issue-15858.rs new file mode 100644 index 00000000000..f0b4db7d6bd --- /dev/null +++ b/src/test/run-pass/issues/issue-15858.rs @@ -0,0 +1,43 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +static mut DROP_RAN: bool = false; + +trait Bar { + fn do_something(&mut self); +} + +struct BarImpl; + +impl Bar for BarImpl { + fn do_something(&mut self) {} +} + + +struct Foo(B); + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { + DROP_RAN = true; + } + } +} + + +fn main() { + { + let _x: Foo = Foo(BarImpl); + } + unsafe { + assert_eq!(DROP_RAN, true); + } +} diff --git a/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs b/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs new file mode 100644 index 00000000000..2b39b80d10f --- /dev/null +++ b/src/test/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 + +// regression test for the model lexer handling the DOTDOTDOT syntax (#15877) + + +pub fn main() { + match 5_usize { + 1_usize...5_usize => {} + _ => panic!("should match range"), + } + match 5_usize { + 6_usize...7_usize => panic!("shouldn't match range"), + _ => {} + } + match 5_usize { + 1_usize => panic!("should match non-first range"), + 2_usize...6_usize => {} + _ => panic!("math is broken") + } + match 'c' { + 'a'...'z' => {} + _ => panic!("should support char ranges") + } + match -3_isize { + -7...5 => {} + _ => panic!("should match signed range") + } + match 3.0f64 { + 1.0...5.0 => {} + _ => panic!("should match float range") + } + match -1.5f64 { + -3.6...3.6 => {} + _ => panic!("should match negative float range") + } +} diff --git a/src/test/run-pass/issues/issue-16151.rs b/src/test/run-pass/issues/issue-16151.rs new file mode 100644 index 00000000000..440037ff119 --- /dev/null +++ b/src/test/run-pass/issues/issue-16151.rs @@ -0,0 +1,39 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem; + +static mut DROP_COUNT: usize = 0; + +struct Fragment; + +impl Drop for Fragment { + fn drop(&mut self) { + unsafe { + DROP_COUNT += 1; + } + } +} + +fn main() { + { + let mut fragments = vec![Fragment, Fragment, Fragment]; + let _new_fragments: Vec = mem::replace(&mut fragments, vec![]) + .into_iter() + .skip_while(|_fragment| { + true + }).collect(); + } + unsafe { + assert_eq!(DROP_COUNT, 3); + } +} diff --git a/src/test/run-pass/issues/issue-16256.rs b/src/test/run-pass/issues/issue-16256.rs new file mode 100644 index 00000000000..20a5bbadcf5 --- /dev/null +++ b/src/test/run-pass/issues/issue-16256.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let mut buf = Vec::new(); + |c: u8| buf.push(c); +} diff --git a/src/test/run-pass/issues/issue-16272.rs b/src/test/run-pass/issues/issue-16272.rs new file mode 100644 index 00000000000..dd515ea1558 --- /dev/null +++ b/src/test/run-pass/issues/issue-16272.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::process::Command; +use std::env; + +fn main() { + let len = env::args().len(); + + if len == 1 { + test(); + } else { + assert_eq!(len, 3); + } +} + +fn test() { + let status = Command::new(&env::current_exe().unwrap()) + .arg("foo").arg("") + .status().unwrap(); + assert!(status.success()); +} diff --git a/src/test/run-pass/issues/issue-16278.rs b/src/test/run-pass/issues/issue-16278.rs new file mode 100644 index 00000000000..c3b6c5a38ba --- /dev/null +++ b/src/test/run-pass/issues/issue-16278.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-tidy-cr + +// this file has some special \r\n endings (use xxd to see them) + +fn main() {assert_eq!(b"", b"\ + "); +assert_eq!(b"\n", b" +"); +} + diff --git a/src/test/run-pass/issues/issue-16441.rs b/src/test/run-pass/issues/issue-16441.rs new file mode 100644 index 00000000000..5a0ea2adc63 --- /dev/null +++ b/src/test/run-pass/issues/issue-16441.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Empty; + +// This used to cause an ICE +extern "C" fn ice(_a: Empty) {} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-16452.rs b/src/test/run-pass/issues/issue-16452.rs new file mode 100644 index 00000000000..2b78582b577 --- /dev/null +++ b/src/test/run-pass/issues/issue-16452.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + if true { return } + match () { + () => { static MAGIC: usize = 0; } + } +} diff --git a/src/test/run-pass/issues/issue-16492.rs b/src/test/run-pass/issues/issue-16492.rs new file mode 100644 index 00000000000..7c2f4d99e6a --- /dev/null +++ b/src/test/run-pass/issues/issue-16492.rs @@ -0,0 +1,77 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +use std::rc::Rc; +use std::cell::Cell; + +struct Field { + number: usize, + state: Rc> +} + +impl Field { + fn new(number: usize, state: Rc>) -> Field { + Field { + number: number, + state: state + } + } +} + +impl Drop for Field { + fn drop(&mut self) { + println!("Dropping field {}", self.number); + assert_eq!(self.state.get(), self.number); + self.state.set(self.state.get()+1); + } +} + +struct NoDropImpl { + _one: Field, + _two: Field, + _three: Field +} + +struct HasDropImpl { + _one: Field, + _two: Field, + _three: Field +} + +impl Drop for HasDropImpl { + fn drop(&mut self) { + println!("HasDropImpl.drop()"); + assert_eq!(self._one.state.get(), 0); + self._one.state.set(1); + } +} + +pub fn main() { + let state = Rc::new(Cell::new(1)); + let noImpl = NoDropImpl { + _one: Field::new(1, state.clone()), + _two: Field::new(2, state.clone()), + _three: Field::new(3, state.clone()) + }; + drop(noImpl); + assert_eq!(state.get(), 4); + + state.set(0); + let hasImpl = HasDropImpl { + _one: Field::new(1, state.clone()), + _two: Field::new(2, state.clone()), + _three: Field::new(3, state.clone()) + }; + drop(hasImpl); + assert_eq!(state.get(), 4); +} diff --git a/src/test/run-pass/issues/issue-16530.rs b/src/test/run-pass/issues/issue-16530.rs new file mode 100644 index 00000000000..f32057e5e44 --- /dev/null +++ b/src/test/run-pass/issues/issue-16530.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +use std::hash::{SipHasher, Hasher, Hash}; + +#[derive(Hash)] +struct Empty; + +pub fn main() { + let mut s1 = SipHasher::new_with_keys(0, 0); + Empty.hash(&mut s1); + let mut s2 = SipHasher::new_with_keys(0, 0); + Empty.hash(&mut s2); + assert_eq!(s1.finish(), s2.finish()); +} diff --git a/src/test/run-pass/issues/issue-16560.rs b/src/test/run-pass/issues/issue-16560.rs new file mode 100644 index 00000000000..50009f4f6ea --- /dev/null +++ b/src/test/run-pass/issues/issue-16560.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::mem; + +fn main() { + let y = 0u8; + let closure = move |x: u8| y + x; + + // Check that both closures are capturing by value + assert_eq!(1, mem::size_of_val(&closure)); + + thread::spawn(move|| { + let ok = closure; + }).join().ok().unwrap(); +} diff --git a/src/test/run-pass/issues/issue-16596.rs b/src/test/run-pass/issues/issue-16596.rs new file mode 100644 index 00000000000..cdbc3daf4ab --- /dev/null +++ b/src/test/run-pass/issues/issue-16596.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait MatrixRow { fn dummy(&self) { }} + +struct Mat; + +impl<'a> MatrixRow for &'a Mat {} + +struct Rows { + mat: M, +} + +impl<'a> Iterator for Rows<&'a Mat> { + type Item = (); + + fn next(&mut self) -> Option<()> { + unimplemented!() + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-16597-empty.rs b/src/test/run-pass/issues/issue-16597-empty.rs new file mode 100644 index 00000000000..c68e2634831 --- /dev/null +++ b/src/test/run-pass/issues/issue-16597-empty.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--test + +// This verifies that the test generation doesn't crash when we have +// no tests - for more information, see PR #16892. diff --git a/src/test/run-pass/issues/issue-16597.rs b/src/test/run-pass/issues/issue-16597.rs new file mode 100644 index 00000000000..6b437eb65aa --- /dev/null +++ b/src/test/run-pass/issues/issue-16597.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--test + +mod tests { + use super::*; + + #[test] + pub fn test(){} +} diff --git a/src/test/run-pass/issues/issue-1660.rs b/src/test/run-pass/issues/issue-1660.rs new file mode 100644 index 00000000000..61b380bf695 --- /dev/null +++ b/src/test/run-pass/issues/issue-1660.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 + +pub fn main() { + static _x: isize = 1<<2; +} diff --git a/src/test/run-pass/issues/issue-16602-1.rs b/src/test/run-pass/issues/issue-16602-1.rs new file mode 100644 index 00000000000..e351832a8c2 --- /dev/null +++ b/src/test/run-pass/issues/issue-16602-1.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let mut t = [1; 2]; + t = [t[1] * 2, t[0] * 2]; + assert_eq!(&t[..], &[2, 2]); +} diff --git a/src/test/run-pass/issues/issue-16602-2.rs b/src/test/run-pass/issues/issue-16602-2.rs new file mode 100644 index 00000000000..197059202e0 --- /dev/null +++ b/src/test/run-pass/issues/issue-16602-2.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct A { + pub x: u32, + pub y: u32, +} + +fn main() { + let mut a = A { x: 1, y: 1 }; + a = A { x: a.y * 2, y: a.x * 2 }; + assert_eq!(a.x, 2); + assert_eq!(a.y, 2); +} diff --git a/src/test/run-pass/issues/issue-16602-3.rs b/src/test/run-pass/issues/issue-16602-3.rs new file mode 100644 index 00000000000..5346851f0f2 --- /dev/null +++ b/src/test/run-pass/issues/issue-16602-3.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +enum Foo { + Bar(u32, u32), + Baz(&'static u32, &'static u32) +} + +static NUM: u32 = 100; + +fn main () { + let mut b = Foo::Baz(&NUM, &NUM); + b = Foo::Bar(f(&b), g(&b)); +} + +static FNUM: u32 = 1; + +fn f (b: &Foo) -> u32 { + FNUM +} + +static GNUM: u32 = 2; + +fn g (b: &Foo) -> u32 { + GNUM +} diff --git a/src/test/run-pass/issues/issue-16643.rs b/src/test/run-pass/issues/issue-16643.rs new file mode 100644 index 00000000000..7bfb5444d05 --- /dev/null +++ b/src/test/run-pass/issues/issue-16643.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-16643.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_16643 as i; + +pub fn main() { + i::TreeBuilder { h: 3 }.process_token(); +} diff --git a/src/test/run-pass/issues/issue-16648.rs b/src/test/run-pass/issues/issue-16648.rs new file mode 100644 index 00000000000..cd0fca9ad62 --- /dev/null +++ b/src/test/run-pass/issues/issue-16648.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let x: (isize, &[isize]) = (2, &[1, 2]); + assert_eq!(match x { + (0, &[_, _]) => 0, + (1, _) => 1, + (2, &[_, _]) => 2, + (2, _) => 3, + _ => 4 + }, 2); +} diff --git a/src/test/run-pass/issues/issue-16668.rs b/src/test/run-pass/issues/issue-16668.rs new file mode 100644 index 00000000000..08f696cfcf4 --- /dev/null +++ b/src/test/run-pass/issues/issue-16668.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Parser<'a, I, O> { + parse: Box Result + 'a> +} + +impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { + fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { + Parser { + parse: Box::new(move |x: I| { + match (self.parse)(x) { + Ok(r) => (rhs.parse)(r), + Err(e) => Err(e) + } + }) + } + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-16671.rs b/src/test/run-pass/issues/issue-16671.rs new file mode 100644 index 00000000000..5ff2bc97ae2 --- /dev/null +++ b/src/test/run-pass/issues/issue-16671.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +//compile-flags: -Z borrowck=compare -Z emit-end-regions + +#![deny(warnings)] + +fn foo(_f: F) { } + +fn main() { + let mut var = Vec::new(); + foo(move|| { + var.push(1); + }); +} diff --git a/src/test/run-pass/issues/issue-16739.rs b/src/test/run-pass/issues/issue-16739.rs new file mode 100644 index 00000000000..8404e387659 --- /dev/null +++ b/src/test/run-pass/issues/issue-16739.rs @@ -0,0 +1,60 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] +#![feature(unboxed_closures, fn_traits)] + +// Test that unboxing shim for calling rust-call ABI methods through a +// trait box works and does not cause an ICE. + +struct Foo { foo: u32 } + +impl FnMut<()> for Foo { + extern "rust-call" fn call_mut(&mut self, _: ()) -> u32 { self.foo } +} + +impl FnOnce<()> for Foo { + type Output = u32; + extern "rust-call" fn call_once(mut self, _: ()) -> u32 { self.call_mut(()) } +} + +///////////////////////////////////////////////////////////////////////// + +impl FnMut<(u32,)> for Foo { + extern "rust-call" fn call_mut(&mut self, (x,): (u32,)) -> u32 { self.foo + x } +} + +impl FnOnce<(u32,)> for Foo { + type Output = u32; + extern "rust-call" fn call_once(mut self, args: (u32,)) -> u32 { self.call_mut(args) } +} + +///////////////////////////////////////////////////////////////////////// + +impl FnMut<(u32,u32)> for Foo { + extern "rust-call" fn call_mut(&mut self, (x, y): (u32, u32)) -> u32 { self.foo + x + y } +} + +impl FnOnce<(u32,u32)> for Foo { + type Output = u32; + extern "rust-call" fn call_once(mut self, args: (u32,u32)) -> u32 { self.call_mut(args) } +} + +fn main() { + let mut f = box Foo { foo: 42 } as Box u32>; + assert_eq!(f.call_mut(()), 42); + + let mut f = box Foo { foo: 40 } as Box u32>; + assert_eq!(f.call_mut((2,)), 42); + + let mut f = box Foo { foo: 40 } as Box u32>; + assert_eq!(f.call_mut((1, 1)), 42); +} diff --git a/src/test/run-pass/issues/issue-16745.rs b/src/test/run-pass/issues/issue-16745.rs new file mode 100644 index 00000000000..4603c0c2c56 --- /dev/null +++ b/src/test/run-pass/issues/issue-16745.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + const X: u8 = 0; + let out: u8 = match 0u8 { + X => 99, + b'\t' => 1, + 1u8 => 2, + _ => 3, + }; + assert_eq!(out, 99); +} diff --git a/src/test/run-pass/issues/issue-16774.rs b/src/test/run-pass/issues/issue-16774.rs new file mode 100644 index 00000000000..dbaa6c30f45 --- /dev/null +++ b/src/test/run-pass/issues/issue-16774.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] +#![feature(box_patterns)] + +use std::ops::{Deref, DerefMut}; + +struct X(Box); + +static mut DESTRUCTOR_RAN: bool = false; + +impl Drop for X { + fn drop(&mut self) { + unsafe { + assert!(!DESTRUCTOR_RAN); + DESTRUCTOR_RAN = true; + } + } +} + +impl Deref for X { + type Target = isize; + + fn deref(&self) -> &isize { + let &X(box ref x) = self; + x + } +} + +impl DerefMut for X { + fn deref_mut(&mut self) -> &mut isize { + let &mut X(box ref mut x) = self; + x + } +} + +fn main() { + { + let mut test = X(box 5); + { + let mut change = || { *test = 10 }; + change(); + } + assert_eq!(*test, 10); + } + assert!(unsafe { DESTRUCTOR_RAN }); +} diff --git a/src/test/run-pass/issues/issue-16783.rs b/src/test/run-pass/issues/issue-16783.rs new file mode 100644 index 00000000000..bafeb9716c5 --- /dev/null +++ b/src/test/run-pass/issues/issue-16783.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let x = [1, 2, 3]; + let y = x; +} diff --git a/src/test/run-pass/issues/issue-16819.rs b/src/test/run-pass/issues/issue-16819.rs new file mode 100644 index 00000000000..498abc1c733 --- /dev/null +++ b/src/test/run-pass/issues/issue-16819.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// `#[cfg]` on struct field permits empty unusable struct + +struct S { + #[cfg(untrue)] + a: int, +} + +fn main() { + let s = S {}; +} diff --git a/src/test/run-pass/issues/issue-16922.rs b/src/test/run-pass/issues/issue-16922.rs new file mode 100644 index 00000000000..8eb066e6f00 --- /dev/null +++ b/src/test/run-pass/issues/issue-16922.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::any::Any; + +fn foo(_: &u8) { +} + +fn main() { + let _ = &foo as &Any; +} diff --git a/src/test/run-pass/issues/issue-1696.rs b/src/test/run-pass/issues/issue-1696.rs new file mode 100644 index 00000000000..d205bed7226 --- /dev/null +++ b/src/test/run-pass/issues/issue-1696.rs @@ -0,0 +1,18 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::HashMap; + +pub fn main() { + let mut m = HashMap::new(); + m.insert(b"foo".to_vec(), b"bar".to_vec()); + println!("{:?}", m); +} diff --git a/src/test/run-pass/issues/issue-1701.rs b/src/test/run-pass/issues/issue-1701.rs new file mode 100644 index 00000000000..433fd4c1af3 --- /dev/null +++ b/src/test/run-pass/issues/issue-1701.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +enum pattern { tabby, tortoiseshell, calico } +enum breed { beagle, rottweiler, pug } +type name = String; +enum ear_kind { lop, upright } +enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } + +fn noise(a: animal) -> Option { + match a { + animal::cat(..) => { Some("meow".to_string()) } + animal::dog(..) => { Some("woof".to_string()) } + animal::rabbit(..) => { None } + animal::tiger => { Some("roar".to_string()) } + } +} + +pub fn main() { + assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_string())); + assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_string())); + assert_eq!(noise(animal::rabbit("Hilbert".to_string(), ear_kind::upright)), None); + assert_eq!(noise(animal::tiger), Some("roar".to_string())); +} diff --git a/src/test/run-pass/issues/issue-17068.rs b/src/test/run-pass/issues/issue-17068.rs new file mode 100644 index 00000000000..ece2284d3c5 --- /dev/null +++ b/src/test/run-pass/issues/issue-17068.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that regionck creates the right region links in the pattern +// binding of a for loop + +fn foo<'a>(v: &'a [usize]) -> &'a usize { + for &ref x in v { return x; } + unreachable!() +} + +fn main() { + assert_eq!(foo(&[0]), &0); +} diff --git a/src/test/run-pass/issues/issue-17074.rs b/src/test/run-pass/issues/issue-17074.rs new file mode 100644 index 00000000000..063cf7b0a03 --- /dev/null +++ b/src/test/run-pass/issues/issue-17074.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +static X2: u64 = !0 as u16 as u64; +static Y2: u64 = !0 as u32 as u64; +const X: u64 = !0 as u16 as u64; +const Y: u64 = !0 as u32 as u64; + +fn main() { + assert_eq!(match 1 { + X => unreachable!(), + Y => unreachable!(), + _ => 1 + }, 1); +} diff --git a/src/test/run-pass/issues/issue-17121.rs b/src/test/run-pass/issues/issue-17121.rs new file mode 100644 index 00000000000..8da01966959 --- /dev/null +++ b/src/test/run-pass/issues/issue-17121.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +// ignore-cloudabi no std::fs + +use std::fs::File; +use std::io::{self, BufReader, Read}; + +struct Lexer +{ + reader: BufReader, +} + +impl Lexer +{ + pub fn new_from_reader(r: R) -> Lexer + { + Lexer{reader: BufReader::new(r)} + } + + pub fn new_from_file(p: &str) -> io::Result> + { + Ok(Lexer::new_from_reader(File::open(p)?)) + } + + pub fn new_from_str<'a>(s: &'a str) -> Lexer<&'a [u8]> + { + Lexer::new_from_reader(s.as_bytes()) + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-17170.rs b/src/test/run-pass/issues/issue-17170.rs new file mode 100644 index 00000000000..f876f1e1463 --- /dev/null +++ b/src/test/run-pass/issues/issue-17170.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(repr_simd)] + +#[repr(simd)] +struct T(f64, f64, f64); + +static X: T = T(0.0, 0.0, 0.0); + +fn main() { + let _ = X; +} diff --git a/src/test/run-pass/issues/issue-17216.rs b/src/test/run-pass/issues/issue-17216.rs new file mode 100644 index 00000000000..dc2848cc190 --- /dev/null +++ b/src/test/run-pass/issues/issue-17216.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Leak<'a> { + dropped: &'a mut bool +} + +impl<'a> Drop for Leak<'a> { + fn drop(&mut self) { + *self.dropped = true; + } +} + +fn main() { + let mut dropped = false; + { + let leak = Leak { dropped: &mut dropped }; + for ((), leaked) in Some(((), leak)).into_iter() {} + } + + assert!(dropped); +} diff --git a/src/test/run-pass/issues/issue-17233.rs b/src/test/run-pass/issues/issue-17233.rs new file mode 100644 index 00000000000..15571d563b2 --- /dev/null +++ b/src/test/run-pass/issues/issue-17233.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const X1: &'static [u8] = &[b'1']; +const X2: &'static [u8] = b"1"; +const X3: &'static [u8; 1] = &[b'1']; +const X4: &'static [u8; 1] = b"1"; + +static Y1: u8 = X1[0]; +static Y2: u8 = X2[0]; +static Y3: u8 = X3[0]; +static Y4: u8 = X4[0]; + +fn main() { + assert_eq!(Y1, Y2); + assert_eq!(Y1, Y3); + assert_eq!(Y1, Y4); +} diff --git a/src/test/run-pass/issues/issue-17302.rs b/src/test/run-pass/issues/issue-17302.rs new file mode 100644 index 00000000000..708257de0b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-17302.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +static mut DROPPED: [bool; 2] = [false, false]; + +struct A(usize); +struct Foo { _a: A, _b: isize } + +impl Drop for A { + fn drop(&mut self) { + let A(i) = *self; + unsafe { DROPPED[i] = true; } + } +} + +fn main() { + { + Foo { + _a: A(0), + ..Foo { _a: A(1), _b: 2 } + }; + } + unsafe { + assert!(DROPPED[0]); + assert!(DROPPED[1]); + } +} diff --git a/src/test/run-pass/issues/issue-17322.rs b/src/test/run-pass/issues/issue-17322.rs new file mode 100644 index 00000000000..dc17f02ab62 --- /dev/null +++ b/src/test/run-pass/issues/issue-17322.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +use std::io::{self, Write}; + +fn f(wr: &mut Write) { + wr.write_all(b"hello").ok().expect("failed"); +} + +fn main() { + let mut wr = box io::stdout() as Box; + f(&mut wr); +} diff --git a/src/test/run-pass/issues/issue-17336.rs b/src/test/run-pass/issues/issue-17336.rs new file mode 100644 index 00000000000..aea2b67a92f --- /dev/null +++ b/src/test/run-pass/issues/issue-17336.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[allow(dead_code)] +fn check(a: &str) { + let x = a as *const str; + x == x; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-17351.rs b/src/test/run-pass/issues/issue-17351.rs new file mode 100644 index 00000000000..69c015ae3e8 --- /dev/null +++ b/src/test/run-pass/issues/issue-17351.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Str { fn foo(&self) {} } +impl Str for str {} +impl<'a, S: ?Sized> Str for &'a S where S: Str {} + +fn main() { + let _: &Str = &"x"; +} diff --git a/src/test/run-pass/issues/issue-17361.rs b/src/test/run-pass/issues/issue-17361.rs new file mode 100644 index 00000000000..9e478a39b82 --- /dev/null +++ b/src/test/run-pass/issues/issue-17361.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that astconv doesn't forget about mutability of &mut str + +// pretty-expanded FIXME #23616 + +fn main() { + fn foo(_: &mut T) {} + let _f: fn(&mut str) = foo; +} diff --git a/src/test/run-pass/issues/issue-17450.rs b/src/test/run-pass/issues/issue-17450.rs new file mode 100644 index 00000000000..67a44951ae0 --- /dev/null +++ b/src/test/run-pass/issues/issue-17450.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code, warnings)] + +static mut x: isize = 3; +static mut y: isize = unsafe { x }; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-17503.rs b/src/test/run-pass/issues/issue-17503.rs new file mode 100644 index 00000000000..909098e3982 --- /dev/null +++ b/src/test/run-pass/issues/issue-17503.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let s: &[isize] = &[0, 1, 2, 3, 4]; + let ss: &&[isize] = &s; + let sss: &&&[isize] = &ss; + + println!("{:?}", &s[..3]); + println!("{:?}", &ss[3..]); + println!("{:?}", &sss[2..4]); +} diff --git a/src/test/run-pass/issues/issue-17662.rs b/src/test/run-pass/issues/issue-17662.rs new file mode 100644 index 00000000000..10ee3ce1741 --- /dev/null +++ b/src/test/run-pass/issues/issue-17662.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-17662.rs + + +extern crate issue_17662 as i; + +use std::marker; + +struct Bar<'a> { m: marker::PhantomData<&'a ()> } + +impl<'a> i::Foo<'a, usize> for Bar<'a> { + fn foo(&self) -> usize { 5 } +} + +pub fn main() { + assert_eq!(i::foo(&Bar { m: marker::PhantomData }), 5); +} diff --git a/src/test/run-pass/issues/issue-17718-borrow-interior.rs b/src/test/run-pass/issues/issue-17718-borrow-interior.rs new file mode 100644 index 00000000000..505aefdd1c7 --- /dev/null +++ b/src/test/run-pass/issues/issue-17718-borrow-interior.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S { a: usize } + +static A: S = S { a: 3 }; +static B: &'static usize = &A.a; +static C: &'static usize = &(A.a); + +static D: [usize; 1] = [1]; +static E: usize = D[0]; +static F: &'static usize = &D[0]; + +fn main() { + assert_eq!(*B, A.a); + assert_eq!(*B, A.a); + + assert_eq!(E, D[0]); + assert_eq!(*F, D[0]); +} diff --git a/src/test/run-pass/issues/issue-17718-const-destructors.rs b/src/test/run-pass/issues/issue-17718-const-destructors.rs new file mode 100644 index 00000000000..6f8fbbd9f78 --- /dev/null +++ b/src/test/run-pass/issues/issue-17718-const-destructors.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct A; +impl Drop for A { + fn drop(&mut self) {} +} + +const FOO: A = A; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-17718-parse-const.rs b/src/test/run-pass/issues/issue-17718-parse-const.rs new file mode 100644 index 00000000000..e9925252540 --- /dev/null +++ b/src/test/run-pass/issues/issue-17718-parse-const.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const FOO: usize = 3; + +fn main() { + assert_eq!(FOO, 3); +} diff --git a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs new file mode 100644 index 00000000000..2ac6a901358 --- /dev/null +++ b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs @@ -0,0 +1,59 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::marker; +use std::cell::UnsafeCell; + +struct MyUnsafePack(UnsafeCell); + +unsafe impl Sync for MyUnsafePack {} + +struct MyUnsafe { + value: MyUnsafePack +} + +impl MyUnsafe { + fn forbidden(&self) {} +} + +unsafe impl Sync for MyUnsafe {} + +enum UnsafeEnum { + VariantSafe, + VariantUnsafe(UnsafeCell) +} + +unsafe impl Sync for UnsafeEnum {} + +static STATIC1: UnsafeEnum = UnsafeEnum::VariantSafe; + +static STATIC2: MyUnsafePack = MyUnsafePack(UnsafeCell::new(1)); +const CONST: MyUnsafePack = MyUnsafePack(UnsafeCell::new(1)); +static STATIC3: MyUnsafe = MyUnsafe{value: CONST}; + +static STATIC4: &'static MyUnsafePack = &STATIC2; + +struct Wrap { + value: T +} + +unsafe impl Sync for Wrap {} + +static UNSAFE: MyUnsafePack = MyUnsafePack(UnsafeCell::new(2)); +static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack> = Wrap { value: &UNSAFE }; + +fn main() { + let a = &STATIC1; + + STATIC3.forbidden() +} diff --git a/src/test/run-pass/issues/issue-17718.rs b/src/test/run-pass/issues/issue-17718.rs new file mode 100644 index 00000000000..c332d0b586d --- /dev/null +++ b/src/test/run-pass/issues/issue-17718.rs @@ -0,0 +1,84 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-17718-aux.rs + +extern crate issue_17718_aux as other; + +use std::sync::atomic::{AtomicUsize, Ordering}; + +const C1: usize = 1; +const C2: AtomicUsize = AtomicUsize::new(0); +const C3: fn() = foo; +const C4: usize = C1 * C1 + C1 / C1; +const C5: &'static usize = &C4; +const C6: usize = { + const C: usize = 3; + C +}; + +static S1: usize = 3; +static S2: AtomicUsize = AtomicUsize::new(0); + +mod test { + static A: usize = 4; + static B: &'static usize = &A; + static C: &'static usize = &(A); +} + +fn foo() {} + +fn main() { + assert_eq!(C1, 1); + assert_eq!(C3(), ()); + assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0); + assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0); + assert_eq!(C4, 2); + assert_eq!(*C5, 2); + assert_eq!(C6, 3); + assert_eq!(S1, 3); + assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 0); + assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 1); + + match 1 { + C1 => {} + _ => unreachable!(), + } + + let _a = C1; + let _a = C2; + let _a = C3; + let _a = C4; + let _a = C5; + let _a = C6; + let _a = S1; + + assert_eq!(other::C1, 1); + assert_eq!(other::C3(), ()); + assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0); + assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0); + assert_eq!(other::C4, 2); + assert_eq!(*other::C5, 2); + assert_eq!(other::S1, 3); + assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 0); + assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 1); + + let _a = other::C1; + let _a = other::C2; + let _a = other::C3; + let _a = other::C4; + let _a = other::C5; + + match 1 { + other::C1 => {} + _ => unreachable!(), + } +} diff --git a/src/test/run-pass/issues/issue-17732.rs b/src/test/run-pass/issues/issue-17732.rs new file mode 100644 index 00000000000..e69d8fabe86 --- /dev/null +++ b/src/test/run-pass/issues/issue-17732.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Person { + type string; + fn dummy(&self) { } +} + +struct Someone(std::marker::PhantomData

); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-17734.rs b/src/test/run-pass/issues/issue-17734.rs new file mode 100644 index 00000000000..e52337667c8 --- /dev/null +++ b/src/test/run-pass/issues/issue-17734.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that generating drop glue for Box doesn't ICE + + +fn f(s: Box) -> Box { + s +} + +fn main() { + // There is currently no safe way to construct a `Box`, so improvise + let box_arr: Box<[u8]> = Box::new(['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8]); + let box_str: Box = unsafe { std::mem::transmute(box_arr) }; + assert_eq!(&*box_str, "hello"); + f(box_str); +} diff --git a/src/test/run-pass/issues/issue-17746.rs b/src/test/run-pass/issues/issue-17746.rs new file mode 100644 index 00000000000..7e88068419e --- /dev/null +++ b/src/test/run-pass/issues/issue-17746.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #17746 + +fn main() {} + +struct A; + +impl A { + fn b(&mut self) { + self.a() + } +} + +trait Foo { + fn dummy(&self) {} +} +trait Bar { + fn a(&self); +} + +impl Foo for A {} +impl Bar for T where T: Foo { + fn a(&self) {} +} diff --git a/src/test/run-pass/issues/issue-17756.rs b/src/test/run-pass/issues/issue-17756.rs new file mode 100644 index 00000000000..8c3f6b93588 --- /dev/null +++ b/src/test/run-pass/issues/issue-17756.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +const count : usize = 2 as usize; +fn main() { + let larger : [usize; count*2]; +} diff --git a/src/test/run-pass/issues/issue-17771.rs b/src/test/run-pass/issues/issue-17771.rs new file mode 100644 index 00000000000..ccea8846b08 --- /dev/null +++ b/src/test/run-pass/issues/issue-17771.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Aaa { fn dummy(&self) { } } + +impl<'a> Aaa for &'a mut (Aaa + 'a) {} + +struct Bar<'a> { + writer: &'a mut (Aaa + 'a), +} + +fn baz(_: &mut Aaa) { +} + +fn foo<'a>(mut bar: Bar<'a>) { + baz(&mut bar.writer); +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-17816.rs b/src/test/run-pass/issues/issue-17816.rs new file mode 100644 index 00000000000..0f96035b274 --- /dev/null +++ b/src/test/run-pass/issues/issue-17816.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::marker::PhantomData; + +fn main() { + struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F, marker: PhantomData<&'a ()> } + let f = |x: Vec<&str>| -> &str { "foobar" }; + let sym = Symbol { function: f, marker: PhantomData }; + (sym.function)(vec![]); +} diff --git a/src/test/run-pass/issues/issue-17877.rs b/src/test/run-pass/issues/issue-17877.rs new file mode 100644 index 00000000000..4dee51c4289 --- /dev/null +++ b/src/test/run-pass/issues/issue-17877.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn main() { + assert_eq!(match [0u8; 1024] { + _ => 42_usize, + }, 42_usize); + + assert_eq!(match [0u8; 1024] { + [1, _..] => 0_usize, + [0, _..] => 1_usize, + _ => 2_usize + }, 1_usize); +} diff --git a/src/test/run-pass/issues/issue-17897.rs b/src/test/run-pass/issues/issue-17897.rs new file mode 100644 index 00000000000..e543606c9c9 --- /dev/null +++ b/src/test/run-pass/issues/issue-17897.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn action(mut cb: Box usize>) -> usize { + cb(1) +} + +pub fn main() { + println!("num: {}", action(Box::new(move |u| u))); +} diff --git a/src/test/run-pass/issues/issue-17904.rs b/src/test/run-pass/issues/issue-17904.rs new file mode 100644 index 00000000000..2a86611a196 --- /dev/null +++ b/src/test/run-pass/issues/issue-17904.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can parse where clauses on various forms of tuple +// structs. + +// pretty-expanded FIXME #23616 + +struct Bar(T) where T: Copy; +struct Bleh(T, U) where T: Copy, U: Sized; +struct Baz where T: Copy { + field: T +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-18060.rs b/src/test/run-pass/issues/issue-18060.rs new file mode 100644 index 00000000000..2714de4b59f --- /dev/null +++ b/src/test/run-pass/issues/issue-18060.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #18060: match arms were matching in the wrong order. + +fn main() { + assert_eq!(2, match (1, 3) { (0, 2..=5) => 1, (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); + assert_eq!(2, match (1, 3) { (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); + assert_eq!(2, match (1, 7) { (0, 2..=5) => 1, (1, 7) => 2, (_, 2..=5) => 3, (_, _) => 4 }); +} diff --git a/src/test/run-pass/issues/issue-18075.rs b/src/test/run-pass/issues/issue-18075.rs new file mode 100644 index 00000000000..edf923fbaf2 --- /dev/null +++ b/src/test/run-pass/issues/issue-18075.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// exec-env:RUST_LOG=rustc::middle=debug + +fn main() { + let b = 1isize; + println!("{}", b); +} diff --git a/src/test/run-pass/issues/issue-18083.rs b/src/test/run-pass/issues/issue-18083.rs new file mode 100644 index 00000000000..152cba82222 --- /dev/null +++ b/src/test/run-pass/issues/issue-18083.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// These crossed imports should resolve fine, and not block on +// each other and be reported as unresolved. + +mod a { + use b::{B}; + pub use self::inner::A; + + mod inner { + pub struct A; + } +} + +mod b { + use a::{A}; + pub use self::inner::B; + + mod inner { + pub struct B; + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-18088.rs b/src/test/run-pass/issues/issue-18088.rs new file mode 100644 index 00000000000..cff5ba70128 --- /dev/null +++ b/src/test/run-pass/issues/issue-18088.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub trait Indexable: std::ops::Index { + fn index2(&self, i: usize) -> &T { + &self[i] + } +} +fn main() {} diff --git a/src/test/run-pass/issues/issue-18110.rs b/src/test/run-pass/issues/issue-18110.rs new file mode 100644 index 00000000000..d6733050216 --- /dev/null +++ b/src/test/run-pass/issues/issue-18110.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + ({return},); +} diff --git a/src/test/run-pass/issues/issue-18173.rs b/src/test/run-pass/issues/issue-18173.rs new file mode 100644 index 00000000000..eb29de18ac9 --- /dev/null +++ b/src/test/run-pass/issues/issue-18173.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + type T; +} + +// should be able to use a trait with an associated type without specifying it as an argument +trait Bar { + fn bar(foo: &F); +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-18188.rs b/src/test/run-pass/issues/issue-18188.rs new file mode 100644 index 00000000000..60d8edc9d59 --- /dev/null +++ b/src/test/run-pass/issues/issue-18188.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait Promisable: Send + Sync {} +impl Promisable for T {} + +pub fn propagate<'a, T, E, F, G>(mut action: F) + -> Box) -> Result + 'a> + where + T: Promisable + Clone + 'a, + E: Promisable + Clone + 'a, + F: FnMut(&T) -> Result + Send + 'a, + G: FnMut(Result) -> Result + 'a { + Box::new(move |result: Result| { + match result { + Ok(ref t) => action(t), + Err(ref e) => Err(e.clone()), + } + }) +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-1821.rs b/src/test/run-pass/issues/issue-1821.rs new file mode 100644 index 00000000000..27c225a1916 --- /dev/null +++ b/src/test/run-pass/issues/issue-1821.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Issue #1821 - Don't recurse trying to typecheck this + + +// pretty-expanded FIXME #23616 + +enum t { + foo(Vec) +} +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-18232.rs b/src/test/run-pass/issues/issue-18232.rs new file mode 100644 index 00000000000..61b7306e9df --- /dev/null +++ b/src/test/run-pass/issues/issue-18232.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Cursor<'a>(::std::marker::PhantomData<&'a ()>); + +trait CursorNavigator { + fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; +} + +struct SimpleNavigator; + +impl CursorNavigator for SimpleNavigator { + fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool { + false + } +} + +fn main() { + let mut c = Cursor(::std::marker::PhantomData); + let n = SimpleNavigator; + n.init_cursor(&mut c); +} diff --git a/src/test/run-pass/issues/issue-18352.rs b/src/test/run-pass/issues/issue-18352.rs new file mode 100644 index 00000000000..802e918e954 --- /dev/null +++ b/src/test/run-pass/issues/issue-18352.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +const X: &'static str = "12345"; + +fn test(s: String) -> bool { + match &*s { + X => true, + _ => false + } +} + +fn main() { + assert!(test("12345".to_string())); +} diff --git a/src/test/run-pass/issues/issue-18353.rs b/src/test/run-pass/issues/issue-18353.rs new file mode 100644 index 00000000000..279ee89a492 --- /dev/null +++ b/src/test/run-pass/issues/issue-18353.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that wrapping an unsized struct in an enum which gets optimised does +// not ICE. + +// pretty-expanded FIXME #23616 + +struct Str { + f: [u8] +} + +fn main() { + let str: Option<&Str> = None; + str.is_some(); +} diff --git a/src/test/run-pass/issues/issue-18412.rs b/src/test/run-pass/issues/issue-18412.rs new file mode 100644 index 00000000000..3d1a66877ed --- /dev/null +++ b/src/test/run-pass/issues/issue-18412.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that non-static methods can be assigned to local variables as +// function pointers. + + +trait Foo { + fn foo(&self) -> usize; +} + +struct A(usize); + +impl A { + fn bar(&self) -> usize { self.0 } +} + +impl Foo for A { + fn foo(&self) -> usize { self.bar() } +} + +fn main() { + let f = A::bar; + let g = Foo::foo; + let a = A(42); + + assert_eq!(f(&a), g(&a)); +} diff --git a/src/test/run-pass/issues/issue-18425.rs b/src/test/run-pass/issues/issue-18425.rs new file mode 100644 index 00000000000..615dc8b4f3c --- /dev/null +++ b/src/test/run-pass/issues/issue-18425.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that codegen doesn't ICE when codegenning an array repeat +// expression with a count of 1 and a non-Copy element type. + +// pretty-expanded FIXME #23616 + +fn main() { + let _ = [Box::new(1_usize); 1]; +} diff --git a/src/test/run-pass/issues/issue-18446.rs b/src/test/run-pass/issues/issue-18446.rs new file mode 100644 index 00000000000..0758ceb0954 --- /dev/null +++ b/src/test/run-pass/issues/issue-18446.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that methods in trait impls should override default methods. + +trait T { + fn foo(&self) -> i32 { 0 } +} + +impl<'a> T + 'a { + fn foo(&self) -> i32 { 1 } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-18464.rs b/src/test/run-pass/issues/issue-18464.rs new file mode 100644 index 00000000000..64536e993c5 --- /dev/null +++ b/src/test/run-pass/issues/issue-18464.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(dead_code)] + +const LOW_RANGE: char = '0'; +const HIGH_RANGE: char = '9'; + +fn main() { + match '5' { + LOW_RANGE..=HIGH_RANGE => (), + _ => () + }; +} diff --git a/src/test/run-pass/issues/issue-18501.rs b/src/test/run-pass/issues/issue-18501.rs new file mode 100644 index 00000000000..2a82b1ab81d --- /dev/null +++ b/src/test/run-pass/issues/issue-18501.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we don't ICE when inlining a function from another +// crate that uses a trait method as a value due to incorrectly +// translating the def ID of the trait during AST decoding. + +// aux-build:issue-18501.rs +// pretty-expanded FIXME #23616 + +extern crate issue_18501 as issue; + +fn main() { + issue::pass_method(); +} diff --git a/src/test/run-pass/issues/issue-18514.rs b/src/test/run-pass/issues/issue-18514.rs new file mode 100644 index 00000000000..6a59b74bd06 --- /dev/null +++ b/src/test/run-pass/issues/issue-18514.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we don't ICE when codegenning a generic impl method from +// an extern crate that contains a match expression on a local +// variable place where one of the match case bodies contains an +// expression that autoderefs through an overloaded generic deref +// impl. + +// aux-build:issue-18514.rs + +extern crate issue_18514 as ice; +use ice::{Tr, St}; + +fn main() { + let st: St<()> = St(vec![]); + st.tr(); +} diff --git a/src/test/run-pass/issues/issue-18539.rs b/src/test/run-pass/issues/issue-18539.rs new file mode 100644 index 00000000000..a3211845d58 --- /dev/null +++ b/src/test/run-pass/issues/issue-18539.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that coercing bare fn's that return a zero sized type to +// a closure doesn't cause an LLVM ERROR + +// pretty-expanded FIXME #23616 + +struct Foo; + +fn uint_to_foo(_: usize) -> Foo { + Foo +} + +#[allow(unused_must_use)] +fn main() { + (0..10).map(uint_to_foo); +} diff --git a/src/test/run-pass/issues/issue-18652.rs b/src/test/run-pass/issues/issue-18652.rs new file mode 100644 index 00000000000..2c027dada87 --- /dev/null +++ b/src/test/run-pass/issues/issue-18652.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests multiple free variables being passed by value into an unboxed +// once closure as an optimization by codegen. This used to hit an +// incorrect assert. + +fn main() { + let x = 2u8; + let y = 3u8; + assert_eq!((move || x + y)(), 5); +} diff --git a/src/test/run-pass/issues/issue-18655.rs b/src/test/run-pass/issues/issue-18655.rs new file mode 100644 index 00000000000..94638539f6e --- /dev/null +++ b/src/test/run-pass/issues/issue-18655.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Factory { + type Product; + fn create(&self) -> ::Product; +} + +impl Factory for f64 { + type Product = f64; + fn create(&self) -> f64 { *self * *self } +} + +impl Factory for (A, B) { + type Product = (::Product, ::Product); + fn create(&self) -> (::Product, ::Product) { + let (ref a, ref b) = *self; + (a.create(), b.create()) + } +} + +fn main() { + assert_eq!((16., 25.), (4., 5.).create()); +} diff --git a/src/test/run-pass/issues/issue-1866.rs b/src/test/run-pass/issues/issue-1866.rs new file mode 100644 index 00000000000..cf4a0ddea98 --- /dev/null +++ b/src/test/run-pass/issues/issue-1866.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +mod a { + pub type rust_task = usize; + pub mod rustrt { + use super::rust_task; + extern { + pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; + } + } +} + +mod b { + pub type rust_task = bool; + pub mod rustrt { + use super::rust_task; + extern { + pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; + } + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-18661.rs b/src/test/run-pass/issues/issue-18661.rs new file mode 100644 index 00000000000..0b20cd45cf2 --- /dev/null +++ b/src/test/run-pass/issues/issue-18661.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that param substitutions from the correct environment are +// used when codegenning unboxed closure calls. + +// pretty-expanded FIXME #23616 + +pub fn inside(c: F) { + c(); +} + +// Use different number of type parameters and closure type to trigger +// an obvious ICE when param environments are mixed up +pub fn outside() { + inside(|| {}); +} + +fn main() { + outside::<(),()>(); +} diff --git a/src/test/run-pass/issues/issue-18685.rs b/src/test/run-pass/issues/issue-18685.rs new file mode 100644 index 00000000000..98f59ed2ccd --- /dev/null +++ b/src/test/run-pass/issues/issue-18685.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the self param space is not used in a conflicting +// manner by unboxed closures within a default method on a trait + +// pretty-expanded FIXME #23616 + +trait Tr { + fn foo(&self); + + fn bar(&self) { + (|| { self.foo() })() + } +} + +impl Tr for () { + fn foo(&self) {} +} + +fn main() { + ().bar(); +} diff --git a/src/test/run-pass/issues/issue-18711.rs b/src/test/run-pass/issues/issue-18711.rs new file mode 100644 index 00000000000..3c3b914e67a --- /dev/null +++ b/src/test/run-pass/issues/issue-18711.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we don't panic on a RefCell borrow conflict in certain +// code paths involving unboxed closures. + +// pretty-expanded FIXME #23616 + +// aux-build:issue-18711.rs +extern crate issue_18711 as issue; + +fn main() { + (|| issue::inner(()))(); +} diff --git a/src/test/run-pass/issues/issue-18738.rs b/src/test/run-pass/issues/issue-18738.rs new file mode 100644 index 00000000000..f586552dcb3 --- /dev/null +++ b/src/test/run-pass/issues/issue-18738.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Eq, PartialEq, PartialOrd, Ord)] +enum Test<'a> { + Int(&'a isize), + Slice(&'a [u8]), +} + +#[derive(Eq, PartialEq, PartialOrd, Ord)] +struct Version { + vendor_info: &'static str +} + +#[derive(Eq, PartialEq, PartialOrd, Ord)] +struct Foo(&'static str); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-18767.rs b/src/test/run-pass/issues/issue-18767.rs new file mode 100644 index 00000000000..3577850be2f --- /dev/null +++ b/src/test/run-pass/issues/issue-18767.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that regionck uses the right memcat for patterns in for loops +// and doesn't ICE. + + +fn main() { + for &&x in Some(&0_usize).iter() { + assert_eq!(x, 0) + } +} diff --git a/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs b/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs new file mode 100644 index 00000000000..06d454b2c89 --- /dev/null +++ b/src/test/run-pass/issues/issue-18804/auxiliary/lib.rs @@ -0,0 +1,20 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "rlib"] +#![feature(linkage)] + +pub fn foo() -> *const() { + extern { + #[linkage = "extern_weak"] + static FOO: *const(); + } + unsafe { FOO } +} diff --git a/src/test/run-pass/issues/issue-18804/main.rs b/src/test/run-pass/issues/issue-18804/main.rs new file mode 100644 index 00000000000..a3a5337077c --- /dev/null +++ b/src/test/run-pass/issues/issue-18804/main.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test for issue #18804, #[linkage] does not propagate thorugh generic +// functions. Failure results in a linker error. + +// ignore-asmjs no weak symbol support +// ignore-emscripten no weak symbol support + +// aux-build:lib.rs + +extern crate lib; + +fn main() { + lib::foo::(); +} diff --git a/src/test/run-pass/issues/issue-18809.rs b/src/test/run-pass/issues/issue-18809.rs new file mode 100644 index 00000000000..1895b3bdfe4 --- /dev/null +++ b/src/test/run-pass/issues/issue-18809.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Tup { + type T0; + type T1; +} + +impl Tup for isize { + type T0 = f32; + type T1 = (); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-18845.rs b/src/test/run-pass/issues/issue-18845.rs new file mode 100644 index 00000000000..1510c774b28 --- /dev/null +++ b/src/test/run-pass/issues/issue-18845.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This used to generate invalid IR in that even if we took the +// `false` branch we'd still try to free the Box from the other +// arm. This was due to treating `*Box::new(9)` as an rvalue datum +// instead of as a place. + +fn test(foo: bool) -> u8 { + match foo { + true => *Box::new(9), + false => 0 + } +} + +fn main() { + assert_eq!(9, test(true)); +} diff --git a/src/test/run-pass/issues/issue-18859.rs b/src/test/run-pass/issues/issue-18859.rs new file mode 100644 index 00000000000..4c98cb2d02d --- /dev/null +++ b/src/test/run-pass/issues/issue-18859.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod foo { + pub mod bar { + pub mod baz { + pub fn name() -> &'static str { + module_path!() + } + } + } +} + +fn main() { + assert_eq!(module_path!(), "issue_18859"); + assert_eq!(foo::bar::baz::name(), "issue_18859::foo::bar::baz"); +} diff --git a/src/test/run-pass/issues/issue-18906.rs b/src/test/run-pass/issues/issue-18906.rs new file mode 100644 index 00000000000..08a39350c57 --- /dev/null +++ b/src/test/run-pass/issues/issue-18906.rs @@ -0,0 +1,39 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait Borrow { + fn borrow(&self) -> &Borrowed; +} + +impl Borrow for T { + fn borrow(&self) -> &T { self } +} + +trait Foo { + fn foo(&self, other: &Self); +} + +fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { + q.foo(k.borrow()) +} + +struct MyTree(K); + +impl MyTree { + // This caused a failure in #18906 + fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { + q.foo(k.borrow()) + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-18913.rs b/src/test/run-pass/issues/issue-18913.rs new file mode 100644 index 00000000000..57882648405 --- /dev/null +++ b/src/test/run-pass/issues/issue-18913.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-18913-1.rs +// aux-build:issue-18913-2.rs + +extern crate foo; + +fn main() { + assert_eq!(foo::foo(), 1); +} diff --git a/src/test/run-pass/issues/issue-18937-1.rs b/src/test/run-pass/issues/issue-18937-1.rs new file mode 100644 index 00000000000..bf6a33d69cc --- /dev/null +++ b/src/test/run-pass/issues/issue-18937-1.rs @@ -0,0 +1,31 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to type-check this example. In particular, +// knowing that `T: 'a` allows us to deduce that `[U]: 'a` (because +// when `T=[U]` it implies that `U: 'a`). +// +// Regr. test for live code we found in the wild when fixing #18937. + +pub trait Leak { + fn leak<'a>(self) -> &'a T where T: 'a; +} + +impl Leak<[U]> for Vec { + fn leak<'a>(mut self) -> &'a [U] where [U]: 'a { + let r: *mut [U] = &mut self[..]; + std::mem::forget(self); + unsafe { &mut *r } + } +} +fn main() { + println!("Hello, world!"); +} diff --git a/src/test/run-pass/issues/issue-18988.rs b/src/test/run-pass/issues/issue-18988.rs new file mode 100644 index 00000000000..422a0f7d7d6 --- /dev/null +++ b/src/test/run-pass/issues/issue-18988.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Foo : Send { } + +pub struct MyFoo { + children: Vec>, +} + +impl Foo for MyFoo { } + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-19001.rs b/src/test/run-pass/issues/issue-19001.rs new file mode 100644 index 00000000000..4407cbf501e --- /dev/null +++ b/src/test/run-pass/issues/issue-19001.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that we handle recursive arrays correctly in `type_of` + +struct Loopy { + ptr: *mut [Loopy; 1] +} + +fn main() { + let _t = Loopy { ptr: 0 as *mut _ }; +} diff --git a/src/test/run-pass/issues/issue-19037.rs b/src/test/run-pass/issues/issue-19037.rs new file mode 100644 index 00000000000..eb3c265617b --- /dev/null +++ b/src/test/run-pass/issues/issue-19037.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Str([u8]); + +#[derive(Clone)] +struct CharSplits<'a, Sep> { + string: &'a Str, + sep: Sep, + allow_trailing_empty: bool, + only_ascii: bool, + finished: bool, +} + +fn clone(s: &Str) -> &Str { + Clone::clone(&s) +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19081.rs b/src/test/run-pass/issues/issue-19081.rs new file mode 100644 index 00000000000..56ceaaf9884 --- /dev/null +++ b/src/test/run-pass/issues/issue-19081.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Hasher { + type State; + + fn hash::State + >>(&self, value: &T) -> u64; +} + +pub trait Hash { + fn hash(&self, state: &mut S); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19097.rs b/src/test/run-pass/issues/issue-19097.rs new file mode 100644 index 00000000000..d3415c34791 --- /dev/null +++ b/src/test/run-pass/issues/issue-19097.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// regression test for #19097 + +struct Foo(T); + +impl<'a, T> Foo<&'a T> { + fn foo(&self) {} +} +impl<'a, T> Foo<&'a mut T> { + fn foo(&self) {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19098.rs b/src/test/run-pass/issues/issue-19098.rs new file mode 100644 index 00000000000..5b114659ae9 --- /dev/null +++ b/src/test/run-pass/issues/issue-19098.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Handler { + fn handle(&self, _: &mut String); +} + +impl Handler for F where F: for<'a, 'b> Fn(&'a mut String) { + fn handle(&self, st: &mut String) { + self(st) + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19102.rs b/src/test/run-pass/issues/issue-19102.rs new file mode 100644 index 00000000000..eecc9db486e --- /dev/null +++ b/src/test/run-pass/issues/issue-19102.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(unused_qualifications)] + +use self::A::B; + +#[derive(PartialEq)] +pub enum A { + B, +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19127.rs b/src/test/run-pass/issues/issue-19127.rs new file mode 100644 index 00000000000..3290b179864 --- /dev/null +++ b/src/test/run-pass/issues/issue-19127.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo T>(f: F) {} +fn id<'a>(input: &'a u8) -> &'a u8 { input } + +fn main() { + foo(id); +} diff --git a/src/test/run-pass/issues/issue-19129-1.rs b/src/test/run-pass/issues/issue-19129-1.rs new file mode 100644 index 00000000000..cdb23e627c9 --- /dev/null +++ b/src/test/run-pass/issues/issue-19129-1.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Trait { + type Output; + + fn method() -> >::Output; +} + +impl Trait for () { + type Output = (); + + fn method() {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19129-2.rs b/src/test/run-pass/issues/issue-19129-2.rs new file mode 100644 index 00000000000..4999ee1287c --- /dev/null +++ b/src/test/run-pass/issues/issue-19129-2.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Trait { + type Output; + + fn method(&self, i: Input) -> bool { false } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19135.rs b/src/test/run-pass/issues/issue-19135.rs new file mode 100644 index 00000000000..8a5fdc3b775 --- /dev/null +++ b/src/test/run-pass/issues/issue-19135.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::marker::PhantomData; + +#[derive(Debug)] +struct LifetimeStruct<'a>(PhantomData<&'a ()>); + +fn main() { + takes_hrtb_closure(|lts| println!("{:?}", lts)); +} + +fn takes_hrtb_closureFnMut(LifetimeStruct<'a>)>(mut f: F) { + f(LifetimeStruct(PhantomData)); +} diff --git a/src/test/run-pass/issues/issue-19244.rs b/src/test/run-pass/issues/issue-19244.rs new file mode 100644 index 00000000000..93cb0b9dd1f --- /dev/null +++ b/src/test/run-pass/issues/issue-19244.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct MyStruct { field: usize } +struct Nested { nested: MyStruct } +struct Mix2 { nested: ((usize,),) } + +const STRUCT: MyStruct = MyStruct { field: 42 }; +const TUP: (usize,) = (43,); +const NESTED_S: Nested = Nested { nested: MyStruct { field: 5 } }; +const NESTED_T: ((usize,),) = ((4,),); +const MIX_1: ((Nested,),) = ((Nested { nested: MyStruct { field: 3 } },),); +const MIX_2: Mix2 = Mix2 { nested: ((2,),) }; +const INSTANT_1: usize = (MyStruct { field: 1 }).field; +const INSTANT_2: usize = (0,).0; + +fn main() { + let a = [0; STRUCT.field]; + let b = [0; TUP.0]; + let c = [0; NESTED_S.nested.field]; + let d = [0; (NESTED_T.0).0]; + let e = [0; (MIX_1.0).0.nested.field]; + let f = [0; (MIX_2.nested.0).0]; + let g = [0; INSTANT_1]; + let h = [0; INSTANT_2]; + + assert_eq!(a.len(), 42); + assert_eq!(b.len(), 43); + assert_eq!(c.len(), 5); + assert_eq!(d.len(), 4); + assert_eq!(e.len(), 3); + assert_eq!(f.len(), 2); + assert_eq!(g.len(), 1); + assert_eq!(h.len(), 0); +} diff --git a/src/test/run-pass/issues/issue-19293.rs b/src/test/run-pass/issues/issue-19293.rs new file mode 100644 index 00000000000..5bb336eba91 --- /dev/null +++ b/src/test/run-pass/issues/issue-19293.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_19293.rs +// pretty-expanded FIXME #23616 + +extern crate issue_19293; +use issue_19293::{Foo, MyEnum}; + +fn main() { + MyEnum::Foo(Foo(5)); +} diff --git a/src/test/run-pass/issues/issue-19340-1.rs b/src/test/run-pass/issues/issue-19340-1.rs new file mode 100644 index 00000000000..53531fcad87 --- /dev/null +++ b/src/test/run-pass/issues/issue-19340-1.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-19340-1.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_19340_1 as lib; + +use lib::Homura; + +fn main() { + let homura = Homura::Madoka { name: "Kaname".to_string() }; + + match homura { + Homura::Madoka { name } => (), + }; +} diff --git a/src/test/run-pass/issues/issue-19340-2.rs b/src/test/run-pass/issues/issue-19340-2.rs new file mode 100644 index 00000000000..a1b68e87626 --- /dev/null +++ b/src/test/run-pass/issues/issue-19340-2.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Homura { + Madoka { + name: String, + age: u32, + }, +} + +fn main() { + let homura = Homura::Madoka { + name: "Akemi".to_string(), + age: 14, + }; + + match homura { + Homura::Madoka { + name, + age, + } => (), + }; +} diff --git a/src/test/run-pass/issues/issue-19358.rs b/src/test/run-pass/issues/issue-19358.rs new file mode 100644 index 00000000000..f58254496ff --- /dev/null +++ b/src/test/run-pass/issues/issue-19358.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Trait { fn dummy(&self) { } } + +#[derive(Debug)] +struct Foo { + foo: T, +} + +#[derive(Debug)] +struct Bar where T: Trait { + bar: T, +} + +impl Trait for isize {} + +fn main() { + let a = Foo { foo: 12 }; + let b = Bar { bar: 12 }; + println!("{:?} {:?}", a, b); +} diff --git a/src/test/run-pass/issues/issue-19367.rs b/src/test/run-pass/issues/issue-19367.rs new file mode 100644 index 00000000000..dfcc0926d80 --- /dev/null +++ b/src/test/run-pass/issues/issue-19367.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S { + o: Option +} + +// Make sure we don't reuse the same alloca when matching +// on field of struct or tuple which we reassign in the match body. + +fn main() { + let mut a = (0, Some("right".to_string())); + let b = match a.1 { + Some(v) => { + a.1 = Some("wrong".to_string()); + v + } + None => String::new() + }; + println!("{}", b); + assert_eq!(b, "right"); + + + let mut s = S{ o: Some("right".to_string()) }; + let b = match s.o { + Some(v) => { + s.o = Some("wrong".to_string()); + v + } + None => String::new(), + }; + println!("{}", b); + assert_eq!(b, "right"); +} diff --git a/src/test/run-pass/issues/issue-19398.rs b/src/test/run-pass/issues/issue-19398.rs new file mode 100644 index 00000000000..dd2a796dba3 --- /dev/null +++ b/src/test/run-pass/issues/issue-19398.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait T { + unsafe extern "Rust" fn foo(&self); +} + +impl T for () { + unsafe extern "Rust" fn foo(&self) {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19404.rs b/src/test/run-pass/issues/issue-19404.rs new file mode 100644 index 00000000000..3a5ce65aef8 --- /dev/null +++ b/src/test/run-pass/issues/issue-19404.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::any::TypeId; +use std::rc::Rc; + +type Fp = Rc; + +struct Engine; + +trait Component: 'static {} +impl Component for Engine {} + +trait Env { + fn get_component_type_id(&self, type_id: TypeId) -> Option>; +} + +impl<'a> Env+'a { + fn get_component(&self) -> Option> { + let x = self.get_component_type_id(TypeId::of::()); + None + } +} + +trait Figment { + fn init(&mut self, env: &Env); +} + +struct MyFigment; + +impl Figment for MyFigment { + fn init(&mut self, env: &Env) { + let engine = env.get_component::(); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19479.rs b/src/test/run-pass/issues/issue-19479.rs new file mode 100644 index 00000000000..6326dfd8fe0 --- /dev/null +++ b/src/test/run-pass/issues/issue-19479.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Base { + fn dummy(&self) { } +} +trait AssocA { + type X: Base; + fn dummy(&self) { } +} +trait AssocB { + type Y: Base; + fn dummy(&self) { } +} +impl AssocB for T { + type Y = ::X; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19499.rs b/src/test/run-pass/issues/issue-19499.rs new file mode 100644 index 00000000000..5fb209b2dfe --- /dev/null +++ b/src/test/run-pass/issues/issue-19499.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #19499. Due to incorrect caching of trait +// results for closures with upvars whose types were not fully +// computed, this rather bizarre little program (along with many more +// reasonable examples) let to ambiguity errors about not being able +// to infer sufficient type information. + +// pretty-expanded FIXME #23616 + +fn main() { + let n = 0; + let it = Some(1_usize).into_iter().inspect(|_| {n;}); +} diff --git a/src/test/run-pass/issues/issue-19631.rs b/src/test/run-pass/issues/issue-19631.rs new file mode 100644 index 00000000000..12804983ee4 --- /dev/null +++ b/src/test/run-pass/issues/issue-19631.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait PoolManager { + type C; + fn dummy(&self) { } +} + +struct InnerPool { + manager: M, +} + +impl InnerPool where M: PoolManager {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19632.rs b/src/test/run-pass/issues/issue-19632.rs new file mode 100644 index 00000000000..801d5947f92 --- /dev/null +++ b/src/test/run-pass/issues/issue-19632.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait PoolManager { + type C; + fn dummy(&self) { } +} + +struct InnerPool { + manager: M, +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-1974.rs b/src/test/run-pass/issues/issue-1974.rs new file mode 100644 index 00000000000..016afcdd54d --- /dev/null +++ b/src/test/run-pass/issues/issue-1974.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 1974 +// Don't double free the condition allocation +// pretty-expanded FIXME #23616 + +pub fn main() { + let s = "hej".to_string(); + while s != "".to_string() { + return; + } +} diff --git a/src/test/run-pass/issues/issue-19811-escape-unicode.rs b/src/test/run-pass/issues/issue-19811-escape-unicode.rs new file mode 100644 index 00000000000..5b021f6ee54 --- /dev/null +++ b/src/test/run-pass/issues/issue-19811-escape-unicode.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let mut escaped = String::from(""); + for c in '\u{10401}'.escape_unicode() { + escaped.push(c); + } + assert_eq!("\\u{10401}", escaped); +} diff --git a/src/test/run-pass/issues/issue-19850.rs b/src/test/run-pass/issues/issue-19850.rs new file mode 100644 index 00000000000..fa837f57ede --- /dev/null +++ b/src/test/run-pass/issues/issue-19850.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that `::Output` and `Self::Output` are accepted as type annotations in let +// bindings + +// pretty-expanded FIXME #23616 + +trait Int { + fn one() -> Self; + fn leading_zeros(self) -> usize; +} + +trait Foo { + type T : Int; + + fn test(&self) { + let r: ::T = Int::one(); + let r: Self::T = Int::one(); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-19982.rs b/src/test/run-pass/issues/issue-19982.rs new file mode 100644 index 00000000000..380cb3cac22 --- /dev/null +++ b/src/test/run-pass/issues/issue-19982.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(fn_traits, unboxed_closures)] + +#[allow(dead_code)] +struct Foo; + +impl<'a> Fn<(&'a (),)> for Foo { + extern "rust-call" fn call(&self, (_,): (&(),)) {} +} + +impl<'a> FnMut<(&'a (),)> for Foo { + extern "rust-call" fn call_mut(&mut self, (_,): (&(),)) {} +} + +impl<'a> FnOnce<(&'a (),)> for Foo { + type Output = (); + + extern "rust-call" fn call_once(self, (_,): (&(),)) {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20009.rs b/src/test/run-pass/issues/issue-20009.rs new file mode 100644 index 00000000000..604395b3dc7 --- /dev/null +++ b/src/test/run-pass/issues/issue-20009.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that associated types are `Sized` + +// pretty-expanded FIXME #23616 + +trait Trait { + type Output; + + fn is_sized(&self) -> Self::Output; + fn wasnt_sized(&self) -> Self::Output { loop {} } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20055-box-trait.rs b/src/test/run-pass/issues/issue-20055-box-trait.rs new file mode 100644 index 00000000000..bd9da3a69c2 --- /dev/null +++ b/src/test/run-pass/issues/issue-20055-box-trait.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// See Issues #20055 and #21695. + +// We are checking here that the temporaries `Box<[i8, k]>`, for `k` +// in 1, 2, 3, 4, that are induced by the match expression are +// properly handled, in that only *one* will be initialized by +// whichever arm is run, and subsequently dropped at the end of the +// statement surrounding the `match`. + +trait Boo { + fn dummy(&self) { } +} + +impl Boo for [i8; 1] { } +impl Boo for [i8; 2] { } +impl Boo for [i8; 3] { } +impl Boo for [i8; 4] { } + +pub fn foo(box_1: fn () -> Box<[i8; 1]>, + box_2: fn () -> Box<[i8; 2]>, + box_3: fn () -> Box<[i8; 3]>, + box_4: fn () -> Box<[i8; 4]>, + ) { + println!("Hello World 1"); + let _: Box = match 3 { + 1 => box_1(), + 2 => box_2(), + 3 => box_3(), + _ => box_4(), + }; + println!("Hello World 2"); +} + +pub fn main() { + fn box_1() -> Box<[i8; 1]> { Box::new( [1; 1] ) } + fn box_2() -> Box<[i8; 2]> { Box::new( [1; 2] ) } + fn box_3() -> Box<[i8; 3]> { Box::new( [1; 3] ) } + fn box_4() -> Box<[i8; 4]> { Box::new( [1; 4] ) } + + foo(box_1, box_2, box_3, box_4); +} diff --git a/src/test/run-pass/issues/issue-20055-box-unsized-array.rs b/src/test/run-pass/issues/issue-20055-box-unsized-array.rs new file mode 100644 index 00000000000..6af9741dc9b --- /dev/null +++ b/src/test/run-pass/issues/issue-20055-box-unsized-array.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #2005: Check that boxed fixed-size arrays are properly +// accounted for (namely, only deallocated if they were actually +// created) when they appear as temporaries in unused arms of a match +// expression. + +pub fn foo(box_1: fn () -> Box<[i8; 1]>, + box_2: fn () -> Box<[i8; 20]>, + box_3: fn () -> Box<[i8; 300]>, + box_4: fn () -> Box<[i8; 4000]>, + ) { + println!("Hello World 1"); + let _: Box<[i8]> = match 3 { + 1 => box_1(), + 2 => box_2(), + 3 => box_3(), + _ => box_4(), + }; + println!("Hello World 2"); +} + +pub fn main() { + fn box_1() -> Box<[i8; 1]> { Box::new( [1] ) } + fn box_2() -> Box<[i8; 20]> { Box::new( [1; 20] ) } + fn box_3() -> Box<[i8; 300]> { Box::new( [1; 300] ) } + fn box_4() -> Box<[i8; 4000]> { Box::new( [1; 4000] ) } + + foo(box_1, box_2, box_3, box_4); +} diff --git a/src/test/run-pass/issues/issue-20091.rs b/src/test/run-pass/issues/issue-20091.rs new file mode 100644 index 00000000000..46d11b9d9b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-20091.rs @@ -0,0 +1,34 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// ignore-cloudabi no processes +// ignore-emscripten no processes + +#![feature(os)] + +#[cfg(unix)] +fn main() { + use std::process::Command; + use std::env; + use std::os::unix::prelude::*; + use std::ffi::OsStr; + + if env::args().len() == 1 { + assert!(Command::new(&env::current_exe().unwrap()) + .arg(::from_bytes(b"\xff")) + .status().unwrap().success()) + } +} + +#[cfg(windows)] +fn main() {} diff --git a/src/test/run-pass/issues/issue-20174.rs b/src/test/run-pass/issues/issue-20174.rs new file mode 100644 index 00000000000..57e7193363e --- /dev/null +++ b/src/test/run-pass/issues/issue-20174.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct GradFn usize>(F); + +fn main() { + let GradFn(x_squared) : GradFn<_> = GradFn(|| -> usize { 2 }); + let _ = x_squared(); +} diff --git a/src/test/run-pass/issues/issue-20186.rs b/src/test/run-pass/issues/issue-20186.rs new file mode 100644 index 00000000000..0f42d8b1caa --- /dev/null +++ b/src/test/run-pass/issues/issue-20186.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo; + +impl Foo { + fn putc(&self, b: u8) { } + + fn puts(&self, s: &str) { + for byte in s.bytes() { + self.putc(byte) + } + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20313.rs b/src/test/run-pass/issues/issue-20313.rs new file mode 100644 index 00000000000..9e6561369b8 --- /dev/null +++ b/src/test/run-pass/issues/issue-20313.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(link_llvm_intrinsics)] + +extern { + #[link_name = "llvm.sqrt.f32"] + fn sqrt(x: f32) -> f32; +} + +fn main(){ +} diff --git a/src/test/run-pass/issues/issue-20343.rs b/src/test/run-pass/issues/issue-20343.rs new file mode 100644 index 00000000000..62506e1c49d --- /dev/null +++ b/src/test/run-pass/issues/issue-20343.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for Issue #20343. + +// pretty-expanded FIXME #23616 + +#![deny(dead_code)] + +struct B { b: u32 } +struct C; +struct D; + +trait T { fn dummy(&self, a: A) { } } +impl T for () {} + +impl B { + // test for unused code in arguments + fn foo(B { b }: B) -> u32 { b } + + // test for unused code in return type + fn bar() -> C { unsafe { ::std::mem::transmute(()) } } + + // test for unused code in generics + fn baz>() {} +} + +pub fn main() { + let b = B { b: 3 }; + B::foo(b); + B::bar(); + B::baz::<()>(); +} diff --git a/src/test/run-pass/issues/issue-20389.rs b/src/test/run-pass/issues/issue-20389.rs new file mode 100644 index 00000000000..21cd3a55268 --- /dev/null +++ b/src/test/run-pass/issues/issue-20389.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_20389.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_20389; + +struct Foo; + +impl issue_20389::T for Foo { + type C = (); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20396.rs b/src/test/run-pass/issues/issue-20396.rs new file mode 100644 index 00000000000..6f0ce7ca2d4 --- /dev/null +++ b/src/test/run-pass/issues/issue-20396.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Foo { + fn noop(&self, _: T); +} + +enum Bar { Bla(T) } + +struct Baz<'a> { + inner: for<'b> Foo> + 'a, +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20414.rs b/src/test/run-pass/issues/issue-20414.rs new file mode 100644 index 00000000000..2e2449933c0 --- /dev/null +++ b/src/test/run-pass/issues/issue-20414.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Trait { + fn method(self) -> isize; +} + +struct Wrapper { + field: T +} + +impl<'a, T> Trait for &'a Wrapper where &'a T: Trait { + fn method(self) -> isize { + let r: &'a T = &self.field; + Trait::method(r); // these should both work + r.method() + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20427.rs b/src/test/run-pass/issues/issue-20427.rs new file mode 100644 index 00000000000..b03c489e252 --- /dev/null +++ b/src/test/run-pass/issues/issue-20427.rs @@ -0,0 +1,95 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] +#![allow(non_camel_case_types)] + +// aux-build:i8.rs +// ignore-pretty issue #37201 + +extern crate i8; +use std::string as i16; +static i32: i32 = 0; +const i64: i64 = 0; +fn u8(f32: f32) {} +fn f(f64: f64) {} +enum u32 {} +struct u64; +trait bool {} + +mod char { + extern crate i8; + static i32_: i32 = 0; + const i64_: i64 = 0; + fn u8_(f32: f32) {} + fn f_(f64: f64_) {} + type u16_ = u16; + enum u32_ {} + struct u64_; + trait bool_ {} + mod char_ {} + + mod str { + use super::i8 as i8; + use super::i32_ as i32; + use super::i64_ as i64; + use super::u8_ as u8; + use super::f_ as f64; + use super::u16_ as u16; + use super::u32_ as u32; + use super::u64_ as u64; + use super::bool_ as bool; + use super::{bool_ as str}; + use super::char_ as char; + } +} + +trait isize_ { + type isize; +} + +fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } + +mod reuse { + use std::mem::size_of; + + type u8 = u64; + use std::string::String as i16; + + pub fn check() { + assert_eq!(size_of::(), 8); + assert_eq!(size_of::<::u64>(), 0); + assert_eq!(size_of::(), 3 * size_of::<*const ()>()); + assert_eq!(size_of::(), 0); + } +} + +mod guard { + pub fn check() { + use std::u8; // bring module u8 in scope + fn f() -> u8 { // OK, resolves to primitive u8, not to std::u8 + u8::max_value() // OK, resolves to associated function ::max_value, + // not to non-existent std::u8::max_value + } + assert_eq!(f(), u8::MAX); // OK, resolves to std::u8::MAX + } +} + +fn main() { + let bool = true; + let _ = match bool { + str @ true => if str { i32 as i64 } else { i64 }, + false => i64, + }; + + reuse::check::(); + guard::check(); +} diff --git a/src/test/run-pass/issues/issue-20454.rs b/src/test/run-pass/issues/issue-20454.rs new file mode 100644 index 00000000000..41cc94909a0 --- /dev/null +++ b/src/test/run-pass/issues/issue-20454.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::thread; + +fn _foo() { + thread::spawn(move || { // no need for -> () + loop { + println!("hello"); + } + }).join(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20544.rs b/src/test/run-pass/issues/issue-20544.rs new file mode 100644 index 00000000000..1a6e647e625 --- /dev/null +++ b/src/test/run-pass/issues/issue-20544.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(unboxed_closures)] +#![feature(fn_traits)] + +struct Fun(F); + +impl FnOnce<(T,)> for Fun where F: Fn(T) -> T { + type Output = T; + + extern "rust-call" fn call_once(self, (t,): (T,)) -> T { + (self.0)(t) + } +} + +fn main() { + let fun = Fun(|i: isize| i * 2); + println!("{}", fun(3)); +} diff --git a/src/test/run-pass/issues/issue-20575.rs b/src/test/run-pass/issues/issue-20575.rs new file mode 100644 index 00000000000..35551185807 --- /dev/null +++ b/src/test/run-pass/issues/issue-20575.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that overloaded calls work with zero arity closures + +// pretty-expanded FIXME #23616 + +fn main() { + let functions: [Box Option<()>>; 1] = [Box::new(|| None)]; + + let _: Option> = functions.iter().map(|f| (*f)()).collect(); +} diff --git a/src/test/run-pass/issues/issue-20616.rs b/src/test/run-pass/issues/issue-20616.rs new file mode 100644 index 00000000000..c28d2123669 --- /dev/null +++ b/src/test/run-pass/issues/issue-20616.rs @@ -0,0 +1,53 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +type MyType<'a, T> = &'a T; + +// combine lifetime bounds and type arguments in usual way +type TypeA<'a> = MyType<'a, ()>; + +// ensure token `>>` works fine +type TypeB = Box>; +type TypeB_ = Box>; + +// trailing comma when combine lifetime bounds and type arguments +type TypeC<'a> = MyType<'a, (),>; + +// normal lifetime bounds +type TypeD = TypeA<'static>; + +// trailing comma on lifetime bounds +type TypeE = TypeA<'static,>; + +// normal type argument +type TypeF = Box; + +// type argument with trailing comma +type TypeG = Box; + +// trailing comma on lifetime defs +type TypeH<'a,> = &'a (); + +// trailing comma on type argument +type TypeI = T; + +static STATIC: () = (); + +fn main() { + + // ensure token `>=` works fine + let _: TypeA<'static>= &STATIC; + let _: TypeA<'static,>= &STATIC; + + // ensure token `>>=` works fine + let _: Box>= Box::new(&STATIC); + let _: Box>= Box::new(&STATIC); +} diff --git a/src/test/run-pass/issues/issue-2063-resource.rs b/src/test/run-pass/issues/issue-2063-resource.rs new file mode 100644 index 00000000000..12e9b481dc1 --- /dev/null +++ b/src/test/run-pass/issues/issue-2063-resource.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// test that autoderef of a type like this does not +// cause compiler to loop. Note that no instances +// of such a type could ever be constructed. + +struct S { + x: X, + to_str: (), +} + +struct X(Box); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2063.rs b/src/test/run-pass/issues/issue-2063.rs new file mode 100644 index 00000000000..853c8bc6ec2 --- /dev/null +++ b/src/test/run-pass/issues/issue-2063.rs @@ -0,0 +1,32 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// test that autoderef of a type like this does not +// cause compiler to loop. Note that no instances +// of such a type could ever be constructed. + +struct T(Box); + +trait ToStr2 { + fn my_to_string(&self) -> String; +} + +impl ToStr2 for T { + fn my_to_string(&self) -> String { "t".to_string() } +} + +#[allow(dead_code)] +fn new_t(x: T) { + x.my_to_string(); +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-20644.rs b/src/test/run-pass/issues/issue-20644.rs new file mode 100644 index 00000000000..728e2be3d23 --- /dev/null +++ b/src/test/run-pass/issues/issue-20644.rs @@ -0,0 +1,43 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// A reduced version of the rustbook ice. The problem this encountered +// had to do with codegen ignoring binders. + +// pretty-expanded FIXME #23616 +// ignore-cloudabi no std::fs + +#![feature(os)] + +use std::iter; +use std::os; +use std::fs::File; +use std::io::prelude::*; +use std::env; +use std::path::Path; + +pub fn parse_summary(_: R, _: &Path) { + let path_from_root = Path::new(""); + Path::new(&iter::repeat("../") + .take(path_from_root.components().count() - 1) + .collect::()); + } + +fn foo() { + let cwd = env::current_dir().unwrap(); + let src = cwd.clone(); + let summary = File::open(&src.join("SUMMARY.md")).unwrap(); + let _ = parse_summary(summary, &src); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20676.rs b/src/test/run-pass/issues/issue-20676.rs new file mode 100644 index 00000000000..ff7ea9eaae4 --- /dev/null +++ b/src/test/run-pass/issues/issue-20676.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #20676. Error was that we didn't support +// UFCS-style calls to a method in `Trait` where `Self` was bound to a +// trait object of type `Trait`. See also `ufcs-trait-object.rs`. + + +use std::fmt; + +fn main() { + let a: &fmt::Debug = &1; + format!("{:?}", a); +} diff --git a/src/test/run-pass/issues/issue-2074.rs b/src/test/run-pass/issues/issue-2074.rs new file mode 100644 index 00000000000..9aba2637068 --- /dev/null +++ b/src/test/run-pass/issues/issue-2074.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(non_camel_case_types)] + +pub fn main() { + let one = || { + enum r { a }; + r::a as usize + }; + let two = || { + enum r { a }; + r::a as usize + }; + one(); two(); +} diff --git a/src/test/run-pass/issues/issue-20763-1.rs b/src/test/run-pass/issues/issue-20763-1.rs new file mode 100644 index 00000000000..0afcc1bd966 --- /dev/null +++ b/src/test/run-pass/issues/issue-20763-1.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait T0 { + type O; + fn dummy(&self) { } +} + +struct S(A); +impl T0 for S { type O = A; } + +trait T1: T0 { + // this looks okay but as we see below, `f` is unusable + fn m0::O) -> bool>(self, f: F) -> bool; +} + +// complains about the bounds on F here not being required by the trait +impl T1 for S { + fn m0 bool>(self, f: F) -> bool { f(self.0) } +} + +// // complains about mismatched types: as T0>::O vs. A +// impl T1 for S +// { +// fn m0::O) -> bool>(self, f: F) -> bool { f(self.0) } +// } + +fn main() { } diff --git a/src/test/run-pass/issues/issue-20763-2.rs b/src/test/run-pass/issues/issue-20763-2.rs new file mode 100644 index 00000000000..4b25d4f05de --- /dev/null +++ b/src/test/run-pass/issues/issue-20763-2.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait T0 { + type O; + fn dummy(&self) { } +} + +struct S(A); +impl T0 for S { type O = A; } + +trait T1: T0 { + // this looks okay but as we see below, `f` is unusable + fn m0::O) -> bool>(self, f: F) -> bool; +} + +// complains about mismatched types: as T0>::O vs. A +impl T1 for S +{ + fn m0::O) -> bool>(self, f: F) -> bool { f(self.0) } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-20797.rs b/src/test/run-pass/issues/issue-20797.rs new file mode 100644 index 00000000000..9c8a2571deb --- /dev/null +++ b/src/test/run-pass/issues/issue-20797.rs @@ -0,0 +1,104 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no std::fs + +// Regression test for #20797. + +use std::default::Default; +use std::io; +use std::fs; +use std::path::PathBuf; + +pub trait PathExtensions { + fn is_dir(&self) -> bool { false } +} + +impl PathExtensions for PathBuf {} + +/// A strategy for acquiring more subpaths to walk. +pub trait Strategy { + type P: PathExtensions; + /// Get additional subpaths from a given path. + fn get_more(&self, item: &Self::P) -> io::Result>; + /// Determine whether a path should be walked further. + /// This is run against each item from `get_more()`. + fn prune(&self, p: &Self::P) -> bool; +} + +/// The basic fully-recursive strategy. Nothing is pruned. +#[derive(Copy, Clone, Default)] +pub struct Recursive; + +impl Strategy for Recursive { + type P = PathBuf; + fn get_more(&self, p: &PathBuf) -> io::Result> { + Ok(fs::read_dir(p).unwrap().map(|s| s.unwrap().path()).collect()) + } + + fn prune(&self, _: &PathBuf) -> bool { false } +} + +/// A directory walker of `P` using strategy `S`. +pub struct Subpaths { + stack: Vec, + strategy: S, +} + +impl Subpaths { + /// Create a directory walker with a root path and strategy. + pub fn new(p: &S::P, strategy: S) -> io::Result> { + let stack = strategy.get_more(p)?; + Ok(Subpaths { stack: stack, strategy: strategy }) + } +} + +impl Subpaths { + /// Create a directory walker with a root path and a default strategy. + pub fn walk(p: &S::P) -> io::Result> { + Subpaths::new(p, Default::default()) + } +} + +impl Default for Subpaths { + fn default() -> Subpaths { + Subpaths { stack: Vec::new(), strategy: Default::default() } + } +} + +impl Iterator for Subpaths { + type Item = S::P; + fn next (&mut self) -> Option { + let mut opt_path = self.stack.pop(); + while opt_path.is_some() && self.strategy.prune(opt_path.as_ref().unwrap()) { + opt_path = self.stack.pop(); + } + match opt_path { + Some(path) => { + if path.is_dir() { + let result = self.strategy.get_more(&path); + match result { + Ok(dirs) => { self.stack.extend(dirs); }, + Err(..) => { } + } + } + Some(path) + } + None => None, + } + } +} + +fn _foo() { + let _walker: Subpaths = Subpaths::walk(&PathBuf::from("/home")).unwrap(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20803.rs b/src/test/run-pass/issues/issue-20803.rs new file mode 100644 index 00000000000..7a3e4e71ace --- /dev/null +++ b/src/test/run-pass/issues/issue-20803.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Add; + +fn foo(x: T) -> >::Output where i32: Add { + 42i32 + x +} + +fn main() { + println!("{}", foo(0i32)); +} diff --git a/src/test/run-pass/issues/issue-20823.rs b/src/test/run-pass/issues/issue-20823.rs new file mode 100644 index 00000000000..0a3b6f6eaa0 --- /dev/null +++ b/src/test/run-pass/issues/issue-20823.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --test + +#[test] +pub fn foo() {} diff --git a/src/test/run-pass/issues/issue-20825.rs b/src/test/run-pass/issues/issue-20825.rs new file mode 100644 index 00000000000..62435fd343e --- /dev/null +++ b/src/test/run-pass/issues/issue-20825.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Subscriber { + type Input; +} + +pub trait Processor: Subscriber::Input> { + type Input; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-20847.rs b/src/test/run-pass/issues/issue-20847.rs new file mode 100644 index 00000000000..4cb5a01b9de --- /dev/null +++ b/src/test/run-pass/issues/issue-20847.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(fn_traits)] + +use std::ops::Fn; + +fn say(x: u32, y: u32) { + println!("{} {}", x, y); +} + +fn main() { + Fn::call(&say, (1, 2)); +} diff --git a/src/test/run-pass/issues/issue-20953.rs b/src/test/run-pass/issues/issue-20953.rs new file mode 100644 index 00000000000..e3dc286df34 --- /dev/null +++ b/src/test/run-pass/issues/issue-20953.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let mut shrinker: Box> = Box::new(vec![1].into_iter()); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } + + let mut shrinker: &mut Iterator = &mut vec![1].into_iter(); + println!("{:?}", shrinker.next()); + for v in shrinker { assert!(false); } +} diff --git a/src/test/run-pass/issues/issue-21033.rs b/src/test/run-pass/issues/issue-21033.rs new file mode 100644 index 00000000000..f96d2db30d3 --- /dev/null +++ b/src/test/run-pass/issues/issue-21033.rs @@ -0,0 +1,57 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_patterns)] +#![feature(box_syntax)] + +enum E { + StructVar { boxed: Box } +} + +fn main() { + + // Test matching each shorthand notation for field patterns. + let mut a = E::StructVar { boxed: box 3 }; + match a { + E::StructVar { box boxed } => { } + } + match a { + E::StructVar { box ref boxed } => { } + } + match a { + E::StructVar { box mut boxed } => { } + } + match a { + E::StructVar { box ref mut boxed } => { } + } + match a { + E::StructVar { ref boxed } => { } + } + match a { + E::StructVar { ref mut boxed } => { } + } + match a { + E::StructVar { mut boxed } => { } + } + + // Test matching non shorthand notation. Recreate a since last test + // moved `boxed` + let mut a = E::StructVar { boxed: box 3 }; + match a { + E::StructVar { boxed: box ref mut num } => { } + } + match a { + E::StructVar { boxed: ref mut num } => { } + } + +} diff --git a/src/test/run-pass/issues/issue-21058.rs b/src/test/run-pass/issues/issue-21058.rs new file mode 100644 index 00000000000..318abfe691e --- /dev/null +++ b/src/test/run-pass/issues/issue-21058.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] + +struct NT(str); +struct DST { a: u32, b: str } + +fn main() { + // type_name should support unsized types + assert_eq!(unsafe {( + // Slice + std::intrinsics::type_name::<[u8]>(), + // str + std::intrinsics::type_name::(), + // Trait + std::intrinsics::type_name::(), + // Newtype + std::intrinsics::type_name::(), + // DST + std::intrinsics::type_name::() + )}, ("[u8]", "str", "dyn std::marker::Send", "NT", "DST")); +} diff --git a/src/test/run-pass/issues/issue-21140.rs b/src/test/run-pass/issues/issue-21140.rs new file mode 100644 index 00000000000..ebd5f6752e3 --- /dev/null +++ b/src/test/run-pass/issues/issue-21140.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Trait where Self::Out: std::fmt::Display { + type Out; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-21174.rs b/src/test/run-pass/issues/issue-21174.rs new file mode 100644 index 00000000000..3af5e5323a6 --- /dev/null +++ b/src/test/run-pass/issues/issue-21174.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Trait<'a> { + type A; + type B; +} + +fn foo<'a, T: Trait<'a>>(value: T::A) { + let new: T::B = unsafe { std::mem::transmute_copy(&value) }; +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-21245.rs b/src/test/run-pass/issues/issue-21245.rs new file mode 100644 index 00000000000..6bc14489d95 --- /dev/null +++ b/src/test/run-pass/issues/issue-21245.rs @@ -0,0 +1,65 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #21245. Check that we are able to infer +// the types in these examples correctly. It used to be that +// insufficient type propagation caused the type of the iterator to be +// incorrectly unified with the `*const` type to which it is coerced. + +// pretty-expanded FIXME #23616 + +use std::ptr; + +trait IntoIterator { + type Iter: Iterator; + + fn into_iter2(self) -> Self::Iter; +} + +impl IntoIterator for I where I: Iterator { + type Iter = I; + + fn into_iter2(self) -> I { + self + } +} + +fn desugared_for_loop_bad(v: Vec) { + match IntoIterator::into_iter2(v.iter()) { + mut iter => { + loop { + match ::std::iter::Iterator::next(&mut iter) { + ::std::option::Option::Some(x) => { + unsafe { ptr::read(x); } + }, + ::std::option::Option::None => break + } + } + } + } +} + +fn desugared_for_loop_good(v: Vec) { + match v.iter().into_iter() { + mut iter => { + loop { + match ::std::iter::Iterator::next(&mut iter) { + ::std::option::Option::Some(x) => { + unsafe { ptr::read(x); } + }, + ::std::option::Option::None => break + } + } + } + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-21291.rs b/src/test/run-pass/issues/issue-21291.rs new file mode 100644 index 00000000000..99912be8f8e --- /dev/null +++ b/src/test/run-pass/issues/issue-21291.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +// Regression test for unwrapping the result of `join`, issue #21291 + +use std::thread; + +fn main() { + thread::spawn(|| {}).join().unwrap() +} diff --git a/src/test/run-pass/issues/issue-21306.rs b/src/test/run-pass/issues/issue-21306.rs new file mode 100644 index 00000000000..e01f0aaac10 --- /dev/null +++ b/src/test/run-pass/issues/issue-21306.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::sync::Arc; + +fn main() { + let x = 5; + let command = Arc::new(Box::new(|| { x*2 })); + assert_eq!(command(), 10); +} diff --git a/src/test/run-pass/issues/issue-21361.rs b/src/test/run-pass/issues/issue-21361.rs new file mode 100644 index 00000000000..4a566d7f78f --- /dev/null +++ b/src/test/run-pass/issues/issue-21361.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let v = vec![1, 2, 3]; + let boxed: Box> = Box::new(v.into_iter()); + assert_eq!(boxed.max(), Some(3)); + + let v = vec![1, 2, 3]; + let boxed: &mut Iterator = &mut v.into_iter(); + assert_eq!(boxed.max(), Some(3)); +} diff --git a/src/test/run-pass/issues/issue-21363.rs b/src/test/run-pass/issues/issue-21363.rs new file mode 100644 index 00000000000..e7f7a80a1de --- /dev/null +++ b/src/test/run-pass/issues/issue-21363.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![no_implicit_prelude] + +trait Iterator { + type Item; + fn dummy(&self) { } +} + +impl<'a, T> Iterator for &'a mut (Iterator + 'a) { + type Item = T; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-21384.rs b/src/test/run-pass/issues/issue-21384.rs new file mode 100644 index 00000000000..eccd1208969 --- /dev/null +++ b/src/test/run-pass/issues/issue-21384.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use ::std::ops::RangeFull; + +fn test(arg: T) -> T { + arg.clone() +} + +#[derive(PartialEq, Debug)] +struct Test(isize); + +fn main() { + // Check that ranges implement clone + assert_eq!(test(1..5), (1..5)); + assert_eq!(test(..5), (..5)); + assert_eq!(test(1..), (1..)); + assert_eq!(test(RangeFull), (RangeFull)); + + // Check that ranges can still be used with non-clone limits + assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5))); +} diff --git a/src/test/run-pass/issues/issue-21400.rs b/src/test/run-pass/issues/issue-21400.rs new file mode 100644 index 00000000000..2c575d28e12 --- /dev/null +++ b/src/test/run-pass/issues/issue-21400.rs @@ -0,0 +1,67 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #21400 which itself was extracted from +// stackoverflow.com/questions/28031155/is-my-borrow-checker-drunk/28031580 + +fn main() { + let mut t = Test; + assert_eq!(t.method1("one"), Ok(1)); + assert_eq!(t.method2("two"), Ok(2)); + assert_eq!(t.test(), Ok(2)); +} + +struct Test; + +impl Test { + fn method1(&mut self, _arg: &str) -> Result { + Ok(1) + } + + fn method2(self: &mut Test, _arg: &str) -> Result { + Ok(2) + } + + fn test(self: &mut Test) -> Result { + let s = format!("abcde"); + // (Originally, this invocation of method2 was saying that `s` + // does not live long enough.) + let data = match self.method2(&*s) { + Ok(r) => r, + Err(e) => return Err(e) + }; + Ok(data) + } +} + +// Below is a closer match for the original test that was failing to compile + +pub struct GitConnect; + +impl GitConnect { + fn command(self: &mut GitConnect, _s: &str) -> Result>, &str> { + unimplemented!() + } + + pub fn git_upload_pack(self: &mut GitConnect) -> Result { + let c = format!("git-upload-pack"); + + let mut out = String::new(); + let data = self.command(&c)?; + + for line in data.iter() { + out.push_str(&format!("{:?}", line)); + } + + Ok(out) + } +} + diff --git a/src/test/run-pass/issues/issue-21402.rs b/src/test/run-pass/issues/issue-21402.rs new file mode 100644 index 00000000000..210ba0711b4 --- /dev/null +++ b/src/test/run-pass/issues/issue-21402.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(Hash)] +struct Foo { + a: Vec, + b: (bool, bool), + c: [bool; 2], +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-21475.rs b/src/test/run-pass/issues/issue-21475.rs new file mode 100644 index 00000000000..883d6d215bd --- /dev/null +++ b/src/test/run-pass/issues/issue-21475.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use m::{START, END}; + +fn main() { + match 42 { + m::START..=m::END => {}, + 0..=m::END => {}, + m::START..=59 => {}, + _ => {}, + } +} + +mod m { + pub const START: u32 = 4; + pub const END: u32 = 14; +} diff --git a/src/test/run-pass/issues/issue-21486.rs b/src/test/run-pass/issues/issue-21486.rs new file mode 100644 index 00000000000..faf9b42a0e8 --- /dev/null +++ b/src/test/run-pass/issues/issue-21486.rs @@ -0,0 +1,86 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #21486: Make sure that all structures are dropped, even when +// created via FRU and control-flow breaks in the middle of +// construction. + +use std::sync::atomic::{Ordering, AtomicUsize}; + +#[derive(Debug)] +struct Noisy(u8); +impl Drop for Noisy { + fn drop(&mut self) { + // println!("splat #{}", self.0); + event(self.0); + } +} + +#[allow(dead_code)] +#[derive(Debug)] +struct Foo { n0: Noisy, n1: Noisy } +impl Foo { + fn vals(&self) -> (u8, u8) { (self.n0.0, self.n1.0) } +} + +fn leak_1_ret() -> Foo { + let _old_foo = Foo { n0: Noisy(1), n1: Noisy(2) }; + Foo { n0: { return Foo { n0: Noisy(3), n1: Noisy(4) } }, + .._old_foo + }; +} + +fn leak_2_ret() -> Foo { + let _old_foo = Foo { n0: Noisy(1), n1: Noisy(2) }; + Foo { n1: { return Foo { n0: Noisy(3), n1: Noisy(4) } }, + .._old_foo + }; +} + +// In this case, the control flow break happens *before* we construct +// `Foo(Noisy(1),Noisy(2))`, so there should be no record of it in the +// event log. +fn leak_3_ret() -> Foo { + let _old_foo = || Foo { n0: Noisy(1), n1: Noisy(2) }; + Foo { n1: { return Foo { n0: Noisy(3), n1: Noisy(4) } }, + .._old_foo() + }; +} + +pub fn main() { + reset_log(); + assert_eq!(leak_1_ret().vals(), (3,4)); + assert_eq!(0x01_02_03_04, event_log()); + + reset_log(); + assert_eq!(leak_2_ret().vals(), (3,4)); + assert_eq!(0x01_02_03_04, event_log()); + + reset_log(); + assert_eq!(leak_3_ret().vals(), (3,4)); + assert_eq!(0x03_04, event_log()); +} + +static LOG: AtomicUsize = AtomicUsize::new(0); + +fn reset_log() { + LOG.store(0, Ordering::SeqCst); +} + +fn event_log() -> usize { + LOG.load(Ordering::SeqCst) +} + +fn event(tag: u8) { + let old_log = LOG.load(Ordering::SeqCst); + let new_log = (old_log << 8) + tag as usize; + LOG.store(new_log, Ordering::SeqCst); +} diff --git a/src/test/run-pass/issues/issue-21520.rs b/src/test/run-pass/issues/issue-21520.rs new file mode 100644 index 00000000000..71eb229ef00 --- /dev/null +++ b/src/test/run-pass/issues/issue-21520.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the requirement (in `Bar`) that `T::Bar : 'static` does +// not wind up propagating to `T`. + +// pretty-expanded FIXME #23616 + +pub trait Foo { + type Bar; + + fn foo(&self) -> Self; +} + +pub struct Static(T); + +struct Bar + where T::Bar : 'static +{ + x: Static> +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-21562.rs b/src/test/run-pass/issues/issue-21562.rs new file mode 100644 index 00000000000..6b876df9d04 --- /dev/null +++ b/src/test/run-pass/issues/issue-21562.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +extern crate core; +use core::marker::Sync; + +static SARRAY: [i32; 1] = [11]; + +struct MyStruct { + pub arr: *const [i32], +} +unsafe impl Sync for MyStruct {} + +static mystruct: MyStruct = MyStruct { + arr: &SARRAY +}; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-21622.rs b/src/test/run-pass/issues/issue-21622.rs new file mode 100644 index 00000000000..e7289e5d162 --- /dev/null +++ b/src/test/run-pass/issues/issue-21622.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Index; + +impl Index { + fn new() -> Self { Index } +} + +fn user() { + let new = Index::new; + + fn inner() { + let index = Index::new(); + } + + let index2 = new(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-21634.rs b/src/test/run-pass/issues/issue-21634.rs new file mode 100644 index 00000000000..8c914ac5adc --- /dev/null +++ b/src/test/run-pass/issues/issue-21634.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(cfg_target_feature)] + +#[cfg(any(not(target_arch = "x86"), target_feature = "sse2"))] +fn main() { + if let Ok(x) = "3.1415".parse::() { + assert_eq!(false, x <= 0.0); + } + if let Ok(x) = "3.1415".parse::() { + assert_eq!(3.1415, x + 0.0); + } + if let Ok(mut x) = "3.1415".parse::() { + assert_eq!(8.1415, { x += 5.0; x }); + } +} + +#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))] +fn main() {} diff --git a/src/test/run-pass/issues/issue-21655.rs b/src/test/run-pass/issues/issue-21655.rs new file mode 100644 index 00000000000..208a5a3f926 --- /dev/null +++ b/src/test/run-pass/issues/issue-21655.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn test(it: &mut Iterator) { + for x in it { + assert_eq!(x, 1) + } +} + +fn main() { + let v = vec![1]; + test(&mut v.into_iter()) +} diff --git a/src/test/run-pass/issues/issue-21721.rs b/src/test/run-pass/issues/issue-21721.rs new file mode 100644 index 00000000000..adda70a0f79 --- /dev/null +++ b/src/test/run-pass/issues/issue-21721.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + static NONE: Option<((), &'static u8)> = None; + let ptr = unsafe { + *(&NONE as *const _ as *const *const u8) + }; + assert!(ptr.is_null()); +} diff --git a/src/test/run-pass/issues/issue-21726.rs b/src/test/run-pass/issues/issue-21726.rs new file mode 100644 index 00000000000..49369759929 --- /dev/null +++ b/src/test/run-pass/issues/issue-21726.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #21726: an issue arose around the rules for +// subtyping of projection types that resulted in an unconstrained +// region, yielding region inference failures. + +// pretty-expanded FIXME #23616 + +fn main() { } + +fn foo<'a>(s: &'a str) { + let b: B<()> = B::new(s, ()); + b.get_short(); +} + +trait IntoRef<'a> { + type T: Clone; + fn into_ref(self, _: &'a str) -> Self::T; +} + +impl<'a> IntoRef<'a> for () { + type T = &'a str; + fn into_ref(self, s: &'a str) -> &'a str { + s + } +} + +struct B<'a, P: IntoRef<'a>>(P::T); + +impl<'a, P: IntoRef<'a>> B<'a, P> { + fn new(s: &'a str, i: P) -> B<'a, P> { + B(i.into_ref(s)) + } + + fn get_short(&self) -> P::T { + self.0.clone() + } +} diff --git a/src/test/run-pass/issues/issue-21891.rs b/src/test/run-pass/issues/issue-21891.rs new file mode 100644 index 00000000000..1e577ba7303 --- /dev/null +++ b/src/test/run-pass/issues/issue-21891.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 + +static foo: [usize; 3] = [1, 2, 3]; + +static slice_1: &'static [usize] = &foo; +static slice_2: &'static [usize] = &foo; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2190-1.rs b/src/test/run-pass/issues/issue-2190-1.rs new file mode 100644 index 00000000000..2d7a7382f0b --- /dev/null +++ b/src/test/run-pass/issues/issue-2190-1.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 +// ignore-emscripten no threads + +use std::thread::Builder; + +static generations: usize = 1024+256+128+49; + +fn spawn(mut f: Box) { + Builder::new().stack_size(32 * 1024).spawn(move|| f()); +} + +fn child_no(x: usize) -> Box { + Box::new(move|| { + if x < generations { + spawn(child_no(x+1)); + } + }) +} + +pub fn main() { + spawn(child_no(0)); +} diff --git a/src/test/run-pass/issues/issue-21909.rs b/src/test/run-pass/issues/issue-21909.rs new file mode 100644 index 00000000000..ad5f1611e6f --- /dev/null +++ b/src/test/run-pass/issues/issue-21909.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait A { + fn dummy(&self, arg: X); +} + +trait B { + type X; + type Y: A; + + fn dummy(&self); +} + +fn main () { } diff --git a/src/test/run-pass/issues/issue-21922.rs b/src/test/run-pass/issues/issue-21922.rs new file mode 100644 index 00000000000..79e9976672e --- /dev/null +++ b/src/test/run-pass/issues/issue-21922.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Add; +fn show(z: i32) { + println!("{}", z) +} +fn main() { + let x = 23; + let y = 42; + show(Add::add( x, y)); + show(Add::add( x, &y)); + show(Add::add(&x, y)); + show(Add::add(&x, &y)); + show( x + y); + show( x + &y); + show(&x + y); + show(&x + &y); +} diff --git a/src/test/run-pass/issues/issue-22008.rs b/src/test/run-pass/issues/issue-22008.rs new file mode 100644 index 00000000000..54882cda624 --- /dev/null +++ b/src/test/run-pass/issues/issue-22008.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let command = "a"; + + match command { + "foo" => println!("foo"), + _ => println!("{}", command), + } +} diff --git a/src/test/run-pass/issues/issue-22036.rs b/src/test/run-pass/issues/issue-22036.rs new file mode 100644 index 00000000000..b814712b91a --- /dev/null +++ b/src/test/run-pass/issues/issue-22036.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait DigitCollection: Sized { + type Iter: Iterator; + fn digit_iter(self) -> Self::Iter; + + fn digit_sum(self) -> u32 { + self.digit_iter() + .map(|digit: u8| digit as u32) + .fold(0, |sum, digit| sum + digit) + } +} + +impl DigitCollection for I where I: Iterator { + type Iter = I; + + fn digit_iter(self) -> I { + self + } +} + +fn main() { + let xs = vec![1, 2, 3, 4, 5]; + assert_eq!(xs.into_iter().digit_sum(), 15); +} diff --git a/src/test/run-pass/issues/issue-22066.rs b/src/test/run-pass/issues/issue-22066.rs new file mode 100644 index 00000000000..ef4753703bf --- /dev/null +++ b/src/test/run-pass/issues/issue-22066.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait LineFormatter<'a> { + type Iter: Iterator + 'a; + fn iter(&'a self, line: &'a str) -> Self::Iter; + + fn dimensions(&'a self, line: &'a str) { + let iter: Self::Iter = self.iter(line); + <_ as IntoIterator>::into_iter(iter); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2214.rs b/src/test/run-pass/issues/issue-2214.rs new file mode 100644 index 00000000000..8329847d3c5 --- /dev/null +++ b/src/test/run-pass/issues/issue-2214.rs @@ -0,0 +1,51 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +extern crate libc; + +use std::mem; +use libc::{c_double, c_int}; + +fn to_c_int(v: &mut isize) -> &mut c_int { + unsafe { + mem::transmute_copy(&v) + } +} + +fn lgamma(n: c_double, value: &mut isize) -> c_double { + unsafe { + return m::lgamma(n, to_c_int(value)); + } +} + +mod m { + use libc::{c_double, c_int}; + + #[link_name = "m"] + extern { + #[cfg(any(unix, target_os = "cloudabi"))] + #[link_name="lgamma_r"] + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + #[cfg(windows)] + #[link_name="lgamma"] + pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; + } +} + +pub fn main() { + let mut y: isize = 5; + let x: &mut isize = &mut y; + assert_eq!(lgamma(1.0 as c_double, x), 0.0 as c_double); +} diff --git a/src/test/run-pass/issues/issue-2216.rs b/src/test/run-pass/issues/issue-2216.rs new file mode 100644 index 00000000000..9283cd93fa3 --- /dev/null +++ b/src/test/run-pass/issues/issue-2216.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let mut x = 0; + + 'foo: loop { + 'bar: loop { + 'quux: loop { + if 1 == 2 { + break 'foo; + } + else { + break 'bar; + } + } + continue 'foo; + } + x = 42; + break; + } + + println!("{}", x); + assert_eq!(x, 42); +} diff --git a/src/test/run-pass/issues/issue-22258.rs b/src/test/run-pass/issues/issue-22258.rs new file mode 100644 index 00000000000..6f97da9b5b5 --- /dev/null +++ b/src/test/run-pass/issues/issue-22258.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Add; + +fn f(a: T, b: T) -> ::Output { + a + b +} + +fn main() { + println!("a + b is {}", f::(100f32, 200f32)); +} diff --git a/src/test/run-pass/issues/issue-22346.rs b/src/test/run-pass/issues/issue-22346.rs new file mode 100644 index 00000000000..6689b6081ec --- /dev/null +++ b/src/test/run-pass/issues/issue-22346.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +// This used to cause an ICE because the retslot for the "return" had the wrong type +fn testcase<'a>() -> Box + 'a> { + return Box::new((0..3).map(|i| { return i; })); +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-22356.rs b/src/test/run-pass/issues/issue-22356.rs new file mode 100644 index 00000000000..6e62ae06982 --- /dev/null +++ b/src/test/run-pass/issues/issue-22356.rs @@ -0,0 +1,44 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(type_alias_bounds)] + +// pretty-expanded FIXME #23616 + +use std::marker::PhantomData; + +pub struct Handle(T, I); + +impl Handle { + pub fn get_info(&self) -> &I { + let Handle(_, ref info) = *self; + info + } +} + +pub struct BufferHandle { + raw: RawBufferHandle, + _marker: PhantomData, +} + +impl BufferHandle { + pub fn get_info(&self) -> &String { + self.raw.get_info() + } +} + +pub type RawBufferHandle = Handle<::Buffer, String>; + +pub trait Device { + type Buffer; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-22375.rs b/src/test/run-pass/issues/issue-22375.rs new file mode 100644 index 00000000000..cf7ff0c404c --- /dev/null +++ b/src/test/run-pass/issues/issue-22375.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait A> {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-22403.rs b/src/test/run-pass/issues/issue-22403.rs new file mode 100644 index 00000000000..76c4af1140b --- /dev/null +++ b/src/test/run-pass/issues/issue-22403.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let x = Box::new([1, 2, 3]); + let y = x as Box<[i32]>; + println!("y: {:?}", y); +} diff --git a/src/test/run-pass/issues/issue-22426.rs b/src/test/run-pass/issues/issue-22426.rs new file mode 100644 index 00000000000..8056b74ff8e --- /dev/null +++ b/src/test/run-pass/issues/issue-22426.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + match 42 { + x if x < 7 => (), + _ => () + } +} diff --git a/src/test/run-pass/issues/issue-22463.rs b/src/test/run-pass/issues/issue-22463.rs new file mode 100644 index 00000000000..e308b65ec87 --- /dev/null +++ b/src/test/run-pass/issues/issue-22463.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! items { + () => { + type A = (); + fn a() {} + } +} + +trait Foo { + type A; + fn a(); +} + +impl Foo for () { + items!(); +} + +fn main() { + +} diff --git a/src/test/run-pass/issues/issue-22471.rs b/src/test/run-pass/issues/issue-22471.rs new file mode 100644 index 00000000000..87b4bc1734b --- /dev/null +++ b/src/test/run-pass/issues/issue-22471.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(type_alias_bounds)] + +type Foo where T: Copy = Box; + +fn main(){} diff --git a/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs b/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs new file mode 100644 index 00000000000..116d0620136 --- /dev/null +++ b/src/test/run-pass/issues/issue-22536-copy-mustnt-zero.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for Issue #22536: If a type implements Copy, then +// moving it must not zero the original memory. + + +trait Resources { + type Buffer: Copy; + fn foo(&self) {} +} + +struct BufferHandle { + raw: ::Buffer, +} +impl Copy for BufferHandle {} +impl Clone for BufferHandle { + fn clone(&self) -> BufferHandle { *self } +} + +enum Res {} +impl Resources for Res { + type Buffer = u32; +} + +fn main() { + let b: BufferHandle = BufferHandle { raw: 1 }; + let c = b; + assert_eq!(c.raw, b.raw) +} diff --git a/src/test/run-pass/issues/issue-22546.rs b/src/test/run-pass/issues/issue-22546.rs new file mode 100644 index 00000000000..28aaae1d8cc --- /dev/null +++ b/src/test/run-pass/issues/issue-22546.rs @@ -0,0 +1,61 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Parsing patterns with paths with type parameters (issue #22544) + +use std::default::Default; + +#[derive(Default)] +pub struct Foo(T, T); + +impl Foo { + fn foo(&self) { + match *self { + Foo::(ref x, ref y) => println!("Goodbye, World! {} {}", x, y) + } + } +} + +trait Tr { + type U; +} + +impl Tr for Foo { + type U = T; +} + +struct Wrapper { + value: T +} + +fn main() { + let Foo::(a, b) = Default::default(); + + let f = Foo(2,3); + f.foo(); + + let w = Wrapper { value: Foo(10u8, 11u8) }; + match w { + Wrapper::> { value: Foo(10, 11) } => {}, + ::Wrapper::< as Tr>::U> { value: Foo::(11, 16) } => { panic!() }, + _ => { panic!() } + } + + if let None:: = Some(8) { + panic!(); + } + if let None:: { .. } = Some(8) { + panic!(); + } + if let Option::None:: { .. } = Some(8) { + panic!(); + } +} diff --git a/src/test/run-pass/issues/issue-22577.rs b/src/test/run-pass/issues/issue-22577.rs new file mode 100644 index 00000000000..774416c9251 --- /dev/null +++ b/src/test/run-pass/issues/issue-22577.rs @@ -0,0 +1,36 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +// ignore-cloudabi no std::fs + +use std::{fs, net}; + +fn assert_both() {} +fn assert_send() {} + +fn main() { + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); + assert_both::(); +} diff --git a/src/test/run-pass/issues/issue-22629.rs b/src/test/run-pass/issues/issue-22629.rs new file mode 100644 index 00000000000..9254a080794 --- /dev/null +++ b/src/test/run-pass/issues/issue-22629.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test transitive analysis for associated types. Collected types +// should be normalized and new obligations generated. + +// pretty-expanded FIXME #23616 + +use std::borrow::{ToOwned, Cow}; + +fn assert_send(_: T) {} + +fn main() { + assert_send(Cow::Borrowed("foo")); +} diff --git a/src/test/run-pass/issues/issue-22777.rs b/src/test/run-pass/issues/issue-22777.rs new file mode 100644 index 00000000000..92ad7a43d4d --- /dev/null +++ b/src/test/run-pass/issues/issue-22777.rs @@ -0,0 +1,58 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test is reduced from libsyntax. It is just checking that we +// can successfully deal with a "deep" structure, which the drop-check +// was hitting a recursion limit on at one point. + +// pretty-expanded FIXME #23616 + +#![allow(non_camel_case_types)] + +pub fn noop_fold_impl_item() -> SmallVector { + loop { } +} + +pub struct SmallVector(P); +pub struct ImplItem(P); + +struct P(Box); + +struct S01_Method(P); +struct S02_Generics(P); +struct S03_TyParam(P); +struct S04_TyParamBound(S05_PolyTraitRef); +struct S05_PolyTraitRef(S06_TraitRef); +struct S06_TraitRef(S07_Path); +struct S07_Path(Vec); +struct S08_PathSegment(S09_GenericArgs); +struct S09_GenericArgs(P); +struct S10_ParenthesizedParameterData(Option>); +struct S11_Ty(P); +struct S12_Expr(P); +struct S13_Block(Vec>); +struct S14_Stmt(P); +struct S15_Decl(P); +struct S16_Local(P); +struct S17_Pat(P); +struct S18_Mac(Vec>); +struct S19_TokenTree(P); +struct S20_Token(P); +struct S21_Nonterminal(P); +struct S22_Item(P); +struct S23_EnumDef(Vec>); +struct S24_Variant(P); +struct S25_VariantKind(P); +struct S26_StructDef(Vec>); +struct S27_StructField(P); +struct S28_StructFieldKind; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-22781.rs b/src/test/run-pass/issues/issue-22781.rs new file mode 100644 index 00000000000..af95b6e1d1a --- /dev/null +++ b/src/test/run-pass/issues/issue-22781.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::HashMap; +use std::collections::hash_map::Entry::Vacant; + +pub fn foo() { + type F = Box; + let mut map: HashMap<(), F> = HashMap::new(); + let x: &mut F = match map.entry(()) { + Vacant(_) => unimplemented!(), + _ => unimplemented!() + }; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-22814.rs b/src/test/run-pass/issues/issue-22814.rs new file mode 100644 index 00000000000..13c7dab3751 --- /dev/null +++ b/src/test/run-pass/issues/issue-22814.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Test {} + +macro_rules! test { +( $($name:ident)+) => ( + impl<$($name: Test),*> Test for ($($name,)*) { + } +) +} + +test!(A B C); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-22828.rs b/src/test/run-pass/issues/issue-22828.rs new file mode 100644 index 00000000000..cc92f080936 --- /dev/null +++ b/src/test/run-pass/issues/issue-22828.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test transitive analysis for associated types. Collected types +// should be normalized and new obligations generated. + +// pretty-expanded FIXME #23616 + +trait Foo { + type A; + fn foo(&self) {} +} + +impl Foo for usize { + type A = usize; +} + +struct Bar { inner: T::A } + +fn is_send() {} + +fn main() { + is_send::>(); +} diff --git a/src/test/run-pass/issues/issue-2284.rs b/src/test/run-pass/issues/issue-2284.rs new file mode 100644 index 00000000000..77d1d6e0aa2 --- /dev/null +++ b/src/test/run-pass/issues/issue-2284.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Send { + fn f(&self); +} + +fn f(t: T) { + t.f(); +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-22864-1.rs b/src/test/run-pass/issues/issue-22864-1.rs new file mode 100644 index 00000000000..e70e199bc2f --- /dev/null +++ b/src/test/run-pass/issues/issue-22864-1.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + struct Fun(F); + let f = Fun(|x| 3*x); + let Fun(g) = f; + println!("{:?}",g(4)); +} diff --git a/src/test/run-pass/issues/issue-22864-2.rs b/src/test/run-pass/issues/issue-22864-2.rs new file mode 100644 index 00000000000..dea4ec49aad --- /dev/null +++ b/src/test/run-pass/issues/issue-22864-2.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +pub fn main() { + let f = || || 0; + std::thread::spawn(f()); +} diff --git a/src/test/run-pass/issues/issue-2288.rs b/src/test/run-pass/issues/issue-2288.rs new file mode 100644 index 00000000000..6185aaca6cf --- /dev/null +++ b/src/test/run-pass/issues/issue-2288.rs @@ -0,0 +1,45 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#![feature(box_syntax)] + +trait clam { + fn chowder(&self, y: A); +} + +#[derive(Copy, Clone)] +struct foo { + x: A, +} + +impl clam for foo { + fn chowder(&self, _y: A) { + } +} + +fn foo(b: A) -> foo { + foo { + x: b + } +} + +fn f(x: Box>, a: A) { + x.chowder(a); +} + +pub fn main() { + + let c = foo(42); + let d: Box> = box c as Box>; + f(d, c.x); +} diff --git a/src/test/run-pass/issues/issue-22894.rs b/src/test/run-pass/issues/issue-22894.rs new file mode 100644 index 00000000000..d1cd8efd73c --- /dev/null +++ b/src/test/run-pass/issues/issue-22894.rs @@ -0,0 +1,14 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[allow(dead_code)] +static X: &'static str = &*""; +fn main() {} diff --git a/src/test/run-pass/issues/issue-22992-2.rs b/src/test/run-pass/issues/issue-22992-2.rs new file mode 100644 index 00000000000..ccf5354b4ee --- /dev/null +++ b/src/test/run-pass/issues/issue-22992-2.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct A(B); +struct B; + +use std::ops::Deref; + +impl Deref for A { + type Target = B; + fn deref(&self) -> &B { &self.0 } +} + +impl B { + fn foo(&self) {} +} + +fn main() { + A(B).foo(); +} diff --git a/src/test/run-pass/issues/issue-22992.rs b/src/test/run-pass/issues/issue-22992.rs new file mode 100644 index 00000000000..18f5021f49e --- /dev/null +++ b/src/test/run-pass/issues/issue-22992.rs @@ -0,0 +1,86 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37201 + +struct X { val: i32 } +impl std::ops::Deref for X { + type Target = i32; + fn deref(&self) -> &i32 { &self.val } +} + + +trait M { fn m(self); } +impl M for i32 { fn m(self) { println!("i32::m()"); } } +impl M for X { fn m(self) { println!("X::m()"); } } +impl<'a> M for &'a X { fn m(self) { println!("&X::m()"); } } +impl<'a, 'b> M for &'a &'b X { fn m(self) { println!("&&X::m()"); } } +impl<'a, 'b, 'c> M for &'a &'b &'c X { fn m(self) { println!("&&&X::m()"); } } + +trait RefM { fn refm(&self); } +impl RefM for i32 { fn refm(&self) { println!("i32::refm()"); } } +impl RefM for X { fn refm(&self) { println!("X::refm()"); } } +impl<'a> RefM for &'a X { fn refm(&self) { println!("&X::refm()"); } } +impl<'a, 'b> RefM for &'a &'b X { fn refm(&self) { println!("&&X::refm()"); } } +impl<'a, 'b, 'c> RefM for &'a &'b &'c X { fn refm(&self) { println!("&&&X::refm()"); } } + +struct Y { val: i32 } +impl std::ops::Deref for Y { + type Target = i32; + fn deref(&self) -> &i32 { &self.val } +} + +struct Z { val: Y } +impl std::ops::Deref for Z { + type Target = Y; + fn deref(&self) -> &Y { &self.val } +} + +struct A; +impl std::marker::Copy for A {} +impl Clone for A { fn clone(&self) -> Self { *self } } +impl M for A { fn m(self) { println!("A::m()"); } } +impl<'a, 'b, 'c> M for &'a &'b &'c A { fn m(self) { println!("&&&A::m()"); } } +impl RefM for A { fn refm(&self) { println!("A::refm()"); } } +impl<'a, 'b, 'c> RefM for &'a &'b &'c A { fn refm(&self) { println!("&&&A::refm()"); } } + +fn main() { + // I'll use @ to denote left side of the dot operator + (*X{val:42}).m(); // i32::refm() , self == @ + X{val:42}.m(); // X::m() , self == @ + (&X{val:42}).m(); // &X::m() , self == @ + (&&X{val:42}).m(); // &&X::m() , self == @ + (&&&X{val:42}).m(); // &&&X:m() , self == @ + (&&&&X{val:42}).m(); // &&&X::m() , self == *@ + (&&&&&X{val:42}).m(); // &&&X::m() , self == **@ + + (*X{val:42}).refm(); // i32::refm() , self == @ + X{val:42}.refm(); // X::refm() , self == @ + (&X{val:42}).refm(); // X::refm() , self == *@ + (&&X{val:42}).refm(); // &X::refm() , self == *@ + (&&&X{val:42}).refm(); // &&X::refm() , self == *@ + (&&&&X{val:42}).refm(); // &&&X::refm(), self == *@ + (&&&&&X{val:42}).refm(); // &&&X::refm(), self == **@ + + Y{val:42}.refm(); // i32::refm() , self == *@ + Z{val:Y{val:42}}.refm(); // i32::refm() , self == **@ + + A.m(); // A::m() , self == @ + // without the Copy trait, (&A).m() would be a compilation error: + // cannot move out of borrowed content + (&A).m(); // A::m() , self == *@ + (&&A).m(); // &&&A::m() , self == &@ + (&&&A).m(); // &&&A::m() , self == @ + A.refm(); // A::refm() , self == @ + (&A).refm(); // A::refm() , self == *@ + (&&A).refm(); // A::refm() , self == **@ + (&&&A).refm(); // &&&A::refm(), self == @ +} diff --git a/src/test/run-pass/issues/issue-23036.rs b/src/test/run-pass/issues/issue-23036.rs new file mode 100644 index 00000000000..4017ae1731c --- /dev/null +++ b/src/test/run-pass/issues/issue-23036.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no std::path + +use std::collections::HashMap; +use std::path::Path; + +fn main() { + let mut map = HashMap::new(); + map.insert(Path::new("a"), 0); + map.get(Path::new("a")); +} diff --git a/src/test/run-pass/issues/issue-2311-2.rs b/src/test/run-pass/issues/issue-2311-2.rs new file mode 100644 index 00000000000..8cfd941cca8 --- /dev/null +++ b/src/test/run-pass/issues/issue-2311-2.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +trait clam { + fn get(self) -> A; +} + +struct foo { + x: A, +} + +impl foo { + pub fn bar>(&self, _c: C) -> B { + panic!(); + } +} + +fn foo(b: A) -> foo { + foo { + x: b + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-2311.rs b/src/test/run-pass/issues/issue-2311.rs new file mode 100644 index 00000000000..816754c4617 --- /dev/null +++ b/src/test/run-pass/issues/issue-2311.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +trait clam { fn get(self) -> A; } +trait foo { + fn bar>(&self, c: C) -> B; +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-2312.rs b/src/test/run-pass/issues/issue-2312.rs new file mode 100644 index 00000000000..33a033ef37f --- /dev/null +++ b/src/test/run-pass/issues/issue-2312.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Testing that the B's are resolved + + +trait clam { fn get(self) -> A; } + +struct foo(isize); + +impl foo { + pub fn bar>(&self, _c: C) -> B { panic!(); } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-2316-c.rs b/src/test/run-pass/issues/issue-2316-c.rs new file mode 100644 index 00000000000..b7a4b6b31e4 --- /dev/null +++ b/src/test/run-pass/issues/issue-2316-c.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_2316_a.rs +// aux-build:issue_2316_b.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_2316_b; +use issue_2316_b::cloth; + +pub fn main() { + let _c: cloth::fabric = cloth::fabric::calico; +} diff --git a/src/test/run-pass/issues/issue-23208.rs b/src/test/run-pass/issues/issue-23208.rs new file mode 100644 index 00000000000..78384017ebc --- /dev/null +++ b/src/test/run-pass/issues/issue-23208.rs @@ -0,0 +1,36 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait TheTrait : TheSuperTrait<::Item> { + type Item; +} + +trait TheSuperTrait { + fn get(&self) -> T; +} + +impl TheTrait for i32 { + type Item = u32; +} + +impl TheSuperTrait for i32 { + fn get(&self) -> u32 { + *self as u32 + } +} + +fn foo>(t: &T) -> u32 { + t.get() +} + +fn main() { + foo::(&22); +} diff --git a/src/test/run-pass/issues/issue-23261.rs b/src/test/run-pass/issues/issue-23261.rs new file mode 100644 index 00000000000..08f178beaf3 --- /dev/null +++ b/src/test/run-pass/issues/issue-23261.rs @@ -0,0 +1,71 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Matching on a DST struct should not trigger an LLVM assertion. + +struct Foo { + a: i32, + inner: T +} + +trait Get { + fn get(&self) -> i32; +} + +impl Get for i32 { + fn get(&self) -> i32 { + *self + } +} + +fn check_val(val: &Foo<[u8]>) { + match *val { + Foo { a, .. } => { + assert_eq!(a, 32); + } + } +} + +fn check_dst_val(val: &Foo<[u8]>) { + match *val { + Foo { ref inner, .. } => { + assert_eq!(inner, [1, 2, 3]); + } + } +} + +fn check_both(val: &Foo<[u8]>) { + match *val { + Foo { a, ref inner } => { + assert_eq!(a, 32); + assert_eq!(inner, [1, 2, 3]); + } + } +} + +fn check_trait_obj(val: &Foo) { + match *val { + Foo { a, ref inner } => { + assert_eq!(a, 32); + assert_eq!(inner.get(), 32); + } + } +} + +fn main() { + let foo: &Foo<[u8]> = &Foo { a: 32, inner: [1, 2, 3] }; + check_val(foo); + check_dst_val(foo); + check_both(foo); + + let foo: &Foo = &Foo { a: 32, inner: 32 }; + check_trait_obj(foo); +} diff --git a/src/test/run-pass/issues/issue-23304-1.rs b/src/test/run-pass/issues/issue-23304-1.rs new file mode 100644 index 00000000000..0a6b4e41e2e --- /dev/null +++ b/src/test/run-pass/issues/issue-23304-1.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +#[repr(u8)] +#[allow(dead_code)] +enum ValueType { + DOUBLE = 0x00, + INT32 = 0x01, +} + +#[repr(u32)] +enum ValueTag { + INT32 = 0x1FFF0u32 | (ValueType::INT32 as u32), + X, +} + +#[repr(u64)] +enum ValueShiftedTag { + INT32 = ValueTag::INT32 as u64, + X, +} + +fn main() { + println!("{}", ValueTag::INT32 as u32); +} diff --git a/src/test/run-pass/issues/issue-23304-2.rs b/src/test/run-pass/issues/issue-23304-2.rs new file mode 100644 index 00000000000..511bec0dde9 --- /dev/null +++ b/src/test/run-pass/issues/issue-23304-2.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +enum X { A = 42 as isize } + +enum Y { A = X::A as isize } + +fn main() { + let x = X::A; + let x = x as isize; + assert_eq!(x, 42); + assert_eq!(Y::A as isize, 42); +} diff --git a/src/test/run-pass/issues/issue-23311.rs b/src/test/run-pass/issues/issue-23311.rs new file mode 100644 index 00000000000..3c91f5e1dfe --- /dev/null +++ b/src/test/run-pass/issues/issue-23311.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we do not ICE when pattern matching an array against a slice. + +#![feature(slice_patterns)] + +fn main() { + match "foo".as_bytes() { + b"food" => (), + &[b'f', ..] => (), + _ => () + } +} diff --git a/src/test/run-pass/issues/issue-23336.rs b/src/test/run-pass/issues/issue-23336.rs new file mode 100644 index 00000000000..0f0477bf844 --- /dev/null +++ b/src/test/run-pass/issues/issue-23336.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Data { fn doit(&self) {} } +impl Data for T {} +pub trait UnaryLogic { type D: Data; } +impl UnaryLogic for () { type D = i32; } + +pub fn crashes(t: T::D) { + t.doit(); +} + +fn main() { crashes::<()>(0); } diff --git a/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs b/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs new file mode 100644 index 00000000000..f1029a8c49a --- /dev/null +++ b/src/test/run-pass/issues/issue-23338-ensure-param-drop-order.rs @@ -0,0 +1,174 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// ignore-pretty issue #37201 + +// This test is ensuring that parameters are indeed dropped after +// temporaries in a fn body. + +use std::cell::RefCell; + +use self::d::D; + +pub fn main() { + let log = RefCell::new(vec![]); + d::println("created empty log"); + test(&log); + + assert_eq!(&log.borrow()[..], + [ + // created empty log + // +-- Make D(da_0, 0) + // | +-- Make D(de_1, 1) + // | | calling foo + // | | entered foo + // | | +-- Make D(de_2, 2) + // | | | +-- Make D(da_1, 3) + // | | | | +-- Make D(de_3, 4) + // | | | | | +-- Make D(de_4, 5) + 3, // | | | +-- Drop D(da_1, 3) + // | | | | | + 4, // | | | +-- Drop D(de_3, 4) + // | | | | + // | | | | eval tail of foo + // | | | +-- Make D(de_5, 6) + // | | | | +-- Make D(de_6, 7) + 5, // | | | | | +-- Drop D(de_4, 5) + // | | | | | + 2, // | | +-- Drop D(de_2, 2) + // | | | | + 6, // | | +-- Drop D(de_5, 6) + // | | | + 1, // | +-- Drop D(de_1, 1) + // | | + 0, // +-- Drop D(da_0, 0) + // | + // | result D(de_6, 7) + 7 // +-- Drop D(de_6, 7) + + ]); +} + +fn test<'a>(log: d::Log<'a>) { + let da = D::new("da", 0, log); + let de = D::new("de", 1, log); + d::println("calling foo"); + let result = foo(da, de); + d::println(&format!("result {}", result)); +} + +fn foo<'a>(da0: D<'a>, de1: D<'a>) -> D<'a> { + d::println("entered foo"); + let de2 = de1.incr(); // creates D(de_2, 2) + let de4 = { + let _da1 = da0.incr(); // creates D(da_1, 3) + de2.incr().incr() // creates D(de_3, 4) and D(de_4, 5) + }; + d::println("eval tail of foo"); + de4.incr().incr() // creates D(de_5, 6) and D(de_6, 7) +} + +// This module provides simultaneous printouts of the dynamic extents +// of all of the D values, in addition to logging the order that each +// is dropped. + +const PREF_INDENT: u32 = 16; + +pub mod d { + #![allow(unused_parens)] + use std::fmt; + use std::mem; + use std::cell::RefCell; + + static mut counter: u32 = 0; + static mut trails: u64 = 0; + + pub type Log<'a> = &'a RefCell>; + + pub fn current_width() -> u32 { + unsafe { max_width() - trails.leading_zeros() } + } + + pub fn max_width() -> u32 { + unsafe { + (mem::size_of_val(&trails)*8) as u32 + } + } + + pub fn indent_println(my_trails: u32, s: &str) { + let mut indent: String = String::new(); + for i in 0..my_trails { + unsafe { + if trails & (1 << i) != 0 { + indent = indent + "| "; + } else { + indent = indent + " "; + } + } + } + println!("{}{}", indent, s); + } + + pub fn println(s: &str) { + indent_println(super::PREF_INDENT, s); + } + + fn first_avail() -> u32 { + unsafe { + for i in 0..64 { + if trails & (1 << i) == 0 { + return i; + } + } + } + panic!("exhausted trails"); + } + + pub struct D<'a> { + name: &'static str, i: u32, uid: u32, trail: u32, log: Log<'a> + } + + impl<'a> fmt::Display for D<'a> { + fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { + write!(w, "D({}_{}, {})", self.name, self.i, self.uid) + } + } + + impl<'a> D<'a> { + pub fn new(name: &'static str, i: u32, log: Log<'a>) -> D<'a> { + unsafe { + let trail = first_avail(); + let ctr = counter; + counter += 1; + trails |= (1 << trail); + let ret = D { + name: name, i: i, log: log, uid: ctr, trail: trail + }; + indent_println(trail, &format!("+-- Make {}", ret)); + ret + } + } + pub fn incr(&self) -> D<'a> { + D::new(self.name, self.i + 1, self.log) + } + } + + impl<'a> Drop for D<'a> { + fn drop(&mut self) { + unsafe { trails &= !(1 << self.trail); }; + self.log.borrow_mut().push(self.uid); + indent_println(self.trail, &format!("+-- Drop {}", self)); + indent_println(::PREF_INDENT, ""); + } + } +} diff --git a/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs b/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs new file mode 100644 index 00000000000..e5eb41b235d --- /dev/null +++ b/src/test/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is largely checking that we now accept code where temp values +// are borrowing from the input parameters (the `foo` case below). +// +// Compare to run-pass/issue-23338-params-outlive-temps-of-body.rs +// +// (The `foo2` case is just for parity with the above test, which +// shows what happens when you move the `y`-binding to the inside of +// the inner block.) + +use std::cell::RefCell; + +fn foo(x: RefCell) -> String { + x.borrow().clone() +} + +fn foo2(x: RefCell) -> String { + let y = x; + let ret = { + y.borrow().clone() + }; + ret +} + +pub 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/run-pass/issues/issue-23406.rs b/src/test/run-pass/issues/issue-23406.rs new file mode 100644 index 00000000000..fb44e2d9270 --- /dev/null +++ b/src/test/run-pass/issues/issue-23406.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Inner { + type T; +} + +impl<'a> Inner for &'a i32 { + type T = i32; +} + +fn f<'a>(x: &'a i32) -> <&'a i32 as Inner>::T { + *x +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-23433.rs b/src/test/run-pass/issues/issue-23433.rs new file mode 100644 index 00000000000..9c1e9b00000 --- /dev/null +++ b/src/test/run-pass/issues/issue-23433.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Don't fail if we encounter a NonNull where T is an unsized type + +use std::ptr::NonNull; + +fn main() { + let mut a = [0u8; 5]; + let b: Option> = Some(NonNull::from(&mut a)); + match b { + Some(_) => println!("Got `Some`"), + None => panic!("Unexpected `None`"), + } +} diff --git a/src/test/run-pass/issues/issue-23442.rs b/src/test/run-pass/issues/issue-23442.rs new file mode 100644 index 00000000000..9f39b30f107 --- /dev/null +++ b/src/test/run-pass/issues/issue-23442.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::marker::PhantomData; + +pub struct UnionedKeys<'a,K> + where K: UnifyKey + 'a +{ + table: &'a mut UnificationTable, + root_key: K, + stack: Vec, +} + +pub trait UnifyKey { + type Value; +} + +pub struct UnificationTable { + values: Delegate, +} + +pub struct Delegate(PhantomData); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-23477.rs b/src/test/run-pass/issues/issue-23477.rs new file mode 100644 index 00000000000..c862b0dbc2f --- /dev/null +++ b/src/test/run-pass/issues/issue-23477.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compiler-flags: -g + +pub struct Dst { + pub a: (), + pub b: (), + pub data: [u8], +} + +pub unsafe fn borrow(bytes: &[u8]) -> &Dst { + let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); + dst +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-23485.rs b/src/test/run-pass/issues/issue-23485.rs new file mode 100644 index 00000000000..42ccf5995ac --- /dev/null +++ b/src/test/run-pass/issues/issue-23485.rs @@ -0,0 +1,59 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test for an ICE that occurred when a default method implementation +// was applied to a type that did not meet the prerequisites. The +// problem occurred specifically because normalizing +// `Self::Item::Target` was impossible in this case. + +use std::boxed::Box; +use std::marker::Sized; +use std::clone::Clone; +use std::ops::Deref; +use std::option::Option; +use std::option::Option::{Some,None}; + +trait Iterator { + type Item; + + fn next(&mut self) -> Option; + + fn clone_first(mut self) -> Option<::Target> where + Self: Sized, + Self::Item: Deref, + ::Target: Clone, + { + self.next().map(|x| x.clone()) + } +} + +struct Counter { + value: i32 +} + +struct Token { + value: i32 +} + +impl Iterator for Counter { + type Item = Token; + + fn next(&mut self) -> Option { + let x = self.value; + self.value += 1; + Some(Token { value: x }) + } +} + +fn main() { + let mut x: Box> = Box::new(Counter { value: 22 }); + assert_eq!(x.next().unwrap().value, 22); +} diff --git a/src/test/run-pass/issues/issue-23491.rs b/src/test/run-pass/issues/issue-23491.rs new file mode 100644 index 00000000000..a6e06050c0e --- /dev/null +++ b/src/test/run-pass/issues/issue-23491.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Node(T); + +fn main() { + let x: Box> = box Node([]); +} diff --git a/src/test/run-pass/issues/issue-23550.rs b/src/test/run-pass/issues/issue-23550.rs new file mode 100644 index 00000000000..143e0babcd9 --- /dev/null +++ b/src/test/run-pass/issues/issue-23550.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] +#![allow(warnings)] + +use std::intrinsics; + +#[derive(Copy, Clone)] +struct Wrap(i64); + +// These volatile intrinsics used to cause an ICE + +unsafe fn test_bool(p: &mut bool, v: bool) { + intrinsics::volatile_load(p); + intrinsics::volatile_store(p, v); +} + +unsafe fn test_immediate_fca(p: &mut Wrap, v: Wrap) { + intrinsics::volatile_load(p); + intrinsics::volatile_store(p, v); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs b/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs new file mode 100644 index 00000000000..ab5a89cbba3 --- /dev/null +++ b/src/test/run-pass/issues/issue-23611-enum-swap-in-drop.rs @@ -0,0 +1,268 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Issue 23611: this test is ensuring that, for an instance `X` of the +// enum `E`, if you swap in a different variant during the execution +// of the `::drop`, then the appropriate substructure will +// be torn down after the `::drop` method returns. + +use std::cell::RefCell; +use std::mem; + +use self::d::D; + +pub fn main() { + let log = RefCell::new(vec![]); + d::println("created empty log"); + test(&log); + + // println!("log: {:?}", &log.borrow()[..]); + assert_eq!( + &log.borrow()[..], + [ + // created empty log + // +-- Make D(test_1, 10000000) + // | +-- Make D(g_b_5, 50000001) + // | | in g_B(b2b0) from E::drop, b=b4b0 + // | +-- Drop D(g_b_5, 50000001) + 50000001, + // | + // | +-- Make D(drop_6, 60000002) + // | | +-- Make D(g_b_5, 50000003) + // | | | in g_B(b2b0) from E::drop, b=b4b1 + // | | +-- Drop D(g_b_5, 50000003) + 50000003, + // | | + // | | +-- Make D(GaspB::drop_3, 30000004) + // | | | +-- Make D(g_b_5, 50000005) + // | | | | in g_B(b4b2) from GaspB::drop + // | | | +-- Drop D(g_b_5, 50000005) + 50000005, + // | | | + // | | +-- Drop D(GaspB::drop_3, 30000004) + 30000004, + // | | + // +-- Drop D(test_1, 10000000) + 10000000, + // | + // +-- Make D(GaspA::drop_2, 20000006) + // | | +-- Make D(f_a_4, 40000007) + // | | | in f_A(a3a0) from GaspA::drop + // | | +-- Drop D(f_a_4, 40000007) + 40000007, + // | | + // +-- Drop D(GaspA::drop_2, 20000006) + 20000006, + // | + // +-- Drop D(drop_6, 60000002) + 60000002 + // + ]); + + // For reference purposes, the old (incorrect) behavior would produce the following + // output, which you can compare to the above: + // + // created empty log + // +-- Make D(test_1, 10000000) + // | +-- Make D(g_b_5, 50000001) + // | | in g_B(b2b0) from E::drop, b=b4b0 + // | +-- Drop D(g_b_5, 50000001) + // | + // | +-- Make D(drop_6, 60000002) + // | | +-- Make D(g_b_5, 50000003) + // | | | in g_B(b2b0) from E::drop, b=b4b1 + // | | +-- Drop D(g_b_5, 50000003) + // | | + // | | +-- Make D(GaspB::drop_3, 30000004) + // | | | +-- Make D(g_b_5, 50000005) + // | | | | in g_B(b4b2) from GaspB::drop + // | | | +-- Drop D(g_b_5, 50000005) + // | | | + // | | +-- Drop D(GaspB::drop_3, 30000004) + // | | + // +-- Drop D(test_1, 10000000) + // | + // +-- Make D(GaspB::drop_3, 30000006) + // | | +-- Make D(f_a_4, 40000007) + // | | | in f_A(a3a0) from GaspB::drop + // | | +-- Drop D(f_a_4, 40000007) + // | | + // +-- Drop D(GaspB::drop_3, 30000006) + // | + // +-- Drop D(drop_6, 60000002) + + // Note that this calls f_A from GaspB::drop (and thus creates a D + // with a uid incorporating the origin of GaspB's drop that + // surrounds the f_A invocation), but the code as written only + // ever hands f_A off to instances of GaspA, and thus one should + // be able to prove the invariant that f_A is *only* invoked from + // from an instance of GaspA (either via the GaspA drop + // implementation or the E drop implementaton). Yet the old (bad) + // behavior allowed a call to f_A to leak in while we are tearing + // down a value of type GaspB. +} + +fn test<'a>(log: d::Log<'a>) { + let _e = E::B(GaspB(g_b, 0xB4B0, log, D::new("test", 1, log)), true); +} + +struct GaspA<'a>(for <'b> fn(u32, &'b str, d::Log<'a>), u32, d::Log<'a>, d::D<'a>); +struct GaspB<'a>(for <'b> fn(u32, &'b str, d::Log<'a>), u32, d::Log<'a>, d::D<'a>); + +impl<'a> Drop for GaspA<'a> { + fn drop(&mut self) { + let _d = d::D::new("GaspA::drop", 2, self.2); + (self.0)(self.1, "GaspA::drop", self.2); + } +} + +impl<'a> Drop for GaspB<'a> { + fn drop(&mut self) { + let _d = d::D::new("GaspB::drop", 3, self.2); + (self.0)(self.1, "GaspB::drop", self.2); + } +} + +enum E<'a> { + A(GaspA<'a>, bool), B(GaspB<'a>, bool), +} + +fn f_a(x: u32, ctxt: &str, log: d::Log) { + let _d = d::D::new("f_a", 4, log); + d::println(&format!("in f_A({:x}) from {}", x, ctxt)); +} +fn g_b(y: u32, ctxt: &str, log: d::Log) { + let _d = d::D::new("g_b", 5, log); + d::println(&format!("in g_B({:x}) from {}", y, ctxt)); +} + +impl<'a> Drop for E<'a> { + fn drop(&mut self) { + let (do_drop, log) = match *self { + E::A(GaspA(ref f, ref mut val_a, log, ref _d_a), ref mut do_drop) => { + f(0xA1A0, &format!("E::drop, a={:x}", val_a), log); + *val_a += 1; + // swap in do_drop := false to avoid infinite dtor regress + (mem::replace(do_drop, false), log) + } + E::B(GaspB(ref g, ref mut val_b, log, ref _d_b), ref mut do_drop) => { + g(0xB2B0, &format!("E::drop, b={:x}", val_b), log); + *val_b += 1; + // swap in do_drop := false to avoid infinite dtor regress + (mem::replace(do_drop, false), log) + } + }; + + if do_drop { + mem::replace(self, E::A(GaspA(f_a, 0xA3A0, log, D::new("drop", 6, log)), true)); + } + } +} + +// This module provides simultaneous printouts of the dynamic extents +// of all of the D values, in addition to logging the order that each +// is dropped. +// +// This code is similar to a support code module embedded within +// test/run-pass/issue-123338-ensure-param-drop-order.rs; however, +// that (slightly simpler) code only identifies objects in the log via +// (creation) time-stamps; this incorporates both timestamping and the +// point of origin within the source code into the unique ID (uid). + +const PREF_INDENT: u32 = 20; + +pub mod d { + #![allow(unused_parens)] + use std::fmt; + use std::mem; + use std::cell::RefCell; + + static mut counter: u16 = 0; + static mut trails: u64 = 0; + + pub type Log<'a> = &'a RefCell>; + + pub fn current_width() -> u32 { + unsafe { max_width() - trails.leading_zeros() } + } + + pub fn max_width() -> u32 { + unsafe { + (mem::size_of_val(&trails)*8) as u32 + } + } + + pub fn indent_println(my_trails: u32, s: &str) { + let mut indent: String = String::new(); + for i in 0..my_trails { + unsafe { + if trails & (1 << i) != 0 { + indent = indent + "| "; + } else { + indent = indent + " "; + } + } + } + println!("{}{}", indent, s); + } + + pub fn println(s: &str) { + indent_println(super::PREF_INDENT, s); + } + + fn first_avail() -> u32 { + unsafe { + for i in 0..64 { + if trails & (1 << i) == 0 { + return i; + } + } + } + panic!("exhausted trails"); + } + + pub struct D<'a> { + name: &'static str, i: u8, uid: u32, trail: u32, log: Log<'a> + } + + impl<'a> fmt::Display for D<'a> { + fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { + write!(w, "D({}_{}, {})", self.name, self.i, self.uid) + } + } + + impl<'a> D<'a> { + pub fn new(name: &'static str, i: u8, log: Log<'a>) -> D<'a> { + unsafe { + let trail = first_avail(); + let ctr = ((i as u32) * 10_000_000) + (counter as u32); + counter += 1; + trails |= (1 << trail); + let ret = D { + name: name, i: i, log: log, uid: ctr, trail: trail + }; + indent_println(trail, &format!("+-- Make {}", ret)); + ret + } + } + } + + impl<'a> Drop for D<'a> { + fn drop(&mut self) { + unsafe { trails &= !(1 << self.trail); }; + self.log.borrow_mut().push(self.uid); + indent_println(self.trail, &format!("+-- Drop {}", self)); + indent_println(::PREF_INDENT, ""); + } + } +} diff --git a/src/test/run-pass/issues/issue-23649-1.rs b/src/test/run-pass/issues/issue-23649-1.rs new file mode 100644 index 00000000000..f270f536cf1 --- /dev/null +++ b/src/test/run-pass/issues/issue-23649-1.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; + +pub struct X([u8]); + +fn _f(x: &X) -> usize { match *x { X(ref x) => { x.len() } } } + +fn main() { + let b: &[u8] = &[11; 42]; + let v: &X = unsafe { mem::transmute(b) }; + assert_eq!(_f(v), 42); +} diff --git a/src/test/run-pass/issues/issue-23649-2.rs b/src/test/run-pass/issues/issue-23649-2.rs new file mode 100644 index 00000000000..6cdd94c381e --- /dev/null +++ b/src/test/run-pass/issues/issue-23649-2.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no std::path + +use std::collections::HashMap; +use std::path::{Path, PathBuf}; + +fn main() { + let m: HashMap = HashMap::new(); + let k = Path::new("foo"); + println!("{:?}", m.get(k)); +} diff --git a/src/test/run-pass/issues/issue-23649-3.rs b/src/test/run-pass/issues/issue-23649-3.rs new file mode 100644 index 00000000000..067628ec12a --- /dev/null +++ b/src/test/run-pass/issues/issue-23649-3.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq)] +struct Slice { slice: [u8] } + +fn main() {} diff --git a/src/test/run-pass/issues/issue-23699.rs b/src/test/run-pass/issues/issue-23699.rs new file mode 100644 index 00000000000..a33d1039267 --- /dev/null +++ b/src/test/run-pass/issues/issue-23699.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn gimme_a_raw_pointer(_: *const T) { } + +fn test(t: T) { } + +fn main() { + // Clearly `pointer` must be of type `*const ()`. + let pointer = &() as *const _; + gimme_a_raw_pointer(pointer); + + let t = test as fn (i32); + t(0i32); +} + diff --git a/src/test/run-pass/issues/issue-23781.rs b/src/test/run-pass/issues/issue-23781.rs new file mode 100644 index 00000000000..fcd6dd196ac --- /dev/null +++ b/src/test/run-pass/issues/issue-23781.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt; + +struct Foo; +impl fmt::Debug for Foo { + fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { + println!("::fmt()"); + + write!(fmt, "") + } +} + +fn test1() { + let foo_str = format!("{:?}", Foo); + + println!("{}", foo_str); +} + +fn test2() { + println!("{:?}", Foo); +} + +fn main() { + // This works fine + test1(); + + // This fails + test2(); +} diff --git a/src/test/run-pass/issues/issue-2380-b.rs b/src/test/run-pass/issues/issue-2380-b.rs new file mode 100644 index 00000000000..fe28c2f3f1b --- /dev/null +++ b/src/test/run-pass/issues/issue-2380-b.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-2380.rs + +// pretty-expanded FIXME #23616 + +extern crate a; + +pub fn main() { + a::f::<()>(); +} diff --git a/src/test/run-pass/issues/issue-23808.rs b/src/test/run-pass/issues/issue-23808.rs new file mode 100644 index 00000000000..133da00ffaa --- /dev/null +++ b/src/test/run-pass/issues/issue-23808.rs @@ -0,0 +1,68 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(dead_code)] + +// use different types / traits to test all combinations + +trait Const { + const C: (); +} + +trait StaticFn { + fn sfn(); +} + +struct ConstStruct; +struct StaticFnStruct; + +enum ConstEnum {} +enum StaticFnEnum {} + +struct AliasedConstStruct; +struct AliasedStaticFnStruct; + +enum AliasedConstEnum {} +enum AliasedStaticFnEnum {} + +type AliasConstStruct = AliasedConstStruct; +type AliasStaticFnStruct = AliasedStaticFnStruct; +type AliasConstEnum = AliasedConstEnum; +type AliasStaticFnEnum = AliasedStaticFnEnum; + +macro_rules! impl_Const {($($T:ident),*) => {$( + impl Const for $T { + const C: () = (); + } +)*}} + +macro_rules! impl_StaticFn {($($T:ident),*) => {$( + impl StaticFn for $T { + fn sfn() {} + } +)*}} + +impl_Const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum); +impl_StaticFn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum); + +fn main() { + let _ = ConstStruct::C; + let _ = ConstEnum::C; + + StaticFnStruct::sfn(); + StaticFnEnum::sfn(); + + let _ = AliasConstStruct::C; + let _ = AliasConstEnum::C; + + AliasStaticFnStruct::sfn(); + AliasStaticFnEnum::sfn(); +} diff --git a/src/test/run-pass/issues/issue-23825.rs b/src/test/run-pass/issues/issue-23825.rs new file mode 100644 index 00000000000..2bcadefe9b8 --- /dev/null +++ b/src/test/run-pass/issues/issue-23825.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Stringify { + fn to_string(&self) -> String; +} + +impl Stringify for u32 { + fn to_string(&self) -> String { format!("u32: {}", *self) } +} + +impl Stringify for f32 { + fn to_string(&self) -> String { format!("f32: {}", *self) } +} + +fn print(x: T) -> String { + x.to_string() +} + +fn main() { + assert_eq!(&print(5), "u32: 5"); + assert_eq!(&print(5.0), "f32: 5"); +} diff --git a/src/test/run-pass/issues/issue-2383.rs b/src/test/run-pass/issues/issue-2383.rs new file mode 100644 index 00000000000..2e1318ee6c8 --- /dev/null +++ b/src/test/run-pass/issues/issue-2383.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::collections::VecDeque; + +pub fn main() { + let mut q = VecDeque::new(); + q.push_front(10); +} diff --git a/src/test/run-pass/issues/issue-23833.rs b/src/test/run-pass/issues/issue-23833.rs new file mode 100644 index 00000000000..eeb7db925da --- /dev/null +++ b/src/test/run-pass/issues/issue-23833.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt; +use std::{i8, i16, i32, i64, isize}; +use std::{u8, u16, u32, u64, usize}; + +const A_I8_T + : [u32; (i8::MAX as i8 - 1i8) as usize] + = [0; (i8::MAX as usize) - 1]; + +fn main() { + foo(&A_I8_T[..]); +} + +fn foo(x: T) { + println!("{:?}", x); +} diff --git a/src/test/run-pass/issues/issue-23891.rs b/src/test/run-pass/issues/issue-23891.rs new file mode 100644 index 00000000000..c2197b885c9 --- /dev/null +++ b/src/test/run-pass/issues/issue-23891.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! id { + ($s: pat) => ($s); +} + +fn main() { + match (Some(123), Some(456)) { + (id!(Some(a)), _) | (_, id!(Some(a))) => println!("{}", a), + _ => (), + } +} diff --git a/src/test/run-pass/issues/issue-23898.rs b/src/test/run-pass/issues/issue-23898.rs new file mode 100644 index 00000000000..d06814d620e --- /dev/null +++ b/src/test/run-pass/issues/issue-23898.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Note: This test was used to demonstrate #5873 (now #23898). + +enum State { ST_NULL, ST_WHITESPACE } + +fn main() { + [State::ST_NULL; (State::ST_WHITESPACE as usize)]; +} diff --git a/src/test/run-pass/issues/issue-23958.rs b/src/test/run-pass/issues/issue-23958.rs new file mode 100644 index 00000000000..6f9e7e21668 --- /dev/null +++ b/src/test/run-pass/issues/issue-23958.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Collection where for<'a> &'a Self: IntoIterator { + fn my_iter(&self) -> <&Self as IntoIterator>::IntoIter { + self.into_iter() + } +} + +impl Collection for [T] { } + +fn main() { + let v = [0usize]; + let _ = v.my_iter(); +} diff --git a/src/test/run-pass/issues/issue-23968-const-not-overflow.rs b/src/test/run-pass/issues/issue-23968-const-not-overflow.rs new file mode 100644 index 00000000000..d51167c47f8 --- /dev/null +++ b/src/test/run-pass/issues/issue-23968-const-not-overflow.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const U8_MAX_HALF: u8 = !0u8 / 2; +const U16_MAX_HALF: u16 = !0u16 / 2; +const U32_MAX_HALF: u32 = !0u32 / 2; +const U64_MAX_HALF: u64 = !0u64 / 2; + +fn main() { + assert_eq!(U8_MAX_HALF, 0x7f); + assert_eq!(U16_MAX_HALF, 0x7fff); + assert_eq!(U32_MAX_HALF, 0x7fff_ffff); + assert_eq!(U64_MAX_HALF, 0x7fff_ffff_ffff_ffff); +} diff --git a/src/test/run-pass/issues/issue-23992.rs b/src/test/run-pass/issues/issue-23992.rs new file mode 100644 index 00000000000..be8588f33a2 --- /dev/null +++ b/src/test/run-pass/issues/issue-23992.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Outer(T); +pub struct Inner<'a> { value: &'a bool } + +pub trait Trait { + type Error; + fn ready(self) -> Self::Error; +} + +impl<'a> Trait for Inner<'a> { + type Error = Outer>; + fn ready(self) -> Outer> { Outer(self) } +} + +fn main() { + let value = true; + let inner = Inner { value: &value }; + assert_eq!(inner.ready().0.value, &value); +} diff --git a/src/test/run-pass/issues/issue-24085.rs b/src/test/run-pass/issues/issue-24085.rs new file mode 100644 index 00000000000..6d8cacf8b29 --- /dev/null +++ b/src/test/run-pass/issues/issue-24085.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #24085. Errors were occurring in region +// inference due to the requirement that `'a:b'`, which was getting +// incorrectly codegened in connection with the closure below. + +#[derive(Copy,Clone)] +struct Path<'a:'b, 'b> { + x: &'a i32, + tail: Option<&'b Path<'a, 'b>> +} + +#[allow(dead_code, unconditional_recursion)] +fn foo<'a,'b,F>(p: Path<'a, 'b>, mut f: F) + where F: for<'c> FnMut(Path<'a, 'c>) { + foo(p, |x| f(x)) +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-24086.rs b/src/test/run-pass/issues/issue-24086.rs new file mode 100644 index 00000000000..632afc00688 --- /dev/null +++ b/src/test/run-pass/issues/issue-24086.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Registry<'a> { + listener: &'a mut (), +} + +pub struct Listener<'a> { + pub announce: Option>, + pub remove: Option>, +} + +impl<'a> Drop for Registry<'a> { + fn drop(&mut self) {} +} + +fn main() { + let mut registry_listener = Listener { + announce: None, + remove: None, + }; +} diff --git a/src/test/run-pass/issues/issue-2414-c.rs b/src/test/run-pass/issues/issue-2414-c.rs new file mode 100644 index 00000000000..d285074accf --- /dev/null +++ b/src/test/run-pass/issues/issue-2414-c.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-2414-a.rs +// aux-build:issue-2414-b.rs + +// pretty-expanded FIXME #23616 + +extern crate b; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-24161.rs b/src/test/run-pass/issues/issue-24161.rs new file mode 100644 index 00000000000..1ac5d1237a7 --- /dev/null +++ b/src/test/run-pass/issues/issue-24161.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Copy,Clone)] +struct Functions { + a: fn(u32) -> u32, + b: extern "C" fn(u32) -> u32, + c: unsafe fn(u32) -> u32, + d: unsafe extern "C" fn(u32) -> u32 +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-24227.rs b/src/test/run-pass/issues/issue-24227.rs new file mode 100644 index 00000000000..86241b1763a --- /dev/null +++ b/src/test/run-pass/issues/issue-24227.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This resulted in an ICE. Test for future-proofing +// Issue #24227 + +#![allow(unused)] + +struct Foo<'a> { + x: &'a u8 +} + +impl<'a> Foo<'a> { + fn foo() { + let mut tmp: Self; + } + +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2428.rs b/src/test/run-pass/issues/issue-2428.rs new file mode 100644 index 00000000000..5a0c9f5a85b --- /dev/null +++ b/src/test/run-pass/issues/issue-2428.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + + +pub fn main() { + let _foo = 100; + const quux: isize = 5; + + enum Stuff { + Bar = quux + } + + assert_eq!(Stuff::Bar as isize, quux); +} diff --git a/src/test/run-pass/issues/issue-24308.rs b/src/test/run-pass/issues/issue-24308.rs new file mode 100644 index 00000000000..6cbdd61273f --- /dev/null +++ b/src/test/run-pass/issues/issue-24308.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Foo { + fn method1() {} + fn method2(); +} + +struct Slice<'a, T: 'a>(&'a [T]); + +impl<'a, T: 'a> Foo for Slice<'a, T> { + fn method2() { + ::method1(); + } +} + +fn main() { + as Foo>::method2(); +} diff --git a/src/test/run-pass/issues/issue-24313.rs b/src/test/run-pass/issues/issue-24313.rs new file mode 100644 index 00000000000..cd20ab5a843 --- /dev/null +++ b/src/test/run-pass/issues/issue-24313.rs @@ -0,0 +1,43 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no threads + +use std::thread; +use std::env; +use std::process::Command; + +struct Handle(i32); + +impl Drop for Handle { + fn drop(&mut self) { panic!(); } +} + +thread_local!(static HANDLE: Handle = Handle(0)); + +fn main() { + let args = env::args().collect::>(); + if args.len() == 1 { + let out = Command::new(&args[0]).arg("test").output().unwrap(); + let stderr = std::str::from_utf8(&out.stderr).unwrap(); + assert!(stderr.contains("panicked at 'explicit panic'"), + "bad failure message:\n{}\n", stderr); + } else { + // TLS dtors are not always run on process exit + thread::spawn(|| { + HANDLE.with(|h| { + println!("{}", h.0); + }); + }).join().unwrap(); + } +} + diff --git a/src/test/run-pass/issues/issue-24353.rs b/src/test/run-pass/issues/issue-24353.rs new file mode 100644 index 00000000000..f4b0e6814e8 --- /dev/null +++ b/src/test/run-pass/issues/issue-24353.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + return (); + + let x = (); + x +} diff --git a/src/test/run-pass/issues/issue-24389.rs b/src/test/run-pass/issues/issue-24389.rs new file mode 100644 index 00000000000..5eb622bb932 --- /dev/null +++ b/src/test/run-pass/issues/issue-24389.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +struct Foo; + +impl Foo { + fn new() -> Self { Foo } + fn bar() { Self::new(); } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-24434.rs b/src/test/run-pass/issues/issue-24434.rs new file mode 100644 index 00000000000..a4f22e3c79a --- /dev/null +++ b/src/test/run-pass/issues/issue-24434.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--cfg set1 + +#![cfg_attr(set1, feature(custom_attribute))] + +#![foobar] +fn main() {} diff --git a/src/test/run-pass/issues/issue-2445-b.rs b/src/test/run-pass/issues/issue-2445-b.rs new file mode 100644 index 00000000000..144861dc94e --- /dev/null +++ b/src/test/run-pass/issues/issue-2445-b.rs @@ -0,0 +1,40 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct c1 { + x: T, +} + +impl c1 { + pub fn f1(&self, _x: isize) { + } +} + +fn c1(x: T) -> c1 { + c1 { + x: x + } +} + +impl c1 { + pub fn f2(&self, _x: isize) { + } +} + + +pub fn main() { + c1::(3).f1(4); + c1::(3).f2(4); +} diff --git a/src/test/run-pass/issues/issue-2445.rs b/src/test/run-pass/issues/issue-2445.rs new file mode 100644 index 00000000000..1d368e908ed --- /dev/null +++ b/src/test/run-pass/issues/issue-2445.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct c1 { + x: T, +} + +impl c1 { + pub fn f1(&self, _x: T) {} +} + +fn c1(x: T) -> c1 { + c1 { + x: x + } +} + +impl c1 { + pub fn f2(&self, _x: T) {} +} + + +pub fn main() { + c1::(3).f1(4); + c1::(3).f2(4); +} diff --git a/src/test/run-pass/issues/issue-24533.rs b/src/test/run-pass/issues/issue-24533.rs new file mode 100644 index 00000000000..316773e8915 --- /dev/null +++ b/src/test/run-pass/issues/issue-24533.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::slice::Iter; +use std::io::{Error, ErrorKind, Result}; +use std::vec::*; + +fn foo(it: &mut Iter) -> Result { + Ok(*it.next().unwrap()) +} + +fn bar() -> Result { + let data: Vec = Vec::new(); + + if true { + return Err(Error::new(ErrorKind::NotFound, "msg")); + } + + let mut it = data.iter(); + foo(&mut it) +} + +fn main() { + bar(); +} diff --git a/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs new file mode 100644 index 00000000000..3f46b0e312d --- /dev/null +++ b/src/test/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs @@ -0,0 +1,69 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test illustrates that under NLL, we can remove our overly +// conservative approach for disallowing mutations of match inputs. + +// See further discussion on rust-lang/rust#24535 and +// rust-lang/rfcs#1006. + +// compile-flags: -Z disable-ast-check-for-mutation-in-guard + +#![feature(nll)] + +fn main() { + rust_issue_24535(); + rfcs_issue_1006_1(); + rfcs_issue_1006_2(); +} + +fn rust_issue_24535() { + fn compare(a: &u8, b: &mut u8) -> bool { + a == b + } + + let a = 3u8; + + match a { + 0 => panic!("nope"), + 3 if compare(&a, &mut 3) => (), + _ => panic!("nope"), + } +} + +fn rfcs_issue_1006_1() { + let v = vec!["1".to_string(), "2".to_string(), "3".to_string()]; + match Some(&v) { + Some(iv) if iv.iter().any(|x| &x[..]=="2") => true, + _ => panic!("nope"), + }; +} + +fn rfcs_issue_1006_2() { + #[inline(always)] + fn check<'a, I: Iterator>(mut i: I) -> bool { + i.any(|&x| x == 2) + } + + let slice = [1, 2, 3]; + + match 42 { + _ if slice.iter().any(|&x| x == 2) => { true }, + _ => { panic!("nope"); } + }; + + // (This match is just illustrating how easy it was to circumvent + // the checking performed for the previous `match`.) + match 42 { + _ if check(slice.iter()) => { true }, + _ => { panic!("nope"); } + }; +} diff --git a/src/test/run-pass/issues/issue-24589.rs b/src/test/run-pass/issues/issue-24589.rs new file mode 100644 index 00000000000..825e3cbd93b --- /dev/null +++ b/src/test/run-pass/issues/issue-24589.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct _X([u8]); + +impl std::ops::Deref for _X { + type Target = [u8]; + + fn deref(&self) -> &[u8] { + &self.0 + } +} + +pub fn _g(x: &_X) -> &[u8] { + x +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-2463.rs b/src/test/run-pass/issues/issue-2463.rs new file mode 100644 index 00000000000..1c655f87435 --- /dev/null +++ b/src/test/run-pass/issues/issue-2463.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Pair { f: isize, g: isize } + +pub fn main() { + + let x = Pair { + f: 0, + g: 0, + }; + + let _y = Pair { + f: 1, + g: 1, + .. x + }; + + let _z = Pair { + f: 1, + .. x + }; + +} diff --git a/src/test/run-pass/issues/issue-2472.rs b/src/test/run-pass/issues/issue-2472.rs new file mode 100644 index 00000000000..bc078ea49cf --- /dev/null +++ b/src/test/run-pass/issues/issue-2472.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_2472_b.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_2472_b; + +use issue_2472_b::{S, T}; + +pub fn main() { + let s = S(()); + s.foo(); + s.bar(); +} diff --git a/src/test/run-pass/issues/issue-24779.rs b/src/test/run-pass/issues/issue-24779.rs new file mode 100644 index 00000000000..85ab4c6d4c5 --- /dev/null +++ b/src/test/run-pass/issues/issue-24779.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + assert_eq!((||||42)()(), 42); +} diff --git a/src/test/run-pass/issues/issue-24805-dropck-itemless.rs b/src/test/run-pass/issues/issue-24805-dropck-itemless.rs new file mode 100644 index 00000000000..1d1bd21075b --- /dev/null +++ b/src/test/run-pass/issues/issue-24805-dropck-itemless.rs @@ -0,0 +1,89 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +// Check that item-less traits do not cause dropck to inject extra +// region constraints. + +#![allow(non_camel_case_types)] + +#![feature(dropck_parametricity)] + +trait UserDefined { } + +impl UserDefined for i32 { } +impl<'a, T> UserDefined for &'a T { } + +// 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 { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { } + } + } +} + +impl_drop!{Send, D_Send} +impl_drop!{Sized, D_Sized} + +// See note below regarding Issue 24895 +// impl_drop!{Copy, D_Copy} + +impl_drop!{Sync, D_Sync} +impl_drop!{UserDefined, D_UserDefined} + +macro_rules! body { + ($id:ident) => { { + // `_d` and `d1` are assigned the *same* lifetime by region inference ... + let (_d, d1); + + d1 = $id(1); + // ... we store a reference to `d1` within `_d` ... + _d = $id(&d1); + + // ... a *conservative* dropck will thus complain, because it + // thinks Drop of _d could access the already dropped `d1`. + } } +} + +fn f_send() { body!(D_Send) } +fn f_sized() { body!(D_Sized) } +fn f_sync() { body!(D_Sync) } + +// Issue 24895: Copy: Clone implies `impl Drop for ...` can +// access a user-defined clone() method, which causes this test case +// to fail. +// +// If 24895 is resolved by removing the `Copy: Clone` relationship, +// then this definition and the call below should be uncommented. If +// it is resolved by deciding to keep the `Copy: Clone` relationship, +// then this comment and the associated bits of code can all be +// removed. + +// fn f_copy() { body!(D_Copy) } + +fn f_userdefined() { body!(D_UserDefined) } + +fn main() { + f_send(); + f_sized(); + // See note above regarding Issue 24895. + // f_copy(); + f_sync(); + f_userdefined(); +} diff --git a/src/test/run-pass/issues/issue-2487-a.rs b/src/test/run-pass/issues/issue-2487-a.rs new file mode 100644 index 00000000000..ee0ee106076 --- /dev/null +++ b/src/test/run-pass/issues/issue-2487-a.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct socket { + sock: isize, + +} + +impl Drop for socket { + fn drop(&mut self) {} +} + +impl socket { + pub fn set_identity(&self) { + closure(|| setsockopt_bytes(self.sock.clone())) + } +} + +fn socket() -> socket { + socket { + sock: 1 + } +} + +fn closure(f: F) where F: FnOnce() { f() } + +fn setsockopt_bytes(_sock: isize) { } + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs b/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs new file mode 100644 index 00000000000..5206acb8e94 --- /dev/null +++ b/src/test/run-pass/issues/issue-24945-repeat-dash-opts.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test is just checking that we continue to accept `-g -g -O -O` +// as options to the compiler. + +// compile-flags:-g -g -O -O + +fn main() { + assert_eq!(1, 1); +} diff --git a/src/test/run-pass/issues/issue-24947.rs b/src/test/run-pass/issues/issue-24947.rs new file mode 100644 index 00000000000..91549128447 --- /dev/null +++ b/src/test/run-pass/issues/issue-24947.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #24947 ICE using a trait-associated const in an array size + + +struct Foo; + +impl Foo { + const SIZE: usize = 8; +} + +trait Bar { + const BAR_SIZE: usize; +} + +impl Bar for Foo { + const BAR_SIZE: usize = 12; +} + +#[allow(unused_variables)] +fn main() { + let w: [u8; 12] = [0u8; ::BAR_SIZE]; + let x: [u8; 12] = [0u8; ::BAR_SIZE]; + let y: [u8; 8] = [0u8; ::SIZE]; + let z: [u8; 8] = [0u8; Foo::SIZE]; +} diff --git a/src/test/run-pass/issues/issue-24954.rs b/src/test/run-pass/issues/issue-24954.rs new file mode 100644 index 00000000000..e8f135f7f67 --- /dev/null +++ b/src/test/run-pass/issues/issue-24954.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + ($y:expr) => ({ + $y = 2; + }) +} + +#[allow(unused_variables)] +#[allow(unused_assignments)] +fn main() { + let mut x = 1; + foo!(x); +} diff --git a/src/test/run-pass/issues/issue-2502.rs b/src/test/run-pass/issues/issue-2502.rs new file mode 100644 index 00000000000..d06f99910a0 --- /dev/null +++ b/src/test/run-pass/issues/issue-2502.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +// pretty-expanded FIXME #23616 + +struct font<'a> { + fontbuf: &'a Vec , +} + +impl<'a> font<'a> { + pub fn buf(&self) -> &'a Vec { + self.fontbuf + } +} + +fn font(fontbuf: &Vec ) -> font { + font { + fontbuf: fontbuf + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-25089.rs b/src/test/run-pass/issues/issue-25089.rs new file mode 100644 index 00000000000..e059ac329b4 --- /dev/null +++ b/src/test/run-pass/issues/issue-25089.rs @@ -0,0 +1,43 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +struct Foo(i32); + +impl Drop for Foo { + fn drop(&mut self) { + static mut DROPPED: bool = false; + unsafe { + assert!(!DROPPED); + DROPPED = true; + } + } +} + +struct Empty; + +fn empty() -> Empty { Empty } + +fn should_panic(_: Foo, _: Empty) { + panic!("test panic"); +} + +fn test() { + should_panic(Foo(1), empty()); +} + +fn main() { + let ret = thread::spawn(test).join(); + assert!(ret.is_err()); +} diff --git a/src/test/run-pass/issues/issue-25145.rs b/src/test/run-pass/issues/issue-25145.rs new file mode 100644 index 00000000000..79b1e7c5ef8 --- /dev/null +++ b/src/test/run-pass/issues/issue-25145.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct S; + +impl S { + const N: usize = 3; +} + +static STUFF: [u8; S::N] = [0; S::N]; + +fn main() { + assert_eq!(STUFF, [0; 3]); +} diff --git a/src/test/run-pass/issues/issue-25180.rs b/src/test/run-pass/issues/issue-25180.rs new file mode 100644 index 00000000000..edfa369ed46 --- /dev/null +++ b/src/test/run-pass/issues/issue-25180.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +const x: &'static Fn() = &|| println!("ICE here"); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-25185.rs b/src/test/run-pass/issues/issue-25185.rs new file mode 100644 index 00000000000..764cfdc187a --- /dev/null +++ b/src/test/run-pass/issues/issue-25185.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-25185-1.rs +// aux-build:issue-25185-2.rs +// ignore-wasm32-bare no libc for ffi testing + +extern crate issue_25185_2; + +fn main() { + let x = unsafe { + issue_25185_2::rust_dbg_extern_identity_u32(1) + }; + assert_eq!(x, 1); +} diff --git a/src/test/run-pass/issues/issue-2526-a.rs b/src/test/run-pass/issues/issue-2526-a.rs new file mode 100644 index 00000000000..210ad831859 --- /dev/null +++ b/src/test/run-pass/issues/issue-2526-a.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-2526.rs + +// pretty-expanded FIXME #23616 + +#![allow(unused_imports)] + +extern crate issue_2526; +use issue_2526::*; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-25279.rs b/src/test/run-pass/issues/issue-25279.rs new file mode 100644 index 00000000000..47714cef2d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-25279.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S<'a>(&'a ()); + +impl<'a> S<'a> { + fn foo(self) -> &'a () { + ::bar(self) + } + + fn bar(self) -> &'a () { + self.0 + } +} + +fn main() { + S(&()).foo(); +} diff --git a/src/test/run-pass/issues/issue-25339.rs b/src/test/run-pass/issues/issue-25339.rs new file mode 100644 index 00000000000..279a8865377 --- /dev/null +++ b/src/test/run-pass/issues/issue-25339.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(associated_type_defaults)] + +use std::marker::PhantomData; + +pub trait Routing { + type Output; + fn resolve(&self, input: I); +} + +pub trait ToRouting { + type Input; + type Routing : ?Sized = Routing; + fn to_routing(self) -> Self::Routing; +} + +pub struct Mount> { + action: R, + _marker: PhantomData +} + +impl> Mount { + pub fn create>(mount: &str, input: T) { + input.to_routing(); + } +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-25343.rs b/src/test/run-pass/issues/issue-25343.rs new file mode 100644 index 00000000000..40e9924e5d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-25343.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[allow(unused)] +fn main() { + || { + 'label: loop { + } + }; + + // More cases added from issue 31754 + + 'label2: loop { + break; + } + + let closure = || { + 'label2: loop {} + }; + + fn inner_fn() { + 'label2: loop {} + } +} diff --git a/src/test/run-pass/issues/issue-25394.rs b/src/test/run-pass/issues/issue-25394.rs new file mode 100644 index 00000000000..df1fe399a4a --- /dev/null +++ b/src/test/run-pass/issues/issue-25394.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct Row([T]); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-25467.rs b/src/test/run-pass/issues/issue-25467.rs new file mode 100644 index 00000000000..37ce124e132 --- /dev/null +++ b/src/test/run-pass/issues/issue-25467.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-25467.rs + +pub type Issue25467BarT = (); +pub type Issue25467FooT = (); + +extern crate issue_25467 as aux; + +fn main() { + let o: aux::Object = None; +} diff --git a/src/test/run-pass/issues/issue-25497.rs b/src/test/run-pass/issues/issue-25497.rs new file mode 100644 index 00000000000..ab5a0bf92f0 --- /dev/null +++ b/src/test/run-pass/issues/issue-25497.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Clone, Debug, PartialEq)] +enum Expression { + Dummy, + Add(Box), +} + +use Expression::*; + +fn simplify(exp: Expression) -> Expression { + match exp { + Add(n) => *n.clone(), + _ => Dummy + } +} + +fn main() { + assert_eq!(simplify(Add(Box::new(Dummy))), Dummy); +} diff --git a/src/test/run-pass/issues/issue-2550.rs b/src/test/run-pass/issues/issue-2550.rs new file mode 100644 index 00000000000..0552e97e642 --- /dev/null +++ b/src/test/run-pass/issues/issue-2550.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + +struct C { + x: usize, +} + +fn C(x: usize) -> C { + C { + x: x + } +} + +fn f(_x: T) { +} + +pub fn main() { + f(C(1)); +} diff --git a/src/test/run-pass/issues/issue-25515.rs b/src/test/run-pass/issues/issue-25515.rs new file mode 100644 index 00000000000..03ad360bcd3 --- /dev/null +++ b/src/test/run-pass/issues/issue-25515.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::rc::Rc; + +struct Foo<'r>(&'r mut i32); + +impl<'r> Drop for Foo<'r> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut drops = 0; + + { + let _: Rc = Rc::new(Foo(&mut drops)); + } + + assert_eq!(1, drops); +} diff --git a/src/test/run-pass/issues/issue-25549-multiple-drop.rs b/src/test/run-pass/issues/issue-25549-multiple-drop.rs new file mode 100644 index 00000000000..24f44f2ecba --- /dev/null +++ b/src/test/run-pass/issues/issue-25549-multiple-drop.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo<'r>(&'r mut i32); + +impl<'r> Drop for Foo<'r> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +trait Trait {} +impl<'r> Trait for Foo<'r> {} + +struct Holder(T); + +fn main() { + let mut drops = 0; + + { + let y = &Holder([Foo(&mut drops)]) as &Holder<[Foo]>; + // this used to cause an extra drop of the Foo instance + let x = &y.0; + } + assert_eq!(1, drops); + + drops = 0; + { + let y = &Holder(Foo(&mut drops)) as &Holder; + // this used to cause an extra drop of the Foo instance + let x = &y.0; + } + assert_eq!(1, drops); +} diff --git a/src/test/run-pass/issues/issue-25679.rs b/src/test/run-pass/issues/issue-25679.rs new file mode 100644 index 00000000000..29e4b44592f --- /dev/null +++ b/src/test/run-pass/issues/issue-25679.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Device { + type Resources; +} +struct Foo(D, R); + +impl Foo { + fn present(&self) {} +} + +struct Res; +struct Dev; + +impl Device for Dev { type Resources = Res; } + +fn main() { + let foo = Foo(Dev, Res); + foo.present(); +} diff --git a/src/test/run-pass/issues/issue-25693.rs b/src/test/run-pass/issues/issue-25693.rs new file mode 100644 index 00000000000..86fe6c08147 --- /dev/null +++ b/src/test/run-pass/issues/issue-25693.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Parameters { type SelfRef; } + +struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> } +struct BP; + +impl<'a> Parameters for RP<'a> { type SelfRef = &'a X>; } +impl Parameters for BP { type SelfRef = Box>; } + +pub struct Y; +pub enum X { + Nothing, + SameAgain(P::SelfRef, Y) +} + +fn main() { + let bnil: Box> = Box::new(X::Nothing); + let bx: Box> = Box::new(X::SameAgain(bnil, Y)); + let rnil: X = X::Nothing; + let rx: X = X::SameAgain(&rnil, Y); +} diff --git a/src/test/run-pass/issues/issue-25700-1.rs b/src/test/run-pass/issues/issue-25700-1.rs new file mode 100644 index 00000000000..f1109ac93cd --- /dev/null +++ b/src/test/run-pass/issues/issue-25700-1.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S(Option<&'static T>); + +trait Tr { type Out; } +impl Tr for T { type Out = T; } + +impl Copy for S where S: Tr {} +impl Clone for S where S: Tr { + fn clone(&self) -> Self { *self } +} +fn main() { + S::<()>(None); +} diff --git a/src/test/run-pass/issues/issue-25700-2.rs b/src/test/run-pass/issues/issue-25700-2.rs new file mode 100644 index 00000000000..99c381042bf --- /dev/null +++ b/src/test/run-pass/issues/issue-25700-2.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Parser { + type Input; +} + +pub struct Iter(P, P::Input); + +pub struct Map(P, F); +impl Parser for Map where F: FnMut(P) { + type Input = u8; +} + +trait AstId { type Untyped; } +impl AstId for u32 { type Untyped = u32; } + +fn record_type(i: Id::Untyped) -> u8 { + Iter(Map(i, |_: Id::Untyped| {}), 42).1 +} + +pub fn main() { + assert_eq!(record_type::(3), 42); +} diff --git a/src/test/run-pass/issues/issue-25746-bool-transmute.rs b/src/test/run-pass/issues/issue-25746-bool-transmute.rs new file mode 100644 index 00000000000..da63bc61607 --- /dev/null +++ b/src/test/run-pass/issues/issue-25746-bool-transmute.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem::transmute; + +fn main() { + unsafe { + let _: i8 = transmute(false); + let _: i8 = transmute(true); + let _: bool = transmute(0u8); + let _: bool = transmute(1u8); + } +} diff --git a/src/test/run-pass/issues/issue-25757.rs b/src/test/run-pass/issues/issue-25757.rs new file mode 100644 index 00000000000..f2fbef2c581 --- /dev/null +++ b/src/test/run-pass/issues/issue-25757.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + a: u32 +} + +impl Foo { + fn x(&mut self) { + self.a = 5; + } +} + +const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x; + +fn main() { + let mut foo = Foo { a: 137 }; + FUNC(&mut foo); + assert_eq!(foo.a, 5); +} diff --git a/src/test/run-pass/issues/issue-25810.rs b/src/test/run-pass/issues/issue-25810.rs new file mode 100644 index 00000000000..986ba48d4b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-25810.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let x = X(15); + let y = x.foo(); + println!("{:?}",y); +} + +trait Foo + where for<'a> &'a Self: Bar +{ + fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output; +} + +trait Bar { + type Output; +} + +struct X(i32); + +impl<'a> Bar for &'a X { + type Output = &'a i32; +} + +impl Foo for X { + fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output { + &self.0 + } +} diff --git a/src/test/run-pass/issues/issue-25916.rs b/src/test/run-pass/issues/issue-25916.rs new file mode 100644 index 00000000000..cf8753119bf --- /dev/null +++ b/src/test/run-pass/issues/issue-25916.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + macro_rules! f { + () => { 0 + 0 } + } + // 16 per line + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); + f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); +} diff --git a/src/test/run-pass/issues/issue-26095.rs b/src/test/run-pass/issues/issue-26095.rs new file mode 100644 index 00000000000..0c6bc7c4885 --- /dev/null +++ b/src/test/run-pass/issues/issue-26095.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + + +trait HasNumber { + const Number: usize; +} + +enum One {} +enum Two {} + +enum Foo {} + +impl HasNumber for One { + const Number: usize = 1; +} + +impl HasNumber for Two { + const Number: usize = 2; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2611-3.rs b/src/test/run-pass/issues/issue-2611-3.rs new file mode 100644 index 00000000000..4b66aa48a5b --- /dev/null +++ b/src/test/run-pass/issues/issue-2611-3.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that impls are allowed to have looser, more permissive bounds +// than the traits require. + + +trait A { + fn b(&self, x: C) -> C; +} + +struct E { + f: isize +} + +impl A for E { + fn b(&self, _x: F) -> F { panic!() } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-26127.rs b/src/test/run-pass/issues/issue-26127.rs new file mode 100644 index 00000000000..c2634ed5690 --- /dev/null +++ b/src/test/run-pass/issues/issue-26127.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Tr { type T; } +impl Tr for u8 { type T=(); } +struct S(I::T); + +fn foo(i: I::T) { + S::(i); +} + +fn main() { + foo::(()); +} diff --git a/src/test/run-pass/issues/issue-26205.rs b/src/test/run-pass/issues/issue-26205.rs new file mode 100644 index 00000000000..e015acfdc2a --- /dev/null +++ b/src/test/run-pass/issues/issue-26205.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::{Deref, DerefMut}; + +struct Foo; + +impl Foo { + fn foo_mut(&mut self) {} +} + +struct Bar(Foo); + +impl Deref for Bar { + type Target = Foo; + + fn deref(&self) -> &Foo { + &self.0 + } +} + +impl DerefMut for Bar { + fn deref_mut(&mut self) -> &mut Foo { + &mut self.0 + } +} + +fn test(mut bar: Box) { + bar.foo_mut(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-26251.rs b/src/test/run-pass/issues/issue-26251.rs new file mode 100644 index 00000000000..20ad091695a --- /dev/null +++ b/src/test/run-pass/issues/issue-26251.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let x = 'a'; + + let y = match x { + 'a'..='b' if false => "one", + 'a' => "two", + 'a'..='b' => "three", + _ => panic!("what?"), + }; + + assert_eq!(y, "two"); +} diff --git a/src/test/run-pass/issues/issue-2631-b.rs b/src/test/run-pass/issues/issue-2631-b.rs new file mode 100644 index 00000000000..d53741b470e --- /dev/null +++ b/src/test/run-pass/issues/issue-2631-b.rs @@ -0,0 +1,27 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:issue-2631-a.rs + +extern crate req; + +use req::request; +use std::cell::RefCell; +use std::collections::HashMap; +use std::rc::Rc; + +pub fn main() { + let v = vec![Rc::new("hi".to_string())]; + let mut m: req::header_map = HashMap::new(); + m.insert("METHOD".to_string(), Rc::new(RefCell::new(v))); + request::(&m); +} diff --git a/src/test/run-pass/issues/issue-26322.rs b/src/test/run-pass/issues/issue-26322.rs new file mode 100644 index 00000000000..23f6a739bd5 --- /dev/null +++ b/src/test/run-pass/issues/issue-26322.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +macro_rules! columnline { + () => ( + (column!(), line!()) + ) +} + +macro_rules! indirectcolumnline { + () => ( + (||{ columnline!() })() + ) +} + +fn main() { + let closure = || { + columnline!() + }; + let iflet = if let Some(_) = Some(0) { + columnline!() + } else { (0, 0) }; + let cl = columnline!(); + assert_eq!(closure(), (9, 29)); + assert_eq!(iflet, (9, 32)); + assert_eq!(cl, (14, 34)); + let indirect = indirectcolumnline!(); + assert_eq!(indirect, (20, 38)); +} diff --git a/src/test/run-pass/issues/issue-2633-2.rs b/src/test/run-pass/issues/issue-2633-2.rs new file mode 100644 index 00000000000..ffc2b6a32a5 --- /dev/null +++ b/src/test/run-pass/issues/issue-2633-2.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + + +fn a_val(x: Box, y: Box) -> isize { + *x + *y +} + +pub fn main() { + let z: Box<_> = box 22; + a_val(z.clone(), z.clone()); +} diff --git a/src/test/run-pass/issues/issue-2633.rs b/src/test/run-pass/issues/issue-2633.rs new file mode 100644 index 00000000000..c02c4e7b9d6 --- /dev/null +++ b/src/test/run-pass/issues/issue-2633.rs @@ -0,0 +1,40 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#[derive(Copy, Clone)] +struct cat { + meow: extern "Rust" fn(), +} + +fn meow() { + println!("meow") +} + +fn cat() -> cat { + cat { + meow: meow, + } +} + +#[derive(Copy, Clone)] +struct KittyInfo {kitty: cat} + +// Code compiles and runs successfully if we add a + before the first arg +fn nyan(kitty: cat, _kitty_info: KittyInfo) { + (kitty.meow)(); +} + +pub fn main() { + let kitty = cat(); + nyan(kitty, KittyInfo {kitty: kitty}); +} diff --git a/src/test/run-pass/issues/issue-2642.rs b/src/test/run-pass/issues/issue-2642.rs new file mode 100644 index 00000000000..c900fa7b42c --- /dev/null +++ b/src/test/run-pass/issues/issue-2642.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn f() { + let _x: usize = loop { loop { break; } }; +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-26468.rs b/src/test/run-pass/issues/issue-26468.rs new file mode 100644 index 00000000000..2c9a48802a6 --- /dev/null +++ b/src/test/run-pass/issues/issue-26468.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +enum FooMode { + Check = 0x1001, +} + +enum BarMode { + Check = 0x2001, +} + +enum Mode { + Foo(FooMode), + Bar(BarMode), +} + +#[inline(never)] +fn broken(mode: &Mode) -> u32 { + for _ in 0..1 { + if let Mode::Foo(FooMode::Check) = *mode { return 17 } + if let Mode::Bar(BarMode::Check) = *mode { return 19 } + } + return 42; +} + +fn main() { + let mode = Mode::Bar(BarMode::Check); + assert_eq!(broken(&mode), 19); +} diff --git a/src/test/run-pass/issues/issue-26484.rs b/src/test/run-pass/issues/issue-26484.rs new file mode 100644 index 00000000000..66fb1df1675 --- /dev/null +++ b/src/test/run-pass/issues/issue-26484.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:-g + +fn helper bool>(_f: F) { + print!(""); +} + +fn main() { + let cond = 0; + helper(|v| v == cond) +} diff --git a/src/test/run-pass/issues/issue-26641.rs b/src/test/run-pass/issues/issue-26641.rs new file mode 100644 index 00000000000..90c2243222c --- /dev/null +++ b/src/test/run-pass/issues/issue-26641.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Parser<'a>(Box); + +fn main() { + let _x = Parser(Box::new(|_|{})); +} diff --git a/src/test/run-pass/issues/issue-26646.rs b/src/test/run-pass/issues/issue-26646.rs new file mode 100644 index 00000000000..05602f7504e --- /dev/null +++ b/src/test/run-pass/issues/issue-26646.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(unused_attributes)] + +#[repr(C)] +#[repr(packed)] +pub struct Foo; + +#[repr(packed)] +#[repr(C)] +pub struct Bar; + +fn main() { } diff --git a/src/test/run-pass/issues/issue-26655.rs b/src/test/run-pass/issues/issue-26655.rs new file mode 100644 index 00000000000..db373f2cc8d --- /dev/null +++ b/src/test/run-pass/issues/issue-26655.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +// Check that the destructors of simple enums are run on unwinding + +use std::sync::atomic::{Ordering, AtomicUsize}; +use std::thread; + +static LOG: AtomicUsize = AtomicUsize::new(0); + +enum WithDtor { Val } +impl Drop for WithDtor { + fn drop(&mut self) { + LOG.store(LOG.load(Ordering::SeqCst)+1,Ordering::SeqCst); + } +} + +pub fn main() { + thread::spawn(move|| { + let _e: WithDtor = WithDtor::Val; + panic!("fail"); + }).join().unwrap_err(); + + assert_eq!(LOG.load(Ordering::SeqCst), 1); +} diff --git a/src/test/run-pass/issues/issue-26709.rs b/src/test/run-pass/issues/issue-26709.rs new file mode 100644 index 00000000000..f8f20405a3d --- /dev/null +++ b/src/test/run-pass/issues/issue-26709.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Wrapper<'a, T: ?Sized>(&'a mut i32, T); + +impl<'a, T: ?Sized> Drop for Wrapper<'a, T> { + fn drop(&mut self) { + *self.0 = 432; + } +} + +fn main() { + let mut x = 0; + { + let wrapper = Box::new(Wrapper(&mut x, 123)); + let _: Box> = wrapper; + } + assert_eq!(432, x) +} diff --git a/src/test/run-pass/issues/issue-26802.rs b/src/test/run-pass/issues/issue-26802.rs new file mode 100644 index 00000000000..85d4e4a3f9f --- /dev/null +++ b/src/test/run-pass/issues/issue-26802.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo<'a> { + fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 } +} + +pub struct FooBar; +impl Foo<'static> for FooBar {} +fn test(foobar: FooBar) -> Box> { + Box::new(foobar) +} + +fn main() { + assert_eq!(test(FooBar).bar(&4), 11); +} diff --git a/src/test/run-pass/issues/issue-26805.rs b/src/test/run-pass/issues/issue-26805.rs new file mode 100644 index 00000000000..0459c654458 --- /dev/null +++ b/src/test/run-pass/issues/issue-26805.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct NonOrd; + +fn main() { + let _: Box> = Box::new(vec![NonOrd].into_iter()); +} diff --git a/src/test/run-pass/issues/issue-26873-multifile.rs b/src/test/run-pass/issues/issue-26873-multifile.rs new file mode 100644 index 00000000000..c557c0698d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-26873-multifile.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// ignore-pretty issue #37195 + +mod issue_26873_multifile; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-26873-onefile.rs b/src/test/run-pass/issues/issue-26873-onefile.rs new file mode 100644 index 00000000000..005491ecc58 --- /dev/null +++ b/src/test/run-pass/issues/issue-26873-onefile.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +mod A { + pub mod B { + use super::*; + + pub struct S; + } + + pub mod C { + use super::*; + use super::B::S; + + pub struct T; + } + + pub use self::C::T; +} + +use A::*; + +fn main() {} + diff --git a/src/test/run-pass/issues/issue-26905.rs b/src/test/run-pass/issues/issue-26905.rs new file mode 100644 index 00000000000..ec0f6b15a34 --- /dev/null +++ b/src/test/run-pass/issues/issue-26905.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(unsize, coerce_unsized)] + +// Verfies that PhantomData is ignored for DST coercions + +use std::marker::{Unsize, PhantomData}; +use std::ops::CoerceUnsized; + +struct MyRc { + _ptr: *const T, + _boo: PhantomData, +} + +impl, U: ?Sized> CoerceUnsized> for MyRc{ } + +fn main() { + let data = [1, 2, 3]; + let iter = data.iter(); + let x = MyRc { _ptr: &iter, _boo: PhantomData }; + let _y: MyRc> = x; +} + diff --git a/src/test/run-pass/issues/issue-26996.rs b/src/test/run-pass/issues/issue-26996.rs new file mode 100644 index 00000000000..8d53b739da2 --- /dev/null +++ b/src/test/run-pass/issues/issue-26996.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let mut c = (1, "".to_owned()); + match c { + c2 => { + c.0 = 2; + assert_eq!(c2.0, 1); + } + } +} diff --git a/src/test/run-pass/issues/issue-26997.rs b/src/test/run-pass/issues/issue-26997.rs new file mode 100644 index 00000000000..e6d0ef14431 --- /dev/null +++ b/src/test/run-pass/issues/issue-26997.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Foo { + x: isize, + y: isize +} + +impl Foo { + pub extern fn foo_new() -> Foo { + Foo { x: 21, y: 33 } + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-27021.rs b/src/test/run-pass/issues/issue-27021.rs new file mode 100644 index 00000000000..addeebe9def --- /dev/null +++ b/src/test/run-pass/issues/issue-27021.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let mut c = (1, (1, "".to_owned())); + match c { + c2 => { (c.1).0 = 2; assert_eq!((c2.1).0, 1); } + } + + let mut c = (1, (1, (1, "".to_owned()))); + match c.1 { + c2 => { ((c.1).1).0 = 3; assert_eq!((c2.1).0, 1); } + } +} diff --git a/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs b/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs new file mode 100644 index 00000000000..cd7e94a2352 --- /dev/null +++ b/src/test/run-pass/issues/issue-27054-primitive-binary-ops.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let x = &mut 1; + assert_eq!(*x + { *x=2; 1 }, 2); +} diff --git a/src/test/run-pass/issues/issue-27060.rs b/src/test/run-pass/issues/issue-27060.rs new file mode 100644 index 00000000000..594edb3fd71 --- /dev/null +++ b/src/test/run-pass/issues/issue-27060.rs @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[repr(packed)] +pub struct Good { + data: &'static u32, + data2: [&'static u32; 2], + aligned: [u8; 32], +} + +#[repr(packed)] +pub struct JustArray { + array: [u32] +} + +// kill this test when that turns to a hard error +#[allow(safe_packed_borrows)] +fn main() { + let good = Good { + data: &0, + data2: [&0, &0], + aligned: [0; 32] + }; + + unsafe { + let _ = &good.data; // ok + let _ = &good.data2[0]; // ok + } + + let _ = &good.data; + let _ = &good.data2[0]; + let _ = &*good.data; // ok, behind a pointer + let _ = &good.aligned; // ok, has align 1 + let _ = &good.aligned[2]; // ok, has align 1 +} diff --git a/src/test/run-pass/issues/issue-2708.rs b/src/test/run-pass/issues/issue-2708.rs new file mode 100644 index 00000000000..5fccdb0f137 --- /dev/null +++ b/src/test/run-pass/issues/issue-2708.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +struct Font { + fontbuf: usize, + cairo_font: usize, + font_dtor: usize, + +} + +impl Drop for Font { + fn drop(&mut self) {} +} + +fn Font() -> Font { + Font { + fontbuf: 0, + cairo_font: 0, + font_dtor: 0 + } +} + +pub fn main() { + let _f: Box<_> = box Font(); +} diff --git a/src/test/run-pass/issues/issue-27105.rs b/src/test/run-pass/issues/issue-27105.rs new file mode 100644 index 00000000000..e565acde2f0 --- /dev/null +++ b/src/test/run-pass/issues/issue-27105.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cell::RefCell; +use std::rc::Rc; + +pub struct Callbacks { + callbacks: Vec>>, +} + +impl Callbacks { + pub fn register(&mut self, callback: F) { + self.callbacks.push(Rc::new(RefCell::new(callback))); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2718.rs b/src/test/run-pass/issues/issue-2718.rs new file mode 100644 index 00000000000..1c5e7c7333d --- /dev/null +++ b/src/test/run-pass/issues/issue-2718.rs @@ -0,0 +1,334 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +pub type Task = isize; + +// tjc: I don't know why +pub mod pipes { + use self::state::{empty, full, blocked, terminated}; + use super::Task; + use std::mem::{forget, transmute}; + use std::mem::{replace, swap}; + use std::mem; + use std::thread; + use std::marker::Send; + + pub struct Stuff { + state: state, + blocked_task: Option, + payload: Option + } + + #[derive(PartialEq, Debug)] + #[repr(isize)] + pub enum state { + empty, + full, + blocked, + terminated + } + + pub struct packet { + state: state, + blocked_task: Option, + payload: Option + } + + unsafe impl Send for packet {} + + pub fn packet() -> *const packet { + unsafe { + let p: *const packet = mem::transmute(Box::new(Stuff{ + state: empty, + blocked_task: None::, + payload: None:: + })); + p + } + } + + mod rusti { + pub fn atomic_xchg(_dst: &mut isize, _src: isize) -> isize { panic!(); } + pub fn atomic_xchg_acq(_dst: &mut isize, _src: isize) -> isize { panic!(); } + pub fn atomic_xchg_rel(_dst: &mut isize, _src: isize) -> isize { panic!(); } + } + + // We should consider moving this to ::std::unsafe, although I + // suspect graydon would want us to use void pointers instead. + pub unsafe fn uniquify(x: *const T) -> Box { + mem::transmute(x) + } + + pub fn swap_state_acq(dst: &mut state, src: state) -> state { + unsafe { + transmute(rusti::atomic_xchg_acq(transmute(dst), src as isize)) + } + } + + pub fn swap_state_rel(dst: &mut state, src: state) -> state { + unsafe { + transmute(rusti::atomic_xchg_rel(transmute(dst), src as isize)) + } + } + + pub fn send(mut p: send_packet, payload: T) { + let p = p.unwrap(); + let mut p = unsafe { uniquify(p) }; + assert!((*p).payload.is_none()); + (*p).payload = Some(payload); + let old_state = swap_state_rel(&mut (*p).state, full); + match old_state { + empty => { + // Yay, fastpath. + + // The receiver will eventually clean this up. + unsafe { forget(p); } + } + full => { panic!("duplicate send") } + blocked => { + + // The receiver will eventually clean this up. + unsafe { forget(p); } + } + terminated => { + // The receiver will never receive this. Rely on drop_glue + // to clean everything up. + } + } + } + + pub fn recv(mut p: recv_packet) -> Option { + let p = p.unwrap(); + let mut p = unsafe { uniquify(p) }; + loop { + let old_state = swap_state_acq(&mut (*p).state, + blocked); + match old_state { + empty | blocked => { thread::yield_now(); } + full => { + let payload = replace(&mut p.payload, None); + return Some(payload.unwrap()) + } + terminated => { + assert_eq!(old_state, terminated); + return None; + } + } + } + } + + pub fn sender_terminate(p: *const packet) { + let mut p = unsafe { uniquify(p) }; + match swap_state_rel(&mut (*p).state, terminated) { + empty | blocked => { + // The receiver will eventually clean up. + unsafe { forget(p) } + } + full => { + // This is impossible + panic!("you dun goofed") + } + terminated => { + // I have to clean up, use drop_glue + } + } + } + + pub fn receiver_terminate(p: *const packet) { + let mut p = unsafe { uniquify(p) }; + match swap_state_rel(&mut (*p).state, terminated) { + empty => { + // the sender will clean up + unsafe { forget(p) } + } + blocked => { + // this shouldn't happen. + panic!("terminating a blocked packet") + } + terminated | full => { + // I have to clean up, use drop_glue + } + } + } + + pub struct send_packet { + p: Option<*const packet>, + } + + impl Drop for send_packet { + fn drop(&mut self) { + unsafe { + if self.p != None { + let self_p: &mut Option<*const packet> = + mem::transmute(&mut self.p); + let p = replace(self_p, None); + sender_terminate(p.unwrap()) + } + } + } + } + + impl send_packet { + pub fn unwrap(&mut self) -> *const packet { + replace(&mut self.p, None).unwrap() + } + } + + pub fn send_packet(p: *const packet) -> send_packet { + send_packet { + p: Some(p) + } + } + + pub struct recv_packet { + p: Option<*const packet>, + } + + impl Drop for recv_packet { + fn drop(&mut self) { + unsafe { + if self.p != None { + let self_p: &mut Option<*const packet> = + mem::transmute(&mut self.p); + let p = replace(self_p, None); + receiver_terminate(p.unwrap()) + } + } + } + } + + impl recv_packet { + pub fn unwrap(&mut self) -> *const packet { + replace(&mut self.p, None).unwrap() + } + } + + pub fn recv_packet(p: *const packet) -> recv_packet { + recv_packet { + p: Some(p) + } + } + + pub fn entangle() -> (send_packet, recv_packet) { + let p = packet(); + (send_packet(p), recv_packet(p)) + } +} + +pub mod pingpong { + use std::mem; + + pub struct ping(::pipes::send_packet); + + unsafe impl Send for ping {} + + pub struct pong(::pipes::send_packet); + + unsafe impl Send for pong {} + + pub fn liberate_ping(p: ping) -> ::pipes::send_packet { + unsafe { + let _addr : *const ::pipes::send_packet = match &p { + &ping(ref x) => { mem::transmute(x) } + }; + panic!() + } + } + + pub fn liberate_pong(p: pong) -> ::pipes::send_packet { + unsafe { + let _addr : *const ::pipes::send_packet = match &p { + &pong(ref x) => { mem::transmute(x) } + }; + panic!() + } + } + + pub fn init() -> (client::ping, server::ping) { + ::pipes::entangle() + } + + pub mod client { + use pingpong; + + pub type ping = ::pipes::send_packet; + pub type pong = ::pipes::recv_packet; + + pub fn do_ping(c: ping) -> pong { + let (sp, rp) = ::pipes::entangle(); + + ::pipes::send(c, pingpong::ping(sp)); + rp + } + + pub fn do_pong(c: pong) -> (ping, ()) { + let packet = ::pipes::recv(c); + if packet.is_none() { + panic!("sender closed the connection") + } + (pingpong::liberate_pong(packet.unwrap()), ()) + } + } + + pub mod server { + use pingpong; + + pub type ping = ::pipes::recv_packet; + pub type pong = ::pipes::send_packet; + + pub fn do_ping(c: ping) -> (pong, ()) { + let packet = ::pipes::recv(c); + if packet.is_none() { + panic!("sender closed the connection") + } + (pingpong::liberate_ping(packet.unwrap()), ()) + } + + pub fn do_pong(c: pong) -> ping { + let (sp, rp) = ::pipes::entangle(); + ::pipes::send(c, pingpong::pong(sp)); + rp + } + } +} + +fn client(chan: pingpong::client::ping) { + let chan = pingpong::client::do_ping(chan); + println!("Sent ping"); + let (_chan, _data) = pingpong::client::do_pong(chan); + println!("Received pong"); +} + +fn server(chan: pingpong::server::ping) { + let (chan, _data) = pingpong::server::do_ping(chan); + println!("Received ping"); + let _chan = pingpong::server::do_pong(chan); + println!("Sent pong"); +} + +pub fn main() { + /* +// Commented out because of option::get error + + let (client_, server_) = pingpong::init(); + + task::spawn {|client_| + let client__ = client_.take(); + client(client__); + }; + task::spawn {|server_| + let server__ = server_.take(); + server(server_ËŠ); + }; + */ +} diff --git a/src/test/run-pass/issues/issue-2723-b.rs b/src/test/run-pass/issues/issue-2723-b.rs new file mode 100644 index 00000000000..34f5238cc80 --- /dev/null +++ b/src/test/run-pass/issues/issue-2723-b.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_2723_a.rs + +extern crate issue_2723_a; +use issue_2723_a::f; + +pub fn main() { + unsafe { + f(vec![2]); + } +} diff --git a/src/test/run-pass/issues/issue-27240.rs b/src/test/run-pass/issues/issue-27240.rs new file mode 100644 index 00000000000..5e65a8084c3 --- /dev/null +++ b/src/test/run-pass/issues/issue-27240.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt; +struct NoisyDrop(T); +impl Drop for NoisyDrop { + fn drop(&mut self) {} +} + +struct Bar([*const NoisyDrop; 2]); + +fn fine() { + let (u,b); + u = vec![43]; + b = Bar([&NoisyDrop(&u), &NoisyDrop(&u)]); +} + +struct Bar2(*const NoisyDrop, *const NoisyDrop); + +fn lolwut() { + let (u,v); + u = vec![43]; + v = Bar2(&NoisyDrop(&u), &NoisyDrop(&u)); +} + +fn main() { fine(); lolwut() } diff --git a/src/test/run-pass/issues/issue-27268.rs b/src/test/run-pass/issues/issue-27268.rs new file mode 100644 index 00000000000..fa23241a25b --- /dev/null +++ b/src/test/run-pass/issues/issue-27268.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + const _C: &'static Fn() = &||{}; +} diff --git a/src/test/run-pass/issues/issue-27281.rs b/src/test/run-pass/issues/issue-27281.rs new file mode 100644 index 00000000000..1dc4ac5cdcc --- /dev/null +++ b/src/test/run-pass/issues/issue-27281.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Trait<'a> { + type T; + type U; + fn foo(&self, s: &'a ()) -> &'a (); +} + +impl<'a> Trait<'a> for () { + type T = &'a (); + type U = Self::T; + + fn foo(&self, s: &'a ()) -> &'a () { + let t: Self::T = s; t + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-27320.rs b/src/test/run-pass/issues/issue-27320.rs new file mode 100644 index 00000000000..e5df3ccd76e --- /dev/null +++ b/src/test/run-pass/issues/issue-27320.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_variables)] +#![allow(dead_code)] + +macro_rules! piece( + ($piece:pat) => ($piece); +); + +enum Piece {A, B} + +fn main() { + match Piece::A { + piece!(pt@ Piece::A) | piece!(pt@ Piece::B) => {} + } +} diff --git a/src/test/run-pass/issues/issue-2734.rs b/src/test/run-pass/issues/issue-2734.rs new file mode 100644 index 00000000000..e3b1618c625 --- /dev/null +++ b/src/test/run-pass/issues/issue-2734.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +trait hax { + fn dummy(&self) { } +} +impl hax for A { } + +fn perform_hax(x: Box) -> Box { + box x as Box +} + +fn deadcode() { + perform_hax(box "deadcode".to_string()); +} + +pub fn main() { + let _ = perform_hax(box 42); +} diff --git a/src/test/run-pass/issues/issue-2735-2.rs b/src/test/run-pass/issues/issue-2735-2.rs new file mode 100644 index 00000000000..a8e81682ada --- /dev/null +++ b/src/test/run-pass/issues/issue-2735-2.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// This test should behave exactly like issue-2735-3 +struct defer<'a> { + b: &'a Cell, +} + +impl<'a> Drop for defer<'a> { + fn drop(&mut self) { + self.b.set(true); + } +} + +fn defer(b: &Cell) -> defer { + defer { + b: b + } +} + +pub fn main() { + let dtor_ran = &Cell::new(false); + let _ = defer(dtor_ran); + assert!(dtor_ran.get()); +} diff --git a/src/test/run-pass/issues/issue-2735-3.rs b/src/test/run-pass/issues/issue-2735-3.rs new file mode 100644 index 00000000000..9b8c2a5142f --- /dev/null +++ b/src/test/run-pass/issues/issue-2735-3.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +// This test should behave exactly like issue-2735-2 +struct defer<'a> { + b: &'a Cell, +} + +impl<'a> Drop for defer<'a> { + fn drop(&mut self) { + self.b.set(true); + } +} + +fn defer(b: &Cell) -> defer { + defer { + b: b + } +} + +pub fn main() { + let dtor_ran = &Cell::new(false); + defer(dtor_ran); + assert!(dtor_ran.get()); +} diff --git a/src/test/run-pass/issues/issue-2735.rs b/src/test/run-pass/issues/issue-2735.rs new file mode 100644 index 00000000000..b22051700d8 --- /dev/null +++ b/src/test/run-pass/issues/issue-2735.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +trait hax { + fn dummy(&self) { } +} +impl hax for A { } + +fn perform_hax(x: Box) -> Box { + box x as Box +} + +fn deadcode() { + perform_hax(box "deadcode".to_string()); +} + +pub fn main() { + perform_hax(box 42); +} diff --git a/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs b/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs new file mode 100644 index 00000000000..d72c8309a5f --- /dev/null +++ b/src/test/run-pass/issues/issue-27401-dropflag-reinit.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37201 + +// Check that when a `let`-binding occurs in a loop, its associated +// drop-flag is reinitialized (to indicate "needs-drop" at the end of +// the owning variable's scope). + +struct A<'a>(&'a mut i32); + +impl<'a> Drop for A<'a> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut cnt = 0; + for i in 0..2 { + let a = A(&mut cnt); + if i == 1 { // Note that + break; // both this break + } // and also + drop(a); // this move of `a` + // are necessary to expose the bug + } + assert_eq!(cnt, 2); +} diff --git a/src/test/run-pass/issues/issue-2748-a.rs b/src/test/run-pass/issues/issue-2748-a.rs new file mode 100644 index 00000000000..9d84e2dccbc --- /dev/null +++ b/src/test/run-pass/issues/issue-2748-a.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + +struct CMap<'a> { + buf: &'a [u8], +} + +fn CMap(buf: &[u8]) -> CMap { + CMap { + buf: buf + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-2748-b.rs b/src/test/run-pass/issues/issue-2748-b.rs new file mode 100644 index 00000000000..78e3a3882c2 --- /dev/null +++ b/src/test/run-pass/issues/issue-2748-b.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn thing<'r>(x: &'r [isize]) -> &'r [isize] { x } + +pub fn main() { + let x = &[1,2,3]; + let y = x; + let z = thing(x); + assert_eq!(z[2], x[2]); + assert_eq!(z[1], y[1]); +} diff --git a/src/test/run-pass/issues/issue-27583.rs b/src/test/run-pass/issues/issue-27583.rs new file mode 100644 index 00000000000..1a1ad2bc194 --- /dev/null +++ b/src/test/run-pass/issues/issue-27583.rs @@ -0,0 +1,57 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #27583. Unclear how useful this will be +// going forward, since the issue in question was EXTREMELY sensitive +// to compiler internals (like the precise numbering of nodes), but +// what the hey. + +#![allow(warnings)] + +use std::cell::Cell; +use std::marker::PhantomData; + +pub trait Delegate<'tcx> { } + +pub struct InferCtxt<'a, 'tcx: 'a> { + x: PhantomData<&'a Cell<&'tcx ()>> +} + +pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> { + x: &'t InferCtxt<'a, 'tcx>, +} + +pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> { + typer: &'t InferCtxt<'a, 'tcx>, + mc: MemCategorizationContext<'t, 'a, 'tcx>, + delegate: &'d mut (Delegate<'tcx>+'d), +} + +impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> { + pub fn new(delegate: &'d mut Delegate<'tcx>, + typer: &'t InferCtxt<'a, 'tcx>) + -> ExprUseVisitor<'d,'t,'a,'tcx> + { + ExprUseVisitor { + typer: typer, + mc: MemCategorizationContext::new(typer), + delegate: delegate, + } + } +} + +impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> { + pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> { + MemCategorizationContext { x: typer } + } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-27639.rs b/src/test/run-pass/issues/issue-27639.rs new file mode 100644 index 00000000000..81b1a2518fc --- /dev/null +++ b/src/test/run-pass/issues/issue-27639.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +fn main() { + const iter: i32 = 0; + + for i in 1..10 { + println!("{}", i); + } +} diff --git a/src/test/run-pass/issues/issue-27859.rs b/src/test/run-pass/issues/issue-27859.rs new file mode 100644 index 00000000000..e289995317f --- /dev/null +++ b/src/test/run-pass/issues/issue-27859.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no std::env +// ignore-wasm32 issue 42629 + +#[inline(never)] +fn foo(a: f32, b: f32) -> f32 { + a % b +} + +#[inline(never)] +fn bar(a: f32, b: f32) -> f32 { + ((a as f64) % (b as f64)) as f32 +} + +fn main() { + let unknown_float = std::env::args().len(); + println!("{}", foo(4.0, unknown_float as f32)); + println!("{}", foo(5.0, (unknown_float as f32) + 1.0)); + println!("{}", bar(6.0, (unknown_float as f32) + 2.0)); + println!("{}", bar(7.0, (unknown_float as f32) + 3.0)); +} diff --git a/src/test/run-pass/issues/issue-27889.rs b/src/test/run-pass/issues/issue-27889.rs new file mode 100644 index 00000000000..a16bfeb8daa --- /dev/null +++ b/src/test/run-pass/issues/issue-27889.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a field can have the same name in different variants +// of an enum + +pub enum Foo { + X { foo: u32 }, + Y { foo: u32 } +} + +pub fn foo(mut x: Foo) { + let mut y = None; + let mut z = None; + if let Foo::X { ref foo } = x { + z = Some(foo); + } + if let Foo::Y { ref mut foo } = x { + y = Some(foo); + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-27890.rs b/src/test/run-pass/issues/issue-27890.rs new file mode 100644 index 00000000000..3526a77cbd5 --- /dev/null +++ b/src/test/run-pass/issues/issue-27890.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +static PLUS_ONE: &'static (Fn(i32) -> i32 + Sync) = (&|x: i32| { x + 1 }) + as &'static (Fn(i32) -> i32 + Sync); + +fn main() { + assert_eq!(PLUS_ONE(2), 3); +} diff --git a/src/test/run-pass/issues/issue-27901.rs b/src/test/run-pass/issues/issue-27901.rs new file mode 100644 index 00000000000..5d02bace609 --- /dev/null +++ b/src/test/run-pass/issues/issue-27901.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Stream { type Item; } +impl<'a> Stream for &'a str { type Item = u8; } +fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) { + (s, 42) +} + +fn main() { + let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item); + assert_eq!(fx("hi"), ("hi", 42)); +} diff --git a/src/test/run-pass/issues/issue-27997.rs b/src/test/run-pass/issues/issue-27997.rs new file mode 100644 index 00000000000..f8dba27390c --- /dev/null +++ b/src/test/run-pass/issues/issue-27997.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::sync::atomic::{Ordering, AtomicUsize}; + +use std::mem; +struct S { + _u: U, + size_of_u: usize, + _v: V, + size_of_v: usize +} + +impl S { + fn new(u: U, v: V) -> Self { + S { + _u: u, + size_of_u: mem::size_of::(), + _v: v, + size_of_v: mem::size_of::() + } + } +} + +static COUNT: AtomicUsize = AtomicUsize::new(0); + +impl Drop for S { + fn drop(&mut self) { + assert_eq!(mem::size_of::(), self.size_of_u); + assert_eq!(mem::size_of::(), self.size_of_v); + COUNT.store(COUNT.load(Ordering::SeqCst)+1, Ordering::SeqCst); + } +} + +fn main() { + assert_eq!(COUNT.load(Ordering::SeqCst), 0); + { S::new(0u8, 1u16); } + assert_eq!(COUNT.load(Ordering::SeqCst), 1); +} diff --git a/src/test/run-pass/issues/issue-2804-2.rs b/src/test/run-pass/issues/issue-2804-2.rs new file mode 100644 index 00000000000..a080627c686 --- /dev/null +++ b/src/test/run-pass/issues/issue-2804-2.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Minimized version of issue-2804.rs. Both check that callee IDs don't +// clobber the previous node ID in a macro expr + +use std::collections::HashMap; + +fn add_interfaces(managed_ip: String, device: HashMap) { + println!("{}, {}", managed_ip, device["interfaces"]); +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-28181.rs b/src/test/run-pass/issues/issue-28181.rs new file mode 100644 index 00000000000..21b0100e815 --- /dev/null +++ b/src/test/run-pass/issues/issue-28181.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn bar(f: F) -> usize where F: Fn([usize; 1]) -> usize { f([2]) } + +fn main() { + bar(|u| { u[0] }); +} diff --git a/src/test/run-pass/issues/issue-28279.rs b/src/test/run-pass/issues/issue-28279.rs new file mode 100644 index 00000000000..bc615c8f7e3 --- /dev/null +++ b/src/test/run-pass/issues/issue-28279.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::rc::Rc; + +fn test1() -> Rc Fn(&'a usize) + 'static> { + if let Some(_) = Some(1) { + loop{} + } else { + loop{} + } +} + +fn test2() -> *mut (for<'a> Fn(&'a usize) + 'static) { + if let Some(_) = Some(1) { + loop{} + } else { + loop{} + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-28550.rs b/src/test/run-pass/issues/issue-28550.rs new file mode 100644 index 00000000000..95b6943849c --- /dev/null +++ b/src/test/run-pass/issues/issue-28550.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct AT,T>(F::Output); +struct BT,T>(A); + +// Removing Option causes it to compile. +fn fooT>(f: F) -> Option> { + Some(B(A(f()))) +} + +fn main() { + let v = (|| foo(||4))(); + match v { + Some(B(A(4))) => {}, + _ => unreachable!() + } +} diff --git a/src/test/run-pass/issues/issue-28561.rs b/src/test/run-pass/issues/issue-28561.rs new file mode 100644 index 00000000000..5927ce77f8e --- /dev/null +++ b/src/test/run-pass/issues/issue-28561.rs @@ -0,0 +1,121 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +struct Array { + f00: [T; 00], + f01: [T; 01], + f02: [T; 02], + f03: [T; 03], + f04: [T; 04], + f05: [T; 05], + f06: [T; 06], + f07: [T; 07], + f08: [T; 08], + f09: [T; 09], + f10: [T; 10], + f11: [T; 11], + f12: [T; 12], + f13: [T; 13], + f14: [T; 14], + f15: [T; 15], + f16: [T; 16], + f17: [T; 17], + f18: [T; 18], + f19: [T; 19], + f20: [T; 20], + f21: [T; 21], + f22: [T; 22], + f23: [T; 23], + f24: [T; 24], + f25: [T; 25], + f26: [T; 26], + f27: [T; 27], + f28: [T; 28], + f29: [T; 29], + f30: [T; 30], + f31: [T; 31], + f32: [T; 32], +} + +// FIXME(#44580): merge with `Array` once `[T; N]: Clone` where `T: Clone` +#[derive(Clone, Copy)] +struct CopyArray { + f00: [T; 00], + f01: [T; 01], + f02: [T; 02], + f03: [T; 03], + f04: [T; 04], + f05: [T; 05], + f06: [T; 06], + f07: [T; 07], + f08: [T; 08], + f09: [T; 09], + f10: [T; 10], + f11: [T; 11], + f12: [T; 12], + f13: [T; 13], + f14: [T; 14], + f15: [T; 15], + f16: [T; 16], + f17: [T; 17], + f18: [T; 18], + f19: [T; 19], + f20: [T; 20], + f21: [T; 21], + f22: [T; 22], + f23: [T; 23], + f24: [T; 24], + f25: [T; 25], + f26: [T; 26], + f27: [T; 27], + f28: [T; 28], + f29: [T; 29], + f30: [T; 30], + f31: [T; 31], + f32: [T; 32], +} + +#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] +struct Fn { + f00: fn(), + f01: fn(A), + f02: fn(A, B), + f03: fn(A, B, C), + f04: fn(A, B, C, D), + f05: fn(A, B, C, D, E), + f06: fn(A, B, C, D, E, F), + f07: fn(A, B, C, D, E, F, G), + f08: fn(A, B, C, D, E, F, G, H), + f09: fn(A, B, C, D, E, F, G, H, I), + f10: fn(A, B, C, D, E, F, G, H, I, J), + f11: fn(A, B, C, D, E, F, G, H, I, J, K), + f12: fn(A, B, C, D, E, F, G, H, I, J, K, L), +} + +#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] +struct Tuple { + f00: (), + f01: (A), + f02: (A, B), + f03: (A, B, C), + f04: (A, B, C, D), + f05: (A, B, C, D, E), + f06: (A, B, C, D, E, F), + f07: (A, B, C, D, E, F, G), + f08: (A, B, C, D, E, F, G, H), + f09: (A, B, C, D, E, F, G, H, I), + f10: (A, B, C, D, E, F, G, H, I, J), + f11: (A, B, C, D, E, F, G, H, I, J, K), + f12: (A, B, C, D, E, F, G, H, I, J, K, L), +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-28600.rs b/src/test/run-pass/issues/issue-28600.rs new file mode 100644 index 00000000000..0f3573f7e62 --- /dev/null +++ b/src/test/run-pass/issues/issue-28600.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #28600 ICE: pub extern fn with parameter type &str inside struct impl + +struct Test; + +impl Test { + #[allow(dead_code)] + #[allow(unused_variables)] + pub extern fn test(val: &str) { + + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-28676.rs b/src/test/run-pass/issues/issue-28676.rs new file mode 100644 index 00000000000..978d2136334 --- /dev/null +++ b/src/test/run-pass/issues/issue-28676.rs @@ -0,0 +1,44 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// ignore-wasm32-bare no libc to test ffi with + +#[derive(Copy, Clone)] +pub struct Quad { a: u64, b: u64, c: u64, d: u64 } + +mod rustrt { + use super::Quad; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn get_c_many_params(_: *const (), _: *const (), + _: *const (), _: *const (), f: Quad) -> u64; + } +} + +fn test() { + unsafe { + let null = std::ptr::null(); + let q = Quad { + a: 1, + b: 2, + c: 3, + d: 4 + }; + assert_eq!(rustrt::get_c_many_params(null, null, null, null, q), q.c); + } +} + +pub fn main() { + test(); +} diff --git a/src/test/run-pass/issues/issue-28777.rs b/src/test/run-pass/issues/issue-28777.rs new file mode 100644 index 00000000000..a796d211df2 --- /dev/null +++ b/src/test/run-pass/issues/issue-28777.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let v1 = { 1 + {2} * {3} }; + let v2 = 1 + {2} * {3} ; + + assert_eq!(7, v1); + assert_eq!(7, v2); + + let v3; + v3 = { 1 + {2} * {3} }; + let v4; + v4 = 1 + {2} * {3}; + assert_eq!(7, v3); + assert_eq!(7, v4); + + let v5 = { 1 + {2} * 3 }; + assert_eq!(7, v5); + + let v9 = { 1 + if 1 > 2 {1} else {2} * {3} }; + assert_eq!(7, v9); +} diff --git a/src/test/run-pass/issues/issue-28822.rs b/src/test/run-pass/issues/issue-28822.rs new file mode 100644 index 00000000000..39e4a23e3cd --- /dev/null +++ b/src/test/run-pass/issues/issue-28822.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +fn main() {} + +const fn size_ofs(_: usize) {} +const fn size_ofs2(_foo: usize) {} diff --git a/src/test/run-pass/issues/issue-28828.rs b/src/test/run-pass/issues/issue-28828.rs new file mode 100644 index 00000000000..2fb6b5875c1 --- /dev/null +++ b/src/test/run-pass/issues/issue-28828.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Foo { + type Out; +} + +impl Foo for () { + type Out = bool; +} + +fn main() { + type Bool = <() as Foo>::Out; + + let x: Bool = true; + assert!(x); + + let y: Option = None; + assert_eq!(y, None); +} diff --git a/src/test/run-pass/issues/issue-28839.rs b/src/test/run-pass/issues/issue-28839.rs new file mode 100644 index 00000000000..1b536fe83c7 --- /dev/null +++ b/src/test/run-pass/issues/issue-28839.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37199 + +pub struct Foo; + +pub fn get_foo2<'a>(foo: &'a mut Option<&'a mut Foo>) -> &'a mut Foo { + match foo { + // Ensure that this is not considered a move, but rather a reborrow. + &mut Some(ref mut x) => *x, + &mut None => panic!(), + } +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-28871.rs b/src/test/run-pass/issues/issue-28871.rs new file mode 100644 index 00000000000..2be32409274 --- /dev/null +++ b/src/test/run-pass/issues/issue-28871.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #28871. The problem is that rustc encountered +// two ways to project, one from a where clause and one from the where +// clauses on the trait definition. (In fact, in this case, the where +// clauses originated from the trait definition as well.) The true +// cause of the error is that the trait definition where clauses are +// not being normalized, and hence the two sources are considered in +// conflict, and not a duplicate. Hacky solution is to prefer where +// clauses over the data found in the trait definition. + +trait T { + type T; +} + +struct S; +impl T for S { + type T = S; +} + +trait T2 { + type T: Iterator::T>; +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-28936.rs b/src/test/run-pass/issues/issue-28936.rs new file mode 100644 index 00000000000..1e3e3474c17 --- /dev/null +++ b/src/test/run-pass/issues/issue-28936.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub type Session = i32; +pub struct StreamParser<'a, T> { + _tokens: T, + _session: &'a mut Session, +} + +impl<'a, T> StreamParser<'a, T> { + pub fn thing(&mut self) -> bool { true } +} + +pub fn parse_stream, U, F>( + _session: &mut Session, _tokens: T, _f: F) -> U + where F: Fn(&mut StreamParser) -> U { panic!(); } + +pub fn thing(session: &mut Session) { + let mut stream = vec![1, 2, 3].into_iter(); + + let _b = parse_stream(session, + stream.by_ref(), + // replacing the above with the following fixes it + //&mut stream, + |p| p.thing()); + +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2895.rs b/src/test/run-pass/issues/issue-2895.rs new file mode 100644 index 00000000000..e52126e16f8 --- /dev/null +++ b/src/test/run-pass/issues/issue-2895.rs @@ -0,0 +1,37 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem; + +struct Cat { + x: isize +} + +struct Kitty { + x: isize, +} + +impl Drop for Kitty { + fn drop(&mut self) {} +} + +#[cfg(target_pointer_width = "64")] +pub fn main() { + assert_eq!(mem::size_of::(), 8 as usize); + assert_eq!(mem::size_of::(), 8 as usize); +} + +#[cfg(target_pointer_width = "32")] +pub fn main() { + assert_eq!(mem::size_of::(), 4 as usize); + assert_eq!(mem::size_of::(), 4 as usize); +} diff --git a/src/test/run-pass/issues/issue-28950.rs b/src/test/run-pass/issues/issue-28950.rs new file mode 100644 index 00000000000..b7426571fbd --- /dev/null +++ b/src/test/run-pass/issues/issue-28950.rs @@ -0,0 +1,32 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads +// compile-flags: -O + +// Tests that the `vec!` macro does not overflow the stack when it is +// given data larger than the stack. + +// FIXME(eddyb) Improve unoptimized codegen to avoid the temporary, +// and thus run successfully even when compiled at -C opt-level=0. + +const LEN: usize = 1 << 15; + +use std::thread::Builder; + +fn main() { + assert!(Builder::new().stack_size(LEN / 2).spawn(|| { + // FIXME(eddyb) this can be vec![[0: LEN]] pending + // https://llvm.org/bugs/show_bug.cgi?id=28987 + let vec = vec![unsafe { std::mem::zeroed::<[u8; LEN]>() }]; + assert_eq!(vec.len(), 1); + }).unwrap().join().is_ok()); +} diff --git a/src/test/run-pass/issues/issue-28983.rs b/src/test/run-pass/issues/issue-28983.rs new file mode 100644 index 00000000000..d38a519cb98 --- /dev/null +++ b/src/test/run-pass/issues/issue-28983.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Test { type T; } + +impl Test for u32 { + type T = i32; +} + +pub mod export { + #[no_mangle] + pub extern "C" fn issue_28983(t: ::T) -> i32 { t*3 } +} + +// to test both exporting and importing functions, import +// a function from ourselves. +extern "C" { + fn issue_28983(t: ::T) -> i32; +} + +fn main() { + assert_eq!(export::issue_28983(2), 6); + assert_eq!(unsafe { issue_28983(3) }, 9); +} diff --git a/src/test/run-pass/issues/issue-28999.rs b/src/test/run-pass/issues/issue-28999.rs new file mode 100644 index 00000000000..bb5747ca744 --- /dev/null +++ b/src/test/run-pass/issues/issue-28999.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Xyz<'a, V> { + pub v: (V, &'a u32), +} + +pub fn eq<'a, 's, 't, V>(this: &'s Xyz<'a, V>, other: &'t Xyz<'a, V>) -> bool + where V: PartialEq { + this.v == other.v +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-29030.rs b/src/test/run-pass/issues/issue-29030.rs new file mode 100644 index 00000000000..51dbf58a77d --- /dev/null +++ b/src/test/run-pass/issues/issue-29030.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct Message<'a, P: 'a = &'a [u8]> { + header: &'a [u8], + payload: P, +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-29037.rs b/src/test/run-pass/issues/issue-29037.rs new file mode 100644 index 00000000000..2ee4446820b --- /dev/null +++ b/src/test/run-pass/issues/issue-29037.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test ensures that each pointer type `P` is covariant in `X`. + +use std::rc::Rc; +use std::sync::Arc; + +fn a<'r>(x: Box<&'static str>) -> Box<&'r str> { + x +} + +fn b<'r, 'w>(x: &'w &'static str) -> &'w &'r str { + x +} + +fn c<'r>(x: Arc<&'static str>) -> Arc<&'r str> { + x +} + +fn d<'r>(x: Rc<&'static str>) -> Rc<&'r str> { + x +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2904.rs b/src/test/run-pass/issues/issue-2904.rs new file mode 100644 index 00000000000..dcb8515c776 --- /dev/null +++ b/src/test/run-pass/issues/issue-2904.rs @@ -0,0 +1,86 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Map representation + +use std::fmt; +use std::io::prelude::*; +use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty}; + +enum square { + bot, + wall, + rock, + lambda, + closed_lift, + open_lift, + earth, + empty +} + +impl fmt::Debug for square { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", match *self { + bot => { "R".to_string() } + wall => { "#".to_string() } + rock => { "*".to_string() } + lambda => { "\\".to_string() } + closed_lift => { "L".to_string() } + open_lift => { "O".to_string() } + earth => { ".".to_string() } + empty => { " ".to_string() } + }) + } +} + +fn square_from_char(c: char) -> square { + match c { + 'R' => { bot } + '#' => { wall } + '*' => { rock } + '\\' => { lambda } + 'L' => { closed_lift } + 'O' => { open_lift } + '.' => { earth } + ' ' => { empty } + _ => { + println!("invalid square: {}", c); + panic!() + } + } +} + +fn read_board_grid(mut input: rdr) + -> Vec> { + let mut input: &mut Read = &mut input; + let mut grid = Vec::new(); + let mut line = [0; 10]; + input.read(&mut line); + let mut row = Vec::new(); + for c in &line { + row.push(square_from_char(*c as char)) + } + grid.push(row); + let width = grid[0].len(); + for row in &grid { assert_eq!(row.len(), width) } + grid +} + +mod test { + #[test] + pub fn trivial_to_string() { + assert_eq!(lambda.to_string(), "\\") + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-29048.rs b/src/test/run-pass/issues/issue-29048.rs new file mode 100644 index 00000000000..f889cd8af61 --- /dev/null +++ b/src/test/run-pass/issues/issue-29048.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Chan; +pub struct ChanSelect<'c, T> { + chans: Vec<(&'c Chan, T)>, +} +impl<'c, T> ChanSelect<'c, T> { + pub fn add_recv_ret(&mut self, chan: &'c Chan, ret: T) + { + self.chans.push((chan, ret)); + } +} +fn main() {} diff --git a/src/test/run-pass/issues/issue-29053.rs b/src/test/run-pass/issues/issue-29053.rs new file mode 100644 index 00000000000..47800b48de4 --- /dev/null +++ b/src/test/run-pass/issues/issue-29053.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let x: &'static str = "x"; + + { + let y = "y".to_string(); + let ref mut x = &*x; + *x = &*y; + } + + assert_eq!(x, "x"); +} diff --git a/src/test/run-pass/issues/issue-29071-2.rs b/src/test/run-pass/issues/issue-29071-2.rs new file mode 100644 index 00000000000..f0025f25557 --- /dev/null +++ b/src/test/run-pass/issues/issue-29071-2.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn t1() -> u32 { + let x; + x = if true { [1, 2, 3] } else { [2, 3, 4] }[0]; + x +} + +fn t2() -> [u32; 1] { + if true { [1, 2, 3]; } else { [2, 3, 4]; } + [0] +} + +fn t3() -> u32 { + let x; + x = if true { i1 as F } else { i2 as F }(); + x +} + +fn t4() -> () { + if true { i1 as F; } else { i2 as F; } + () +} + +type F = fn() -> u32; +fn i1() -> u32 { 1 } +fn i2() -> u32 { 2 } + +fn main() { + assert_eq!(t1(), 1); + assert_eq!(t3(), 1); +} diff --git a/src/test/run-pass/issues/issue-29071.rs b/src/test/run-pass/issues/issue-29071.rs new file mode 100644 index 00000000000..06570f41a53 --- /dev/null +++ b/src/test/run-pass/issues/issue-29071.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +fn ret() -> u32 { + static x: u32 = 10; + x & if true { 10u32 } else { 20u32 } & x +} + +fn ret2() -> &'static u32 { + static x: u32 = 10; + if true { 10u32; } else { 20u32; } + &x +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-29092.rs b/src/test/run-pass/issues/issue-29092.rs new file mode 100644 index 00000000000..3517f016675 --- /dev/null +++ b/src/test/run-pass/issues/issue-29092.rs @@ -0,0 +1,36 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for Issue #29092. +// +// (Possibly redundant with regression test run-pass/issue-30530.rs) + +use self::Term::*; + +#[derive(Clone)] +pub enum Term { + Dummy, + A(Box), + B(Box), +} + +// a small-step evaluator +pub fn small_eval(v: Term) -> Term { + match v { + A(t) => *t.clone(), + B(t) => *t.clone(), + _ => Dummy, + } +} + +fn main() { + small_eval(Dummy); +} diff --git a/src/test/run-pass/issues/issue-29147.rs b/src/test/run-pass/issues/issue-29147.rs new file mode 100644 index 00000000000..93ff713eafe --- /dev/null +++ b/src/test/run-pass/issues/issue-29147.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![recursion_limit="1024"] + +use std::mem; + +pub struct S0(T,T); +pub struct S1(Option>>>,Option>>>); +pub struct S2(Option>>>,Option>>>); +pub struct S3(Option>>>,Option>>>); +pub struct S4(Option>>>,Option>>>); +pub struct S5(Option>>>,Option>>>,Option); + +trait Foo { fn xxx(&self); } +/// some local of #[fundamental] trait +trait Bar {} + +impl Foo for T where T: Bar, T: Sync { + fn xxx(&self) {} +} + +impl Foo for S5 { fn xxx(&self) {} } + +fn main() { + let s = S5(None,None,None); + s.xxx(); + assert_eq!(mem::size_of_val(&s.2), mem::size_of::>()); +} diff --git a/src/test/run-pass/issues/issue-29166.rs b/src/test/run-pass/issues/issue-29166.rs new file mode 100644 index 00000000000..1cc2c7a8893 --- /dev/null +++ b/src/test/run-pass/issues/issue-29166.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test ensures that vec.into_iter does not overconstrain element lifetime. + +pub fn main() { + original_report(); + revision_1(); + revision_2(); +} + +fn original_report() { + drop(vec![&()].into_iter()) +} + +fn revision_1() { + // below is what above `vec!` expands into at time of this writing. + drop(<[_]>::into_vec(::std::boxed::Box::new([&()])).into_iter()) +} + +fn revision_2() { + drop((match (Vec::new(), &()) { (mut v, b) => { v.push(b); v } }).into_iter()) +} diff --git a/src/test/run-pass/issues/issue-29227.rs b/src/test/run-pass/issues/issue-29227.rs new file mode 100644 index 00000000000..a33bb698634 --- /dev/null +++ b/src/test/run-pass/issues/issue-29227.rs @@ -0,0 +1,152 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-tidy-linelength + +// Regression test for #29227. The problem here was that MIR +// construction for these gigantic match expressions was very +// inefficient. + +pub trait CharExt : Sized + Copy { + fn is_unicode_uppercase_letter(self) -> bool { false } + fn is_unicode_lowercase_letter(self) -> bool { false } + fn is_unicode_titlecase_letter(self) -> bool { false } + fn is_unicode_modifier_letter(self) -> bool { false } + fn is_unicode_other_letter(self) -> bool { false } + fn is_unicode_letter_number(self) -> bool { false } + fn is_unicode_nonspacing_mark(self) -> bool { false } + fn is_unicode_combining_spacing_mark(self) -> bool { false } + fn is_unicode_decimal_number(self) -> bool{ false } + fn is_unicode_connector_punctiation(self) -> bool { false } + fn is_unicode_space_separator(self) -> bool { false } + + fn is_es_identifier_start(self) -> bool { false } + fn is_es_identifier_part(self) -> bool { false } + fn is_es_whitespace(self) -> bool { false } + fn is_es_line_terminator(self) -> bool { false } + + fn is_unicode_letter(self) -> bool { + self.is_unicode_uppercase_letter() + || self.is_unicode_lowercase_letter() + || self.is_unicode_titlecase_letter() + || self.is_unicode_modifier_letter() + || self.is_unicode_modifier_letter() + || self.is_unicode_letter_number() + } + +} + + +macro_rules! match_char_class { + ($thing:expr, $($c:expr),*) => { + match $thing { + $($c)|* => true, + _ => false + } + } +} + +impl CharExt for char { + fn is_unicode_uppercase_letter(self) -> bool { + match_char_class!(self, + '\u{0041}', '\u{0042}', '\u{0043}', '\u{0044}', '\u{0045}', '\u{0046}', '\u{0047}', '\u{0048}', '\u{0049}', '\u{004A}', '\u{004B}', '\u{004C}', '\u{004D}', '\u{004E}', '\u{004F}', '\u{0050}', '\u{0051}', '\u{0052}', '\u{0053}', '\u{0054}', '\u{0055}', '\u{0056}', '\u{0057}', '\u{0058}', '\u{0059}', '\u{005A}', '\u{00C0}', '\u{00C1}', '\u{00C2}', '\u{00C3}', '\u{00C4}', '\u{00C5}', '\u{00C6}', '\u{00C7}', '\u{00C8}', '\u{00C9}', '\u{00CA}', '\u{00CB}', '\u{00CC}', '\u{00CD}', '\u{00CE}', '\u{00CF}', '\u{00D0}', '\u{00D1}', '\u{00D2}', '\u{00D3}', '\u{00D4}', '\u{00D5}', '\u{00D6}', '\u{00D8}', '\u{00D9}', '\u{00DA}', '\u{00DB}', '\u{00DC}', '\u{00DD}', '\u{00DE}', '\u{0100}', '\u{0102}', '\u{0104}', '\u{0106}', '\u{0108}', '\u{010A}', '\u{010C}', '\u{010E}', '\u{0110}', '\u{0112}', '\u{0114}', '\u{0116}', '\u{0118}', '\u{011A}', '\u{011C}', '\u{011E}', '\u{0120}', '\u{0122}', '\u{0124}', '\u{0126}', '\u{0128}', '\u{012A}', '\u{012C}', '\u{012E}', '\u{0130}', '\u{0132}', '\u{0134}', '\u{0136}', '\u{0139}', '\u{013B}', '\u{013D}', '\u{013F}', '\u{0141}', '\u{0143}', '\u{0145}', '\u{0147}', '\u{014A}', '\u{014C}', '\u{014E}', '\u{0150}', '\u{0152}', '\u{0154}', '\u{0156}', '\u{0158}', '\u{015A}', '\u{015C}', '\u{015E}', '\u{0160}', '\u{0162}', '\u{0164}', '\u{0166}', '\u{0168}', '\u{016A}', '\u{016C}', '\u{016E}', '\u{0170}', '\u{0172}', '\u{0174}', '\u{0176}', '\u{0178}', '\u{0179}', '\u{017B}', '\u{017D}', '\u{0181}', '\u{0182}', '\u{0184}', '\u{0186}', '\u{0187}', '\u{0189}', '\u{018A}', '\u{018B}', '\u{018E}', '\u{018F}', '\u{0190}', '\u{0191}', '\u{0193}', '\u{0194}', '\u{0196}', '\u{0197}', '\u{0198}', '\u{019C}', '\u{019D}', '\u{019F}', '\u{01A0}', '\u{01A2}', '\u{01A4}', '\u{01A6}', '\u{01A7}', '\u{01A9}', '\u{01AC}', '\u{01AE}', '\u{01AF}', '\u{01B1}', '\u{01B2}', '\u{01B3}', '\u{01B5}', '\u{01B7}', '\u{01B8}', '\u{01BC}', '\u{01C4}', '\u{01C7}', '\u{01CA}', '\u{01CD}', '\u{01CF}', '\u{01D1}', '\u{01D3}', '\u{01D5}', '\u{01D7}', '\u{01D9}', '\u{01DB}', '\u{01DE}', '\u{01E0}', '\u{01E2}', '\u{01E4}', '\u{01E6}', '\u{01E8}', '\u{01EA}', '\u{01EC}', '\u{01EE}', '\u{01F1}', '\u{01F4}', '\u{01F6}', '\u{01F7}', '\u{01F8}', '\u{01FA}', '\u{01FC}', '\u{01FE}', '\u{0200}', '\u{0202}', '\u{0204}', '\u{0206}', '\u{0208}', '\u{020A}', '\u{020C}', '\u{020E}', '\u{0210}', '\u{0212}', '\u{0214}', '\u{0216}', '\u{0218}', '\u{021A}', '\u{021C}', '\u{021E}', '\u{0220}', '\u{0222}', '\u{0224}', '\u{0226}', '\u{0228}', '\u{022A}', '\u{022C}', '\u{022E}', '\u{0230}', '\u{0232}', '\u{023A}', '\u{023B}', '\u{023D}', '\u{023E}', '\u{0241}', '\u{0243}', '\u{0244}', '\u{0245}', '\u{0246}', '\u{0248}', '\u{024A}', '\u{024C}', '\u{024E}', '\u{0370}', '\u{0372}', '\u{0376}', '\u{0386}', '\u{0388}', '\u{0389}', '\u{038A}', '\u{038C}', '\u{038E}', '\u{038F}', '\u{0391}', '\u{0392}', '\u{0393}', '\u{0394}', '\u{0395}', '\u{0396}', '\u{0397}', '\u{0398}', '\u{0399}', '\u{039A}', '\u{039B}', '\u{039C}', '\u{039D}', '\u{039E}', '\u{039F}', '\u{03A0}', '\u{03A1}', '\u{03A3}', '\u{03A4}', '\u{03A5}', '\u{03A6}', '\u{03A7}', '\u{03A8}', '\u{03A9}', '\u{03AA}', '\u{03AB}', '\u{03CF}', '\u{03D2}', '\u{03D3}', '\u{03D4}', '\u{03D8}', '\u{03DA}', '\u{03DC}', '\u{03DE}', '\u{03E0}', '\u{03E2}', '\u{03E4}', '\u{03E6}', '\u{03E8}', '\u{03EA}', '\u{03EC}', '\u{03EE}', '\u{03F4}', '\u{03F7}', '\u{03F9}', '\u{03FA}', '\u{03FD}', '\u{03FE}', '\u{03FF}', '\u{0400}', '\u{0401}', '\u{0402}', '\u{0403}', '\u{0404}', '\u{0405}', '\u{0406}', '\u{0407}', '\u{0408}', '\u{0409}', '\u{040A}', '\u{040B}', '\u{040C}', '\u{040D}', '\u{040E}', '\u{040F}', '\u{0410}', '\u{0411}', '\u{0412}', '\u{0413}', '\u{0414}', '\u{0415}', '\u{0416}', '\u{0417}', '\u{0418}', '\u{0419}', '\u{041A}', '\u{041B}', '\u{041C}', '\u{041D}', '\u{041E}', '\u{041F}', '\u{0420}', '\u{0421}', '\u{0422}', '\u{0423}', '\u{0424}', '\u{0425}', '\u{0426}', '\u{0427}', '\u{0428}', '\u{0429}', '\u{042A}', '\u{042B}', '\u{042C}', '\u{042D}', '\u{042E}', '\u{042F}', '\u{0460}', '\u{0462}', '\u{0464}', '\u{0466}', '\u{0468}', '\u{046A}', '\u{046C}', '\u{046E}', '\u{0470}', '\u{0472}', '\u{0474}', '\u{0476}', '\u{0478}', '\u{047A}', '\u{047C}', '\u{047E}', '\u{0480}', '\u{048A}', '\u{048C}', '\u{048E}', '\u{0490}', '\u{0492}', '\u{0494}', '\u{0496}', '\u{0498}', '\u{049A}', '\u{049C}', '\u{049E}', '\u{04A0}', '\u{04A2}', '\u{04A4}', '\u{04A6}', '\u{04A8}', '\u{04AA}', '\u{04AC}', '\u{04AE}', '\u{04B0}', '\u{04B2}', '\u{04B4}', '\u{04B6}', '\u{04B8}', '\u{04BA}', '\u{04BC}', '\u{04BE}', '\u{04C0}', '\u{04C1}', '\u{04C3}', '\u{04C5}', '\u{04C7}', '\u{04C9}', '\u{04CB}', '\u{04CD}', '\u{04D0}', '\u{04D2}', '\u{04D4}', '\u{04D6}', '\u{04D8}', '\u{04DA}', '\u{04DC}', '\u{04DE}', '\u{04E0}', '\u{04E2}', '\u{04E4}', '\u{04E6}', '\u{04E8}', '\u{04EA}', '\u{04EC}', '\u{04EE}', '\u{04F0}', '\u{04F2}', '\u{04F4}', '\u{04F6}', '\u{04F8}', '\u{04FA}', '\u{04FC}', '\u{04FE}', '\u{0500}', '\u{0502}', '\u{0504}', '\u{0506}', '\u{0508}', '\u{050A}', '\u{050C}', '\u{050E}', '\u{0510}', '\u{0512}', '\u{0514}', '\u{0516}', '\u{0518}', '\u{051A}', '\u{051C}', '\u{051E}', '\u{0520}', '\u{0522}', '\u{0531}', '\u{0532}', '\u{0533}', '\u{0534}', '\u{0535}', '\u{0536}', '\u{0537}', '\u{0538}', '\u{0539}', '\u{053A}', '\u{053B}', '\u{053C}', '\u{053D}', '\u{053E}', '\u{053F}', '\u{0540}', '\u{0541}', '\u{0542}', '\u{0543}', '\u{0544}', '\u{0545}', '\u{0546}', '\u{0547}', '\u{0548}', '\u{0549}', '\u{054A}', '\u{054B}', '\u{054C}', '\u{054D}', '\u{054E}', '\u{054F}', '\u{0550}', '\u{0551}', '\u{0552}', '\u{0553}', '\u{0554}', '\u{0555}', '\u{0556}', '\u{10A0}', '\u{10A1}', '\u{10A2}', '\u{10A3}', '\u{10A4}', '\u{10A5}', '\u{10A6}', '\u{10A7}', '\u{10A8}', '\u{10A9}', '\u{10AA}', '\u{10AB}', '\u{10AC}', '\u{10AD}', '\u{10AE}', '\u{10AF}', '\u{10B0}', '\u{10B1}', '\u{10B2}', '\u{10B3}', '\u{10B4}', '\u{10B5}', '\u{10B6}', '\u{10B7}', '\u{10B8}', '\u{10B9}', '\u{10BA}', '\u{10BB}', '\u{10BC}', '\u{10BD}', '\u{10BE}', '\u{10BF}', '\u{10C0}', '\u{10C1}', '\u{10C2}', '\u{10C3}', '\u{10C4}', '\u{10C5}', '\u{1E00}', '\u{1E02}', '\u{1E04}', '\u{1E06}', '\u{1E08}', '\u{1E0A}', '\u{1E0C}', '\u{1E0E}', '\u{1E10}', '\u{1E12}', '\u{1E14}', '\u{1E16}', '\u{1E18}', '\u{1E1A}', '\u{1E1C}', '\u{1E1E}', '\u{1E20}', '\u{1E22}', '\u{1E24}', '\u{1E26}', '\u{1E28}', '\u{1E2A}', '\u{1E2C}', '\u{1E2E}', '\u{1E30}', '\u{1E32}', '\u{1E34}', '\u{1E36}', '\u{1E38}', '\u{1E3A}', '\u{1E3C}', '\u{1E3E}', '\u{1E40}', '\u{1E42}', '\u{1E44}', '\u{1E46}', '\u{1E48}', '\u{1E4A}', '\u{1E4C}', '\u{1E4E}', '\u{1E50}', '\u{1E52}', '\u{1E54}', '\u{1E56}', '\u{1E58}', '\u{1E5A}', '\u{1E5C}', '\u{1E5E}', '\u{1E60}', '\u{1E62}', '\u{1E64}', '\u{1E66}', '\u{1E68}', '\u{1E6A}', '\u{1E6C}', '\u{1E6E}', '\u{1E70}', '\u{1E72}', '\u{1E74}', '\u{1E76}', '\u{1E78}', '\u{1E7A}', '\u{1E7C}', '\u{1E7E}', '\u{1E80}', '\u{1E82}', '\u{1E84}', '\u{1E86}', '\u{1E88}', '\u{1E8A}', '\u{1E8C}', '\u{1E8E}', '\u{1E90}', '\u{1E92}', '\u{1E94}', '\u{1E9E}', '\u{1EA0}', '\u{1EA2}', '\u{1EA4}', '\u{1EA6}', '\u{1EA8}', '\u{1EAA}', '\u{1EAC}', '\u{1EAE}', '\u{1EB0}', '\u{1EB2}', '\u{1EB4}', '\u{1EB6}', '\u{1EB8}', '\u{1EBA}', '\u{1EBC}', '\u{1EBE}', '\u{1EC0}', '\u{1EC2}', '\u{1EC4}', '\u{1EC6}', '\u{1EC8}', '\u{1ECA}', '\u{1ECC}', '\u{1ECE}', '\u{1ED0}', '\u{1ED2}', '\u{1ED4}', '\u{1ED6}', '\u{1ED8}', '\u{1EDA}', '\u{1EDC}', '\u{1EDE}', '\u{1EE0}', '\u{1EE2}', '\u{1EE4}', '\u{1EE6}', '\u{1EE8}', '\u{1EEA}', '\u{1EEC}', '\u{1EEE}', '\u{1EF0}', '\u{1EF2}', '\u{1EF4}', '\u{1EF6}', '\u{1EF8}', '\u{1EFA}', '\u{1EFC}', '\u{1EFE}', '\u{1F08}', '\u{1F09}', '\u{1F0A}', '\u{1F0B}', '\u{1F0C}', '\u{1F0D}', '\u{1F0E}', '\u{1F0F}', '\u{1F18}', '\u{1F19}', '\u{1F1A}', '\u{1F1B}', '\u{1F1C}', '\u{1F1D}', '\u{1F28}', '\u{1F29}', '\u{1F2A}', '\u{1F2B}', '\u{1F2C}', '\u{1F2D}', '\u{1F2E}', '\u{1F2F}', '\u{1F38}', '\u{1F39}', '\u{1F3A}', '\u{1F3B}', '\u{1F3C}', '\u{1F3D}', '\u{1F3E}', '\u{1F3F}', '\u{1F48}', '\u{1F49}', '\u{1F4A}', '\u{1F4B}', '\u{1F4C}', '\u{1F4D}', '\u{1F59}', '\u{1F5B}', '\u{1F5D}', '\u{1F5F}', '\u{1F68}', '\u{1F69}', '\u{1F6A}', '\u{1F6B}', '\u{1F6C}', '\u{1F6D}', '\u{1F6E}', '\u{1F6F}', '\u{1FB8}', '\u{1FB9}', '\u{1FBA}', '\u{1FBB}', '\u{1FC8}', '\u{1FC9}', '\u{1FCA}', '\u{1FCB}', '\u{1FD8}', '\u{1FD9}', '\u{1FDA}', '\u{1FDB}', '\u{1FE8}', '\u{1FE9}', '\u{1FEA}', '\u{1FEB}', '\u{1FEC}', '\u{1FF8}', '\u{1FF9}', '\u{1FFA}', '\u{1FFB}', '\u{2102}', '\u{2107}', '\u{210B}', '\u{210C}', '\u{210D}', '\u{2110}', '\u{2111}', '\u{2112}', '\u{2115}', '\u{2119}', '\u{211A}', '\u{211B}', '\u{211C}', '\u{211D}', '\u{2124}', '\u{2126}', '\u{2128}', '\u{212A}', '\u{212B}', '\u{212C}', '\u{212D}', '\u{2130}', '\u{2131}', '\u{2132}', '\u{2133}', '\u{213E}', '\u{213F}', '\u{2145}', '\u{2183}', '\u{2C00}', '\u{2C01}', '\u{2C02}', '\u{2C03}', '\u{2C04}', '\u{2C05}', '\u{2C06}', '\u{2C07}', '\u{2C08}', '\u{2C09}', '\u{2C0A}', '\u{2C0B}', '\u{2C0C}', '\u{2C0D}', '\u{2C0E}', '\u{2C0F}', '\u{2C10}', '\u{2C11}', '\u{2C12}', '\u{2C13}', '\u{2C14}', '\u{2C15}', '\u{2C16}', '\u{2C17}', '\u{2C18}', '\u{2C19}', '\u{2C1A}', '\u{2C1B}', '\u{2C1C}', '\u{2C1D}', '\u{2C1E}', '\u{2C1F}', '\u{2C20}', '\u{2C21}', '\u{2C22}', '\u{2C23}', '\u{2C24}', '\u{2C25}', '\u{2C26}', '\u{2C27}', '\u{2C28}', '\u{2C29}', '\u{2C2A}', '\u{2C2B}', '\u{2C2C}', '\u{2C2D}', '\u{2C2E}', '\u{2C60}', '\u{2C62}', '\u{2C63}', '\u{2C64}', '\u{2C67}', '\u{2C69}', '\u{2C6B}', '\u{2C6D}', '\u{2C6E}', '\u{2C6F}', '\u{2C72}', '\u{2C75}', '\u{2C80}', '\u{2C82}', '\u{2C84}', '\u{2C86}', '\u{2C88}', '\u{2C8A}', '\u{2C8C}', '\u{2C8E}', '\u{2C90}', '\u{2C92}', '\u{2C94}', '\u{2C96}', '\u{2C98}', '\u{2C9A}', '\u{2C9C}', '\u{2C9E}', '\u{2CA0}', '\u{2CA2}', '\u{2CA4}', '\u{2CA6}', '\u{2CA8}', '\u{2CAA}', '\u{2CAC}', '\u{2CAE}', '\u{2CB0}', '\u{2CB2}', '\u{2CB4}', '\u{2CB6}', '\u{2CB8}', '\u{2CBA}', '\u{2CBC}', '\u{2CBE}', '\u{2CC0}', '\u{2CC2}', '\u{2CC4}', '\u{2CC6}', '\u{2CC8}', '\u{2CCA}', '\u{2CCC}', '\u{2CCE}', '\u{2CD0}', '\u{2CD2}', '\u{2CD4}', '\u{2CD6}', '\u{2CD8}', '\u{2CDA}', '\u{2CDC}', '\u{2CDE}', '\u{2CE0}', '\u{2CE2}', '\u{A640}', '\u{A642}', '\u{A644}', '\u{A646}', '\u{A648}', '\u{A64A}', '\u{A64C}', '\u{A64E}', '\u{A650}', '\u{A652}', '\u{A654}', '\u{A656}', '\u{A658}', '\u{A65A}', '\u{A65C}', '\u{A65E}', '\u{A662}', '\u{A664}', '\u{A666}', '\u{A668}', '\u{A66A}', '\u{A66C}', '\u{A680}', '\u{A682}', '\u{A684}', '\u{A686}', '\u{A688}', '\u{A68A}', '\u{A68C}', '\u{A68E}', '\u{A690}', '\u{A692}', '\u{A694}', '\u{A696}', '\u{A722}', '\u{A724}', '\u{A726}', '\u{A728}', '\u{A72A}', '\u{A72C}', '\u{A72E}', '\u{A732}', '\u{A734}', '\u{A736}', '\u{A738}', '\u{A73A}', '\u{A73C}', '\u{A73E}', '\u{A740}', '\u{A742}', '\u{A744}', '\u{A746}', '\u{A748}', '\u{A74A}', '\u{A74C}', '\u{A74E}', '\u{A750}', '\u{A752}', '\u{A754}', '\u{A756}', '\u{A758}', '\u{A75A}', '\u{A75C}', '\u{A75E}', '\u{A760}', '\u{A762}', '\u{A764}', '\u{A766}', '\u{A768}', '\u{A76A}', '\u{A76C}', '\u{A76E}', '\u{A779}', '\u{A77B}', '\u{A77D}', '\u{A77E}', '\u{A780}', '\u{A782}', '\u{A784}', '\u{A786}', '\u{A78B}', '\u{FF21}', '\u{FF22}', '\u{FF23}', '\u{FF24}', '\u{FF25}', '\u{FF26}', '\u{FF27}', '\u{FF28}', '\u{FF29}', '\u{FF2A}', '\u{FF2B}', '\u{FF2C}', '\u{FF2D}', '\u{FF2E}', '\u{FF2F}', '\u{FF30}', '\u{FF31}', '\u{FF32}', '\u{FF33}', '\u{FF34}', '\u{FF35}', '\u{FF36}', '\u{FF37}', '\u{FF38}', '\u{FF39}', '\u{FF3A}') + } + + fn is_unicode_lowercase_letter(self) -> bool { + match_char_class!(self, + '\u{0061}', '\u{0062}', '\u{0063}', '\u{0064}', '\u{0065}', '\u{0066}', '\u{0067}', '\u{0068}', '\u{0069}', '\u{006A}', '\u{006B}', '\u{006C}', '\u{006D}', '\u{006E}', '\u{006F}', '\u{0070}', '\u{0071}', '\u{0072}', '\u{0073}', '\u{0074}', '\u{0075}', '\u{0076}', '\u{0077}', '\u{0078}', '\u{0079}', '\u{007A}', '\u{00AA}', '\u{00B5}', '\u{00BA}', '\u{00DF}', '\u{00E0}', '\u{00E1}', '\u{00E2}', '\u{00E3}', '\u{00E4}', '\u{00E5}', '\u{00E6}', '\u{00E7}', '\u{00E8}', '\u{00E9}', '\u{00EA}', '\u{00EB}', '\u{00EC}', '\u{00ED}', '\u{00EE}', '\u{00EF}', '\u{00F0}', '\u{00F1}', '\u{00F2}', '\u{00F3}', '\u{00F4}', '\u{00F5}', '\u{00F6}', '\u{00F8}', '\u{00F9}', '\u{00FA}', '\u{00FB}', '\u{00FC}', '\u{00FD}', '\u{00FE}', '\u{00FF}', '\u{0101}', '\u{0103}', '\u{0105}', '\u{0107}', '\u{0109}', '\u{010B}', '\u{010D}', '\u{010F}', '\u{0111}', '\u{0113}', '\u{0115}', '\u{0117}', '\u{0119}', '\u{011B}', '\u{011D}', '\u{011F}', '\u{0121}', '\u{0123}', '\u{0125}', '\u{0127}', '\u{0129}', '\u{012B}', '\u{012D}', '\u{012F}', '\u{0131}', '\u{0133}', '\u{0135}', '\u{0137}', '\u{0138}', '\u{013A}', '\u{013C}', '\u{013E}', '\u{0140}', '\u{0142}', '\u{0144}', '\u{0146}', '\u{0148}', '\u{0149}', '\u{014B}', '\u{014D}', '\u{014F}', '\u{0151}', '\u{0153}', '\u{0155}', '\u{0157}', '\u{0159}', '\u{015B}', '\u{015D}', '\u{015F}', '\u{0161}', '\u{0163}', '\u{0165}', '\u{0167}', '\u{0169}', '\u{016B}', '\u{016D}', '\u{016F}', '\u{0171}', '\u{0173}', '\u{0175}', '\u{0177}', '\u{017A}', '\u{017C}', '\u{017E}', '\u{017F}', '\u{0180}', '\u{0183}', '\u{0185}', '\u{0188}', '\u{018C}', '\u{018D}', '\u{0192}', '\u{0195}', '\u{0199}', '\u{019A}', '\u{019B}', '\u{019E}', '\u{01A1}', '\u{01A3}', '\u{01A5}', '\u{01A8}', '\u{01AA}', '\u{01AB}', '\u{01AD}', '\u{01B0}', '\u{01B4}', '\u{01B6}', '\u{01B9}', '\u{01BA}', '\u{01BD}', '\u{01BE}', '\u{01BF}', '\u{01C6}', '\u{01C9}', '\u{01CC}', '\u{01CE}', '\u{01D0}', '\u{01D2}', '\u{01D4}', '\u{01D6}', '\u{01D8}', '\u{01DA}', '\u{01DC}', '\u{01DD}', '\u{01DF}', '\u{01E1}', '\u{01E3}', '\u{01E5}', '\u{01E7}', '\u{01E9}', '\u{01EB}', '\u{01ED}', '\u{01EF}', '\u{01F0}', '\u{01F3}', '\u{01F5}', '\u{01F9}', '\u{01FB}', '\u{01FD}', '\u{01FF}', '\u{0201}', '\u{0203}', '\u{0205}', '\u{0207}', '\u{0209}', '\u{020B}', '\u{020D}', '\u{020F}', '\u{0211}', '\u{0213}', '\u{0215}', '\u{0217}', '\u{0219}', '\u{021B}', '\u{021D}', '\u{021F}', '\u{0221}', '\u{0223}', '\u{0225}', '\u{0227}', '\u{0229}', '\u{022B}', '\u{022D}', '\u{022F}', '\u{0231}', '\u{0233}', '\u{0234}', '\u{0235}', '\u{0236}', '\u{0237}', '\u{0238}', '\u{0239}', '\u{023C}', '\u{023F}', '\u{0240}', '\u{0242}', '\u{0247}', '\u{0249}', '\u{024B}', '\u{024D}', '\u{024F}', '\u{0250}', '\u{0251}', '\u{0252}', '\u{0253}', '\u{0254}', '\u{0255}', '\u{0256}', '\u{0257}', '\u{0258}', '\u{0259}', '\u{025A}', '\u{025B}', '\u{025C}', '\u{025D}', '\u{025E}', '\u{025F}', '\u{0260}', '\u{0261}', '\u{0262}', '\u{0263}', '\u{0264}', '\u{0265}', '\u{0266}', '\u{0267}', '\u{0268}', '\u{0269}', '\u{026A}', '\u{026B}', '\u{026C}', '\u{026D}', '\u{026E}', '\u{026F}', '\u{0270}', '\u{0271}', '\u{0272}', '\u{0273}', '\u{0274}', '\u{0275}', '\u{0276}', '\u{0277}', '\u{0278}', '\u{0279}', '\u{027A}', '\u{027B}', '\u{027C}', '\u{027D}', '\u{027E}', '\u{027F}', '\u{0280}', '\u{0281}', '\u{0282}', '\u{0283}', '\u{0284}', '\u{0285}', '\u{0286}', '\u{0287}', '\u{0288}', '\u{0289}', '\u{028A}', '\u{028B}', '\u{028C}', '\u{028D}', '\u{028E}', '\u{028F}', '\u{0290}', '\u{0291}', '\u{0292}', '\u{0293}', '\u{0295}', '\u{0296}', '\u{0297}', '\u{0298}', '\u{0299}', '\u{029A}', '\u{029B}', '\u{029C}', '\u{029D}', '\u{029E}', '\u{029F}', '\u{02A0}', '\u{02A1}', '\u{02A2}', '\u{02A3}', '\u{02A4}', '\u{02A5}', '\u{02A6}', '\u{02A7}', '\u{02A8}', '\u{02A9}', '\u{02AA}', '\u{02AB}', '\u{02AC}', '\u{02AD}', '\u{02AE}', '\u{02AF}', '\u{0371}', '\u{0373}', '\u{0377}', '\u{037B}', '\u{037C}', '\u{037D}', '\u{0390}', '\u{03AC}', '\u{03AD}', '\u{03AE}', '\u{03AF}', '\u{03B0}', '\u{03B1}', '\u{03B2}', '\u{03B3}', '\u{03B4}', '\u{03B5}', '\u{03B6}', '\u{03B7}', '\u{03B8}', '\u{03B9}', '\u{03BA}', '\u{03BB}', '\u{03BC}', '\u{03BD}', '\u{03BE}', '\u{03BF}', '\u{03C0}', '\u{03C1}', '\u{03C2}', '\u{03C3}', '\u{03C4}', '\u{03C5}', '\u{03C6}', '\u{03C7}', '\u{03C8}', '\u{03C9}', '\u{03CA}', '\u{03CB}', '\u{03CC}', '\u{03CD}', '\u{03CE}', '\u{03D0}', '\u{03D1}', '\u{03D5}', '\u{03D6}', '\u{03D7}', '\u{03D9}', '\u{03DB}', '\u{03DD}', '\u{03DF}', '\u{03E1}', '\u{03E3}', '\u{03E5}', '\u{03E7}', '\u{03E9}', '\u{03EB}', '\u{03ED}', '\u{03EF}', '\u{03F0}', '\u{03F1}', '\u{03F2}', '\u{03F3}', '\u{03F5}', '\u{03F8}', '\u{03FB}', '\u{03FC}', '\u{0430}', '\u{0431}', '\u{0432}', '\u{0433}', '\u{0434}', '\u{0435}', '\u{0436}', '\u{0437}', '\u{0438}', '\u{0439}', '\u{043A}', '\u{043B}', '\u{043C}', '\u{043D}', '\u{043E}', '\u{043F}', '\u{0440}', '\u{0441}', '\u{0442}', '\u{0443}', '\u{0444}', '\u{0445}', '\u{0446}', '\u{0447}', '\u{0448}', '\u{0449}', '\u{044A}', '\u{044B}', '\u{044C}', '\u{044D}', '\u{044E}', '\u{044F}', '\u{0450}', '\u{0451}', '\u{0452}', '\u{0453}', '\u{0454}', '\u{0455}', '\u{0456}', '\u{0457}', '\u{0458}', '\u{0459}', '\u{045A}', '\u{045B}', '\u{045C}', '\u{045D}', '\u{045E}', '\u{045F}', '\u{0461}', '\u{0463}', '\u{0465}', '\u{0467}', '\u{0469}', '\u{046B}', '\u{046D}', '\u{046F}', '\u{0471}', '\u{0473}', '\u{0475}', '\u{0477}', '\u{0479}', '\u{047B}', '\u{047D}', '\u{047F}', '\u{0481}', '\u{048B}', '\u{048D}', '\u{048F}', '\u{0491}', '\u{0493}', '\u{0495}', '\u{0497}', '\u{0499}', '\u{049B}', '\u{049D}', '\u{049F}', '\u{04A1}', '\u{04A3}', '\u{04A5}', '\u{04A7}', '\u{04A9}', '\u{04AB}', '\u{04AD}', '\u{04AF}', '\u{04B1}', '\u{04B3}', '\u{04B5}', '\u{04B7}', '\u{04B9}', '\u{04BB}', '\u{04BD}', '\u{04BF}', '\u{04C2}', '\u{04C4}', '\u{04C6}', '\u{04C8}', '\u{04CA}', '\u{04CC}', '\u{04CE}', '\u{04CF}', '\u{04D1}', '\u{04D3}', '\u{04D5}', '\u{04D7}', '\u{04D9}', '\u{04DB}', '\u{04DD}', '\u{04DF}', '\u{04E1}', '\u{04E3}', '\u{04E5}', '\u{04E7}', '\u{04E9}', '\u{04EB}', '\u{04ED}', '\u{04EF}', '\u{04F1}', '\u{04F3}', '\u{04F5}', '\u{04F7}', '\u{04F9}', '\u{04FB}', '\u{04FD}', '\u{04FF}', '\u{0501}', '\u{0503}', '\u{0505}', '\u{0507}', '\u{0509}', '\u{050B}', '\u{050D}', '\u{050F}', '\u{0511}', '\u{0513}', '\u{0515}', '\u{0517}', '\u{0519}', '\u{051B}', '\u{051D}', '\u{051F}', '\u{0521}', '\u{0523}', '\u{0561}', '\u{0562}', '\u{0563}', '\u{0564}', '\u{0565}', '\u{0566}', '\u{0567}', '\u{0568}', '\u{0569}', '\u{056A}', '\u{056B}', '\u{056C}', '\u{056D}', '\u{056E}', '\u{056F}', '\u{0570}', '\u{0571}', '\u{0572}', '\u{0573}', '\u{0574}', '\u{0575}', '\u{0576}', '\u{0577}', '\u{0578}', '\u{0579}', '\u{057A}', '\u{057B}', '\u{057C}', '\u{057D}', '\u{057E}', '\u{057F}', '\u{0580}', '\u{0581}', '\u{0582}', '\u{0583}', '\u{0584}', '\u{0585}', '\u{0586}', '\u{0587}', '\u{1D00}', '\u{1D01}', '\u{1D02}', '\u{1D03}', '\u{1D04}', '\u{1D05}', '\u{1D06}', '\u{1D07}', '\u{1D08}', '\u{1D09}', '\u{1D0A}', '\u{1D0B}', '\u{1D0C}', '\u{1D0D}', '\u{1D0E}', '\u{1D0F}', '\u{1D10}', '\u{1D11}', '\u{1D12}', '\u{1D13}', '\u{1D14}', '\u{1D15}', '\u{1D16}', '\u{1D17}', '\u{1D18}', '\u{1D19}', '\u{1D1A}', '\u{1D1B}', '\u{1D1C}', '\u{1D1D}', '\u{1D1E}', '\u{1D1F}', '\u{1D20}', '\u{1D21}', '\u{1D22}', '\u{1D23}', '\u{1D24}', '\u{1D25}', '\u{1D26}', '\u{1D27}', '\u{1D28}', '\u{1D29}', '\u{1D2A}', '\u{1D2B}', '\u{1D62}', '\u{1D63}', '\u{1D64}', '\u{1D65}', '\u{1D66}', '\u{1D67}', '\u{1D68}', '\u{1D69}', '\u{1D6A}', '\u{1D6B}', '\u{1D6C}', '\u{1D6D}', '\u{1D6E}', '\u{1D6F}', '\u{1D70}', '\u{1D71}', '\u{1D72}', '\u{1D73}', '\u{1D74}', '\u{1D75}', '\u{1D76}', '\u{1D77}', '\u{1D79}', '\u{1D7A}', '\u{1D7B}', '\u{1D7C}', '\u{1D7D}', '\u{1D7E}', '\u{1D7F}', '\u{1D80}', '\u{1D81}', '\u{1D82}', '\u{1D83}', '\u{1D84}', '\u{1D85}', '\u{1D86}', '\u{1D87}', '\u{1D88}', '\u{1D89}', '\u{1D8A}', '\u{1D8B}', '\u{1D8C}', '\u{1D8D}', '\u{1D8E}', '\u{1D8F}', '\u{1D90}', '\u{1D91}', '\u{1D92}', '\u{1D93}', '\u{1D94}', '\u{1D95}', '\u{1D96}', '\u{1D97}', '\u{1D98}', '\u{1D99}', '\u{1D9A}', '\u{1E01}', '\u{1E03}', '\u{1E05}', '\u{1E07}', '\u{1E09}', '\u{1E0B}', '\u{1E0D}', '\u{1E0F}', '\u{1E11}', '\u{1E13}', '\u{1E15}', '\u{1E17}', '\u{1E19}', '\u{1E1B}', '\u{1E1D}', '\u{1E1F}', '\u{1E21}', '\u{1E23}', '\u{1E25}', '\u{1E27}', '\u{1E29}', '\u{1E2B}', '\u{1E2D}', '\u{1E2F}', '\u{1E31}', '\u{1E33}', '\u{1E35}', '\u{1E37}', '\u{1E39}', '\u{1E3B}', '\u{1E3D}', '\u{1E3F}', '\u{1E41}', '\u{1E43}', '\u{1E45}', '\u{1E47}', '\u{1E49}', '\u{1E4B}', '\u{1E4D}', '\u{1E4F}', '\u{1E51}', '\u{1E53}', '\u{1E55}', '\u{1E57}', '\u{1E59}', '\u{1E5B}', '\u{1E5D}', '\u{1E5F}', '\u{1E61}', '\u{1E63}', '\u{1E65}', '\u{1E67}', '\u{1E69}', '\u{1E6B}', '\u{1E6D}', '\u{1E6F}', '\u{1E71}', '\u{1E73}', '\u{1E75}', '\u{1E77}', '\u{1E79}', '\u{1E7B}', '\u{1E7D}', '\u{1E7F}', '\u{1E81}', '\u{1E83}', '\u{1E85}', '\u{1E87}', '\u{1E89}', '\u{1E8B}', '\u{1E8D}', '\u{1E8F}', '\u{1E91}', '\u{1E93}', '\u{1E95}', '\u{1E96}', '\u{1E97}', '\u{1E98}', '\u{1E99}', '\u{1E9A}', '\u{1E9B}', '\u{1E9C}', '\u{1E9D}', '\u{1E9F}', '\u{1EA1}', '\u{1EA3}', '\u{1EA5}', '\u{1EA7}', '\u{1EA9}', '\u{1EAB}', '\u{1EAD}', '\u{1EAF}', '\u{1EB1}', '\u{1EB3}', '\u{1EB5}', '\u{1EB7}', '\u{1EB9}', '\u{1EBB}', '\u{1EBD}', '\u{1EBF}', '\u{1EC1}', '\u{1EC3}', '\u{1EC5}', '\u{1EC7}', '\u{1EC9}', '\u{1ECB}', '\u{1ECD}', '\u{1ECF}', '\u{1ED1}', '\u{1ED3}', '\u{1ED5}', '\u{1ED7}', '\u{1ED9}', '\u{1EDB}', '\u{1EDD}', '\u{1EDF}', '\u{1EE1}', '\u{1EE3}', '\u{1EE5}', '\u{1EE7}', '\u{1EE9}', '\u{1EEB}', '\u{1EED}', '\u{1EEF}', '\u{1EF1}', '\u{1EF3}', '\u{1EF5}', '\u{1EF7}', '\u{1EF9}', '\u{1EFB}', '\u{1EFD}', '\u{1EFF}', '\u{1F00}', '\u{1F01}', '\u{1F02}', '\u{1F03}', '\u{1F04}', '\u{1F05}', '\u{1F06}', '\u{1F07}', '\u{1F10}', '\u{1F11}', '\u{1F12}', '\u{1F13}', '\u{1F14}', '\u{1F15}', '\u{1F20}', '\u{1F21}', '\u{1F22}', '\u{1F23}', '\u{1F24}', '\u{1F25}', '\u{1F26}', '\u{1F27}', '\u{1F30}', '\u{1F31}', '\u{1F32}', '\u{1F33}', '\u{1F34}', '\u{1F35}', '\u{1F36}', '\u{1F37}', '\u{1F40}', '\u{1F41}', '\u{1F42}', '\u{1F43}', '\u{1F44}', '\u{1F45}', '\u{1F50}', '\u{1F51}', '\u{1F52}', '\u{1F53}', '\u{1F54}', '\u{1F55}', '\u{1F56}', '\u{1F57}', '\u{1F60}', '\u{1F61}', '\u{1F62}', '\u{1F63}', '\u{1F64}', '\u{1F65}', '\u{1F66}', '\u{1F67}', '\u{1F70}', '\u{1F71}', '\u{1F72}', '\u{1F73}', '\u{1F74}', '\u{1F75}', '\u{1F76}', '\u{1F77}', '\u{1F78}', '\u{1F79}', '\u{1F7A}', '\u{1F7B}', '\u{1F7C}', '\u{1F7D}', '\u{1F80}', '\u{1F81}', '\u{1F82}', '\u{1F83}', '\u{1F84}', '\u{1F85}', '\u{1F86}', '\u{1F87}', '\u{1F90}', '\u{1F91}', '\u{1F92}', '\u{1F93}', '\u{1F94}', '\u{1F95}', '\u{1F96}', '\u{1F97}', '\u{1FA0}', '\u{1FA1}', '\u{1FA2}', '\u{1FA3}', '\u{1FA4}', '\u{1FA5}', '\u{1FA6}', '\u{1FA7}', '\u{1FB0}', '\u{1FB1}', '\u{1FB2}', '\u{1FB3}', '\u{1FB4}', '\u{1FB6}', '\u{1FB7}', '\u{1FBE}', '\u{1FC2}', '\u{1FC3}', '\u{1FC4}', '\u{1FC6}', '\u{1FC7}', '\u{1FD0}', '\u{1FD1}', '\u{1FD2}', '\u{1FD3}', '\u{1FD6}', '\u{1FD7}', '\u{1FE0}', '\u{1FE1}', '\u{1FE2}', '\u{1FE3}', '\u{1FE4}', '\u{1FE5}', '\u{1FE6}', '\u{1FE7}', '\u{1FF2}', '\u{1FF3}', '\u{1FF4}', '\u{1FF6}', '\u{1FF7}', '\u{2071}', '\u{207F}', '\u{210A}', '\u{210E}', '\u{210F}', '\u{2113}', '\u{212F}', '\u{2134}', '\u{2139}', '\u{213C}', '\u{213D}', '\u{2146}', '\u{2147}', '\u{2148}', '\u{2149}', '\u{214E}', '\u{2184}', '\u{2C30}', '\u{2C31}', '\u{2C32}', '\u{2C33}', '\u{2C34}', '\u{2C35}', '\u{2C36}', '\u{2C37}', '\u{2C38}', '\u{2C39}', '\u{2C3A}', '\u{2C3B}', '\u{2C3C}', '\u{2C3D}', '\u{2C3E}', '\u{2C3F}', '\u{2C40}', '\u{2C41}', '\u{2C42}', '\u{2C43}', '\u{2C44}', '\u{2C45}', '\u{2C46}', '\u{2C47}', '\u{2C48}', '\u{2C49}', '\u{2C4A}', '\u{2C4B}', '\u{2C4C}', '\u{2C4D}', '\u{2C4E}', '\u{2C4F}', '\u{2C50}', '\u{2C51}', '\u{2C52}', '\u{2C53}', '\u{2C54}', '\u{2C55}', '\u{2C56}', '\u{2C57}', '\u{2C58}', '\u{2C59}', '\u{2C5A}', '\u{2C5B}', '\u{2C5C}', '\u{2C5D}', '\u{2C5E}', '\u{2C61}', '\u{2C65}', '\u{2C66}', '\u{2C68}', '\u{2C6A}', '\u{2C6C}', '\u{2C71}', '\u{2C73}', '\u{2C74}', '\u{2C76}', '\u{2C77}', '\u{2C78}', '\u{2C79}', '\u{2C7A}', '\u{2C7B}', '\u{2C7C}', '\u{2C81}', '\u{2C83}', '\u{2C85}', '\u{2C87}', '\u{2C89}', '\u{2C8B}', '\u{2C8D}', '\u{2C8F}', '\u{2C91}', '\u{2C93}', '\u{2C95}', '\u{2C97}', '\u{2C99}', '\u{2C9B}', '\u{2C9D}', '\u{2C9F}', '\u{2CA1}', '\u{2CA3}', '\u{2CA5}', '\u{2CA7}', '\u{2CA9}', '\u{2CAB}', '\u{2CAD}', '\u{2CAF}', '\u{2CB1}', '\u{2CB3}', '\u{2CB5}', '\u{2CB7}', '\u{2CB9}', '\u{2CBB}', '\u{2CBD}', '\u{2CBF}', '\u{2CC1}', '\u{2CC3}', '\u{2CC5}', '\u{2CC7}', '\u{2CC9}', '\u{2CCB}', '\u{2CCD}', '\u{2CCF}', '\u{2CD1}', '\u{2CD3}', '\u{2CD5}', '\u{2CD7}', '\u{2CD9}', '\u{2CDB}', '\u{2CDD}', '\u{2CDF}', '\u{2CE1}', '\u{2CE3}', '\u{2CE4}', '\u{2D00}', '\u{2D01}', '\u{2D02}', '\u{2D03}', '\u{2D04}', '\u{2D05}', '\u{2D06}', '\u{2D07}', '\u{2D08}', '\u{2D09}', '\u{2D0A}', '\u{2D0B}', '\u{2D0C}', '\u{2D0D}', '\u{2D0E}', '\u{2D0F}', '\u{2D10}', '\u{2D11}', '\u{2D12}', '\u{2D13}', '\u{2D14}', '\u{2D15}', '\u{2D16}', '\u{2D17}', '\u{2D18}', '\u{2D19}', '\u{2D1A}', '\u{2D1B}', '\u{2D1C}', '\u{2D1D}', '\u{2D1E}', '\u{2D1F}', '\u{2D20}', '\u{2D21}', '\u{2D22}', '\u{2D23}', '\u{2D24}', '\u{2D25}', '\u{A641}', '\u{A643}', '\u{A645}', '\u{A647}', '\u{A649}', '\u{A64B}', '\u{A64D}', '\u{A64F}', '\u{A651}', '\u{A653}', '\u{A655}', '\u{A657}', '\u{A659}', '\u{A65B}', '\u{A65D}', '\u{A65F}', '\u{A663}', '\u{A665}', '\u{A667}', '\u{A669}', '\u{A66B}', '\u{A66D}', '\u{A681}', '\u{A683}', '\u{A685}', '\u{A687}', '\u{A689}', '\u{A68B}', '\u{A68D}', '\u{A68F}', '\u{A691}', '\u{A693}', '\u{A695}', '\u{A697}', '\u{A723}', '\u{A725}', '\u{A727}', '\u{A729}', '\u{A72B}', '\u{A72D}', '\u{A72F}', '\u{A730}', '\u{A731}', '\u{A733}', '\u{A735}', '\u{A737}', '\u{A739}', '\u{A73B}', '\u{A73D}', '\u{A73F}', '\u{A741}', '\u{A743}', '\u{A745}', '\u{A747}', '\u{A749}', '\u{A74B}', '\u{A74D}', '\u{A74F}', '\u{A751}', '\u{A753}', '\u{A755}', '\u{A757}', '\u{A759}', '\u{A75B}', '\u{A75D}', '\u{A75F}', '\u{A761}', '\u{A763}', '\u{A765}', '\u{A767}', '\u{A769}', '\u{A76B}', '\u{A76D}', '\u{A76F}', '\u{A771}', '\u{A772}', '\u{A773}', '\u{A774}', '\u{A775}', '\u{A776}', '\u{A777}', '\u{A778}', '\u{A77A}', '\u{A77C}', '\u{A77F}', '\u{A781}', '\u{A783}', '\u{A785}', '\u{A787}', '\u{A78C}', '\u{FB00}', '\u{FB01}', '\u{FB02}', '\u{FB03}', '\u{FB04}', '\u{FB05}', '\u{FB06}', '\u{FB13}', '\u{FB14}', '\u{FB15}', '\u{FB16}', '\u{FB17}', '\u{FF41}', '\u{FF42}', '\u{FF43}', '\u{FF44}', '\u{FF45}', '\u{FF46}', '\u{FF47}', '\u{FF48}', '\u{FF49}', '\u{FF4A}', '\u{FF4B}', '\u{FF4C}', '\u{FF4D}', '\u{FF4E}', '\u{FF4F}', '\u{FF50}', '\u{FF51}', '\u{FF52}', '\u{FF53}', '\u{FF54}', '\u{FF55}', '\u{FF56}', '\u{FF57}', '\u{FF58}', '\u{FF59}', '\u{FF5A}') + + } + + fn is_unicode_titlecase_letter(self) -> bool { + match_char_class!(self, + '\u{01C5}', '\u{01C8}', '\u{01CB}', '\u{01F2}', '\u{1F88}', '\u{1F89}', '\u{1F8A}', '\u{1F8B}', '\u{1F8C}', '\u{1F8D}', '\u{1F8E}', '\u{1F8F}', '\u{1F98}', '\u{1F99}', '\u{1F9A}', '\u{1F9B}', '\u{1F9C}', '\u{1F9D}', '\u{1F9E}', '\u{1F9F}', '\u{1FA8}', '\u{1FA9}', '\u{1FAA}', '\u{1FAB}', '\u{1FAC}', '\u{1FAD}', '\u{1FAE}', '\u{1FAF}', '\u{1FBC}', '\u{1FCC}') + } + + fn is_unicode_modifier_letter(self) -> bool { + match_char_class!(self, + '\u{02B0}', '\u{02B1}', '\u{02B2}', '\u{02B3}', '\u{02B4}', '\u{02B5}', '\u{02B6}', '\u{02B7}', '\u{02B8}', '\u{02B9}', '\u{02BA}', '\u{02BB}', '\u{02BC}', '\u{02BD}', '\u{02BE}', '\u{02BF}', '\u{02C0}', '\u{02C1}', '\u{02C6}', '\u{02C7}', '\u{02C8}', '\u{02C9}', '\u{02CA}', '\u{02CB}', '\u{02CC}', '\u{02CD}', '\u{02CE}', '\u{02CF}', '\u{02D0}', '\u{02D1}', '\u{02E0}', '\u{02E1}', '\u{02E2}', '\u{02E3}', '\u{02E4}', '\u{02EC}', '\u{02EE}', '\u{0374}', '\u{037A}', '\u{0559}', '\u{0640}', '\u{06E5}', '\u{06E6}', '\u{07F4}', '\u{07F5}', '\u{07FA}', '\u{0971}', '\u{0E46}', '\u{0EC6}', '\u{10FC}', '\u{17D7}', '\u{1843}', '\u{1C78}', '\u{1C79}', '\u{1C7A}', '\u{1C7B}', '\u{1C7C}', '\u{1C7D}', '\u{1D2C}', '\u{1D2D}', '\u{1D2E}', '\u{1D2F}', '\u{1D30}', '\u{1D31}', '\u{1D32}', '\u{1D33}', '\u{1D34}', '\u{1D35}', '\u{1D36}', '\u{1D37}', '\u{1D38}', '\u{1D39}', '\u{1D3A}', '\u{1D3B}', '\u{1D3C}', '\u{1D3D}', '\u{1D3E}', '\u{1D3F}', '\u{1D40}', '\u{1D41}', '\u{1D42}', '\u{1D43}', '\u{1D44}', '\u{1D45}', '\u{1D46}', '\u{1D47}', '\u{1D48}', '\u{1D49}', '\u{1D4A}', '\u{1D4B}', '\u{1D4C}', '\u{1D4D}', '\u{1D4E}', '\u{1D4F}', '\u{1D50}', '\u{1D51}', '\u{1D52}', '\u{1D53}', '\u{1D54}', '\u{1D55}', '\u{1D56}', '\u{1D57}', '\u{1D58}', '\u{1D59}', '\u{1D5A}', '\u{1D5B}', '\u{1D5C}', '\u{1D5D}', '\u{1D5E}', '\u{1D5F}', '\u{1D60}', '\u{1D61}', '\u{1D78}', '\u{1D9B}', '\u{1D9C}', '\u{1D9D}', '\u{1D9E}', '\u{1D9F}', '\u{1DA0}', '\u{1DA1}', '\u{1DA2}', '\u{1DA3}', '\u{1DA4}', '\u{1DA5}', '\u{1DA6}', '\u{1DA7}', '\u{1DA8}', '\u{1DA9}', '\u{1DAA}', '\u{1DAB}', '\u{1DAC}', '\u{1DAD}', '\u{1DAE}', '\u{1DAF}', '\u{1DB0}', '\u{1DB1}', '\u{1DB2}', '\u{1DB3}', '\u{1DB4}', '\u{1DB5}', '\u{1DB6}', '\u{1DB7}', '\u{1DB8}', '\u{1DB9}', '\u{1DBA}', '\u{1DBB}', '\u{1DBC}', '\u{1DBD}', '\u{1DBE}', '\u{1DBF}', '\u{2090}', '\u{2091}', '\u{2092}', '\u{2093}', '\u{2094}', '\u{2C7D}', '\u{2D6F}', '\u{2E2F}', '\u{3005}', '\u{3031}', '\u{3032}', '\u{3033}', '\u{3034}', '\u{3035}', '\u{303B}', '\u{309D}', '\u{309E}', '\u{30FC}', '\u{30FD}', '\u{30FE}', '\u{A015}', '\u{A60C}', '\u{A67F}', '\u{A717}', '\u{A718}', '\u{A719}', '\u{A71A}', '\u{A71B}', '\u{A71C}', '\u{A71D}', '\u{A71E}', '\u{A71F}', '\u{A770}', '\u{A788}', '\u{FF70}', '\u{FF9E}', '\u{FF9F}') + } + + fn is_unicode_other_letter(self) -> bool { + match_char_class!(self, + '\u{01BB}', '\u{01C0}', '\u{01C1}', '\u{01C2}', '\u{01C3}', '\u{0294}', '\u{05D0}', '\u{05D1}', '\u{05D2}', '\u{05D3}', '\u{05D4}', '\u{05D5}', '\u{05D6}', '\u{05D7}', '\u{05D8}', '\u{05D9}', '\u{05DA}', '\u{05DB}', '\u{05DC}', '\u{05DD}', '\u{05DE}', '\u{05DF}', '\u{05E0}', '\u{05E1}', '\u{05E2}', '\u{05E3}', '\u{05E4}', '\u{05E5}', '\u{05E6}', '\u{05E7}', '\u{05E8}', '\u{05E9}', '\u{05EA}', '\u{05F0}', '\u{05F1}', '\u{05F2}', '\u{0621}', '\u{0622}', '\u{0623}', '\u{0624}', '\u{0625}', '\u{0626}', '\u{0627}', '\u{0628}', '\u{0629}', '\u{062A}', '\u{062B}', '\u{062C}', '\u{062D}', '\u{062E}', '\u{062F}', '\u{0630}', '\u{0631}', '\u{0632}', '\u{0633}', '\u{0634}', '\u{0635}', '\u{0636}', '\u{0637}', '\u{0638}', '\u{0639}', '\u{063A}', '\u{063B}', '\u{063C}', '\u{063D}', '\u{063E}', '\u{063F}', '\u{0641}', '\u{0642}', '\u{0643}', '\u{0644}', '\u{0645}', '\u{0646}', '\u{0647}', '\u{0648}', '\u{0649}', '\u{064A}', '\u{066E}', '\u{066F}', '\u{0671}', '\u{0672}', '\u{0673}', '\u{0674}', '\u{0675}', '\u{0676}', '\u{0677}', '\u{0678}', '\u{0679}', '\u{067A}', '\u{067B}', '\u{067C}', '\u{067D}', '\u{067E}', '\u{067F}', '\u{0680}', '\u{0681}', '\u{0682}', '\u{0683}', '\u{0684}', '\u{0685}', '\u{0686}', '\u{0687}', '\u{0688}', '\u{0689}', '\u{068A}', '\u{068B}', '\u{068C}', '\u{068D}', '\u{068E}', '\u{068F}', '\u{0690}', '\u{0691}', '\u{0692}', '\u{0693}', '\u{0694}', '\u{0695}', '\u{0696}', '\u{0697}', '\u{0698}', '\u{0699}', '\u{069A}', '\u{069B}', '\u{069C}', '\u{069D}', '\u{069E}', '\u{069F}', '\u{06A0}', '\u{06A1}', '\u{06A2}', '\u{06A3}', '\u{06A4}', '\u{06A5}', '\u{06A6}', '\u{06A7}', '\u{06A8}', '\u{06A9}', '\u{06AA}', '\u{06AB}', '\u{06AC}', '\u{06AD}', '\u{06AE}', '\u{06AF}', '\u{06B0}', '\u{06B1}', '\u{06B2}', '\u{06B3}', '\u{06B4}', '\u{06B5}', '\u{06B6}', '\u{06B7}', '\u{06B8}', '\u{06B9}', '\u{06BA}', '\u{06BB}', '\u{06BC}', '\u{06BD}', '\u{06BE}', '\u{06BF}', '\u{06C0}', '\u{06C1}', '\u{06C2}', '\u{06C3}', '\u{06C4}', '\u{06C5}', '\u{06C6}', '\u{06C7}', '\u{06C8}', '\u{06C9}', '\u{06CA}', '\u{06CB}', '\u{06CC}', '\u{06CD}', '\u{06CE}', '\u{06CF}', '\u{06D0}', '\u{06D1}', '\u{06D2}', '\u{06D3}', '\u{06D5}', '\u{06EE}', '\u{06EF}', '\u{06FA}', '\u{06FB}', '\u{06FC}', '\u{06FF}', '\u{0710}', '\u{0712}', '\u{0713}', '\u{0714}', '\u{0715}', '\u{0716}', '\u{0717}', '\u{0718}', '\u{0719}', '\u{071A}', '\u{071B}', '\u{071C}', '\u{071D}', '\u{071E}', '\u{071F}', '\u{0720}', '\u{0721}', '\u{0722}', '\u{0723}', '\u{0724}', '\u{0725}', '\u{0726}', '\u{0727}', '\u{0728}', '\u{0729}', '\u{072A}', '\u{072B}', '\u{072C}', '\u{072D}', '\u{072E}', '\u{072F}', '\u{074D}', '\u{074E}', '\u{074F}', '\u{0750}', '\u{0751}', '\u{0752}', '\u{0753}', '\u{0754}', '\u{0755}', '\u{0756}', '\u{0757}', '\u{0758}', '\u{0759}', '\u{075A}', '\u{075B}', '\u{075C}', '\u{075D}', '\u{075E}', '\u{075F}', '\u{0760}', '\u{0761}', '\u{0762}', '\u{0763}', '\u{0764}', '\u{0765}', '\u{0766}', '\u{0767}', '\u{0768}', '\u{0769}', '\u{076A}', '\u{076B}', '\u{076C}', '\u{076D}', '\u{076E}', '\u{076F}', '\u{0770}', '\u{0771}', '\u{0772}', '\u{0773}', '\u{0774}', '\u{0775}', '\u{0776}', '\u{0777}', '\u{0778}', '\u{0779}', '\u{077A}', '\u{077B}', '\u{077C}', '\u{077D}', '\u{077E}', '\u{077F}', '\u{0780}', '\u{0781}', '\u{0782}', '\u{0783}', '\u{0784}', '\u{0785}', '\u{0786}', '\u{0787}', '\u{0788}', '\u{0789}', '\u{078A}', '\u{078B}', '\u{078C}', '\u{078D}', '\u{078E}', '\u{078F}', '\u{0790}', '\u{0791}', '\u{0792}', '\u{0793}', '\u{0794}', '\u{0795}', '\u{0796}', '\u{0797}', '\u{0798}', '\u{0799}', '\u{079A}', '\u{079B}', '\u{079C}', '\u{079D}', '\u{079E}', '\u{079F}', '\u{07A0}', '\u{07A1}', '\u{07A2}', '\u{07A3}', '\u{07A4}', '\u{07A5}', '\u{07B1}', '\u{07CA}', '\u{07CB}', '\u{07CC}', '\u{07CD}', '\u{07CE}', '\u{07CF}', '\u{07D0}', '\u{07D1}', '\u{07D2}', '\u{07D3}', '\u{07D4}', '\u{07D5}', '\u{07D6}', '\u{07D7}', '\u{07D8}', '\u{07D9}', '\u{07DA}', '\u{07DB}', '\u{07DC}', '\u{07DD}', '\u{07DE}', '\u{07DF}', '\u{07E0}', '\u{07E1}', '\u{07E2}', '\u{07E3}', '\u{07E4}', '\u{07E5}', '\u{07E6}', '\u{07E7}', '\u{07E8}', '\u{07E9}', '\u{07EA}', '\u{0904}', '\u{0905}', '\u{0906}', '\u{0907}', '\u{0908}', '\u{0909}', '\u{090A}', '\u{090B}', '\u{090C}', '\u{090D}', '\u{090E}', '\u{090F}', '\u{0910}', '\u{0911}', '\u{0912}', '\u{0913}', '\u{0914}', '\u{0915}', '\u{0916}', '\u{0917}', '\u{0918}', '\u{0919}', '\u{091A}', '\u{091B}', '\u{091C}', '\u{091D}', '\u{091E}', '\u{091F}', '\u{0920}', '\u{0921}', '\u{0922}', '\u{0923}', '\u{0924}', '\u{0925}', '\u{0926}', '\u{0927}', '\u{0928}', '\u{0929}', '\u{092A}', '\u{092B}', '\u{092C}', '\u{092D}', '\u{092E}', '\u{092F}', '\u{0930}', '\u{0931}', '\u{0932}', '\u{0933}', '\u{0934}', '\u{0935}', '\u{0936}', '\u{0937}', '\u{0938}', '\u{0939}', '\u{093D}', '\u{0950}', '\u{0958}', '\u{0959}', '\u{095A}', '\u{095B}', '\u{095C}', '\u{095D}', '\u{095E}', '\u{095F}', '\u{0960}', '\u{0961}', '\u{0972}', '\u{097B}', '\u{097C}', '\u{097D}', '\u{097E}', '\u{097F}', '\u{0985}', '\u{0986}', '\u{0987}', '\u{0988}', '\u{0989}', '\u{098A}', '\u{098B}', '\u{098C}', '\u{098F}', '\u{0990}', '\u{0993}', '\u{0994}', '\u{0995}', '\u{0996}', '\u{0997}', '\u{0998}', '\u{0999}', '\u{099A}', '\u{099B}', '\u{099C}', '\u{099D}', '\u{099E}', '\u{099F}', '\u{09A0}', '\u{09A1}', '\u{09A2}', '\u{09A3}', '\u{09A4}', '\u{09A5}', '\u{09A6}', '\u{09A7}', '\u{09A8}', '\u{09AA}', '\u{09AB}', '\u{09AC}', '\u{09AD}', '\u{09AE}', '\u{09AF}', '\u{09B0}', '\u{09B2}', '\u{09B6}', '\u{09B7}', '\u{09B8}', '\u{09B9}', '\u{09BD}', '\u{09CE}', '\u{09DC}', '\u{09DD}', '\u{09DF}', '\u{09E0}', '\u{09E1}', '\u{09F0}', '\u{09F1}', '\u{0A05}', '\u{0A06}', '\u{0A07}', '\u{0A08}', '\u{0A09}', '\u{0A0A}', '\u{0A0F}', '\u{0A10}', '\u{0A13}', '\u{0A14}', '\u{0A15}', '\u{0A16}', '\u{0A17}', '\u{0A18}', '\u{0A19}', '\u{0A1A}', '\u{0A1B}', '\u{0A1C}', '\u{0A1D}', '\u{0A1E}', '\u{0A1F}', '\u{0A20}', '\u{0A21}', '\u{0A22}', '\u{0A23}', '\u{0A24}', '\u{0A25}', '\u{0A26}', '\u{0A27}', '\u{0A28}', '\u{0A2A}', '\u{0A2B}', '\u{0A2C}', '\u{0A2D}', '\u{0A2E}', '\u{0A2F}', '\u{0A30}', '\u{0A32}', '\u{0A33}', '\u{0A35}', '\u{0A36}', '\u{0A38}', '\u{0A39}', '\u{0A59}', '\u{0A5A}', '\u{0A5B}', '\u{0A5C}', '\u{0A5E}', '\u{0A72}', '\u{0A73}', '\u{0A74}', '\u{0A85}', '\u{0A86}', '\u{0A87}', '\u{0A88}', '\u{0A89}', '\u{0A8A}', '\u{0A8B}', '\u{0A8C}', '\u{0A8D}', '\u{0A8F}', '\u{0A90}', '\u{0A91}', '\u{0A93}', '\u{0A94}', '\u{0A95}', '\u{0A96}', '\u{0A97}', '\u{0A98}', '\u{0A99}', '\u{0A9A}', '\u{0A9B}', '\u{0A9C}', '\u{0A9D}', '\u{0A9E}', '\u{0A9F}', '\u{0AA0}', '\u{0AA1}', '\u{0AA2}', '\u{0AA3}', '\u{0AA4}', '\u{0AA5}', '\u{0AA6}', '\u{0AA7}', '\u{0AA8}', '\u{0AAA}', '\u{0AAB}', '\u{0AAC}', '\u{0AAD}', '\u{0AAE}', '\u{0AAF}', '\u{0AB0}', '\u{0AB2}', '\u{0AB3}', '\u{0AB5}', '\u{0AB6}', '\u{0AB7}', '\u{0AB8}', '\u{0AB9}', '\u{0ABD}', '\u{0AD0}', '\u{0AE0}', '\u{0AE1}', '\u{0B05}', '\u{0B06}', '\u{0B07}', '\u{0B08}', '\u{0B09}', '\u{0B0A}', '\u{0B0B}', '\u{0B0C}', '\u{0B0F}', '\u{0B10}', '\u{0B13}', '\u{0B14}', '\u{0B15}', '\u{0B16}', '\u{0B17}', '\u{0B18}', '\u{0B19}', '\u{0B1A}', '\u{0B1B}', '\u{0B1C}', '\u{0B1D}', '\u{0B1E}', '\u{0B1F}', '\u{0B20}', '\u{0B21}', '\u{0B22}', '\u{0B23}', '\u{0B24}', '\u{0B25}', '\u{0B26}', '\u{0B27}', '\u{0B28}', '\u{0B2A}', '\u{0B2B}', '\u{0B2C}', '\u{0B2D}', '\u{0B2E}', '\u{0B2F}', '\u{0B30}', '\u{0B32}', '\u{0B33}', '\u{0B35}', '\u{0B36}', '\u{0B37}', '\u{0B38}', '\u{0B39}', '\u{0B3D}', '\u{0B5C}', '\u{0B5D}', '\u{0B5F}', '\u{0B60}', '\u{0B61}', '\u{0B71}', '\u{0B83}', '\u{0B85}', '\u{0B86}', '\u{0B87}', '\u{0B88}', '\u{0B89}', '\u{0B8A}', '\u{0B8E}', '\u{0B8F}', '\u{0B90}', '\u{0B92}', '\u{0B93}', '\u{0B94}', '\u{0B95}', '\u{0B99}', '\u{0B9A}', '\u{0B9C}', '\u{0B9E}', '\u{0B9F}', '\u{0BA3}', '\u{0BA4}', '\u{0BA8}', '\u{0BA9}', '\u{0BAA}', '\u{0BAE}', '\u{0BAF}', '\u{0BB0}', '\u{0BB1}', '\u{0BB2}', '\u{0BB3}', '\u{0BB4}', '\u{0BB5}', '\u{0BB6}', '\u{0BB7}', '\u{0BB8}', '\u{0BB9}', '\u{0BD0}', '\u{0C05}', '\u{0C06}', '\u{0C07}', '\u{0C08}', '\u{0C09}', '\u{0C0A}', '\u{0C0B}', '\u{0C0C}', '\u{0C0E}', '\u{0C0F}', '\u{0C10}', '\u{0C12}', '\u{0C13}', '\u{0C14}', '\u{0C15}', '\u{0C16}', '\u{0C17}', '\u{0C18}', '\u{0C19}', '\u{0C1A}', '\u{0C1B}', '\u{0C1C}', '\u{0C1D}', '\u{0C1E}', '\u{0C1F}', '\u{0C20}', '\u{0C21}', '\u{0C22}', '\u{0C23}', '\u{0C24}', '\u{0C25}', '\u{0C26}', '\u{0C27}', '\u{0C28}', '\u{0C2A}', '\u{0C2B}', '\u{0C2C}', '\u{0C2D}', '\u{0C2E}', '\u{0C2F}', '\u{0C30}', '\u{0C31}', '\u{0C32}', '\u{0C33}', '\u{0C35}', '\u{0C36}', '\u{0C37}', '\u{0C38}', '\u{0C39}', '\u{0C3D}', '\u{0C58}', '\u{0C59}', '\u{0C60}', '\u{0C61}', '\u{0C85}', '\u{0C86}', '\u{0C87}', '\u{0C88}', '\u{0C89}', '\u{0C8A}', '\u{0C8B}', '\u{0C8C}', '\u{0C8E}', '\u{0C8F}', '\u{0C90}', '\u{0C92}', '\u{0C93}', '\u{0C94}', '\u{0C95}', '\u{0C96}', '\u{0C97}', '\u{0C98}', '\u{0C99}', '\u{0C9A}', '\u{0C9B}', '\u{0C9C}', '\u{0C9D}', '\u{0C9E}', '\u{0C9F}', '\u{0CA0}', '\u{0CA1}', '\u{0CA2}', '\u{0CA3}', '\u{0CA4}', '\u{0CA5}', '\u{0CA6}', '\u{0CA7}', '\u{0CA8}', '\u{0CAA}', '\u{0CAB}', '\u{0CAC}', '\u{0CAD}', '\u{0CAE}', '\u{0CAF}', '\u{0CB0}', '\u{0CB1}', '\u{0CB2}', '\u{0CB3}', '\u{0CB5}', '\u{0CB6}', '\u{0CB7}', '\u{0CB8}', '\u{0CB9}', '\u{0CBD}', '\u{0CDE}', '\u{0CE0}', '\u{0CE1}', '\u{0D05}', '\u{0D06}', '\u{0D07}', '\u{0D08}', '\u{0D09}', '\u{0D0A}', '\u{0D0B}', '\u{0D0C}', '\u{0D0E}', '\u{0D0F}', '\u{0D10}', '\u{0D12}', '\u{0D13}', '\u{0D14}', '\u{0D15}', '\u{0D16}', '\u{0D17}', '\u{0D18}', '\u{0D19}', '\u{0D1A}', '\u{0D1B}', '\u{0D1C}', '\u{0D1D}', '\u{0D1E}', '\u{0D1F}', '\u{0D20}', '\u{0D21}', '\u{0D22}', '\u{0D23}', '\u{0D24}', '\u{0D25}', '\u{0D26}', '\u{0D27}', '\u{0D28}', '\u{0D2A}', '\u{0D2B}', '\u{0D2C}', '\u{0D2D}', '\u{0D2E}', '\u{0D2F}', '\u{0D30}', '\u{0D31}', '\u{0D32}', '\u{0D33}', '\u{0D34}', '\u{0D35}', '\u{0D36}', '\u{0D37}', '\u{0D38}', '\u{0D39}', '\u{0D3D}', '\u{0D60}', '\u{0D61}', '\u{0D7A}', '\u{0D7B}', '\u{0D7C}', '\u{0D7D}', '\u{0D7E}', '\u{0D7F}', '\u{0D85}', '\u{0D86}', '\u{0D87}', '\u{0D88}', '\u{0D89}', '\u{0D8A}', '\u{0D8B}', '\u{0D8C}', '\u{0D8D}', '\u{0D8E}', '\u{0D8F}', '\u{0D90}', '\u{0D91}', '\u{0D92}', '\u{0D93}', '\u{0D94}', '\u{0D95}', '\u{0D96}', '\u{0D9A}', '\u{0D9B}', '\u{0D9C}', '\u{0D9D}', '\u{0D9E}', '\u{0D9F}', '\u{0DA0}', '\u{0DA1}', '\u{0DA2}', '\u{0DA3}', '\u{0DA4}', '\u{0DA5}', '\u{0DA6}', '\u{0DA7}', '\u{0DA8}', '\u{0DA9}', '\u{0DAA}', '\u{0DAB}', '\u{0DAC}', '\u{0DAD}', '\u{0DAE}', '\u{0DAF}', '\u{0DB0}', '\u{0DB1}', '\u{0DB3}', '\u{0DB4}', '\u{0DB5}', '\u{0DB6}', '\u{0DB7}', '\u{0DB8}', '\u{0DB9}', '\u{0DBA}', '\u{0DBB}', '\u{0DBD}', '\u{0DC0}', '\u{0DC1}', '\u{0DC2}', '\u{0DC3}', '\u{0DC4}', '\u{0DC5}', '\u{0DC6}', '\u{0E01}', '\u{0E02}', '\u{0E03}', '\u{0E04}', '\u{0E05}', '\u{0E06}', '\u{0E07}', '\u{0E08}', '\u{0E09}', '\u{0E0A}', '\u{0E0B}', '\u{0E0C}', '\u{0E0D}', '\u{0E0E}', '\u{0E0F}', '\u{0E10}', '\u{0E11}', '\u{0E12}', '\u{0E13}', '\u{0E14}', '\u{0E15}', '\u{0E16}', '\u{0E17}', '\u{0E18}', '\u{0E19}', '\u{0E1A}', '\u{0E1B}', '\u{0E1C}', '\u{0E1D}', '\u{0E1E}', '\u{0E1F}', '\u{0E20}', '\u{0E21}', '\u{0E22}', '\u{0E23}', '\u{0E24}', '\u{0E25}', '\u{0E26}', '\u{0E27}', '\u{0E28}', '\u{0E29}', '\u{0E2A}', '\u{0E2B}', '\u{0E2C}', '\u{0E2D}', '\u{0E2E}', '\u{0E2F}', '\u{0E30}', '\u{0E32}', '\u{0E33}', '\u{0E40}', '\u{0E41}', '\u{0E42}', '\u{0E43}', '\u{0E44}', '\u{0E45}', '\u{0E81}', '\u{0E82}', '\u{0E84}', '\u{0E87}', '\u{0E88}', '\u{0E8A}', '\u{0E8D}', '\u{0E94}', '\u{0E95}', '\u{0E96}', '\u{0E97}', '\u{0E99}', '\u{0E9A}', '\u{0E9B}', '\u{0E9C}', '\u{0E9D}', '\u{0E9E}', '\u{0E9F}', '\u{0EA1}', '\u{0EA2}', '\u{0EA3}', '\u{0EA5}', '\u{0EA7}', '\u{0EAA}', '\u{0EAB}', '\u{0EAD}', '\u{0EAE}', '\u{0EAF}', '\u{0EB0}', '\u{0EB2}', '\u{0EB3}', '\u{0EBD}', '\u{0EC0}', '\u{0EC1}', '\u{0EC2}', '\u{0EC3}', '\u{0EC4}', '\u{0EDC}', '\u{0EDD}', '\u{0F00}', '\u{0F40}', '\u{0F41}', '\u{0F42}', '\u{0F43}', '\u{0F44}', '\u{0F45}', '\u{0F46}', '\u{0F47}', '\u{0F49}', '\u{0F4A}', '\u{0F4B}', '\u{0F4C}', '\u{0F4D}', '\u{0F4E}', '\u{0F4F}', '\u{0F50}', '\u{0F51}', '\u{0F52}', '\u{0F53}', '\u{0F54}', '\u{0F55}', '\u{0F56}', '\u{0F57}', '\u{0F58}', '\u{0F59}', '\u{0F5A}', '\u{0F5B}', '\u{0F5C}', '\u{0F5D}', '\u{0F5E}', '\u{0F5F}', '\u{0F60}', '\u{0F61}', '\u{0F62}', '\u{0F63}', '\u{0F64}', '\u{0F65}', '\u{0F66}', '\u{0F67}', '\u{0F68}', '\u{0F69}', '\u{0F6A}', '\u{0F6B}', '\u{0F6C}', '\u{0F88}', '\u{0F89}', '\u{0F8A}', '\u{0F8B}', '\u{1000}', '\u{1001}', '\u{1002}', '\u{1003}', '\u{1004}', '\u{1005}', '\u{1006}', '\u{1007}', '\u{1008}', '\u{1009}', '\u{100A}', '\u{100B}', '\u{100C}', '\u{100D}', '\u{100E}', '\u{100F}', '\u{1010}', '\u{1011}', '\u{1012}', '\u{1013}', '\u{1014}', '\u{1015}', '\u{1016}', '\u{1017}', '\u{1018}', '\u{1019}', '\u{101A}', '\u{101B}', '\u{101C}', '\u{101D}', '\u{101E}', '\u{101F}', '\u{1020}', '\u{1021}', '\u{1022}', '\u{1023}', '\u{1024}', '\u{1025}', '\u{1026}', '\u{1027}', '\u{1028}', '\u{1029}', '\u{102A}', '\u{103F}', '\u{1050}', '\u{1051}', '\u{1052}', '\u{1053}', '\u{1054}', '\u{1055}', '\u{105A}', '\u{105B}', '\u{105C}', '\u{105D}', '\u{1061}', '\u{1065}', '\u{1066}', '\u{106E}', '\u{106F}', '\u{1070}', '\u{1075}', '\u{1076}', '\u{1077}', '\u{1078}', '\u{1079}', '\u{107A}', '\u{107B}', '\u{107C}', '\u{107D}', '\u{107E}', '\u{107F}', '\u{1080}', '\u{1081}', '\u{108E}', '\u{10D0}', '\u{10D1}', '\u{10D2}', '\u{10D3}', '\u{10D4}', '\u{10D5}', '\u{10D6}', '\u{10D7}', '\u{10D8}', '\u{10D9}', '\u{10DA}', '\u{10DB}', '\u{10DC}', '\u{10DD}', '\u{10DE}', '\u{10DF}', '\u{10E0}', '\u{10E1}', '\u{10E2}', '\u{10E3}', '\u{10E4}', '\u{10E5}', '\u{10E6}', '\u{10E7}', '\u{10E8}', '\u{10E9}', '\u{10EA}', '\u{10EB}', '\u{10EC}', '\u{10ED}', '\u{10EE}', '\u{10EF}', '\u{10F0}', '\u{10F1}', '\u{10F2}', '\u{10F3}', '\u{10F4}', '\u{10F5}', '\u{10F6}', '\u{10F7}', '\u{10F8}', '\u{10F9}', '\u{10FA}', '\u{1100}', '\u{1101}', '\u{1102}', '\u{1103}', '\u{1104}', '\u{1105}', '\u{1106}', '\u{1107}', '\u{1108}', '\u{1109}', '\u{110A}', '\u{110B}', '\u{110C}', '\u{110D}', '\u{110E}', '\u{110F}', '\u{1110}', '\u{1111}', '\u{1112}', '\u{1113}', '\u{1114}', '\u{1115}', '\u{1116}', '\u{1117}', '\u{1118}', '\u{1119}', '\u{111A}', '\u{111B}', '\u{111C}', '\u{111D}', '\u{111E}', '\u{111F}', '\u{1120}', '\u{1121}', '\u{1122}', '\u{1123}', '\u{1124}', '\u{1125}', '\u{1126}', '\u{1127}', '\u{1128}', '\u{1129}', '\u{112A}', '\u{112B}', '\u{112C}', '\u{112D}', '\u{112E}', '\u{112F}', '\u{1130}', '\u{1131}', '\u{1132}', '\u{1133}', '\u{1134}', '\u{1135}', '\u{1136}', '\u{1137}', '\u{1138}', '\u{1139}', '\u{113A}', '\u{113B}', '\u{113C}', '\u{113D}', '\u{113E}', '\u{113F}', '\u{1140}', '\u{1141}', '\u{1142}', '\u{1143}', '\u{1144}', '\u{1145}', '\u{1146}', '\u{1147}', '\u{1148}', '\u{1149}', '\u{114A}', '\u{114B}', '\u{114C}', '\u{114D}', '\u{114E}', '\u{114F}', '\u{1150}', '\u{1151}', '\u{1152}', '\u{1153}', '\u{1154}', '\u{1155}', '\u{1156}', '\u{1157}', '\u{1158}', '\u{1159}', '\u{115F}', '\u{1160}', '\u{1161}', '\u{1162}', '\u{1163}', '\u{1164}', '\u{1165}', '\u{1166}', '\u{1167}', '\u{1168}', '\u{1169}', '\u{116A}', '\u{116B}', '\u{116C}', '\u{116D}', '\u{116E}', '\u{116F}', '\u{1170}', '\u{1171}', '\u{1172}', '\u{1173}', '\u{1174}', '\u{1175}', '\u{1176}', '\u{1177}', '\u{1178}', '\u{1179}', '\u{117A}', '\u{117B}', '\u{117C}', '\u{117D}', '\u{117E}', '\u{117F}', '\u{1180}', '\u{1181}', '\u{1182}', '\u{1183}', '\u{1184}', '\u{1185}', '\u{1186}', '\u{1187}', '\u{1188}', '\u{1189}', '\u{118A}', '\u{118B}', '\u{118C}', '\u{118D}', '\u{118E}', '\u{118F}', '\u{1190}', '\u{1191}', '\u{1192}', '\u{1193}', '\u{1194}', '\u{1195}', '\u{1196}', '\u{1197}', '\u{1198}', '\u{1199}', '\u{119A}', '\u{119B}', '\u{119C}', '\u{119D}', '\u{119E}', '\u{119F}', '\u{11A0}', '\u{11A1}', '\u{11A2}', '\u{11A8}', '\u{11A9}', '\u{11AA}', '\u{11AB}', '\u{11AC}', '\u{11AD}', '\u{11AE}', '\u{11AF}', '\u{11B0}', '\u{11B1}', '\u{11B2}', '\u{11B3}', '\u{11B4}', '\u{11B5}', '\u{11B6}', '\u{11B7}', '\u{11B8}', '\u{11B9}', '\u{11BA}', '\u{11BB}', '\u{11BC}', '\u{11BD}', '\u{11BE}', '\u{11BF}', '\u{11C0}', '\u{11C1}', '\u{11C2}', '\u{11C3}', '\u{11C4}', '\u{11C5}', '\u{11C6}', '\u{11C7}', '\u{11C8}', '\u{11C9}', '\u{11CA}', '\u{11CB}', '\u{11CC}', '\u{11CD}', '\u{11CE}', '\u{11CF}', '\u{11D0}', '\u{11D1}', '\u{11D2}', '\u{11D3}', '\u{11D4}', '\u{11D5}', '\u{11D6}', '\u{11D7}', '\u{11D8}', '\u{11D9}', '\u{11DA}', '\u{11DB}', '\u{11DC}', '\u{11DD}', '\u{11DE}', '\u{11DF}', '\u{11E0}', '\u{11E1}', '\u{11E2}', '\u{11E3}', '\u{11E4}', '\u{11E5}', '\u{11E6}', '\u{11E7}', '\u{11E8}', '\u{11E9}', '\u{11EA}', '\u{11EB}', '\u{11EC}', '\u{11ED}', '\u{11EE}', '\u{11EF}', '\u{11F0}', '\u{11F1}', '\u{11F2}', '\u{11F3}', '\u{11F4}', '\u{11F5}', '\u{11F6}', '\u{11F7}', '\u{11F8}', '\u{11F9}', '\u{1200}', '\u{1201}', '\u{1202}', '\u{1203}', '\u{1204}', '\u{1205}', '\u{1206}', '\u{1207}', '\u{1208}', '\u{1209}', '\u{120A}', '\u{120B}', '\u{120C}', '\u{120D}', '\u{120E}', '\u{120F}', '\u{1210}', '\u{1211}', '\u{1212}', '\u{1213}', '\u{1214}', '\u{1215}', '\u{1216}', '\u{1217}', '\u{1218}', '\u{1219}', '\u{121A}', '\u{121B}', '\u{121C}', '\u{121D}', '\u{121E}', '\u{121F}', '\u{1220}', '\u{1221}', '\u{1222}', '\u{1223}', '\u{1224}', '\u{1225}', '\u{1226}', '\u{1227}', '\u{1228}', '\u{1229}', '\u{122A}', '\u{122B}', '\u{122C}', '\u{122D}', '\u{122E}', '\u{122F}', '\u{1230}', '\u{1231}', '\u{1232}', '\u{1233}', '\u{1234}', '\u{1235}', '\u{1236}', '\u{1237}', '\u{1238}', '\u{1239}', '\u{123A}', '\u{123B}', '\u{123C}', '\u{123D}', '\u{123E}', '\u{123F}', '\u{1240}', '\u{1241}', '\u{1242}', '\u{1243}', '\u{1244}', '\u{1245}', '\u{1246}', '\u{1247}', '\u{1248}', '\u{124A}', '\u{124B}', '\u{124C}', '\u{124D}', '\u{1250}', '\u{1251}', '\u{1252}', '\u{1253}', '\u{1254}', '\u{1255}', '\u{1256}', '\u{1258}', '\u{125A}', '\u{125B}', '\u{125C}', '\u{125D}', '\u{1260}', '\u{1261}', '\u{1262}', '\u{1263}', '\u{1264}', '\u{1265}', '\u{1266}', '\u{1267}', '\u{1268}', '\u{1269}', '\u{126A}', '\u{126B}', '\u{126C}', '\u{126D}', '\u{126E}', '\u{126F}', '\u{1270}', '\u{1271}', '\u{1272}', '\u{1273}', '\u{1274}', '\u{1275}', '\u{1276}', '\u{1277}', '\u{1278}', '\u{1279}', '\u{127A}', '\u{127B}', '\u{127C}', '\u{127D}', '\u{127E}', '\u{127F}', '\u{1280}', '\u{1281}', '\u{1282}', '\u{1283}', '\u{1284}', '\u{1285}', '\u{1286}', '\u{1287}', '\u{1288}', '\u{128A}', '\u{128B}', '\u{128C}', '\u{128D}', '\u{1290}', '\u{1291}', '\u{1292}', '\u{1293}', '\u{1294}', '\u{1295}', '\u{1296}', '\u{1297}', '\u{1298}', '\u{1299}', '\u{129A}', '\u{129B}', '\u{129C}', '\u{129D}', '\u{129E}', '\u{129F}', '\u{12A0}', '\u{12A1}', '\u{12A2}', '\u{12A3}', '\u{12A4}', '\u{12A5}', '\u{12A6}', '\u{12A7}', '\u{12A8}', '\u{12A9}', '\u{12AA}', '\u{12AB}', '\u{12AC}', '\u{12AD}', '\u{12AE}', '\u{12AF}', '\u{12B0}', '\u{12B2}', '\u{12B3}', '\u{12B4}', '\u{12B5}', '\u{12B8}', '\u{12B9}', '\u{12BA}', '\u{12BB}', '\u{12BC}', '\u{12BD}', '\u{12BE}', '\u{12C0}', '\u{12C2}', '\u{12C3}', '\u{12C4}', '\u{12C5}', '\u{12C8}', '\u{12C9}', '\u{12CA}', '\u{12CB}', '\u{12CC}', '\u{12CD}', '\u{12CE}', '\u{12CF}', '\u{12D0}', '\u{12D1}', '\u{12D2}', '\u{12D3}', '\u{12D4}', '\u{12D5}', '\u{12D6}', '\u{12D8}', '\u{12D9}', '\u{12DA}', '\u{12DB}', '\u{12DC}', '\u{12DD}', '\u{12DE}', '\u{12DF}', '\u{12E0}', '\u{12E1}', '\u{12E2}', '\u{12E3}', '\u{12E4}', '\u{12E5}', '\u{12E6}', '\u{12E7}', '\u{12E8}', '\u{12E9}', '\u{12EA}', '\u{12EB}', '\u{12EC}', '\u{12ED}', '\u{12EE}', '\u{12EF}', '\u{12F0}', '\u{12F1}', '\u{12F2}', '\u{12F3}', '\u{12F4}', '\u{12F5}', '\u{12F6}', '\u{12F7}', '\u{12F8}', '\u{12F9}', '\u{12FA}', '\u{12FB}', '\u{12FC}', '\u{12FD}', '\u{12FE}', '\u{12FF}', '\u{1300}', '\u{1301}', '\u{1302}', '\u{1303}', '\u{1304}', '\u{1305}', '\u{1306}', '\u{1307}', '\u{1308}', '\u{1309}', '\u{130A}', '\u{130B}', '\u{130C}', '\u{130D}', '\u{130E}', '\u{130F}', '\u{1310}', '\u{1312}', '\u{1313}', '\u{1314}', '\u{1315}', '\u{1318}', '\u{1319}', '\u{131A}', '\u{131B}', '\u{131C}', '\u{131D}', '\u{131E}', '\u{131F}', '\u{1320}', '\u{1321}', '\u{1322}', '\u{1323}', '\u{1324}', '\u{1325}', '\u{1326}', '\u{1327}', '\u{1328}', '\u{1329}', '\u{132A}', '\u{132B}', '\u{132C}', '\u{132D}', '\u{132E}', '\u{132F}', '\u{1330}', '\u{1331}', '\u{1332}', '\u{1333}', '\u{1334}', '\u{1335}', '\u{1336}', '\u{1337}', '\u{1338}', '\u{1339}', '\u{133A}', '\u{133B}', '\u{133C}', '\u{133D}', '\u{133E}', '\u{133F}', '\u{1340}', '\u{1341}', '\u{1342}', '\u{1343}', '\u{1344}', '\u{1345}', '\u{1346}', '\u{1347}', '\u{1348}', '\u{1349}', '\u{134A}', '\u{134B}', '\u{134C}', '\u{134D}', '\u{134E}', '\u{134F}', '\u{1350}', '\u{1351}', '\u{1352}', '\u{1353}', '\u{1354}', '\u{1355}', '\u{1356}', '\u{1357}', '\u{1358}', '\u{1359}', '\u{135A}', '\u{1380}', '\u{1381}', '\u{1382}', '\u{1383}', '\u{1384}', '\u{1385}', '\u{1386}', '\u{1387}', '\u{1388}', '\u{1389}', '\u{138A}', '\u{138B}', '\u{138C}', '\u{138D}', '\u{138E}', '\u{138F}', '\u{13A0}', '\u{13A1}', '\u{13A2}', '\u{13A3}', '\u{13A4}', '\u{13A5}', '\u{13A6}', '\u{13A7}', '\u{13A8}', '\u{13A9}', '\u{13AA}', '\u{13AB}', '\u{13AC}', '\u{13AD}', '\u{13AE}', '\u{13AF}', '\u{13B0}', '\u{13B1}', '\u{13B2}', '\u{13B3}', '\u{13B4}', '\u{13B5}', '\u{13B6}', '\u{13B7}', '\u{13B8}', '\u{13B9}', '\u{13BA}', '\u{13BB}', '\u{13BC}', '\u{13BD}', '\u{13BE}', '\u{13BF}', '\u{13C0}', '\u{13C1}', '\u{13C2}', '\u{13C3}', '\u{13C4}', '\u{13C5}', '\u{13C6}', '\u{13C7}', '\u{13C8}', '\u{13C9}', '\u{13CA}', '\u{13CB}', '\u{13CC}', '\u{13CD}', '\u{13CE}', '\u{13CF}', '\u{13D0}', '\u{13D1}', '\u{13D2}', '\u{13D3}', '\u{13D4}', '\u{13D5}', '\u{13D6}', '\u{13D7}', '\u{13D8}', '\u{13D9}', '\u{13DA}', '\u{13DB}', '\u{13DC}', '\u{13DD}', '\u{13DE}', '\u{13DF}', '\u{13E0}', '\u{13E1}', '\u{13E2}', '\u{13E3}', '\u{13E4}', '\u{13E5}', '\u{13E6}', '\u{13E7}', '\u{13E8}', '\u{13E9}', '\u{13EA}', '\u{13EB}', '\u{13EC}', '\u{13ED}', '\u{13EE}', '\u{13EF}', '\u{13F0}', '\u{13F1}', '\u{13F2}', '\u{13F3}', '\u{13F4}', '\u{1401}', '\u{1402}', '\u{1403}', '\u{1404}', '\u{1405}', '\u{1406}', '\u{1407}', '\u{1408}', '\u{1409}', '\u{140A}', '\u{140B}', '\u{140C}', '\u{140D}', '\u{140E}', '\u{140F}', '\u{1410}', '\u{1411}', '\u{1412}', '\u{1413}', '\u{1414}', '\u{1415}', '\u{1416}', '\u{1417}', '\u{1418}', '\u{1419}', '\u{141A}', '\u{141B}', '\u{141C}', '\u{141D}', '\u{141E}', '\u{141F}', '\u{1420}', '\u{1421}', '\u{1422}', '\u{1423}', '\u{1424}', '\u{1425}', '\u{1426}', '\u{1427}', '\u{1428}', '\u{1429}', '\u{142A}', '\u{142B}', '\u{142C}', '\u{142D}', '\u{142E}', '\u{142F}', '\u{1430}', '\u{1431}', '\u{1432}', '\u{1433}', '\u{1434}', '\u{1435}', '\u{1436}', '\u{1437}', '\u{1438}', '\u{1439}', '\u{143A}', '\u{143B}', '\u{143C}', '\u{143D}', '\u{143E}', '\u{143F}', '\u{1440}', '\u{1441}', '\u{1442}', '\u{1443}', '\u{1444}', '\u{1445}', '\u{1446}', '\u{1447}', '\u{1448}', '\u{1449}', '\u{144A}', '\u{144B}', '\u{144C}', '\u{144D}', '\u{144E}', '\u{144F}', '\u{1450}', '\u{1451}', '\u{1452}', '\u{1453}', '\u{1454}', '\u{1455}', '\u{1456}', '\u{1457}', '\u{1458}', '\u{1459}', '\u{145A}', '\u{145B}', '\u{145C}', '\u{145D}', '\u{145E}', '\u{145F}', '\u{1460}', '\u{1461}', '\u{1462}', '\u{1463}', '\u{1464}', '\u{1465}', '\u{1466}', '\u{1467}', '\u{1468}', '\u{1469}', '\u{146A}', '\u{146B}', '\u{146C}', '\u{146D}', '\u{146E}', '\u{146F}', '\u{1470}', '\u{1471}', '\u{1472}', '\u{1473}', '\u{1474}', '\u{1475}', '\u{1476}', '\u{1477}', '\u{1478}', '\u{1479}', '\u{147A}', '\u{147B}', '\u{147C}', '\u{147D}', '\u{147E}', '\u{147F}', '\u{1480}', '\u{1481}', '\u{1482}', '\u{1483}', '\u{1484}', '\u{1485}', '\u{1486}', '\u{1487}', '\u{1488}', '\u{1489}', '\u{148A}', '\u{148B}', '\u{148C}', '\u{148D}', '\u{148E}', '\u{148F}', '\u{1490}', '\u{1491}', '\u{1492}', '\u{1493}', '\u{1494}', '\u{1495}', '\u{1496}', '\u{1497}', '\u{1498}', '\u{1499}', '\u{149A}', '\u{149B}', '\u{149C}', '\u{149D}', '\u{149E}', '\u{149F}', '\u{14A0}', '\u{14A1}', '\u{14A2}', '\u{14A3}', '\u{14A4}', '\u{14A5}', '\u{14A6}', '\u{14A7}', '\u{14A8}', '\u{14A9}', '\u{14AA}', '\u{14AB}', '\u{14AC}', '\u{14AD}', '\u{14AE}', '\u{14AF}', '\u{14B0}', '\u{14B1}', '\u{14B2}', '\u{14B3}', '\u{14B4}', '\u{14B5}', '\u{14B6}', '\u{14B7}', '\u{14B8}', '\u{14B9}', '\u{14BA}', '\u{14BB}', '\u{14BC}', '\u{14BD}', '\u{14BE}', '\u{14BF}', '\u{14C0}', '\u{14C1}', '\u{14C2}', '\u{14C3}', '\u{14C4}', '\u{14C5}', '\u{14C6}', '\u{14C7}', '\u{14C8}', '\u{14C9}', '\u{14CA}', '\u{14CB}', '\u{14CC}', '\u{14CD}', '\u{14CE}', '\u{14CF}', '\u{14D0}', '\u{14D1}', '\u{14D2}', '\u{14D3}', '\u{14D4}', '\u{14D5}', '\u{14D6}', '\u{14D7}', '\u{14D8}', '\u{14D9}', '\u{14DA}', '\u{14DB}', '\u{14DC}', '\u{14DD}', '\u{14DE}', '\u{14DF}', '\u{14E0}', '\u{14E1}', '\u{14E2}', '\u{14E3}', '\u{14E4}', '\u{14E5}', '\u{14E6}', '\u{14E7}', '\u{14E8}', '\u{14E9}', '\u{14EA}', '\u{14EB}', '\u{14EC}', '\u{14ED}', '\u{14EE}', '\u{14EF}', '\u{14F0}', '\u{14F1}', '\u{14F2}', '\u{14F3}', '\u{14F4}', '\u{14F5}', '\u{14F6}', '\u{14F7}', '\u{14F8}', '\u{14F9}', '\u{14FA}', '\u{14FB}', '\u{14FC}', '\u{14FD}', '\u{14FE}', '\u{14FF}', '\u{1500}', '\u{1501}', '\u{1502}', '\u{1503}', '\u{1504}', '\u{1505}', '\u{1506}', '\u{1507}', '\u{1508}', '\u{1509}', '\u{150A}', '\u{150B}', '\u{150C}', '\u{150D}', '\u{150E}', '\u{150F}', '\u{1510}', '\u{1511}', '\u{1512}', '\u{1513}', '\u{1514}', '\u{1515}', '\u{1516}', '\u{1517}', '\u{1518}', '\u{1519}', '\u{151A}', '\u{151B}', '\u{151C}', '\u{151D}', '\u{151E}', '\u{151F}', '\u{1520}', '\u{1521}', '\u{1522}', '\u{1523}', '\u{1524}', '\u{1525}', '\u{1526}', '\u{1527}', '\u{1528}', '\u{1529}', '\u{152A}', '\u{152B}', '\u{152C}', '\u{152D}', '\u{152E}', '\u{152F}', '\u{1530}', '\u{1531}', '\u{1532}', '\u{1533}', '\u{1534}', '\u{1535}', '\u{1536}', '\u{1537}', '\u{1538}', '\u{1539}', '\u{153A}', '\u{153B}', '\u{153C}', '\u{153D}', '\u{153E}', '\u{153F}', '\u{1540}', '\u{1541}', '\u{1542}', '\u{1543}', '\u{1544}', '\u{1545}', '\u{1546}', '\u{1547}', '\u{1548}', '\u{1549}', '\u{154A}', '\u{154B}', '\u{154C}', '\u{154D}', '\u{154E}', '\u{154F}', '\u{1550}', '\u{1551}', '\u{1552}', '\u{1553}', '\u{1554}', '\u{1555}', '\u{1556}', '\u{1557}', '\u{1558}', '\u{1559}', '\u{155A}', '\u{155B}', '\u{155C}', '\u{155D}', '\u{155E}', '\u{155F}', '\u{1560}', '\u{1561}', '\u{1562}', '\u{1563}', '\u{1564}', '\u{1565}', '\u{1566}', '\u{1567}', '\u{1568}', '\u{1569}', '\u{156A}', '\u{156B}', '\u{156C}', '\u{156D}', '\u{156E}', '\u{156F}', '\u{1570}', '\u{1571}', '\u{1572}', '\u{1573}', '\u{1574}', '\u{1575}', '\u{1576}', '\u{1577}', '\u{1578}', '\u{1579}', '\u{157A}', '\u{157B}', '\u{157C}', '\u{157D}', '\u{157E}', '\u{157F}', '\u{1580}', '\u{1581}', '\u{1582}', '\u{1583}', '\u{1584}', '\u{1585}', '\u{1586}', '\u{1587}', '\u{1588}', '\u{1589}', '\u{158A}', '\u{158B}', '\u{158C}', '\u{158D}', '\u{158E}', '\u{158F}', '\u{1590}', '\u{1591}', '\u{1592}', '\u{1593}', '\u{1594}', '\u{1595}', '\u{1596}', '\u{1597}', '\u{1598}', '\u{1599}', '\u{159A}', '\u{159B}', '\u{159C}', '\u{159D}', '\u{159E}', '\u{159F}', '\u{15A0}', '\u{15A1}', '\u{15A2}', '\u{15A3}', '\u{15A4}', '\u{15A5}', '\u{15A6}', '\u{15A7}', '\u{15A8}', '\u{15A9}', '\u{15AA}', '\u{15AB}', '\u{15AC}', '\u{15AD}', '\u{15AE}', '\u{15AF}', '\u{15B0}', '\u{15B1}', '\u{15B2}', '\u{15B3}', '\u{15B4}', '\u{15B5}', '\u{15B6}', '\u{15B7}', '\u{15B8}', '\u{15B9}', '\u{15BA}', '\u{15BB}', '\u{15BC}', '\u{15BD}', '\u{15BE}', '\u{15BF}', '\u{15C0}', '\u{15C1}', '\u{15C2}', '\u{15C3}', '\u{15C4}', '\u{15C5}', '\u{15C6}', '\u{15C7}', '\u{15C8}', '\u{15C9}', '\u{15CA}', '\u{15CB}', '\u{15CC}', '\u{15CD}', '\u{15CE}', '\u{15CF}', '\u{15D0}', '\u{15D1}', '\u{15D2}', '\u{15D3}', '\u{15D4}', '\u{15D5}', '\u{15D6}', '\u{15D7}', '\u{15D8}', '\u{15D9}', '\u{15DA}', '\u{15DB}', '\u{15DC}', '\u{15DD}', '\u{15DE}', '\u{15DF}', '\u{15E0}', '\u{15E1}', '\u{15E2}', '\u{15E3}', '\u{15E4}', '\u{15E5}', '\u{15E6}', '\u{15E7}', '\u{15E8}', '\u{15E9}', '\u{15EA}', '\u{15EB}', '\u{15EC}', '\u{15ED}', '\u{15EE}', '\u{15EF}', '\u{15F0}', '\u{15F1}', '\u{15F2}', '\u{15F3}', '\u{15F4}', '\u{15F5}', '\u{15F6}', '\u{15F7}', '\u{15F8}', '\u{15F9}', '\u{15FA}', '\u{15FB}', '\u{15FC}', '\u{15FD}', '\u{15FE}', '\u{15FF}', '\u{1600}', '\u{1601}', '\u{1602}', '\u{1603}', '\u{1604}', '\u{1605}', '\u{1606}', '\u{1607}', '\u{1608}', '\u{1609}', '\u{160A}', '\u{160B}', '\u{160C}', '\u{160D}', '\u{160E}', '\u{160F}', '\u{1610}', '\u{1611}', '\u{1612}', '\u{1613}', '\u{1614}', '\u{1615}', '\u{1616}', '\u{1617}', '\u{1618}', '\u{1619}', '\u{161A}', '\u{161B}', '\u{161C}', '\u{161D}', '\u{161E}', '\u{161F}', '\u{1620}', '\u{1621}', '\u{1622}', '\u{1623}', '\u{1624}', '\u{1625}', '\u{1626}', '\u{1627}', '\u{1628}', '\u{1629}', '\u{162A}', '\u{162B}', '\u{162C}', '\u{162D}', '\u{162E}', '\u{162F}', '\u{1630}', '\u{1631}', '\u{1632}', '\u{1633}', '\u{1634}', '\u{1635}', '\u{1636}', '\u{1637}', '\u{1638}', '\u{1639}', '\u{163A}', '\u{163B}', '\u{163C}', '\u{163D}', '\u{163E}', '\u{163F}', '\u{1640}', '\u{1641}', '\u{1642}', '\u{1643}', '\u{1644}', '\u{1645}', '\u{1646}', '\u{1647}', '\u{1648}', '\u{1649}', '\u{164A}', '\u{164B}', '\u{164C}', '\u{164D}', '\u{164E}', '\u{164F}', '\u{1650}', '\u{1651}', '\u{1652}', '\u{1653}', '\u{1654}', '\u{1655}', '\u{1656}', '\u{1657}', '\u{1658}', '\u{1659}', '\u{165A}', '\u{165B}', '\u{165C}', '\u{165D}', '\u{165E}', '\u{165F}', '\u{1660}', '\u{1661}', '\u{1662}', '\u{1663}', '\u{1664}', '\u{1665}', '\u{1666}', '\u{1667}', '\u{1668}', '\u{1669}', '\u{166A}', '\u{166B}', '\u{166C}', '\u{166F}', '\u{1670}', '\u{1671}', '\u{1672}', '\u{1673}', '\u{1674}', '\u{1675}', '\u{1676}', '\u{1681}', '\u{1682}', '\u{1683}', '\u{1684}', '\u{1685}', '\u{1686}', '\u{1687}', '\u{1688}', '\u{1689}', '\u{168A}', '\u{168B}', '\u{168C}', '\u{168D}', '\u{168E}', '\u{168F}', '\u{1690}', '\u{1691}', '\u{1692}', '\u{1693}', '\u{1694}', '\u{1695}', '\u{1696}', '\u{1697}', '\u{1698}', '\u{1699}', '\u{169A}', '\u{16A0}', '\u{16A1}', '\u{16A2}', '\u{16A3}', '\u{16A4}', '\u{16A5}', '\u{16A6}', '\u{16A7}', '\u{16A8}', '\u{16A9}', '\u{16AA}', '\u{16AB}', '\u{16AC}', '\u{16AD}', '\u{16AE}', '\u{16AF}', '\u{16B0}', '\u{16B1}', '\u{16B2}', '\u{16B3}', '\u{16B4}', '\u{16B5}', '\u{16B6}', '\u{16B7}', '\u{16B8}', '\u{16B9}', '\u{16BA}', '\u{16BB}', '\u{16BC}', '\u{16BD}', '\u{16BE}', '\u{16BF}', '\u{16C0}', '\u{16C1}', '\u{16C2}', '\u{16C3}', '\u{16C4}', '\u{16C5}', '\u{16C6}', '\u{16C7}', '\u{16C8}', '\u{16C9}', '\u{16CA}', '\u{16CB}', '\u{16CC}', '\u{16CD}', '\u{16CE}', '\u{16CF}', '\u{16D0}', '\u{16D1}', '\u{16D2}', '\u{16D3}', '\u{16D4}', '\u{16D5}', '\u{16D6}', '\u{16D7}', '\u{16D8}', '\u{16D9}', '\u{16DA}', '\u{16DB}', '\u{16DC}', '\u{16DD}', '\u{16DE}', '\u{16DF}', '\u{16E0}', '\u{16E1}', '\u{16E2}', '\u{16E3}', '\u{16E4}', '\u{16E5}', '\u{16E6}', '\u{16E7}', '\u{16E8}', '\u{16E9}', '\u{16EA}', '\u{1700}', '\u{1701}', '\u{1702}', '\u{1703}', '\u{1704}', '\u{1705}', '\u{1706}', '\u{1707}', '\u{1708}', '\u{1709}', '\u{170A}', '\u{170B}', '\u{170C}', '\u{170E}', '\u{170F}', '\u{1710}', '\u{1711}', '\u{1720}', '\u{1721}', '\u{1722}', '\u{1723}', '\u{1724}', '\u{1725}', '\u{1726}', '\u{1727}', '\u{1728}', '\u{1729}', '\u{172A}', '\u{172B}', '\u{172C}', '\u{172D}', '\u{172E}', '\u{172F}', '\u{1730}', '\u{1731}', '\u{1740}', '\u{1741}', '\u{1742}', '\u{1743}', '\u{1744}', '\u{1745}', '\u{1746}', '\u{1747}', '\u{1748}', '\u{1749}', '\u{174A}', '\u{174B}', '\u{174C}', '\u{174D}', '\u{174E}', '\u{174F}', '\u{1750}', '\u{1751}', '\u{1760}', '\u{1761}', '\u{1762}', '\u{1763}', '\u{1764}', '\u{1765}', '\u{1766}', '\u{1767}', '\u{1768}', '\u{1769}', '\u{176A}', '\u{176B}', '\u{176C}', '\u{176E}', '\u{176F}', '\u{1770}', '\u{1780}', '\u{1781}', '\u{1782}', '\u{1783}', '\u{1784}', '\u{1785}', '\u{1786}', '\u{1787}', '\u{1788}', '\u{1789}', '\u{178A}', '\u{178B}', '\u{178C}', '\u{178D}', '\u{178E}', '\u{178F}', '\u{1790}', '\u{1791}', '\u{1792}', '\u{1793}', '\u{1794}', '\u{1795}', '\u{1796}', '\u{1797}', '\u{1798}', '\u{1799}', '\u{179A}', '\u{179B}', '\u{179C}', '\u{179D}', '\u{179E}', '\u{179F}', '\u{17A0}', '\u{17A1}', '\u{17A2}', '\u{17A3}', '\u{17A4}', '\u{17A5}', '\u{17A6}', '\u{17A7}', '\u{17A8}', '\u{17A9}', '\u{17AA}', '\u{17AB}', '\u{17AC}', '\u{17AD}', '\u{17AE}', '\u{17AF}', '\u{17B0}', '\u{17B1}', '\u{17B2}', '\u{17B3}', '\u{17DC}', '\u{1820}', '\u{1821}', '\u{1822}', '\u{1823}', '\u{1824}', '\u{1825}', '\u{1826}', '\u{1827}', '\u{1828}', '\u{1829}', '\u{182A}', '\u{182B}', '\u{182C}', '\u{182D}', '\u{182E}', '\u{182F}', '\u{1830}', '\u{1831}', '\u{1832}', '\u{1833}', '\u{1834}', '\u{1835}', '\u{1836}', '\u{1837}', '\u{1838}', '\u{1839}', '\u{183A}', '\u{183B}', '\u{183C}', '\u{183D}', '\u{183E}', '\u{183F}', '\u{1840}', '\u{1841}', '\u{1842}', '\u{1844}', '\u{1845}', '\u{1846}', '\u{1847}', '\u{1848}', '\u{1849}', '\u{184A}', '\u{184B}', '\u{184C}', '\u{184D}', '\u{184E}', '\u{184F}', '\u{1850}', '\u{1851}', '\u{1852}', '\u{1853}', '\u{1854}', '\u{1855}', '\u{1856}', '\u{1857}', '\u{1858}', '\u{1859}', '\u{185A}', '\u{185B}', '\u{185C}', '\u{185D}', '\u{185E}', '\u{185F}', '\u{1860}', '\u{1861}', '\u{1862}', '\u{1863}', '\u{1864}', '\u{1865}', '\u{1866}', '\u{1867}', '\u{1868}', '\u{1869}', '\u{186A}', '\u{186B}', '\u{186C}', '\u{186D}', '\u{186E}', '\u{186F}', '\u{1870}', '\u{1871}', '\u{1872}', '\u{1873}', '\u{1874}', '\u{1875}', '\u{1876}', '\u{1877}', '\u{1880}', '\u{1881}', '\u{1882}', '\u{1883}', '\u{1884}', '\u{1885}', '\u{1886}', '\u{1887}', '\u{1888}', '\u{1889}', '\u{188A}', '\u{188B}', '\u{188C}', '\u{188D}', '\u{188E}', '\u{188F}', '\u{1890}', '\u{1891}', '\u{1892}', '\u{1893}', '\u{1894}', '\u{1895}', '\u{1896}', '\u{1897}', '\u{1898}', '\u{1899}', '\u{189A}', '\u{189B}', '\u{189C}', '\u{189D}', '\u{189E}', '\u{189F}', '\u{18A0}', '\u{18A1}', '\u{18A2}', '\u{18A3}', '\u{18A4}', '\u{18A5}', '\u{18A6}', '\u{18A7}', '\u{18A8}', '\u{18AA}', '\u{1900}', '\u{1901}', '\u{1902}', '\u{1903}', '\u{1904}', '\u{1905}', '\u{1906}', '\u{1907}', '\u{1908}', '\u{1909}', '\u{190A}', '\u{190B}', '\u{190C}', '\u{190D}', '\u{190E}', '\u{190F}', '\u{1910}', '\u{1911}', '\u{1912}', '\u{1913}', '\u{1914}', '\u{1915}', '\u{1916}', '\u{1917}', '\u{1918}', '\u{1919}', '\u{191A}', '\u{191B}', '\u{191C}', '\u{1950}', '\u{1951}', '\u{1952}', '\u{1953}', '\u{1954}', '\u{1955}', '\u{1956}', '\u{1957}', '\u{1958}', '\u{1959}', '\u{195A}', '\u{195B}', '\u{195C}', '\u{195D}', '\u{195E}', '\u{195F}', '\u{1960}', '\u{1961}', '\u{1962}', '\u{1963}', '\u{1964}', '\u{1965}', '\u{1966}', '\u{1967}', '\u{1968}', '\u{1969}', '\u{196A}', '\u{196B}', '\u{196C}', '\u{196D}', '\u{1970}', '\u{1971}', '\u{1972}', '\u{1973}', '\u{1974}', '\u{1980}', '\u{1981}', '\u{1982}', '\u{1983}', '\u{1984}', '\u{1985}', '\u{1986}', '\u{1987}', '\u{1988}', '\u{1989}', '\u{198A}', '\u{198B}', '\u{198C}', '\u{198D}', '\u{198E}', '\u{198F}', '\u{1990}', '\u{1991}', '\u{1992}', '\u{1993}', '\u{1994}', '\u{1995}', '\u{1996}', '\u{1997}', '\u{1998}', '\u{1999}', '\u{199A}', '\u{199B}', '\u{199C}', '\u{199D}', '\u{199E}', '\u{199F}', '\u{19A0}', '\u{19A1}', '\u{19A2}', '\u{19A3}', '\u{19A4}', '\u{19A5}', '\u{19A6}', '\u{19A7}', '\u{19A8}', '\u{19A9}', '\u{19C1}', '\u{19C2}', '\u{19C3}', '\u{19C4}', '\u{19C5}', '\u{19C6}', '\u{19C7}', '\u{1A00}', '\u{1A01}', '\u{1A02}', '\u{1A03}', '\u{1A04}', '\u{1A05}', '\u{1A06}', '\u{1A07}', '\u{1A08}', '\u{1A09}', '\u{1A0A}', '\u{1A0B}', '\u{1A0C}', '\u{1A0D}', '\u{1A0E}', '\u{1A0F}', '\u{1A10}', '\u{1A11}', '\u{1A12}', '\u{1A13}', '\u{1A14}', '\u{1A15}', '\u{1A16}', '\u{1B05}', '\u{1B06}', '\u{1B07}', '\u{1B08}', '\u{1B09}', '\u{1B0A}', '\u{1B0B}', '\u{1B0C}', '\u{1B0D}', '\u{1B0E}', '\u{1B0F}', '\u{1B10}', '\u{1B11}', '\u{1B12}', '\u{1B13}', '\u{1B14}', '\u{1B15}', '\u{1B16}', '\u{1B17}', '\u{1B18}', '\u{1B19}', '\u{1B1A}', '\u{1B1B}', '\u{1B1C}', '\u{1B1D}', '\u{1B1E}', '\u{1B1F}', '\u{1B20}', '\u{1B21}', '\u{1B22}', '\u{1B23}', '\u{1B24}', '\u{1B25}', '\u{1B26}', '\u{1B27}', '\u{1B28}', '\u{1B29}', '\u{1B2A}', '\u{1B2B}', '\u{1B2C}', '\u{1B2D}', '\u{1B2E}', '\u{1B2F}', '\u{1B30}', '\u{1B31}', '\u{1B32}', '\u{1B33}', '\u{1B45}', '\u{1B46}', '\u{1B47}', '\u{1B48}', '\u{1B49}', '\u{1B4A}', '\u{1B4B}', '\u{1B83}', '\u{1B84}', '\u{1B85}', '\u{1B86}', '\u{1B87}', '\u{1B88}', '\u{1B89}', '\u{1B8A}', '\u{1B8B}', '\u{1B8C}', '\u{1B8D}', '\u{1B8E}', '\u{1B8F}', '\u{1B90}', '\u{1B91}', '\u{1B92}', '\u{1B93}', '\u{1B94}', '\u{1B95}', '\u{1B96}', '\u{1B97}', '\u{1B98}', '\u{1B99}', '\u{1B9A}', '\u{1B9B}', '\u{1B9C}', '\u{1B9D}', '\u{1B9E}', '\u{1B9F}', '\u{1BA0}', '\u{1BAE}', '\u{1BAF}', '\u{1C00}', '\u{1C01}', '\u{1C02}', '\u{1C03}', '\u{1C04}', '\u{1C05}', '\u{1C06}', '\u{1C07}', '\u{1C08}', '\u{1C09}', '\u{1C0A}', '\u{1C0B}', '\u{1C0C}', '\u{1C0D}', '\u{1C0E}', '\u{1C0F}', '\u{1C10}', '\u{1C11}', '\u{1C12}', '\u{1C13}', '\u{1C14}', '\u{1C15}', '\u{1C16}', '\u{1C17}', '\u{1C18}', '\u{1C19}', '\u{1C1A}', '\u{1C1B}', '\u{1C1C}', '\u{1C1D}', '\u{1C1E}', '\u{1C1F}', '\u{1C20}', '\u{1C21}', '\u{1C22}', '\u{1C23}', '\u{1C4D}', '\u{1C4E}', '\u{1C4F}', '\u{1C5A}', '\u{1C5B}', '\u{1C5C}', '\u{1C5D}', '\u{1C5E}', '\u{1C5F}', '\u{1C60}', '\u{1C61}', '\u{1C62}', '\u{1C63}', '\u{1C64}', '\u{1C65}', '\u{1C66}', '\u{1C67}', '\u{1C68}', '\u{1C69}', '\u{1C6A}', '\u{1C6B}', '\u{1C6C}', '\u{1C6D}', '\u{1C6E}', '\u{1C6F}', '\u{1C70}', '\u{1C71}', '\u{1C72}', '\u{1C73}', '\u{1C74}', '\u{1C75}', '\u{1C76}', '\u{1C77}', '\u{2135}', '\u{2136}', '\u{2137}', '\u{2138}', '\u{2D30}', '\u{2D31}', '\u{2D32}', '\u{2D33}', '\u{2D34}', '\u{2D35}', '\u{2D36}', '\u{2D37}', '\u{2D38}', '\u{2D39}', '\u{2D3A}', '\u{2D3B}', '\u{2D3C}', '\u{2D3D}', '\u{2D3E}', '\u{2D3F}', '\u{2D40}', '\u{2D41}', '\u{2D42}', '\u{2D43}', '\u{2D44}', '\u{2D45}', '\u{2D46}', '\u{2D47}', '\u{2D48}', '\u{2D49}', '\u{2D4A}', '\u{2D4B}', '\u{2D4C}', '\u{2D4D}', '\u{2D4E}', '\u{2D4F}', '\u{2D50}', '\u{2D51}', '\u{2D52}', '\u{2D53}', '\u{2D54}', '\u{2D55}', '\u{2D56}', '\u{2D57}', '\u{2D58}', '\u{2D59}', '\u{2D5A}', '\u{2D5B}', '\u{2D5C}', '\u{2D5D}', '\u{2D5E}', '\u{2D5F}', '\u{2D60}', '\u{2D61}', '\u{2D62}', '\u{2D63}', '\u{2D64}', '\u{2D65}', '\u{2D80}', '\u{2D81}', '\u{2D82}', '\u{2D83}', '\u{2D84}', '\u{2D85}', '\u{2D86}', '\u{2D87}', '\u{2D88}', '\u{2D89}', '\u{2D8A}', '\u{2D8B}', '\u{2D8C}', '\u{2D8D}', '\u{2D8E}', '\u{2D8F}', '\u{2D90}', '\u{2D91}', '\u{2D92}', '\u{2D93}', '\u{2D94}', '\u{2D95}', '\u{2D96}', '\u{2DA0}', '\u{2DA1}', '\u{2DA2}', '\u{2DA3}', '\u{2DA4}', '\u{2DA5}', '\u{2DA6}', '\u{2DA8}', '\u{2DA9}', '\u{2DAA}', '\u{2DAB}', '\u{2DAC}', '\u{2DAD}', '\u{2DAE}', '\u{2DB0}', '\u{2DB1}', '\u{2DB2}', '\u{2DB3}', '\u{2DB4}', '\u{2DB5}', '\u{2DB6}', '\u{2DB8}', '\u{2DB9}', '\u{2DBA}', '\u{2DBB}', '\u{2DBC}', '\u{2DBD}', '\u{2DBE}', '\u{2DC0}', '\u{2DC1}', '\u{2DC2}', '\u{2DC3}', '\u{2DC4}', '\u{2DC5}', '\u{2DC6}', '\u{2DC8}', '\u{2DC9}', '\u{2DCA}', '\u{2DCB}', '\u{2DCC}', '\u{2DCD}', '\u{2DCE}', '\u{2DD0}', '\u{2DD1}', '\u{2DD2}', '\u{2DD3}', '\u{2DD4}', '\u{2DD5}', '\u{2DD6}', '\u{2DD8}', '\u{2DD9}', '\u{2DDA}', '\u{2DDB}', '\u{2DDC}', '\u{2DDD}', '\u{2DDE}', '\u{3006}', '\u{303C}', '\u{3041}', '\u{3042}', '\u{3043}', '\u{3044}', '\u{3045}', '\u{3046}', '\u{3047}', '\u{3048}', '\u{3049}', '\u{304A}', '\u{304B}', '\u{304C}', '\u{304D}', '\u{304E}', '\u{304F}', '\u{3050}', '\u{3051}', '\u{3052}', '\u{3053}', '\u{3054}', '\u{3055}', '\u{3056}', '\u{3057}', '\u{3058}', '\u{3059}', '\u{305A}', '\u{305B}', '\u{305C}', '\u{305D}', '\u{305E}', '\u{305F}', '\u{3060}', '\u{3061}', '\u{3062}', '\u{3063}', '\u{3064}', '\u{3065}', '\u{3066}', '\u{3067}', '\u{3068}', '\u{3069}', '\u{306A}', '\u{306B}', '\u{306C}', '\u{306D}', '\u{306E}', '\u{306F}', '\u{3070}', '\u{3071}', '\u{3072}', '\u{3073}', '\u{3074}', '\u{3075}', '\u{3076}', '\u{3077}', '\u{3078}', '\u{3079}', '\u{307A}', '\u{307B}', '\u{307C}', '\u{307D}', '\u{307E}', '\u{307F}', '\u{3080}', '\u{3081}', '\u{3082}', '\u{3083}', '\u{3084}', '\u{3085}', '\u{3086}', '\u{3087}', '\u{3088}', '\u{3089}', '\u{308A}', '\u{308B}', '\u{308C}', '\u{308D}', '\u{308E}', '\u{308F}', '\u{3090}', '\u{3091}', '\u{3092}', '\u{3093}', '\u{3094}', '\u{3095}', '\u{3096}', '\u{309F}', '\u{30A1}', '\u{30A2}', '\u{30A3}', '\u{30A4}', '\u{30A5}', '\u{30A6}', '\u{30A7}', '\u{30A8}', '\u{30A9}', '\u{30AA}', '\u{30AB}', '\u{30AC}', '\u{30AD}', '\u{30AE}', '\u{30AF}', '\u{30B0}', '\u{30B1}', '\u{30B2}', '\u{30B3}', '\u{30B4}', '\u{30B5}', '\u{30B6}', '\u{30B7}', '\u{30B8}', '\u{30B9}', '\u{30BA}', '\u{30BB}', '\u{30BC}', '\u{30BD}', '\u{30BE}', '\u{30BF}', '\u{30C0}', '\u{30C1}', '\u{30C2}', '\u{30C3}', '\u{30C4}', '\u{30C5}', '\u{30C6}', '\u{30C7}', '\u{30C8}', '\u{30C9}', '\u{30CA}', '\u{30CB}', '\u{30CC}', '\u{30CD}', '\u{30CE}', '\u{30CF}', '\u{30D0}', '\u{30D1}', '\u{30D2}', '\u{30D3}', '\u{30D4}', '\u{30D5}', '\u{30D6}', '\u{30D7}', '\u{30D8}', '\u{30D9}', '\u{30DA}', '\u{30DB}', '\u{30DC}', '\u{30DD}', '\u{30DE}', '\u{30DF}', '\u{30E0}', '\u{30E1}', '\u{30E2}', '\u{30E3}', '\u{30E4}', '\u{30E5}', '\u{30E6}', '\u{30E7}', '\u{30E8}', '\u{30E9}', '\u{30EA}', '\u{30EB}', '\u{30EC}', '\u{30ED}', '\u{30EE}', '\u{30EF}', '\u{30F0}', '\u{30F1}', '\u{30F2}', '\u{30F3}', '\u{30F4}', '\u{30F5}', '\u{30F6}', '\u{30F7}', '\u{30F8}', '\u{30F9}', '\u{30FA}', '\u{30FF}', '\u{3105}', '\u{3106}', '\u{3107}', '\u{3108}', '\u{3109}', '\u{310A}', '\u{310B}', '\u{310C}', '\u{310D}', '\u{310E}', '\u{310F}', '\u{3110}', '\u{3111}', '\u{3112}', '\u{3113}', '\u{3114}', '\u{3115}', '\u{3116}', '\u{3117}', '\u{3118}', '\u{3119}', '\u{311A}', '\u{311B}', '\u{311C}', '\u{311D}', '\u{311E}', '\u{311F}', '\u{3120}', '\u{3121}', '\u{3122}', '\u{3123}', '\u{3124}', '\u{3125}', '\u{3126}', '\u{3127}', '\u{3128}', '\u{3129}', '\u{312A}', '\u{312B}', '\u{312C}', '\u{312D}', '\u{3131}', '\u{3132}', '\u{3133}', '\u{3134}', '\u{3135}', '\u{3136}', '\u{3137}', '\u{3138}', '\u{3139}', '\u{313A}', '\u{313B}', '\u{313C}', '\u{313D}', '\u{313E}', '\u{313F}', '\u{3140}', '\u{3141}', '\u{3142}', '\u{3143}', '\u{3144}', '\u{3145}', '\u{3146}', '\u{3147}', '\u{3148}', '\u{3149}', '\u{314A}', '\u{314B}', '\u{314C}', '\u{314D}', '\u{314E}', '\u{314F}', '\u{3150}', '\u{3151}', '\u{3152}', '\u{3153}', '\u{3154}', '\u{3155}', '\u{3156}', '\u{3157}', '\u{3158}', '\u{3159}', '\u{315A}', '\u{315B}', '\u{315C}', '\u{315D}', '\u{315E}', '\u{315F}', '\u{3160}', '\u{3161}', '\u{3162}', '\u{3163}', '\u{3164}', '\u{3165}', '\u{3166}', '\u{3167}', '\u{3168}', '\u{3169}', '\u{316A}', '\u{316B}', '\u{316C}', '\u{316D}', '\u{316E}', '\u{316F}', '\u{3170}', '\u{3171}', '\u{3172}', '\u{3173}', '\u{3174}', '\u{3175}', '\u{3176}', '\u{3177}', '\u{3178}', '\u{3179}', '\u{317A}', '\u{317B}', '\u{317C}', '\u{317D}', '\u{317E}', '\u{317F}', '\u{3180}', '\u{3181}', '\u{3182}', '\u{3183}', '\u{3184}', '\u{3185}', '\u{3186}', '\u{3187}', '\u{3188}', '\u{3189}', '\u{318A}', '\u{318B}', '\u{318C}', '\u{318D}', '\u{318E}', '\u{31A0}', '\u{31A1}', '\u{31A2}', '\u{31A3}', '\u{31A4}', '\u{31A5}', '\u{31A6}', '\u{31A7}', '\u{31A8}', '\u{31A9}', '\u{31AA}', '\u{31AB}', '\u{31AC}', '\u{31AD}', '\u{31AE}', '\u{31AF}', '\u{31B0}', '\u{31B1}', '\u{31B2}', '\u{31B3}', '\u{31B4}', '\u{31B5}', '\u{31B6}', '\u{31B7}', '\u{31F0}', '\u{31F1}', '\u{31F2}', '\u{31F3}', '\u{31F4}', '\u{31F5}', '\u{31F6}', '\u{31F7}', '\u{31F8}', '\u{31F9}', '\u{31FA}', '\u{31FB}', '\u{31FC}', '\u{31FD}', '\u{31FE}', '\u{31FF}', '\u{3400}', '\u{4DB5}', '\u{4E00}', '\u{9FC3}', '\u{A000}', '\u{A001}', '\u{A002}', '\u{A003}', '\u{A004}', '\u{A005}', '\u{A006}', '\u{A007}', '\u{A008}', '\u{A009}', '\u{A00A}', '\u{A00B}', '\u{A00C}', '\u{A00D}', '\u{A00E}', '\u{A00F}', '\u{A010}', '\u{A011}', '\u{A012}', '\u{A013}', '\u{A014}', '\u{A016}', '\u{A017}', '\u{A018}', '\u{A019}', '\u{A01A}', '\u{A01B}', '\u{A01C}', '\u{A01D}', '\u{A01E}', '\u{A01F}', '\u{A020}', '\u{A021}', '\u{A022}', '\u{A023}', '\u{A024}', '\u{A025}', '\u{A026}', '\u{A027}', '\u{A028}', '\u{A029}', '\u{A02A}', '\u{A02B}', '\u{A02C}', '\u{A02D}', '\u{A02E}', '\u{A02F}', '\u{A030}', '\u{A031}', '\u{A032}', '\u{A033}', '\u{A034}', '\u{A035}', '\u{A036}', '\u{A037}', '\u{A038}', '\u{A039}', '\u{A03A}', '\u{A03B}', '\u{A03C}', '\u{A03D}', '\u{A03E}', '\u{A03F}', '\u{A040}', '\u{A041}', '\u{A042}', '\u{A043}', '\u{A044}', '\u{A045}', '\u{A046}', '\u{A047}', '\u{A048}', '\u{A049}', '\u{A04A}', '\u{A04B}', '\u{A04C}', '\u{A04D}', '\u{A04E}', '\u{A04F}', '\u{A050}', '\u{A051}', '\u{A052}', '\u{A053}', '\u{A054}', '\u{A055}', '\u{A056}', '\u{A057}', '\u{A058}', '\u{A059}', '\u{A05A}', '\u{A05B}', '\u{A05C}', '\u{A05D}', '\u{A05E}', '\u{A05F}', '\u{A060}', '\u{A061}', '\u{A062}', '\u{A063}', '\u{A064}', '\u{A065}', '\u{A066}', '\u{A067}', '\u{A068}', '\u{A069}', '\u{A06A}', '\u{A06B}', '\u{A06C}', '\u{A06D}', '\u{A06E}', '\u{A06F}', '\u{A070}', '\u{A071}', '\u{A072}', '\u{A073}', '\u{A074}', '\u{A075}', '\u{A076}', '\u{A077}', '\u{A078}', '\u{A079}', '\u{A07A}', '\u{A07B}', '\u{A07C}', '\u{A07D}', '\u{A07E}', '\u{A07F}', '\u{A080}', '\u{A081}', '\u{A082}', '\u{A083}', '\u{A084}', '\u{A085}', '\u{A086}', '\u{A087}', '\u{A088}', '\u{A089}', '\u{A08A}', '\u{A08B}', '\u{A08C}', '\u{A08D}', '\u{A08E}', '\u{A08F}', '\u{A090}', '\u{A091}', '\u{A092}', '\u{A093}', '\u{A094}', '\u{A095}', '\u{A096}', '\u{A097}', '\u{A098}', '\u{A099}', '\u{A09A}', '\u{A09B}', '\u{A09C}', '\u{A09D}', '\u{A09E}', '\u{A09F}', '\u{A0A0}', '\u{A0A1}', '\u{A0A2}', '\u{A0A3}', '\u{A0A4}', '\u{A0A5}', '\u{A0A6}', '\u{A0A7}', '\u{A0A8}', '\u{A0A9}', '\u{A0AA}', '\u{A0AB}', '\u{A0AC}', '\u{A0AD}', '\u{A0AE}', '\u{A0AF}', '\u{A0B0}', '\u{A0B1}', '\u{A0B2}', '\u{A0B3}', '\u{A0B4}', '\u{A0B5}', '\u{A0B6}', '\u{A0B7}', '\u{A0B8}', '\u{A0B9}', '\u{A0BA}', '\u{A0BB}', '\u{A0BC}', '\u{A0BD}', '\u{A0BE}', '\u{A0BF}', '\u{A0C0}', '\u{A0C1}', '\u{A0C2}', '\u{A0C3}', '\u{A0C4}', '\u{A0C5}', '\u{A0C6}', '\u{A0C7}', '\u{A0C8}', '\u{A0C9}', '\u{A0CA}', '\u{A0CB}', '\u{A0CC}', '\u{A0CD}', '\u{A0CE}', '\u{A0CF}', '\u{A0D0}', '\u{A0D1}', '\u{A0D2}', '\u{A0D3}', '\u{A0D4}', '\u{A0D5}', '\u{A0D6}', '\u{A0D7}', '\u{A0D8}', '\u{A0D9}', '\u{A0DA}', '\u{A0DB}', '\u{A0DC}', '\u{A0DD}', '\u{A0DE}', '\u{A0DF}', '\u{A0E0}', '\u{A0E1}', '\u{A0E2}', '\u{A0E3}', '\u{A0E4}', '\u{A0E5}', '\u{A0E6}', '\u{A0E7}', '\u{A0E8}', '\u{A0E9}', '\u{A0EA}', '\u{A0EB}', '\u{A0EC}', '\u{A0ED}', '\u{A0EE}', '\u{A0EF}', '\u{A0F0}', '\u{A0F1}', '\u{A0F2}', '\u{A0F3}', '\u{A0F4}', '\u{A0F5}', '\u{A0F6}', '\u{A0F7}', '\u{A0F8}', '\u{A0F9}', '\u{A0FA}', '\u{A0FB}', '\u{A0FC}', '\u{A0FD}', '\u{A0FE}', '\u{A0FF}', '\u{A100}', '\u{A101}', '\u{A102}', '\u{A103}', '\u{A104}', '\u{A105}', '\u{A106}', '\u{A107}', '\u{A108}', '\u{A109}', '\u{A10A}', '\u{A10B}', '\u{A10C}', '\u{A10D}', '\u{A10E}', '\u{A10F}', '\u{A110}', '\u{A111}', '\u{A112}', '\u{A113}', '\u{A114}', '\u{A115}', '\u{A116}', '\u{A117}', '\u{A118}', '\u{A119}', '\u{A11A}', '\u{A11B}', '\u{A11C}', '\u{A11D}', '\u{A11E}', '\u{A11F}', '\u{A120}', '\u{A121}', '\u{A122}', '\u{A123}', '\u{A124}', '\u{A125}', '\u{A126}', '\u{A127}', '\u{A128}', '\u{A129}', '\u{A12A}', '\u{A12B}', '\u{A12C}', '\u{A12D}', '\u{A12E}', '\u{A12F}', '\u{A130}', '\u{A131}', '\u{A132}', '\u{A133}', '\u{A134}', '\u{A135}', '\u{A136}', '\u{A137}', '\u{A138}', '\u{A139}', '\u{A13A}', '\u{A13B}', '\u{A13C}', '\u{A13D}', '\u{A13E}', '\u{A13F}', '\u{A140}', '\u{A141}', '\u{A142}', '\u{A143}', '\u{A144}', '\u{A145}', '\u{A146}', '\u{A147}', '\u{A148}', '\u{A149}', '\u{A14A}', '\u{A14B}', '\u{A14C}', '\u{A14D}', '\u{A14E}', '\u{A14F}', '\u{A150}', '\u{A151}', '\u{A152}', '\u{A153}', '\u{A154}', '\u{A155}', '\u{A156}', '\u{A157}', '\u{A158}', '\u{A159}', '\u{A15A}', '\u{A15B}', '\u{A15C}', '\u{A15D}', '\u{A15E}', '\u{A15F}', '\u{A160}', '\u{A161}', '\u{A162}', '\u{A163}', '\u{A164}', '\u{A165}', '\u{A166}', '\u{A167}', '\u{A168}', '\u{A169}', '\u{A16A}', '\u{A16B}', '\u{A16C}', '\u{A16D}', '\u{A16E}', '\u{A16F}', '\u{A170}', '\u{A171}', '\u{A172}', '\u{A173}', '\u{A174}', '\u{A175}', '\u{A176}', '\u{A177}', '\u{A178}', '\u{A179}', '\u{A17A}', '\u{A17B}', '\u{A17C}', '\u{A17D}', '\u{A17E}', '\u{A17F}', '\u{A180}', '\u{A181}', '\u{A182}', '\u{A183}', '\u{A184}', '\u{A185}', '\u{A186}', '\u{A187}', '\u{A188}', '\u{A189}', '\u{A18A}', '\u{A18B}', '\u{A18C}', '\u{A18D}', '\u{A18E}', '\u{A18F}', '\u{A190}', '\u{A191}', '\u{A192}', '\u{A193}', '\u{A194}', '\u{A195}', '\u{A196}', '\u{A197}', '\u{A198}', '\u{A199}', '\u{A19A}', '\u{A19B}', '\u{A19C}', '\u{A19D}', '\u{A19E}', '\u{A19F}', '\u{A1A0}', '\u{A1A1}', '\u{A1A2}', '\u{A1A3}', '\u{A1A4}', '\u{A1A5}', '\u{A1A6}', '\u{A1A7}', '\u{A1A8}', '\u{A1A9}', '\u{A1AA}', '\u{A1AB}', '\u{A1AC}', '\u{A1AD}', '\u{A1AE}', '\u{A1AF}') + } + + fn is_unicode_letter_number(self) -> bool { + match_char_class!(self, + '\u{16EE}', '\u{16EF}', '\u{16F0}', '\u{2160}', '\u{2161}', '\u{2162}', '\u{2163}', '\u{2164}', '\u{2165}', '\u{2166}', '\u{2167}', '\u{2168}', '\u{2169}', '\u{216A}', '\u{216B}', '\u{216C}', '\u{216D}', '\u{216E}', '\u{216F}', '\u{2170}', '\u{2171}', '\u{2172}', '\u{2173}', '\u{2174}', '\u{2175}', '\u{2176}', '\u{2177}', '\u{2178}', '\u{2179}', '\u{217A}', '\u{217B}', '\u{217C}', '\u{217D}', '\u{217E}', '\u{217F}', '\u{2180}', '\u{2181}', '\u{2182}', '\u{2185}', '\u{2186}', '\u{2187}', '\u{2188}', '\u{3007}', '\u{3021}', '\u{3022}', '\u{3023}', '\u{3024}', '\u{3025}', '\u{3026}', '\u{3027}', '\u{3028}', '\u{3029}', '\u{3038}', '\u{3039}', '\u{303A}') + } + + fn is_unicode_nonspacing_mark(self) -> bool { + match_char_class!(self, + '\u{0300}', '\u{0301}', '\u{0302}', '\u{0303}', '\u{0304}', '\u{0305}', '\u{0306}', '\u{0307}', '\u{0308}', '\u{0309}', '\u{030A}', '\u{030B}', '\u{030C}', '\u{030D}', '\u{030E}', '\u{030F}', '\u{0310}', '\u{0311}', '\u{0312}', '\u{0313}', '\u{0314}', '\u{0315}', '\u{0316}', '\u{0317}', '\u{0318}', '\u{0319}', '\u{031A}', '\u{031B}', '\u{031C}', '\u{031D}', '\u{031E}', '\u{031F}', '\u{0320}', '\u{0321}', '\u{0322}', '\u{0323}', '\u{0324}', '\u{0325}', '\u{0326}', '\u{0327}', '\u{0328}', '\u{0329}', '\u{032A}', '\u{032B}', '\u{032C}', '\u{032D}', '\u{032E}', '\u{032F}', '\u{0330}', '\u{0331}', '\u{0332}', '\u{0333}', '\u{0334}', '\u{0335}', '\u{0336}', '\u{0337}', '\u{0338}', '\u{0339}', '\u{033A}', '\u{033B}', '\u{033C}', '\u{033D}', '\u{033E}', '\u{033F}', '\u{0340}', '\u{0341}', '\u{0342}', '\u{0343}', '\u{0344}', '\u{0345}', '\u{0346}', '\u{0347}', '\u{0348}', '\u{0349}', '\u{034A}', '\u{034B}', '\u{034C}', '\u{034D}', '\u{034E}', '\u{034F}', '\u{0350}', '\u{0351}', '\u{0352}', '\u{0353}', '\u{0354}', '\u{0355}', '\u{0356}', '\u{0357}', '\u{0358}', '\u{0359}', '\u{035A}', '\u{035B}', '\u{035C}', '\u{035D}', '\u{035E}', '\u{035F}', '\u{0360}', '\u{0361}', '\u{0362}', '\u{0363}', '\u{0364}', '\u{0365}', '\u{0366}', '\u{0367}', '\u{0368}', '\u{0369}', '\u{036A}', '\u{036B}', '\u{036C}', '\u{036D}', '\u{036E}', '\u{036F}', '\u{0483}', '\u{0484}', '\u{0485}', '\u{0486}', '\u{0487}', '\u{0591}', '\u{0592}', '\u{0593}', '\u{0594}', '\u{0595}', '\u{0596}', '\u{0597}', '\u{0598}', '\u{0599}', '\u{059A}', '\u{059B}', '\u{059C}', '\u{059D}', '\u{059E}', '\u{059F}', '\u{05A0}', '\u{05A1}', '\u{05A2}', '\u{05A3}', '\u{05A4}', '\u{05A5}', '\u{05A6}', '\u{05A7}', '\u{05A8}', '\u{05A9}', '\u{05AA}', '\u{05AB}', '\u{05AC}', '\u{05AD}', '\u{05AE}', '\u{05AF}', '\u{05B0}', '\u{05B1}', '\u{05B2}', '\u{05B3}', '\u{05B4}', '\u{05B5}', '\u{05B6}', '\u{05B7}', '\u{05B8}', '\u{05B9}', '\u{05BA}', '\u{05BB}', '\u{05BC}', '\u{05BD}', '\u{05BF}', '\u{05C1}', '\u{05C2}', '\u{05C4}', '\u{05C5}', '\u{05C7}', '\u{0610}', '\u{0611}', '\u{0612}', '\u{0613}', '\u{0614}', '\u{0615}', '\u{0616}', '\u{0617}', '\u{0618}', '\u{0619}', '\u{061A}', '\u{064B}', '\u{064C}', '\u{064D}', '\u{064E}', '\u{064F}', '\u{0650}', '\u{0651}', '\u{0652}', '\u{0653}', '\u{0654}', '\u{0655}', '\u{0656}', '\u{0657}', '\u{0658}', '\u{0659}', '\u{065A}', '\u{065B}', '\u{065C}', '\u{065D}', '\u{065E}', '\u{0670}', '\u{06D6}', '\u{06D7}', '\u{06D8}', '\u{06D9}', '\u{06DA}', '\u{06DB}', '\u{06DC}', '\u{06DF}', '\u{06E0}', '\u{06E1}', '\u{06E2}', '\u{06E3}', '\u{06E4}', '\u{06E7}', '\u{06E8}', '\u{06EA}', '\u{06EB}', '\u{06EC}', '\u{06ED}', '\u{0711}', '\u{0730}', '\u{0731}', '\u{0732}', '\u{0733}', '\u{0734}', '\u{0735}', '\u{0736}', '\u{0737}', '\u{0738}', '\u{0739}', '\u{073A}', '\u{073B}', '\u{073C}', '\u{073D}', '\u{073E}', '\u{073F}', '\u{0740}', '\u{0741}', '\u{0742}', '\u{0743}', '\u{0744}', '\u{0745}', '\u{0746}', '\u{0747}', '\u{0748}', '\u{0749}', '\u{074A}', '\u{07A6}', '\u{07A7}', '\u{07A8}', '\u{07A9}', '\u{07AA}', '\u{07AB}', '\u{07AC}', '\u{07AD}', '\u{07AE}', '\u{07AF}', '\u{07B0}', '\u{07EB}', '\u{07EC}', '\u{07ED}', '\u{07EE}', '\u{07EF}', '\u{07F0}', '\u{07F1}', '\u{07F2}', '\u{07F3}', '\u{0901}', '\u{0902}', '\u{093C}', '\u{0941}', '\u{0942}', '\u{0943}', '\u{0944}', '\u{0945}', '\u{0946}', '\u{0947}', '\u{0948}', '\u{094D}', '\u{0951}', '\u{0952}', '\u{0953}', '\u{0954}', '\u{0962}', '\u{0963}', '\u{0981}', '\u{09BC}', '\u{09C1}', '\u{09C2}', '\u{09C3}', '\u{09C4}', '\u{09CD}', '\u{09E2}', '\u{09E3}', '\u{0A01}', '\u{0A02}', '\u{0A3C}', '\u{0A41}', '\u{0A42}', '\u{0A47}', '\u{0A48}', '\u{0A4B}', '\u{0A4C}', '\u{0A4D}', '\u{0A51}', '\u{0A70}', '\u{0A71}', '\u{0A75}', '\u{0A81}', '\u{0A82}', '\u{0ABC}', '\u{0AC1}', '\u{0AC2}', '\u{0AC3}', '\u{0AC4}', '\u{0AC5}', '\u{0AC7}', '\u{0AC8}', '\u{0ACD}', '\u{0AE2}', '\u{0AE3}', '\u{0B01}', '\u{0B3C}', '\u{0B3F}', '\u{0B41}', '\u{0B42}', '\u{0B43}', '\u{0B44}', '\u{0B4D}', '\u{0B56}', '\u{0B62}', '\u{0B63}', '\u{0B82}', '\u{0BC0}', '\u{0BCD}', '\u{0C3E}', '\u{0C3F}', '\u{0C40}', '\u{0C46}', '\u{0C47}', '\u{0C48}', '\u{0C4A}', '\u{0C4B}', '\u{0C4C}', '\u{0C4D}', '\u{0C55}', '\u{0C56}', '\u{0C62}', '\u{0C63}', '\u{0CBC}', '\u{0CBF}', '\u{0CC6}', '\u{0CCC}', '\u{0CCD}', '\u{0CE2}', '\u{0CE3}', '\u{0D41}', '\u{0D42}', '\u{0D43}', '\u{0D44}', '\u{0D4D}', '\u{0D62}', '\u{0D63}', '\u{0DCA}', '\u{0DD2}', '\u{0DD3}', '\u{0DD4}', '\u{0DD6}', '\u{0E31}', '\u{0E34}', '\u{0E35}', '\u{0E36}', '\u{0E37}', '\u{0E38}', '\u{0E39}', '\u{0E3A}', '\u{0E47}', '\u{0E48}', '\u{0E49}', '\u{0E4A}', '\u{0E4B}', '\u{0E4C}', '\u{0E4D}', '\u{0E4E}', '\u{0EB1}', '\u{0EB4}', '\u{0EB5}', '\u{0EB6}', '\u{0EB7}', '\u{0EB8}', '\u{0EB9}', '\u{0EBB}', '\u{0EBC}', '\u{0EC8}', '\u{0EC9}', '\u{0ECA}', '\u{0ECB}', '\u{0ECC}', '\u{0ECD}', '\u{0F18}', '\u{0F19}', '\u{0F35}', '\u{0F37}', '\u{0F39}', '\u{0F71}', '\u{0F72}', '\u{0F73}', '\u{0F74}', '\u{0F75}', '\u{0F76}', '\u{0F77}', '\u{0F78}', '\u{0F79}', '\u{0F7A}', '\u{0F7B}', '\u{0F7C}', '\u{0F7D}', '\u{0F7E}', '\u{0F80}', '\u{0F81}', '\u{0F82}', '\u{0F83}', '\u{0F84}', '\u{0F86}', '\u{0F87}', '\u{0F90}', '\u{0F91}', '\u{0F92}', '\u{0F93}', '\u{0F94}', '\u{0F95}', '\u{0F96}', '\u{0F97}', '\u{0F99}', '\u{0F9A}', '\u{0F9B}', '\u{0F9C}', '\u{0F9D}', '\u{0F9E}', '\u{0F9F}', '\u{0FA0}', '\u{0FA1}', '\u{0FA2}', '\u{0FA3}', '\u{0FA4}', '\u{0FA5}', '\u{0FA6}', '\u{0FA7}', '\u{0FA8}', '\u{0FA9}', '\u{0FAA}', '\u{0FAB}', '\u{0FAC}', '\u{0FAD}', '\u{0FAE}', '\u{0FAF}', '\u{0FB0}', '\u{0FB1}', '\u{0FB2}', '\u{0FB3}', '\u{0FB4}', '\u{0FB5}', '\u{0FB6}', '\u{0FB7}', '\u{0FB8}', '\u{0FB9}', '\u{0FBA}', '\u{0FBB}', '\u{0FBC}', '\u{0FC6}', '\u{102D}', '\u{102E}', '\u{102F}', '\u{1030}', '\u{1032}', '\u{1033}', '\u{1034}', '\u{1035}', '\u{1036}', '\u{1037}', '\u{1039}', '\u{103A}', '\u{103D}', '\u{103E}', '\u{1058}', '\u{1059}', '\u{105E}', '\u{105F}', '\u{1060}', '\u{1071}', '\u{1072}', '\u{1073}', '\u{1074}', '\u{1082}', '\u{1085}', '\u{1086}', '\u{108D}', '\u{135F}', '\u{1712}', '\u{1713}', '\u{1714}', '\u{1732}', '\u{1733}', '\u{1734}', '\u{1752}', '\u{1753}', '\u{1772}', '\u{1773}', '\u{17B7}', '\u{17B8}', '\u{17B9}', '\u{17BA}', '\u{17BB}', '\u{17BC}', '\u{17BD}', '\u{17C6}', '\u{17C9}', '\u{17CA}', '\u{17CB}', '\u{17CC}', '\u{17CD}', '\u{17CE}', '\u{17CF}', '\u{17D0}', '\u{17D1}', '\u{17D2}', '\u{17D3}', '\u{17DD}', '\u{180B}', '\u{180C}', '\u{180D}', '\u{18A9}', '\u{1920}', '\u{1921}', '\u{1922}', '\u{1927}', '\u{1928}', '\u{1932}', '\u{1939}', '\u{193A}', '\u{193B}', '\u{1A17}', '\u{1A18}', '\u{1B00}', '\u{1B01}', '\u{1B02}', '\u{1B03}', '\u{1B34}', '\u{1B36}', '\u{1B37}', '\u{1B38}', '\u{1B39}', '\u{1B3A}', '\u{1B3C}', '\u{1B42}', '\u{1B6B}', '\u{1B6C}', '\u{1B6D}', '\u{1B6E}', '\u{1B6F}', '\u{1B70}', '\u{1B71}', '\u{1B72}', '\u{1B73}', '\u{1B80}', '\u{1B81}', '\u{1BA2}', '\u{1BA3}', '\u{1BA4}', '\u{1BA5}', '\u{1BA8}', '\u{1BA9}', '\u{1C2C}', '\u{1C2D}', '\u{1C2E}', '\u{1C2F}', '\u{1C30}', '\u{1C31}', '\u{1C32}', '\u{1C33}', '\u{1C36}', '\u{1C37}', '\u{1DC0}', '\u{1DC1}', '\u{1DC2}', '\u{1DC3}', '\u{1DC4}', '\u{1DC5}', '\u{1DC6}', '\u{1DC7}', '\u{1DC8}', '\u{1DC9}', '\u{1DCA}', '\u{1DCB}', '\u{1DCC}', '\u{1DCD}', '\u{1DCE}', '\u{1DCF}', '\u{1DD0}', '\u{1DD1}', '\u{1DD2}', '\u{1DD3}', '\u{1DD4}', '\u{1DD5}', '\u{1DD6}', '\u{1DD7}', '\u{1DD8}', '\u{1DD9}', '\u{1DDA}', '\u{1DDB}', '\u{1DDC}', '\u{1DDD}', '\u{1DDE}', '\u{1DDF}', '\u{1DE0}', '\u{1DE1}', '\u{1DE2}', '\u{1DE3}', '\u{1DE4}', '\u{1DE5}', '\u{1DE6}', '\u{1DFE}', '\u{1DFF}', '\u{20D0}', '\u{20D1}', '\u{20D2}', '\u{20D3}', '\u{20D4}', '\u{20D5}', '\u{20D6}', '\u{20D7}', '\u{20D8}', '\u{20D9}', '\u{20DA}', '\u{20DB}', '\u{20DC}', '\u{20E1}', '\u{20E5}', '\u{20E6}', '\u{20E7}', '\u{20E8}', '\u{20E9}', '\u{20EA}', '\u{20EB}', '\u{20EC}', '\u{20ED}', '\u{20EE}', '\u{20EF}', '\u{20F0}', '\u{2DE0}', '\u{2DE1}', '\u{2DE2}', '\u{2DE3}', '\u{2DE4}', '\u{2DE5}', '\u{2DE6}', '\u{2DE7}', '\u{2DE8}', '\u{2DE9}', '\u{2DEA}', '\u{2DEB}', '\u{2DEC}', '\u{2DED}', '\u{2DEE}', '\u{2DEF}', '\u{2DF0}', '\u{2DF1}', '\u{2DF2}', '\u{2DF3}', '\u{2DF4}', '\u{2DF5}', '\u{2DF6}', '\u{2DF7}', '\u{2DF8}', '\u{2DF9}', '\u{2DFA}', '\u{2DFB}', '\u{2DFC}', '\u{2DFD}', '\u{2DFE}', '\u{2DFF}', '\u{302A}', '\u{302B}', '\u{302C}', '\u{302D}', '\u{302E}', '\u{302F}', '\u{3099}', '\u{309A}', '\u{A66F}', '\u{A67C}', '\u{A67D}', '\u{A802}', '\u{A806}', '\u{A80B}', '\u{A825}', '\u{A826}', '\u{A8C4}', '\u{A926}', '\u{A927}', '\u{A928}', '\u{A929}', '\u{A92A}', '\u{A92B}', '\u{A92C}', '\u{A92D}', '\u{A947}', '\u{A948}', '\u{A949}', '\u{A94A}', '\u{A94B}', '\u{A94C}', '\u{A94D}', '\u{A94E}', '\u{A94F}', '\u{A950}', '\u{A951}', '\u{AA29}', '\u{AA2A}', '\u{AA2B}', '\u{AA2C}', '\u{AA2D}', '\u{AA2E}', '\u{AA31}', '\u{AA32}', '\u{AA35}', '\u{AA36}', '\u{AA43}', '\u{AA4C}', '\u{FB1E}', '\u{FE00}', '\u{FE01}', '\u{FE02}', '\u{FE03}', '\u{FE04}', '\u{FE05}', '\u{FE06}', '\u{FE07}', '\u{FE08}', '\u{FE09}', '\u{FE0A}', '\u{FE0B}', '\u{FE0C}', '\u{FE0D}', '\u{FE0E}', '\u{FE0F}', '\u{FE20}', '\u{FE21}', '\u{FE22}', '\u{FE23}', '\u{FE24}', '\u{FE25}', '\u{FE26}', '\u{01BB}', '\u{01C0}', '\u{01C1}', '\u{01C2}', '\u{01C3}', '\u{0294}', '\u{05D0}', '\u{05D1}', '\u{05D2}', '\u{05D3}', '\u{05D4}', '\u{05D5}', '\u{05D6}', '\u{05D7}', '\u{05D8}', '\u{05D9}', '\u{05DA}', '\u{05DB}', '\u{05DC}', '\u{05DD}', '\u{05DE}', '\u{05DF}', '\u{05E0}', '\u{05E1}', '\u{05E2}', '\u{05E3}', '\u{05E4}', '\u{05E5}', '\u{05E6}', '\u{05E7}', '\u{05E8}', '\u{05E9}', '\u{05EA}', '\u{05F0}', '\u{05F1}', '\u{05F2}', '\u{0621}', '\u{0622}', '\u{0623}', '\u{0624}', '\u{0625}', '\u{0626}', '\u{0627}', '\u{0628}', '\u{0629}', '\u{062A}', '\u{062B}', '\u{062C}', '\u{062D}', '\u{062E}', '\u{062F}', '\u{0630}', '\u{0631}', '\u{0632}', '\u{0633}', '\u{0634}', '\u{0635}', '\u{0636}', '\u{0637}', '\u{0638}', '\u{0639}', '\u{063A}', '\u{063B}', '\u{063C}', '\u{063D}', '\u{063E}', '\u{063F}', '\u{0641}', '\u{0642}', '\u{0643}', '\u{0644}', '\u{0645}', '\u{0646}', '\u{0647}', '\u{0648}', '\u{0649}', '\u{064A}', '\u{066E}', '\u{066F}', '\u{0671}', '\u{0672}', '\u{0673}', '\u{0674}', '\u{0675}', '\u{0676}', '\u{0677}', '\u{0678}', '\u{0679}', '\u{067A}', '\u{067B}', '\u{067C}', '\u{067D}', '\u{067E}', '\u{067F}', '\u{0680}', '\u{0681}', '\u{0682}', '\u{0683}', '\u{0684}', '\u{0685}', '\u{0686}', '\u{0687}', '\u{0688}', '\u{0689}', '\u{068A}', '\u{068B}', '\u{068C}', '\u{068D}', '\u{068E}', '\u{068F}', '\u{0690}', '\u{0691}', '\u{0692}', '\u{0693}', '\u{0694}', '\u{0695}', '\u{0696}', '\u{0697}', '\u{0698}', '\u{0699}', '\u{069A}', '\u{069B}', '\u{069C}', '\u{069D}', '\u{069E}', '\u{069F}', '\u{06A0}', '\u{06A1}', '\u{06A2}', '\u{06A3}', '\u{06A4}', '\u{06A5}', '\u{06A6}', '\u{06A7}', '\u{06A8}', '\u{06A9}', '\u{06AA}', '\u{06AB}', '\u{06AC}', '\u{06AD}', '\u{06AE}', '\u{06AF}', '\u{06B0}', '\u{06B1}', '\u{06B2}', '\u{06B3}', '\u{06B4}', '\u{06B5}', '\u{06B6}', '\u{06B7}', '\u{06B8}', '\u{06B9}', '\u{06BA}', '\u{06BB}', '\u{06BC}', '\u{06BD}', '\u{06BE}', '\u{06BF}', '\u{06C0}', '\u{06C1}', '\u{06C2}', '\u{06C3}', '\u{06C4}', '\u{06C5}', '\u{06C6}', '\u{06C7}', '\u{06C8}', '\u{06C9}', '\u{06CA}', '\u{06CB}', '\u{06CC}', '\u{06CD}', '\u{06CE}', '\u{06CF}', '\u{06D0}', '\u{06D1}', '\u{06D2}', '\u{06D3}', '\u{06D5}', '\u{06EE}', '\u{06EF}', '\u{06FA}', '\u{06FB}', '\u{06FC}', '\u{06FF}', '\u{0710}', '\u{0712}', '\u{0713}', '\u{0714}', '\u{0715}', '\u{0716}', '\u{0717}', '\u{0718}', '\u{0719}', '\u{071A}', '\u{071B}', '\u{071C}', '\u{071D}', '\u{071E}', '\u{071F}', '\u{0720}', '\u{0721}', '\u{0722}', '\u{0723}', '\u{0724}', '\u{0725}', '\u{0726}', '\u{0727}', '\u{0728}', '\u{0729}', '\u{072A}', '\u{072B}', '\u{072C}', '\u{072D}', '\u{072E}', '\u{072F}', '\u{074D}', '\u{074E}', '\u{074F}', '\u{0750}', '\u{0751}', '\u{0752}', '\u{0753}', '\u{0754}', '\u{0755}', '\u{0756}', '\u{0757}', '\u{0758}', '\u{0759}', '\u{075A}', '\u{075B}', '\u{075C}', '\u{075D}', '\u{075E}', '\u{075F}', '\u{0760}', '\u{0761}', '\u{0762}', '\u{0763}', '\u{0764}', '\u{0765}', '\u{0766}', '\u{0767}', '\u{0768}', '\u{0769}', '\u{076A}', '\u{076B}', '\u{076C}', '\u{076D}', '\u{076E}', '\u{076F}', '\u{0770}', '\u{0771}', '\u{0772}', '\u{0773}', '\u{0774}', '\u{0775}', '\u{0776}', '\u{0777}', '\u{0778}', '\u{0779}', '\u{077A}', '\u{077B}', '\u{077C}', '\u{077D}', '\u{077E}', '\u{077F}', '\u{0780}', '\u{0781}', '\u{0782}', '\u{0783}', '\u{0784}', '\u{0785}', '\u{0786}', '\u{0787}', '\u{0788}', '\u{0789}', '\u{078A}', '\u{078B}', '\u{078C}', '\u{078D}', '\u{078E}', '\u{078F}', '\u{0790}', '\u{0791}', '\u{0792}', '\u{0793}', '\u{0794}', '\u{0795}', '\u{0796}', '\u{0797}', '\u{0798}', '\u{0799}', '\u{079A}', '\u{079B}', '\u{079C}', '\u{079D}', '\u{079E}', '\u{079F}', '\u{07A0}', '\u{07A1}', '\u{07A2}', '\u{07A3}', '\u{07A4}', '\u{07A5}', '\u{07B1}', '\u{07CA}', '\u{07CB}', '\u{07CC}', '\u{07CD}', '\u{07CE}', '\u{07CF}', '\u{07D0}', '\u{07D1}', '\u{07D2}', '\u{07D3}', '\u{07D4}', '\u{07D5}', '\u{07D6}', '\u{07D7}', '\u{07D8}', '\u{07D9}', '\u{07DA}', '\u{07DB}', '\u{07DC}', '\u{07DD}', '\u{07DE}', '\u{07DF}', '\u{07E0}', '\u{07E1}', '\u{07E2}', '\u{07E3}', '\u{07E4}', '\u{07E5}', '\u{07E6}', '\u{07E7}', '\u{07E8}', '\u{07E9}', '\u{07EA}', '\u{0904}', '\u{0905}', '\u{0906}', '\u{0907}', '\u{0908}', '\u{0909}', '\u{090A}', '\u{090B}', '\u{090C}', '\u{090D}', '\u{090E}', '\u{090F}', '\u{0910}', '\u{0911}', '\u{0912}', '\u{0913}', '\u{0914}', '\u{0915}', '\u{0916}', '\u{0917}', '\u{0918}', '\u{0919}', '\u{091A}', '\u{091B}', '\u{091C}', '\u{091D}', '\u{091E}', '\u{091F}', '\u{0920}', '\u{0921}', '\u{0922}', '\u{0923}', '\u{0924}', '\u{0925}', '\u{0926}', '\u{0927}', '\u{0928}', '\u{0929}', '\u{092A}', '\u{092B}', '\u{092C}', '\u{092D}', '\u{092E}', '\u{092F}', '\u{0930}', '\u{0931}', '\u{0932}', '\u{0933}', '\u{0934}', '\u{0935}', '\u{0936}', '\u{0937}', '\u{0938}', '\u{0939}', '\u{093D}', '\u{0950}', '\u{0958}', '\u{0959}', '\u{095A}', '\u{095B}', '\u{095C}', '\u{095D}', '\u{095E}', '\u{095F}', '\u{0960}', '\u{0961}', '\u{0972}', '\u{097B}', '\u{097C}', '\u{097D}', '\u{097E}', '\u{097F}', '\u{0985}', '\u{0986}', '\u{0987}', '\u{0988}', '\u{0989}', '\u{098A}', '\u{098B}', '\u{098C}', '\u{098F}', '\u{0990}', '\u{0993}', '\u{0994}', '\u{0995}', '\u{0996}', '\u{0997}', '\u{0998}', '\u{0999}', '\u{099A}', '\u{099B}', '\u{099C}', '\u{099D}', '\u{099E}', '\u{099F}', '\u{09A0}', '\u{09A1}', '\u{09A2}', '\u{09A3}', '\u{09A4}', '\u{09A5}', '\u{09A6}', '\u{09A7}', '\u{09A8}', '\u{09AA}', '\u{09AB}', '\u{09AC}', '\u{09AD}', '\u{09AE}', '\u{09AF}', '\u{09B0}', '\u{09B2}', '\u{09B6}', '\u{09B7}', '\u{09B8}', '\u{09B9}', '\u{09BD}', '\u{09CE}', '\u{09DC}', '\u{09DD}', '\u{09DF}', '\u{09E0}', '\u{09E1}', '\u{09F0}', '\u{09F1}', '\u{0A05}', '\u{0A06}', '\u{0A07}', '\u{0A08}', '\u{0A09}', '\u{0A0A}', '\u{0A0F}', '\u{0A10}', '\u{0A13}', '\u{0A14}', '\u{0A15}', '\u{0A16}', '\u{0A17}', '\u{0A18}', '\u{0A19}', '\u{0A1A}', '\u{0A1B}', '\u{0A1C}', '\u{0A1D}', '\u{0A1E}', '\u{0A1F}', '\u{0A20}', '\u{0A21}', '\u{0A22}', '\u{0A23}', '\u{0A24}', '\u{0A25}', '\u{0A26}', '\u{0A27}', '\u{0A28}', '\u{0A2A}', '\u{0A2B}', '\u{0A2C}', '\u{0A2D}', '\u{0A2E}', '\u{0A2F}', '\u{0A30}', '\u{0A32}', '\u{0A33}', '\u{0A35}', '\u{0A36}', '\u{0A38}', '\u{0A39}', '\u{0A59}', '\u{0A5A}', '\u{0A5B}', '\u{0A5C}', '\u{0A5E}', '\u{0A72}', '\u{0A73}', '\u{0A74}', '\u{0A85}', '\u{0A86}', '\u{0A87}', '\u{0A88}', '\u{0A89}', '\u{0A8A}', '\u{0A8B}', '\u{0A8C}', '\u{0A8D}', '\u{0A8F}', '\u{0A90}', '\u{0A91}', '\u{0A93}', '\u{0A94}', '\u{0A95}', '\u{0A96}', '\u{0A97}', '\u{0A98}', '\u{0A99}', '\u{0A9A}', '\u{0A9B}', '\u{0A9C}', '\u{0A9D}', '\u{0A9E}', '\u{0A9F}', '\u{0AA0}', '\u{0AA1}', '\u{0AA2}', '\u{0AA3}', '\u{0AA4}', '\u{0AA5}', '\u{0AA6}', '\u{0AA7}', '\u{0AA8}', '\u{0AAA}', '\u{0AAB}', '\u{0AAC}', '\u{0AAD}', '\u{0AAE}', '\u{0AAF}', '\u{0AB0}', '\u{0AB2}', '\u{0AB3}', '\u{0AB5}', '\u{0AB6}', '\u{0AB7}', '\u{0AB8}', '\u{0AB9}', '\u{0ABD}', '\u{0AD0}', '\u{0AE0}', '\u{0AE1}', '\u{0B05}', '\u{0B06}', '\u{0B07}', '\u{0B08}', '\u{0B09}', '\u{0B0A}', '\u{0B0B}', '\u{0B0C}', '\u{0B0F}', '\u{0B10}', '\u{0B13}', '\u{0B14}', '\u{0B15}', '\u{0B16}', '\u{0B17}', '\u{0B18}', '\u{0B19}', '\u{0B1A}', '\u{0B1B}', '\u{0B1C}', '\u{0B1D}', '\u{0B1E}', '\u{0B1F}', '\u{0B20}', '\u{0B21}', '\u{0B22}', '\u{0B23}', '\u{0B24}', '\u{0B25}', '\u{0B26}', '\u{0B27}', '\u{0B28}', '\u{0B2A}', '\u{0B2B}', '\u{0B2C}', '\u{0B2D}', '\u{0B2E}', '\u{0B2F}', '\u{0B30}', '\u{0B32}', '\u{0B33}', '\u{0B35}', '\u{0B36}', '\u{0B37}', '\u{0B38}', '\u{0B39}', '\u{0B3D}', '\u{0B5C}', '\u{0B5D}', '\u{0B5F}', '\u{0B60}', '\u{0B61}', '\u{0B71}', '\u{0B83}', '\u{0B85}', '\u{0B86}', '\u{0B87}', '\u{0B88}', '\u{0B89}', '\u{0B8A}', '\u{0B8E}', '\u{0B8F}', '\u{0B90}', '\u{0B92}', '\u{0B93}', '\u{0B94}', '\u{0B95}', '\u{0B99}', '\u{0B9A}', '\u{0B9C}', '\u{0B9E}', '\u{0B9F}', '\u{0BA3}', '\u{0BA4}', '\u{0BA8}', '\u{0BA9}', '\u{0BAA}', '\u{0BAE}', '\u{0BAF}', '\u{0BB0}', '\u{0BB1}', '\u{0BB2}', '\u{0BB3}', '\u{0BB4}', '\u{0BB5}', '\u{0BB6}', '\u{0BB7}', '\u{0BB8}', '\u{0BB9}', '\u{0BD0}', '\u{0C05}', '\u{0C06}', '\u{0C07}', '\u{0C08}', '\u{0C09}', '\u{0C0A}', '\u{0C0B}', '\u{0C0C}', '\u{0C0E}', '\u{0C0F}', '\u{0C10}', '\u{0C12}', '\u{0C13}', '\u{0C14}', '\u{0C15}', '\u{0C16}', '\u{0C17}', '\u{0C18}', '\u{0C19}', '\u{0C1A}', '\u{0C1B}', '\u{0C1C}', '\u{0C1D}', '\u{0C1E}', '\u{0C1F}', '\u{0C20}', '\u{0C21}', '\u{0C22}', '\u{0C23}', '\u{0C24}', '\u{0C25}', '\u{0C26}', '\u{0C27}', '\u{0C28}', '\u{0C2A}', '\u{0C2B}', '\u{0C2C}', '\u{0C2D}', '\u{0C2E}', '\u{0C2F}', '\u{0C30}', '\u{0C31}', '\u{0C32}', '\u{0C33}', '\u{0C35}', '\u{0C36}', '\u{0C37}', '\u{0C38}', '\u{0C39}', '\u{0C3D}', '\u{0C58}', '\u{0C59}', '\u{0C60}', '\u{0C61}', '\u{0C85}', '\u{0C86}', '\u{0C87}', '\u{0C88}', '\u{0C89}', '\u{0C8A}', '\u{0C8B}', '\u{0C8C}', '\u{0C8E}', '\u{0C8F}', '\u{0C90}', '\u{0C92}', '\u{0C93}', '\u{0C94}', '\u{0C95}', '\u{0C96}', '\u{0C97}', '\u{0C98}', '\u{0C99}', '\u{0C9A}', '\u{0C9B}', '\u{0C9C}', '\u{0C9D}', '\u{0C9E}', '\u{0C9F}', '\u{0CA0}', '\u{0CA1}', '\u{0CA2}', '\u{0CA3}', '\u{0CA4}', '\u{0CA5}', '\u{0CA6}', '\u{0CA7}', '\u{0CA8}', '\u{0CAA}', '\u{0CAB}', '\u{0CAC}', '\u{0CAD}', '\u{0CAE}', '\u{0CAF}', '\u{0CB0}', '\u{0CB1}', '\u{0CB2}', '\u{0CB3}', '\u{0CB5}', '\u{0CB6}', '\u{0CB7}', '\u{0CB8}', '\u{0CB9}', '\u{0CBD}', '\u{0CDE}', '\u{0CE0}', '\u{0CE1}', '\u{0D05}', '\u{0D06}', '\u{0D07}', '\u{0D08}', '\u{0D09}', '\u{0D0A}', '\u{0D0B}', '\u{0D0C}', '\u{0D0E}', '\u{0D0F}', '\u{0D10}', '\u{0D12}', '\u{0D13}', '\u{0D14}', '\u{0D15}', '\u{0D16}', '\u{0D17}', '\u{0D18}', '\u{0D19}', '\u{0D1A}', '\u{0D1B}', '\u{0D1C}', '\u{0D1D}', '\u{0D1E}', '\u{0D1F}', '\u{0D20}', '\u{0D21}', '\u{0D22}', '\u{0D23}', '\u{0D24}', '\u{0D25}', '\u{0D26}', '\u{0D27}', '\u{0D28}', '\u{0D2A}', '\u{0D2B}', '\u{0D2C}', '\u{0D2D}', '\u{0D2E}', '\u{0D2F}', '\u{0D30}', '\u{0D31}', '\u{0D32}', '\u{0D33}', '\u{0D34}', '\u{0D35}', '\u{0D36}', '\u{0D37}', '\u{0D38}', '\u{0D39}', '\u{0D3D}', '\u{0D60}', '\u{0D61}', '\u{0D7A}', '\u{0D7B}', '\u{0D7C}', '\u{0D7D}', '\u{0D7E}', '\u{0D7F}', '\u{0D85}', '\u{0D86}', '\u{0D87}', '\u{0D88}', '\u{0D89}', '\u{0D8A}', '\u{0D8B}', '\u{0D8C}', '\u{0D8D}', '\u{0D8E}', '\u{0D8F}', '\u{0D90}', '\u{0D91}', '\u{0D92}', '\u{0D93}', '\u{0D94}', '\u{0D95}', '\u{0D96}', '\u{0D9A}', '\u{0D9B}', '\u{0D9C}', '\u{0D9D}', '\u{0D9E}', '\u{0D9F}', '\u{0DA0}', '\u{0DA1}', '\u{0DA2}', '\u{0DA3}', '\u{0DA4}', '\u{0DA5}', '\u{0DA6}', '\u{0DA7}', '\u{0DA8}', '\u{0DA9}', '\u{0DAA}', '\u{0DAB}', '\u{0DAC}', '\u{0DAD}', '\u{0DAE}', '\u{0DAF}', '\u{0DB0}', '\u{0DB1}', '\u{0DB3}', '\u{0DB4}', '\u{0DB5}', '\u{0DB6}', '\u{0DB7}', '\u{0DB8}', '\u{0DB9}', '\u{0DBA}', '\u{0DBB}', '\u{0DBD}', '\u{0DC0}', '\u{0DC1}', '\u{0DC2}', '\u{0DC3}', '\u{0DC4}', '\u{0DC5}', '\u{0DC6}', '\u{0E01}', '\u{0E02}', '\u{0E03}', '\u{0E04}', '\u{0E05}', '\u{0E06}', '\u{0E07}', '\u{0E08}', '\u{0E09}', '\u{0E0A}', '\u{0E0B}', '\u{0E0C}', '\u{0E0D}', '\u{0E0E}', '\u{0E0F}', '\u{0E10}', '\u{0E11}', '\u{0E12}', '\u{0E13}', '\u{0E14}', '\u{0E15}', '\u{0E16}', '\u{0E17}', '\u{0E18}', '\u{0E19}', '\u{0E1A}', '\u{0E1B}', '\u{0E1C}', '\u{0E1D}', '\u{0E1E}', '\u{0E1F}', '\u{0E20}', '\u{0E21}', '\u{0E22}', '\u{0E23}', '\u{0E24}', '\u{0E25}', '\u{0E26}', '\u{0E27}', '\u{0E28}', '\u{0E29}', '\u{0E2A}', '\u{0E2B}', '\u{0E2C}', '\u{0E2D}', '\u{0E2E}', '\u{0E2F}', '\u{0E30}', '\u{0E32}', '\u{0E33}', '\u{0E40}', '\u{0E41}', '\u{0E42}', '\u{0E43}', '\u{0E44}', '\u{0E45}', '\u{0E81}', '\u{0E82}', '\u{0E84}', '\u{0E87}', '\u{0E88}', '\u{0E8A}', '\u{0E8D}', '\u{0E94}', '\u{0E95}', '\u{0E96}', '\u{0E97}', '\u{0E99}', '\u{0E9A}', '\u{0E9B}', '\u{0E9C}', '\u{0E9D}', '\u{0E9E}', '\u{0E9F}', '\u{0EA1}', '\u{0EA2}', '\u{0EA3}', '\u{0EA5}', '\u{0EA7}', '\u{0EAA}', '\u{0EAB}', '\u{0EAD}', '\u{0EAE}', '\u{0EAF}', '\u{0EB0}', '\u{0EB2}', '\u{0EB3}', '\u{0EBD}', '\u{0EC0}', '\u{0EC1}', '\u{0EC2}', '\u{0EC3}', '\u{0EC4}', '\u{0EDC}', '\u{0EDD}', '\u{0F00}', '\u{0F40}', '\u{0F41}', '\u{0F42}', '\u{0F43}', '\u{0F44}', '\u{0F45}', '\u{0F46}', '\u{0F47}', '\u{0F49}', '\u{0F4A}', '\u{0F4B}', '\u{0F4C}', '\u{0F4D}', '\u{0F4E}', '\u{0F4F}', '\u{0F50}', '\u{0F51}', '\u{0F52}', '\u{0F53}', '\u{0F54}', '\u{0F55}', '\u{0F56}', '\u{0F57}', '\u{0F58}', '\u{0F59}', '\u{0F5A}', '\u{0F5B}', '\u{0F5C}', '\u{0F5D}', '\u{0F5E}', '\u{0F5F}', '\u{0F60}', '\u{0F61}', '\u{0F62}', '\u{0F63}', '\u{0F64}', '\u{0F65}', '\u{0F66}', '\u{0F67}', '\u{0F68}', '\u{0F69}', '\u{0F6A}', '\u{0F6B}', '\u{0F6C}', '\u{0F88}', '\u{0F89}', '\u{0F8A}', '\u{0F8B}', '\u{1000}', '\u{1001}', '\u{1002}', '\u{1003}', '\u{1004}', '\u{1005}', '\u{1006}', '\u{1007}', '\u{1008}', '\u{1009}', '\u{100A}', '\u{100B}', '\u{100C}', '\u{100D}', '\u{100E}', '\u{100F}', '\u{1010}', '\u{1011}', '\u{1012}', '\u{1013}', '\u{1014}', '\u{1015}', '\u{1016}', '\u{1017}', '\u{1018}', '\u{1019}', '\u{101A}', '\u{101B}', '\u{101C}', '\u{101D}', '\u{101E}', '\u{101F}', '\u{1020}', '\u{1021}', '\u{1022}', '\u{1023}', '\u{1024}', '\u{1025}', '\u{1026}', '\u{1027}', '\u{1028}', '\u{1029}', '\u{102A}', '\u{103F}', '\u{1050}', '\u{1051}', '\u{1052}', '\u{1053}', '\u{1054}', '\u{1055}', '\u{105A}', '\u{105B}', '\u{105C}', '\u{105D}', '\u{1061}', '\u{1065}', '\u{1066}', '\u{106E}', '\u{106F}', '\u{1070}', '\u{1075}', '\u{1076}', '\u{1077}', '\u{1078}', '\u{1079}', '\u{107A}', '\u{107B}', '\u{107C}', '\u{107D}', '\u{107E}', '\u{107F}', '\u{1080}', '\u{1081}', '\u{108E}', '\u{10D0}', '\u{10D1}', '\u{10D2}', '\u{10D3}', '\u{10D4}', '\u{10D5}', '\u{10D6}', '\u{10D7}', '\u{10D8}', '\u{10D9}', '\u{10DA}', '\u{10DB}', '\u{10DC}', '\u{10DD}', '\u{10DE}', '\u{10DF}', '\u{10E0}', '\u{10E1}', '\u{10E2}', '\u{10E3}', '\u{10E4}', '\u{10E5}', '\u{10E6}', '\u{10E7}', '\u{10E8}', '\u{10E9}', '\u{10EA}', '\u{10EB}', '\u{10EC}', '\u{10ED}', '\u{10EE}', '\u{10EF}', '\u{10F0}', '\u{10F1}', '\u{10F2}', '\u{10F3}', '\u{10F4}', '\u{10F5}', '\u{10F6}', '\u{10F7}', '\u{10F8}', '\u{10F9}', '\u{10FA}', '\u{1100}', '\u{1101}', '\u{1102}', '\u{1103}', '\u{1104}', '\u{1105}', '\u{1106}', '\u{1107}', '\u{1108}', '\u{1109}', '\u{110A}', '\u{110B}', '\u{110C}', '\u{110D}', '\u{110E}', '\u{110F}', '\u{1110}', '\u{1111}', '\u{1112}', '\u{1113}', '\u{1114}', '\u{1115}', '\u{1116}', '\u{1117}', '\u{1118}', '\u{1119}', '\u{111A}', '\u{111B}', '\u{111C}', '\u{111D}', '\u{111E}', '\u{111F}', '\u{1120}', '\u{1121}', '\u{1122}', '\u{1123}', '\u{1124}', '\u{1125}', '\u{1126}', '\u{1127}', '\u{1128}', '\u{1129}', '\u{112A}', '\u{112B}', '\u{112C}', '\u{112D}', '\u{112E}', '\u{112F}', '\u{1130}', '\u{1131}', '\u{1132}', '\u{1133}', '\u{1134}', '\u{1135}', '\u{1136}', '\u{1137}', '\u{1138}', '\u{1139}', '\u{113A}', '\u{113B}', '\u{113C}', '\u{113D}', '\u{113E}', '\u{113F}', '\u{1140}', '\u{1141}', '\u{1142}', '\u{1143}', '\u{1144}', '\u{1145}', '\u{1146}', '\u{1147}', '\u{1148}', '\u{1149}', '\u{114A}', '\u{114B}', '\u{114C}', '\u{114D}', '\u{114E}', '\u{114F}', '\u{1150}', '\u{1151}', '\u{1152}', '\u{1153}', '\u{1154}', '\u{1155}', '\u{1156}', '\u{1157}', '\u{1158}', '\u{1159}', '\u{115F}', '\u{1160}', '\u{1161}', '\u{1162}', '\u{1163}', '\u{1164}', '\u{1165}', '\u{1166}', '\u{1167}', '\u{1168}', '\u{1169}', '\u{116A}', '\u{116B}', '\u{116C}', '\u{116D}', '\u{116E}', '\u{116F}', '\u{1170}', '\u{1171}', '\u{1172}', '\u{1173}', '\u{1174}', '\u{1175}', '\u{1176}', '\u{1177}', '\u{1178}', '\u{1179}', '\u{117A}', '\u{117B}', '\u{117C}', '\u{117D}', '\u{117E}', '\u{117F}', '\u{1180}', '\u{1181}', '\u{1182}', '\u{1183}', '\u{1184}', '\u{1185}', '\u{1186}', '\u{1187}', '\u{1188}', '\u{1189}', '\u{118A}', '\u{118B}', '\u{118C}', '\u{118D}', '\u{118E}', '\u{118F}', '\u{1190}', '\u{1191}', '\u{1192}', '\u{1193}', '\u{1194}', '\u{1195}', '\u{1196}', '\u{1197}', '\u{1198}', '\u{1199}', '\u{119A}', '\u{119B}', '\u{119C}', '\u{119D}', '\u{119E}', '\u{119F}', '\u{11A0}', '\u{11A1}', '\u{11A2}', '\u{11A8}', '\u{11A9}', '\u{11AA}', '\u{11AB}', '\u{11AC}', '\u{11AD}', '\u{11AE}', '\u{11AF}', '\u{11B0}', '\u{11B1}', '\u{11B2}', '\u{11B3}', '\u{11B4}', '\u{11B5}', '\u{11B6}', '\u{11B7}', '\u{11B8}', '\u{11B9}', '\u{11BA}', '\u{11BB}', '\u{11BC}', '\u{11BD}', '\u{11BE}', '\u{11BF}', '\u{11C0}', '\u{11C1}', '\u{11C2}', '\u{11C3}', '\u{11C4}', '\u{11C5}', '\u{11C6}', '\u{11C7}', '\u{11C8}', '\u{11C9}', '\u{11CA}', '\u{11CB}', '\u{11CC}', '\u{11CD}', '\u{11CE}', '\u{11CF}', '\u{11D0}', '\u{11D1}', '\u{11D2}', '\u{11D3}', '\u{11D4}', '\u{11D5}', '\u{11D6}', '\u{11D7}', '\u{11D8}', '\u{11D9}', '\u{11DA}', '\u{11DB}', '\u{11DC}', '\u{11DD}', '\u{11DE}', '\u{11DF}', '\u{11E0}', '\u{11E1}', '\u{11E2}', '\u{11E3}', '\u{11E4}', '\u{11E5}', '\u{11E6}', '\u{11E7}', '\u{11E8}', '\u{11E9}', '\u{11EA}', '\u{11EB}', '\u{11EC}', '\u{11ED}', '\u{11EE}', '\u{11EF}', '\u{11F0}', '\u{11F1}', '\u{11F2}', '\u{11F3}', '\u{11F4}', '\u{11F5}', '\u{11F6}', '\u{11F7}', '\u{11F8}', '\u{11F9}', '\u{1200}', '\u{1201}', '\u{1202}', '\u{1203}', '\u{1204}', '\u{1205}', '\u{1206}', '\u{1207}', '\u{1208}', '\u{1209}', '\u{120A}', '\u{120B}', '\u{120C}', '\u{120D}', '\u{120E}', '\u{120F}', '\u{1210}', '\u{1211}', '\u{1212}', '\u{1213}', '\u{1214}', '\u{1215}', '\u{1216}', '\u{1217}', '\u{1218}', '\u{1219}', '\u{121A}', '\u{121B}', '\u{121C}', '\u{121D}', '\u{121E}', '\u{121F}', '\u{1220}', '\u{1221}', '\u{1222}', '\u{1223}', '\u{1224}', '\u{1225}', '\u{1226}', '\u{1227}', '\u{1228}', '\u{1229}', '\u{122A}', '\u{122B}', '\u{122C}', '\u{122D}', '\u{122E}', '\u{122F}', '\u{1230}', '\u{1231}', '\u{1232}', '\u{1233}', '\u{1234}', '\u{1235}', '\u{1236}', '\u{1237}', '\u{1238}', '\u{1239}', '\u{123A}', '\u{123B}', '\u{123C}', '\u{123D}', '\u{123E}', '\u{123F}', '\u{1240}', '\u{1241}', '\u{1242}', '\u{1243}', '\u{1244}', '\u{1245}', '\u{1246}', '\u{1247}', '\u{1248}', '\u{124A}', '\u{124B}', '\u{124C}', '\u{124D}', '\u{1250}', '\u{1251}', '\u{1252}', '\u{1253}', '\u{1254}', '\u{1255}', '\u{1256}', '\u{1258}', '\u{125A}', '\u{125B}', '\u{125C}', '\u{125D}', '\u{1260}', '\u{1261}', '\u{1262}', '\u{1263}', '\u{1264}', '\u{1265}', '\u{1266}', '\u{1267}', '\u{1268}', '\u{1269}', '\u{126A}', '\u{126B}', '\u{126C}', '\u{126D}', '\u{126E}', '\u{126F}', '\u{1270}', '\u{1271}', '\u{1272}', '\u{1273}', '\u{1274}', '\u{1275}', '\u{1276}', '\u{1277}', '\u{1278}', '\u{1279}', '\u{127A}', '\u{127B}', '\u{127C}', '\u{127D}', '\u{127E}', '\u{127F}', '\u{1280}', '\u{1281}', '\u{1282}', '\u{1283}', '\u{1284}', '\u{1285}', '\u{1286}', '\u{1287}', '\u{1288}', '\u{128A}', '\u{128B}', '\u{128C}', '\u{128D}', '\u{1290}', '\u{1291}', '\u{1292}', '\u{1293}', '\u{1294}', '\u{1295}', '\u{1296}', '\u{1297}', '\u{1298}', '\u{1299}', '\u{129A}', '\u{129B}', '\u{129C}', '\u{129D}', '\u{129E}', '\u{129F}', '\u{12A0}', '\u{12A1}', '\u{12A2}', '\u{12A3}', '\u{12A4}', '\u{12A5}', '\u{12A6}', '\u{12A7}', '\u{12A8}', '\u{12A9}', '\u{12AA}', '\u{12AB}', '\u{12AC}', '\u{12AD}', '\u{12AE}', '\u{12AF}', '\u{12B0}', '\u{12B2}', '\u{12B3}', '\u{12B4}', '\u{12B5}', '\u{12B8}', '\u{12B9}', '\u{12BA}', '\u{12BB}', '\u{12BC}', '\u{12BD}', '\u{12BE}', '\u{12C0}', '\u{12C2}', '\u{12C3}', '\u{12C4}', '\u{12C5}', '\u{12C8}', '\u{12C9}', '\u{12CA}', '\u{12CB}', '\u{12CC}', '\u{12CD}', '\u{12CE}', '\u{12CF}', '\u{12D0}', '\u{12D1}', '\u{12D2}', '\u{12D3}', '\u{12D4}', '\u{12D5}', '\u{12D6}', '\u{12D8}', '\u{12D9}', '\u{12DA}', '\u{12DB}', '\u{12DC}', '\u{12DD}', '\u{12DE}', '\u{12DF}', '\u{12E0}', '\u{12E1}', '\u{12E2}', '\u{12E3}', '\u{12E4}', '\u{12E5}', '\u{12E6}', '\u{12E7}', '\u{12E8}', '\u{12E9}', '\u{12EA}', '\u{12EB}', '\u{12EC}', '\u{12ED}', '\u{12EE}', '\u{12EF}', '\u{12F0}', '\u{12F1}', '\u{12F2}', '\u{12F3}', '\u{12F4}', '\u{12F5}', '\u{12F6}', '\u{12F7}', '\u{12F8}', '\u{12F9}', '\u{12FA}', '\u{12FB}', '\u{12FC}', '\u{12FD}', '\u{12FE}', '\u{12FF}', '\u{1300}', '\u{1301}', '\u{1302}', '\u{1303}', '\u{1304}', '\u{1305}', '\u{1306}', '\u{1307}', '\u{1308}', '\u{1309}', '\u{130A}', '\u{130B}', '\u{130C}', '\u{130D}', '\u{130E}', '\u{130F}', '\u{1310}', '\u{1312}', '\u{1313}', '\u{1314}', '\u{1315}', '\u{1318}', '\u{1319}', '\u{131A}', '\u{131B}', '\u{131C}', '\u{131D}', '\u{131E}', '\u{131F}', '\u{1320}', '\u{1321}', '\u{1322}', '\u{1323}', '\u{1324}', '\u{1325}', '\u{1326}', '\u{1327}', '\u{1328}', '\u{1329}', '\u{132A}', '\u{132B}', '\u{132C}', '\u{132D}', '\u{132E}', '\u{132F}', '\u{1330}', '\u{1331}', '\u{1332}', '\u{1333}', '\u{1334}', '\u{1335}', '\u{1336}', '\u{1337}', '\u{1338}', '\u{1339}', '\u{133A}', '\u{133B}', '\u{133C}', '\u{133D}', '\u{133E}', '\u{133F}', '\u{1340}', '\u{1341}', '\u{1342}', '\u{1343}', '\u{1344}', '\u{1345}', '\u{1346}', '\u{1347}', '\u{1348}', '\u{1349}', '\u{134A}', '\u{134B}', '\u{134C}', '\u{134D}', '\u{134E}', '\u{134F}', '\u{1350}', '\u{1351}', '\u{1352}', '\u{1353}', '\u{1354}', '\u{1355}', '\u{1356}', '\u{1357}', '\u{1358}', '\u{1359}', '\u{135A}', '\u{1380}', '\u{1381}', '\u{1382}', '\u{1383}', '\u{1384}', '\u{1385}', '\u{1386}', '\u{1387}', '\u{1388}', '\u{1389}', '\u{138A}', '\u{138B}', '\u{138C}', '\u{138D}', '\u{138E}', '\u{138F}', '\u{13A0}', '\u{13A1}', '\u{13A2}', '\u{13A3}', '\u{13A4}', '\u{13A5}', '\u{13A6}', '\u{13A7}', '\u{13A8}', '\u{13A9}', '\u{13AA}', '\u{13AB}', '\u{13AC}', '\u{13AD}', '\u{13AE}', '\u{13AF}', '\u{13B0}', '\u{13B1}', '\u{13B2}', '\u{13B3}', '\u{13B4}', '\u{13B5}', '\u{13B6}', '\u{13B7}', '\u{13B8}', '\u{13B9}', '\u{13BA}', '\u{13BB}', '\u{13BC}', '\u{13BD}', '\u{13BE}', '\u{13BF}', '\u{13C0}', '\u{13C1}', '\u{13C2}', '\u{13C3}', '\u{13C4}', '\u{13C5}', '\u{13C6}', '\u{13C7}', '\u{13C8}', '\u{13C9}', '\u{13CA}', '\u{13CB}', '\u{13CC}', '\u{13CD}', '\u{13CE}', '\u{13CF}', '\u{13D0}', '\u{13D1}', '\u{13D2}', '\u{13D3}', '\u{13D4}', '\u{13D5}', '\u{13D6}', '\u{13D7}', '\u{13D8}', '\u{13D9}', '\u{13DA}', '\u{13DB}', '\u{13DC}', '\u{13DD}', '\u{13DE}', '\u{13DF}', '\u{13E0}', '\u{13E1}', '\u{13E2}', '\u{13E3}', '\u{13E4}', '\u{13E5}', '\u{13E6}', '\u{13E7}', '\u{13E8}', '\u{13E9}', '\u{13EA}', '\u{13EB}', '\u{13EC}', '\u{13ED}', '\u{13EE}', '\u{13EF}', '\u{13F0}', '\u{13F1}', '\u{13F2}', '\u{13F3}', '\u{13F4}', '\u{1401}', '\u{1402}', '\u{1403}', '\u{1404}', '\u{1405}', '\u{1406}', '\u{1407}', '\u{1408}', '\u{1409}', '\u{140A}', '\u{140B}', '\u{140C}', '\u{140D}', '\u{140E}', '\u{140F}', '\u{1410}', '\u{1411}', '\u{1412}', '\u{1413}', '\u{1414}', '\u{1415}', '\u{1416}', '\u{1417}', '\u{1418}', '\u{1419}', '\u{141A}', '\u{141B}', '\u{141C}', '\u{141D}', '\u{141E}', '\u{141F}', '\u{1420}', '\u{1421}', '\u{1422}', '\u{1423}', '\u{1424}', '\u{1425}', '\u{1426}', '\u{1427}', '\u{1428}', '\u{1429}', '\u{142A}', '\u{142B}', '\u{142C}', '\u{142D}', '\u{142E}', '\u{142F}', '\u{1430}', '\u{1431}', '\u{1432}', '\u{1433}', '\u{1434}', '\u{1435}', '\u{1436}', '\u{1437}', '\u{1438}', '\u{1439}', '\u{143A}', '\u{143B}', '\u{143C}', '\u{143D}', '\u{143E}', '\u{143F}', '\u{1440}', '\u{1441}', '\u{1442}', '\u{1443}', '\u{1444}', '\u{1445}', '\u{1446}', '\u{1447}', '\u{1448}', '\u{1449}', '\u{144A}', '\u{144B}', '\u{144C}', '\u{144D}', '\u{144E}', '\u{144F}', '\u{1450}', '\u{1451}', '\u{1452}', '\u{1453}', '\u{1454}', '\u{1455}', '\u{1456}', '\u{1457}', '\u{1458}', '\u{1459}', '\u{145A}', '\u{145B}', '\u{145C}', '\u{145D}', '\u{145E}', '\u{145F}', '\u{1460}', '\u{1461}', '\u{1462}', '\u{1463}', '\u{1464}', '\u{1465}', '\u{1466}', '\u{1467}', '\u{1468}', '\u{1469}', '\u{146A}', '\u{146B}', '\u{146C}', '\u{146D}', '\u{146E}', '\u{146F}', '\u{1470}', '\u{1471}', '\u{1472}', '\u{1473}', '\u{1474}', '\u{1475}', '\u{1476}', '\u{1477}', '\u{1478}', '\u{1479}', '\u{147A}', '\u{147B}', '\u{147C}', '\u{147D}', '\u{147E}', '\u{147F}', '\u{1480}', '\u{1481}', '\u{1482}', '\u{1483}', '\u{1484}', '\u{1485}', '\u{1486}', '\u{1487}', '\u{1488}', '\u{1489}', '\u{148A}', '\u{148B}', '\u{148C}', '\u{148D}', '\u{148E}', '\u{148F}', '\u{1490}', '\u{1491}', '\u{1492}', '\u{1493}', '\u{1494}', '\u{1495}', '\u{1496}', '\u{1497}', '\u{1498}', '\u{1499}', '\u{149A}', '\u{149B}', '\u{149C}', '\u{149D}', '\u{149E}', '\u{149F}', '\u{14A0}', '\u{14A1}', '\u{14A2}', '\u{14A3}', '\u{14A4}', '\u{14A5}', '\u{14A6}', '\u{14A7}', '\u{14A8}', '\u{14A9}', '\u{14AA}', '\u{14AB}', '\u{14AC}', '\u{14AD}', '\u{14AE}', '\u{14AF}', '\u{14B0}', '\u{14B1}', '\u{14B2}', '\u{14B3}', '\u{14B4}', '\u{14B5}', '\u{14B6}', '\u{14B7}', '\u{14B8}', '\u{14B9}', '\u{14BA}', '\u{14BB}', '\u{14BC}', '\u{14BD}', '\u{14BE}', '\u{14BF}', '\u{14C0}', '\u{14C1}', '\u{14C2}', '\u{14C3}', '\u{14C4}', '\u{14C5}', '\u{14C6}', '\u{14C7}', '\u{14C8}', '\u{14C9}', '\u{14CA}', '\u{14CB}', '\u{14CC}', '\u{14CD}', '\u{14CE}', '\u{14CF}', '\u{14D0}', '\u{14D1}', '\u{14D2}', '\u{14D3}', '\u{14D4}', '\u{14D5}', '\u{14D6}', '\u{14D7}', '\u{14D8}', '\u{14D9}', '\u{14DA}', '\u{14DB}', '\u{14DC}', '\u{14DD}', '\u{14DE}', '\u{14DF}', '\u{14E0}', '\u{14E1}', '\u{14E2}', '\u{14E3}', '\u{14E4}', '\u{14E5}', '\u{14E6}', '\u{14E7}', '\u{14E8}', '\u{14E9}', '\u{14EA}', '\u{14EB}', '\u{14EC}', '\u{14ED}', '\u{14EE}', '\u{14EF}', '\u{14F0}', '\u{14F1}', '\u{14F2}', '\u{14F3}', '\u{14F4}', '\u{14F5}', '\u{14F6}', '\u{14F7}', '\u{14F8}', '\u{14F9}', '\u{14FA}', '\u{14FB}', '\u{14FC}', '\u{14FD}', '\u{14FE}', '\u{14FF}', '\u{1500}', '\u{1501}', '\u{1502}', '\u{1503}', '\u{1504}', '\u{1505}', '\u{1506}', '\u{1507}', '\u{1508}', '\u{1509}', '\u{150A}', '\u{150B}', '\u{150C}', '\u{150D}', '\u{150E}', '\u{150F}', '\u{1510}', '\u{1511}', '\u{1512}', '\u{1513}', '\u{1514}', '\u{1515}', '\u{1516}', '\u{1517}', '\u{1518}', '\u{1519}', '\u{151A}', '\u{151B}', '\u{151C}', '\u{151D}', '\u{151E}', '\u{151F}', '\u{1520}', '\u{1521}', '\u{1522}', '\u{1523}', '\u{1524}', '\u{1525}', '\u{1526}', '\u{1527}', '\u{1528}', '\u{1529}', '\u{152A}', '\u{152B}', '\u{152C}', '\u{152D}', '\u{152E}', '\u{152F}', '\u{1530}', '\u{1531}', '\u{1532}', '\u{1533}', '\u{1534}', '\u{1535}', '\u{1536}', '\u{1537}', '\u{1538}', '\u{1539}', '\u{153A}', '\u{153B}', '\u{153C}', '\u{153D}', '\u{153E}', '\u{153F}', '\u{1540}', '\u{1541}', '\u{1542}', '\u{1543}', '\u{1544}', '\u{1545}', '\u{1546}', '\u{1547}', '\u{1548}', '\u{1549}', '\u{154A}', '\u{154B}', '\u{154C}', '\u{154D}', '\u{154E}', '\u{154F}', '\u{1550}', '\u{1551}', '\u{1552}', '\u{1553}', '\u{1554}', '\u{1555}', '\u{1556}', '\u{1557}', '\u{1558}', '\u{1559}', '\u{155A}', '\u{155B}', '\u{155C}', '\u{155D}', '\u{155E}', '\u{155F}', '\u{1560}', '\u{1561}', '\u{1562}', '\u{1563}', '\u{1564}', '\u{1565}', '\u{1566}', '\u{1567}', '\u{1568}', '\u{1569}', '\u{156A}', '\u{156B}', '\u{156C}', '\u{156D}', '\u{156E}', '\u{156F}', '\u{1570}', '\u{1571}', '\u{1572}', '\u{1573}', '\u{1574}', '\u{1575}', '\u{1576}', '\u{1577}', '\u{1578}', '\u{1579}', '\u{157A}', '\u{157B}', '\u{157C}', '\u{157D}', '\u{157E}', '\u{157F}', '\u{1580}', '\u{1581}', '\u{1582}', '\u{1583}', '\u{1584}', '\u{1585}', '\u{1586}', '\u{1587}', '\u{1588}', '\u{1589}', '\u{158A}', '\u{158B}', '\u{158C}', '\u{158D}', '\u{158E}', '\u{158F}', '\u{1590}', '\u{1591}', '\u{1592}', '\u{1593}', '\u{1594}', '\u{1595}', '\u{1596}', '\u{1597}', '\u{1598}', '\u{1599}', '\u{159A}', '\u{159B}', '\u{159C}', '\u{159D}', '\u{159E}', '\u{159F}', '\u{15A0}', '\u{15A1}', '\u{15A2}', '\u{15A3}', '\u{15A4}', '\u{15A5}', '\u{15A6}', '\u{15A7}', '\u{15A8}', '\u{15A9}', '\u{15AA}', '\u{15AB}', '\u{15AC}', '\u{15AD}', '\u{15AE}', '\u{15AF}', '\u{15B0}', '\u{15B1}', '\u{15B2}', '\u{15B3}', '\u{15B4}', '\u{15B5}', '\u{15B6}', '\u{15B7}', '\u{15B8}', '\u{15B9}', '\u{15BA}', '\u{15BB}', '\u{15BC}', '\u{15BD}', '\u{15BE}', '\u{15BF}', '\u{15C0}', '\u{15C1}', '\u{15C2}', '\u{15C3}', '\u{15C4}', '\u{15C5}', '\u{15C6}', '\u{15C7}', '\u{15C8}', '\u{15C9}', '\u{15CA}', '\u{15CB}', '\u{15CC}', '\u{15CD}', '\u{15CE}', '\u{15CF}', '\u{15D0}', '\u{15D1}', '\u{15D2}', '\u{15D3}', '\u{15D4}', '\u{15D5}', '\u{15D6}', '\u{15D7}', '\u{15D8}', '\u{15D9}', '\u{15DA}', '\u{15DB}', '\u{15DC}', '\u{15DD}', '\u{15DE}', '\u{15DF}', '\u{15E0}', '\u{15E1}', '\u{15E2}', '\u{15E3}', '\u{15E4}', '\u{15E5}', '\u{15E6}', '\u{15E7}', '\u{15E8}', '\u{15E9}', '\u{15EA}', '\u{15EB}', '\u{15EC}', '\u{15ED}', '\u{15EE}', '\u{15EF}', '\u{15F0}', '\u{15F1}', '\u{15F2}', '\u{15F3}', '\u{15F4}', '\u{15F5}', '\u{15F6}', '\u{15F7}', '\u{15F8}', '\u{15F9}', '\u{15FA}', '\u{15FB}', '\u{15FC}', '\u{15FD}', '\u{15FE}', '\u{15FF}', '\u{1600}', '\u{1601}', '\u{1602}', '\u{1603}', '\u{1604}', '\u{1605}', '\u{1606}', '\u{1607}', '\u{1608}', '\u{1609}', '\u{160A}', '\u{160B}', '\u{160C}', '\u{160D}', '\u{160E}', '\u{160F}', '\u{1610}', '\u{1611}', '\u{1612}', '\u{1613}', '\u{1614}', '\u{1615}', '\u{1616}', '\u{1617}', '\u{1618}', '\u{1619}', '\u{161A}', '\u{161B}', '\u{161C}', '\u{161D}', '\u{161E}', '\u{161F}', '\u{1620}', '\u{1621}', '\u{1622}', '\u{1623}', '\u{1624}', '\u{1625}', '\u{1626}', '\u{1627}', '\u{1628}', '\u{1629}', '\u{162A}', '\u{162B}', '\u{162C}', '\u{162D}', '\u{162E}', '\u{162F}', '\u{1630}', '\u{1631}', '\u{1632}', '\u{1633}', '\u{1634}', '\u{1635}', '\u{1636}', '\u{1637}', '\u{1638}', '\u{1639}', '\u{163A}', '\u{163B}', '\u{163C}', '\u{163D}', '\u{163E}', '\u{163F}', '\u{1640}', '\u{1641}', '\u{1642}', '\u{1643}', '\u{1644}', '\u{1645}', '\u{1646}', '\u{1647}', '\u{1648}', '\u{1649}', '\u{164A}', '\u{164B}', '\u{164C}', '\u{164D}', '\u{164E}', '\u{164F}', '\u{1650}', '\u{1651}', '\u{1652}', '\u{1653}', '\u{1654}', '\u{1655}', '\u{1656}', '\u{1657}', '\u{1658}', '\u{1659}', '\u{165A}', '\u{165B}', '\u{165C}', '\u{165D}', '\u{165E}', '\u{165F}', '\u{1660}', '\u{1661}', '\u{1662}', '\u{1663}', '\u{1664}', '\u{1665}', '\u{1666}', '\u{1667}', '\u{1668}', '\u{1669}', '\u{166A}', '\u{166B}', '\u{166C}', '\u{166F}', '\u{1670}', '\u{1671}', '\u{1672}', '\u{1673}', '\u{1674}', '\u{1675}', '\u{1676}', '\u{1681}', '\u{1682}', '\u{1683}', '\u{1684}', '\u{1685}', '\u{1686}', '\u{1687}', '\u{1688}', '\u{1689}', '\u{168A}', '\u{168B}', '\u{168C}', '\u{168D}', '\u{168E}', '\u{168F}', '\u{1690}', '\u{1691}', '\u{1692}', '\u{1693}', '\u{1694}', '\u{1695}', '\u{1696}', '\u{1697}', '\u{1698}', '\u{1699}', '\u{169A}', '\u{16A0}', '\u{16A1}', '\u{16A2}', '\u{16A3}', '\u{16A4}', '\u{16A5}', '\u{16A6}', '\u{16A7}', '\u{16A8}', '\u{16A9}', '\u{16AA}', '\u{16AB}', '\u{16AC}', '\u{16AD}', '\u{16AE}', '\u{16AF}', '\u{16B0}', '\u{16B1}', '\u{16B2}', '\u{16B3}', '\u{16B4}', '\u{16B5}', '\u{16B6}', '\u{16B7}', '\u{16B8}', '\u{16B9}', '\u{16BA}', '\u{16BB}', '\u{16BC}', '\u{16BD}', '\u{16BE}', '\u{16BF}', '\u{16C0}', '\u{16C1}', '\u{16C2}', '\u{16C3}', '\u{16C4}', '\u{16C5}', '\u{16C6}', '\u{16C7}', '\u{16C8}', '\u{16C9}', '\u{16CA}', '\u{16CB}', '\u{16CC}', '\u{16CD}', '\u{16CE}', '\u{16CF}', '\u{16D0}', '\u{16D1}', '\u{16D2}', '\u{16D3}', '\u{16D4}', '\u{16D5}', '\u{16D6}', '\u{16D7}', '\u{16D8}', '\u{16D9}', '\u{16DA}', '\u{16DB}', '\u{16DC}', '\u{16DD}', '\u{16DE}', '\u{16DF}', '\u{16E0}', '\u{16E1}', '\u{16E2}', '\u{16E3}', '\u{16E4}', '\u{16E5}', '\u{16E6}', '\u{16E7}', '\u{16E8}', '\u{16E9}', '\u{16EA}', '\u{1700}', '\u{1701}', '\u{1702}', '\u{1703}', '\u{1704}', '\u{1705}', '\u{1706}', '\u{1707}', '\u{1708}', '\u{1709}', '\u{170A}', '\u{170B}', '\u{170C}', '\u{170E}', '\u{170F}', '\u{1710}', '\u{1711}', '\u{1720}', '\u{1721}', '\u{1722}', '\u{1723}', '\u{1724}', '\u{1725}', '\u{1726}', '\u{1727}', '\u{1728}', '\u{1729}', '\u{172A}', '\u{172B}', '\u{172C}', '\u{172D}', '\u{172E}', '\u{172F}', '\u{1730}', '\u{1731}', '\u{1740}', '\u{1741}', '\u{1742}', '\u{1743}', '\u{1744}', '\u{1745}', '\u{1746}', '\u{1747}', '\u{1748}', '\u{1749}', '\u{174A}', '\u{174B}', '\u{174C}', '\u{174D}', '\u{174E}', '\u{174F}', '\u{1750}', '\u{1751}', '\u{1760}', '\u{1761}', '\u{1762}', '\u{1763}', '\u{1764}', '\u{1765}', '\u{1766}', '\u{1767}', '\u{1768}', '\u{1769}', '\u{176A}', '\u{176B}', '\u{176C}', '\u{176E}', '\u{176F}', '\u{1770}', '\u{1780}', '\u{1781}', '\u{1782}', '\u{1783}', '\u{1784}', '\u{1785}', '\u{1786}', '\u{1787}', '\u{1788}', '\u{1789}', '\u{178A}', '\u{178B}', '\u{178C}', '\u{178D}', '\u{178E}', '\u{178F}', '\u{1790}', '\u{1791}', '\u{1792}', '\u{1793}', '\u{1794}', '\u{1795}', '\u{1796}', '\u{1797}', '\u{1798}', '\u{1799}', '\u{179A}', '\u{179B}', '\u{179C}', '\u{179D}', '\u{179E}', '\u{179F}', '\u{17A0}', '\u{17A1}', '\u{17A2}', '\u{17A3}', '\u{17A4}', '\u{17A5}', '\u{17A6}', '\u{17A7}', '\u{17A8}', '\u{17A9}', '\u{17AA}', '\u{17AB}', '\u{17AC}', '\u{17AD}', '\u{17AE}', '\u{17AF}', '\u{17B0}', '\u{17B1}', '\u{17B2}', '\u{17B3}', '\u{17DC}', '\u{1820}', '\u{1821}', '\u{1822}', '\u{1823}', '\u{1824}', '\u{1825}', '\u{1826}', '\u{1827}', '\u{1828}', '\u{1829}', '\u{182A}', '\u{182B}', '\u{182C}', '\u{182D}', '\u{182E}', '\u{182F}', '\u{1830}', '\u{1831}', '\u{1832}', '\u{1833}', '\u{1834}', '\u{1835}', '\u{1836}', '\u{1837}', '\u{1838}', '\u{1839}', '\u{183A}', '\u{183B}', '\u{183C}', '\u{183D}', '\u{183E}', '\u{183F}', '\u{1840}', '\u{1841}', '\u{1842}', '\u{1844}', '\u{1845}', '\u{1846}', '\u{1847}', '\u{1848}', '\u{1849}', '\u{184A}', '\u{184B}', '\u{184C}', '\u{184D}', '\u{184E}', '\u{184F}', '\u{1850}', '\u{1851}', '\u{1852}', '\u{1853}', '\u{1854}', '\u{1855}', '\u{1856}', '\u{1857}', '\u{1858}', '\u{1859}', '\u{185A}', '\u{185B}', '\u{185C}', '\u{185D}', '\u{185E}', '\u{185F}', '\u{1860}', '\u{1861}', '\u{1862}', '\u{1863}', '\u{1864}', '\u{1865}', '\u{1866}', '\u{1867}', '\u{1868}', '\u{1869}', '\u{186A}', '\u{186B}', '\u{186C}', '\u{186D}', '\u{186E}', '\u{186F}', '\u{1870}', '\u{1871}', '\u{1872}', '\u{1873}', '\u{1874}', '\u{1875}', '\u{1876}', '\u{1877}', '\u{1880}', '\u{1881}', '\u{1882}', '\u{1883}', '\u{1884}', '\u{1885}', '\u{1886}', '\u{1887}', '\u{1888}', '\u{1889}', '\u{188A}', '\u{188B}', '\u{188C}', '\u{188D}', '\u{188E}', '\u{188F}', '\u{1890}', '\u{1891}', '\u{1892}', '\u{1893}', '\u{1894}', '\u{1895}', '\u{1896}', '\u{1897}', '\u{1898}', '\u{1899}', '\u{189A}', '\u{189B}', '\u{189C}', '\u{189D}', '\u{189E}', '\u{189F}', '\u{18A0}', '\u{18A1}', '\u{18A2}', '\u{18A3}', '\u{18A4}', '\u{18A5}', '\u{18A6}', '\u{18A7}', '\u{18A8}', '\u{18AA}', '\u{1900}', '\u{1901}', '\u{1902}', '\u{1903}', '\u{1904}', '\u{1905}', '\u{1906}', '\u{1907}', '\u{1908}', '\u{1909}', '\u{190A}', '\u{190B}', '\u{190C}', '\u{190D}', '\u{190E}', '\u{190F}', '\u{1910}', '\u{1911}', '\u{1912}', '\u{1913}', '\u{1914}', '\u{1915}', '\u{1916}', '\u{1917}', '\u{1918}', '\u{1919}', '\u{191A}', '\u{191B}', '\u{191C}', '\u{1950}', '\u{1951}', '\u{1952}', '\u{1953}', '\u{1954}', '\u{1955}', '\u{1956}', '\u{1957}', '\u{1958}', '\u{1959}', '\u{195A}', '\u{195B}', '\u{195C}', '\u{195D}', '\u{195E}', '\u{195F}', '\u{1960}', '\u{1961}', '\u{1962}', '\u{1963}', '\u{1964}', '\u{1965}', '\u{1966}', '\u{1967}', '\u{1968}', '\u{1969}', '\u{196A}', '\u{196B}', '\u{196C}', '\u{196D}', '\u{1970}', '\u{1971}', '\u{1972}', '\u{1973}', '\u{1974}', '\u{1980}', '\u{1981}', '\u{1982}', '\u{1983}', '\u{1984}', '\u{1985}', '\u{1986}', '\u{1987}', '\u{1988}', '\u{1989}', '\u{198A}', '\u{198B}', '\u{198C}', '\u{198D}', '\u{198E}', '\u{198F}', '\u{1990}', '\u{1991}', '\u{1992}', '\u{1993}', '\u{1994}', '\u{1995}', '\u{1996}', '\u{1997}', '\u{1998}', '\u{1999}', '\u{199A}', '\u{199B}', '\u{199C}', '\u{199D}', '\u{199E}', '\u{199F}', '\u{19A0}', '\u{19A1}', '\u{19A2}', '\u{19A3}', '\u{19A4}', '\u{19A5}', '\u{19A6}', '\u{19A7}', '\u{19A8}', '\u{19A9}', '\u{19C1}', '\u{19C2}', '\u{19C3}', '\u{19C4}', '\u{19C5}', '\u{19C6}', '\u{19C7}', '\u{1A00}', '\u{1A01}', '\u{1A02}', '\u{1A03}', '\u{1A04}', '\u{1A05}', '\u{1A06}', '\u{1A07}', '\u{1A08}', '\u{1A09}', '\u{1A0A}', '\u{1A0B}', '\u{1A0C}', '\u{1A0D}', '\u{1A0E}', '\u{1A0F}', '\u{1A10}', '\u{1A11}', '\u{1A12}', '\u{1A13}', '\u{1A14}', '\u{1A15}', '\u{1A16}', '\u{1B05}', '\u{1B06}', '\u{1B07}', '\u{1B08}', '\u{1B09}', '\u{1B0A}', '\u{1B0B}', '\u{1B0C}', '\u{1B0D}', '\u{1B0E}', '\u{1B0F}', '\u{1B10}', '\u{1B11}', '\u{1B12}', '\u{1B13}', '\u{1B14}', '\u{1B15}', '\u{1B16}', '\u{1B17}', '\u{1B18}', '\u{1B19}', '\u{1B1A}', '\u{1B1B}', '\u{1B1C}', '\u{1B1D}', '\u{1B1E}', '\u{1B1F}', '\u{1B20}', '\u{1B21}', '\u{1B22}', '\u{1B23}', '\u{1B24}', '\u{1B25}', '\u{1B26}', '\u{1B27}', '\u{1B28}', '\u{1B29}', '\u{1B2A}', '\u{1B2B}', '\u{1B2C}', '\u{1B2D}', '\u{1B2E}', '\u{1B2F}', '\u{1B30}', '\u{1B31}', '\u{1B32}', '\u{1B33}', '\u{1B45}', '\u{1B46}', '\u{1B47}', '\u{1B48}', '\u{1B49}', '\u{1B4A}', '\u{1B4B}', '\u{1B83}', '\u{1B84}', '\u{1B85}', '\u{1B86}', '\u{1B87}', '\u{1B88}', '\u{1B89}', '\u{1B8A}', '\u{1B8B}', '\u{1B8C}', '\u{1B8D}', '\u{1B8E}', '\u{1B8F}', '\u{1B90}', '\u{1B91}', '\u{1B92}', '\u{1B93}', '\u{1B94}', '\u{1B95}', '\u{1B96}', '\u{1B97}', '\u{1B98}', '\u{1B99}', '\u{1B9A}', '\u{1B9B}', '\u{1B9C}', '\u{1B9D}', '\u{1B9E}', '\u{1B9F}', '\u{1BA0}', '\u{1BAE}', '\u{1BAF}', '\u{1C00}', '\u{1C01}', '\u{1C02}', '\u{1C03}', '\u{1C04}', '\u{1C05}', '\u{1C06}', '\u{1C07}', '\u{1C08}', '\u{1C09}', '\u{1C0A}', '\u{1C0B}', '\u{1C0C}', '\u{1C0D}', '\u{1C0E}', '\u{1C0F}', '\u{1C10}', '\u{1C11}', '\u{1C12}', '\u{1C13}', '\u{1C14}', '\u{1C15}', '\u{1C16}', '\u{1C17}', '\u{1C18}', '\u{1C19}', '\u{1C1A}', '\u{1C1B}', '\u{1C1C}', '\u{1C1D}', '\u{1C1E}', '\u{1C1F}', '\u{1C20}', '\u{1C21}', '\u{1C22}', '\u{1C23}', '\u{1C4D}', '\u{1C4E}', '\u{1C4F}', '\u{1C5A}', '\u{1C5B}', '\u{1C5C}', '\u{1C5D}', '\u{1C5E}', '\u{1C5F}', '\u{1C60}', '\u{1C61}', '\u{1C62}', '\u{1C63}', '\u{1C64}', '\u{1C65}', '\u{1C66}', '\u{1C67}', '\u{1C68}', '\u{1C69}', '\u{1C6A}', '\u{1C6B}', '\u{1C6C}', '\u{1C6D}', '\u{1C6E}', '\u{1C6F}', '\u{1C70}', '\u{1C71}', '\u{1C72}', '\u{1C73}', '\u{1C74}', '\u{1C75}', '\u{1C76}', '\u{1C77}', '\u{2135}', '\u{2136}', '\u{2137}', '\u{2138}', '\u{2D30}', '\u{2D31}', '\u{2D32}', '\u{2D33}', '\u{2D34}', '\u{2D35}', '\u{2D36}', '\u{2D37}', '\u{2D38}', '\u{2D39}', '\u{2D3A}', '\u{2D3B}', '\u{2D3C}', '\u{2D3D}', '\u{2D3E}', '\u{2D3F}', '\u{2D40}', '\u{2D41}', '\u{2D42}', '\u{2D43}', '\u{2D44}', '\u{2D45}', '\u{2D46}', '\u{2D47}', '\u{2D48}', '\u{2D49}', '\u{2D4A}', '\u{2D4B}', '\u{2D4C}', '\u{2D4D}', '\u{2D4E}', '\u{2D4F}', '\u{2D50}', '\u{2D51}', '\u{2D52}', '\u{2D53}', '\u{2D54}', '\u{2D55}', '\u{2D56}', '\u{2D57}', '\u{2D58}', '\u{2D59}', '\u{2D5A}', '\u{2D5B}', '\u{2D5C}', '\u{2D5D}', '\u{2D5E}', '\u{2D5F}', '\u{2D60}', '\u{2D61}', '\u{2D62}', '\u{2D63}', '\u{2D64}', '\u{2D65}', '\u{2D80}', '\u{2D81}', '\u{2D82}', '\u{2D83}', '\u{2D84}', '\u{2D85}', '\u{2D86}', '\u{2D87}', '\u{2D88}', '\u{2D89}', '\u{2D8A}', '\u{2D8B}', '\u{2D8C}', '\u{2D8D}', '\u{2D8E}', '\u{2D8F}', '\u{2D90}', '\u{2D91}', '\u{2D92}', '\u{2D93}', '\u{2D94}', '\u{2D95}', '\u{2D96}', '\u{2DA0}', '\u{2DA1}', '\u{2DA2}', '\u{2DA3}', '\u{2DA4}', '\u{2DA5}', '\u{2DA6}', '\u{2DA8}', '\u{2DA9}', '\u{2DAA}', '\u{2DAB}', '\u{2DAC}', '\u{2DAD}', '\u{2DAE}', '\u{2DB0}', '\u{2DB1}', '\u{2DB2}', '\u{2DB3}', '\u{2DB4}', '\u{2DB5}', '\u{2DB6}', '\u{2DB8}', '\u{2DB9}', '\u{2DBA}', '\u{2DBB}', '\u{2DBC}', '\u{2DBD}', '\u{2DBE}', '\u{2DC0}', '\u{2DC1}', '\u{2DC2}', '\u{2DC3}', '\u{2DC4}', '\u{2DC5}', '\u{2DC6}', '\u{2DC8}', '\u{2DC9}', '\u{2DCA}', '\u{2DCB}', '\u{2DCC}', '\u{2DCD}', '\u{2DCE}', '\u{2DD0}', '\u{2DD1}', '\u{2DD2}', '\u{2DD3}', '\u{2DD4}', '\u{2DD5}', '\u{2DD6}', '\u{2DD8}', '\u{2DD9}', '\u{2DDA}', '\u{2DDB}', '\u{2DDC}', '\u{2DDD}', '\u{2DDE}', '\u{3006}', '\u{303C}', '\u{3041}', '\u{3042}', '\u{3043}', '\u{3044}', '\u{3045}', '\u{3046}', '\u{3047}', '\u{3048}', '\u{3049}', '\u{304A}', '\u{304B}', '\u{304C}', '\u{304D}', '\u{304E}', '\u{304F}', '\u{3050}', '\u{3051}', '\u{3052}', '\u{3053}', '\u{3054}', '\u{3055}', '\u{3056}', '\u{3057}', '\u{3058}', '\u{3059}', '\u{305A}', '\u{305B}', '\u{305C}', '\u{305D}', '\u{305E}', '\u{305F}', '\u{3060}', '\u{3061}', '\u{3062}', '\u{3063}', '\u{3064}', '\u{3065}', '\u{3066}', '\u{3067}', '\u{3068}', '\u{3069}', '\u{306A}', '\u{306B}', '\u{306C}', '\u{306D}', '\u{306E}', '\u{306F}', '\u{3070}', '\u{3071}', '\u{3072}', '\u{3073}', '\u{3074}', '\u{3075}', '\u{3076}', '\u{3077}', '\u{3078}', '\u{3079}', '\u{307A}', '\u{307B}', '\u{307C}', '\u{307D}', '\u{307E}', '\u{307F}', '\u{3080}', '\u{3081}', '\u{3082}', '\u{3083}', '\u{3084}', '\u{3085}', '\u{3086}', '\u{3087}', '\u{3088}', '\u{3089}', '\u{308A}', '\u{308B}', '\u{308C}', '\u{308D}', '\u{308E}', '\u{308F}', '\u{3090}', '\u{3091}', '\u{3092}', '\u{3093}', '\u{3094}', '\u{3095}', '\u{3096}', '\u{309F}', '\u{30A1}', '\u{30A2}', '\u{30A3}', '\u{30A4}', '\u{30A5}', '\u{30A6}', '\u{30A7}', '\u{30A8}', '\u{30A9}', '\u{30AA}', '\u{30AB}', '\u{30AC}', '\u{30AD}', '\u{30AE}', '\u{30AF}', '\u{30B0}', '\u{30B1}', '\u{30B2}', '\u{30B3}', '\u{30B4}', '\u{30B5}', '\u{30B6}', '\u{30B7}', '\u{30B8}', '\u{30B9}', '\u{30BA}', '\u{30BB}', '\u{30BC}', '\u{30BD}', '\u{30BE}', '\u{30BF}', '\u{30C0}', '\u{30C1}', '\u{30C2}', '\u{30C3}', '\u{30C4}', '\u{30C5}', '\u{30C6}', '\u{30C7}', '\u{30C8}', '\u{30C9}', '\u{30CA}', '\u{30CB}', '\u{30CC}', '\u{30CD}', '\u{30CE}', '\u{30CF}', '\u{30D0}', '\u{30D1}', '\u{30D2}', '\u{30D3}', '\u{30D4}', '\u{30D5}', '\u{30D6}', '\u{30D7}', '\u{30D8}', '\u{30D9}', '\u{30DA}', '\u{30DB}', '\u{30DC}', '\u{30DD}', '\u{30DE}', '\u{30DF}', '\u{30E0}', '\u{30E1}', '\u{30E2}', '\u{30E3}', '\u{30E4}', '\u{30E5}', '\u{30E6}', '\u{30E7}', '\u{30E8}', '\u{30E9}', '\u{30EA}', '\u{30EB}', '\u{30EC}', '\u{30ED}', '\u{30EE}', '\u{30EF}', '\u{30F0}', '\u{30F1}', '\u{30F2}', '\u{30F3}', '\u{30F4}', '\u{30F5}', '\u{30F6}', '\u{30F7}', '\u{30F8}', '\u{30F9}', '\u{30FA}', '\u{30FF}', '\u{3105}', '\u{3106}', '\u{3107}', '\u{3108}', '\u{3109}', '\u{310A}', '\u{310B}', '\u{310C}', '\u{310D}', '\u{310E}', '\u{310F}', '\u{3110}', '\u{3111}', '\u{3112}', '\u{3113}', '\u{3114}', '\u{3115}', '\u{3116}', '\u{3117}', '\u{3118}', '\u{3119}', '\u{311A}', '\u{311B}', '\u{311C}', '\u{311D}', '\u{311E}', '\u{311F}', '\u{3120}', '\u{3121}', '\u{3122}', '\u{3123}', '\u{3124}', '\u{3125}', '\u{3126}', '\u{3127}', '\u{3128}', '\u{3129}', '\u{312A}', '\u{312B}', '\u{312C}', '\u{312D}', '\u{3131}', '\u{3132}', '\u{3133}', '\u{3134}', '\u{3135}', '\u{3136}', '\u{3137}', '\u{3138}', '\u{3139}', '\u{313A}', '\u{313B}', '\u{313C}', '\u{313D}', '\u{313E}', '\u{313F}', '\u{3140}', '\u{3141}', '\u{3142}', '\u{3143}', '\u{3144}', '\u{3145}', '\u{3146}', '\u{3147}', '\u{3148}', '\u{3149}', '\u{314A}', '\u{314B}', '\u{314C}', '\u{314D}', '\u{314E}', '\u{314F}', '\u{3150}', '\u{3151}', '\u{3152}', '\u{3153}', '\u{3154}', '\u{3155}', '\u{3156}', '\u{3157}', '\u{3158}', '\u{3159}', '\u{315A}', '\u{315B}', '\u{315C}', '\u{315D}', '\u{315E}', '\u{315F}', '\u{3160}', '\u{3161}', '\u{3162}', '\u{3163}', '\u{3164}', '\u{3165}', '\u{3166}', '\u{3167}', '\u{3168}', '\u{3169}', '\u{316A}', '\u{316B}', '\u{316C}', '\u{316D}', '\u{316E}', '\u{316F}', '\u{3170}', '\u{3171}', '\u{3172}', '\u{3173}', '\u{3174}', '\u{3175}', '\u{3176}', '\u{3177}', '\u{3178}', '\u{3179}', '\u{317A}', '\u{317B}', '\u{317C}', '\u{317D}', '\u{317E}', '\u{317F}', '\u{3180}', '\u{3181}', '\u{3182}', '\u{3183}', '\u{3184}', '\u{3185}', '\u{3186}', '\u{3187}', '\u{3188}', '\u{3189}', '\u{318A}', '\u{318B}', '\u{318C}', '\u{318D}', '\u{318E}', '\u{31A0}', '\u{31A1}', '\u{31A2}', '\u{31A3}', '\u{31A4}', '\u{31A5}', '\u{31A6}', '\u{31A7}', '\u{31A8}', '\u{31A9}', '\u{31AA}', '\u{31AB}', '\u{31AC}', '\u{31AD}', '\u{31AE}', '\u{31AF}', '\u{31B0}', '\u{31B1}', '\u{31B2}', '\u{31B3}', '\u{31B4}', '\u{31B5}', '\u{31B6}', '\u{31B7}', '\u{31F0}', '\u{31F1}', '\u{31F2}', '\u{31F3}', '\u{31F4}', '\u{31F5}', '\u{31F6}', '\u{31F7}', '\u{31F8}', '\u{31F9}', '\u{31FA}', '\u{31FB}', '\u{31FC}', '\u{31FD}', '\u{31FE}', '\u{31FF}', '\u{3400}', '\u{4DB5}', '\u{4E00}', '\u{9FC3}', '\u{A000}', '\u{A001}', '\u{A002}', '\u{A003}', '\u{A004}', '\u{A005}', '\u{A006}', '\u{A007}', '\u{A008}', '\u{A009}', '\u{A00A}', '\u{A00B}', '\u{A00C}', '\u{A00D}', '\u{A00E}', '\u{A00F}', '\u{A010}', '\u{A011}', '\u{A012}', '\u{A013}', '\u{A014}', '\u{A016}', '\u{A017}', '\u{A018}', '\u{A019}', '\u{A01A}', '\u{A01B}', '\u{A01C}', '\u{A01D}', '\u{A01E}', '\u{A01F}', '\u{A020}', '\u{A021}', '\u{A022}', '\u{A023}', '\u{A024}', '\u{A025}', '\u{A026}', '\u{A027}', '\u{A028}', '\u{A029}', '\u{A02A}', '\u{A02B}', '\u{A02C}', '\u{A02D}', '\u{A02E}', '\u{A02F}', '\u{A030}', '\u{A031}', '\u{A032}', '\u{A033}', '\u{A034}', '\u{A035}', '\u{A036}', '\u{A037}', '\u{A038}', '\u{A039}', '\u{A03A}', '\u{A03B}', '\u{A03C}', '\u{A03D}', '\u{A03E}', '\u{A03F}', '\u{A040}', '\u{A041}', '\u{A042}', '\u{A043}', '\u{A044}', '\u{A045}', '\u{A046}', '\u{A047}', '\u{A048}', '\u{A049}', '\u{A04A}', '\u{A04B}', '\u{A04C}', '\u{A04D}', '\u{A04E}', '\u{A04F}', '\u{A050}', '\u{A051}', '\u{A052}', '\u{A053}', '\u{A054}', '\u{A055}', '\u{A056}', '\u{A057}', '\u{A058}', '\u{A059}', '\u{A05A}', '\u{A05B}', '\u{A05C}', '\u{A05D}', '\u{A05E}', '\u{A05F}', '\u{A060}', '\u{A061}', '\u{A062}', '\u{A063}', '\u{A064}', '\u{A065}', '\u{A066}', '\u{A067}', '\u{A068}', '\u{A069}', '\u{A06A}', '\u{A06B}', '\u{A06C}', '\u{A06D}', '\u{A06E}', '\u{A06F}', '\u{A070}', '\u{A071}', '\u{A072}', '\u{A073}', '\u{A074}', '\u{A075}', '\u{A076}', '\u{A077}', '\u{A078}', '\u{A079}', '\u{A07A}', '\u{A07B}', '\u{A07C}', '\u{A07D}', '\u{A07E}', '\u{A07F}', '\u{A080}', '\u{A081}', '\u{A082}', '\u{A083}', '\u{A084}', '\u{A085}', '\u{A086}', '\u{A087}', '\u{A088}', '\u{A089}', '\u{A08A}', '\u{A08B}', '\u{A08C}', '\u{A08D}', '\u{A08E}', '\u{A08F}', '\u{A090}', '\u{A091}', '\u{A092}', '\u{A093}', '\u{A094}', '\u{A095}', '\u{A096}', '\u{A097}', '\u{A098}', '\u{A099}', '\u{A09A}', '\u{A09B}', '\u{A09C}', '\u{A09D}', '\u{A09E}', '\u{A09F}', '\u{A0A0}', '\u{A0A1}', '\u{A0A2}', '\u{A0A3}', '\u{A0A4}', '\u{A0A5}', '\u{A0A6}', '\u{A0A7}', '\u{A0A8}', '\u{A0A9}', '\u{A0AA}', '\u{A0AB}', '\u{A0AC}', '\u{A0AD}', '\u{A0AE}', '\u{A0AF}', '\u{A0B0}', '\u{A0B1}', '\u{A0B2}', '\u{A0B3}', '\u{A0B4}', '\u{A0B5}', '\u{A0B6}', '\u{A0B7}', '\u{A0B8}', '\u{A0B9}', '\u{A0BA}', '\u{A0BB}', '\u{A0BC}', '\u{A0BD}', '\u{A0BE}', '\u{A0BF}', '\u{A0C0}', '\u{A0C1}', '\u{A0C2}', '\u{A0C3}', '\u{A0C4}', '\u{A0C5}', '\u{A0C6}', '\u{A0C7}', '\u{A0C8}', '\u{A0C9}', '\u{A0CA}', '\u{A0CB}', '\u{A0CC}', '\u{A0CD}', '\u{A0CE}', '\u{A0CF}', '\u{A0D0}', '\u{A0D1}', '\u{A0D2}', '\u{A0D3}', '\u{A0D4}', '\u{A0D5}', '\u{A0D6}', '\u{A0D7}', '\u{A0D8}', '\u{A0D9}', '\u{A0DA}', '\u{A0DB}', '\u{A0DC}', '\u{A0DD}', '\u{A0DE}', '\u{A0DF}', '\u{A0E0}', '\u{A0E1}', '\u{A0E2}', '\u{A0E3}', '\u{A0E4}', '\u{A0E5}', '\u{A0E6}', '\u{A0E7}', '\u{A0E8}', '\u{A0E9}', '\u{A0EA}', '\u{A0EB}', '\u{A0EC}', '\u{A0ED}', '\u{A0EE}', '\u{A0EF}', '\u{A0F0}', '\u{A0F1}', '\u{A0F2}', '\u{A0F3}', '\u{A0F4}', '\u{A0F5}', '\u{A0F6}', '\u{A0F7}', '\u{A0F8}', '\u{A0F9}', '\u{A0FA}', '\u{A0FB}', '\u{A0FC}', '\u{A0FD}', '\u{A0FE}', '\u{A0FF}', '\u{A100}', '\u{A101}', '\u{A102}', '\u{A103}', '\u{A104}', '\u{A105}', '\u{A106}', '\u{A107}', '\u{A108}', '\u{A109}', '\u{A10A}', '\u{A10B}', '\u{A10C}', '\u{A10D}', '\u{A10E}', '\u{A10F}', '\u{A110}', '\u{A111}', '\u{A112}', '\u{A113}', '\u{A114}', '\u{A115}', '\u{A116}', '\u{A117}', '\u{A118}', '\u{A119}', '\u{A11A}', '\u{A11B}', '\u{A11C}', '\u{A11D}', '\u{A11E}', '\u{A11F}', '\u{A120}', '\u{A121}', '\u{A122}', '\u{A123}', '\u{A124}', '\u{A125}', '\u{A126}', '\u{A127}', '\u{A128}', '\u{A129}', '\u{A12A}', '\u{A12B}', '\u{A12C}', '\u{A12D}', '\u{A12E}', '\u{A12F}', '\u{A130}', '\u{A131}', '\u{A132}', '\u{A133}', '\u{A134}', '\u{A135}', '\u{A136}', '\u{A137}', '\u{A138}', '\u{A139}', '\u{A13A}', '\u{A13B}', '\u{A13C}', '\u{A13D}', '\u{A13E}', '\u{A13F}', '\u{A140}', '\u{A141}', '\u{A142}', '\u{A143}', '\u{A144}', '\u{A145}', '\u{A146}', '\u{A147}', '\u{A148}', '\u{A149}', '\u{A14A}', '\u{A14B}', '\u{A14C}', '\u{A14D}', '\u{A14E}', '\u{A14F}', '\u{A150}', '\u{A151}', '\u{A152}', '\u{A153}', '\u{A154}', '\u{A155}', '\u{A156}', '\u{A157}', '\u{A158}', '\u{A159}', '\u{A15A}', '\u{A15B}', '\u{A15C}', '\u{A15D}', '\u{A15E}', '\u{A15F}', '\u{A160}', '\u{A161}', '\u{A162}', '\u{A163}', '\u{A164}', '\u{A165}', '\u{A166}', '\u{A167}', '\u{A168}', '\u{A169}', '\u{A16A}', '\u{A16B}', '\u{A16C}', '\u{A16D}', '\u{A16E}', '\u{A16F}', '\u{A170}', '\u{A171}', '\u{A172}', '\u{A173}', '\u{A174}', '\u{A175}', '\u{A176}', '\u{A177}', '\u{A178}', '\u{A179}', '\u{A17A}', '\u{A17B}', '\u{A17C}', '\u{A17D}', '\u{A17E}', '\u{A17F}', '\u{A180}', '\u{A181}', '\u{A182}', '\u{A183}', '\u{A184}', '\u{A185}', '\u{A186}', '\u{A187}', '\u{A188}', '\u{A189}', '\u{A18A}', '\u{A18B}', '\u{A18C}', '\u{A18D}', '\u{A18E}', '\u{A18F}', '\u{A190}', '\u{A191}', '\u{A192}', '\u{A193}', '\u{A194}', '\u{A195}', '\u{A196}', '\u{A197}', '\u{A198}', '\u{A199}', '\u{A19A}', '\u{A19B}', '\u{A19C}', '\u{A19D}', '\u{A19E}', '\u{A19F}', '\u{A1A0}', '\u{A1A1}', '\u{A1A2}', '\u{A1A3}', '\u{A1A4}', '\u{A1A5}', '\u{A1A6}', '\u{A1A7}', '\u{A1A8}', '\u{A1A9}', '\u{A1AA}', '\u{A1AB}', '\u{A1AC}', '\u{A1AD}', '\u{A1AE}', '\u{A1AF}') + } + + fn is_unicode_combining_spacing_mark(self) -> bool { + match_char_class!(self, + '\u{0903}', '\u{093E}', '\u{093F}', '\u{0940}', '\u{0949}', '\u{094A}', '\u{094B}', '\u{094C}', '\u{0982}', '\u{0983}', '\u{09BE}', '\u{09BF}', '\u{09C0}', '\u{09C7}', '\u{09C8}', '\u{09CB}', '\u{09CC}', '\u{09D7}', '\u{0A03}', '\u{0A3E}', '\u{0A3F}', '\u{0A40}', '\u{0A83}', '\u{0ABE}', '\u{0ABF}', '\u{0AC0}', '\u{0AC9}', '\u{0ACB}', '\u{0ACC}', '\u{0B02}', '\u{0B03}', '\u{0B3E}', '\u{0B40}', '\u{0B47}', '\u{0B48}', '\u{0B4B}', '\u{0B4C}', '\u{0B57}', '\u{0BBE}', '\u{0BBF}', '\u{0BC1}', '\u{0BC2}', '\u{0BC6}', '\u{0BC7}', '\u{0BC8}', '\u{0BCA}', '\u{0BCB}', '\u{0BCC}', '\u{0BD7}', '\u{0C01}', '\u{0C02}', '\u{0C03}', '\u{0C41}', '\u{0C42}', '\u{0C43}', '\u{0C44}', '\u{0C82}', '\u{0C83}', '\u{0CBE}', '\u{0CC0}', '\u{0CC1}', '\u{0CC2}', '\u{0CC3}', '\u{0CC4}', '\u{0CC7}', '\u{0CC8}', '\u{0CCA}', '\u{0CCB}', '\u{0CD5}', '\u{0CD6}', '\u{0D02}', '\u{0D03}', '\u{0D3E}', '\u{0D3F}', '\u{0D40}', '\u{0D46}', '\u{0D47}', '\u{0D48}', '\u{0D4A}', '\u{0D4B}', '\u{0D4C}', '\u{0D57}', '\u{0D82}', '\u{0D83}', '\u{0DCF}', '\u{0DD0}', '\u{0DD1}', '\u{0DD8}', '\u{0DD9}', '\u{0DDA}', '\u{0DDB}', '\u{0DDC}', '\u{0DDD}', '\u{0DDE}', '\u{0DDF}', '\u{0DF2}', '\u{0DF3}', '\u{0F3E}', '\u{0F3F}', '\u{0F7F}', '\u{102B}', '\u{102C}', '\u{1031}', '\u{1038}', '\u{103B}', '\u{103C}', '\u{1056}', '\u{1057}', '\u{1062}', '\u{1063}', '\u{1064}', '\u{1067}', '\u{1068}', '\u{1069}', '\u{106A}', '\u{106B}', '\u{106C}', '\u{106D}', '\u{1083}', '\u{1084}', '\u{1087}', '\u{1088}', '\u{1089}', '\u{108A}', '\u{108B}', '\u{108C}', '\u{108F}', '\u{17B6}', '\u{17BE}', '\u{17BF}', '\u{17C0}', '\u{17C1}', '\u{17C2}', '\u{17C3}', '\u{17C4}', '\u{17C5}', '\u{17C7}', '\u{17C8}', '\u{1923}', '\u{1924}', '\u{1925}', '\u{1926}', '\u{1929}', '\u{192A}', '\u{192B}', '\u{1930}', '\u{1931}', '\u{1933}', '\u{1934}', '\u{1935}', '\u{1936}', '\u{1937}', '\u{1938}', '\u{19B0}', '\u{19B1}', '\u{19B2}', '\u{19B3}', '\u{19B4}', '\u{19B5}', '\u{19B6}', '\u{19B7}', '\u{19B8}', '\u{19B9}', '\u{19BA}', '\u{19BB}', '\u{19BC}', '\u{19BD}', '\u{19BE}', '\u{19BF}', '\u{19C0}', '\u{19C8}', '\u{19C9}', '\u{1A19}', '\u{1A1A}', '\u{1A1B}', '\u{1B04}', '\u{1B35}', '\u{1B3B}', '\u{1B3D}', '\u{1B3E}', '\u{1B3F}', '\u{1B40}', '\u{1B41}', '\u{1B43}', '\u{1B44}', '\u{1B82}', '\u{1BA1}', '\u{1BA6}', '\u{1BA7}', '\u{1BAA}', '\u{1C24}', '\u{1C25}', '\u{1C26}', '\u{1C27}', '\u{1C28}', '\u{1C29}', '\u{1C2A}', '\u{1C2B}', '\u{1C34}', '\u{1C35}', '\u{A823}', '\u{A824}', '\u{A827}', '\u{A880}', '\u{A881}', '\u{A8B4}', '\u{A8B5}', '\u{A8B6}', '\u{A8B7}', '\u{A8B8}', '\u{A8B9}', '\u{A8BA}', '\u{A8BB}', '\u{A8BC}', '\u{A8BD}', '\u{A8BE}', '\u{A8BF}', '\u{A8C0}', '\u{A8C1}', '\u{A8C2}', '\u{A8C3}', '\u{A952}', '\u{A953}', '\u{AA2F}', '\u{AA30}', '\u{AA33}', '\u{AA34}', '\u{AA4D}') + } + + fn is_unicode_decimal_number(self) -> bool { + match_char_class!(self, + '\u{0030}', '\u{0031}', '\u{0032}', '\u{0033}', '\u{0034}', '\u{0035}', '\u{0036}', '\u{0037}', '\u{0038}', '\u{0039}', '\u{0660}', '\u{0661}', '\u{0662}', '\u{0663}', '\u{0664}', '\u{0665}', '\u{0666}', '\u{0667}', '\u{0668}', '\u{0669}', '\u{06F0}', '\u{06F1}', '\u{06F2}', '\u{06F3}', '\u{06F4}', '\u{06F5}', '\u{06F6}', '\u{06F7}', '\u{06F8}', '\u{06F9}', '\u{07C0}', '\u{07C1}', '\u{07C2}', '\u{07C3}', '\u{07C4}', '\u{07C5}', '\u{07C6}', '\u{07C7}', '\u{07C8}', '\u{07C9}', '\u{0966}', '\u{0967}', '\u{0968}', '\u{0969}', '\u{096A}', '\u{096B}', '\u{096C}', '\u{096D}', '\u{096E}', '\u{096F}', '\u{09E6}', '\u{09E7}', '\u{09E8}', '\u{09E9}', '\u{09EA}', '\u{09EB}', '\u{09EC}', '\u{09ED}', '\u{09EE}', '\u{09EF}', '\u{0A66}', '\u{0A67}', '\u{0A68}', '\u{0A69}', '\u{0A6A}', '\u{0A6B}', '\u{0A6C}', '\u{0A6D}', '\u{0A6E}', '\u{0A6F}', '\u{0AE6}', '\u{0AE7}', '\u{0AE8}', '\u{0AE9}', '\u{0AEA}', '\u{0AEB}', '\u{0AEC}', '\u{0AED}', '\u{0AEE}', '\u{0AEF}', '\u{0B66}', '\u{0B67}', '\u{0B68}', '\u{0B69}', '\u{0B6A}', '\u{0B6B}', '\u{0B6C}', '\u{0B6D}', '\u{0B6E}', '\u{0B6F}', '\u{0BE6}', '\u{0BE7}', '\u{0BE8}', '\u{0BE9}', '\u{0BEA}', '\u{0BEB}', '\u{0BEC}', '\u{0BED}', '\u{0BEE}', '\u{0BEF}', '\u{0C66}', '\u{0C67}', '\u{0C68}', '\u{0C69}', '\u{0C6A}', '\u{0C6B}', '\u{0C6C}', '\u{0C6D}', '\u{0C6E}', '\u{0C6F}', '\u{0CE6}', '\u{0CE7}', '\u{0CE8}', '\u{0CE9}', '\u{0CEA}', '\u{0CEB}', '\u{0CEC}', '\u{0CED}', '\u{0CEE}', '\u{0CEF}', '\u{0D66}', '\u{0D67}', '\u{0D68}', '\u{0D69}', '\u{0D6A}', '\u{0D6B}', '\u{0D6C}', '\u{0D6D}', '\u{0D6E}', '\u{0D6F}', '\u{0E50}', '\u{0E51}', '\u{0E52}', '\u{0E53}', '\u{0E54}', '\u{0E55}', '\u{0E56}', '\u{0E57}', '\u{0E58}', '\u{0E59}', '\u{0ED0}', '\u{0ED1}', '\u{0ED2}', '\u{0ED3}', '\u{0ED4}', '\u{0ED5}', '\u{0ED6}', '\u{0ED7}', '\u{0ED8}', '\u{0ED9}', '\u{0F20}', '\u{0F21}', '\u{0F22}', '\u{0F23}', '\u{0F24}', '\u{0F25}', '\u{0F26}', '\u{0F27}', '\u{0F28}', '\u{0F29}', '\u{1040}', '\u{1041}', '\u{1042}', '\u{1043}', '\u{1044}', '\u{1045}', '\u{1046}', '\u{1047}', '\u{1048}', '\u{1049}', '\u{1090}', '\u{1091}', '\u{1092}', '\u{1093}', '\u{1094}', '\u{1095}', '\u{1096}', '\u{1097}', '\u{1098}', '\u{1099}', '\u{17E0}', '\u{17E1}', '\u{17E2}', '\u{17E3}', '\u{17E4}', '\u{17E5}', '\u{17E6}', '\u{17E7}', '\u{17E8}', '\u{17E9}', '\u{1810}', '\u{1811}', '\u{1812}', '\u{1813}', '\u{1814}', '\u{1815}', '\u{1816}', '\u{1817}', '\u{1818}', '\u{1819}', '\u{1946}', '\u{1947}', '\u{1948}', '\u{1949}', '\u{194A}', '\u{194B}', '\u{194C}', '\u{194D}', '\u{194E}', '\u{194F}', '\u{19D0}', '\u{19D1}', '\u{19D2}', '\u{19D3}', '\u{19D4}', '\u{19D5}', '\u{19D6}', '\u{19D7}', '\u{19D8}', '\u{19D9}', '\u{1B50}', '\u{1B51}', '\u{1B52}', '\u{1B53}', '\u{1B54}', '\u{1B55}', '\u{1B56}', '\u{1B57}', '\u{1B58}', '\u{1B59}', '\u{1BB0}', '\u{1BB1}', '\u{1BB2}', '\u{1BB3}', '\u{1BB4}', '\u{1BB5}', '\u{1BB6}', '\u{1BB7}', '\u{1BB8}', '\u{1BB9}', '\u{1C40}', '\u{1C41}', '\u{1C42}', '\u{1C43}', '\u{1C44}', '\u{1C45}', '\u{1C46}', '\u{1C47}', '\u{1C48}', '\u{1C49}', '\u{1C50}', '\u{1C51}', '\u{1C52}', '\u{1C53}', '\u{1C54}', '\u{1C55}', '\u{1C56}', '\u{1C57}', '\u{1C58}', '\u{1C59}', '\u{A620}', '\u{A621}', '\u{A622}', '\u{A623}', '\u{A624}', '\u{A625}', '\u{A626}', '\u{A627}', '\u{A628}', '\u{A629}', '\u{A8D0}', '\u{A8D1}', '\u{A8D2}', '\u{A8D3}', '\u{A8D4}', '\u{A8D5}', '\u{A8D6}', '\u{A8D7}', '\u{A8D8}', '\u{A8D9}', '\u{A900}', '\u{A901}', '\u{A902}', '\u{A903}', '\u{A904}', '\u{A905}', '\u{A906}', '\u{A907}', '\u{A908}', '\u{A909}', '\u{AA50}', '\u{AA51}', '\u{AA52}', '\u{AA53}', '\u{AA54}', '\u{AA55}', '\u{AA56}', '\u{AA57}', '\u{AA58}', '\u{AA59}', '\u{FF10}', '\u{FF11}', '\u{FF12}', '\u{FF13}', '\u{FF14}', '\u{FF15}', '\u{FF16}', '\u{FF17}', '\u{FF18}', '\u{FF19}') + } + + fn is_unicode_connector_punctiation(self) -> bool { + match_char_class!(self, + '\u{005F}', '\u{203F}', '\u{2040}', '\u{2054}', '\u{FE33}', '\u{FE34}', '\u{FE4D}', '\u{FE4E}', '\u{FE4F}', '\u{FF3F}') + } + + fn is_unicode_space_separator(self) -> bool { + match_char_class!(self, + '\u{0020}', '\u{00A0}', '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}', '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}', '\u{2009}', '\u{200A}', '\u{202F}', '\u{205F}', '\u{3000}') + } + + fn is_es_identifier_start(self) -> bool { + match self { + '$' | '_' | '\\' => true, + c if c.is_unicode_letter() => true, + _ => false + } + } + + // see section 7.6 + fn is_es_identifier_part(self) -> bool { + match self { + '\u{200C}' | '\u{200D}' => true, + c if c.is_es_identifier_start() => true, + c if c.is_unicode_combining_spacing_mark() => true, + c if c.is_unicode_nonspacing_mark() => true, + c if c.is_unicode_decimal_number() => true, + c if c.is_unicode_connector_punctiation() => true, + _ => false + } + } + + fn is_es_whitespace(self) -> bool { + match self { + '\t' | '\u{000B}' | '\u{000C}' | '\u{0020}' | '\u{00A0}' | '\u{FEFF}' => true, + c => c.is_unicode_space_separator() + } + } + + fn is_es_line_terminator(self) -> bool { + match self { + '\n' | '\r' | '\u{2028}' | '\u{2029}' => true, + _ => false + } + } +} + +fn main() { + +} diff --git a/src/test/run-pass/issues/issue-29276.rs b/src/test/run-pass/issues/issue-29276.rs new file mode 100644 index 00000000000..6797dbc31c1 --- /dev/null +++ b/src/test/run-pass/issues/issue-29276.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S([u8; { struct Z; 0 }]); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-2935.rs b/src/test/run-pass/issues/issue-2935.rs new file mode 100644 index 00000000000..d2af8325181 --- /dev/null +++ b/src/test/run-pass/issues/issue-2935.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +//type t = { a: isize }; +// type t = { a: bool }; +type t = bool; + +trait it { + fn f(&self); +} + +impl it for t { + fn f(&self) { } +} + +pub fn main() { + // let x = ({a: 4} as it); + // let y = box ({a: 4}); + // let z = box ({a: 4} as it); + // let z = box ({a: true} as it); + let z: Box<_> = box (box true as Box); + // x.f(); + // y.f(); + // (*z).f(); + println!("ok so far..."); + z.f(); //segfault +} diff --git a/src/test/run-pass/issues/issue-2936.rs b/src/test/run-pass/issues/issue-2936.rs new file mode 100644 index 00000000000..84201348af3 --- /dev/null +++ b/src/test/run-pass/issues/issue-2936.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +trait bar { + fn get_bar(&self) -> T; +} + +fn foo>(b: U) -> T { + b.get_bar() +} + +struct cbar { + x: isize, +} + +impl bar for cbar { + fn get_bar(&self) -> isize { + self.x + } +} + +fn cbar(x: isize) -> cbar { + cbar { + x: x + } +} + +pub fn main() { + let x: isize = foo::(cbar(5)); + assert_eq!(x, 5); +} diff --git a/src/test/run-pass/issues/issue-29466.rs b/src/test/run-pass/issues/issue-29466.rs new file mode 100644 index 00000000000..1c8fc88f8f2 --- /dev/null +++ b/src/test/run-pass/issues/issue-29466.rs @@ -0,0 +1,3608 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! m( + ($e1:expr => $e2:expr) => ({ $e1 }) +); + +fn main() { + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + let x = m!(1 => 2); + + println!("{}", x); +} diff --git a/src/test/run-pass/issues/issue-29485.rs b/src/test/run-pass/issues/issue-29485.rs new file mode 100644 index 00000000000..67725b02ded --- /dev/null +++ b/src/test/run-pass/issues/issue-29485.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-29485.rs +// ignore-emscripten no threads + +#[feature(recover)] + +extern crate a; + +fn main() { + let _ = std::thread::spawn(move || { + a::f(&mut a::X(0), g); + }).join(); +} + +fn g() { + panic!(); +} diff --git a/src/test/run-pass/issues/issue-29488.rs b/src/test/run-pass/issues/issue-29488.rs new file mode 100644 index 00000000000..d9d53ceaaeb --- /dev/null +++ b/src/test/run-pass/issues/issue-29488.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) { + println!("test2"); + } +} + +thread_local!(static FOO: Foo = Foo); + +fn main() { + // Off the main thread due to #28129, be sure to initialize FOO first before + // calling `println!` + thread::spawn(|| { + FOO.with(|_| {}); + println!("test1"); + }).join().unwrap(); +} diff --git a/src/test/run-pass/issues/issue-29516.rs b/src/test/run-pass/issues/issue-29516.rs new file mode 100644 index 00000000000..55caa65f1cf --- /dev/null +++ b/src/test/run-pass/issues/issue-29516.rs @@ -0,0 +1,29 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(optin_builtin_traits)] + +auto trait NotSame {} + +impl !NotSame for (A, A) {} + +trait OneOfEach {} + +impl OneOfEach for (A,) {} + +impl OneOfEach for (A, B) +where + (B,): OneOfEach, + (A, B): NotSame, +{ +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-29522.rs b/src/test/run-pass/issues/issue-29522.rs new file mode 100644 index 00000000000..9d5a12dadbe --- /dev/null +++ b/src/test/run-pass/issues/issue-29522.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that we don't accidentally capture upvars just because their name +// occurs in a path + +fn assert_static(_t: T) {} + +mod foo { + pub fn scope() {} +} + +fn main() { + let scope = &mut 0; + assert_static(|| { + foo::scope(); + }); +} diff --git a/src/test/run-pass/issues/issue-29540.rs b/src/test/run-pass/issues/issue-29540.rs new file mode 100644 index 00000000000..7e01efcd05f --- /dev/null +++ b/src/test/run-pass/issues/issue-29540.rs @@ -0,0 +1,502 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +pub struct Config { + pub name: String, + pub cluster: String, + pub debug_none: String, + pub debug_lockdep: String, + pub debug_context: String, + pub debug_crush: String, + pub debug_mds: String, + pub debug_mds_balancer: String, + pub debug_mds_locker: String, + pub debug_mds_log: String, + pub debug_mds_log_expire: String, + pub debug_mds_migrator: String, + pub debug_buffer: String, + pub debug_timer: String, + pub debug_filer: String, + pub debug_striper: String, + pub debug_objecter: String, + pub debug_rados: String, + pub debug_rbd: String, + pub debug_journaler: String, + pub debug_objectcacher: String, + pub debug_client: String, + pub debug_osd: String, + pub debug_optracker: String, + pub debug_objclass: String, + pub debug_filestore: String, + pub debug_keyvaluestore: String, + pub debug_journal: String, + pub debug_ms: String, + pub debug_mon: String, + pub debug_monc: String, + pub debug_paxos: String, + pub debug_tp: String, + pub debug_auth: String, + pub debug_crypto: String, + pub debug_finisher: String, + pub debug_heartbeatmap: String, + pub debug_perfcounter: String, + pub debug_rgw: String, + pub debug_civetweb: String, + pub debug_javaclient: String, + pub debug_asok: String, + pub debug_throttle: String, + pub host: String, + pub fsid: String, + pub public_addr: String, + pub cluster_addr: String, + pub public_network: String, + pub cluster_network: String, + pub num_client: String, + pub monmap: String, + pub mon_host: String, + pub lockdep: String, + pub run_dir: String, + pub admin_socket: String, + pub daemonize: String, + pub pid_file: String, + pub chdir: String, + pub max_open_files: String, + pub restapi_log_level: String, + pub restapi_base_url: String, + pub fatal_signal_handlers: String, + pub log_file: String, + pub log_max_new: String, + pub log_max_recent: String, + pub log_to_stderr: String, + pub err_to_stderr: String, + pub log_to_syslog: String, + pub err_to_syslog: String, + pub log_flush_on_exit: String, + pub log_stop_at_utilization: String, + pub clog_to_monitors: String, + pub clog_to_syslog: String, + pub clog_to_syslog_level: String, + pub clog_to_syslog_facility: String, + pub mon_cluster_log_to_syslog: String, + pub mon_cluster_log_to_syslog_level: String, + pub mon_cluster_log_to_syslog_facility: String, + pub mon_cluster_log_file: String, + pub mon_cluster_log_file_level: String, + pub key: String, + pub keyfile: String, + pub keyring: String, + pub heartbeat_interval: String, + pub heartbeat_file: String, + pub heartbeat_inject_failure: String, + pub perf: String, + pub ms_tcp_nodelay: String, + pub ms_tcp_rcvbuf: String, + pub ms_initial_backoff: String, + pub ms_max_backoff: String, + pub ms_nocrc: String, + pub ms_die_on_bad_msg: String, + pub ms_die_on_unhandled_msg: String, + pub ms_die_on_old_message: String, + pub ms_dispatch_throttle_bytes: String, + pub ms_bind_ipv6: String, + pub ms_bind_port_min: String, + pub ms_bind_port_max: String, + pub ms_rwthread_stack_bytes: String, + pub ms_tcp_read_timeout: String, + pub ms_pq_max_tokens_per_priority: String, + pub ms_pq_min_cost: String, + pub ms_inject_socket_failures: String, + pub ms_inject_delay_type: String, + pub ms_inject_delay_msg_type: String, + pub ms_inject_delay_max: String, + pub ms_inject_delay_probability: String, + pub ms_inject_internal_delays: String, + pub ms_dump_on_send: String, + pub inject_early_sigterm: String, + pub mon_data: String, + pub mon_initial_members: String, + pub mon_sync_fs_threshold: String, + pub mon_compact_on_start: String, + pub mon_compact_on_bootstrap: String, + pub mon_compact_on_trim: String, + pub mon_tick_interval: String, + pub mon_subscribe_interval: String, + pub mon_delta_reset_interval: String, + pub mon_osd_laggy_halflife: String, + pub mon_osd_laggy_weight: String, + pub mon_osd_adjust_heartbeat_grace: String, + pub mon_osd_adjust_down_out_interval: String, + pub mon_osd_auto_mark_in: String, + pub mon_osd_auto_mark_auto_out_in: String, + pub mon_osd_auto_mark_new_in: String, + pub mon_osd_down_out_interval: String, + pub mon_osd_down_out_subtree_limit: String, + pub mon_osd_min_up_ratio: String, + pub mon_osd_min_in_ratio: String, + pub mon_osd_max_op_age: String, + pub mon_osd_max_split_count: String, + pub mon_osd_allow_primary_temp: String, + pub mon_osd_allow_primary_affinity: String, + pub mon_stat_smooth_intervals: String, + pub mon_lease: String, + pub mon_lease_renew_interval: String, + pub mon_lease_ack_timeout: String, + pub mon_clock_drift_allowed: String, + pub mon_clock_drift_warn_backoff: String, + pub mon_timecheck_interval: String, + pub mon_accept_timeout: String, + pub mon_pg_create_interval: String, + pub mon_pg_stuck_threshold: String, + pub mon_pg_warn_min_per_osd: String, + pub mon_pg_warn_max_object_skew: String, + pub mon_pg_warn_min_objects: String, + pub mon_pg_warn_min_pool_objects: String, + pub mon_cache_target_full_warn_ratio: String, + pub mon_osd_full_ratio: String, + pub mon_osd_nearfull_ratio: String, + pub mon_globalid_prealloc: String, + pub mon_osd_report_timeout: String, + pub mon_force_standby_active: String, + pub mon_warn_on_old_mons: String, + pub mon_warn_on_legacy_crush_tunables: String, + pub mon_warn_on_osd_down_out_interval_zero: String, + pub mon_warn_on_cache_pools_without_hit_sets: String, + pub mon_min_osdmap_epochs: String, + pub mon_max_pgmap_epochs: String, + pub mon_max_log_epochs: String, + pub mon_max_mdsmap_epochs: String, + pub mon_max_osd: String, + pub mon_probe_timeout: String, + pub mon_slurp_timeout: String, + pub mon_slurp_bytes: String, + pub mon_client_bytes: String, + pub mon_daemon_bytes: String, + pub mon_max_log_entries_per_event: String, + pub mon_health_data_update_interval: String, + pub mon_data_avail_crit: String, + pub mon_data_avail_warn: String, + pub mon_config_key_max_entry_size: String, + pub mon_sync_timeout: String, + pub mon_sync_max_payload_size: String, + pub mon_sync_debug: String, + pub mon_sync_debug_leader: String, + pub mon_sync_debug_provider: String, + pub mon_sync_debug_provider_fallback: String, + pub mon_inject_sync_get_chunk_delay: String, + pub mon_osd_min_down_reporters: String, + pub mon_osd_min_down_reports: String, + pub mon_osd_force_trim_to: String, + pub mon_mds_force_trim_to: String, + pub mon_advanced_debug_mode: String, + pub mon_debug_dump_transactions: String, + pub mon_debug_dump_location: String, + pub mon_sync_provider_kill_at: String, + pub mon_sync_requester_kill_at: String, + pub mon_leveldb_write_buffer_size: String, + pub mon_leveldb_cache_size: String, + pub mon_leveldb_block_size: String, + pub mon_leveldb_bloom_size: String, + pub mon_leveldb_max_open_files: String, + pub mon_leveldb_compression: String, + pub mon_leveldb_paranoid: String, + pub mon_leveldb_log: String, + pub mon_leveldb_size_warn: String, + pub mon_force_quorum_join: String, + pub paxos_stash_full_interval: String, + pub paxos_max_join_drift: String, + pub paxos_propose_interval: String, + pub paxos_min_wait: String, + pub paxos_min: String, + pub paxos_trim_min: String, + pub paxos_trim_max: String, + pub paxos_service_trim_min: String, + pub paxos_service_trim_max: String, + pub paxos_kill_at: String, + pub clock_offset: String, + pub auth_cluster_required: String, + pub auth_service_required: String, + pub auth_client_required: String, + pub auth_supported: String, + pub cephx_require_signatures: String, + pub cephx_cluster_require_signatures: String, + pub cephx_service_require_signatures: String, + pub cephx_sign_messages: String, + pub auth_mon_ticket_ttl: String, + pub auth_service_ticket_ttl: String, + pub auth_debug: String, + pub mon_client_hunt_interval: String, + pub mon_client_ping_interval: String, + pub mon_client_ping_timeout: String, + pub mon_client_hunt_interval_backoff: String, + pub mon_client_hunt_interval_max_multiple: String, + pub mon_client_max_log_entries_per_message: String, + pub mon_max_pool_pg_num: String, + pub mon_pool_quota_warn_threshold: String, + pub mon_pool_quota_crit_threshold: String, + pub client_cache_size: String, + pub client_cache_mid: String, + pub client_use_random_mds: String, + pub client_mount_timeout: String, + pub client_tick_interval: String, + pub client_trace: String, + pub client_readahead_min: String, + pub client_readahead_max_bytes: String, + pub client_readahead_max_periods: String, + pub client_snapdir: String, + pub client_mountpoint: String, + pub client_notify_timeout: String, + pub osd_client_watch_timeout: String, + pub client_caps_release_delay: String, + pub client_oc: String, + pub client_oc_size: String, + pub client_oc_max_dirty: String, + pub client_oc_target_dirty: String, + pub client_oc_max_dirty_age: String, + pub client_oc_max_objects: String, + pub client_debug_force_sync_read: String, + pub client_debug_inject_tick_delay: String, + pub client_max_inline_size: String, + pub fuse_use_invalidate_cb: String, + pub fuse_allow_other: String, + pub fuse_default_permissions: String, + pub fuse_big_writes: String, + pub fuse_atomic_o_trunc: String, + pub fuse_debug: String, + pub fuse_multithreaded: String, + pub crush_location: String, + pub objecter_tick_interval: String, + pub objecter_timeout: String, + pub objecter_inflight_op_bytes: String, + pub objecter_inflight_ops: String, + pub journaler_allow_split_entries: String, + pub journaler_write_head_interval: String, + pub journaler_prefetch_periods: String, + pub journaler_prezero_periods: String, + pub journaler_batch_interval: String, + pub journaler_batch_max: String, + pub mds_data: String, + pub mds_max_file_size: String, + pub mds_cache_size: String, + pub mds_cache_mid: String, + pub mds_mem_max: String, + pub mds_dir_max_commit_size: String, + pub mds_decay_halflife: String, + pub mds_beacon_interval: String, + pub mds_beacon_grace: String, + pub mds_enforce_unique_name: String, + pub mds_blacklist_interval: String, + pub mds_session_timeout: String, + pub mds_freeze_tree_timeout: String, + pub mds_session_autoclose: String, + pub mds_reconnect_timeout: String, + pub mds_tick_interval: String, + pub mds_dirstat_min_interval: String, + pub mds_scatter_nudge_interval: String, + pub mds_client_prealloc_inos: String, + pub mds_early_reply: String, + pub mds_default_dir_hash: String, + pub mds_log: String, + pub mds_log_skip_corrupt_events: String, + pub mds_log_max_events: String, + pub mds_log_segment_size: String, + pub mds_log_max_segments: String, + pub mds_log_max_expiring: String, + pub mds_bal_sample_interval: String, + pub mds_bal_replicate_threshold: String, + pub mds_bal_unreplicate_threshold: String, + pub mds_bal_frag: String, + pub mds_bal_split_size: String, + pub mds_bal_split_rd: String, + pub mds_bal_split_wr: String, + pub mds_bal_split_bits: String, + pub mds_bal_merge_size: String, + pub mds_bal_merge_rd: String, + pub mds_bal_merge_wr: String, + pub mds_bal_interval: String, + pub mds_bal_fragment_interval: String, + pub mds_bal_idle_threshold: String, + pub mds_bal_max: String, + pub mds_bal_max_until: String, + pub mds_bal_mode: String, + pub mds_bal_min_rebalance: String, + pub mds_bal_min_start: String, + pub mds_bal_need_min: String, + pub mds_bal_need_max: String, + pub mds_bal_midchunk: String, + pub mds_bal_minchunk: String, + pub mds_bal_target_removal_min: String, + pub mds_bal_target_removal_max: String, + pub mds_replay_interval: String, + pub mds_shutdown_check: String, + pub mds_thrash_exports: String, + pub mds_thrash_fragments: String, + pub mds_dump_cache_on_map: String, + pub mds_dump_cache_after_rejoin: String, + pub mds_verify_scatter: String, + pub mds_debug_scatterstat: String, + pub mds_debug_frag: String, + pub mds_debug_auth_pins: String, + pub mds_debug_subtrees: String, + pub mds_kill_mdstable_at: String, + pub mds_kill_export_at: String, + pub mds_kill_import_at: String, + pub mds_kill_link_at: String, + pub mds_kill_rename_at: String, + pub mds_kill_openc_at: String, + pub mds_kill_journal_at: String, + pub mds_kill_journal_expire_at: String, + pub mds_kill_journal_replay_at: String, + pub mds_kill_create_at: String, + pub mds_open_remote_link_mode: String, + pub mds_inject_traceless_reply_probability: String, + pub mds_wipe_sessions: String, + pub mds_wipe_ino_prealloc: String, + pub mds_skip_ino: String, + pub max_mds: String, + pub mds_standby_for_name: String, + pub mds_standby_for_rank: String, + pub mds_standby_replay: String, + pub osd_compact_leveldb_on_mount: String, + pub osd_max_backfills: String, + pub osd_backfill_full_ratio: String, + pub osd_backfill_retry_interval: String, + pub osd_agent_max_ops: String, + pub osd_agent_min_evict_effort: String, + pub osd_agent_quantize_effort: String, + pub osd_agent_delay_time: String, + pub osd_agent_hist_halflife: String, + pub osd_agent_slop: String, + pub osd_uuid: String, + pub osd_data: String, + pub osd_journal: String, + pub osd_journal_size: String, + pub osd_max_write_size: String, + pub osd_max_pgls: String, + pub osd_client_message_size_cap: String, + pub osd_client_message_cap: String, + pub osd_pg_bits: String, + pub osd_pgp_bits: String, + pub osd_crush_chooseleaf_type: String, + pub osd_pool_default_crush_rule: String, + pub osd_pool_default_crush_replicated_ruleset: String, + pub osd_pool_erasure_code_stripe_width: String, + pub osd_pool_default_size: String, + pub osd_pool_default_min_size: String, + pub osd_pool_default_pg_num: String, + pub osd_pool_default_pgp_num: String, + pub osd_pool_default_erasure_code_directory: String, + pub osd_pool_default_erasure_code_profile: String, + pub osd_erasure_code_plugins: String, + pub osd_pool_default_flags: String, + pub osd_pool_default_flag_hashpspool: String, + pub osd_pool_default_hit_set_bloom_fpp: String, + pub osd_pool_default_cache_target_dirty_ratio: String, + pub osd_pool_default_cache_target_full_ratio: String, + pub osd_pool_default_cache_min_flush_age: String, + pub osd_pool_default_cache_min_evict_age: String, + pub osd_hit_set_min_size: String, + pub osd_hit_set_max_size: String, + pub osd_hit_set_namespace: String, + pub osd_tier_default_cache_mode: String, + pub osd_tier_default_cache_hit_set_count: String, + pub osd_tier_default_cache_hit_set_period: String, + pub osd_tier_default_cache_hit_set_type: String, + pub osd_map_dedup: String, + pub osd_map_max_advance: String, + pub osd_map_cache_size: String, + pub osd_map_message_max: String, + pub osd_map_share_max_epochs: String, + pub osd_op_threads: String, + pub osd_peering_wq_batch_size: String, + pub osd_op_pq_max_tokens_per_priority: String, + pub osd_op_pq_min_cost: String, + pub osd_disk_threads: String, + pub osd_disk_thread_ioprio_class: String, + pub osd_disk_thread_ioprio_priority: String, + pub osd_recovery_threads: String, + pub osd_recover_clone_overlap: String, + pub osd_recover_clone_overlap_limit: String, + pub osd_backfill_scan_min: String, + pub osd_backfill_scan_max: String, + pub osd_op_thread_timeout: String, + pub osd_recovery_thread_timeout: String, + pub osd_snap_trim_thread_timeout: String, + pub osd_snap_trim_sleep: String, + pub osd_scrub_thread_timeout: String, + pub osd_scrub_finalize_thread_timeout: String, + pub osd_scrub_invalid_stats: String, + pub osd_remove_thread_timeout: String, + pub osd_command_thread_timeout: String, + pub osd_age: String, + pub osd_age_time: String, + pub osd_heartbeat_addr: String, + pub osd_heartbeat_interval: String, + pub osd_heartbeat_grace: String, + pub osd_heartbeat_min_peers: String, + pub osd_pg_max_concurrent_snap_trims: String, + pub osd_heartbeat_min_healthy_ratio: String, + pub osd_mon_heartbeat_interval: String, + pub osd_mon_report_interval_max: String, + pub osd_mon_report_interval_min: String, + pub osd_pg_stat_report_interval_max: String, + pub osd_mon_ack_timeout: String, + pub osd_default_data_pool_replay_window: String, + pub osd_preserve_trimmed_log: String, + pub osd_auto_mark_unfound_lost: String, + pub osd_recovery_delay_start: String, + pub osd_recovery_max_active: String, + pub osd_recovery_max_single_start: String, + pub osd_recovery_max_chunk: String, + pub osd_copyfrom_max_chunk: String, + pub osd_push_per_object_cost: String, + pub osd_max_push_cost: String, + pub osd_max_push_objects: String, + pub osd_recovery_forget_lost_objects: String, + pub osd_max_scrubs: String, + pub osd_scrub_load_threshold: String, + pub osd_scrub_min_interval: String, + pub osd_scrub_max_interval: String, + pub osd_scrub_chunk_min: String, + pub osd_scrub_chunk_max: String, + pub osd_scrub_sleep: String, + pub osd_deep_scrub_interval: String, + pub osd_deep_scrub_stride: String, + pub osd_scan_list_ping_tp_interval: String, + pub osd_auto_weight: String, + pub osd_class_dir: String, + pub osd_open_classes_on_start: String, + pub osd_check_for_log_corruption: String, + pub osd_use_stale_snap: String, + pub osd_rollback_to_cluster_snap: String, + pub osd_default_notify_timeout: String, + pub osd_kill_backfill_at: String, + pub osd_pg_epoch_persisted_max_stale: String, + pub osd_min_pg_log_entries: String, + pub osd_max_pg_log_entries: String, + pub osd_op_complaint_time: String, + pub osd_command_max_records: String, + pub osd_op_log_threshold: String, + pub osd_verify_sparse_read_holes: String, + pub osd_debug_drop_ping_probability: String, + pub osd_debug_drop_ping_duration: String, + pub osd_debug_drop_pg_create_probability: String, + pub osd_debug_drop_pg_create_duration: String, + pub osd_debug_drop_op_probability: String, + pub osd_debug_op_order: String, + pub osd_debug_verify_snaps_on_info: String, + pub osd_debug_verify_stray_on_activate: String, + pub osd_debug_skip_full_check_in_backfill_reservation: String, + pub osd_debug_reject_backfill_probability: String, + pub osd_enable_op_tracker: String, +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-29663.rs b/src/test/run-pass/issues/issue-29663.rs new file mode 100644 index 00000000000..709bea268d1 --- /dev/null +++ b/src/test/run-pass/issues/issue-29663.rs @@ -0,0 +1,66 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +// write_volatile causes an LLVM assert with composite types + +#![feature(volatile)] +use std::ptr::{read_volatile, write_volatile}; + +#[derive(Debug, Eq, PartialEq)] +struct A(u32); +#[derive(Debug, Eq, PartialEq)] +struct B(u64); +#[derive(Debug, Eq, PartialEq)] +struct C(u32, u32); +#[derive(Debug, Eq, PartialEq)] +struct D(u64, u64); +#[derive(Debug, Eq, PartialEq)] +struct E([u64; 32]); + +fn main() { + unsafe { + let mut x: u32 = 0; + write_volatile(&mut x, 1); + assert_eq!(read_volatile(&x), 1); + assert_eq!(x, 1); + + let mut x: u64 = 0; + write_volatile(&mut x, 1); + assert_eq!(read_volatile(&x), 1); + assert_eq!(x, 1); + + let mut x = A(0); + write_volatile(&mut x, A(1)); + assert_eq!(read_volatile(&x), A(1)); + assert_eq!(x, A(1)); + + let mut x = B(0); + write_volatile(&mut x, B(1)); + assert_eq!(read_volatile(&x), B(1)); + assert_eq!(x, B(1)); + + let mut x = C(0, 0); + write_volatile(&mut x, C(1, 1)); + assert_eq!(read_volatile(&x), C(1, 1)); + assert_eq!(x, C(1, 1)); + + let mut x = D(0, 0); + write_volatile(&mut x, D(1, 1)); + assert_eq!(read_volatile(&x), D(1, 1)); + assert_eq!(x, D(1, 1)); + + let mut x = E([0; 32]); + write_volatile(&mut x, E([1; 32])); + assert_eq!(read_volatile(&x), E([1; 32])); + assert_eq!(x, E([1; 32])); + } +} diff --git a/src/test/run-pass/issues/issue-29668.rs b/src/test/run-pass/issues/issue-29668.rs new file mode 100644 index 00000000000..f10152b29c9 --- /dev/null +++ b/src/test/run-pass/issues/issue-29668.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Functions can return unnameable types + +mod m1 { + mod m2 { + #[derive(Debug)] + pub struct A; + } + use self::m2::A; + pub fn x() -> A { A } +} + +fn main() { + let x = m1::x(); + println!("{:?}", x); +} diff --git a/src/test/run-pass/issues/issue-29710.rs b/src/test/run-pass/issues/issue-29710.rs new file mode 100644 index 00000000000..fa768340b71 --- /dev/null +++ b/src/test/run-pass/issues/issue-29710.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(unused_results)] +#![allow(dead_code)] + +#[derive(Debug)] +struct A(usize); + +#[derive(Debug)] +struct B { a: usize } + +fn main() {} diff --git a/src/test/run-pass/issues/issue-29740.rs b/src/test/run-pass/issues/issue-29740.rs new file mode 100644 index 00000000000..b0959e83009 --- /dev/null +++ b/src/test/run-pass/issues/issue-29740.rs @@ -0,0 +1,326 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #29740. Inefficient MIR matching algorithms +// generated way too much code for this sort of case, leading to OOM. +#![allow(non_snake_case)] + +pub mod KeyboardEventConstants { + pub const DOM_KEY_LOCATION_STANDARD: u32 = 0; + pub const DOM_KEY_LOCATION_LEFT: u32 = 1; + pub const DOM_KEY_LOCATION_RIGHT: u32 = 2; + pub const DOM_KEY_LOCATION_NUMPAD: u32 = 3; +} // mod KeyboardEventConstants + +pub enum Key { + Space, + Apostrophe, + Comma, + Minus, + Period, + Slash, + Num0, + Num1, + Num2, + Num3, + Num4, + Num5, + Num6, + Num7, + Num8, + Num9, + Semicolon, + Equal, + A, + B, + C, + D, + E, + F, + G, + H, + I, + J, + K, + L, + M, + N, + O, + P, + Q, + R, + S, + T, + U, + V, + W, + X, + Y, + Z, + LeftBracket, + Backslash, + RightBracket, + GraveAccent, + World1, + World2, + + Escape, + Enter, + Tab, + Backspace, + Insert, + Delete, + Right, + Left, + Down, + Up, + PageUp, + PageDown, + Home, + End, + CapsLock, + ScrollLock, + NumLock, + PrintScreen, + Pause, + F1, + F2, + F3, + F4, + F5, + F6, + F7, + F8, + F9, + F10, + F11, + F12, + F13, + F14, + F15, + F16, + F17, + F18, + F19, + F20, + F21, + F22, + F23, + F24, + F25, + Kp0, + Kp1, + Kp2, + Kp3, + Kp4, + Kp5, + Kp6, + Kp7, + Kp8, + Kp9, + KpDecimal, + KpDivide, + KpMultiply, + KpSubtract, + KpAdd, + KpEnter, + KpEqual, + LeftShift, + LeftControl, + LeftAlt, + LeftSuper, + RightShift, + RightControl, + RightAlt, + RightSuper, + Menu, +} + +fn key_from_string(key_string: &str, location: u32) -> Option { + match key_string { + " " => Some(Key::Space), + "\"" => Some(Key::Apostrophe), + "'" => Some(Key::Apostrophe), + "<" => Some(Key::Comma), + "," => Some(Key::Comma), + "_" => Some(Key::Minus), + "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Minus), + ">" => Some(Key::Period), + "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Period), + "?" => Some(Key::Slash), + "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Slash), + "~" => Some(Key::GraveAccent), + "`" => Some(Key::GraveAccent), + ")" => Some(Key::Num0), + "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num0), + "!" => Some(Key::Num1), + "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num1), + "@" => Some(Key::Num2), + "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num2), + "#" => Some(Key::Num3), + "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num3), + "$" => Some(Key::Num4), + "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num4), + "%" => Some(Key::Num5), + "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num5), + "^" => Some(Key::Num6), + "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num6), + "&" => Some(Key::Num7), + "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num7), + "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), + "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), + "(" => Some(Key::Num9), + "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num9), + ":" => Some(Key::Semicolon), + ";" => Some(Key::Semicolon), + "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), + "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), + "A" => Some(Key::A), + "a" => Some(Key::A), + "B" => Some(Key::B), + "b" => Some(Key::B), + "C" => Some(Key::C), + "c" => Some(Key::C), + "D" => Some(Key::D), + "d" => Some(Key::D), + "E" => Some(Key::E), + "e" => Some(Key::E), + "F" => Some(Key::F), + "f" => Some(Key::F), + "G" => Some(Key::G), + "g" => Some(Key::G), + "H" => Some(Key::H), + "h" => Some(Key::H), + "I" => Some(Key::I), + "i" => Some(Key::I), + "J" => Some(Key::J), + "j" => Some(Key::J), + "K" => Some(Key::K), + "k" => Some(Key::K), + "L" => Some(Key::L), + "l" => Some(Key::L), + "M" => Some(Key::M), + "m" => Some(Key::M), + "N" => Some(Key::N), + "n" => Some(Key::N), + "O" => Some(Key::O), + "o" => Some(Key::O), + "P" => Some(Key::P), + "p" => Some(Key::P), + "Q" => Some(Key::Q), + "q" => Some(Key::Q), + "R" => Some(Key::R), + "r" => Some(Key::R), + "S" => Some(Key::S), + "s" => Some(Key::S), + "T" => Some(Key::T), + "t" => Some(Key::T), + "U" => Some(Key::U), + "u" => Some(Key::U), + "V" => Some(Key::V), + "v" => Some(Key::V), + "W" => Some(Key::W), + "w" => Some(Key::W), + "X" => Some(Key::X), + "x" => Some(Key::X), + "Y" => Some(Key::Y), + "y" => Some(Key::Y), + "Z" => Some(Key::Z), + "z" => Some(Key::Z), + "{" => Some(Key::LeftBracket), + "[" => Some(Key::LeftBracket), + "|" => Some(Key::Backslash), + "\\" => Some(Key::Backslash), + "}" => Some(Key::RightBracket), + "]" => Some(Key::RightBracket), + "Escape" => Some(Key::Escape), + "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD + => Some(Key::Enter), + "Tab" => Some(Key::Tab), + "Backspace" => Some(Key::Backspace), + "Insert" => Some(Key::Insert), + "Delete" => Some(Key::Delete), + "ArrowRight" => Some(Key::Right), + "ArrowLeft" => Some(Key::Left), + "ArrowDown" => Some(Key::Down), + "ArrowUp" => Some(Key::Up), + "PageUp" => Some(Key::PageUp), + "PageDown" => Some(Key::PageDown), + "Home" => Some(Key::Home), + "End" => Some(Key::End), + "CapsLock" => Some(Key::CapsLock), + "ScrollLock" => Some(Key::ScrollLock), + "NumLock" => Some(Key::NumLock), + "PrintScreen" => Some(Key::PrintScreen), + "Pause" => Some(Key::Pause), + "F1" => Some(Key::F1), + "F2" => Some(Key::F2), + "F3" => Some(Key::F3), + "F4" => Some(Key::F4), + "F5" => Some(Key::F5), + "F6" => Some(Key::F6), + "F7" => Some(Key::F7), + "F8" => Some(Key::F8), + "F9" => Some(Key::F9), + "F10" => Some(Key::F10), + "F11" => Some(Key::F11), + "F12" => Some(Key::F12), + "F13" => Some(Key::F13), + "F14" => Some(Key::F14), + "F15" => Some(Key::F15), + "F16" => Some(Key::F16), + "F17" => Some(Key::F17), + "F18" => Some(Key::F18), + "F19" => Some(Key::F19), + "F20" => Some(Key::F20), + "F21" => Some(Key::F21), + "F22" => Some(Key::F22), + "F23" => Some(Key::F23), + "F24" => Some(Key::F24), + "F25" => Some(Key::F25), + "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp0), + "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp1), + "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp2), + "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp3), + "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp4), + "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp5), + "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp6), + "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp7), + "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp8), + "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp9), + "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDecimal), + "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDivide), + "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpMultiply), + "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpSubtract), + "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpAdd), + "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD + => Some(Key::KpEnter), + "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpEqual), + "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT + => Some(Key::LeftShift), + "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT + => Some(Key::LeftControl), + "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftAlt), + "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT + => Some(Key::LeftSuper), + "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT + => Some(Key::RightShift), + "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT + => Some(Key::RightControl), + "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightAlt), + "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT + => Some(Key::RightSuper), + "ContextMenu" => Some(Key::Menu), + _ => None + } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-29746.rs b/src/test/run-pass/issues/issue-29746.rs new file mode 100644 index 00000000000..c2072ddddce --- /dev/null +++ b/src/test/run-pass/issues/issue-29746.rs @@ -0,0 +1,46 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// zip!(a1,a2,a3,a4) is equivalent to: +// a1.zip(a2).zip(a3).zip(a4).map(|(((x1,x2),x3),x4)| (x1,x2,x3,x4)) +macro_rules! zip { + // Entry point + ([$a:expr, $b:expr, $($rest:expr),*]) => { + zip!([$($rest),*], $a.zip($b), (x,y), [x,y]) + }; + + // Intermediate steps to build the zipped expression, the match pattern, and + // and the output tuple of the closure, using macro hygiene to repeatedly + // introduce new variables named 'x'. + ([$a:expr, $($rest:expr),*], $zip:expr, $pat:pat, [$($flat:expr),*]) => { + zip!([$($rest),*], $zip.zip($a), ($pat,x), [$($flat),*, x]) + }; + + // Final step + ([], $zip:expr, $pat:pat, [$($flat:expr),+]) => { + $zip.map(|$pat| ($($flat),+)) + }; + + // Comma + ([$a:expr], $zip:expr, $pat:pat, [$($flat:expr),*]) => { + zip!([$a,], $zip, $pat, [$($flat),*]) + }; +} + +fn main() { + let p1 = vec![1i32, 2].into_iter(); + let p2 = vec!["10", "20"].into_iter(); + let p3 = vec![100u16, 200].into_iter(); + let p4 = vec![1000i64, 2000].into_iter(); + + let e = zip!([p1,p2,p3,p4]).collect::>(); + assert_eq!(e[0], (1i32,"10",100u16,1000i64)); +} diff --git a/src/test/run-pass/issues/issue-29844.rs b/src/test/run-pass/issues/issue-29844.rs new file mode 100644 index 00000000000..0a17b708fcf --- /dev/null +++ b/src/test/run-pass/issues/issue-29844.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::sync::Arc; + +pub struct DescriptorSet<'a> { + pub slots: Vec> +} + +pub trait ResourcesTrait<'r>: Sized { + type DescriptorSet: 'r; +} + +pub struct Resources; + +impl<'a> ResourcesTrait<'a> for Resources { + type DescriptorSet = DescriptorSet<'a>; +} + +pub enum AttachInfo<'a, R: ResourcesTrait<'a>> { + NextDescriptorSet(Arc) +} + +fn main() { + let _x = DescriptorSet {slots: Vec::new()}; +} diff --git a/src/test/run-pass/issues/issue-2989.rs b/src/test/run-pass/issues/issue-2989.rs new file mode 100644 index 00000000000..7690d9a6927 --- /dev/null +++ b/src/test/run-pass/issues/issue-2989.rs @@ -0,0 +1,46 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +trait methods { + fn to_bytes(&self) -> Vec ; +} + +impl methods for () { + fn to_bytes(&self) -> Vec { + Vec::new() + } +} + +// the position of this function is significant! - if it comes before methods +// then it works, if it comes after it then it doesn't! +fn to_bools(bitv: Storage) -> Vec { + (0..8).map(|i| { + let w = i / 64; + let b = i % 64; + let x = 1 & (bitv.storage[w] >> b); + x == 1 + }).collect() +} + +struct Storage { storage: Vec } + +pub fn main() { + let bools = vec![false, false, true, false, false, true, true, false]; + let bools2 = to_bools(Storage{storage: vec![0b01100100]}); + + for i in 0..8 { + println!("{} => {} vs {}", i, bools[i], bools2[i]); + } + + assert_eq!(bools, bools2); +} diff --git a/src/test/run-pass/issues/issue-29914-2.rs b/src/test/run-pass/issues/issue-29914-2.rs new file mode 100644 index 00000000000..e3b9aa1afae --- /dev/null +++ b/src/test/run-pass/issues/issue-29914-2.rs @@ -0,0 +1,16 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const ARR: [usize; 5] = [5, 4, 3, 2, 1]; + +fn main() { + assert_eq!(3, ARR[ARR[3]]); +} diff --git a/src/test/run-pass/issues/issue-29914-3.rs b/src/test/run-pass/issues/issue-29914-3.rs new file mode 100644 index 00000000000..1d54e068a72 --- /dev/null +++ b/src/test/run-pass/issues/issue-29914-3.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const ARR: [usize; 5] = [5, 4, 3, 2, 1]; +const BLA: usize = ARR[ARR[3]]; + +fn main() { + assert_eq!(3, BLA); +} diff --git a/src/test/run-pass/issues/issue-29914.rs b/src/test/run-pass/issues/issue-29914.rs new file mode 100644 index 00000000000..16f03592756 --- /dev/null +++ b/src/test/run-pass/issues/issue-29914.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(const_indexing)] + +const ARR: [usize; 5] = [5, 4, 3, 2, 1]; + +fn main() { + assert_eq!(3, ARR[ARR[3]]); +} diff --git a/src/test/run-pass/issues/issue-29927.rs b/src/test/run-pass/issues/issue-29927.rs new file mode 100644 index 00000000000..4eab938609f --- /dev/null +++ b/src/test/run-pass/issues/issue-29927.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] +struct A { + field: usize, +} +const fn f() -> usize { + 5 +} +fn main() { + let _ = [0; f()]; +} diff --git a/src/test/run-pass/issues/issue-29948.rs b/src/test/run-pass/issues/issue-29948.rs new file mode 100644 index 00000000000..2beaaec55a1 --- /dev/null +++ b/src/test/run-pass/issues/issue-29948.rs @@ -0,0 +1,50 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default + +use std::panic; + +impl<'a> panic::UnwindSafe for Foo<'a> {} +impl<'a> panic::RefUnwindSafe for Foo<'a> {} + +struct Foo<'a>(&'a mut bool); + +impl<'a> Drop for Foo<'a> { + fn drop(&mut self) { + *self.0 = true; + } +} + +fn f(t: T) { + t() +} + +fn main() { + let mut ran_drop = false; + { + let x = Foo(&mut ran_drop); + let x = move || { let _ = x; }; + f(x); + } + assert!(ran_drop); + + let mut ran_drop = false; + { + let x = Foo(&mut ran_drop); + let result = panic::catch_unwind(move || { + let x = move || { let _ = x; panic!() }; + f(x); + }); + assert!(result.is_err()); + } + assert!(ran_drop); +} diff --git a/src/test/run-pass/issues/issue-30018-nopanic.rs b/src/test/run-pass/issues/issue-30018-nopanic.rs new file mode 100644 index 00000000000..bb94d4f8517 --- /dev/null +++ b/src/test/run-pass/issues/issue-30018-nopanic.rs @@ -0,0 +1,112 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// More thorough regression test for Issues #30018 and #30822. This +// attempts to explore different ways that array element construction +// (for both scratch arrays and non-scratch ones) interacts with +// breaks in the control-flow, in terms of the order of evaluation of +// the destructors (which may change; see RFC Issue 744) and the +// number of times that the destructor evaluates for each value (which +// should never exceed 1; this latter case is what #30822 is about). + +use std::cell::RefCell; + +struct D<'a>(&'a RefCell>, i32); + +impl<'a> Drop for D<'a> { + fn drop(&mut self) { + println!("Dropping D({})", self.1); + (self.0).borrow_mut().push(self.1); + } +} + +fn main() { + println!("Start"); + break_during_elem(); + break_after_whole(); + println!("Finis"); +} + +fn break_during_elem() { + let log = &RefCell::new(Vec::new()); + + // CASE 1: Fixed-size array itself is stored in _r slot. + loop { + let _r = [D(log, 10), + D(log, 11), + { D(log, 12); break; }, + D(log, 13)]; + } + assert_eq!(&log.borrow()[..], &[12, 11, 10]); + log.borrow_mut().clear(); + + // CASE 2: Slice (borrow of array) is stored in _r slot. + // This is the case that is actually being reported in #30018. + loop { + let _r = &[D(log, 20), + D(log, 21), + { D(log, 22); break; }, + D(log, 23)]; + } + assert_eq!(&log.borrow()[..], &[22, 21, 20]); + log.borrow_mut().clear(); + + // CASE 3: (Borrow of) slice-index of array is stored in _r slot. + loop { + let _r = &[D(log, 30), + D(log, 31), + { D(log, 32); break; }, + D(log, 33)][..]; + } + assert_eq!(&log.borrow()[..], &[32, 31, 30]); + log.borrow_mut().clear(); +} + +// The purpose of these functions is to test what happens when we +// panic after an array has been constructed in its entirety. +// +// It is meant to act as proof that we still need to continue +// scheduling the destruction of an array even after we've scheduling +// drop for its elements during construction; the latter is tested by +// `fn break_during_elem()`. +fn break_after_whole() { + let log = &RefCell::new(Vec::new()); + + // CASE 1: Fixed-size array itself is stored in _r slot. + loop { + let _r = [D(log, 10), + D(log, 11), + D(log, 12)]; + break; + } + assert_eq!(&log.borrow()[..], &[10, 11, 12]); + log.borrow_mut().clear(); + + // CASE 2: Slice (borrow of array) is stored in _r slot. + loop { + let _r = &[D(log, 20), + D(log, 21), + D(log, 22)]; + break; + } + assert_eq!(&log.borrow()[..], &[20, 21, 22]); + log.borrow_mut().clear(); + + // CASE 3: (Borrow of) slice-index of array is stored in _r slot. + loop { + let _r = &[D(log, 30), + D(log, 31), + D(log, 32)][..]; + break; + } + assert_eq!(&log.borrow()[..], &[30, 31, 32]); + log.borrow_mut().clear(); +} diff --git a/src/test/run-pass/issues/issue-30018-panic.rs b/src/test/run-pass/issues/issue-30018-panic.rs new file mode 100644 index 00000000000..0922cfb9c21 --- /dev/null +++ b/src/test/run-pass/issues/issue-30018-panic.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for Issue #30018. This is very similar to the +// original reported test, except that the panic is wrapped in a +// spawned thread to isolate the expected error result from the +// SIGTRAP injected by the drop-flag consistency checking. + +// ignore-emscripten no threads support + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) {} +} + +fn foo() -> Foo { + panic!(); +} + +fn main() { + use std::thread; + let handle = thread::spawn(|| { + let _ = &[foo()]; + }); + let _ = handle.join(); +} diff --git a/src/test/run-pass/issues/issue-30081.rs b/src/test/run-pass/issues/issue-30081.rs new file mode 100644 index 00000000000..b866f7f8f33 --- /dev/null +++ b/src/test/run-pass/issues/issue-30081.rs @@ -0,0 +1,25 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This used to segfault #30081 + +pub enum Instruction { + Increment(i8), + Loop(Box>), +} + +fn main() { + let instrs: Option<(u8, Box)> = None; + instrs.into_iter() + .map(|(_, instr)| instr) + .map(|instr| match *instr { _other => {} }) + .last(); +} diff --git a/src/test/run-pass/issues/issue-3012-2.rs b/src/test/run-pass/issues/issue-3012-2.rs new file mode 100644 index 00000000000..1a64d6bb9ae --- /dev/null +++ b/src/test/run-pass/issues/issue-3012-2.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-3012-1.rs + +// pretty-expanded FIXME #23616 + +extern crate socketlib; + +use socketlib::socket; + +pub fn main() { + let fd: u32 = 1 as u32; + let _sock: Box<_> = Box::new(socket::socket_handle(fd)); +} diff --git a/src/test/run-pass/issues/issue-30240.rs b/src/test/run-pass/issues/issue-30240.rs new file mode 100644 index 00000000000..c18a821c0e8 --- /dev/null +++ b/src/test/run-pass/issues/issue-30240.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let &ref a = &[0i32] as &[_]; + assert_eq!(a, &[0i32] as &[_]); + + let &ref a = "hello"; + assert_eq!(a, "hello"); + + match "foo" { + "fool" => unreachable!(), + "foo" => {}, + ref _x => unreachable!() + } +} diff --git a/src/test/run-pass/issues/issue-3026.rs b/src/test/run-pass/issues/issue-3026.rs new file mode 100644 index 00000000000..dcd1572c1a4 --- /dev/null +++ b/src/test/run-pass/issues/issue-3026.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +use std::collections::HashMap; + +pub fn main() { + let x: Box<_>; + let mut buggy_map: HashMap = HashMap::new(); + x = box 1; + buggy_map.insert(42, &*x); +} diff --git a/src/test/run-pass/issues/issue-3037.rs b/src/test/run-pass/issues/issue-3037.rs new file mode 100644 index 00000000000..ab2d5a5ae88 --- /dev/null +++ b/src/test/run-pass/issues/issue-3037.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_camel_case_types)] + +enum what { } + +fn what_to_string(x: what) -> String +{ + match x { + } +} + +pub fn main() +{ +} diff --git a/src/test/run-pass/issues/issue-30371.rs b/src/test/run-pass/issues/issue-30371.rs new file mode 100644 index 00000000000..f95d442c1b9 --- /dev/null +++ b/src/test/run-pass/issues/issue-30371.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(unused_variables)] + +fn main() { + for _ in match return () { + () => Some(0), + } {} +} + diff --git a/src/test/run-pass/issues/issue-30490.rs b/src/test/run-pass/issues/issue-30490.rs new file mode 100644 index 00000000000..500999cc1cf --- /dev/null +++ b/src/test/run-pass/issues/issue-30490.rs @@ -0,0 +1,111 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +// Previously libstd would set stdio descriptors of a child process +// by `dup`ing the requested descriptors to inherit directly into the +// stdio descriptors. This, however, would incorrectly handle cases +// where the descriptors to inherit were already stdio descriptors. +// This test checks to avoid that regression. + +#![cfg_attr(unix, feature(libc))] +#![cfg_attr(windows, allow(unused_imports))] + +#[cfg(unix)] +extern crate libc; + +use std::fs::File; +use std::io::{Read, Write}; +use std::io::{stdout, stderr}; +use std::process::{Command, Stdio}; + +#[cfg(unix)] +use std::os::unix::io::FromRawFd; + +#[cfg(not(unix))] +fn main() { + // Bug not present in Windows +} + +#[cfg(unix)] +fn main() { + let mut args = std::env::args(); + let name = args.next().unwrap(); + let args: Vec = args.collect(); + if let Some("--child") = args.get(0).map(|s| &**s) { + return child(); + } else if !args.is_empty() { + panic!("unknown options"); + } + + let stdout_backup = unsafe { libc::dup(libc::STDOUT_FILENO) }; + let stderr_backup = unsafe { libc::dup(libc::STDERR_FILENO) }; + assert!(stdout_backup > -1); + assert!(stderr_backup > -1); + + let (stdout_reader, stdout_writer) = pipe(); + let (stderr_reader, stderr_writer) = pipe(); + assert!(unsafe { libc::dup2(stdout_writer, libc::STDOUT_FILENO) } > -1); + assert!(unsafe { libc::dup2(stderr_writer, libc::STDERR_FILENO) } > -1); + + // Make sure we close any duplicates of the writer end of the pipe, + // otherwise we can get stuck reading from the pipe which has open + // writers but no one supplying any input + assert_eq!(unsafe { libc::close(stdout_writer) }, 0); + assert_eq!(unsafe { libc::close(stderr_writer) }, 0); + + stdout().write_all("parent stdout\n".as_bytes()).expect("failed to write to stdout"); + stderr().write_all("parent stderr\n".as_bytes()).expect("failed to write to stderr"); + + let child = { + Command::new(name) + .arg("--child") + .stdin(Stdio::inherit()) + .stdout(unsafe { Stdio::from_raw_fd(libc::STDERR_FILENO) }) + .stderr(unsafe { Stdio::from_raw_fd(libc::STDOUT_FILENO) }) + .spawn() + }; + + // The Stdio passed into the Command took over (and closed) std{out, err} + // so we should restore them as they were. + assert!(unsafe { libc::dup2(stdout_backup, libc::STDOUT_FILENO) } > -1); + assert!(unsafe { libc::dup2(stderr_backup, libc::STDERR_FILENO) } > -1); + + // Using File as a shim around the descriptor + let mut read = String::new(); + let mut f: File = unsafe { FromRawFd::from_raw_fd(stdout_reader) }; + f.read_to_string(&mut read).expect("failed to read from stdout file"); + assert_eq!(read, "parent stdout\nchild stderr\n"); + + // Using File as a shim around the descriptor + read.clear(); + let mut f: File = unsafe { FromRawFd::from_raw_fd(stderr_reader) }; + f.read_to_string(&mut read).expect("failed to read from stderr file"); + assert_eq!(read, "parent stderr\nchild stdout\n"); + + assert!(child.expect("failed to execute child process").wait().unwrap().success()); +} + +#[cfg(unix)] +fn child() { + stdout().write_all("child stdout\n".as_bytes()).expect("child failed to write to stdout"); + stderr().write_all("child stderr\n".as_bytes()).expect("child failed to write to stderr"); +} + +#[cfg(unix)] +/// Returns a pipe (reader, writer combo) +fn pipe() -> (i32, i32) { + let mut fds = [0; 2]; + assert_eq!(unsafe { libc::pipe(fds.as_mut_ptr()) }, 0); + (fds[0], fds[1]) +} diff --git a/src/test/run-pass/issues/issue-3052.rs b/src/test/run-pass/issues/issue-3052.rs new file mode 100644 index 00000000000..6c2d3899bf3 --- /dev/null +++ b/src/test/run-pass/issues/issue-3052.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +type Connection = Box) + 'static>; + +fn f() -> Option { + let mock_connection: Connection = Box::new(|_| {}); + Some(mock_connection) +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-30530.rs b/src/test/run-pass/issues/issue-30530.rs new file mode 100644 index 00000000000..0e25d72ed88 --- /dev/null +++ b/src/test/run-pass/issues/issue-30530.rs @@ -0,0 +1,36 @@ +// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for Issue #30530: alloca's created for storing +// intermediate scratch values during brace-less match arms need to be +// initialized with their drop-flag set to "dropped" (or else we end +// up running the destructors on garbage data at the end of the +// function). + +pub enum Handler { + Default, + #[allow(dead_code)] + Custom(*mut Box), +} + +fn main() { + take(Handler::Default, Box::new(main)); +} + +#[inline(never)] +pub fn take(h: Handler, f: Box) -> Box { + unsafe { + match h { + Handler::Custom(ptr) => *Box::from_raw(ptr), + Handler::Default => f, + } + } +} diff --git a/src/test/run-pass/issues/issue-30615.rs b/src/test/run-pass/issues/issue-30615.rs new file mode 100644 index 00000000000..28a21adbd29 --- /dev/null +++ b/src/test/run-pass/issues/issue-30615.rs @@ -0,0 +1,15 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + &0u8 as *const u8 as *const PartialEq; + &[0u8] as *const [u8; 1] as *const [u8]; +} diff --git a/src/test/run-pass/issues/issue-30756.rs b/src/test/run-pass/issues/issue-30756.rs new file mode 100644 index 00000000000..6ed0d441b93 --- /dev/null +++ b/src/test/run-pass/issues/issue-30756.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![forbid(unsafe_code)] + +thread_local!(static FOO: u8 = 1); + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-30891.rs b/src/test/run-pass/issues/issue-30891.rs new file mode 100644 index 00000000000..0ec42d44902 --- /dev/null +++ b/src/test/run-pass/issues/issue-30891.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const ERROR_CONST: bool = true; + +fn get() -> bool { + false || ERROR_CONST +} + +pub fn main() { + assert_eq!(get(), true); +} diff --git a/src/test/run-pass/issues/issue-3091.rs b/src/test/run-pass/issues/issue-3091.rs new file mode 100644 index 00000000000..c6103bf017f --- /dev/null +++ b/src/test/run-pass/issues/issue-3091.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let x = 1; + let y = 1; + assert_eq!(&x, &y); +} diff --git a/src/test/run-pass/issues/issue-3109.rs b/src/test/run-pass/issues/issue-3109.rs new file mode 100644 index 00000000000..6017a9ffbe6 --- /dev/null +++ b/src/test/run-pass/issues/issue-3109.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + println!("{:?}", ("hi there!", "you")); +} diff --git a/src/test/run-pass/issues/issue-3121.rs b/src/test/run-pass/issues/issue-3121.rs new file mode 100644 index 00000000000..9d70cf90d1c --- /dev/null +++ b/src/test/run-pass/issues/issue-3121.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +#[derive(Copy, Clone)] +enum side { mayo, catsup, vinegar } +#[derive(Copy, Clone)] +enum order { hamburger, fries(side), shake } +#[derive(Copy, Clone)] +enum meal { to_go(order), for_here(order) } + +fn foo(m: Box, cond: bool) { + match *m { + meal::to_go(_) => { } + meal::for_here(_) if cond => {} + meal::for_here(order::hamburger) => {} + meal::for_here(order::fries(_s)) => {} + meal::for_here(order::shake) => {} + } +} + +pub fn main() { + foo(box meal::for_here(order::hamburger), true) +} diff --git a/src/test/run-pass/issues/issue-31260.rs b/src/test/run-pass/issues/issue-31260.rs new file mode 100644 index 00000000000..6b31a1ac996 --- /dev/null +++ b/src/test/run-pass/issues/issue-31260.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Struct { + pub field: K, +} + +static STRUCT: Struct<&'static [u8]> = Struct { + field: {&[1]} +}; + +static STRUCT2: Struct<&'static [u8]> = Struct { + field: &[1] +}; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-31267-additional.rs b/src/test/run-pass/issues/issue-31267-additional.rs new file mode 100644 index 00000000000..d07cd8e2a77 --- /dev/null +++ b/src/test/run-pass/issues/issue-31267-additional.rs @@ -0,0 +1,30 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(Clone, Copy, Debug)] +struct Bar; + +const BAZ: Bar = Bar; + +#[derive(Debug)] +struct Foo([Bar; 1]); + +struct Biz; + +impl Biz { + const BAZ: Foo = Foo([BAZ; 1]); +} + +fn main() { + let foo = Biz::BAZ; + println!("{:?}", foo); +} diff --git a/src/test/run-pass/issues/issue-31267.rs b/src/test/run-pass/issues/issue-31267.rs new file mode 100644 index 00000000000..761ef1f89ff --- /dev/null +++ b/src/test/run-pass/issues/issue-31267.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #31267 + + +struct Foo; + +impl Foo { + const FOO: [i32; 3] = [0; 3]; +} + +pub fn main() { + let foo = Foo::FOO; + assert_eq!(foo, [0i32, 0, 0]); +} diff --git a/src/test/run-pass/issues/issue-31299.rs b/src/test/run-pass/issues/issue-31299.rs new file mode 100644 index 00000000000..6d3be955577 --- /dev/null +++ b/src/test/run-pass/issues/issue-31299.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #31299. This was generating an overflow error +// because of eager normalization: +// +// proving `M: Sized` requires +// - proving `PtrBack>: Sized` requires +// - normalizing `Vec< as Front>::Back>>: Sized` requires +// - proving `Vec: Front` requires +// - `M: Sized` <-- cycle! +// +// If we skip the normalization step, though, everything goes fine. +// +// This could be fixed by implementing lazy normalization everywhere. +// +// However, we want this to work before then. For that, when checking +// whether a type is Sized we only check that the tails are Sized. As +// PtrBack does not have a tail, we don't need to normalize anything +// and this compiles + +trait Front { + type Back; +} + +impl Front for Vec { + type Back = Vec; +} + +struct PtrBack(Vec); + +struct M(PtrBack>); + +fn main() { + std::mem::size_of::(); +} diff --git a/src/test/run-pass/issues/issue-3149.rs b/src/test/run-pass/issues/issue-3149.rs new file mode 100644 index 00000000000..324aec23ab0 --- /dev/null +++ b/src/test/run-pass/issues/issue-3149.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] +// pretty-expanded FIXME #23616 + +fn Matrix4(m11: T, m12: T, m13: T, m14: T, + m21: T, m22: T, m23: T, m24: T, + m31: T, m32: T, m33: T, m34: T, + m41: T, m42: T, m43: T, m44: T) + -> Matrix4 { + Matrix4 { + m11: m11, m12: m12, m13: m13, m14: m14, + m21: m21, m22: m22, m23: m23, m24: m24, + m31: m31, m32: m32, m33: m33, m34: m34, + m41: m41, m42: m42, m43: m43, m44: m44 + } +} + +struct Matrix4 { + m11: T, m12: T, m13: T, m14: T, + m21: T, m22: T, m23: T, m24: T, + m31: T, m32: T, m33: T, m34: T, + m41: T, m42: T, m43: T, m44: T, +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-31597.rs b/src/test/run-pass/issues/issue-31597.rs new file mode 100644 index 00000000000..50aefb7d870 --- /dev/null +++ b/src/test/run-pass/issues/issue-31597.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Make { + type Out; + + fn make() -> Self::Out; +} + +impl Make for () { + type Out = (); + + fn make() -> Self::Out {} +} + +// Also make sure we don't hit an ICE when the projection can't be known +fn f() -> ::Out { loop {} } + +// ...and that it works with a blanket impl +trait Tr { + type Assoc; +} + +impl Tr for T { + type Assoc = (); +} + +fn g() -> ::Assoc { } + +fn main() {} diff --git a/src/test/run-pass/issues/issue-31702.rs b/src/test/run-pass/issues/issue-31702.rs new file mode 100644 index 00000000000..8ce06e8d343 --- /dev/null +++ b/src/test/run-pass/issues/issue-31702.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-31702-1.rs +// aux-build:issue-31702-2.rs +// ignore-test: FIXME(#31702) when this test was added it was thought that the +// accompanying llvm update would fix it, but +// unfortunately it appears that was not the case. In +// the interest of not deleting the test, though, +// this is just tagged with ignore-test + +// this test is actually entirely in the linked library crates + +extern crate issue_31702_1; +extern crate issue_31702_2; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-31776.rs b/src/test/run-pass/issues/issue-31776.rs new file mode 100644 index 00000000000..db866b86a2a --- /dev/null +++ b/src/test/run-pass/issues/issue-31776.rs @@ -0,0 +1,65 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Various scenarios in which `pub` is required in blocks + +struct S; + +mod m { + fn f() { + impl ::S { + pub fn s(&self) {} + } + } +} + +// ------------------------------------------------------ + +pub trait Tr { + type A; +} +pub struct S1; + +fn f() { + pub struct Z; + + impl ::Tr for ::S1 { + type A = Z; // Private-in-public error unless `struct Z` is pub + } +} + +// ------------------------------------------------------ + +trait Tr1 { + type A; + fn pull(&self) -> Self::A; +} +struct S2; + +mod m1 { + fn f() { + pub struct Z { + pub field: u8 + } + + impl ::Tr1 for ::S2 { + type A = Z; + fn pull(&self) -> Self::A { Z{field: 10} } + } + } +} + +// ------------------------------------------------------ + +fn main() { + S.s(); // Privacy error, unless `fn s` is pub + let a = S2.pull().field; // Privacy error unless `field: u8` is pub +} diff --git a/src/test/run-pass/issues/issue-32008.rs b/src/test/run-pass/issues/issue-32008.rs new file mode 100644 index 00000000000..7fccf09bdaa --- /dev/null +++ b/src/test/run-pass/issues/issue-32008.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that binary operators allow subtyping on both the LHS and RHS, +// and as such do not introduce unnecessarily strict lifetime constraints. + +use std::ops::Add; + +struct Foo; + +impl<'a> Add<&'a Foo> for &'a Foo { + type Output = (); + fn add(self, rhs: &'a Foo) {} +} + +fn try_to_add(input: &Foo) { + let local = Foo; + + // Manual reborrow worked even with invariant trait search. + &*input + &local; + + // Direct use of the reference on the LHS requires additional + // subtyping before searching (invariantly) for `LHS: Add`. + input + &local; +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-3211.rs b/src/test/run-pass/issues/issue-3211.rs new file mode 100644 index 00000000000..8f90b710dae --- /dev/null +++ b/src/test/run-pass/issues/issue-3211.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let mut x = 0; + for _ in 0..4096 { x += 1; } + assert_eq!(x, 4096); + println!("x = {}", x); +} diff --git a/src/test/run-pass/issues/issue-3220.rs b/src/test/run-pass/issues/issue-3220.rs new file mode 100644 index 00000000000..2d32a08e37b --- /dev/null +++ b/src/test/run-pass/issues/issue-3220.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +// pretty-expanded FIXME #23616 + +struct thing { x: isize, } + +impl Drop for thing { + fn drop(&mut self) {} +} + +fn thing() -> thing { + thing { + x: 0 + } +} + +impl thing { + pub fn f(self) {} +} + +pub fn main() { + let z = thing(); + (z).f(); +} diff --git a/src/test/run-pass/issues/issue-32292.rs b/src/test/run-pass/issues/issue-32292.rs new file mode 100644 index 00000000000..856b7e2382b --- /dev/null +++ b/src/test/run-pass/issues/issue-32292.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(warnings)] + +#[derive(Hash, Ord, PartialOrd, Eq, PartialEq, Debug, Clone, Copy)] +struct Foo; + +fn main() { + let _ = Foo; +} diff --git a/src/test/run-pass/issues/issue-32324.rs b/src/test/run-pass/issues/issue-32324.rs new file mode 100644 index 00000000000..483ddaeb957 --- /dev/null +++ b/src/test/run-pass/issues/issue-32324.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +trait Resources { + type Buffer: Copy; +} + +#[derive(Copy, Clone)] +struct ConstantBufferSet( + pub R::Buffer +); + +#[derive(Copy, Clone)] +enum It {} +impl Resources for It { + type Buffer = u8; +} + +#[derive(Copy, Clone)] +enum Command { + BindConstantBuffers(ConstantBufferSet) +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-32389.rs b/src/test/run-pass/issues/issue-32389.rs new file mode 100644 index 00000000000..31e4a5c9e47 --- /dev/null +++ b/src/test/run-pass/issues/issue-32389.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo() -> T { loop {} } + +fn test() { + let ref mut a: &mut FnMut((i8,), i16) = foo(); + a((0,), 0); +} + +fn main() { + let _ = test; +} diff --git a/src/test/run-pass/issues/issue-32518.rs b/src/test/run-pass/issues/issue-32518.rs new file mode 100644 index 00000000000..bc8b11d3e66 --- /dev/null +++ b/src/test/run-pass/issues/issue-32518.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// no-prefer-dynamic +// aux-build:cgu_test.rs +// aux-build:cgu_test_a.rs +// aux-build:cgu_test_b.rs + +extern crate cgu_test_a; +extern crate cgu_test_b; + +fn main() { + cgu_test_a::a::a(); + cgu_test_b::a::a(); +} diff --git a/src/test/run-pass/issues/issue-32805.rs b/src/test/run-pass/issues/issue-32805.rs new file mode 100644 index 00000000000..4c68bed4b05 --- /dev/null +++ b/src/test/run-pass/issues/issue-32805.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn const_mir() -> f32 { 9007199791611905.0 } + +fn main() { + let original = "9007199791611905.0"; // (1<<53)+(1<<29)+1 + let expected = "9007200000000000"; + + assert_eq!(const_mir().to_string(), expected); + assert_eq!(original.parse::().unwrap().to_string(), expected); +} diff --git a/src/test/run-pass/issues/issue-3290.rs b/src/test/run-pass/issues/issue-3290.rs new file mode 100644 index 00000000000..02f27cbf483 --- /dev/null +++ b/src/test/run-pass/issues/issue-3290.rs @@ -0,0 +1,18 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut x: Box<_> = box 3; + x = x; + assert_eq!(*x, 3); +} diff --git a/src/test/run-pass/issues/issue-32947.rs b/src/test/run-pass/issues/issue-32947.rs new file mode 100644 index 00000000000..9b00a09338e --- /dev/null +++ b/src/test/run-pass/issues/issue-32947.rs @@ -0,0 +1,34 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten FIXME(#45351) + +#![feature(repr_simd, test)] + +extern crate test; + +#[repr(simd)] +pub struct Mu64(pub u64, pub u64, pub u64, pub u64); + +fn main() { + // This ensures an unaligned pointer even in optimized builds, though LLVM + // gets enough type information to actually not mess things up in that case, + // but at the time of writing this, it's enough to trigger the bug in + // non-optimized builds + unsafe { + let memory = &mut [0u64; 8] as *mut _ as *mut u8; + let misaligned_ptr: &mut [u8; 32] = { + std::mem::transmute(memory.offset(1)) + }; + *misaligned_ptr = std::mem::transmute(Mu64(1, 1, 1, 1)); + test::black_box(memory); + } +} diff --git a/src/test/run-pass/issues/issue-33096.rs b/src/test/run-pass/issues/issue-33096.rs new file mode 100644 index 00000000000..f89295c0627 --- /dev/null +++ b/src/test/run-pass/issues/issue-33096.rs @@ -0,0 +1,28 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -g + +use std::ops::Deref; + +trait Foo { + fn foo() {} +} + +impl Foo for u8 {} + +fn bar() where T::Target: Foo { + <::Target as Foo>::foo() +} + +fn main() { + bar::<&u8>(); +} diff --git a/src/test/run-pass/issues/issue-33185.rs b/src/test/run-pass/issues/issue-33185.rs new file mode 100644 index 00000000000..6268454658f --- /dev/null +++ b/src/test/run-pass/issues/issue-33185.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +#[macro_export] +macro_rules! state { + ( $( $name:ident : $field:ty )* ) => ( + #[derive(Default)] + struct State { + $($name : $field),* + } + ) +} + +state! { x: i64 } + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-33187.rs b/src/test/run-pass/issues/issue-33187.rs new file mode 100644 index 00000000000..a998a953b06 --- /dev/null +++ b/src/test/run-pass/issues/issue-33187.rs @@ -0,0 +1,28 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo(::Data); + +impl Copy for Foo where ::Data: Copy { } +impl Clone for Foo where ::Data: Clone { + fn clone(&self) -> Self { Foo(self.0.clone()) } +} + +trait Repr { + type Data; +} + +impl Repr for A { + type Data = u32; +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-33202.rs b/src/test/run-pass/issues/issue-33202.rs new file mode 100644 index 00000000000..1101861c09e --- /dev/null +++ b/src/test/run-pass/issues/issue-33202.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[repr(C)] +pub enum CPOption { + PSome(T), +} + +fn main() { + println!("sizeof CPOption {}", std::mem::size_of::>()); +} diff --git a/src/test/run-pass/issues/issue-33264.rs b/src/test/run-pass/issues/issue-33264.rs new file mode 100644 index 00000000000..1c0ad2a659e --- /dev/null +++ b/src/test/run-pass/issues/issue-33264.rs @@ -0,0 +1,40 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// only-x86_64 + +#![allow(dead_code, non_upper_case_globals)] +#![feature(asm)] + +#[repr(C)] +pub struct D32x4(f32,f32,f32,f32); + +impl D32x4 { + fn add(&self, vec: Self) -> Self { + unsafe { + let ret: Self; + asm!(" + movaps $1, %xmm1 + movaps $2, %xmm2 + addps %xmm1, %xmm2 + movaps $xmm1, $0 + " + : "=r"(ret) + : "1"(self), "2"(vec) + : "xmm1", "xmm2" + ); + ret + } + } +} + +fn main() { } + diff --git a/src/test/run-pass/issues/issue-33287.rs b/src/test/run-pass/issues/issue-33287.rs new file mode 100644 index 00000000000..e99c53caa87 --- /dev/null +++ b/src/test/run-pass/issues/issue-33287.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const A: [u32; 1] = [0]; + +fn test() { + let range = A[1]..; +} + +fn main() { } + diff --git a/src/test/run-pass/issues/issue-333.rs b/src/test/run-pass/issues/issue-333.rs new file mode 100644 index 00000000000..4c47ab77a48 --- /dev/null +++ b/src/test/run-pass/issues/issue-333.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn quux(x: T) -> T { let f = id::; return f(x); } + +fn id(x: T) -> T { return x; } + +pub fn main() { assert_eq!(quux(10), 10); } diff --git a/src/test/run-pass/issues/issue-33387.rs b/src/test/run-pass/issues/issue-33387.rs new file mode 100644 index 00000000000..def4059b9df --- /dev/null +++ b/src/test/run-pass/issues/issue-33387.rs @@ -0,0 +1,42 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(rustc_attrs)] + +use std::sync::Arc; + +trait Foo { + fn get(&self) -> [u8; 2]; +} + +impl Foo for [u8; 2] { + fn get(&self) -> [u8; 2] { + *self + } +} + +struct Bar(T); + +fn unsize_fat_ptr<'a>(x: &'a Bar) -> &'a Bar { + x +} + +fn unsize_nested_fat_ptr(x: Arc) -> Arc { + x +} + +fn main() { + let x: Box> = Box::new(Bar([1,2])); + assert_eq!(unsize_fat_ptr(&*x).0.get(), [1, 2]); + + let x: Arc = Arc::new([3, 4]); + assert_eq!(unsize_nested_fat_ptr(x).get(), [3, 4]); +} diff --git a/src/test/run-pass/issues/issue-33461.rs b/src/test/run-pass/issues/issue-33461.rs new file mode 100644 index 00000000000..17938a38474 --- /dev/null +++ b/src/test/run-pass/issues/issue-33461.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::marker::PhantomData; + +struct TheType { + t: PhantomData +} + +pub trait TheTrait { + type TheAssociatedType; +} + +impl TheTrait for () { + type TheAssociatedType = (); +} + +pub trait Shape { + fn doit(&self) { + } +} + +impl Shape

for TheType { +} + +fn main() { + let ball = TheType { t: PhantomData }; + let handle: &Shape<()> = &ball; +} diff --git a/src/test/run-pass/issues/issue-33498.rs b/src/test/run-pass/issues/issue-33498.rs new file mode 100644 index 00000000000..e7e89083032 --- /dev/null +++ b/src/test/run-pass/issues/issue-33498.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let x = (0, 2); + + match x { + (0, ref y) => {} + (y, 0) => {} + _ => (), + } +} diff --git a/src/test/run-pass/issues/issue-33537.rs b/src/test/run-pass/issues/issue-33537.rs new file mode 100644 index 00000000000..3ef1595b958 --- /dev/null +++ b/src/test/run-pass/issues/issue-33537.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +const fn foo() -> *const i8 { + b"foo" as *const _ as *const i8 +} + +const fn bar() -> i32 { + *&{(1, 2, 3).1} +} + +fn main() { + assert_eq!(foo(), b"foo" as *const _ as *const i8); + assert_eq!(bar(), 2); +} diff --git a/src/test/run-pass/issues/issue-33687.rs b/src/test/run-pass/issues/issue-33687.rs new file mode 100644 index 00000000000..e6841595916 --- /dev/null +++ b/src/test/run-pass/issues/issue-33687.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(unboxed_closures)] +#![feature(fn_traits)] + +struct Test; + +impl FnOnce<(u32, u32)> for Test { + type Output = u32; + + extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { + a + b + } +} + +fn main() { + assert_eq!(Test(1u32, 2u32), 3u32); +} diff --git a/src/test/run-pass/issues/issue-33770.rs b/src/test/run-pass/issues/issue-33770.rs new file mode 100644 index 00000000000..5d1de986b47 --- /dev/null +++ b/src/test/run-pass/issues/issue-33770.rs @@ -0,0 +1,104 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::process::{Command, Stdio}; +use std::env; +use std::sync::{Mutex, RwLock}; +use std::time::Duration; +use std::thread; + +fn test_mutex() { + let m = Mutex::new(0); + let _g = m.lock().unwrap(); + let _g2 = m.lock().unwrap(); +} + +fn test_try_mutex() { + let m = Mutex::new(0); + let _g = m.lock().unwrap(); + let _g2 = m.try_lock().unwrap(); +} + +fn test_rwlock_ww() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.write().unwrap(); +} + +fn test_try_rwlock_ww() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.try_write().unwrap(); +} + +fn test_rwlock_rw() { + let m = RwLock::new(0); + let _g = m.read().unwrap(); + let _g2 = m.write().unwrap(); +} + +fn test_try_rwlock_rw() { + let m = RwLock::new(0); + let _g = m.read().unwrap(); + let _g2 = m.try_write().unwrap(); +} + +fn test_rwlock_wr() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.read().unwrap(); +} + +fn test_try_rwlock_wr() { + let m = RwLock::new(0); + let _g = m.write().unwrap(); + let _g2 = m.try_read().unwrap(); +} + +fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 { + match &*args[1] { + "mutex" => test_mutex(), + "try_mutex" => test_try_mutex(), + "rwlock_ww" => test_rwlock_ww(), + "try_rwlock_ww" => test_try_rwlock_ww(), + "rwlock_rw" => test_rwlock_rw(), + "try_rwlock_rw" => test_try_rwlock_rw(), + "rwlock_wr" => test_rwlock_wr(), + "try_rwlock_wr" => test_try_rwlock_wr(), + _ => unreachable!(), + } + // If we reach this point then the test failed + println!("TEST FAILED: {}", args[1]); + } else { + let mut v = vec![]; + v.push(Command::new(&args[0]).arg("mutex").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_mutex").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("rwlock_ww").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_rwlock_ww").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("rwlock_rw").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_rwlock_rw").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("rwlock_wr").stderr(Stdio::null()).spawn().unwrap()); + v.push(Command::new(&args[0]).arg("try_rwlock_wr").stderr(Stdio::null()).spawn().unwrap()); + + thread::sleep(Duration::new(1, 0)); + + // Make sure all subprocesses either panicked or were killed because they deadlocked + for mut c in v { + c.kill().ok(); + assert!(!c.wait().unwrap().success()); + } + } +} diff --git a/src/test/run-pass/issues/issue-3389.rs b/src/test/run-pass/issues/issue-3389.rs new file mode 100644 index 00000000000..7102bb469e4 --- /dev/null +++ b/src/test/run-pass/issues/issue-3389.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct trie_node { + content: Vec , + children: Vec , +} + +fn print_str_vector(vector: Vec ) { + for string in &vector { + println!("{}", *string); + } +} + +pub fn main() { + let mut node: trie_node = trie_node { + content: Vec::new(), + children: Vec::new() + }; + let v = vec!["123".to_string(), "abc".to_string()]; + node.content = vec!["123".to_string(), "abc".to_string()]; + print_str_vector(v); + print_str_vector(node.content.clone()); + +} diff --git a/src/test/run-pass/issues/issue-33903.rs b/src/test/run-pass/issues/issue-33903.rs new file mode 100644 index 00000000000..df2f5e3e7a0 --- /dev/null +++ b/src/test/run-pass/issues/issue-33903.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 33903: +// Built-in indexing should be used even when the index is not +// trivially an integer +// Only built-in indexing can be used in constant expressions + +const FOO: i32 = [12, 34][0 + 1]; + +fn main() {} + diff --git a/src/test/run-pass/issues/issue-33992.rs b/src/test/run-pass/issues/issue-33992.rs new file mode 100644 index 00000000000..d10c11644d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-33992.rs @@ -0,0 +1,41 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-windows +// ignore-macos + +#![feature(linkage)] + +#[linkage = "common"] +pub static mut TEST1: u32 = 0u32; + +#[linkage = "external"] +pub static TEST2: bool = true; + +#[linkage = "internal"] +pub static TEST3: bool = true; + +#[linkage = "linkonce"] +pub static TEST4: bool = true; + +#[linkage = "linkonce_odr"] +pub static TEST5: bool = true; + +#[linkage = "private"] +pub static TEST6: bool = true; + +#[linkage = "weak"] +pub static TEST7: bool = true; + +#[linkage = "weak_odr"] +pub static TEST8: bool = true; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-34053.rs b/src/test/run-pass/issues/issue-34053.rs new file mode 100644 index 00000000000..fb6417ee870 --- /dev/null +++ b/src/test/run-pass/issues/issue-34053.rs @@ -0,0 +1,40 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; + +static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; + +struct A(i32); + +impl Drop for A { + fn drop(&mut self) { + // update global drop count + DROP_COUNTER.fetch_add(1, Ordering::SeqCst); + } +} + +static FOO: A = A(123); +const BAR: A = A(456); + +impl A { + const BAZ: A = A(789); +} + +fn main() { + assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 0); + assert_eq!(&FOO.0, &123); + assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 0); + assert_eq!(BAR.0, 456); + assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 1); + assert_eq!(A::BAZ.0, 789); + assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 2); +} diff --git a/src/test/run-pass/issues/issue-34074.rs b/src/test/run-pass/issues/issue-34074.rs new file mode 100644 index 00000000000..3f64cfd2e58 --- /dev/null +++ b/src/test/run-pass/issues/issue-34074.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Make sure several unnamed function parameters don't conflict with each other + +trait Tr { + #[allow(anonymous_parameters)] + fn f(u8, u8) {} +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-34194.rs b/src/test/run-pass/issues/issue-34194.rs new file mode 100644 index 00000000000..dfc0a34651a --- /dev/null +++ b/src/test/run-pass/issues/issue-34194.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +struct A { + a: &'static (), +} + +static B: &'static A = &A { a: &() }; +static C: &'static A = &B; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-3424.rs b/src/test/run-pass/issues/issue-3424.rs new file mode 100644 index 00000000000..1e914eaee58 --- /dev/null +++ b/src/test/run-pass/issues/issue-3424.rs @@ -0,0 +1,29 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +// rustc --test ignores2.rs && ./ignores2 + +pub struct Path; + +type rsrc_loader = Box Result>; + +fn tester() +{ + let mut loader: rsrc_loader = Box::new(move |_path| { + Ok("more blah".to_string()) + }); + + let path = Path; + assert!(loader(&path).is_ok()); +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-3429.rs b/src/test/run-pass/issues/issue-3429.rs new file mode 100644 index 00000000000..d6bc8739377 --- /dev/null +++ b/src/test/run-pass/issues/issue-3429.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let x = 1_usize; + let y = || x; + let _z = y(); +} diff --git a/src/test/run-pass/issues/issue-34427.rs b/src/test/run-pass/issues/issue-34427.rs new file mode 100644 index 00000000000..b43e9ff8b52 --- /dev/null +++ b/src/test/run-pass/issues/issue-34427.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #34427: On ARM, the code in `foo` at one time was generating +// a machine code instruction of the form: `str r0, [r0, rN]!` (for +// some N), which is not legal because the source register and base +// register cannot be identical in the preindexed form signalled by +// the `!`. +// +// See LLVM bug: https://llvm.org/bugs/show_bug.cgi?id=28809 + +#[inline(never)] +fn foo(n: usize) -> Vec> { + (0..n).map(|_| None).collect() +} + +fn main() { + let _ = (foo(10), foo(32)); +} diff --git a/src/test/run-pass/issues/issue-3447.rs b/src/test/run-pass/issues/issue-3447.rs new file mode 100644 index 00000000000..ff4642e47eb --- /dev/null +++ b/src/test/run-pass/issues/issue-3447.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] +#![allow(non_camel_case_types)] +#![feature(box_syntax)] + +use std::cell::RefCell; + +static S: &'static str = "str"; + +struct list { + element: T, + next: Option>>> +} + +impl list { + pub fn addEnd(&mut self, element: T) { + let newList = list { + element: element, + next: None + }; + + self.next = Some(box RefCell::new(newList)); + } +} + +pub fn main() { + let ls = list { + element: S, + next: None + }; + println!("{}", ls.element); +} diff --git a/src/test/run-pass/issues/issue-34503.rs b/src/test/run-pass/issues/issue-34503.rs new file mode 100644 index 00000000000..b470518fd43 --- /dev/null +++ b/src/test/run-pass/issues/issue-34503.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + struct X; + trait Foo { + fn foo(&self) where (T, Option): Ord {} + fn bar(&self, x: &Option) -> bool + where Option: Ord { *x < *x } + } + impl Foo for () {} + let _ = &() as &Foo; +} diff --git a/src/test/run-pass/issues/issue-34569.rs b/src/test/run-pass/issues/issue-34569.rs new file mode 100644 index 00000000000..1bdd56b15ab --- /dev/null +++ b/src/test/run-pass/issues/issue-34569.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:-g + +// In this test we just want to make sure that the code below does not lead to +// a debuginfo verification assertion during compilation. This was caused by the +// closure in the guard being codegened twice due to how match expressions are +// handled. +// +// See https://github.com/rust-lang/rust/issues/34569 for details. + +fn main() { + match 0 { + e if (|| { e == 0 })() => {}, + 1 => {}, + _ => {} + } +} diff --git a/src/test/run-pass/issues/issue-34571.rs b/src/test/run-pass/issues/issue-34571.rs new file mode 100644 index 00000000000..dbb85007be8 --- /dev/null +++ b/src/test/run-pass/issues/issue-34571.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[repr(u8)] +enum Foo { + Foo(u8), +} + +fn main() { + match Foo::Foo(1) { + _ => () + } +} diff --git a/src/test/run-pass/issues/issue-34751.rs b/src/test/run-pass/issues/issue-34751.rs new file mode 100644 index 00000000000..382212a1908 --- /dev/null +++ b/src/test/run-pass/issues/issue-34751.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #34751 ICE: 'rustc' panicked at 'assertion failed: !substs.has_regions_escaping_depth(0)' + +#[allow(dead_code)] + +use std::marker::PhantomData; + +fn f<'a>(PhantomData::<&'a u8>: PhantomData<&'a u8>) {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-34780.rs b/src/test/run-pass/issues/issue-34780.rs new file mode 100644 index 00000000000..b7f2871a8d1 --- /dev/null +++ b/src/test/run-pass/issues/issue-34780.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +#![feature(associated_consts)] + +use std::marker::PhantomData; + +trait Tr<'a> { + const C: PhantomData<&'a u8> = PhantomData::<&'a u8>; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-34784.rs b/src/test/run-pass/issues/issue-34784.rs new file mode 100644 index 00000000000..0a6a25c41d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-34784.rs @@ -0,0 +1,29 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const C: *const u8 = &0; + +fn foo(x: *const u8) { + match x { + C => {} + _ => {} + } +} + +const D: *const [u8; 4] = b"abcd"; + +fn main() { + match D { + D => {} + _ => {} + } +} + diff --git a/src/test/run-pass/issues/issue-34796.rs b/src/test/run-pass/issues/issue-34796.rs new file mode 100644 index 00000000000..ea9172ae483 --- /dev/null +++ b/src/test/run-pass/issues/issue-34796.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test case exposes conditions where the encoding of a trait object type +// with projection predicates would differ between this crate and the upstream +// crate, because the predicates were encoded in different order within each +// crate. This led to different symbol hashes of functions using these type, +// which in turn led to linker errors because the two crates would not agree on +// the symbol name. +// The fix was to make the order in which predicates get encoded stable. + +// aux-build:issue34796aux.rs +extern crate issue34796aux; + +fn mk() -> T { loop {} } + +struct Data { + data: T, + error: E, +} + +fn main() { + issue34796aux::bar(|()| { + Data::<(), std::io::Error> { + data: mk(), + error: mk(), + } + }) +} diff --git a/src/test/run-pass/issues/issue-34798.rs b/src/test/run-pass/issues/issue-34798.rs new file mode 100644 index 00000000000..33e78be4889 --- /dev/null +++ b/src/test/run-pass/issues/issue-34798.rs @@ -0,0 +1,35 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![forbid(improper_ctypes)] +#![allow(dead_code)] + +#[repr(C)] +pub struct Foo { + size: u8, + __value: ::std::marker::PhantomData, +} + +#[repr(C)] +pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData); + +#[repr(C)] +pub struct Bar { + size: u8, + baz: ZeroSizeWithPhantomData, +} + +extern "C" { + pub fn bar(_: *mut Foo, _: *mut Bar); +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-34932.rs b/src/test/run-pass/issues/issue-34932.rs new file mode 100644 index 00000000000..8f249c32110 --- /dev/null +++ b/src/test/run-pass/issues/issue-34932.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--test +// rustc-env:RUSTC_BOOTSTRAP_KEY= +#![cfg(any())] // This test should be configured away +#![feature(rustc_attrs)] // Test that this is allowed on stable/beta +#![feature(iter_arith_traits)] // Test that this is not unused +#![deny(unused_features)] + +#[test] +fn dummy() { + let () = "this should not reach type-checking"; +} diff --git a/src/test/run-pass/issues/issue-3500.rs b/src/test/run-pass/issues/issue-3500.rs new file mode 100644 index 00000000000..c4d3255cd30 --- /dev/null +++ b/src/test/run-pass/issues/issue-3500.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let x = &Some(1); + match x { + &Some(_) => (), + &None => (), + } +} diff --git a/src/test/run-pass/issues/issue-35376.rs b/src/test/run-pass/issues/issue-35376.rs new file mode 100644 index 00000000000..ee8c6c9f35c --- /dev/null +++ b/src/test/run-pass/issues/issue-35376.rs @@ -0,0 +1,52 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(specialization)] + +fn main() {} + +pub trait Alpha { } + +pub trait Beta { + type Event; +} + +pub trait Delta { + type Handle; + fn process(&self); +} + +pub struct Parent(A, T); + +impl Delta for Parent +where A: Alpha, + T: Delta, + T::Handle: Beta::Event> { + type Handle = Handle; + default fn process(&self) { + unimplemented!() + } +} + +impl Delta for Parent +where A: Alpha + Alpha, + T: Delta, + T::Handle: Beta::Event> { + fn process(&self) { + unimplemented!() + } +} + +pub struct Handle; + +impl Beta for Handle { + type Event = (); +} diff --git a/src/test/run-pass/issues/issue-35423.rs b/src/test/run-pass/issues/issue-35423.rs new file mode 100644 index 00000000000..969925679fa --- /dev/null +++ b/src/test/run-pass/issues/issue-35423.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main () { + let x = 4; + match x { + ref r if *r < 0 => println!("got negative num {} < 0", r), + e @ 1 ..= 100 => println!("got number within range [1,100] {}", e), + _ => println!("no"), + } +} diff --git a/src/test/run-pass/issues/issue-35546.rs b/src/test/run-pass/issues/issue-35546.rs new file mode 100644 index 00000000000..9c39941232f --- /dev/null +++ b/src/test/run-pass/issues/issue-35546.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #35546. Check that we are able to codegen +// this. Before we had problems because of the drop glue signature +// around dropping a trait object (specifically, when dropping the +// `value` field of `Node`). + +struct Node { + next: Option>>, + value: T, +} + +fn clear(head: &mut Option>>) { + match head.take() { + Some(node) => *head = node.next, + None => (), + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-3556.rs b/src/test/run-pass/issues/issue-3556.rs new file mode 100644 index 00000000000..b71d94adfeb --- /dev/null +++ b/src/test/run-pass/issues/issue-3556.rs @@ -0,0 +1,45 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(Debug)] +enum Token { + Text(String), + ETag(Vec, String), + UTag(Vec, String), + Section(Vec, bool, Vec, String, + String, String, String, String), + IncompleteSection(Vec, bool, String, bool), + Partial(String, String, String), +} + +fn check_strs(actual: &str, expected: &str) -> bool +{ + if actual != expected + { + println!("Found {}, but expected {}", actual, expected); + return false; + } + return true; +} + +pub fn main() +{ + let t = Token::Text("foo".to_string()); + let u = Token::Section(vec!["alpha".to_string()], + true, + vec![t], + "foo".to_string(), + "foo".to_string(), "foo".to_string(), "foo".to_string(), + "foo".to_string()); + let v = format!("{:?}", u); // this is the line that causes the seg fault + assert!(!v.is_empty()); +} diff --git a/src/test/run-pass/issues/issue-3559.rs b/src/test/run-pass/issues/issue-3559.rs new file mode 100644 index 00000000000..8ca001691bb --- /dev/null +++ b/src/test/run-pass/issues/issue-3559.rs @@ -0,0 +1,28 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::HashMap; + +fn check_strs(actual: &str, expected: &str) -> bool { + if actual != expected { + println!("Found {}, but expected {}", actual, expected); + return false; + } + return true; +} + +pub fn main() { + let mut table = HashMap::new(); + table.insert("one".to_string(), 1); + table.insert("two".to_string(), 2); + assert!(check_strs(&format!("{:?}", table), "{\"one\": 1, \"two\": 2}") || + check_strs(&format!("{:?}", table), "{\"two\": 2, \"one\": 1}")); +} diff --git a/src/test/run-pass/issues/issue-35600.rs b/src/test/run-pass/issues/issue-35600.rs new file mode 100644 index 00000000000..1083aa808cb --- /dev/null +++ b/src/test/run-pass/issues/issue-35600.rs @@ -0,0 +1,25 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + type bar; + fn bar(); +} + +impl Foo for () { + type bar = (); + fn bar() {} +} + +fn main() { + let x: <() as Foo>::bar = (); + <()>::bar(); +} diff --git a/src/test/run-pass/issues/issue-3563-2.rs b/src/test/run-pass/issues/issue-3563-2.rs new file mode 100644 index 00000000000..534bec59018 --- /dev/null +++ b/src/test/run-pass/issues/issue-3563-2.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Canvas { + fn add_point(&self, point: &isize); + fn add_points(&self, shapes: &[isize]) { + for pt in shapes { + self.add_point(pt) + } + } + +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-3563-3.rs b/src/test/run-pass/issues/issue-3563-3.rs new file mode 100644 index 00000000000..cd31abaca35 --- /dev/null +++ b/src/test/run-pass/issues/issue-3563-3.rs @@ -0,0 +1,189 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// ASCII art shape renderer. Demonstrates traits, impls, operator overloading, +// non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && +// ./shapes + +// Rust's std library is tightly bound to the language itself so it is +// automatically linked in. However the extra library is designed to be +// optional (for code that must run on constrained environments like embedded +// devices or special environments like kernel code) so it must be explicitly +// linked in. + +// Extern mod controls linkage. Use controls the visibility of names to modules +// that are already linked in. Using WriterUtil allows us to use the write_line +// method. + +use std::fmt; +use std::iter::repeat; +use std::slice; + +// Represents a position on a canvas. +#[derive(Copy, Clone)] +struct Point { + x: isize, + y: isize, +} + +// Represents an offset on a canvas. (This has the same structure as a Point. +// but different semantics). +#[derive(Copy, Clone)] +struct Size { + width: isize, + height: isize, +} + +#[derive(Copy, Clone)] +struct Rect { + top_left: Point, + size: Size, +} + +// Contains the information needed to do shape rendering via ASCII art. +struct AsciiArt { + width: usize, + height: usize, + fill: char, + lines: Vec > , + + // This struct can be quite large so we'll disable copying: developers need + // to either pass these structs around via references or move them. +} + +impl Drop for AsciiArt { + fn drop(&mut self) {} +} + +// It's common to define a constructor sort of function to create struct instances. +// If there is a canonical constructor it is typically named the same as the type. +// Other constructor sort of functions are typically named from_foo, from_bar, etc. +fn AsciiArt(width: usize, height: usize, fill: char) -> AsciiArt { + // Build a vector of vectors containing blank characters for each position in + // our canvas. + let lines = vec![vec!['.'; width]; height]; + + // Rust code often returns values by omitting the trailing semi-colon + // instead of using an explicit return statement. + AsciiArt {width: width, height: height, fill: fill, lines: lines} +} + +// Methods particular to the AsciiArt struct. +impl AsciiArt { + fn add_pt(&mut self, x: isize, y: isize) { + if x >= 0 && x < self.width as isize { + if y >= 0 && y < self.height as isize { + // Note that numeric types don't implicitly convert to each other. + let v = y as usize; + let h = x as usize; + + // Vector subscripting will normally copy the element, but &v[i] + // will return a reference which is what we need because the + // element is: + // 1) potentially large + // 2) needs to be modified + let row = &mut self.lines[v]; + row[h] = self.fill; + } + } + } +} + +// Allows AsciiArt to be converted to a string using the libcore ToString trait. +// Note that the %s fmt! specifier will not call this automatically. +impl fmt::Display for AsciiArt { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // Convert each line into a string. + let lines = self.lines.iter() + .map(|line| line.iter().cloned().collect()) + .collect::>(); + + // Concatenate the lines together using a new-line. + write!(f, "{}", lines.join("\n")) + } +} + +// This is similar to an interface in other languages: it defines a protocol which +// developers can implement for arbitrary concrete types. +trait Canvas { + fn add_point(&mut self, shape: Point); + fn add_rect(&mut self, shape: Rect); + + // Unlike interfaces traits support default implementations. + // Got an ICE as soon as I added this method. + fn add_points(&mut self, shapes: &[Point]) { + for pt in shapes {self.add_point(*pt)}; + } +} + +// Here we provide an implementation of the Canvas methods for AsciiArt. +// Other implementations could also be provided (e.g. for PDF or Apple's Quartz) +// and code can use them polymorphically via the Canvas trait. +impl Canvas for AsciiArt { + fn add_point(&mut self, shape: Point) { + self.add_pt(shape.x, shape.y); + } + + fn add_rect(&mut self, shape: Rect) { + // Add the top and bottom lines. + for x in shape.top_left.x..shape.top_left.x + shape.size.width { + self.add_pt(x, shape.top_left.y); + self.add_pt(x, shape.top_left.y + shape.size.height - 1); + } + + // Add the left and right lines. + for y in shape.top_left.y..shape.top_left.y + shape.size.height { + self.add_pt(shape.top_left.x, y); + self.add_pt(shape.top_left.x + shape.size.width - 1, y); + } + } +} + +// Rust's unit testing framework is currently a bit under-developed so we'll use +// this little helper. +pub fn check_strs(actual: &str, expected: &str) -> bool { + if actual != expected { + println!("Found:\n{}\nbut expected\n{}", actual, expected); + return false; + } + return true; +} + + +fn test_ascii_art_ctor() { + let art = AsciiArt(3, 3, '*'); + assert!(check_strs(&art.to_string(), "...\n...\n...")); +} + + +fn test_add_pt() { + let mut art = AsciiArt(3, 3, '*'); + art.add_pt(0, 0); + art.add_pt(0, -10); + art.add_pt(1, 2); + assert!(check_strs(&art.to_string(), "*..\n...\n.*.")); +} + + +fn test_shapes() { + let mut art = AsciiArt(4, 4, '*'); + art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}}); + art.add_point(Point {x: 2, y: 2}); + assert!(check_strs(&art.to_string(), "****\n*..*\n*.**\n****")); +} + +pub fn main() { + test_ascii_art_ctor(); + test_add_pt(); + test_shapes(); +} diff --git a/src/test/run-pass/issues/issue-3574.rs b/src/test/run-pass/issues/issue-3574.rs new file mode 100644 index 00000000000..1b5f80031b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-3574.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// rustc --test match_borrowed_str.rs.rs && ./match_borrowed_str.rs + + +fn compare(x: &str, y: &str) -> bool { + match x { + "foo" => y == "foo", + _ => y == "bar", + } +} + +pub fn main() { + assert!(compare("foo", "foo")); +} diff --git a/src/test/run-pass/issues/issue-35815.rs b/src/test/run-pass/issues/issue-35815.rs new file mode 100644 index 00000000000..62bd6aa37fd --- /dev/null +++ b/src/test/run-pass/issues/issue-35815.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; + +struct Foo { + a: i64, + b: bool, + c: T, +} + +fn main() { + let foo: &Foo = &Foo { a: 1, b: false, c: 2i32 }; + let foo_unsized: &Foo = foo; + assert_eq!(mem::size_of_val(foo), mem::size_of_val(foo_unsized)); +} diff --git a/src/test/run-pass/issues/issue-36023.rs b/src/test/run-pass/issues/issue-36023.rs new file mode 100644 index 00000000000..a654a813edf --- /dev/null +++ b/src/test/run-pass/issues/issue-36023.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Deref; + +fn main() { + if env_var("FOOBAR").as_ref().map(Deref::deref).ok() == Some("yes") { + panic!() + } + + let env_home: Result = Ok("foo-bar-baz".to_string()); + let env_home = env_home.as_ref().map(Deref::deref).ok(); + + if env_home == Some("") { panic!() } +} + +#[inline(never)] +fn env_var(s: &str) -> Result { + Err(VarError::NotPresent) +} + +pub enum VarError { + NotPresent, + NotUnicode(String), +} diff --git a/src/test/run-pass/issues/issue-36036-associated-type-layout.rs b/src/test/run-pass/issues/issue-36036-associated-type-layout.rs new file mode 100644 index 00000000000..772a936af86 --- /dev/null +++ b/src/test/run-pass/issues/issue-36036-associated-type-layout.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 36036: computing the layout of a type composed from another +// trait's associated type caused compiler to ICE when the associated +// type was allowed to be unsized, even though the known instantiated +// type is itself sized. + +#![allow(dead_code)] + +trait Context { + type Container: ?Sized; +} + +impl Context for u16 { + type Container = u8; +} + +struct Wrapper { + container: &'static C::Container +} + +fn foobar(_: Wrapper) {} + +static VALUE: u8 = 0; + +fn main() { + foobar(Wrapper { container: &VALUE }); +} diff --git a/src/test/run-pass/issues/issue-36053.rs b/src/test/run-pass/issues/issue-36053.rs new file mode 100644 index 00000000000..3f1fa529d72 --- /dev/null +++ b/src/test/run-pass/issues/issue-36053.rs @@ -0,0 +1,32 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #36053. ICE was caused due to obligations being +// added to a special, dedicated fulfillment cx during a +// probe. Problem seems to be related to the particular definition of +// `FusedIterator` in std but I was not able to isolate that into an +// external crate. + +use std::iter::FusedIterator; + +struct Thing<'a>(&'a str); +impl<'a> Iterator for Thing<'a> { + type Item = &'a str; + fn next(&mut self) -> Option<&'a str> { + None + } +} + +impl<'a> FusedIterator for Thing<'a> {} + +fn main() { + Thing("test").fuse().filter(|_| true).count(); +} diff --git a/src/test/run-pass/issues/issue-36075.rs b/src/test/run-pass/issues/issue-36075.rs new file mode 100644 index 00000000000..e11d35669f5 --- /dev/null +++ b/src/test/run-pass/issues/issue-36075.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait DeclarationParser { + type Declaration; +} + +struct DeclarationListParser<'i, I, P> + where P: DeclarationParser +{ + input: &'i (), + parser: P +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-3609.rs b/src/test/run-pass/issues/issue-3609.rs new file mode 100644 index 00000000000..384964188db --- /dev/null +++ b/src/test/run-pass/issues/issue-3609.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::thread; +use std::sync::mpsc::Sender; + +type RingBuffer = Vec ; +type SamplesFn = Box; + +enum Msg +{ + GetSamples(String, SamplesFn), // sample set name, callback which receives samples +} + +fn foo(name: String, samples_chan: Sender) { + thread::spawn(move|| { + let mut samples_chan = samples_chan; + + let callback: SamplesFn = Box::new(move |buffer| { + for i in 0..buffer.len() { + println!("{}: {}", i, buffer[i]) + } + }); + + samples_chan.send(Msg::GetSamples(name.clone(), callback)); + }).join(); +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs b/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs new file mode 100644 index 00000000000..04693f4e615 --- /dev/null +++ b/src/test/run-pass/issues/issue-36139-normalize-closure-sig.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Previously the closure's argument would be inferred to +// >::Item, causing an error in MIR type +// checking + +trait ITrait<'a> {type Item;} + +struct S {} + +impl<'a> ITrait<'a> for S { type Item = &'a mut usize; } + +fn m(_: F) + where I: for<'a> ITrait<'a>, + F: for<'a> FnMut(>::Item) { } + + +fn main() { + m::(|x| { *x += 1; }); +} diff --git a/src/test/run-pass/issues/issue-36260.rs b/src/test/run-pass/issues/issue-36260.rs new file mode 100644 index 00000000000..052fd9d8477 --- /dev/null +++ b/src/test/run-pass/issues/issue-36260.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Make sure this compiles without getting a linker error because of missing +// drop-glue because the collector missed adding drop-glue for the closure: + +fn create_fn() -> Box { + let text = String::new(); + + Box::new(move || { let _ = &text; }) +} + +fn main() { + let _ = create_fn(); +} diff --git a/src/test/run-pass/issues/issue-36278-prefix-nesting.rs b/src/test/run-pass/issues/issue-36278-prefix-nesting.rs new file mode 100644 index 00000000000..41c01db076e --- /dev/null +++ b/src/test/run-pass/issues/issue-36278-prefix-nesting.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 36278: On an unsized struct with >1 level of nontrivial +// nesting, ensure we are computing dynamic size of prefix correctly. + +use std::mem; + +const SZ: usize = 100; +struct P([u8; SZ], T); + +type Ack = P>; + +fn main() { + let size_of_sized; let size_of_unsized; + let x: Box> = Box::new(P([0; SZ], P([0; SZ], [0; 0]))); + size_of_sized = mem::size_of_val::>(&x); + let y: Box> = x; + size_of_unsized = mem::size_of_val::>(&y); + assert_eq!(size_of_sized, size_of_unsized); +} diff --git a/src/test/run-pass/issues/issue-36381.rs b/src/test/run-pass/issues/issue-36381.rs new file mode 100644 index 00000000000..e7e0dca4f64 --- /dev/null +++ b/src/test/run-pass/issues/issue-36381.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #36381. The monomorphization collector was asserting that +// there are no projection types, but the `<&str as +// StreamOnce>::Position` projection contained a late-bound region, +// and we don't currently normalize in that case until the function is +// actually invoked. + +pub trait StreamOnce { + type Position; +} + +impl<'a> StreamOnce for &'a str { + type Position = usize; +} + +pub fn parser(_: F) { +} + +fn follow(_: &str) -> <&str as StreamOnce>::Position { + panic!() +} + +fn main() { + parser(follow); +} diff --git a/src/test/run-pass/issues/issue-36401.rs b/src/test/run-pass/issues/issue-36401.rs new file mode 100644 index 00000000000..fb180a359dd --- /dev/null +++ b/src/test/run-pass/issues/issue-36401.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +pub enum Event { + Key(u8), + Resize, + Unknown(u16), +} + +static XTERM_SINGLE_BYTES : [(u8, Event); 1] = [(1, Event::Resize)]; + +fn main() { + match XTERM_SINGLE_BYTES[0] { + (1, Event::Resize) => {}, + ref bad => panic!("unexpected {:?}", bad) + } +} diff --git a/src/test/run-pass/issues/issue-36474.rs b/src/test/run-pass/issues/issue-36474.rs new file mode 100644 index 00000000000..cfb136c1157 --- /dev/null +++ b/src/test/run-pass/issues/issue-36474.rs @@ -0,0 +1,41 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + remove_axis(&3, 0); +} + +trait Dimension { + fn slice(&self) -> &[usize]; +} + +impl Dimension for () { + fn slice(&self) -> &[usize] { &[] } +} + +impl Dimension for usize { + fn slice(&self) -> &[usize] { + unsafe { + ::std::slice::from_raw_parts(self, 1) + } + } +} + +fn remove_axis(value: &usize, axis: usize) -> () { + let tup = (); + let mut it = tup.slice().iter(); + for (i, _) in value.slice().iter().enumerate() { + if i == axis { + continue; + } + it.next(); + } +} diff --git a/src/test/run-pass/issues/issue-3656.rs b/src/test/run-pass/issues/issue-3656.rs new file mode 100644 index 00000000000..1e626e2e9c1 --- /dev/null +++ b/src/test/run-pass/issues/issue-3656.rs @@ -0,0 +1,39 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// Issue #3656 +// Incorrect struct size computation in the FFI, because of not taking +// the alignment of elements into account. + +// pretty-expanded FIXME #23616 +// ignore-wasm32-bare no libc to test with + +#![feature(libc)] + +extern crate libc; +use libc::{c_uint, uint32_t, c_void}; + +pub struct KEYGEN { + hash_algorithm: [c_uint; 2], + count: uint32_t, + salt: *const c_void, + salt_size: uint32_t, +} + +extern { + // Bogus signature, just need to test if it compiles. + pub fn malloc(data: KEYGEN); +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs b/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs new file mode 100644 index 00000000000..4a566d94a50 --- /dev/null +++ b/src/test/run-pass/issues/issue-36744-bitcast-args-if-needed.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This tests for an ICE (and, if ignored, subsequent LLVM abort) when +// a lifetime-parametric fn is passed into a context whose expected +// type has a differing lifetime parameterization. + +struct A<'a> { + _a: &'a i32, +} + +fn call(s: T, functions: &Vec fn(&'n T)>) { + for function in functions { + function(&s); + } +} + +fn f(a: &A) { println!("a holds {}", a._a); } + +fn main() { + let a = A { _a: &10 }; + + let vec: Vec fn(&'u A<'v>)> = vec![f]; + call(a, &vec); +} diff --git a/src/test/run-pass/issues/issue-36744-without-calls.rs b/src/test/run-pass/issues/issue-36744-without-calls.rs new file mode 100644 index 00000000000..ad54d6e403c --- /dev/null +++ b/src/test/run-pass/issues/issue-36744-without-calls.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests for an LLVM abort when storing a lifetime-parametric fn into +// context that is expecting one that is not lifetime-parametric +// (i.e. has no `for <'_>`). + +pub struct A<'a>(&'a ()); +pub struct S(T); + +pub fn bad<'s>(v: &mut S)>, y: S fn(A<'b>)>) { + *v = y; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-36768.rs b/src/test/run-pass/issues/issue-36768.rs new file mode 100644 index 00000000000..c6a76b2ca13 --- /dev/null +++ b/src/test/run-pass/issues/issue-36768.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--test +#![deny(private_in_public)] + +#[test] fn foo() {} +mod foo {} + +#[test] fn core() {} +extern crate core; diff --git a/src/test/run-pass/issues/issue-36786-resolve-call.rs b/src/test/run-pass/issues/issue-36786-resolve-call.rs new file mode 100644 index 00000000000..51aa7906b94 --- /dev/null +++ b/src/test/run-pass/issues/issue-36786-resolve-call.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensure that types that rely on obligations are autoderefed +// correctly + +fn main() { + let x : Vec> = vec![Box::new(|| ())]; + x[0]() +} diff --git a/src/test/run-pass/issues/issue-36792.rs b/src/test/run-pass/issues/issue-36792.rs new file mode 100644 index 00000000000..91e76140b82 --- /dev/null +++ b/src/test/run-pass/issues/issue-36792.rs @@ -0,0 +1,17 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo() -> impl Copy { + foo +} +fn main() { + foo(); +} diff --git a/src/test/run-pass/issues/issue-36816.rs b/src/test/run-pass/issues/issue-36816.rs new file mode 100644 index 00000000000..292829b4d24 --- /dev/null +++ b/src/test/run-pass/issues/issue-36816.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! m { () => { 1 } } +macro_rules! n { () => { 1 + m!() } } + +fn main() { + let _: [u32; n!()] = [0, 0]; +} diff --git a/src/test/run-pass/issues/issue-3683.rs b/src/test/run-pass/issues/issue-3683.rs new file mode 100644 index 00000000000..9b39577ec65 --- /dev/null +++ b/src/test/run-pass/issues/issue-3683.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + fn a(&self) -> isize; + fn b(&self) -> isize { + self.a() + 2 + } +} + +impl Foo for isize { + fn a(&self) -> isize { + 3 + } +} + +pub fn main() { + assert_eq!(3.b(), 5); +} diff --git a/src/test/run-pass/issues/issue-36856.rs b/src/test/run-pass/issues/issue-36856.rs new file mode 100644 index 00000000000..9aebb900183 --- /dev/null +++ b/src/test/run-pass/issues/issue-36856.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #36856. + +// compile-flags:-g + +fn g() -> bool { + false +} + +pub fn main() { + let a = !g(); + if a != !g() { + panic!(); + } +} diff --git a/src/test/run-pass/issues/issue-36936.rs b/src/test/run-pass/issues/issue-36936.rs new file mode 100644 index 00000000000..da187ac173d --- /dev/null +++ b/src/test/run-pass/issues/issue-36936.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that casts are not being treated as lexprs. + +fn main() { + let mut a = 0i32; + let b = &(a as i32); + a = 1; + assert_ne!(&a as *const i32, b as *const i32); + assert_eq!(*b, 0); + + assert_eq!(issue_36936(), 1); +} + + +struct A(u32); + +impl Drop for A { + fn drop(&mut self) { + self.0 = 0; + } +} + +fn issue_36936() -> u32 { + let a = &(A(1) as A); + a.0 +} diff --git a/src/test/run-pass/issues/issue-36954.rs b/src/test/run-pass/issues/issue-36954.rs new file mode 100644 index 00000000000..d12e9e41ee6 --- /dev/null +++ b/src/test/run-pass/issues/issue-36954.rs @@ -0,0 +1,18 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-36954.rs + +extern crate issue_36954 as lib; + +fn main() { + let _ = lib::FOO; +} diff --git a/src/test/run-pass/issues/issue-3702.rs b/src/test/run-pass/issues/issue-3702.rs new file mode 100644 index 00000000000..5ca851f8b77 --- /dev/null +++ b/src/test/run-pass/issues/issue-3702.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + trait Text { + fn to_string(&self) -> String; + } + + fn to_string(t: Box) { + println!("{}", (*t).to_string()); + } + +} diff --git a/src/test/run-pass/issues/issue-37109.rs b/src/test/run-pass/issues/issue-37109.rs new file mode 100644 index 00000000000..a683af9bbb2 --- /dev/null +++ b/src/test/run-pass/issues/issue-37109.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait ToRef<'a> { + type Ref: 'a; +} + +impl<'a, U: 'a> ToRef<'a> for U { + type Ref = &'a U; +} + +fn example<'a, T>(value: &'a T) -> (>::Ref, u32) { + (value, 0) +} + +fn main() { + example(&0); +} diff --git a/src/test/run-pass/issues/issue-37175.rs b/src/test/run-pass/issues/issue-37175.rs new file mode 100644 index 00000000000..a51f829abd8 --- /dev/null +++ b/src/test/run-pass/issues/issue-37175.rs @@ -0,0 +1,15 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! m { (<$t:ty>) => { stringify!($t) } } +fn main() { + println!("{}", m!(>)); +} diff --git a/src/test/run-pass/issues/issue-37222.rs b/src/test/run-pass/issues/issue-37222.rs new file mode 100644 index 00000000000..af19a922fae --- /dev/null +++ b/src/test/run-pass/issues/issue-37222.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug, PartialEq)] +enum Bar { + A(i64), + B(i32), + C, +} + +#[derive(Debug, PartialEq)] +struct Foo(Bar, u8); + +static FOO: [Foo; 2] = [Foo(Bar::C, 0), Foo(Bar::C, 0xFF)]; + +fn main() { + assert_eq!(&FOO[1], &Foo(Bar::C, 0xFF)); +} diff --git a/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs b/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs new file mode 100644 index 00000000000..67cdea807be --- /dev/null +++ b/src/test/run-pass/issues/issue-37291/auxiliary/lib.rs @@ -0,0 +1,52 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +use std::ops::Mul; + +pub trait A {} +pub trait B { + type AT: A; +} +pub trait C { + type BT: B; +} + +pub struct AV; +impl A for AV {} + +pub struct BV; +impl B for BV { + type AT = AV; +} + +pub struct CV; +impl C for CV { + type BT = BV; +} + +pub struct WrapperB(pub T); +pub struct WrapperC(pub T); + +impl Mul::AT>> for WrapperC + where C1: C +{ + type Output = u8; + fn mul(self, _: WrapperB<::AT>) -> Self::Output { + loop {} + } +} +impl Mul> for WrapperC { + type Output = u8; + fn mul(self, _: WrapperC) -> Self::Output { + loop {} + } +} diff --git a/src/test/run-pass/issues/issue-37291/main.rs b/src/test/run-pass/issues/issue-37291/main.rs new file mode 100644 index 00000000000..c30e87ad785 --- /dev/null +++ b/src/test/run-pass/issues/issue-37291/main.rs @@ -0,0 +1,30 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:lib.rs + +// Regression test for #37291. The problem was that the starting +// environment for a specialization check was not including the +// where-clauses from the impl when attempting to normalize the impl's +// trait-ref, so things like `::Item` could not resolve, +// since the `C: Foo` trait bound was not included in the environment. + +extern crate lib; + +use lib::{CV, WrapperB, WrapperC}; + +fn main() { + let a = WrapperC(CV); + let b = WrapperC(CV); + if false { + let _ = a * b; + } +} diff --git a/src/test/run-pass/issues/issue-3743.rs b/src/test/run-pass/issues/issue-3743.rs new file mode 100644 index 00000000000..e884bc4d5c4 --- /dev/null +++ b/src/test/run-pass/issues/issue-3743.rs @@ -0,0 +1,65 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// If `Mul` used an associated type for its output, this test would +// work more smoothly. + +use std::ops::Mul; + +#[derive(Copy, Clone)] +struct Vec2 { + x: f64, + y: f64 +} + +// methods we want to export as methods as well as operators +impl Vec2 { +#[inline(always)] + fn vmul(self, other: f64) -> Vec2 { + Vec2 { x: self.x * other, y: self.y * other } + } +} + +// Right-hand-side operator visitor pattern +trait RhsOfVec2Mul { + type Result; + + fn mul_vec2_by(&self, lhs: &Vec2) -> Self::Result; +} + +// Vec2's implementation of Mul "from the other side" using the above trait +impl> Mul for Vec2 { + type Output = Res; + + fn mul(self, rhs: Rhs) -> Res { rhs.mul_vec2_by(&self) } +} + +// Implementation of 'f64 as right-hand-side of Vec2::Mul' +impl RhsOfVec2Mul for f64 { + type Result = Vec2; + + fn mul_vec2_by(&self, lhs: &Vec2) -> Vec2 { lhs.vmul(*self) } +} + +// Usage with failing inference +pub fn main() { + let a = Vec2 { x: 3.0f64, y: 4.0f64 }; + + // the following compiles and works properly + let v1: Vec2 = a * 3.0f64; + println!("{} {}", v1.x, v1.y); + + // the following compiles but v2 will not be Vec2 yet and + // using it later will cause an error that the type of v2 + // must be known + let v2 = a * 3.0f64; + println!("{} {}", v2.x, v2.y); // error regarding v2's type +} diff --git a/src/test/run-pass/issues/issue-3753.rs b/src/test/run-pass/issues/issue-3753.rs new file mode 100644 index 00000000000..7941b016d14 --- /dev/null +++ b/src/test/run-pass/issues/issue-3753.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #3656 +// Issue Name: pub method preceded by attribute can't be parsed +// Abstract: Visibility parsing failed when compiler parsing + +use std::f64; + +#[derive(Copy, Clone)] +pub struct Point { + x: f64, + y: f64 +} + +#[derive(Copy, Clone)] +pub enum Shape { + Circle(Point, f64), + Rectangle(Point, Point) +} + +impl Shape { + pub fn area(&self, sh: Shape) -> f64 { + match sh { + Shape::Circle(_, size) => f64::consts::PI * size * size, + Shape::Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y) + } + } +} + +pub fn main(){ + let s = Shape::Circle(Point { x: 1.0, y: 2.0 }, 3.0); + println!("{}", s.area(s)); +} diff --git a/src/test/run-pass/issues/issue-37598.rs b/src/test/run-pass/issues/issue-37598.rs new file mode 100644 index 00000000000..b5a11f5a0fd --- /dev/null +++ b/src/test/run-pass/issues/issue-37598.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn check(list: &[u8]) { + match list { + &[] => {}, + &[_u1, _u2, ref _next..] => {}, + &[_u1] => {}, + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-37655.rs b/src/test/run-pass/issues/issue-37655.rs new file mode 100644 index 00000000000..899686befc2 --- /dev/null +++ b/src/test/run-pass/issues/issue-37655.rs @@ -0,0 +1,47 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #37655. The problem was a false edge created by +// coercion that wound up requiring that `'a` (in `split()`) outlive +// `'b`, which shouldn't be necessary. + +#![allow(warnings)] + +trait SliceExt { + type Item; + + fn get_me(&self, index: I) -> &I::Output + where I: SliceIndex; +} + +impl SliceExt for [T] { + type Item = T; + + fn get_me(&self, index: I) -> &I::Output + where I: SliceIndex + { + panic!() + } +} + +pub trait SliceIndex { + type Output: ?Sized; +} + +impl SliceIndex for usize { + type Output = T; +} + +fn foo<'a, 'b>(split: &'b [&'a [u8]]) -> &'a [u8] { + split.get_me(0) +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-37686.rs b/src/test/run-pass/issues/issue-37686.rs new file mode 100644 index 00000000000..824f80c04f9 --- /dev/null +++ b/src/test/run-pass/issues/issue-37686.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + match (0, 0) { + (std::usize::MIN, std::usize::MAX) => {} + _ => {} + } +} diff --git a/src/test/run-pass/issues/issue-37725.rs b/src/test/run-pass/issues/issue-37725.rs new file mode 100644 index 00000000000..ce952a7e520 --- /dev/null +++ b/src/test/run-pass/issues/issue-37725.rs @@ -0,0 +1,19 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + fn foo(&self); +} + +fn foo<'a>(s: &'a mut ()) where &'a mut (): Foo { + s.foo(); +} +fn main() {} diff --git a/src/test/run-pass/issues/issue-37733.rs b/src/test/run-pass/issues/issue-37733.rs new file mode 100644 index 00000000000..0b1b08d4e7b --- /dev/null +++ b/src/test/run-pass/issues/issue-37733.rs @@ -0,0 +1,16 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +type A = for<> fn(); + +type B = for<'a,> fn(); + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-3794.rs b/src/test/run-pass/issues/issue-3794.rs new file mode 100644 index 00000000000..936e9db6715 --- /dev/null +++ b/src/test/run-pass/issues/issue-3794.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +trait T { + fn print(&self); +} + +#[derive(Debug)] +struct S { + s: isize, +} + +impl T for S { + fn print(&self) { + println!("{:?}", self); + } +} + +fn print_t(t: &T) { + t.print(); +} + +fn print_s(s: &S) { + s.print(); +} + +pub fn main() { + let s: Box = box S { s: 5 }; + print_s(&*s); + let t: Box = s as Box; + print_t(&*t); +} diff --git a/src/test/run-pass/issues/issue-37991.rs b/src/test/run-pass/issues/issue-37991.rs new file mode 100644 index 00000000000..578c22fe232 --- /dev/null +++ b/src/test/run-pass/issues/issue-37991.rs @@ -0,0 +1,28 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] + +const fn foo() -> i64 { + 3 +} + +const fn bar(x: i64) -> i64 { + x*2 +} + +fn main() { + let val = &(foo() % 2); + assert_eq!(*val, 1); + + let val2 = &(bar(1+1) % 3); + assert_eq!(*val2, 1); +} diff --git a/src/test/run-pass/issues/issue-38002.rs b/src/test/run-pass/issues/issue-38002.rs new file mode 100644 index 00000000000..70892ba7d62 --- /dev/null +++ b/src/test/run-pass/issues/issue-38002.rs @@ -0,0 +1,44 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that constant ADTs are codegened OK, part k of N. + +enum Bar { + C +} + +enum Foo { + A {}, + B { + y: usize, + z: Bar + }, +} + +const LIST: [(usize, Foo); 2] = [ + (51, Foo::B { y: 42, z: Bar::C }), + (52, Foo::B { y: 45, z: Bar::C }), +]; + +pub fn main() { + match LIST { + [ + (51, Foo::B { y: 42, z: Bar::C }), + (52, Foo::B { y: 45, z: Bar::C }) + ] => {} + _ => { + // I would want to print the enum here, but if + // the discriminant is garbage this causes an + // `unreachable` and silent process exit. + panic!("trivial match failed") + } + } +} diff --git a/src/test/run-pass/issues/issue-38033.rs b/src/test/run-pass/issues/issue-38033.rs new file mode 100644 index 00000000000..3f6ef26ed79 --- /dev/null +++ b/src/test/run-pass/issues/issue-38033.rs @@ -0,0 +1,89 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::marker; +use std::mem; + +fn main() { + let workers = (0..0).map(|_| result::()); + drop(join_all(workers).poll()); +} + +trait Future { + type Item; + type Error; + + fn poll(&mut self) -> Result; +} + +trait IntoFuture { + type Future: Future; + type Item; + type Error; + + fn into_future(self) -> Self::Future; +} + +impl IntoFuture for F { + type Future = F; + type Item = F::Item; + type Error = F::Error; + + fn into_future(self) -> F { + self + } +} + +struct FutureResult { + _inner: marker::PhantomData<(T, E)>, +} + +fn result() -> FutureResult { + loop {} +} + +impl Future for FutureResult { + type Item = T; + type Error = E; + + fn poll(&mut self) -> Result { + loop {} + } +} + +struct JoinAll + where I: IntoIterator, + I::Item: IntoFuture, +{ + elems: Vec<::Item>, +} + +fn join_all(_: I) -> JoinAll + where I: IntoIterator, + I::Item: IntoFuture, +{ + JoinAll { elems: vec![] } +} + +impl Future for JoinAll + where I: IntoIterator, + I::Item: IntoFuture, +{ + type Item = Vec<::Item>; + type Error = ::Error; + + fn poll(&mut self) -> Result { + let elems = mem::replace(&mut self.elems, Vec::new()); + Ok(elems.into_iter().map(|e| { + e + }).collect::>()) + } +} diff --git a/src/test/run-pass/issues/issue-38074.rs b/src/test/run-pass/issues/issue-38074.rs new file mode 100644 index 00000000000..bae0f5fd3ff --- /dev/null +++ b/src/test/run-pass/issues/issue-38074.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten FIXME(#45351) + +#![feature(platform_intrinsics, repr_simd)] + +extern "platform-intrinsic" { + fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; +} + +#[repr(simd)] +#[derive(Clone, Copy)] +#[allow(non_camel_case_types)] +struct u64x2(u64, u64); + +fn main() { + let a = u64x2(1, 2); + let r: u64x2 = unsafe { simd_shuffle2(a, a, [0-0, 0-0]) }; + assert_eq!(r.0, 1); + assert_eq!(r.1, 1); +} diff --git a/src/test/run-pass/issues/issue-38091.rs b/src/test/run-pass/issues/issue-38091.rs new file mode 100644 index 00000000000..2e3cf210c4a --- /dev/null +++ b/src/test/run-pass/issues/issue-38091.rs @@ -0,0 +1,30 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(specialization)] + +trait Iterate<'a> { + type Ty: Valid; + fn iterate(self); +} +impl<'a, T> Iterate<'a> for T where T: Check { + default type Ty = (); + default fn iterate(self) {} +} + +trait Check {} +impl<'a, T> Check for T where >::Ty: Valid {} + +trait Valid {} + +fn main() { + Iterate::iterate(0); +} diff --git a/src/test/run-pass/issues/issue-38190.rs b/src/test/run-pass/issues/issue-38190.rs new file mode 100644 index 00000000000..86bc2ba02b8 --- /dev/null +++ b/src/test/run-pass/issues/issue-38190.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_38190.rs +// ignore-pretty issue #37195 + +#[macro_use] +extern crate issue_38190; + +mod auxiliary { + m!([mod issue_38190;]); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-38226.rs b/src/test/run-pass/issues/issue-38226.rs new file mode 100644 index 00000000000..d26807a4d68 --- /dev/null +++ b/src/test/run-pass/issues/issue-38226.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test makes sure that we don't run into a linker error because of the +// middle::reachable pass missing trait methods with default impls. + +// aux-build:issue_38226_aux.rs + +// Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty +// code gets optimized out: +// compile-flags: -Cno-prepopulate-passes -Cpasses=name-anon-globals + +extern crate issue_38226_aux; + +fn main() { + issue_38226_aux::foo::<()>(); +} diff --git a/src/test/run-pass/issues/issue-38437.rs b/src/test/run-pass/issues/issue-38437.rs new file mode 100644 index 00000000000..cea55270aa0 --- /dev/null +++ b/src/test/run-pass/issues/issue-38437.rs @@ -0,0 +1,55 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that drop elaboration clears the "master" discriminant +// drop flag even if it protects no fields. + +struct Good(usize); +impl Drop for Good { + #[inline(never)] + fn drop(&mut self) { + println!("dropping Good({})", self.0); + } +} + +struct Void; +impl Drop for Void { + #[inline(never)] + fn drop(&mut self) { + panic!("Suddenly, a Void appears."); + } +} + +enum E { + Never(Void), + Fine(Good) +} + +fn main() { + let mut go = true; + + loop { + let next; + match go { + true => next = E::Fine(Good(123)), + false => return, + } + + match next { + E::Never(_) => return, + E::Fine(_good) => go = false, + } + + // `next` is dropped and StorageDead'd here. We must reset the + // discriminant's drop flag to avoid random variants being + // dropped. + } +} diff --git a/src/test/run-pass/issues/issue-3847.rs b/src/test/run-pass/issues/issue-3847.rs new file mode 100644 index 00000000000..1342843f870 --- /dev/null +++ b/src/test/run-pass/issues/issue-3847.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +mod buildings { + pub struct Tower { pub height: usize } +} + +pub fn main() { + let sears = buildings::Tower { height: 1451 }; + let h: usize = match sears { + buildings::Tower { height: h } => { h } + }; + + println!("{}", h); +} diff --git a/src/test/run-pass/issues/issue-38556.rs b/src/test/run-pass/issues/issue-38556.rs new file mode 100644 index 00000000000..b1a30f910df --- /dev/null +++ b/src/test/run-pass/issues/issue-38556.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Foo; + +macro_rules! reexport { + () => { use Foo as Bar; } +} + +reexport!(); + +fn main() { + use Bar; + fn f(_: Bar) {} +} diff --git a/src/test/run-pass/issues/issue-38715.rs b/src/test/run-pass/issues/issue-38715.rs new file mode 100644 index 00000000000..8cc1d8af89c --- /dev/null +++ b/src/test/run-pass/issues/issue-38715.rs @@ -0,0 +1,25 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_38715.rs +// aux-build:issue_38715-modern.rs + +// Test that `#[macro_export] macro_rules!` shadow earlier `#[macro_export] macro_rules!` + +#[macro_use] +extern crate issue_38715; +#[macro_use] +extern crate issue_38715_modern; + +fn main() { + foo!(); + foo_modern!(); +} diff --git a/src/test/run-pass/issues/issue-38727.rs b/src/test/run-pass/issues/issue-38727.rs new file mode 100644 index 00000000000..81e63476524 --- /dev/null +++ b/src/test/run-pass/issues/issue-38727.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[repr(u64)] +enum A { + A = 0u64, + B = !0u64, +} + +fn cmp() -> A { + A::B +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-3874.rs b/src/test/run-pass/issues/issue-3874.rs new file mode 100644 index 00000000000..53a57c9943b --- /dev/null +++ b/src/test/run-pass/issues/issue-3874.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum PureCounter { PureCounterVariant(usize) } + +fn each(thing: PureCounter, blk: F) where F: FnOnce(&usize) { + let PureCounter::PureCounterVariant(ref x) = thing; + blk(x); +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-38763.rs b/src/test/run-pass/issues/issue-38763.rs new file mode 100644 index 00000000000..c488aa5ca1a --- /dev/null +++ b/src/test/run-pass/issues/issue-38763.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten + +#[repr(C)] +pub struct Foo(i128); + +#[no_mangle] +pub extern "C" fn foo(x: Foo) -> Foo { x } + +fn main() { + foo(Foo(1)); +} diff --git a/src/test/run-pass/issues/issue-3878.rs b/src/test/run-pass/issues/issue-3878.rs new file mode 100644 index 00000000000..9e073c749bb --- /dev/null +++ b/src/test/run-pass/issues/issue-3878.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(path_statements)] +#![feature(box_syntax)] + +pub fn main() { + let y: Box<_> = box 1; + y; +} diff --git a/src/test/run-pass/issues/issue-3888-2.rs b/src/test/run-pass/issues/issue-3888-2.rs new file mode 100644 index 00000000000..707145392c7 --- /dev/null +++ b/src/test/run-pass/issues/issue-3888-2.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { + &v[1..5] +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-38942.rs b/src/test/run-pass/issues/issue-38942.rs new file mode 100644 index 00000000000..740bf952828 --- /dev/null +++ b/src/test/run-pass/issues/issue-38942.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// See https://github.com/rust-lang/rust/issues/38942 + +#[repr(u64)] +pub enum NSEventType { + NSEventTypePressure, +} + +pub const A: u64 = NSEventType::NSEventTypePressure as u64; + +fn banana() -> u64 { + A +} + +fn main() { + println!("banana! {}", banana()); +} diff --git a/src/test/run-pass/issues/issue-3895.rs b/src/test/run-pass/issues/issue-3895.rs new file mode 100644 index 00000000000..3620cb874f5 --- /dev/null +++ b/src/test/run-pass/issues/issue-3895.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + enum State { BadChar, BadSyntax } + + match State::BadChar { + _ if true => State::BadChar, + State::BadChar | State::BadSyntax => panic!() , + }; +} diff --git a/src/test/run-pass/issues/issue-38987.rs b/src/test/run-pass/issues/issue-38987.rs new file mode 100644 index 00000000000..ef89ed6fee4 --- /dev/null +++ b/src/test/run-pass/issues/issue-38987.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128; +} diff --git a/src/test/run-pass/issues/issue-3904.rs b/src/test/run-pass/issues/issue-3904.rs new file mode 100644 index 00000000000..1f5b777c4d2 --- /dev/null +++ b/src/test/run-pass/issues/issue-3904.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn example_err(prog: &str, arg: &str) { + println!("{}: {}", prog, arg) +} + +fn exit(print: F, prog: &str, arg: &str) where F: FnOnce(&str, &str) { + print(prog, arg); +} + +struct X where F: FnOnce(&str, &str) { + err: F, +} + +impl X where F: FnOnce(&str, &str) { + pub fn boom(self) { + exit(self.err, "prog", "arg"); + } +} + +pub fn main(){ + let val = X { + err: example_err, + }; + val.boom(); +} diff --git a/src/test/run-pass/issues/issue-39089.rs b/src/test/run-pass/issues/issue-39089.rs new file mode 100644 index 00000000000..e4ace4299bd --- /dev/null +++ b/src/test/run-pass/issues/issue-39089.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn f Sized>() {} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-39292.rs b/src/test/run-pass/issues/issue-39292.rs new file mode 100644 index 00000000000..4b79e08f334 --- /dev/null +++ b/src/test/run-pass/issues/issue-39292.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #39292. The object vtable was being +// incorrectly left with a null pointer. + +trait Foo { + fn print<'a>(&'a self) where T: 'a { println!("foo"); } +} + +impl<'a> Foo<&'a ()> for () { } + +trait Bar: for<'a> Foo<&'a ()> { } + +impl Bar for () {} + +fn main() { + (&() as &Bar).print(); // Segfault +} diff --git a/src/test/run-pass/issues/issue-3935.rs b/src/test/run-pass/issues/issue-3935.rs new file mode 100644 index 00000000000..756bc7b5797 --- /dev/null +++ b/src/test/run-pass/issues/issue-3935.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(PartialEq)] +struct Bike { + name: String, +} + +pub fn main() { + let town_bike = Bike { name: "schwinn".to_string() }; + let my_bike = Bike { name: "surly".to_string() }; + + assert!(town_bike != my_bike); +} diff --git a/src/test/run-pass/issues/issue-39367.rs b/src/test/run-pass/issues/issue-39367.rs new file mode 100644 index 00000000000..4f6ed57a7ae --- /dev/null +++ b/src/test/run-pass/issues/issue-39367.rs @@ -0,0 +1,50 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Deref; + +struct ArenaSet::Target>(U, &'static V) + where V: 'static + ?Sized; + +static Z: [u8; 4] = [1,2,3,4]; + +fn arena() -> &'static ArenaSet> { + fn __static_ref_initialize() -> ArenaSet> { + ArenaSet(vec![], &Z) + } + unsafe { + use std::sync::{Once, ONCE_INIT}; + fn require_sync(_: &T) { } + unsafe fn __stability() -> &'static ArenaSet> { + use std::mem::transmute; + use std::boxed::Box; + static mut DATA: *const ArenaSet> = 0 as *const ArenaSet>; + + static mut ONCE: Once = ONCE_INIT; + ONCE.call_once(|| { + DATA = transmute + ::>>, *const ArenaSet>> + (Box::new(__static_ref_initialize())); + }); + + &*DATA + } + let static_ref = __stability(); + require_sync(static_ref); + static_ref + } +} + +fn main() { + let &ArenaSet(ref u, v) = arena(); + assert!(u.is_empty()); + assert_eq!(v, Z); +} diff --git a/src/test/run-pass/issues/issue-39467.rs b/src/test/run-pass/issues/issue-39467.rs new file mode 100644 index 00000000000..3fab06d9a68 --- /dev/null +++ b/src/test/run-pass/issues/issue-39467.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! expr { () => { () } } + +enum A {} + +impl A { + const A: () = expr!(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-39548.rs b/src/test/run-pass/issues/issue-39548.rs new file mode 100644 index 00000000000..28bf971c830 --- /dev/null +++ b/src/test/run-pass/issues/issue-39548.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +type Array = [(); ((1 < 2) == false) as usize]; + +fn main() { + let _: Array = []; +} diff --git a/src/test/run-pass/issues/issue-39709.rs b/src/test/run-pass/issues/issue-39709.rs new file mode 100644 index 00000000000..44caa644edf --- /dev/null +++ b/src/test/run-pass/issues/issue-39709.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + println!("{}", { macro_rules! x { ($(t:tt)*) => {} } 33 }); +} + diff --git a/src/test/run-pass/issues/issue-39720.rs b/src/test/run-pass/issues/issue-39720.rs new file mode 100644 index 00000000000..157cc41cdd3 --- /dev/null +++ b/src/test/run-pass/issues/issue-39720.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// ignore-emscripten FIXME(#45351) + +#![feature(repr_simd, platform_intrinsics)] + +#[repr(C)] +#[repr(simd)] +#[derive(Copy, Clone, Debug)] +pub struct char3(pub i8, pub i8, pub i8); + +#[repr(C)] +#[repr(simd)] +#[derive(Copy, Clone, Debug)] +pub struct short3(pub i16, pub i16, pub i16); + +extern "platform-intrinsic" { + fn simd_cast(x: T) -> U; +} + +fn main() { + let cast: short3 = unsafe { simd_cast(char3(10, -3, -9)) }; + + println!("{:?}", cast); +} diff --git a/src/test/run-pass/issues/issue-39720.stderr b/src/test/run-pass/issues/issue-39720.stderr new file mode 100644 index 00000000000..7b717d86335 --- /dev/null +++ b/src/test/run-pass/issues/issue-39720.stderr @@ -0,0 +1,16 @@ +warning[E0566]: conflicting representation hints + --> $DIR/issue-39720.rs:18:8 + | +LL | #[repr(C)] + | ^ +LL | #[repr(simd)] + | ^^^^ + +warning[E0566]: conflicting representation hints + --> $DIR/issue-39720.rs:23:8 + | +LL | #[repr(C)] + | ^ +LL | #[repr(simd)] + | ^^^^ + diff --git a/src/test/run-pass/issues/issue-3979-2.rs b/src/test/run-pass/issues/issue-3979-2.rs new file mode 100644 index 00000000000..9b8e5817c6c --- /dev/null +++ b/src/test/run-pass/issues/issue-3979-2.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait A { + fn a_method(&self); +} + +trait B: A { + fn b_method(&self); +} + +trait C: B { + fn c_method(&self) { + self.a_method(); + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-3979-generics.rs b/src/test/run-pass/issues/issue-3979-generics.rs new file mode 100644 index 00000000000..7766d7d1bdc --- /dev/null +++ b/src/test/run-pass/issues/issue-3979-generics.rs @@ -0,0 +1,45 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +use std::ops::Add; + +trait Positioned { + fn SetX(&mut self, _: S); + fn X(&self) -> S; +} + +trait Movable>: Positioned { + fn translate(&mut self, dx: S) { + let x = self.X() + dx; + self.SetX(x); + } +} + +struct Point { x: isize, y: isize } + +impl Positioned for Point { + fn SetX(&mut self, x: isize) { + self.x = x; + } + fn X(&self) -> isize { + self.x + } +} + +impl Movable for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/src/test/run-pass/issues/issue-3979-xcrate.rs b/src/test/run-pass/issues/issue-3979-xcrate.rs new file mode 100644 index 00000000000..d698e7ac775 --- /dev/null +++ b/src/test/run-pass/issues/issue-3979-xcrate.rs @@ -0,0 +1,34 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_3979_traits.rs + +extern crate issue_3979_traits; +use issue_3979_traits::{Positioned, Movable}; + +struct Point { x: isize, y: isize } + +impl Positioned for Point { + fn SetX(&mut self, x: isize) { + self.x = x; + } + fn X(&self) -> isize { + self.x + } +} + +impl Movable for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/src/test/run-pass/issues/issue-3979.rs b/src/test/run-pass/issues/issue-3979.rs new file mode 100644 index 00000000000..4cc2e882baa --- /dev/null +++ b/src/test/run-pass/issues/issue-3979.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +trait Positioned { + fn SetX(&mut self, _: isize); + fn X(&self) -> isize; +} + +trait Movable: Positioned { + fn translate(&mut self, dx: isize) { + let x = self.X(); + self.SetX(x + dx); + } +} + +struct Point { x: isize, y: isize } + +impl Positioned for Point { + fn SetX(&mut self, x: isize) { + self.x = x; + } + fn X(&self) -> isize { + self.x + } +} + +impl Movable for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/src/test/run-pass/issues/issue-39808.rs b/src/test/run-pass/issues/issue-39808.rs new file mode 100644 index 00000000000..78c67302a99 --- /dev/null +++ b/src/test/run-pass/issues/issue-39808.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unreachable_code)] + +// Regression test for #39808. The type parameter of `Owned` was +// considered to be "unconstrained" because the type resulting from +// `format!` (`String`) was not being propagated upward, owing to the +// fact that the expression diverges. + +use std::borrow::Cow; + +fn main() { + let _ = if false { + Cow::Owned(format!("{:?}", panic!())) + } else { + Cow::Borrowed("") + }; +} diff --git a/src/test/run-pass/issues/issue-39823.rs b/src/test/run-pass/issues/issue-39823.rs new file mode 100644 index 00000000000..4a2e4846a59 --- /dev/null +++ b/src/test/run-pass/issues/issue-39823.rs @@ -0,0 +1,35 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_39823.rs + +extern crate issue_39823; +use issue_39823::{RemoteC, RemoteG}; + +#[derive(Debug, PartialEq)] +struct LocalC(u32); + +#[derive(Debug, PartialEq)] +struct LocalG(T); + +fn main() { + let virtual_localc : &Fn(_) -> LocalC = &LocalC; + assert_eq!(virtual_localc(1), LocalC(1)); + + let virtual_localg : &Fn(_) -> LocalG = &LocalG; + assert_eq!(virtual_localg(1), LocalG(1)); + + let virtual_remotec : &Fn(_) -> RemoteC = &RemoteC; + assert_eq!(virtual_remotec(1), RemoteC(1)); + + let virtual_remoteg : &Fn(_) -> RemoteG = &RemoteG; + assert_eq!(virtual_remoteg(1), RemoteG(1)); +} diff --git a/src/test/run-pass/issues/issue-39827.rs b/src/test/run-pass/issues/issue-39827.rs new file mode 100644 index 00000000000..c7b2a0d4fc0 --- /dev/null +++ b/src/test/run-pass/issues/issue-39827.rs @@ -0,0 +1,44 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] + +use std::intrinsics::{ volatile_copy_memory, volatile_store, volatile_load, + volatile_copy_nonoverlapping_memory, + volatile_set_memory }; + +// +// This test ensures that volatile intrinsics can be specialised with +// zero-sized types and, in case of copy/set functions, can accept +// number of elements equal to zero. +// +fn main () { + let mut dst_pair = (1, 2); + let src_pair = (3, 4); + let mut dst_empty = (); + let src_empty = (); + + const COUNT_0: usize = 0; + const COUNT_100: usize = 100; + + unsafe { + volatile_copy_memory(&mut dst_pair, &dst_pair, COUNT_0); + volatile_copy_nonoverlapping_memory(&mut dst_pair, &src_pair, 0); + volatile_copy_memory(&mut dst_empty, &dst_empty, 100); + volatile_copy_nonoverlapping_memory(&mut dst_empty, &src_empty, + COUNT_100); + volatile_set_memory(&mut dst_empty, 0, COUNT_100); + volatile_set_memory(&mut dst_pair, 0, COUNT_0); + volatile_store(&mut dst_empty, ()); + volatile_store(&mut dst_empty, src_empty); + volatile_load(&src_empty); + } +} diff --git a/src/test/run-pass/issues/issue-3991.rs b/src/test/run-pass/issues/issue-3991.rs new file mode 100644 index 00000000000..d3efcaf636e --- /dev/null +++ b/src/test/run-pass/issues/issue-3991.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +struct HasNested { + nest: Vec > , +} + +impl HasNested { + fn method_push_local(&mut self) { + self.nest[0].push(0); + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-39984.rs b/src/test/run-pass/issues/issue-39984.rs new file mode 100644 index 00000000000..450620da35a --- /dev/null +++ b/src/test/run-pass/issues/issue-39984.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #39984. +// +// The key here is that the error type of the `Ok` call ought to be +// constrained to `String`, even though it is dead-code. + +fn main() {} + +fn t() -> Result<(), String> { + return Err("".into()); + Ok(()) +} diff --git a/src/test/run-pass/issues/issue-40003.rs b/src/test/run-pass/issues/issue-40003.rs new file mode 100644 index 00000000000..cf18ab47c39 --- /dev/null +++ b/src/test/run-pass/issues/issue-40003.rs @@ -0,0 +1,187 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + if false { test(); } +} + +fn test() { + let rx = Err::, u32>(1).into_future(); + + rx.map(|l: Vec| stream::iter(l.into_iter().map(|i| Ok(i)))) + .flatten_stream() + .chunks(50) + .buffer_unordered(5); +} + +use future::{Future, IntoFuture}; +mod future { + use std::result; + + use {stream, Stream}; + + pub trait Future { + type Item; + type Error; + + fn map(self, _: F) -> Map + where F: FnOnce(Self::Item) -> U, + Self: Sized, + { + panic!() + } + + fn flatten_stream(self) -> FlattenStream + where ::Item: stream::Stream, + Self: Sized + { + panic!() + } + } + + pub trait IntoFuture { + type Future: Future; + type Item; + type Error; + fn into_future(self) -> Self::Future; + } + + impl IntoFuture for F { + type Future = F; + type Item = F::Item; + type Error = F::Error; + + fn into_future(self) -> F { + panic!() + } + } + + impl IntoFuture for result::Result { + type Future = FutureResult; + type Item = T; + type Error = E; + + fn into_future(self) -> FutureResult { + panic!() + } + } + + pub struct Map { + _a: (A, F), + } + + impl Future for Map + where A: Future, + F: FnOnce(A::Item) -> U, + { + type Item = U; + type Error = A::Error; + } + + pub struct FlattenStream { + _f: F, + } + + impl Stream for FlattenStream + where F: Future, + ::Item: Stream, + { + type Item = ::Item; + type Error = ::Error; + } + + pub struct FutureResult { + _inner: (T, E), + } + + impl Future for FutureResult { + type Item = T; + type Error = E; + } +} + +mod stream { + use IntoFuture; + + pub trait Stream { + type Item; + type Error; + + fn buffer_unordered(self, amt: usize) -> BufferUnordered + where Self::Item: IntoFuture::Error>, + Self: Sized + { + new(self, amt) + } + + fn chunks(self, _capacity: usize) -> Chunks + where Self: Sized + { + panic!() + } + } + + pub struct IterStream { + _iter: I, + } + + pub fn iter(_: J) -> IterStream + where J: IntoIterator>, + { + panic!() + } + + impl Stream for IterStream + where I: Iterator>, + { + type Item = T; + type Error = E; + } + + pub struct Chunks { + _stream: S + } + + impl Stream for Chunks + where S: Stream + { + type Item = Result::Item>, u32>; + type Error = ::Error; + } + + pub struct BufferUnordered { + _stream: S, + } + + enum Slot { + Next(usize), + _Data { _a: T }, + } + + fn new(_s: S, _amt: usize) -> BufferUnordered + where S: Stream, + S::Item: IntoFuture::Error>, + { + (0..0).map(|_| { + Slot::Next::<::Future>(1) + }).collect::>(); + panic!() + } + + impl Stream for BufferUnordered + where S: Stream, + S::Item: IntoFuture::Error>, + { + type Item = ::Item; + type Error = ::Error; + } +} +use stream::Stream; diff --git a/src/test/run-pass/issues/issue-40085.rs b/src/test/run-pass/issues/issue-40085.rs new file mode 100644 index 00000000000..062366941d9 --- /dev/null +++ b/src/test/run-pass/issues/issue-40085.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Index; +fn bar() {} +static UNIT: () = (); +struct S; +impl Index for S { + type Output = (); + fn index(&self, _: fn()) -> &() { &UNIT } +} +fn main() { + S.index(bar); + S[bar]; +} diff --git a/src/test/run-pass/issues/issue-40136.rs b/src/test/run-pass/issues/issue-40136.rs new file mode 100644 index 00000000000..5c1a527dbeb --- /dev/null +++ b/src/test/run-pass/issues/issue-40136.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! m { () => { 0 } } + +trait T { + const C: i32 = m!(); +} + +struct S; +impl S { + const C: i32 = m!(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-40235.rs b/src/test/run-pass/issues/issue-40235.rs new file mode 100644 index 00000000000..3c26183f146 --- /dev/null +++ b/src/test/run-pass/issues/issue-40235.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo() {} + +fn main() { + while let Some(foo) = Some(1) { break } + foo(); +} diff --git a/src/test/run-pass/issues/issue-4025.rs b/src/test/run-pass/issues/issue-4025.rs new file mode 100644 index 00000000000..f216ba9b9c9 --- /dev/null +++ b/src/test/run-pass/issues/issue-4025.rs @@ -0,0 +1,33 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +/* +# if b { x } else { y } requires identical types for x and y +*/ + +fn print1(b: bool, s1: &str, s2: &str) { + println!("{}", if b { s1 } else { s2 }); +} +fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { + println!("{}", if b { s1 } else { s2 }); +} +fn print3(b: bool, s1: &str, s2: &str) { + let mut s: &str; + if b { s = s1; } else { s = s2; } + println!("{}", s); +} +fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { + let mut s: &str; + if b { s = s1; } else { s = s2; } + println!("{}", s); +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-40408.rs b/src/test/run-pass/issues/issue-40408.rs new file mode 100644 index 00000000000..68f2858df47 --- /dev/null +++ b/src/test/run-pass/issues/issue-40408.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + println!("{}", 0E+10); + println!("{}", 0e+10); + println!("{}", 00e+10); + println!("{}", 00E+10); +} diff --git a/src/test/run-pass/issues/issue-40469.rs b/src/test/run-pass/issues/issue-40469.rs new file mode 100644 index 00000000000..fd0ad2d0e08 --- /dev/null +++ b/src/test/run-pass/issues/issue-40469.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +#![allow(dead_code)] + +include!("auxiliary/issue_40469.rs"); +fn f() { m!(); } + +fn main() {} diff --git a/src/test/run-pass/issues/issue-40770.rs b/src/test/run-pass/issues/issue-40770.rs new file mode 100644 index 00000000000..d27b13c3a10 --- /dev/null +++ b/src/test/run-pass/issues/issue-40770.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! m { + ($e:expr) => { + macro_rules! n { () => { $e } } + } +} + +fn main() { + m!(foo!()); +} diff --git a/src/test/run-pass/issues/issue-40847.rs b/src/test/run-pass/issues/issue-40847.rs new file mode 100644 index 00000000000..4d18cd6c7de --- /dev/null +++ b/src/test/run-pass/issues/issue-40847.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! gen { + ($name:ident ( $($dol:tt $var:ident)* ) $($body:tt)*) => { + macro_rules! $name { + ($($dol $var:ident)*) => { + $($body)* + } + } + } +} + +gen!(m($var) $var); + +fn main() { + let x = 1; + assert_eq!(m!(x), 1); +} diff --git a/src/test/run-pass/issues/issue-40883.rs b/src/test/run-pass/issues/issue-40883.rs new file mode 100644 index 00000000000..357152b60e5 --- /dev/null +++ b/src/test/run-pass/issues/issue-40883.rs @@ -0,0 +1,102 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check that we don't have linear stack usage with multiple calls to `push` + +#![feature(test)] + +extern crate test; +use std::mem; + +fn meal() -> Big { + if test::black_box(false) { + panic!() + } + Big { drop_me: [ + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + None, None, None, None, None, None, None, None, + ]} +} + +pub struct Big { + drop_me: [Option>; 48], +} + +#[inline] +fn push(out: &mut Vec) { + out.push(meal()); +} + +#[inline(never)] +pub fn supersize_me(out: &mut Vec) { + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); // 16 calls to `push` + + verify_stack_usage(out); + + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); + push(out); // 16 calls to `push` +} + +#[inline(never)] +fn verify_stack_usage(before_ptr: *mut Vec) { + // to check stack usage, create locals before and after + // and check the difference in addresses between them. + let mut stack_var: Vec = vec![]; + test::black_box(&mut stack_var); + let stack_usage = isize::abs( + (&mut stack_var as *mut _ as isize) - + (before_ptr as isize)) as usize; + // give space for 2 copies of `Big` + 128 "misc" bytes. + if stack_usage > mem::size_of::() * 2 + 128 { + panic!("used {} bytes of stack, but `struct Big` is only {} bytes", + stack_usage, mem::size_of::()); + } + +} + +pub fn main() { + let mut v = vec![]; + test::black_box(&mut v); + supersize_me(&mut v); +} diff --git a/src/test/run-pass/issues/issue-40951.rs b/src/test/run-pass/issues/issue-40951.rs new file mode 100644 index 00000000000..b6f74f4f1cd --- /dev/null +++ b/src/test/run-pass/issues/issue-40951.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #40951. + +const FOO: [&'static str; 1] = ["foo"]; + +fn find(t: &[T], element: &T) { } + +fn main() { + let x = format!("hi"); + find(&FOO, &&*x); +} diff --git a/src/test/run-pass/issues/issue-40962.rs b/src/test/run-pass/issues/issue-40962.rs new file mode 100644 index 00000000000..9c9fb2ce9cb --- /dev/null +++ b/src/test/run-pass/issues/issue-40962.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! m { + ($i:meta) => { + #[derive($i)] + struct S; + } +} + +m!(Clone); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-41053.rs b/src/test/run-pass/issues/issue-41053.rs new file mode 100644 index 00000000000..2d9dec6bbc7 --- /dev/null +++ b/src/test/run-pass/issues/issue-41053.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_41053.rs + +pub trait Trait { fn foo(&self) {} } + +pub struct Foo; + +impl Iterator for Foo { + type Item = Box; + fn next(&mut self) -> Option> { + extern crate issue_41053; + impl ::Trait for issue_41053::Test { + fn foo(&self) {} + } + Some(Box::new(issue_41053::Test)) + } +} + +fn main() { + Foo.next().unwrap().foo(); +} diff --git a/src/test/run-pass/issues/issue-4107.rs b/src/test/run-pass/issues/issue-4107.rs new file mode 100644 index 00000000000..a05b1ddd9f4 --- /dev/null +++ b/src/test/run-pass/issues/issue-4107.rs @@ -0,0 +1,35 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let _id: &Mat2 = &Matrix::identity(1.0); +} + +pub trait Index { fn get(&self, _: Index) -> Result { panic!() } } +pub trait Dimensional: Index { } + +pub struct Mat2 { x: T } +pub struct Vec2 { x: T } + +impl Dimensional> for Mat2 { } +impl Index> for Mat2 { } + +impl Dimensional for Vec2 { } +impl Index for Vec2 { } + +pub trait Matrix: Dimensional { + fn identity(t:T) -> Self; +} + +impl Matrix> for Mat2 { + fn identity(t:T) -> Mat2 { Mat2{ x: t } } +} diff --git a/src/test/run-pass/issues/issue-41213.rs b/src/test/run-pass/issues/issue-41213.rs new file mode 100644 index 00000000000..0f1d8fe7249 --- /dev/null +++ b/src/test/run-pass/issues/issue-41213.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum A { + A1, + A2, + A3, +} + +enum B { + B1(String, String), + B2(String, String), +} + +fn main() { + let a = A::A1; + loop { + let _ctor = match a { + A::A3 => break, + A::A1 => B::B1, + A::A2 => B::B2, + }; + break; + } +} diff --git a/src/test/run-pass/issues/issue-41272.rs b/src/test/run-pass/issues/issue-41272.rs new file mode 100644 index 00000000000..3debd77d123 --- /dev/null +++ b/src/test/run-pass/issues/issue-41272.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo; + +impl Foo { + fn bar(&mut self) -> bool { true } +} + +fn error(foo: &mut Foo) { + if let Some(_) = Some(true) { + } else if foo.bar() {} +} + +fn ok(foo: &mut Foo) { + if let Some(_) = Some(true) { + } else { + if foo.bar() {} + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-41298.rs b/src/test/run-pass/issues/issue-41298.rs new file mode 100644 index 00000000000..62e1afb9230 --- /dev/null +++ b/src/test/run-pass/issues/issue-41298.rs @@ -0,0 +1,17 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Function { t: T, f: F } + +impl Function R> { fn foo() { } } +impl Function R> { fn bar() { } } + +fn main() { } diff --git a/src/test/run-pass/issues/issue-41394.rs b/src/test/run-pass/issues/issue-41394.rs new file mode 100644 index 00000000000..9287c672108 --- /dev/null +++ b/src/test/run-pass/issues/issue-41394.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-41394.rs + +extern crate issue_41394 as lib; + +fn main() { + assert_eq!(lib::foo() as u32, 42); +} diff --git a/src/test/run-pass/issues/issue-41479.rs b/src/test/run-pass/issues/issue-41479.rs new file mode 100644 index 00000000000..f527257207a --- /dev/null +++ b/src/test/run-pass/issues/issue-41479.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn split(pair: (A, B)) { + let _a = pair.0; + let _b = pair.1; +} + +fn main() { + split(((), ((), ()))); +} diff --git a/src/test/run-pass/issues/issue-41498.rs b/src/test/run-pass/issues/issue-41498.rs new file mode 100644 index 00000000000..18acc7d7c31 --- /dev/null +++ b/src/test/run-pass/issues/issue-41498.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// regression test for issue #41498. + +struct S; +impl S { + fn mutate(&mut self) {} +} + +fn call_and_ref T>(x: &mut Option, f: F) -> &mut T { + *x = Some(f()); + x.as_mut().unwrap() +} + +fn main() { + let mut n = None; + call_and_ref(&mut n, || [S])[0].mutate(); +} diff --git a/src/test/run-pass/issues/issue-41604.rs b/src/test/run-pass/issues/issue-41604.rs new file mode 100644 index 00000000000..c4eda86c9c0 --- /dev/null +++ b/src/test/run-pass/issues/issue-41604.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct B; + +impl B { + fn init(&mut self) {} +} + +fn main() { + let mut b = [B]; + b[1-1].init(); +} diff --git a/src/test/run-pass/issues/issue-41628.rs b/src/test/run-pass/issues/issue-41628.rs new file mode 100644 index 00000000000..f4b9588ff05 --- /dev/null +++ b/src/test/run-pass/issues/issue-41628.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(dead_code)] + +#[used] +static FOO: u32 = 0; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-41677.rs b/src/test/run-pass/issues/issue-41677.rs new file mode 100644 index 00000000000..b99a5f7f2a7 --- /dev/null +++ b/src/test/run-pass/issues/issue-41677.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #41677. The local variable was winding up with +// a type `Receiver` where `?T` was unconstrained, because we +// failed to enforce the WF obligations and `?T` is a bivariant type +// parameter position. + +#![allow(unused_variables, dead_code)] + +use std::marker::PhantomData; + +trait Handle { + type Inner; +} + +struct ResizingHandle(PhantomData); +impl Handle for ResizingHandle { + type Inner = H; +} + +struct Receiver>(PhantomData); + +fn channel(size: usize) -> Receiver> { + let rx = Receiver(PhantomData); + rx +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-41696.rs b/src/test/run-pass/issues/issue-41696.rs new file mode 100644 index 00000000000..780290dce7f --- /dev/null +++ b/src/test/run-pass/issues/issue-41696.rs @@ -0,0 +1,61 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// this used to cause exponential code-size blowup during LLVM passes. + +#![feature(test)] + +extern crate test; + +struct MayUnwind; + +impl Drop for MayUnwind { + fn drop(&mut self) { + if test::black_box(false) { + panic!() + } + } +} + +struct DS { + may_unwind: MayUnwind, + name: String, + next: U, +} + +fn add(ds: DS, name: String) -> DS> { + DS { + may_unwind: MayUnwind, + name: "?".to_owned(), + next: ds, + } +} + +fn main() { + let deserializers = DS { may_unwind: MayUnwind, name: "?".to_owned(), next: () }; + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); + let deserializers = add(deserializers, "?".to_owned()); // 0.7s + let deserializers = add(deserializers, "?".to_owned()); // 1.3s + let deserializers = add(deserializers, "?".to_owned()); // 2.4s + let deserializers = add(deserializers, "?".to_owned()); // 6.7s + let deserializers = add(deserializers, "?".to_owned()); // 26.0s + let deserializers = add(deserializers, "?".to_owned()); // 114.0s + let deserializers = add(deserializers, "?".to_owned()); // 228.0s + let deserializers = add(deserializers, "?".to_owned()); // 400.0s + let deserializers = add(deserializers, "?".to_owned()); // 800.0s + let deserializers = add(deserializers, "?".to_owned()); // 1600.0s + let deserializers = add(deserializers, "?".to_owned()); // 3200.0s +} diff --git a/src/test/run-pass/issues/issue-41744.rs b/src/test/run-pass/issues/issue-41744.rs new file mode 100644 index 00000000000..b667b1d929b --- /dev/null +++ b/src/test/run-pass/issues/issue-41744.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Tc {} +impl Tc for bool {} + +fn main() { + let _: &[&Tc] = &[&true]; +} diff --git a/src/test/run-pass/issues/issue-41803.rs b/src/test/run-pass/issues/issue-41803.rs new file mode 100644 index 00000000000..30e3d60bd34 --- /dev/null +++ b/src/test/run-pass/issues/issue-41803.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +/// A compile-time map from identifiers to arbitrary (heterogeneous) expressions +macro_rules! ident_map { + ( $name:ident = { $($key:ident => $e:expr,)* } ) => { + macro_rules! $name { + $( + ( $key ) => { $e }; + )* + // Empty invocation expands to nothing. Needed when the map is empty. + () => {}; + } + }; +} + +ident_map!(my_map = { + main => 0, +}); + +fn main() { + my_map!(main); +} diff --git a/src/test/run-pass/issues/issue-41849-variance-req.rs b/src/test/run-pass/issues/issue-41849-variance-req.rs new file mode 100644 index 00000000000..2f8c108f590 --- /dev/null +++ b/src/test/run-pass/issues/issue-41849-variance-req.rs @@ -0,0 +1,44 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #41849. + +use std::ops::Mul; + +const C: usize = 1; +const CAPACITY: usize = 1 * C; + +struct A { + f: [X; CAPACITY], +} + +struct B { + f: T, +} + +impl Mul for B { + type Output = Self; + fn mul(self, _rhs: B) -> Self::Output { + self + } +} + +impl Mul for B { + type Output = Self; + fn mul(self, _rhs: usize) -> Self::Output { + self + } +} + +fn main() { + let a = A { f: [1] }; + let _ = B { f: a }; +} diff --git a/src/test/run-pass/issues/issue-41888.rs b/src/test/run-pass/issues/issue-41888.rs new file mode 100644 index 00000000000..5ae8029e224 --- /dev/null +++ b/src/test/run-pass/issues/issue-41888.rs @@ -0,0 +1,44 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { let _ = g(Some(E::F(K))); } + +type R = Result<(), ()>; +struct K; + +enum E { + F(K), // must not be built-in type + #[allow(dead_code)] + G(Box, Box), +} + +fn translate(x: R) -> R { x } + +fn g(mut status: Option) -> R { + loop { + match status { + Some(infix_or_postfix) => match infix_or_postfix { + E::F(_op) => { // <- must be captured by value + match Ok(()) { + Err(err) => return Err(err), + Ok(_) => {}, + }; + } + _ => (), + }, + _ => match translate(Err(())) { + Err(err) => return Err(err), + Ok(_) => {}, + } + } + status = None; + } +} diff --git a/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs b/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs new file mode 100644 index 00000000000..f47e69931d5 --- /dev/null +++ b/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #41936. The coerce-unsized trait check in +// coherence was using subtyping, which triggered variance +// computation, which failed because it required type info for fields +// that had not (yet) been computed. + +#![feature(unsize)] +#![feature(coerce_unsized)] + +use std::{marker,ops}; + +// Change the array to a non-array, and error disappears +// Adding a new field to the end keeps the error +struct LogDataBuf([u8;8]); + +struct Aref +{ + // Inner structure triggers the error, removing the inner removes the message. + ptr: Box>, +} +impl, U: ?Sized> ops::CoerceUnsized> for Aref {} + +struct ArefInner +{ + // Even with this field commented out, the error is raised. + data: T, +} + +fn main(){} diff --git a/src/test/run-pass/issues/issue-42007.rs b/src/test/run-pass/issues/issue-42007.rs new file mode 100644 index 00000000000..b72343f05c6 --- /dev/null +++ b/src/test/run-pass/issues/issue-42007.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_42007_s.rs + +extern crate issue_42007_s; + +enum I { + E(issue_42007_s::E), +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-4208.rs b/src/test/run-pass/issues/issue-4208.rs new file mode 100644 index 00000000000..fa6f56bc817 --- /dev/null +++ b/src/test/run-pass/issues/issue-4208.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-4208-cc.rs + +// pretty-expanded FIXME #23616 + +extern crate numeric; +use numeric::{sin, Angle}; + +fn foo>(theta: A) -> T { sin(&theta) } + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-42148.rs b/src/test/run-pass/issues/issue-42148.rs new file mode 100644 index 00000000000..76947e8b0ba --- /dev/null +++ b/src/test/run-pass/issues/issue-42148.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Zst; + +fn main() { + unsafe { ::std::ptr::write_volatile(1 as *mut Zst, Zst) } +} diff --git a/src/test/run-pass/issues/issue-42210.rs b/src/test/run-pass/issues/issue-42210.rs new file mode 100644 index 00000000000..d3b0da5e044 --- /dev/null +++ b/src/test/run-pass/issues/issue-42210.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #42210. + +// compile-flags: -g + +trait Foo { + fn foo() { } +} + +struct Bar; + +trait Baz { +} + +impl Foo for (Bar, Baz) { } + + +fn main() { + <(Bar, Baz) as Foo>::foo() +} diff --git a/src/test/run-pass/issues/issue-4228.rs b/src/test/run-pass/issues/issue-4228.rs new file mode 100644 index 00000000000..e66921fe115 --- /dev/null +++ b/src/test/run-pass/issues/issue-4228.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo; + +impl Foo { + fn first() {} +} +impl Foo { + fn second() {} +} + +pub fn main() { + Foo::first(); + Foo::second(); +} diff --git a/src/test/run-pass/issues/issue-42453.rs b/src/test/run-pass/issues/issue-42453.rs new file mode 100644 index 00000000000..649f52ef82e --- /dev/null +++ b/src/test/run-pass/issues/issue-42453.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#[derive(Debug)] +struct builder; + +fn main() { + +} + diff --git a/src/test/run-pass/issues/issue-42463.rs b/src/test/run-pass/issues/issue-42463.rs new file mode 100644 index 00000000000..9074ab8b6dd --- /dev/null +++ b/src/test/run-pass/issues/issue-42463.rs @@ -0,0 +1,42 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::{Deref, DerefMut}; + +struct CheckedDeref { + value: T, + check: F +} + +impl bool, T> Deref for CheckedDeref { + type Target = T; + fn deref(&self) -> &T { + assert!((self.check)(&self.value)); + &self.value + } +} + +impl bool, T> DerefMut for CheckedDeref { + fn deref_mut(&mut self) -> &mut T { + assert!((self.check)(&self.value)); + &mut self.value + } +} + + +fn main() { + let mut v = CheckedDeref { + value: vec![0], + check: |v: &Vec<_>| !v.is_empty() + }; + v.push(1); + assert_eq!(*v, vec![0, 1]); +} diff --git a/src/test/run-pass/issues/issue-42467.rs b/src/test/run-pass/issues/issue-42467.rs new file mode 100644 index 00000000000..0f89d505751 --- /dev/null +++ b/src/test/run-pass/issues/issue-42467.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo(T); + +struct IntoIter(T); + +impl<'a, T: 'a> Iterator for IntoIter { + type Item = (); + + fn next(&mut self) -> Option<()> { + None + } +} + +impl IntoIterator for Foo { + type Item = (); + type IntoIter = IntoIter; + + fn into_iter(self) -> IntoIter { + IntoIter(self.0) + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-4252.rs b/src/test/run-pass/issues/issue-4252.rs new file mode 100644 index 00000000000..c733bf5b764 --- /dev/null +++ b/src/test/run-pass/issues/issue-4252.rs @@ -0,0 +1,43 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait X { + fn call(&self, x: &T); + fn default_method(&self, x: &T) { + println!("X::default_method {:?}", x); + } +} + +#[derive(Debug)] +struct Y(isize); + +#[derive(Debug)] +struct Z { + x: T +} + +impl X for Y { + fn call(&self, x: &T) { + println!("X::call {:?} {:?}", self, x); + } +} + +impl Drop for Z { + fn drop(&mut self) { + // These statements used to cause an ICE. + self.x.call(self); + self.x.default_method(self); + } +} + +pub fn main() { + let _z = Z {x: Y(42)}; +} diff --git a/src/test/run-pass/issues/issue-42552.rs b/src/test/run-pass/issues/issue-42552.rs new file mode 100644 index 00000000000..e1c3a1bd141 --- /dev/null +++ b/src/test/run-pass/issues/issue-42552.rs @@ -0,0 +1,41 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for an obscure issue with the projection cache. + +fn into_iter(a: &I) -> Groups { + Groups { _a: a } +} + +pub struct Groups<'a, I: 'a> { + _a: &'a I, +} + +impl<'a, I: Iterator> Iterator for Groups<'a, I> { + type Item = Group<'a, I>; + fn next(&mut self) -> Option { + None + } +} + +pub struct Group<'a, I: Iterator + 'a> + where I::Item: 'a // <-- needed to trigger ICE! +{ + _phantom: &'a (), + _ice_trigger: I::Item, // <-- needed to trigger ICE! +} + + +fn main() { + let _ = into_iter(&[0].iter().map(|_| 0)).map(|grp| { + let _g = grp; + }); +} diff --git a/src/test/run-pass/issues/issue-42679.rs b/src/test/run-pass/issues/issue-42679.rs new file mode 100644 index 00000000000..452d231a846 --- /dev/null +++ b/src/test/run-pass/issues/issue-42679.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] +#![feature(box_patterns)] + +#[derive(Debug, PartialEq)] +enum Test { + Foo(usize), + Bar(isize), +} + +fn main() { + let a = box Test::Foo(10); + let b = box Test::Bar(-20); + match (a, b) { + (_, box Test::Foo(_)) => unreachable!(), + (box Test::Foo(x), b) => { + assert_eq!(x, 10); + assert_eq!(b, box Test::Bar(-20)); + }, + _ => unreachable!(), + } +} diff --git a/src/test/run-pass/issues/issue-42747.rs b/src/test/run-pass/issues/issue-42747.rs new file mode 100644 index 00000000000..c91de3f40ea --- /dev/null +++ b/src/test/run-pass/issues/issue-42747.rs @@ -0,0 +1,56 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! fooN { + ($cur:ident $prev:ty) => { + #[allow(dead_code)] + enum $cur { + Empty, + First($prev), + Second($prev), + Third($prev), + Fourth($prev), + } + } +} + +fooN!(Foo0 ()); +fooN!(Foo1 Foo0); +fooN!(Foo2 Foo1); +fooN!(Foo3 Foo2); +fooN!(Foo4 Foo3); +fooN!(Foo5 Foo4); +fooN!(Foo6 Foo5); +fooN!(Foo7 Foo6); +fooN!(Foo8 Foo7); +fooN!(Foo9 Foo8); +fooN!(Foo10 Foo9); +fooN!(Foo11 Foo10); +fooN!(Foo12 Foo11); +fooN!(Foo13 Foo12); +fooN!(Foo14 Foo13); +fooN!(Foo15 Foo14); +fooN!(Foo16 Foo15); +fooN!(Foo17 Foo16); +fooN!(Foo18 Foo17); +fooN!(Foo19 Foo18); +fooN!(Foo20 Foo19); +fooN!(Foo21 Foo20); +fooN!(Foo22 Foo21); +fooN!(Foo23 Foo22); +fooN!(Foo24 Foo23); +fooN!(Foo25 Foo24); +fooN!(Foo26 Foo25); +fooN!(Foo27 Foo26); + +fn main() { + let _foo = Foo27::Empty; +} diff --git a/src/test/run-pass/issues/issue-42956.rs b/src/test/run-pass/issues/issue-42956.rs new file mode 100644 index 00000000000..cee9d8be98d --- /dev/null +++ b/src/test/run-pass/issues/issue-42956.rs @@ -0,0 +1,35 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +#![feature(associated_consts)] + +impl A for i32 { + type Foo = u32; +} +impl B for u32 { + const BAR: i32 = 0; +} + +trait A { + type Foo: B; +} + +trait B { + const BAR: i32; +} + +fn generic() { + // This panics if the universal function call syntax is used as well + println!("{}", T::Foo::BAR); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-43057.rs b/src/test/run-pass/issues/issue-43057.rs new file mode 100644 index 00000000000..26140246a7f --- /dev/null +++ b/src/test/run-pass/issues/issue-43057.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused)] + +macro_rules! column { + ($i:ident) => { + $i + }; +} + +fn foo() -> ! { + panic!(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-43132.rs b/src/test/run-pass/issues/issue-43132.rs new file mode 100644 index 00000000000..b80e000d2e7 --- /dev/null +++ b/src/test/run-pass/issues/issue-43132.rs @@ -0,0 +1,75 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused)] + +fn main() { +} + +fn foo() { + let b = mk::< + Forward<(Box>,)>, + >(); + b.map_err(|_| ()).join(); +} + +fn mk() -> T { + loop {} +} + +impl, E> Future for (I,) { + type Error = E; +} + +struct Forward { + _a: T, +} + +impl Future for Forward +where + T::Error: From, +{ + type Error = T::Error; +} + +trait Future { + type Error; + + fn map_err(self, _: F) -> (Self, F) + where + F: FnOnce(Self::Error) -> E, + Self: Sized, + { + loop {} + } + + fn join(self) -> (MaybeDone, ()) + where + Self: Sized, + { + loop {} + } +} + +impl Future for Box { + type Error = S::Error; +} + +enum MaybeDone { + _Done(A::Error), +} + +impl Future for (A, F) +where + F: FnOnce(A::Error) -> U, +{ + type Error = U; +} diff --git a/src/test/run-pass/issues/issue-43205.rs b/src/test/run-pass/issues/issue-43205.rs new file mode 100644 index 00000000000..8f89942ddfc --- /dev/null +++ b/src/test/run-pass/issues/issue-43205.rs @@ -0,0 +1,15 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + &&[()][0]; + println!("{:?}", &[(),()][1]); +} diff --git a/src/test/run-pass/issues/issue-43291.rs b/src/test/run-pass/issues/issue-43291.rs new file mode 100644 index 00000000000..cb850b54f7b --- /dev/null +++ b/src/test/run-pass/issues/issue-43291.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + assert_eq!(!0usize as *const (), foo(0, 1)); + assert_eq!(!0usize as *const (), (0i8 - 1) as *const ()); +} + +pub fn foo(a: i8, b: i8) -> *const () { + (a - b) as *const () +} diff --git a/src/test/run-pass/issues/issue-4333.rs b/src/test/run-pass/issues/issue-4333.rs new file mode 100644 index 00000000000..193a438fc9c --- /dev/null +++ b/src/test/run-pass/issues/issue-4333.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::io; + +pub fn main() { + let stdout = &mut io::stdout() as &mut io::Write; + stdout.write(b"Hello!"); +} diff --git a/src/test/run-pass/issues/issue-43357.rs b/src/test/run-pass/issues/issue-43357.rs new file mode 100644 index 00000000000..75d05c06428 --- /dev/null +++ b/src/test/run-pass/issues/issue-43357.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Trait { + type Output; +} + +fn f() { + std::mem::size_of::(); +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-43483.rs b/src/test/run-pass/issues/issue-43483.rs new file mode 100644 index 00000000000..52ee080125f --- /dev/null +++ b/src/test/run-pass/issues/issue-43483.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait VecN { + const DIM: usize; +} + +trait Mat { + type Row: VecN; +} + +fn m() { + let x = M::Row::DIM; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-43692.rs b/src/test/run-pass/issues/issue-43692.rs new file mode 100644 index 00000000000..a84dd86a156 --- /dev/null +++ b/src/test/run-pass/issues/issue-43692.rs @@ -0,0 +1,15 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + assert_eq!('\u{10__FFFF}', '\u{10FFFF}'); + assert_eq!("\u{10_F0FF__}foo\u{1_0_0_0__}", "\u{10F0FF}foo\u{1000}"); +} diff --git a/src/test/run-pass/issues/issue-43853.rs b/src/test/run-pass/issues/issue-43853.rs new file mode 100644 index 00000000000..bb8af71b54d --- /dev/null +++ b/src/test/run-pass/issues/issue-43853.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default + +use std::panic; + +fn test() { + wait(|| panic!()); +} + +fn wait T>(f: F) -> F::Output { + From::from(f()) +} + +fn main() { + let result = panic::catch_unwind(move || test()); + assert!(result.is_err()); +} diff --git a/src/test/run-pass/issues/issue-4387.rs b/src/test/run-pass/issues/issue-4387.rs new file mode 100644 index 00000000000..45c26433a20 --- /dev/null +++ b/src/test/run-pass/issues/issue-4387.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let _foo = [0; 2*4]; +} diff --git a/src/test/run-pass/issues/issue-43910.rs b/src/test/run-pass/issues/issue-43910.rs new file mode 100644 index 00000000000..5c401a7f82d --- /dev/null +++ b/src/test/run-pass/issues/issue-43910.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(unused_variables)] + +fn main() { + #[allow(unused_variables)] + let x = 12; +} diff --git a/src/test/run-pass/issues/issue-43923.rs b/src/test/run-pass/issues/issue-43923.rs new file mode 100644 index 00000000000..220a68e1335 --- /dev/null +++ b/src/test/run-pass/issues/issue-43923.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct A { ptr: T } + +fn foo(x: &A<[T]>) {} + +fn main() { + let a = foo; + let b = A { ptr: [a, a, a] }; + a(&A { ptr: [()] }); +} diff --git a/src/test/run-pass/issues/issue-44005.rs b/src/test/run-pass/issues/issue-44005.rs new file mode 100644 index 00000000000..699cb18ffc7 --- /dev/null +++ b/src/test/run-pass/issues/issue-44005.rs @@ -0,0 +1,40 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait Foo<'a> { + type Bar; + fn foo(&'a self) -> Self::Bar; +} + +impl<'a, 'b, T: 'a> Foo<'a> for &'b T { + type Bar = &'a T; + fn foo(&'a self) -> &'a T { + self + } +} + +pub fn uncallable(x: T, f: F) + where T: for<'a> Foo<'a>, + F: for<'a> Fn(>::Bar) +{ + f(x.foo()); +} + +pub fn catalyst(x: &i32) { + broken(x, |_| {}) +} + +pub fn broken(x: &i32, f: F) { + uncallable(x, |y| f(y)); +} + +fn main() { } + diff --git a/src/test/run-pass/issues/issue-4401.rs b/src/test/run-pass/issues/issue-4401.rs new file mode 100644 index 00000000000..5935901efe7 --- /dev/null +++ b/src/test/run-pass/issues/issue-4401.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let mut count = 0; + for _ in 0..999_999 { count += 1; } + assert_eq!(count, 999_999); + println!("{}", count); +} diff --git a/src/test/run-pass/issues/issue-44056.rs b/src/test/run-pass/issues/issue-44056.rs new file mode 100644 index 00000000000..50fe9997066 --- /dev/null +++ b/src/test/run-pass/issues/issue-44056.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// only-x86_64 +// no-prefer-dynamic +// compile-flags: -Ctarget-feature=+avx -Clto + +fn main() {} diff --git a/src/test/run-pass/issues/issue-44247.rs b/src/test/run-pass/issues/issue-44247.rs new file mode 100644 index 00000000000..f431e94889c --- /dev/null +++ b/src/test/run-pass/issues/issue-44247.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait T { + type X; + const X: Self::X; +} +fn foo() { + let _: X::X = X::X; +} + +trait S { + const X: Self::X; + type X; +} +fn bar() { + let _: X::X = X::X; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-44333.rs b/src/test/run-pass/issues/issue-44333.rs new file mode 100644 index 00000000000..28fadb9014d --- /dev/null +++ b/src/test/run-pass/issues/issue-44333.rs @@ -0,0 +1,30 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +type Func = fn(usize, usize) -> usize; + +fn foo(a: usize, b: usize) -> usize { a + b } +fn bar(a: usize, b: usize) -> usize { a * b } +fn test(x: usize) -> Func { + if x % 2 == 0 { foo } + else { bar } +} + +const FOO: Func = foo; +const BAR: Func = bar; + +fn main() { + match test(std::env::consts::ARCH.len()) { + FOO => println!("foo"), + BAR => println!("bar"), + _ => unreachable!(), + } +} diff --git a/src/test/run-pass/issues/issue-44373.rs b/src/test/run-pass/issues/issue-44373.rs new file mode 100644 index 00000000000..4d5bb5449b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-44373.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z borrowck=compare + +struct Foo(bool); + +struct Container(&'static [&'static Foo]); + +static FOO: Foo = Foo(true); +static CONTAINER: Container = Container(&[&FOO]); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-44402.rs b/src/test/run-pass/issues/issue-44402.rs new file mode 100644 index 00000000000..427ac016c08 --- /dev/null +++ b/src/test/run-pass/issues/issue-44402.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(never_type)] +#![feature(exhaustive_patterns)] + +// Regression test for inhabitedness check. The old +// cache used to cause us to incorrectly decide +// that `test_b` was invalid. + +struct Foo { + field1: !, + field2: Option<&'static Bar>, +} + +struct Bar { + field1: &'static Foo +} + +fn test_a() { + let x: Option = None; + match x { None => () } +} + +fn test_b() { + let x: Option = None; + match x { None => () } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-4446.rs b/src/test/run-pass/issues/issue-4446.rs new file mode 100644 index 00000000000..3cd70df23cf --- /dev/null +++ b/src/test/run-pass/issues/issue-4446.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::sync::mpsc::channel; +use std::thread; + +pub fn main() { + let (tx, rx) = channel(); + + tx.send("hello, world").unwrap(); + + thread::spawn(move|| { + println!("{}", rx.recv().unwrap()); + }).join().ok().unwrap(); +} diff --git a/src/test/run-pass/issues/issue-4448.rs b/src/test/run-pass/issues/issue-4448.rs new file mode 100644 index 00000000000..eb474d4c459 --- /dev/null +++ b/src/test/run-pass/issues/issue-4448.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::sync::mpsc::channel; +use std::thread; + +pub fn main() { + let (tx, rx) = channel::<&'static str>(); + + let t = thread::spawn(move|| { + assert_eq!(rx.recv().unwrap(), "hello, world"); + }); + + tx.send("hello, world").unwrap(); + t.join().ok().unwrap(); +} diff --git a/src/test/run-pass/issues/issue-4464.rs b/src/test/run-pass/issues/issue-4464.rs new file mode 100644 index 00000000000..bb788aaf88d --- /dev/null +++ b/src/test/run-pass/issues/issue-4464.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn broken(v: &[u8], i: usize, j: usize) -> &[u8] { &v[i..j] } + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-44730.rs b/src/test/run-pass/issues/issue-44730.rs new file mode 100644 index 00000000000..0f4d2e174fc --- /dev/null +++ b/src/test/run-pass/issues/issue-44730.rs @@ -0,0 +1,25 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +//! dox + +#![deny(missing_docs)] + +macro_rules! doc { + ($e:expr) => ( + #[doc = $e] + pub struct Foo; + ) +} + +doc!("a"); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-44851.rs b/src/test/run-pass/issues/issue-44851.rs new file mode 100644 index 00000000000..1e9f4d3e4e5 --- /dev/null +++ b/src/test/run-pass/issues/issue-44851.rs @@ -0,0 +1,25 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! a { + () => { "a" } +} + +macro_rules! b { + ($doc:expr) => { + #[doc = $doc] + pub struct B; + } +} + +b!(a!()); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-45124.rs b/src/test/run-pass/issues/issue-45124.rs new file mode 100644 index 00000000000..774ad8ac760 --- /dev/null +++ b/src/test/run-pass/issues/issue-45124.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --edition 2018 + +#![feature(try_blocks)] + +fn main() { + let mut a = 0; + let () = { + let _: Result<(), ()> = try { + let _ = Err(())?; + return + }; + a += 1; + }; + a += 2; + assert_eq!(a, 3); +} diff --git a/src/test/run-pass/issues/issue-45152.rs b/src/test/run-pass/issues/issue-45152.rs new file mode 100644 index 00000000000..71c1f92baa7 --- /dev/null +++ b/src/test/run-pass/issues/issue-45152.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(unsize, coerce_unsized)] + +#[repr(packed)] +struct UnalignedPtr<'a, T: ?Sized> + where T: 'a, +{ + data: &'a T, +} + +fn main() { + + impl<'a, T, U> std::ops::CoerceUnsized> for UnalignedPtr<'a, T> + where + T: std::marker::Unsize + ?Sized, + U: ?Sized, + { } + + let arr = [1, 2, 3]; + let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr }; + let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned; +} diff --git a/src/test/run-pass/issues/issue-4541.rs b/src/test/run-pass/issues/issue-4541.rs new file mode 100644 index 00000000000..99415297feb --- /dev/null +++ b/src/test/run-pass/issues/issue-4541.rs @@ -0,0 +1,33 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no std::env + +fn parse_args() -> String { + let args: Vec<_> = ::std::env::args().collect(); + let mut n = 0; + + while n < args.len() { + match &*args[n] { + "-v" => (), + s => { + return s.to_string(); + } + } + n += 1; + } + + return "".to_string() +} + +pub fn main() { + println!("{}", parse_args()); +} diff --git a/src/test/run-pass/issues/issue-4542.rs b/src/test/run-pass/issues/issue-4542.rs new file mode 100644 index 00000000000..3e19e7fa583 --- /dev/null +++ b/src/test/run-pass/issues/issue-4542.rs @@ -0,0 +1,23 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +// ignore-cloudabi no std::env + +use std::env; + +pub fn main() { + for arg in env::args() { + match arg.clone() { + _s => { } + } + } +} diff --git a/src/test/run-pass/issues/issue-45425.rs b/src/test/run-pass/issues/issue-45425.rs new file mode 100644 index 00000000000..c7523664047 --- /dev/null +++ b/src/test/run-pass/issues/issue-45425.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Add; + +fn ref_add(a: &T, b: &T) -> T +where + for<'x> &'x T: Add<&'x T, Output = T>, +{ + a + b +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-4545.rs b/src/test/run-pass/issues/issue-4545.rs new file mode 100644 index 00000000000..94eedbdb93a --- /dev/null +++ b/src/test/run-pass/issues/issue-4545.rs @@ -0,0 +1,17 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-4545.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_4545 as somelib; +pub fn main() { somelib::mk::(); } diff --git a/src/test/run-pass/issues/issue-45731.rs b/src/test/run-pass/issues/issue-45731.rs new file mode 100644 index 00000000000..568d6674c3a --- /dev/null +++ b/src/test/run-pass/issues/issue-45731.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--test -g + +#[cfg(target_os = "macos")] +#[test] +fn simple_test() { + use std::{env, panic, fs}; + + // Find our dSYM and replace the DWARF binary with an empty file + let mut dsym_path = env::current_exe().unwrap(); + let executable_name = dsym_path.file_name().unwrap().to_str().unwrap().to_string(); + assert!(dsym_path.pop()); // Pop executable + dsym_path.push(format!("{}.dSYM/Contents/Resources/DWARF/{0}", executable_name)); + { + let file = fs::OpenOptions::new().read(false).write(true).truncate(true).create(false) + .open(&dsym_path).unwrap(); + } + + env::set_var("RUST_BACKTRACE", "1"); + + // We don't need to die of panic, just trigger a backtrace + let _ = panic::catch_unwind(|| { + assert!(false); + }); +} diff --git a/src/test/run-pass/issues/issue-46069.rs b/src/test/run-pass/issues/issue-46069.rs new file mode 100644 index 00000000000..573b2b8198a --- /dev/null +++ b/src/test/run-pass/issues/issue-46069.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::iter::{Fuse, Cloned}; +use std::slice::Iter; + +struct Foo<'a, T: 'a>(&'a T); +impl<'a, T: 'a> Copy for Foo<'a, T> {} +impl<'a, T: 'a> Clone for Foo<'a, T> { + fn clone(&self) -> Self { *self } +} + +fn copy_ex() { + let s = 2; + let k1 = || s; + let upvar = Foo(&k1); + let k = || upvar; + k(); +} + +fn main() { + let _f = 0 as *mut >> as Iterator>::Item; + + copy_ex(); +} diff --git a/src/test/run-pass/issues/issue-46095.rs b/src/test/run-pass/issues/issue-46095.rs new file mode 100644 index 00000000000..ac6ca3923f7 --- /dev/null +++ b/src/test/run-pass/issues/issue-46095.rs @@ -0,0 +1,40 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct A; + +impl A { + fn take_mutably(&mut self) {} +} + +fn identity(t: T) -> T { + t +} + +// Issue 46095 +// Built-in indexing should be used even when the index is not +// trivially an integer +// Overloaded indexing would cause wrapped to be borrowed mutably + +fn main() { + let mut a1 = A; + let mut a2 = A; + + let wrapped = [&mut a1, &mut a2]; + + { + wrapped[0 + 1 - 1].take_mutably(); + } + + { + wrapped[identity(0)].take_mutably(); + } +} diff --git a/src/test/run-pass/issues/issue-46519.rs b/src/test/run-pass/issues/issue-46519.rs new file mode 100644 index 00000000000..94b7032417a --- /dev/null +++ b/src/test/run-pass/issues/issue-46519.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:--test -O + +#[test] +#[should_panic(expected = "creating inhabited type")] +fn test() { + FontLanguageOverride::system_font(SystemFont::new()); +} + +pub enum FontLanguageOverride { + Normal, + Override(&'static str), + System(SystemFont) +} + +pub enum SystemFont {} + +impl FontLanguageOverride { + fn system_font(f: SystemFont) -> Self { + FontLanguageOverride::System(f) + } +} + +impl SystemFont { + fn new() -> Self { + panic!("creating inhabited type") + } +} diff --git a/src/test/run-pass/issues/issue-46553.rs b/src/test/run-pass/issues/issue-46553.rs new file mode 100644 index 00000000000..001db9d8691 --- /dev/null +++ b/src/test/run-pass/issues/issue-46553.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(const_fn)] +#![deny(const_err)] + +pub struct Data { + function: fn() -> T, +} + +impl Data { + pub const fn new(function: fn() -> T) -> Data { + Data { + function: function, + } + } +} + +pub static DATA: Data = Data::new(|| { + 413i32 +}); + +fn main() { + print!("{:?}", (DATA.function)()); +} diff --git a/src/test/run-pass/issues/issue-46845.rs b/src/test/run-pass/issues/issue-46845.rs new file mode 100644 index 00000000000..f8f3a2bb5bd --- /dev/null +++ b/src/test/run-pass/issues/issue-46845.rs @@ -0,0 +1,42 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// To work around #46855 +// compile-flags: -Z mir-opt-level=0 +// Regression test for the inhabitedness of unions with uninhabited variants, issue #46845 + +use std::mem; + +#[derive(Copy, Clone)] +enum Never { } + +// A single uninhabited variant shouldn't make the whole union uninhabited. +union Foo { + a: u64, + _b: Never +} + +// If all the variants are uninhabited, however, the union should be uninhabited. +// NOTE(#49298) the union being uninhabited shouldn't change its size. +union Bar { + _a: (Never, u64), + _b: (u64, Never) +} + +fn main() { + assert_eq!(mem::size_of::(), 8); + // See the note on `Bar`'s definition for why this isn't `0`. + assert_eq!(mem::size_of::(), 8); + + let f = [Foo { a: 42 }, Foo { a: 10 }]; + println!("{}", unsafe { f[0].a }); + assert_eq!(unsafe { f[1].a }, 10); +} diff --git a/src/test/run-pass/issues/issue-46855.rs b/src/test/run-pass/issues/issue-46855.rs new file mode 100644 index 00000000000..8e6a37083e3 --- /dev/null +++ b/src/test/run-pass/issues/issue-46855.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Zmir-opt-level=1 + +use std::mem; + +#[derive(Copy, Clone)] +enum Never {} + +union Foo { + a: u64, + b: Never +} + +fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } + +fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } + +fn main() { + println!("{}", mem::size_of::()); + + let f = [Foo { a: 42 }, Foo { a: 10 }]; + println!("{:?}", unsafe { f[0].a }); +} diff --git a/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs b/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs new file mode 100644 index 00000000000..1e1f1f0baa9 --- /dev/null +++ b/src/test/run-pass/issues/issue-46920-byte-array-patterns.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const CURSOR_PARTITION_LABEL: &'static [u8] = b"partition"; +const CURSOR_EVENT_TYPE_LABEL: &'static [u8] = b"event_type"; +const BYTE_PATTERN: &'static [u8; 5] = b"hello"; + +fn match_slice(x: &[u8]) -> u32 { + match x { + CURSOR_PARTITION_LABEL => 0, + CURSOR_EVENT_TYPE_LABEL => 1, + _ => 2, + } +} + +fn match_array(x: &[u8; 5]) -> bool { + match x { + BYTE_PATTERN => true, + _ => false + } +} + +fn main() { + assert_eq!(match_slice(b"abcde"), 2); + assert_eq!(match_slice(b"event_type"), 1); + assert_eq!(match_slice(b"partition"), 0); + + assert_eq!(match_array(b"hello"), true); + assert_eq!(match_array(b"hella"), false); +} diff --git a/src/test/run-pass/issues/issue-46959.rs b/src/test/run-pass/issues/issue-46959.rs new file mode 100644 index 00000000000..baaff2d4581 --- /dev/null +++ b/src/test/run-pass/issues/issue-46959.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(non_camel_case_types)] + +#[allow(dead_code)] +fn qqq(lol: impl Iterator) -> impl Iterator { + lol.map(|x|x as u64) +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-46964.rs b/src/test/run-pass/issues/issue-46964.rs new file mode 100644 index 00000000000..ad4d6e3ac1a --- /dev/null +++ b/src/test/run-pass/issues/issue-46964.rs @@ -0,0 +1,29 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +mod my_mod { + #[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash)] + pub struct Name<'a> { + source: &'a str, + } + + pub const JSON: Name = Name { source: "JSON" }; +} + +pub fn crash() -> bool { + match (my_mod::JSON, None) { + (_, Some(my_mod::JSON)) => true, + (my_mod::JSON, None) => true, + _ => false, + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-47139-1.rs b/src/test/run-pass/issues/issue-47139-1.rs new file mode 100644 index 00000000000..df225b6e0d9 --- /dev/null +++ b/src/test/run-pass/issues/issue-47139-1.rs @@ -0,0 +1,88 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #47139: +// +// Coherence was encountering an (unnecessary) overflow trying to +// decide if the two impls of dummy overlap. +// +// The overflow went something like: +// +// - `&'a ?T: Insertable` ? +// - let ?T = Option ? +// - `Option: Insertable` ? +// - `Option<&'a ?U>: Insertable` ? +// - `&'a ?U: Insertable` ? +// +// While somewhere in the middle, a projection would occur, which +// broke cycle detection. +// +// It turned out that this cycle was being kicked off due to some +// extended diagnostic attempts in coherence, so removing those +// sidestepped the issue for now. + +#![allow(dead_code)] + +pub trait Insertable { + type Values; + + fn values(self) -> Self::Values; +} + +impl Insertable for Option + where + T: Insertable, + T::Values: Default, +{ + type Values = T::Values; + + fn values(self) -> Self::Values { + self.map(Insertable::values).unwrap_or_default() + } +} + +impl<'a, T> Insertable for &'a Option + where + Option<&'a T>: Insertable, +{ + type Values = as Insertable>::Values; + + fn values(self) -> Self::Values { + self.as_ref().values() + } +} + +impl<'a, T> Insertable for &'a [T] +{ + type Values = Self; + + fn values(self) -> Self::Values { + self + } +} + +trait Unimplemented { } + +trait Dummy { } + +struct Foo { t: T } + +impl<'a, U> Dummy for Foo<&'a U> + where &'a U: Insertable +{ +} + +impl Dummy for T + where T: Unimplemented +{ } + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-47139-2.rs b/src/test/run-pass/issues/issue-47139-2.rs new file mode 100644 index 00000000000..dfc506dc8f1 --- /dev/null +++ b/src/test/run-pass/issues/issue-47139-2.rs @@ -0,0 +1,76 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #47139: +// +// Same as issue-47139-1.rs, but the impls of dummy are in the +// opposite order. This influenced the way that coherence ran and in +// some cases caused the overflow to occur when it wouldn't otherwise. +// In an effort to make the regr test more robust, I am including both +// orderings. + +#![allow(dead_code)] + +pub trait Insertable { + type Values; + + fn values(self) -> Self::Values; +} + +impl Insertable for Option + where + T: Insertable, + T::Values: Default, +{ + type Values = T::Values; + + fn values(self) -> Self::Values { + self.map(Insertable::values).unwrap_or_default() + } +} + +impl<'a, T> Insertable for &'a Option + where + Option<&'a T>: Insertable, +{ + type Values = as Insertable>::Values; + + fn values(self) -> Self::Values { + self.as_ref().values() + } +} + +impl<'a, T> Insertable for &'a [T] +{ + type Values = Self; + + fn values(self) -> Self::Values { + self + } +} + +trait Unimplemented { } + +trait Dummy { } + +struct Foo { t: T } + +impl Dummy for T + where T: Unimplemented +{ } + +impl<'a, U> Dummy for Foo<&'a U> + where &'a U: Insertable +{ +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-4734.rs b/src/test/run-pass/issues/issue-4734.rs new file mode 100644 index 00000000000..216fd537022 --- /dev/null +++ b/src/test/run-pass/issues/issue-4734.rs @@ -0,0 +1,46 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensures that destructors are run for expressions of the form "e;" where +// `e` is a type which requires a destructor. + + +#![allow(path_statements)] + +struct A { n: isize } +struct B; + +static mut NUM_DROPS: usize = 0; + +impl Drop for A { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +impl Drop for B { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +fn main() { + assert_eq!(unsafe { NUM_DROPS }, 0); + { let _a = A { n: 1 }; } + assert_eq!(unsafe { NUM_DROPS }, 1); + { A { n: 3 }; } + assert_eq!(unsafe { NUM_DROPS }, 2); + + { let _b = B; } + assert_eq!(unsafe { NUM_DROPS }, 3); + { B; } + assert_eq!(unsafe { NUM_DROPS }, 4); +} diff --git a/src/test/run-pass/issues/issue-4735.rs b/src/test/run-pass/issues/issue-4735.rs new file mode 100644 index 00000000000..1b136be9a91 --- /dev/null +++ b/src/test/run-pass/issues/issue-4735.rs @@ -0,0 +1,29 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::mem::transmute; + +struct NonCopyable(*const u8); + +impl Drop for NonCopyable { + fn drop(&mut self) { + let NonCopyable(p) = *self; + let _v = unsafe { transmute::<*const u8, Box>(p) }; + } +} + +pub fn main() { + let t = Box::new(0); + let p = unsafe { transmute::, *const u8>(t) }; + let _z = NonCopyable(p); +} diff --git a/src/test/run-pass/issues/issue-47364.rs b/src/test/run-pass/issues/issue-47364.rs new file mode 100644 index 00000000000..61dd0714a1f --- /dev/null +++ b/src/test/run-pass/issues/issue-47364.rs @@ -0,0 +1,68 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -C codegen-units=8 -O +#![allow(non_snake_case)] + +fn main() { + nom_sql::selection(b"x "); +} + +pub enum Err

{ + Position(P), + NodePosition(u32), +} + +pub enum IResult { + Done(I,O), + Error(Err), + Incomplete(u32, u64) +} + +pub fn multispace(input: T) -> ::IResult { + ::IResult::Done(0, 0) +} + +mod nom_sql { + fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option> { + let X = match ::multispace(i) { + ::IResult::Done(..) => ::IResult::Done(i, None::), + _ => ::IResult::Error(::Err::NodePosition(0)), + }; + match X { + ::IResult::Done(_, _) => ::IResult::Done(i, None), + _ => X + } + } + + pub fn selection(i: &[u8]) { + let Y = match { + match { + where_clause(i) + } { + ::IResult::Done(_, o) => ::IResult::Done(i, Some(o)), + ::IResult::Error(_) => ::IResult::Done(i, None), + _ => ::IResult::Incomplete(0, 0), + } + } { + ::IResult::Done(z, _) => ::IResult::Done(z, None::), + _ => return () + }; + match Y { + ::IResult::Done(x, _) => { + let bytes = b"; "; + let len = x.len(); + bytes[len]; + } + _ => () + } + } +} diff --git a/src/test/run-pass/issues/issue-4759-1.rs b/src/test/run-pass/issues/issue-4759-1.rs new file mode 100644 index 00000000000..f05cea777af --- /dev/null +++ b/src/test/run-pass/issues/issue-4759-1.rs @@ -0,0 +1,14 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait U { fn f(self); } +impl U for isize { fn f(self) {} } +pub fn main() { 4.f(); } diff --git a/src/test/run-pass/issues/issue-4759.rs b/src/test/run-pass/issues/issue-4759.rs new file mode 100644 index 00000000000..12f2874341f --- /dev/null +++ b/src/test/run-pass/issues/issue-4759.rs @@ -0,0 +1,30 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_shorthand_field_patterns)] + +#![feature(box_syntax)] + +struct T { a: Box } + +trait U { + fn f(self); +} + +impl U for Box { + fn f(self) { } +} + +pub fn main() { + let T { a: a } = T { a: box 0 }; + a.f(); +} diff --git a/src/test/run-pass/issues/issue-47638.rs b/src/test/run-pass/issues/issue-47638.rs new file mode 100644 index 00000000000..c3c662ea2d4 --- /dev/null +++ b/src/test/run-pass/issues/issue-47638.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn id<'c, 'b>(f: &'c &'b Fn(&i32)) -> &'c &'b Fn(&'static i32) { + f +} + +fn main() { + let f: &Fn(&i32) = &|x| {}; + id(&f); +} diff --git a/src/test/run-pass/issues/issue-47673.rs b/src/test/run-pass/issues/issue-47673.rs new file mode 100644 index 00000000000..96f38deec4c --- /dev/null +++ b/src/test/run-pass/issues/issue-47673.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use {{}, {}}; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-47703-1.rs b/src/test/run-pass/issues/issue-47703-1.rs new file mode 100644 index 00000000000..8fa931abb86 --- /dev/null +++ b/src/test/run-pass/issues/issue-47703-1.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(nll)] + +struct AtomicRefMut<'a> { + value: &'a mut i32, + borrow: AtomicBorrowRefMut, +} + +struct AtomicBorrowRefMut { +} + +impl Drop for AtomicBorrowRefMut { + fn drop(&mut self) { + } +} + +fn map(orig: AtomicRefMut) -> AtomicRefMut { + AtomicRefMut { + value: orig.value, + borrow: orig.borrow, + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-47703-tuple.rs b/src/test/run-pass/issues/issue-47703-tuple.rs new file mode 100644 index 00000000000..188d4bc5520 --- /dev/null +++ b/src/test/run-pass/issues/issue-47703-tuple.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(nll)] + +struct WithDrop; + +impl Drop for WithDrop { + fn drop(&mut self) {} +} + +fn consume(x: (&mut (), WithDrop)) -> &mut () { x.0 } + +fn main() {} diff --git a/src/test/run-pass/issues/issue-47703.rs b/src/test/run-pass/issues/issue-47703.rs new file mode 100644 index 00000000000..0a0388ac48e --- /dev/null +++ b/src/test/run-pass/issues/issue-47703.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(nll)] + +struct MyStruct<'a> { + field: &'a mut (), + field2: WithDrop +} + +struct WithDrop; + +impl Drop for WithDrop { + fn drop(&mut self) {} +} + +impl<'a> MyStruct<'a> { + fn consume(self) -> &'a mut () { self.field } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-47722.rs b/src/test/run-pass/issues/issue-47722.rs new file mode 100644 index 00000000000..92309297356 --- /dev/null +++ b/src/test/run-pass/issues/issue-47722.rs @@ -0,0 +1,28 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Tests that automatic coercions from &mut T to *mut T +// allow borrows of T to expire immediately - essentially, that +// they work identically to 'foo as *mut T' +#![feature(nll)] + +struct SelfReference { + self_reference: *mut SelfReference, +} + +impl SelfReference { + fn set_self_ref(&mut self) { + self.self_reference = self; + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-47789.rs b/src/test/run-pass/issues/issue-47789.rs new file mode 100644 index 00000000000..57aac45e51a --- /dev/null +++ b/src/test/run-pass/issues/issue-47789.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +#![feature(nll)] + +static mut x: &'static u32 = &0; + +fn foo() { + unsafe { x = &1; } +} + +fn main() { } diff --git a/src/test/run-pass/issues/issue-48159.rs b/src/test/run-pass/issues/issue-48159.rs new file mode 100644 index 00000000000..2f625747b25 --- /dev/null +++ b/src/test/run-pass/issues/issue-48159.rs @@ -0,0 +1,38 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(repr_packed)] +#![allow(non_camel_case_types)] + +use std::mem; + +pub enum c_void {} + +type uintptr_t = usize; +type int16_t = u16; +type uint16_t = int16_t; +type uint32_t = u32; +type intptr_t = uintptr_t; + +#[repr(C)] +#[repr(packed(4))] +pub struct kevent { + pub ident: uintptr_t, + pub filter: int16_t, + pub flags: uint16_t, + pub fflags: uint32_t, + pub data: intptr_t, + pub udata: *mut c_void, +} + +fn main() { + assert_eq!(mem::align_of::(), 4); +} diff --git a/src/test/run-pass/issues/issue-4830.rs b/src/test/run-pass/issues/issue-4830.rs new file mode 100644 index 00000000000..42800255c6b --- /dev/null +++ b/src/test/run-pass/issues/issue-4830.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +pub struct Scheduler { + /// The event loop used to drive the scheduler and perform I/O + event_loop: Box +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-48508-aux.rs b/src/test/run-pass/issues/issue-48508-aux.rs new file mode 100644 index 00000000000..1d5ae23cb5e --- /dev/null +++ b/src/test/run-pass/issues/issue-48508-aux.rs @@ -0,0 +1,17 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-test Not a test. Used by issue-48508.rs + +pub fn other() -> f64 { + let µ = 1.0; + µ +} diff --git a/src/test/run-pass/issues/issue-48508.rs b/src/test/run-pass/issues/issue-48508.rs new file mode 100644 index 00000000000..8297d7c33a7 --- /dev/null +++ b/src/test/run-pass/issues/issue-48508.rs @@ -0,0 +1,29 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #48508: +// +// Confusion between global and local file offsets caused incorrect handling of multibyte character +// spans when compiling multiple files. One visible effect was an ICE generating debug information +// when a multibyte character is at the end of a scope. The problematic code is actually in +// issue-48508-aux.rs + +// compile-flags:-g +// ignore-pretty issue #37195 + +#![feature(non_ascii_idents)] + +#[path = "issue-48508-aux.rs"] +mod other_file; + +fn main() { + other_file::other(); +} diff --git a/src/test/run-pass/issues/issue-48551.rs b/src/test/run-pass/issues/issue-48551.rs new file mode 100644 index 00000000000..b4059d1fd75 --- /dev/null +++ b/src/test/run-pass/issues/issue-48551.rs @@ -0,0 +1,44 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #48551. Covers a case where duplicate candidates +// arose during associated type projection. + +use std::ops::{Mul, MulAssign}; + +pub trait ClosedMul: Sized + Mul + MulAssign {} +impl ClosedMul for T +where + T: Mul + MulAssign, +{ +} + +pub trait InnerSpace: ClosedMul<::Real> { + type Real; +} + +pub trait FiniteDimVectorSpace: ClosedMul<::Field> { + type Field; +} + +pub trait FiniteDimInnerSpace + : InnerSpace + FiniteDimVectorSpace::Real> { +} + +pub trait EuclideanSpace: ClosedMul<::Real> { + type Coordinates: FiniteDimInnerSpace + + Mul + + MulAssign; + + type Real; +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-4865-1.rs b/src/test/run-pass/issues/issue-4865-1.rs new file mode 100644 index 00000000000..9a22cf08c04 --- /dev/null +++ b/src/test/run-pass/issues/issue-4865-1.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This should resolve fine. +// Prior to fix, the crossed imports between a and b +// would block on the glob import, itself never being resolved +// because these previous imports were not resolved. + +pub mod a { + use b::fn_b; + use c::*; + + pub fn fn_a(){ + } +} + +pub mod b { + use a::fn_a; + use c::*; + + pub fn fn_b(){ + } +} + +pub mod c{ + pub fn fn_c(){ + } +} + +use a::fn_a; +use b::fn_b; + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-4865-2.rs b/src/test/run-pass/issues/issue-4865-2.rs new file mode 100644 index 00000000000..6d0395f7ab2 --- /dev/null +++ b/src/test/run-pass/issues/issue-4865-2.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Previously, this would have failed to resolve due to the circular +// block between `use say` and `pub use hello::*`. +// +// Now, as `use say` is not `pub`, the glob import can resolve +// without any problem and this resolves fine. + +pub use hello::*; + +pub mod say { + pub fn hello() { println!("hello"); } +} + +pub mod hello { + use say; + + pub fn hello() { + say::hello(); + } +} + +fn main() { + hello(); +} diff --git a/src/test/run-pass/issues/issue-4865-3.rs b/src/test/run-pass/issues/issue-4865-3.rs new file mode 100644 index 00000000000..4a18539c302 --- /dev/null +++ b/src/test/run-pass/issues/issue-4865-3.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This should resolve fine even with the circular imports as +// they are not `pub`. + +pub mod a { + use b::*; +} + +pub mod b { + use a::*; +} + +use a::*; + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-4875.rs b/src/test/run-pass/issues/issue-4875.rs new file mode 100644 index 00000000000..d33d08ab18c --- /dev/null +++ b/src/test/run-pass/issues/issue-4875.rs @@ -0,0 +1,24 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// regression test for issue 4875 + +// pretty-expanded FIXME #23616 + +pub struct Foo { + data: T, +} + +fn foo(Foo{..}: Foo) { +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-48962.rs b/src/test/run-pass/issues/issue-48962.rs new file mode 100644 index 00000000000..ea309981af1 --- /dev/null +++ b/src/test/run-pass/issues/issue-48962.rs @@ -0,0 +1,44 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to reinitialize box with moved referent +#![feature(nll)] +static mut ORDER: [usize; 3] = [0, 0, 0]; +static mut INDEX: usize = 0; + +struct Dropee (usize); + +impl Drop for Dropee { + fn drop(&mut self) { + unsafe { + ORDER[INDEX] = self.0; + INDEX = INDEX + 1; + } + } +} + +fn add_sentintel() { + unsafe { + ORDER[INDEX] = 2; + INDEX = INDEX + 1; + } +} + +fn main() { + let mut x = Box::new(Dropee(1)); + *x; // move out from `*x` + add_sentintel(); + *x = Dropee(3); // re-initialize `*x` + {x}; // drop value + unsafe { + assert_eq!(ORDER, [1, 2, 3]); + } +} diff --git a/src/test/run-pass/issues/issue-48984.rs b/src/test/run-pass/issues/issue-48984.rs new file mode 100644 index 00000000000..faffc2e4fb0 --- /dev/null +++ b/src/test/run-pass/issues/issue-48984.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-48984-aux.rs +extern crate issue48984aux; +use issue48984aux::Bar; + +fn do_thing() { } + +fn main() { } diff --git a/src/test/run-pass/issues/issue-49298.rs b/src/test/run-pass/issues/issue-49298.rs new file mode 100644 index 00000000000..22a34f334cb --- /dev/null +++ b/src/test/run-pass/issues/issue-49298.rs @@ -0,0 +1,35 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(test)] + +extern crate test; + +enum Void {} + +fn main() { + let mut x: (Void, usize); + let mut y = 42; + x.1 = 13; + + // Make sure `y` stays on the stack. + test::black_box(&mut y); + + // Check that the write to `x.1` did not overwrite `y`. + // Note that this doesn't fail with optimizations enabled, + // because we can't keep `x.1` on the stack, like we can `y`, + // as we can't borrow partially initialized variables. + assert_eq!(y.to_string(), "42"); + + // Check that `(Void, usize)` has space for the `usize` field. + assert_eq!(std::mem::size_of::<(Void, usize)>(), + std::mem::size_of::()); +} diff --git a/src/test/run-pass/issues/issue-49556.rs b/src/test/run-pass/issues/issue-49556.rs new file mode 100644 index 00000000000..aeeb55d6c60 --- /dev/null +++ b/src/test/run-pass/issues/issue-49556.rs @@ -0,0 +1,23 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn iter<'a>(data: &'a [usize]) -> impl Iterator + 'a { + data.iter() + .map( + |x| x // fn(&'a usize) -> &'(ReScope) usize + ) + .map( + |x| *x // fn(&'(ReScope) usize) -> usize + ) +} + +fn main() { +} diff --git a/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs b/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs new file mode 100644 index 00000000000..3a70bdfb2fd --- /dev/null +++ b/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs @@ -0,0 +1,25 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(non_shorthand_field_patterns)] + +pub struct Value { pub value: A } + +#[macro_export] +macro_rules! pat { + ($a:pat) => { + Value { value: $a } + }; +} + +fn main() { + let pat!(value) = Value { value: () }; +} diff --git a/src/test/run-pass/issues/issue-49632.rs b/src/test/run-pass/issues/issue-49632.rs new file mode 100644 index 00000000000..2552363b9c9 --- /dev/null +++ b/src/test/run-pass/issues/issue-49632.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(stmt_expr_attributes)] + +pub fn main() { + let _x = #[inline(always)] || {}; + let _y = #[inline(never)] || {}; + let _z = #[inline] || {}; +} diff --git a/src/test/run-pass/issues/issue-49685.rs b/src/test/run-pass/issues/issue-49685.rs new file mode 100644 index 00000000000..e4dfef1e3da --- /dev/null +++ b/src/test/run-pass/issues/issue-49685.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for #49685: drop elaboration was not revealing the +// value of `impl Trait` returns, leading to an ICE. + +fn main() { + let _ = Some(()) + .into_iter() + .flat_map(|_| Some(()).into_iter().flat_map(func)); +} + +fn func(_: ()) -> impl Iterator { + Some(()).into_iter().flat_map(|_| vec![]) +} diff --git a/src/test/run-pass/issues/issue-49854.rs b/src/test/run-pass/issues/issue-49854.rs new file mode 100644 index 00000000000..5dd323eaf8e --- /dev/null +++ b/src/test/run-pass/issues/issue-49854.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ffi::OsString; + +fn main() { + let os_str = OsString::from("Hello Rust!"); + + assert_eq!(os_str, "Hello Rust!"); + assert_eq!("Hello Rust!", os_str); +} diff --git a/src/test/run-pass/issues/issue-49955-2.rs b/src/test/run-pass/issues/issue-49955-2.rs new file mode 100644 index 00000000000..40827b01622 --- /dev/null +++ b/src/test/run-pass/issues/issue-49955-2.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z borrowck=mir + +use std::cell::Cell; + +#[inline(never)] +fn tuple_field() -> &'static u32 { + // This test is MIR-borrowck-only because the old borrowck + // doesn't agree that borrows of "frozen" (i.e. without any + // interior mutability) fields of non-frozen temporaries, + // should be promoted, while MIR promotion does promote them. + &(Cell::new(5), 42).1 +} + +fn main() { + assert_eq!(tuple_field().to_string(), "42"); +} diff --git a/src/test/run-pass/issues/issue-49955.rs b/src/test/run-pass/issues/issue-49955.rs new file mode 100644 index 00000000000..a5e67928115 --- /dev/null +++ b/src/test/run-pass/issues/issue-49955.rs @@ -0,0 +1,31 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z borrowck=compare + +const ALL_THE_NUMS: [u32; 1] = [ + 1 +]; + +#[inline(never)] +fn array(i: usize) -> &'static u32 { + return &ALL_THE_NUMS[i]; +} + +#[inline(never)] +fn tuple_field() -> &'static u32 { + &(42,).0 +} + +fn main() { + assert_eq!(tuple_field().to_string(), "42"); + assert_eq!(array(0).to_string(), "1"); +} diff --git a/src/test/run-pass/issues/issue-49973.rs b/src/test/run-pass/issues/issue-49973.rs new file mode 100644 index 00000000000..c5a3f6c124a --- /dev/null +++ b/src/test/run-pass/issues/issue-49973.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +#[repr(i32)] +enum E { + Min = -2147483648i32, + _Max = 2147483647i32, +} + +fn main() { + assert_eq!(Some(E::Min).unwrap() as i32, -2147483648i32); +} diff --git a/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs b/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs new file mode 100644 index 00000000000..6a08a0c58ac --- /dev/null +++ b/src/test/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs @@ -0,0 +1,44 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +/* + +#5008 cast to &Trait causes code to segfault on method call + +It fixes itself if the &Trait is changed to @Trait. +*/ + +trait Debuggable { + fn debug_name(&self) -> String; +} + +#[derive(Clone)] +struct Thing { + name: String, +} + +impl Thing { + fn new() -> Thing { Thing { name: "dummy".to_string() } } +} + +impl Debuggable for Thing { + fn debug_name(&self) -> String { self.name.clone() } +} + +fn print_name(x: &Debuggable) +{ + println!("debug_name = {}", x.debug_name()); +} + +pub fn main() { + let thing = Thing::new(); + print_name(&thing as &Debuggable); +} diff --git a/src/test/run-pass/issues/issue-50415.rs b/src/test/run-pass/issues/issue-50415.rs new file mode 100644 index 00000000000..282b3b414fa --- /dev/null +++ b/src/test/run-pass/issues/issue-50415.rs @@ -0,0 +1,28 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + // -------- Simplified test case -------- + + let _ = || 0..=1; + + // -------- Original test case -------- + + let full_length = 1024; + let range = { + // do some stuff, omit here + None + }; + + let range = range.map(|(s, t)| s..=t).unwrap_or(0..=(full_length-1)); + + assert_eq!(range, 0..=1023); +} diff --git a/src/test/run-pass/issues/issue-50442.rs b/src/test/run-pass/issues/issue-50442.rs new file mode 100644 index 00000000000..6a55f2d633b --- /dev/null +++ b/src/test/run-pass/issues/issue-50442.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Void {} + +enum Foo { + A(i32), + B(Void), + C(i32) +} + +fn main() { + let _foo = Foo::A(0); +} diff --git a/src/test/run-pass/issues/issue-5060.rs b/src/test/run-pass/issues/issue-5060.rs new file mode 100644 index 00000000000..2caa6541f09 --- /dev/null +++ b/src/test/run-pass/issues/issue-5060.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! print_hd_tl { + ($field_hd:ident, $($field_tl:ident),+) => ({ + print!("{}", stringify!($field_hd)); + print!("::["); + $( + print!("{}", stringify!($field_tl)); + print!(", "); + )+ + print!("]\n"); + }) +} + +pub fn main() { + print_hd_tl!(x, y, z, w) +} diff --git a/src/test/run-pass/issues/issue-50689.rs b/src/test/run-pass/issues/issue-50689.rs new file mode 100644 index 00000000000..bc94066b041 --- /dev/null +++ b/src/test/run-pass/issues/issue-50689.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Foo { + Bar = (|x: i32| { }, 42).1, +} + +fn main() { + assert_eq!(Foo::Bar as usize, 42); +} diff --git a/src/test/run-pass/issues/issue-50731.rs b/src/test/run-pass/issues/issue-50731.rs new file mode 100644 index 00000000000..fd1d5579fbf --- /dev/null +++ b/src/test/run-pass/issues/issue-50731.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Void {} +fn foo(_: Result<(Void, u32), (Void, String)>) {} +fn main() { + let _: fn(_) = foo; +} diff --git a/src/test/run-pass/issues/issue-50811.rs b/src/test/run-pass/issues/issue-50811.rs new file mode 100644 index 00000000000..381afd4ee11 --- /dev/null +++ b/src/test/run-pass/issues/issue-50811.rs @@ -0,0 +1,66 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(test)] + +extern crate test; + +use std::f64::{NAN, NEG_INFINITY, INFINITY, MAX}; +use std::mem::size_of; +use test::black_box; + +// Ensure the const-eval result and runtime result of float comparison are equivalent. + +macro_rules! compare { + ($op:tt) => { + compare!( + [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN], + $op + ); + }; + ([$($lhs:expr),+], $op:tt) => { + $(compare!( + $lhs, + $op, + [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN] + );)+ + }; + ($lhs:expr, $op:tt, [$($rhs:expr),+]) => { + $({ + // Wrap the check in its own function to reduce time needed to borrowck. + fn check() { + static CONST_EVAL: bool = $lhs $op $rhs; + let runtime_eval = black_box($lhs) $op black_box($rhs); + assert_eq!(CONST_EVAL, runtime_eval, stringify!($lhs $op $rhs)); + assert_eq!( + size_of::<[u8; ($lhs $op $rhs) as usize]>(), + runtime_eval as usize, + stringify!($lhs $op $rhs (forced const eval)) + ); + } + check(); + })+ + }; +} + +fn main() { + assert_eq!(0.0/0.0 < 0.0/0.0, false); + assert_eq!(0.0/0.0 > 0.0/0.0, false); + assert_eq!(NAN < NAN, false); + assert_eq!(NAN > NAN, false); + + compare!(==); + compare!(!=); + compare!(<); + compare!(<=); + compare!(>); + compare!(>=); +} diff --git a/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs b/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs new file mode 100644 index 00000000000..306256d53d3 --- /dev/null +++ b/src/test/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub fn bar

( // Error won't happen if "bar" is not generic + _baz: P, +) { + hide_foo()(); +} + +fn hide_foo() -> impl Fn() { // Error won't happen if "iterate" hasn't impl Trait or has generics + foo +} + +fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics +} diff --git a/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs b/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs new file mode 100644 index 00000000000..8c53ecd9c55 --- /dev/null +++ b/src/test/run-pass/issues/issue-50865-private-impl-trait/main.rs @@ -0,0 +1,26 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:lib.rs + +// Regression test for #50865. +// When using generics or specifying the type directly, this example +// codegens `foo` internally. However, when using a private `impl Trait` +// function which references another private item, `foo` (in this case) +// wouldn't be codegenned until main.rs used `bar`, as with impl Trait +// it is not cast to `fn()` automatically to satisfy e.g. +// `fn foo() -> fn() { ... }`. + +extern crate lib; + +fn main() { + lib::bar(()); // Error won't happen if bar is called from same crate +} diff --git a/src/test/run-pass/issues/issue-51185.rs b/src/test/run-pass/issues/issue-51185.rs new file mode 100644 index 00000000000..3fd38e76d1d --- /dev/null +++ b/src/test/run-pass/issues/issue-51185.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo() -> impl Into fn(&'a ())> { + (|_| {}) as for<'a> fn(&'a ()) +} + +fn main() { + foo().into()(&()); +} diff --git a/src/test/run-pass/issues/issue-51345.rs b/src/test/run-pass/issues/issue-51345.rs new file mode 100644 index 00000000000..887feada3c8 --- /dev/null +++ b/src/test/run-pass/issues/issue-51345.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(nll)] + +fn main() { + let mut v = Vec::new(); + + loop { v.push(break) } +} diff --git a/src/test/run-pass/issues/issue-51582.rs b/src/test/run-pass/issues/issue-51582.rs new file mode 100644 index 00000000000..6c513e843eb --- /dev/null +++ b/src/test/run-pass/issues/issue-51582.rs @@ -0,0 +1,28 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] + +#[repr(i8)] +pub enum Enum { + VariantA, + VariantB, +} + +fn make_b() -> Enum { Enum::VariantB } + +fn main() { + assert_eq!(1, make_b() as i8); + assert_eq!(1, make_b() as u8); + assert_eq!(1, make_b() as i32); + assert_eq!(1, make_b() as u32); + assert_eq!(1, unsafe { std::intrinsics::discriminant_value(&make_b()) }); +} diff --git a/src/test/run-pass/issues/issue-51655.rs b/src/test/run-pass/issues/issue-51655.rs new file mode 100644 index 00000000000..17c04a4097a --- /dev/null +++ b/src/test/run-pass/issues/issue-51655.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +const PATH_DOT: &[u8] = &[b'.']; + +fn match_slice(element: &[u8]) { + match element { + &[] => {} + PATH_DOT => {} + _ => {} + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-51907.rs b/src/test/run-pass/issues/issue-51907.rs new file mode 100644 index 00000000000..3ac31fde31f --- /dev/null +++ b/src/test/run-pass/issues/issue-51907.rs @@ -0,0 +1,27 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + extern fn borrow(&self); + extern fn take(self: Box); +} + +struct Bar; +impl Foo for Bar { + extern fn borrow(&self) {} + extern fn take(self: Box) {} +} + +fn main() { + let foo: Box = Box::new(Bar); + foo.borrow(); + foo.take() +} diff --git a/src/test/run-pass/issues/issue-5192.rs b/src/test/run-pass/issues/issue-5192.rs new file mode 100644 index 00000000000..df9664dc234 --- /dev/null +++ b/src/test/run-pass/issues/issue-5192.rs @@ -0,0 +1,50 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub trait EventLoop { + fn dummy(&self) { } +} + +pub struct UvEventLoop { + uvio: isize +} + +impl UvEventLoop { + pub fn new() -> UvEventLoop { + UvEventLoop { + uvio: 0 + } + } +} + +impl EventLoop for UvEventLoop { +} + +pub struct Scheduler { + event_loop: Box, +} + +impl Scheduler { + + pub fn new(event_loop: Box) -> Scheduler { + Scheduler { + event_loop: event_loop, + } + } +} + +pub fn main() { + let _sched = Scheduler::new(box UvEventLoop::new() as Box); +} diff --git a/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs b/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs new file mode 100644 index 00000000000..bf8dee0863a --- /dev/null +++ b/src/test/run-pass/issues/issue-52140/auxiliary/some_crate.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub fn hello() { + println!("Hello, world!"); +} diff --git a/src/test/run-pass/issues/issue-52140/main.rs b/src/test/run-pass/issues/issue-52140/main.rs new file mode 100644 index 00000000000..3d727e2ad1b --- /dev/null +++ b/src/test/run-pass/issues/issue-52140/main.rs @@ -0,0 +1,23 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:some_crate.rs +// compile-flags:--extern some_crate +// edition:2018 + +mod foo { + pub use some_crate; +} + +fn main() { + ::some_crate::hello(); + foo::some_crate::hello(); +} diff --git a/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs b/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs new file mode 100644 index 00000000000..bf8dee0863a --- /dev/null +++ b/src/test/run-pass/issues/issue-52141/auxiliary/some_crate.rs @@ -0,0 +1,15 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub fn hello() { + println!("Hello, world!"); +} diff --git a/src/test/run-pass/issues/issue-52141/main.rs b/src/test/run-pass/issues/issue-52141/main.rs new file mode 100644 index 00000000000..20705dc38e1 --- /dev/null +++ b/src/test/run-pass/issues/issue-52141/main.rs @@ -0,0 +1,26 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:some_crate.rs +// compile-flags:--extern some_crate +// edition:2018 + +use some_crate as some_name; + +mod foo { + pub use crate::some_name::*; +} + +fn main() { + ::some_crate::hello(); + some_name::hello(); + foo::hello(); +} diff --git a/src/test/run-pass/issues/issue-52169.rs b/src/test/run-pass/issues/issue-52169.rs new file mode 100644 index 00000000000..19c0f51d235 --- /dev/null +++ b/src/test/run-pass/issues/issue-52169.rs @@ -0,0 +1,25 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(macro_literal_matcher)] + +macro_rules! a { + ($i:literal) => { "right" }; + ($i:tt) => { "wrong" }; +} + +macro_rules! b { + ($i:literal) => { a!($i) }; +} + +fn main() { + assert_eq!(b!(0), "right"); +} diff --git a/src/test/run-pass/issues/issue-5239-2.rs b/src/test/run-pass/issues/issue-5239-2.rs new file mode 100644 index 00000000000..2b328c5177c --- /dev/null +++ b/src/test/run-pass/issues/issue-5239-2.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #5239 + + +pub fn main() { + let _f = |ref x: isize| { *x }; + let foo = 10; + assert_eq!(_f(foo), 10); +} diff --git a/src/test/run-pass/issues/issue-5243.rs b/src/test/run-pass/issues/issue-5243.rs new file mode 100644 index 00000000000..708187643d8 --- /dev/null +++ b/src/test/run-pass/issues/issue-5243.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that merely having lifetime parameters is not +// enough for codegen to consider this as non-monomorphic, +// which led to various assertions and failures in turn. + +// pretty-expanded FIXME #23616 + +struct S<'a> { + v: &'a isize +} + +fn f<'lt>(_s: &'lt S<'lt>) {} + +pub fn main() { + f(& S { v: &42 }); +} diff --git a/src/test/run-pass/issues/issue-52557.rs b/src/test/run-pass/issues/issue-52557.rs new file mode 100644 index 00000000000..3c987d32b90 --- /dev/null +++ b/src/test/run-pass/issues/issue-52557.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test checks for namespace pollution by private tests. +// Tests used to marked as public causing name conflicts with normal +// functions only in test builds. + +// compile-flags: --test + +mod a { + pub fn foo() -> bool { + true + } +} + +mod b { + #[test] + fn foo() { + local_name(); // ensure the local name still works + } + + #[test] + fn local_name() {} +} + +use a::*; +use b::*; + +pub fn conflict() { + let _: bool = foo(); +} diff --git a/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs b/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs new file mode 100644 index 00000000000..48d53a2cbac --- /dev/null +++ b/src/test/run-pass/issues/issue-52705/auxiliary/png2.rs @@ -0,0 +1,13 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +pub struct DecodingError; diff --git a/src/test/run-pass/issues/issue-52705/main.rs b/src/test/run-pass/issues/issue-52705/main.rs new file mode 100644 index 00000000000..00cb5ac103a --- /dev/null +++ b/src/test/run-pass/issues/issue-52705/main.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:png2.rs +// compile-flags:--extern png2 +// edition:2018 + +mod png { + use png2 as png_ext; + + fn foo() -> png_ext::DecodingError { unimplemented!() } +} + +fn main() { + println!("Hello, world!"); +} diff --git a/src/test/run-pass/issues/issue-5280.rs b/src/test/run-pass/issues/issue-5280.rs new file mode 100644 index 00000000000..f80b80c72af --- /dev/null +++ b/src/test/run-pass/issues/issue-5280.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +type FontTableTag = u32; + +trait FontTableTagConversions { + fn tag_to_string(self); +} + +impl FontTableTagConversions for FontTableTag { + fn tag_to_string(self) { + &self; + } +} + +pub fn main() { + 5.tag_to_string(); +} diff --git a/src/test/run-pass/issues/issue-5315.rs b/src/test/run-pass/issues/issue-5315.rs new file mode 100644 index 00000000000..11a6b61dc58 --- /dev/null +++ b/src/test/run-pass/issues/issue-5315.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct A(bool); + +pub fn main() { + let f = A; + f(true); +} diff --git a/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs b/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs new file mode 100644 index 00000000000..54d45716de1 --- /dev/null +++ b/src/test/run-pass/issues/issue-5321-immediates-with-bare-self.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Fooable { + fn yes(self); +} + +impl Fooable for usize { + fn yes(self) { + for _ in 0..self { println!("yes"); } + } +} + +pub fn main() { + 2.yes(); +} diff --git a/src/test/run-pass/issues/issue-53333.rs b/src/test/run-pass/issues/issue-53333.rs new file mode 100644 index 00000000000..8cb0d17cc16 --- /dev/null +++ b/src/test/run-pass/issues/issue-53333.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// edition:2018 + +fn main() { + use std; + let std = "std"; + println!("{}", std); +} diff --git a/src/test/run-pass/issues/issue-5353.rs b/src/test/run-pass/issues/issue-5353.rs new file mode 100644 index 00000000000..678a42e7549 --- /dev/null +++ b/src/test/run-pass/issues/issue-5353.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +const INVALID_ENUM : u32 = 0; +const INVALID_VALUE : u32 = 1; + +fn gl_err_str(err: u32) -> String +{ + match err + { + INVALID_ENUM => { "Invalid enum".to_string() }, + INVALID_VALUE => { "Invalid value".to_string() }, + _ => { "Unknown error".to_string() } + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-5518.rs b/src/test/run-pass/issues/issue-5518.rs new file mode 100644 index 00000000000..4adcc7822e6 --- /dev/null +++ b/src/test/run-pass/issues/issue-5518.rs @@ -0,0 +1,18 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-5518.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_5518 as other; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-5521.rs b/src/test/run-pass/issues/issue-5521.rs new file mode 100644 index 00000000000..4890156f7b8 --- /dev/null +++ b/src/test/run-pass/issues/issue-5521.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-5521.rs + + + +extern crate issue_5521 as foo; + +fn bar(a: foo::map) { + if false { + panic!(); + } else { + let _b = &(*a)[&2]; + } +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-5530.rs b/src/test/run-pass/issues/issue-5530.rs new file mode 100644 index 00000000000..cf0a225290f --- /dev/null +++ b/src/test/run-pass/issues/issue-5530.rs @@ -0,0 +1,49 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum Enum { + Foo { foo: usize }, + Bar { bar: usize } +} + +fn fun1(e1: &Enum, e2: &Enum) -> usize { + match (e1, e2) { + (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0, + (&Enum::Foo { foo: _ }, &Enum::Bar { bar: _ }) => 1, + (&Enum::Bar { bar: _ }, &Enum::Bar { bar: _ }) => 2, + (&Enum::Bar { bar: _ }, &Enum::Foo { foo: _ }) => 3, + } +} + +fn fun2(e1: &Enum, e2: &Enum) -> usize { + match (e1, e2) { + (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0, + (&Enum::Foo { foo: _ }, _ ) => 1, + (&Enum::Bar { bar: _ }, &Enum::Bar { bar: _ }) => 2, + (&Enum::Bar { bar: _ }, _ ) => 3, + } +} + +pub fn main() { + let foo = Enum::Foo { foo: 1 }; + let bar = Enum::Bar { bar: 1 }; + + assert_eq!(fun1(&foo, &foo), 0); + assert_eq!(fun1(&foo, &bar), 1); + assert_eq!(fun1(&bar, &bar), 2); + assert_eq!(fun1(&bar, &foo), 3); + + assert_eq!(fun2(&foo, &foo), 0); + assert_eq!(fun2(&foo, &bar), 1); // fun2 returns 0 + assert_eq!(fun2(&bar, &bar), 2); + assert_eq!(fun2(&bar, &foo), 3); // fun2 returns 2 +} diff --git a/src/test/run-pass/issues/issue-5550.rs b/src/test/run-pass/issues/issue-5550.rs new file mode 100644 index 00000000000..3b0f19b1f8b --- /dev/null +++ b/src/test/run-pass/issues/issue-5550.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + let s: String = "foobar".to_string(); + let mut t: &str = &s; + t = &t[0..3]; // for master: str::view(t, 0, 3) maybe +} diff --git a/src/test/run-pass/issues/issue-5554.rs b/src/test/run-pass/issues/issue-5554.rs new file mode 100644 index 00000000000..8ff48c8600e --- /dev/null +++ b/src/test/run-pass/issues/issue-5554.rs @@ -0,0 +1,38 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::default::Default; + +pub struct X { + a: T, +} + +// reordering these bounds stops the ICE +// +// nmatsakis: This test used to have the bounds Default + PartialEq + +// Default, but having duplicate bounds became illegal. +impl Default for X { + fn default() -> X { + X { a: Default::default() } + } +} + +macro_rules! constants { + () => { + let _ : X = Default::default(); + } +} + +pub fn main() { + constants!(); +} diff --git a/src/test/run-pass/issues/issue-5572.rs b/src/test/run-pass/issues/issue-5572.rs new file mode 100644 index 00000000000..418119e2fd6 --- /dev/null +++ b/src/test/run-pass/issues/issue-5572.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo(_t: T) { } + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-5666.rs b/src/test/run-pass/issues/issue-5666.rs new file mode 100644 index 00000000000..c578397487e --- /dev/null +++ b/src/test/run-pass/issues/issue-5666.rs @@ -0,0 +1,37 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Dog { + name : String +} + +trait Barks { + fn bark(&self) -> String; +} + +impl Barks for Dog { + fn bark(&self) -> String { + return format!("woof! (I'm {})", self.name); + } +} + + +pub fn main() { + let snoopy = box Dog{name: "snoopy".to_string()}; + let bubbles = box Dog{name: "bubbles".to_string()}; + let barker = [snoopy as Box, bubbles as Box]; + + for pup in &barker { + println!("{}", pup.bark()); + } +} diff --git a/src/test/run-pass/issues/issue-5688.rs b/src/test/run-pass/issues/issue-5688.rs new file mode 100644 index 00000000000..fdad413776e --- /dev/null +++ b/src/test/run-pass/issues/issue-5688.rs @@ -0,0 +1,30 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +/* +# Corrupted initialization in the static struct + +...should print &[1, 2, 3] but instead prints something like +&[4492532864, 24]. It is pretty evident that the compiler messed up +with the representation of [isize; n] and [isize] somehow, or at least +failed to typecheck correctly. +*/ + +#[derive(Copy, Clone)] +struct X { vec: &'static [isize] } + +static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; + +pub fn main() { + for &v in V { + println!("{:?}", v.vec); + } +} diff --git a/src/test/run-pass/issues/issue-5708.rs b/src/test/run-pass/issues/issue-5708.rs new file mode 100644 index 00000000000..2fef9bc1973 --- /dev/null +++ b/src/test/run-pass/issues/issue-5708.rs @@ -0,0 +1,64 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +/* +# ICE when returning struct with reference to trait + +A function which takes a reference to a trait and returns a +struct with that reference results in an ICE. + +This does not occur with concrete types, only with references +to traits. +*/ + + +// original +trait Inner { + fn print(&self); +} + +impl Inner for isize { + fn print(&self) { print!("Inner: {}\n", *self); } +} + +struct Outer<'a> { + inner: &'a (Inner+'a) +} + +impl<'a> Outer<'a> { + fn new(inner: &Inner) -> Outer { + Outer { + inner: inner + } + } +} + +pub fn main() { + let inner: isize = 5; + let outer = Outer::new(&inner as &Inner); + outer.inner.print(); +} + + +// minimal +pub trait MyTrait { + fn dummy(&self, t: T) -> T { panic!() } +} + +pub struct MyContainer<'a, T:'a> { + foos: Vec<&'a (MyTrait+'a)> , +} + +impl<'a, T> MyContainer<'a, T> { + pub fn add (&mut self, foo: &'a MyTrait) { + self.foos.push(foo); + } +} diff --git a/src/test/run-pass/issues/issue-5718.rs b/src/test/run-pass/issues/issue-5718.rs new file mode 100644 index 00000000000..444d3103ada --- /dev/null +++ b/src/test/run-pass/issues/issue-5718.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +struct Element; + +macro_rules! foo { + ($tag: expr, $string: expr) => { + if $tag == $string { + let element: Box<_> = box Element; + unsafe { + return std::mem::transmute::<_, usize>(element); + } + } + } +} + +fn bar() -> usize { + foo!("a", "b"); + 0 +} + +fn main() { + bar(); +} diff --git a/src/test/run-pass/issues/issue-5741.rs b/src/test/run-pass/issues/issue-5741.rs new file mode 100644 index 00000000000..f3beeff60fb --- /dev/null +++ b/src/test/run-pass/issues/issue-5741.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(while_true)] +#![allow(unreachable_code)] + +pub fn main() { + return; + while true {}; +} diff --git a/src/test/run-pass/issues/issue-5754.rs b/src/test/run-pass/issues/issue-5754.rs new file mode 100644 index 00000000000..ba79c32a83d --- /dev/null +++ b/src/test/run-pass/issues/issue-5754.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// pretty-expanded FIXME #23616 + +struct TwoDoubles { + r: f64, + i: f64 +} + +extern "C" { + fn rust_dbg_extern_identity_TwoDoubles(arg1: TwoDoubles) -> TwoDoubles; +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-5791.rs b/src/test/run-pass/issues/issue-5791.rs new file mode 100644 index 00000000000..e6c9106111f --- /dev/null +++ b/src/test/run-pass/issues/issue-5791.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +extern { + #[link_name = "malloc"] + fn malloc1(len: i32) -> *const u8; + #[link_name = "malloc"] + fn malloc2(len: i32, foo: i32) -> *const u8; +} + +pub fn main () {} diff --git a/src/test/run-pass/issues/issue-5884.rs b/src/test/run-pass/issues/issue-5884.rs new file mode 100644 index 00000000000..26816f235e9 --- /dev/null +++ b/src/test/run-pass/issues/issue-5884.rs @@ -0,0 +1,29 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub struct Foo { + a: isize, +} + +struct Bar<'a> { + a: Box>, + b: &'a Foo, +} + +fn check(a: Box) { + let _ic = Bar{ b: &*a, a: box None }; +} + +pub fn main(){} diff --git a/src/test/run-pass/issues/issue-5900.rs b/src/test/run-pass/issues/issue-5900.rs new file mode 100644 index 00000000000..d75291bf1f3 --- /dev/null +++ b/src/test/run-pass/issues/issue-5900.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub mod foo { + use super::Bar; + + pub struct FooStruct { bar : Bar } +} + +pub enum Bar { + Bar0 = 0 as isize +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-5917.rs b/src/test/run-pass/issues/issue-5917.rs new file mode 100644 index 00000000000..75466c01fed --- /dev/null +++ b/src/test/run-pass/issues/issue-5917.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +struct T (&'static [isize]); +static t : T = T (&[5, 4, 3]); +pub fn main () { + let T(ref v) = t; + assert_eq!(v[0], 5); +} diff --git a/src/test/run-pass/issues/issue-5950.rs b/src/test/run-pass/issues/issue-5950.rs new file mode 100644 index 00000000000..239f9680413 --- /dev/null +++ b/src/test/run-pass/issues/issue-5950.rs @@ -0,0 +1,19 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +pub use local as local_alias; + +pub mod local { } + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-5988.rs b/src/test/run-pass/issues/issue-5988.rs new file mode 100644 index 00000000000..d068195ade7 --- /dev/null +++ b/src/test/run-pass/issues/issue-5988.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait B { + fn f(&self); +} + +trait T : B { +} + +struct A; + +impl B for U { + fn f(&self) { } +} + +impl T for A { +} + +fn main() { + let a = A; + let br = &a as &B; + br.f(); +} diff --git a/src/test/run-pass/issues/issue-5997.rs b/src/test/run-pass/issues/issue-5997.rs new file mode 100644 index 00000000000..d888f691477 --- /dev/null +++ b/src/test/run-pass/issues/issue-5997.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn f() -> bool { + enum E { V(T) } + + struct S(T); + + true +} + +fn main() { + let b = f::(); + assert!(b); +} diff --git a/src/test/run-pass/issues/issue-6117.rs b/src/test/run-pass/issues/issue-6117.rs new file mode 100644 index 00000000000..fa9ef84746d --- /dev/null +++ b/src/test/run-pass/issues/issue-6117.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Either { Left(T), Right(U) } + +pub fn main() { + match Either::Left(Box::new(17)) { + Either::Right(()) => {} + _ => {} + } +} diff --git a/src/test/run-pass/issues/issue-6128.rs b/src/test/run-pass/issues/issue-6128.rs new file mode 100644 index 00000000000..d060da34723 --- /dev/null +++ b/src/test/run-pass/issues/issue-6128.rs @@ -0,0 +1,34 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(box_syntax)] + +use std::collections::HashMap; + +trait Graph { + fn f(&self, _: Edge); + fn g(&self, _: Node); +} + +impl Graph for HashMap { + fn f(&self, _e: E) { + panic!(); + } + fn g(&self, _e: isize) { + panic!(); + } +} + +pub fn main() { + let g : Box> = box HashMap::new(); + let _g2 : Box> = g as Box>; +} diff --git a/src/test/run-pass/issues/issue-6130.rs b/src/test/run-pass/issues/issue-6130.rs new file mode 100644 index 00000000000..12c2abf9c98 --- /dev/null +++ b/src/test/run-pass/issues/issue-6130.rs @@ -0,0 +1,20 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let i: usize = 0; + assert!(i <= 0xFFFF_FFFF); + + let i: isize = 0; + assert!(i >= -0x8000_0000); + assert!(i <= 0x7FFF_FFFF); +} diff --git a/src/test/run-pass/issues/issue-6153.rs b/src/test/run-pass/issues/issue-6153.rs new file mode 100644 index 00000000000..e6141b0121c --- /dev/null +++ b/src/test/run-pass/issues/issue-6153.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn swap(f: F) -> Vec where F: FnOnce(Vec) -> Vec { + let x = vec![1, 2, 3]; + f(x) +} + +pub fn main() { + let v = swap(|mut x| { x.push(4); x }); + let w = swap(|mut x| { x.push(4); x }); + assert_eq!(v, w); +} diff --git a/src/test/run-pass/issues/issue-6157.rs b/src/test/run-pass/issues/issue-6157.rs new file mode 100644 index 00000000000..ff4c6adc55d --- /dev/null +++ b/src/test/run-pass/issues/issue-6157.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; } + +impl OpInt for F where F: FnMut(isize, isize) -> isize { + fn call(&mut self, a:isize, b:isize) -> isize { + (*self)(a, b) + } +} + +fn squarei<'a>(x: isize, op: &'a mut OpInt) -> isize { op.call(x, x) } + +fn muli(x:isize, y:isize) -> isize { x * y } + +pub fn main() { + let mut f = |x, y| muli(x, y); + { + let g = &mut f; + let h = g as &mut OpInt; + squarei(3, h); + } +} diff --git a/src/test/run-pass/issues/issue-6318.rs b/src/test/run-pass/issues/issue-6318.rs new file mode 100644 index 00000000000..59ca54a4318 --- /dev/null +++ b/src/test/run-pass/issues/issue-6318.rs @@ -0,0 +1,32 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub enum Thing { + A(Box) +} + +pub trait Foo { + fn dummy(&self) { } +} + +pub struct Struct; + +impl Foo for Struct {} + +pub fn main() { + match Thing::A(box Struct as Box) { + Thing::A(_a) => 0, + }; +} diff --git a/src/test/run-pass/issues/issue-6334.rs b/src/test/run-pass/issues/issue-6334.rs new file mode 100644 index 00000000000..e7c6e74938f --- /dev/null +++ b/src/test/run-pass/issues/issue-6334.rs @@ -0,0 +1,56 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that everything still compiles and runs fine even when +// we reorder the bounds. + + +trait A { + fn a(&self) -> usize; +} + +trait B { + fn b(&self) -> usize; +} + +trait C { + fn combine(&self, t: &T) -> usize; +} + +struct Foo; + +impl A for Foo { + fn a(&self) -> usize { 1 } +} + +impl B for Foo { + fn b(&self) -> usize { 2 } +} + +struct Bar; + +impl C for Bar { + // Note below: bounds in impl decl are in reverse order. + fn combine(&self, t: &T) -> usize { + (t.a() * 100) + t.b() + } +} + +fn use_c(s: &S, t: &T) -> usize { + s.combine(t) +} + +pub fn main() { + let foo = Foo; + let bar = Bar; + let r = use_c(&bar, &foo); + assert_eq!(r, 102); +} diff --git a/src/test/run-pass/issues/issue-6341.rs b/src/test/run-pass/issues/issue-6341.rs new file mode 100644 index 00000000000..ca79e304b15 --- /dev/null +++ b/src/test/run-pass/issues/issue-6341.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#[derive(PartialEq)] +struct A { x: usize } + +impl Drop for A { + fn drop(&mut self) {} +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-6344-let.rs b/src/test/run-pass/issues/issue-6344-let.rs new file mode 100644 index 00000000000..83d908d597c --- /dev/null +++ b/src/test/run-pass/issues/issue-6344-let.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct A { x: usize } + +impl Drop for A { + fn drop(&mut self) {} +} + +pub fn main() { + let a = A { x: 0 }; + + let A { x: ref x } = a; + println!("{}", x) +} diff --git a/src/test/run-pass/issues/issue-6344-match.rs b/src/test/run-pass/issues/issue-6344-match.rs new file mode 100644 index 00000000000..c427ca6526c --- /dev/null +++ b/src/test/run-pass/issues/issue-6344-match.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct A { x: usize } + +impl Drop for A { + fn drop(&mut self) {} +} + +pub fn main() { + let a = A { x: 0 }; + + match a { + A { x : ref x } => { + println!("{}", x) + } + } +} diff --git a/src/test/run-pass/issues/issue-6449.rs b/src/test/run-pass/issues/issue-6449.rs new file mode 100644 index 00000000000..1987bca9330 --- /dev/null +++ b/src/test/run-pass/issues/issue-6449.rs @@ -0,0 +1,53 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum Foo { + Bar(isize), + Baz, +} + +enum Other { + Other1(Foo), + Other2(Foo, Foo), +} + +fn main() { + match Foo::Baz { + ::Foo::Bar(3) => panic!(), + ::Foo::Bar(_) if false => panic!(), + ::Foo::Bar(..) if false => panic!(), + ::Foo::Bar(_n) => panic!(), + ::Foo::Baz => {} + } + match Foo::Bar(3) { + ::Foo::Bar(3) => {} + ::Foo::Bar(_) if false => panic!(), + ::Foo::Bar(..) if false => panic!(), + ::Foo::Bar(_n) => panic!(), + ::Foo::Baz => panic!(), + } + match Foo::Bar(4) { + ::Foo::Bar(3) => panic!(), + ::Foo::Bar(_) if false => panic!(), + ::Foo::Bar(..) if false => panic!(), + ::Foo::Bar(n) => assert_eq!(n, 4), + ::Foo::Baz => panic!(), + } + + match Other::Other1(Foo::Baz) { + ::Other::Other1(::Foo::Baz) => {} + ::Other::Other1(::Foo::Bar(_)) => {} + ::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {} + ::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {} + ::Other::Other2(..) => {} + } +} diff --git a/src/test/run-pass/issues/issue-6470.rs b/src/test/run-pass/issues/issue-6470.rs new file mode 100644 index 00000000000..152b4bbedc3 --- /dev/null +++ b/src/test/run-pass/issues/issue-6470.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// pretty-expanded FIXME #23616 +#![allow(non_snake_case)] + +pub mod Bar { + pub struct Foo { + v: isize, + } + + extern { + pub fn foo(v: *const Foo) -> Foo; + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-6557.rs b/src/test/run-pass/issues/issue-6557.rs new file mode 100644 index 00000000000..5179ddb472b --- /dev/null +++ b/src/test/run-pass/issues/issue-6557.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_patterns)] +#![feature(box_syntax)] + +fn foo(box (_x, _y): Box<(isize, isize)>) {} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-6892.rs b/src/test/run-pass/issues/issue-6892.rs new file mode 100644 index 00000000000..173ad5833e5 --- /dev/null +++ b/src/test/run-pass/issues/issue-6892.rs @@ -0,0 +1,67 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensures that destructors are run for expressions of the form "let _ = e;" +// where `e` is a type which requires a destructor. + + +struct Foo; +struct Bar { x: isize } +struct Baz(isize); +enum FooBar { _Foo(Foo), _Bar(usize) } + +static mut NUM_DROPS: usize = 0; + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} +impl Drop for Bar { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} +impl Drop for Baz { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} +impl Drop for FooBar { + fn drop(&mut self) { + unsafe { NUM_DROPS += 1; } + } +} + +fn main() { + assert_eq!(unsafe { NUM_DROPS }, 0); + { let _x = Foo; } + assert_eq!(unsafe { NUM_DROPS }, 1); + { let _x = Bar { x: 21 }; } + assert_eq!(unsafe { NUM_DROPS }, 2); + { let _x = Baz(21); } + assert_eq!(unsafe { NUM_DROPS }, 3); + { let _x = FooBar::_Foo(Foo); } + assert_eq!(unsafe { NUM_DROPS }, 5); + { let _x = FooBar::_Bar(42); } + assert_eq!(unsafe { NUM_DROPS }, 6); + + { let _ = Foo; } + assert_eq!(unsafe { NUM_DROPS }, 7); + { let _ = Bar { x: 21 }; } + assert_eq!(unsafe { NUM_DROPS }, 8); + { let _ = Baz(21); } + assert_eq!(unsafe { NUM_DROPS }, 9); + { let _ = FooBar::_Foo(Foo); } + assert_eq!(unsafe { NUM_DROPS }, 11); + { let _ = FooBar::_Bar(42); } + assert_eq!(unsafe { NUM_DROPS }, 12); +} diff --git a/src/test/run-pass/issues/issue-6898.rs b/src/test/run-pass/issues/issue-6898.rs new file mode 100644 index 00000000000..b9a3a24585b --- /dev/null +++ b/src/test/run-pass/issues/issue-6898.rs @@ -0,0 +1,43 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::mem; + +/// Returns the size of a type +pub fn size_of() -> usize { + TypeInfo::size_of(None::) +} + +/// Returns the size of the type that `val` points to +pub fn size_of_val(val: &T) -> usize { + val.size_of_val() +} + +pub trait TypeInfo: Sized { + fn size_of(_lame_type_hint: Option) -> usize; + fn size_of_val(&self) -> usize; +} + +impl TypeInfo for T { + /// The size of the type in bytes. + fn size_of(_lame_type_hint: Option) -> usize { + mem::size_of::() + } + + /// Returns the size of the type of `self` in bytes. + fn size_of_val(&self) -> usize { + TypeInfo::size_of(None::) + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-6919.rs b/src/test/run-pass/issues/issue-6919.rs new file mode 100644 index 00000000000..94c1a1ae00a --- /dev/null +++ b/src/test/run-pass/issues/issue-6919.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:iss.rs + +// pretty-expanded FIXME #23616 + +#![crate_id="issue-6919"] +extern crate issue6919_3; + +pub fn main() { + let _ = issue6919_3::D.k; +} diff --git a/src/test/run-pass/issues/issue-6991.rs b/src/test/run-pass/issues/issue-6991.rs new file mode 100644 index 00000000000..13b738ac0e6 --- /dev/null +++ b/src/test/run-pass/issues/issue-6991.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +static x: &'static usize = &1; +static y: usize = *x; + +fn main() {} diff --git a/src/test/run-pass/issues/issue-7012.rs b/src/test/run-pass/issues/issue-7012.rs new file mode 100644 index 00000000000..217c0dee560 --- /dev/null +++ b/src/test/run-pass/issues/issue-7012.rs @@ -0,0 +1,32 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +/* +# Comparison of static arrays + +The expected behaviour would be that test==test1, therefore 'true' +would be printed, however the below prints false. +*/ + +struct signature<'a> { pattern : &'a [u32] } + +static test1: signature<'static> = signature { + pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0] +}; + +pub fn main() { + let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e, + 0x03707344,0xa4093822,0x299f31d0]; + println!("{}",test==test1.pattern); +} diff --git a/src/test/run-pass/issues/issue-7178.rs b/src/test/run-pass/issues/issue-7178.rs new file mode 100644 index 00000000000..3a74ed833e9 --- /dev/null +++ b/src/test/run-pass/issues/issue-7178.rs @@ -0,0 +1,20 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-7178.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_7178 as cross_crate_self; + +pub fn main() { + let _ = cross_crate_self::Foo::new(&1); +} diff --git a/src/test/run-pass/issues/issue-7222.rs b/src/test/run-pass/issues/issue-7222.rs new file mode 100644 index 00000000000..52c3e17fae6 --- /dev/null +++ b/src/test/run-pass/issues/issue-7222.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 + +pub fn main() { + const FOO: f64 = 10.0; + + match 0.0 { + 0.0 ..= FOO => (), + _ => () + } +} diff --git a/src/test/run-pass/issues/issue-7268.rs b/src/test/run-pass/issues/issue-7268.rs new file mode 100644 index 00000000000..3a93a144ee8 --- /dev/null +++ b/src/test/run-pass/issues/issue-7268.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo(_: T) {} + +fn bar(x: &'static T) { + foo(x); +} +fn main() {} diff --git a/src/test/run-pass/issues/issue-7344.rs b/src/test/run-pass/issues/issue-7344.rs new file mode 100644 index 00000000000..cc160c79ae9 --- /dev/null +++ b/src/test/run-pass/issues/issue-7344.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unreachable_code)] + +fn foo() -> bool { false } + +fn bar() { + return; + !foo(); +} + +fn baz() { + return; + if "" == "" {} +} + +pub fn main() { + bar(); + baz(); +} diff --git a/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs b/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs new file mode 100644 index 00000000000..3e60d24627c --- /dev/null +++ b/src/test/run-pass/issues/issue-7519-match-unit-in-arg.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +/* +#7519 ICE pattern matching unit in function argument +*/ + +fn foo(():()) { } + +pub fn main() { + foo(()); +} diff --git a/src/test/run-pass/issues/issue-7563.rs b/src/test/run-pass/issues/issue-7563.rs new file mode 100644 index 00000000000..203c9cdfa49 --- /dev/null +++ b/src/test/run-pass/issues/issue-7563.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait IDummy { + fn do_nothing(&self); +} + +#[derive(Debug)] +struct A { a: isize } +#[derive(Debug)] +struct B<'a> { b: isize, pa: &'a A } + + impl IDummy for A { + fn do_nothing(&self) { + println!("A::do_nothing() is called"); + } + } + +impl<'a> B<'a> { + fn get_pa(&self) -> &'a IDummy { self.pa as &'a IDummy } +} + +pub fn main() { + let sa = A { a: 100 }; + let sb = B { b: 200, pa: &sa }; + + println!("sa is {:?}", sa); + println!("sb is {:?}", sb); +} diff --git a/src/test/run-pass/issues/issue-7575.rs b/src/test/run-pass/issues/issue-7575.rs new file mode 100644 index 00000000000..e027119855e --- /dev/null +++ b/src/test/run-pass/issues/issue-7575.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { + fn new() -> bool { false } + fn dummy(&self) { } +} + +trait Bar { + fn new(&self) -> bool { true } +} + +impl Bar for isize {} +impl Foo for isize {} + +fn main() { + assert!(1.new()); +} diff --git a/src/test/run-pass/issues/issue-7607-2.rs b/src/test/run-pass/issues/issue-7607-2.rs new file mode 100644 index 00000000000..7a1f0159df9 --- /dev/null +++ b/src/test/run-pass/issues/issue-7607-2.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub mod a { + pub struct Foo { a: usize } +} + +pub mod b { + use a::Foo; + impl Foo { + fn bar(&self) { } + } +} + +pub fn main() { } diff --git a/src/test/run-pass/issues/issue-7660.rs b/src/test/run-pass/issues/issue-7660.rs new file mode 100644 index 00000000000..774d9706d90 --- /dev/null +++ b/src/test/run-pass/issues/issue-7660.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue 7660 +// rvalue lifetime too short when equivalent `match` works + +// pretty-expanded FIXME #23616 + +use std::collections::HashMap; + +struct A(isize, isize); + +pub fn main() { + let mut m: HashMap = HashMap::new(); + m.insert(1, A(0, 0)); + + let A(ref _a, ref _b) = m[&1]; + let (a, b) = match m[&1] { A(ref _a, ref _b) => (_a, _b) }; +} diff --git a/src/test/run-pass/issues/issue-7663.rs b/src/test/run-pass/issues/issue-7663.rs new file mode 100644 index 00000000000..2c2ce9483da --- /dev/null +++ b/src/test/run-pass/issues/issue-7663.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(unused_imports, dead_code)] + +mod test1 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use test1::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +mod test2 { + + mod foo { pub fn p() -> isize { 1 } } + mod bar { pub fn p() -> isize { 2 } } + + pub mod baz { + use test2::bar::p; + + pub fn my_main() { assert_eq!(p(), 2); } + } +} + +fn main() { + test1::baz::my_main(); + test2::baz::my_main(); +} diff --git a/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs new file mode 100644 index 00000000000..f9dae8472a8 --- /dev/null +++ b/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +/* + +#7673 Polymorphically creating traits barely works + +*/ + +#![feature(box_syntax)] + +pub fn main() {} + +trait A { + fn dummy(&self) { } +} + +impl A for T {} + +fn owned2(a: Box) { a as Box; } +fn owned3(a: Box) { box a as Box; } diff --git a/src/test/run-pass/issues/issue-7784.rs b/src/test/run-pass/issues/issue-7784.rs new file mode 100644 index 00000000000..864371cab4d --- /dev/null +++ b/src/test/run-pass/issues/issue-7784.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +use std::ops::Add; + +fn foo + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { + (x.clone(), x.clone() + y.clone(), x + y + z) +} +fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { + [a, b, b, a] +} + +fn main() { + assert_eq!(foo([1, 2, 3]), (1, 3, 6)); + + let [a, b, c, d] = bar("foo", "bar"); + assert_eq!(a, "foo"); + assert_eq!(b, "bar"); + assert_eq!(c, "bar"); + assert_eq!(d, "foo"); + + let [a, _, _, d] = bar("baz", "foo"); + assert_eq!(a, "baz"); + assert_eq!(d, "baz"); + + let out = bar("baz", "foo"); + let [a, xs.., d] = out; + assert_eq!(a, "baz"); + assert_eq!(xs, ["foo", "foo"]); + assert_eq!(d, "baz"); +} diff --git a/src/test/run-pass/issues/issue-7899.rs b/src/test/run-pass/issues/issue-7899.rs new file mode 100644 index 00000000000..74a5b060822 --- /dev/null +++ b/src/test/run-pass/issues/issue-7899.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-7899.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_7899 as testcrate; + +fn main() { + let f = testcrate::V2(1.0f32, 2.0f32); +} diff --git a/src/test/run-pass/issues/issue-7911.rs b/src/test/run-pass/issues/issue-7911.rs new file mode 100644 index 00000000000..f2299eecb40 --- /dev/null +++ b/src/test/run-pass/issues/issue-7911.rs @@ -0,0 +1,47 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// (Closes #7911) Test that we can use the same self expression +// with different mutability in macro in two methods + +#![allow(unused_variables)] // unused foobar_immut + foobar_mut +trait FooBar { + fn dummy(&self) { } +} +struct Bar(i32); +struct Foo { bar: Bar } + +impl FooBar for Bar {} + +trait Test { + fn get_immut(&self) -> &FooBar; + fn get_mut(&mut self) -> &mut FooBar; +} + +macro_rules! generate_test { ($type_:path, $slf:ident, $field:expr) => ( + impl Test for $type_ { + fn get_immut(&$slf) -> &FooBar { + &$field as &FooBar + } + + fn get_mut(&mut $slf) -> &mut FooBar { + &mut $field as &mut FooBar + } + } +)} + +generate_test!(Foo, self, self.bar); + +pub fn main() { + let mut foo: Foo = Foo { bar: Bar(42) }; + { let foobar_immut = foo.get_immut(); } + { let foobar_mut = foo.get_mut(); } +} diff --git a/src/test/run-pass/issues/issue-8044.rs b/src/test/run-pass/issues/issue-8044.rs new file mode 100644 index 00000000000..3a3d08dc35a --- /dev/null +++ b/src/test/run-pass/issues/issue-8044.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-8044.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_8044 as minimal; +use minimal::{BTree, leaf}; + +pub fn main() { + BTree:: { node: leaf(1) }; +} diff --git a/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs new file mode 100644 index 00000000000..311fd129ab0 --- /dev/null +++ b/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +/* + +#8171 Self is not recognised as implementing kinds in default method implementations + +*/ + +fn require_send(_: T){} + +trait TragicallySelfIsNotSend: Send + Sized { + fn x(self) { + require_send(self); + } +} + +pub fn main(){} diff --git a/src/test/run-pass/issues/issue-8248.rs b/src/test/run-pass/issues/issue-8248.rs new file mode 100644 index 00000000000..21060576f2e --- /dev/null +++ b/src/test/run-pass/issues/issue-8248.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +fn foo(_: &mut A) {} + +pub fn main() { + let mut b = B; + foo(&mut b as &mut A); +} diff --git a/src/test/run-pass/issues/issue-8249.rs b/src/test/run-pass/issues/issue-8249.rs new file mode 100644 index 00000000000..9afa6f937b5 --- /dev/null +++ b/src/test/run-pass/issues/issue-8249.rs @@ -0,0 +1,29 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait A { + fn dummy(&self) { } +} +struct B; +impl A for B {} + +struct C<'a> { + foo: &'a mut (A+'a), +} + +fn foo(a: &mut A) { + C{ foo: a }; +} + +pub fn main() { +} diff --git a/src/test/run-pass/issues/issue-8259.rs b/src/test/run-pass/issues/issue-8259.rs new file mode 100644 index 00000000000..a0e2caee40a --- /dev/null +++ b/src/test/run-pass/issues/issue-8259.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// aux-build:issue-8259.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_8259 as other; +static a: other::Foo<'static> = other::Foo::A; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-8351-1.rs b/src/test/run-pass/issues/issue-8351-1.rs new file mode 100644 index 00000000000..3caecf9fb93 --- /dev/null +++ b/src/test/run-pass/issues/issue-8351-1.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { + Foo{f: isize}, + Bar, +} + +pub fn main() { + let e = E::Foo{f: 0}; + match e { + E::Foo{f: 1} => panic!(), + E::Foo{..} => (), + _ => panic!(), + } +} diff --git a/src/test/run-pass/issues/issue-8351-2.rs b/src/test/run-pass/issues/issue-8351-2.rs new file mode 100644 index 00000000000..da70fc415c0 --- /dev/null +++ b/src/test/run-pass/issues/issue-8351-2.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum E { + Foo{f: isize, b: bool}, + Bar, +} + +pub fn main() { + let e = E::Foo{f: 0, b: false}; + match e { + E::Foo{f: 1, b: true} => panic!(), + E::Foo{b: false, f: 0} => (), + _ => panic!(), + } +} diff --git a/src/test/run-pass/issues/issue-8391.rs b/src/test/run-pass/issues/issue-8391.rs new file mode 100644 index 00000000000..d6c85370b8e --- /dev/null +++ b/src/test/run-pass/issues/issue-8391.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn main() { + let x = match Some(1) { + ref _y @ Some(_) => 1, + None => 2, + }; + assert_eq!(x, 1); +} diff --git a/src/test/run-pass/issues/issue-8398.rs b/src/test/run-pass/issues/issue-8398.rs new file mode 100644 index 00000000000..e4f5a457f41 --- /dev/null +++ b/src/test/run-pass/issues/issue-8398.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait Writer { + fn write(&mut self, b: &[u8]) -> Result<(), ()>; +} + +fn foo(a: &mut Writer) { + a.write(&[]).unwrap(); +} + +pub fn main(){} diff --git a/src/test/run-pass/issues/issue-8401.rs b/src/test/run-pass/issues/issue-8401.rs new file mode 100644 index 00000000000..966f89486b7 --- /dev/null +++ b/src/test/run-pass/issues/issue-8401.rs @@ -0,0 +1,18 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_8401.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_8401; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-8460.rs b/src/test/run-pass/issues/issue-8460.rs new file mode 100644 index 00000000000..9f0f7e2fa42 --- /dev/null +++ b/src/test/run-pass/issues/issue-8460.rs @@ -0,0 +1,60 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support +#![feature(rustc_attrs)] + +use std::thread; + +trait Int { + fn zero() -> Self; + fn one() -> Self; +} +macro_rules! doit { + ($($t:ident)*) => ($(impl Int for $t { + fn zero() -> $t { 0 } + fn one() -> $t { 1 } + })*) +} +doit! { i8 i16 i32 i64 isize } + +macro_rules! check { + ($($e:expr),*) => { + $(assert!(thread::spawn({ + move|| { $e; } + }).join().is_err());)* + } +} + +fn main() { + check![ + isize::min_value() / -isize::one(), + i8::min_value() / -i8::one(), + i16::min_value() / -i16::one(), + i32::min_value() / -i32::one(), + i64::min_value() / -i64::one(), + 1isize / isize::zero(), + 1i8 / i8::zero(), + 1i16 / i16::zero(), + 1i32 / i32::zero(), + 1i64 / i64::zero(), + isize::min_value() % -isize::one(), + i8::min_value() % -i8::one(), + i16::min_value() % -i16::one(), + i32::min_value() % -i32::one(), + i64::min_value() % -i64::one(), + 1isize % isize::zero(), + 1i8 % i8::zero(), + 1i16 % i16::zero(), + 1i32 % i32::zero(), + 1i64 % i64::zero() + ]; +} diff --git a/src/test/run-pass/issues/issue-8498.rs b/src/test/run-pass/issues/issue-8498.rs new file mode 100644 index 00000000000..334c331dba7 --- /dev/null +++ b/src/test/run-pass/issues/issue-8498.rs @@ -0,0 +1,37 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + match &[(Box::new(5),Box::new(7))] { + ps => { + let (ref y, _) = ps[0]; + assert_eq!(**y, 5); + } + } + + match Some(&[(Box::new(5),)]) { + Some(ps) => { + let (ref y,) = ps[0]; + assert_eq!(**y, 5); + } + None => () + } + + match Some(&[(Box::new(5),Box::new(7))]) { + Some(ps) => { + let (ref y, ref z) = ps[0]; + assert_eq!(**y, 5); + assert_eq!(**z, 7); + } + None => () + } +} diff --git a/src/test/run-pass/issues/issue-8506.rs b/src/test/run-pass/issues/issue-8506.rs new file mode 100644 index 00000000000..1cf054a46df --- /dev/null +++ b/src/test/run-pass/issues/issue-8506.rs @@ -0,0 +1,24 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_upper_case_globals)] + +#![allow(dead_code)] + +enum Either { + One, + Other(String,String) +} + +static one : Either = Either::One; + +pub fn main () { } diff --git a/src/test/run-pass/issues/issue-8521.rs b/src/test/run-pass/issues/issue-8521.rs new file mode 100644 index 00000000000..b70a79bed3c --- /dev/null +++ b/src/test/run-pass/issues/issue-8521.rs @@ -0,0 +1,35 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo1 {} + +trait A {} + +macro_rules! foo1(($t:path) => { + impl Foo1 for T {} +}); + +foo1!(A); + +trait Foo2 {} + +trait B {} + +#[allow(unused)] +struct C {} + +macro_rules! foo2(($t:path) => { + impl Foo2 for T {} +}); + +foo2!(B); + +fn main() {} diff --git a/src/test/run-pass/issues/issue-8578.rs b/src/test/run-pass/issues/issue-8578.rs new file mode 100644 index 00000000000..8753ee8370b --- /dev/null +++ b/src/test/run-pass/issues/issue-8578.rs @@ -0,0 +1,29 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] +// pretty-expanded FIXME #23616 + +pub struct UninterpretedOption_NamePart { + name_part: Option, +} + +impl<'a> UninterpretedOption_NamePart { + pub fn default_instance() -> &'static UninterpretedOption_NamePart { + static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart { + name_part: None, + }; + &instance + } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-868.rs b/src/test/run-pass/issues/issue-868.rs new file mode 100644 index 00000000000..a545abefb7a --- /dev/null +++ b/src/test/run-pass/issues/issue-868.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn f(g: F) -> T where F: FnOnce() -> T { g() } + +pub fn main() { + let _x = f( | | { 10 }); + // used to be: cannot determine a type for this expression + f(| | { }); + // ditto + f( | | { ()}); + // always worked + let _: () = f(| | { }); + // empty block with no type info should compile too + let _ = f(||{}); + let _ = (||{}); +} diff --git a/src/test/run-pass/issues/issue-8709.rs b/src/test/run-pass/issues/issue-8709.rs new file mode 100644 index 00000000000..3d0739caf1a --- /dev/null +++ b/src/test/run-pass/issues/issue-8709.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! sty { + ($t:ty) => (stringify!($t)) +} + +macro_rules! spath { + ($t:path) => (stringify!($t)) +} + +fn main() { + assert_eq!(sty!(isize), "isize"); + assert_eq!(spath!(std::option), "std::option"); +} diff --git a/src/test/run-pass/issues/issue-8783.rs b/src/test/run-pass/issues/issue-8783.rs new file mode 100644 index 00000000000..741411aeffb --- /dev/null +++ b/src/test/run-pass/issues/issue-8783.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::default::Default; + +struct X { pub x: usize } +impl Default for X { + fn default() -> X { + X { x: 42 } + } +} + +struct Y { pub y: T } +impl Default for Y { + fn default() -> Y { + Y { y: Default::default() } + } +} + +fn main() { + let X { x: _ } = Default::default(); + let Y { y: X { x } } = Default::default(); +} diff --git a/src/test/run-pass/issues/issue-8827.rs b/src/test/run-pass/issues/issue-8827.rs new file mode 100644 index 00000000000..d854793c22a --- /dev/null +++ b/src/test/run-pass/issues/issue-8827.rs @@ -0,0 +1,63 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Receiver}; + +fn periodical(n: isize) -> Receiver { + let (chan, port) = channel(); + thread::spawn(move|| { + loop { + for _ in 1..n { + match chan.send(false) { + Ok(()) => {} + Err(..) => break, + } + } + match chan.send(true) { + Ok(()) => {} + Err(..) => break + } + } + }); + return port; +} + +fn integers() -> Receiver { + let (chan, port) = channel(); + thread::spawn(move|| { + let mut i = 1; + loop { + match chan.send(i) { + Ok(()) => {} + Err(..) => break, + } + i = i + 1; + } + }); + return port; +} + +fn main() { + let ints = integers(); + let threes = periodical(3); + let fives = periodical(5); + for _ in 1..100 { + match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { + (_, true, true) => println!("FizzBuzz"), + (_, true, false) => println!("Fizz"), + (_, false, true) => println!("Buzz"), + (i, false, false) => println!("{}", i) + } + } +} diff --git a/src/test/run-pass/issues/issue-8851.rs b/src/test/run-pass/issues/issue-8851.rs new file mode 100644 index 00000000000..19fd51b476d --- /dev/null +++ b/src/test/run-pass/issues/issue-8851.rs @@ -0,0 +1,39 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// after fixing #9384 and implementing hygiene for match bindings, +// this now fails because the insertion of the 'y' into the match +// doesn't cause capture. Making this macro hygienic (as I've done) +// could very well make this test case completely pointless.... + +// pretty-expanded FIXME #23616 + +enum T { + A(isize), + B(usize) +} + +macro_rules! test { + ($id:ident, $e:expr) => ( + fn foo(t: T) -> isize { + match t { + T::A($id) => $e, + T::B($id) => $e + } + } + ) +} + +test!(y, 10 + (y as isize)); + +pub fn main() { + foo(T::A(20)); +} diff --git a/src/test/run-pass/issues/issue-8860.rs b/src/test/run-pass/issues/issue-8860.rs new file mode 100644 index 00000000000..c4d9cab9ff3 --- /dev/null +++ b/src/test/run-pass/issues/issue-8860.rs @@ -0,0 +1,59 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z borrowck=compare + +static mut DROP: isize = 0; +static mut DROP_S: isize = 0; +static mut DROP_T: isize = 0; + +struct S; +impl Drop for S { + fn drop(&mut self) { + unsafe { + DROP_S += 1; + DROP += 1; + } + } +} +fn f(ref _s: S) {} + +struct T { i: isize } +impl Drop for T { + fn drop(&mut self) { + unsafe { + DROP_T += 1; + DROP += 1; + } + } +} +fn g(ref _t: T) {} + +fn do_test() { + let s = S; + f(s); + unsafe { + assert_eq!(1, DROP); + assert_eq!(1, DROP_S); + } + let t = T { i: 1 }; + g(t); + unsafe { assert_eq!(1, DROP_T); } +} + +fn main() { + do_test(); + unsafe { + assert_eq!(2, DROP); + assert_eq!(1, DROP_S); + assert_eq!(1, DROP_T); + } +} diff --git a/src/test/run-pass/issues/issue-8898.rs b/src/test/run-pass/issues/issue-8898.rs new file mode 100644 index 00000000000..d405a0949e8 --- /dev/null +++ b/src/test/run-pass/issues/issue-8898.rs @@ -0,0 +1,28 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn assert_repr_eq(obj : T, expected : String) { + assert_eq!(expected, format!("{:?}", obj)); +} + +pub fn main() { + let abc = [1, 2, 3]; + let tf = [true, false]; + let x = [(), ()]; + let slice = &x[..1]; + + assert_repr_eq(&abc[..], "[1, 2, 3]".to_string()); + assert_repr_eq(&tf[..], "[true, false]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); + assert_repr_eq(slice, "[()]".to_string()); + assert_repr_eq(&x[..], "[(), ()]".to_string()); +} diff --git a/src/test/run-pass/issues/issue-9047.rs b/src/test/run-pass/issues/issue-9047.rs new file mode 100644 index 00000000000..30f886f6784 --- /dev/null +++ b/src/test/run-pass/issues/issue-9047.rs @@ -0,0 +1,22 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn decode() -> String { + 'outer: loop { + let mut ch_start: usize; + break 'outer; + } + "".to_string() +} + +pub fn main() { + println!("{}", decode()); +} diff --git a/src/test/run-pass/issues/issue-9110.rs b/src/test/run-pass/issues/issue-9110.rs new file mode 100644 index 00000000000..906c7a422e7 --- /dev/null +++ b/src/test/run-pass/issues/issue-9110.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +#![allow(non_snake_case)] + +macro_rules! silly_macro { + () => ( + pub mod Qux { + pub struct Foo { x : u8 } + pub fn bar(_foo : Foo) {} + } + ); +} + +silly_macro!(); + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-9123.rs b/src/test/run-pass/issues/issue-9123.rs new file mode 100644 index 00000000000..0f41acecaaa --- /dev/null +++ b/src/test/run-pass/issues/issue-9123.rs @@ -0,0 +1,18 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_9123.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9123; + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-9129.rs b/src/test/run-pass/issues/issue-9129.rs new file mode 100644 index 00000000000..21e192b23f5 --- /dev/null +++ b/src/test/run-pass/issues/issue-9129.rs @@ -0,0 +1,44 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] +// ignore-pretty unreported + +#![feature(box_syntax)] + +pub trait bomb { fn boom(&self, _: Ident); } +pub struct S; +impl bomb for S { fn boom(&self, _: Ident) { } } + +pub struct Ident { name: usize } + +// macro_rules! int3 { () => ( unsafe { asm!( "int3" ); } ) } +macro_rules! int3 { () => ( { } ) } + +fn Ident_new() -> Ident { + int3!(); + Ident {name: 0x6789ABCD } +} + +pub fn light_fuse(fld: Box) { + int3!(); + let f = || { + int3!(); + fld.boom(Ident_new()); // *** 1 + }; + f(); +} + +pub fn main() { + let b = box S as Box; + light_fuse(b); +} diff --git a/src/test/run-pass/issues/issue-9188.rs b/src/test/run-pass/issues/issue-9188.rs new file mode 100644 index 00000000000..44fe06eed49 --- /dev/null +++ b/src/test/run-pass/issues/issue-9188.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_9188.rs + + +extern crate issue_9188; + +pub fn main() { + let a = issue_9188::bar(); + let b = issue_9188::foo::(); + assert_eq!(*a, *b); +} diff --git a/src/test/run-pass/issues/issue-9243.rs b/src/test/run-pass/issues/issue-9243.rs new file mode 100644 index 00000000000..957330a1925 --- /dev/null +++ b/src/test/run-pass/issues/issue-9243.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue 9243 +#![allow(non_upper_case_globals)] + +pub struct Test { + mem: isize, +} + +pub static g_test: Test = Test {mem: 0}; + +impl Drop for Test { + fn drop(&mut self) {} +} + +fn main() {} diff --git a/src/test/run-pass/issues/issue-9249.rs b/src/test/run-pass/issues/issue-9249.rs new file mode 100644 index 00000000000..d11665c531e --- /dev/null +++ b/src/test/run-pass/issues/issue-9249.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +static DATA:&'static [&'static str] = &["my string"]; +fn main() { } diff --git a/src/test/run-pass/issues/issue-9259.rs b/src/test/run-pass/issues/issue-9259.rs new file mode 100644 index 00000000000..481014fe3f3 --- /dev/null +++ b/src/test/run-pass/issues/issue-9259.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct A<'a> { + a: &'a [String], + b: Option<&'a [String]>, +} + +pub fn main() { + let b: &[String] = &["foo".to_string()]; + let a = A { + a: &["test".to_string()], + b: Some(b), + }; + assert_eq!(a.b.as_ref().unwrap()[0], "foo"); +} diff --git a/src/test/run-pass/issues/issue-9382.rs b/src/test/run-pass/issues/issue-9382.rs new file mode 100644 index 00000000000..6a4f868cdf1 --- /dev/null +++ b/src/test/run-pass/issues/issue-9382.rs @@ -0,0 +1,49 @@ +// pretty-expanded FIXME #23616 + +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +// Tests for a previous bug that occurred due to an interaction +// between struct field initialization and the auto-coercion +// from a vector to a slice. The drop glue was being invoked on +// the temporary slice with a wrong type, triggering an LLVM assert. + + +struct Thing1<'a> { + baz: &'a [Box], + bar: Box, +} + +struct Thing2<'a> { + baz: &'a [Box], + bar: u64, +} + +pub fn main() { + let _t1_fixed = Thing1 { + baz: &[], + bar: box 32, + }; + Thing1 { + baz: &Vec::new(), + bar: box 32, + }; + let _t2_fixed = Thing2 { + baz: &[], + bar: 32, + }; + Thing2 { + baz: &Vec::new(), + bar: 32, + }; +} diff --git a/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs b/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs new file mode 100644 index 00000000000..ca94a7b2fbd --- /dev/null +++ b/src/test/run-pass/issues/issue-9394-inherited-trait-calls.rs @@ -0,0 +1,72 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Base: Base2 + Base3{ + fn foo(&self) -> String; + fn foo1(&self) -> String; + fn foo2(&self) -> String{ + "base foo2".to_string() + } +} + +trait Base2: Base3{ + fn baz(&self) -> String; +} + +trait Base3{ + fn root(&self) -> String; +} + +trait Super: Base{ + fn bar(&self) -> String; +} + +struct X; + +impl Base for X { + fn foo(&self) -> String{ + "base foo".to_string() + } + fn foo1(&self) -> String{ + "base foo1".to_string() + } + +} + +impl Base2 for X { + fn baz(&self) -> String{ + "base2 baz".to_string() + } +} + +impl Base3 for X { + fn root(&self) -> String{ + "base3 root".to_string() + } +} + +impl Super for X { + fn bar(&self) -> String{ + "super bar".to_string() + } +} + +pub fn main() { + let n = X; + let s = &n as &Super; + assert_eq!(s.bar(),"super bar".to_string()); + assert_eq!(s.foo(),"base foo".to_string()); + assert_eq!(s.foo1(),"base foo1".to_string()); + assert_eq!(s.foo2(),"base foo2".to_string()); + assert_eq!(s.baz(),"base2 baz".to_string()); + assert_eq!(s.root(),"base3 root".to_string()); +} diff --git a/src/test/run-pass/issues/issue-9396.rs b/src/test/run-pass/issues/issue-9396.rs new file mode 100644 index 00000000000..62a38767ddd --- /dev/null +++ b/src/test/run-pass/issues/issue-9396.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] +// ignore-emscripten no threads support + +use std::sync::mpsc::{TryRecvError, channel}; +use std::thread; + +pub fn main() { + let (tx, rx) = channel(); + let t = thread::spawn(move||{ + thread::sleep_ms(10); + tx.send(()).unwrap(); + }); + loop { + match rx.try_recv() { + Ok(()) => break, + Err(TryRecvError::Empty) => {} + Err(TryRecvError::Disconnected) => unreachable!() + } + } + t.join(); +} diff --git a/src/test/run-pass/issues/issue-9446.rs b/src/test/run-pass/issues/issue-9446.rs new file mode 100644 index 00000000000..efd04a1c5ac --- /dev/null +++ b/src/test/run-pass/issues/issue-9446.rs @@ -0,0 +1,40 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Wrapper(String); + +impl Wrapper { + pub fn new(wrapped: String) -> Wrapper { + Wrapper(wrapped) + } + + pub fn say_hi(&self) { + let Wrapper(ref s) = *self; + println!("hello {}", *s); + } +} + +impl Drop for Wrapper { + fn drop(&mut self) {} +} + +pub fn main() { + { + // This runs without complaint. + let x = Wrapper::new("Bob".to_string()); + x.say_hi(); + } + { + // This fails to compile, circa 0.8-89-gc635fba. + // error: internal compiler error: drop_ty_immediate: non-box ty + Wrapper::new("Bob".to_string()).say_hi(); + } +} diff --git a/src/test/run-pass/issues/issue-9719.rs b/src/test/run-pass/issues/issue-9719.rs new file mode 100644 index 00000000000..1e52f326c1f --- /dev/null +++ b/src/test/run-pass/issues/issue-9719.rs @@ -0,0 +1,50 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod a { + pub enum Enum { + A(T), + } + + pub trait X { + fn dummy(&self) { } + } + impl X for isize {} + + pub struct Z<'a>(Enum<&'a (X+'a)>); + fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } +} + +mod b { + trait X { + fn dummy(&self) { } + } + impl X for isize {} + struct Y<'a>{ + x:Option<&'a (X+'a)>, + } + + fn bar() { + let x: isize = 42; + let _y = Y { x: Some(&x as &X) }; + } +} + +mod c { + pub trait X { fn f(&self); } + impl X for isize { fn f(&self) {} } + pub struct Z<'a>(Option<&'a (X+'a)>); + fn main() { let x: isize = 42; let z = Z(Some(&x as &X)); let _ = z; } +} + +pub fn main() {} diff --git a/src/test/run-pass/issues/issue-9737.rs b/src/test/run-pass/issues/issue-9737.rs new file mode 100644 index 00000000000..304eb7808a7 --- /dev/null +++ b/src/test/run-pass/issues/issue-9737.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! f { + (v: $x:expr) => ( println!("{}", $x) ) +} + +fn main () { + let v = 5; + f!(v: 3); +} diff --git a/src/test/run-pass/issues/issue-979.rs b/src/test/run-pass/issues/issue-979.rs new file mode 100644 index 00000000000..a00909ffb67 --- /dev/null +++ b/src/test/run-pass/issues/issue-979.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::cell::Cell; + +struct r<'a> { + b: &'a Cell, +} + +impl<'a> Drop for r<'a> { + fn drop(&mut self) { + self.b.set(self.b.get() + 1); + } +} + +fn r(b: &Cell) -> r { + r { + b: b + } +} + +pub fn main() { + let b = &Cell::new(0); + { + let _p = Some(r(b)); + } + + assert_eq!(b.get(), 1); +} diff --git a/src/test/run-pass/issues/issue-9837.rs b/src/test/run-pass/issues/issue-9837.rs new file mode 100644 index 00000000000..0a4c53ae1c5 --- /dev/null +++ b/src/test/run-pass/issues/issue-9837.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const C1: i32 = 0x12345678; +const C2: isize = C1 as i16 as isize; + +enum E { + V = C2 +} + +fn main() { + assert_eq!(C2 as u64, E::V as u64); +} diff --git a/src/test/run-pass/issues/issue-9906.rs b/src/test/run-pass/issues/issue-9906.rs new file mode 100644 index 00000000000..546de0f6429 --- /dev/null +++ b/src/test/run-pass/issues/issue-9906.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-9906.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9906 as testmod; + +pub fn main() { + testmod::foo(); + testmod::FooBar::new(1); +} diff --git a/src/test/run-pass/issues/issue-9918.rs b/src/test/run-pass/issues/issue-9918.rs new file mode 100644 index 00000000000..bfad636876c --- /dev/null +++ b/src/test/run-pass/issues/issue-9918.rs @@ -0,0 +1,15 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + assert_eq!((0 + 0u8) as char, '\0'); +} diff --git a/src/test/run-pass/issues/issue-9942.rs b/src/test/run-pass/issues/issue-9942.rs new file mode 100644 index 00000000000..7c50c96e9a8 --- /dev/null +++ b/src/test/run-pass/issues/issue-9942.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + const S: usize = 23 as usize; [0; S]; () +} diff --git a/src/test/run-pass/issues/issue-9951.rs b/src/test/run-pass/issues/issue-9951.rs new file mode 100644 index 00000000000..35cdafc87d0 --- /dev/null +++ b/src/test/run-pass/issues/issue-9951.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +trait Bar { + fn noop(&self); +} +impl Bar for u8 { + fn noop(&self) {} +} + +fn main() { + let (a, b) = (&5u8 as &Bar, &9u8 as &Bar); + let (c, d): (&Bar, &Bar) = (a, b); + + let (a, b) = (Box::new(5u8) as Box, Box::new(9u8) as Box); + let (c, d): (&Bar, &Bar) = (&*a, &*b); + + let (c, d): (&Bar, &Bar) = (&5, &9); +} diff --git a/src/test/run-pass/issues/issue-9968.rs b/src/test/run-pass/issues/issue-9968.rs new file mode 100644 index 00000000000..8fe54ff0c63 --- /dev/null +++ b/src/test/run-pass/issues/issue-9968.rs @@ -0,0 +1,23 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue-9968.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9968 as lib; + +use lib::{Trait, Struct}; + +pub fn main() +{ + Struct::init().test(); +} diff --git a/src/test/run-pass/issues/issue2170exe.rs b/src/test/run-pass/issues/issue2170exe.rs new file mode 100644 index 00000000000..84b8d421da6 --- /dev/null +++ b/src/test/run-pass/issues/issue2170exe.rs @@ -0,0 +1,19 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue2170lib.rs +// pretty-expanded FIXME #23616 + +extern crate issue2170lib; + +pub fn main() { + // let _ = issue2170lib::rsrc(2); +} diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs new file mode 100644 index 00000000000..f1624fd2e58 --- /dev/null +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +// This is a file that pulls in a separate file as a submodule, where +// that separate file has many multi-byte characters, to try to +// encourage the compiler to trip on them. + +mod issue24687_mbcs_in_comments; + +pub use issue24687_mbcs_in_comments::D; + diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs new file mode 100644 index 00000000000..8dc243aed7e --- /dev/null +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::fmt; + +// This ia file with many multi-byte characters, to try to encourage +// the compiler to trip on them. The Drop implementation below will +// need to have its source location embedded into the debug info for +// the output file. + +// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα +// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ +// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ +// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ +// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε + +// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ +// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη +// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ +// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι +// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ + +pub struct D(pub X); + +impl Drop for D { + fn drop(&mut self) { + // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ + println!("Dropping D({:?})", self.0); + } +} diff --git a/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs b/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs new file mode 100644 index 00000000000..af93c9bff0f --- /dev/null +++ b/src/test/run-pass/issues/issue24687-embed-debuginfo/main.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue24687_lib.rs +// compile-flags:-g + +extern crate issue24687_lib as d; + +fn main() { + // Create a d, which has a destructor whose body will be codegen'ed + // into the generated code here, and thus the local debuginfo will + // need references into the original source locations from + // `importer` above. + let _d = d::D("Hi"); +} diff --git a/src/test/run-pass/issues/issue28498-must-work-ex1.rs b/src/test/run-pass/issues/issue28498-must-work-ex1.rs new file mode 100644 index 00000000000..54c53465acb --- /dev/null +++ b/src/test/run-pass/issues/issue28498-must-work-ex1.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #examples-of-code-that-must-continue-to-work + +use std::cell::Cell; + +struct Concrete<'a>(u32, Cell>>); + +fn main() { + let mut data = Vec::new(); + data.push(Concrete(0, Cell::new(None))); + data.push(Concrete(0, Cell::new(None))); + + data[0].1.set(Some(&data[1])); + data[1].1.set(Some(&data[0])); +} diff --git a/src/test/run-pass/issues/issue28498-must-work-ex2.rs b/src/test/run-pass/issues/issue28498-must-work-ex2.rs new file mode 100644 index 00000000000..b8667710925 --- /dev/null +++ b/src/test/run-pass/issues/issue28498-must-work-ex2.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #examples-of-code-that-must-continue-to-work + +use std::cell::Cell; + +struct Concrete<'a>(u32, Cell>>); + +struct Foo { data: Vec } + +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])); + foo.data[1].1.set(Some(&foo.data[0])); +} + diff --git a/src/test/run-pass/issues/issue28498-ugeh-ex1.rs b/src/test/run-pass/issues/issue28498-ugeh-ex1.rs new file mode 100644 index 00000000000..50baa2975dd --- /dev/null +++ b/src/test/run-pass/issues/issue28498-ugeh-ex1.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Example taken from RFC 1238 text + +// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md +// #example-of-the-unguarded-escape-hatch + +#![feature(dropck_parametricity)] +use std::cell::Cell; + +struct Concrete<'a>(u32, Cell>>); + +struct Foo { data: Vec } + +impl Drop for Foo { + // Below is the UGEH attribute + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { } +} + +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])); + foo.data[1].1.set(Some(&foo.data[0])); +} + diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs b/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs new file mode 100644 index 00000000000..0fff6507833 --- /dev/null +++ b/src/test/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Demonstrate the use of the unguarded escape hatch with a lifetime param +// to assert that destructor will not access any dead data. +// +// Compare with compile-fail/issue28498-reject-lifetime-param.rs + +#![feature(dropck_parametricity)] + +#[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> { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { + // Use of `unsafe_destructor_blind_to_params` is sound, + // because destructor never accesses `self.1`. + println!("Dropping Foo({}, _)", self.0); + } +} + +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); + foo1 = Foo(1, &first_dropped); + + println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); +} diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs b/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs new file mode 100644 index 00000000000..28645801db2 --- /dev/null +++ b/src/test/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs @@ -0,0 +1,59 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Demonstrate the use of the unguarded escape hatch with a type param in negative position +// to assert that destructor will not access any dead data. +// +// Compare with compile-fail/issue28498-reject-lifetime-param.rs + +// 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 + +#![feature(dropck_parametricity)] + +#[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 { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { + // Use of `unsafe_destructor_blind_to_params` is sound, + // because destructor never passes a `self.1` to the callback + // (in `self.2`) despite having it available. + println!("Dropping Foo({}, _)", self.0); + } +} + +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)); + foo1 = Foo(1, &first_dropped, Box::new(callback)); + + println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); +} diff --git a/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs b/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs new file mode 100644 index 00000000000..7df3ceb7614 --- /dev/null +++ b/src/test/run-pass/issues/issue28498-ugeh-with-trait-bound.rs @@ -0,0 +1,54 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. + +// Demonstrate the use of the unguarded escape hatch with a trait bound +// to assert that destructor will not access any dead data. +// +// Compare with compile-fail/issue28498-reject-trait-bound.rs + +#![feature(dropck_parametricity)] + +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 { + #[unsafe_destructor_blind_to_params] + fn drop(&mut self) { + // Use of `unsafe_destructor_blind_to_params` is sound, + // because destructor never accesses the `Debug::fmt` method + // of `T`, despite having it available. + println!("Dropping Foo({}, _)", self.0); + } +} + +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); + foo1 = Foo(1, &first_dropped); + + println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); +} diff --git a/src/test/run-pass/issues/issue29927-1.rs b/src/test/run-pass/issues/issue29927-1.rs new file mode 100644 index 00000000000..c613560aff1 --- /dev/null +++ b/src/test/run-pass/issues/issue29927-1.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(min_const_fn)] +const fn f() -> usize { + 5 +} +struct A { + field: usize, +} +fn main() { + let _ = [0; f()]; +} diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/B.rs b/src/test/run-pass/issues/issue_26873_multifile/A/B.rs new file mode 100644 index 00000000000..cd4d9bc64ed --- /dev/null +++ b/src/test/run-pass/issues/issue_26873_multifile/A/B.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use super::*; + +pub struct S; + diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/C.rs b/src/test/run-pass/issues/issue_26873_multifile/A/C.rs new file mode 100644 index 00000000000..fb2567584c8 --- /dev/null +++ b/src/test/run-pass/issues/issue_26873_multifile/A/C.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use super::*; + +use super::B::S; + +pub struct T { i: i32 } + diff --git a/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs b/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs new file mode 100644 index 00000000000..c36c5b8c4c0 --- /dev/null +++ b/src/test/run-pass/issues/issue_26873_multifile/A/mod.rs @@ -0,0 +1,16 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub mod B; +pub mod C; + +pub use self::C::T; + diff --git a/src/test/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir b/src/test/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/issues/issue_26873_multifile/mod.rs b/src/test/run-pass/issues/issue_26873_multifile/mod.rs new file mode 100644 index 00000000000..95ed215d04f --- /dev/null +++ b/src/test/run-pass/issues/issue_26873_multifile/mod.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +mod A; + +use self::A::*; + diff --git a/src/test/run-pass/issues/issue_3136_b.rs b/src/test/run-pass/issues/issue_3136_b.rs new file mode 100644 index 00000000000..bf513c8391e --- /dev/null +++ b/src/test/run-pass/issues/issue_3136_b.rs @@ -0,0 +1,17 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_3136_a.rc + +// pretty-expanded FIXME #23616 + +extern crate issue_3136_a; +pub fn main() {} diff --git a/src/test/run-pass/issues/issue_9155.rs b/src/test/run-pass/issues/issue_9155.rs new file mode 100644 index 00000000000..cb73b6a201d --- /dev/null +++ b/src/test/run-pass/issues/issue_9155.rs @@ -0,0 +1,22 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:issue_9155.rs + +// pretty-expanded FIXME #23616 + +extern crate issue_9155; + +struct Baz; + +pub fn main() { + issue_9155::Foo::new(Baz); +} diff --git a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs new file mode 100644 index 00000000000..0043c1bc829 --- /dev/null +++ b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for type inference failure around shifting. In this +// case, the iteration yields an isize, but we hadn't run the full type +// propagation yet, and so we just saw a type variable, yielding an +// error. + +// pretty-expanded FIXME #23616 + +trait IntoIterator { + type Iter: Iterator; + + fn into_iter(self) -> Self::Iter; +} + +impl IntoIterator for I where I: Iterator { + type Iter = I; + + fn into_iter(self) -> I { + self + } +} + +fn desugared_for_loop_bad(byte: u8) -> u8 { + let mut result = 0; + let mut x = IntoIterator::into_iter(0..8); + let mut y = Iterator::next(&mut x); + let mut z = y.unwrap(); + byte >> z; + 1 +} + +fn main() {} diff --git a/src/test/run-pass/iterators/iter-cloned-type-inference.rs b/src/test/run-pass/iterators/iter-cloned-type-inference.rs new file mode 100644 index 00000000000..7e4bd4fb31b --- /dev/null +++ b/src/test/run-pass/iterators/iter-cloned-type-inference.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// Test to see that the element type of .cloned() can be inferred +// properly. Previously this would fail to deduce the type of `sum`. + +#![feature(iter_arith)] + +fn square_sum(v: &[i64]) -> i64 { + let sum: i64 = v.iter().cloned().sum(); + sum * sum +} + +fn main() { + assert_eq!(36, square_sum(&[1,2,3])); +} diff --git a/src/test/run-pass/iterators/iter-range.rs b/src/test/run-pass/iterators/iter-range.rs new file mode 100644 index 00000000000..017ffb3f9be --- /dev/null +++ b/src/test/run-pass/iterators/iter-range.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn range_(a: isize, b: isize, mut it: F) where F: FnMut(isize) { + assert!((a < b)); + let mut i: isize = a; + while i < b { it(i); i += 1; } +} + +pub fn main() { + let mut sum: isize = 0; + range_(0, 100, |x| sum += x ); + println!("{}", sum); +} diff --git a/src/test/run-pass/iterators/iter-step-overflow-debug.rs b/src/test/run-pass/iterators/iter-step-overflow-debug.rs new file mode 100644 index 00000000000..35f4d7b0c00 --- /dev/null +++ b/src/test/run-pass/iterators/iter-step-overflow-debug.rs @@ -0,0 +1,31 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default +// compile-flags: -C debug_assertions=yes + +use std::panic; + +fn main() { + let r = panic::catch_unwind(|| { + let mut it = u8::max_value()..; + it.next().unwrap(); // 255 + it.next().unwrap(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + let mut it = i8::max_value()..; + it.next().unwrap(); // 127 + it.next().unwrap(); + }); + assert!(r.is_err()); +} diff --git a/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs b/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs new file mode 100644 index 00000000000..9f12d08254d --- /dev/null +++ b/src/test/run-pass/iterators/iter-step-overflow-ndebug.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -C debug_assertions=no + +fn main() { + let mut it = u8::max_value()..; + assert_eq!(it.next().unwrap(), 255); + assert_eq!(it.next().unwrap(), u8::min_value()); + + let mut it = i8::max_value()..; + assert_eq!(it.next().unwrap(), 127); + assert_eq!(it.next().unwrap(), i8::min_value()); +} diff --git a/src/test/run-pass/iterators/iter-sum-overflow-debug.rs b/src/test/run-pass/iterators/iter-sum-overflow-debug.rs new file mode 100644 index 00000000000..acd70657f44 --- /dev/null +++ b/src/test/run-pass/iterators/iter-sum-overflow-debug.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default +// compile-flags: -C debug_assertions=yes + +use std::panic; + +fn main() { + let r = panic::catch_unwind(|| { + [1, i32::max_value()].iter().sum::(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + [2, i32::max_value()].iter().product::(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + [1, i32::max_value()].iter().cloned().sum::(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + [2, i32::max_value()].iter().cloned().product::(); + }); + assert!(r.is_err()); +} diff --git a/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs b/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs new file mode 100644 index 00000000000..1cd8026e456 --- /dev/null +++ b/src/test/run-pass/iterators/iter-sum-overflow-ndebug.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -C debug_assertions=no + +fn main() { + assert_eq!([1i32, i32::max_value()].iter().sum::(), + 1i32.wrapping_add(i32::max_value())); + assert_eq!([2i32, i32::max_value()].iter().product::(), + 2i32.wrapping_mul(i32::max_value())); + + assert_eq!([1i32, i32::max_value()].iter().cloned().sum::(), + 1i32.wrapping_add(i32::max_value())); + assert_eq!([2i32, i32::max_value()].iter().cloned().product::(), + 2i32.wrapping_mul(i32::max_value())); +} diff --git a/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs b/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs new file mode 100644 index 00000000000..a4a237c57a5 --- /dev/null +++ b/src/test/run-pass/iterators/iter-sum-overflow-overflow-checks.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default +// compile-flags: -C overflow-checks + +use std::panic; + +fn main() { + let r = panic::catch_unwind(|| { + [1, i32::max_value()].iter().sum::(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + [2, i32::max_value()].iter().product::(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + [1, i32::max_value()].iter().cloned().sum::(); + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + [2, i32::max_value()].iter().cloned().product::(); + }); + assert!(r.is_err()); +} diff --git a/src/test/run-pass/iterators/iter-zip.rs b/src/test/run-pass/iterators/iter-zip.rs new file mode 100644 index 00000000000..f2402fe185a --- /dev/null +++ b/src/test/run-pass/iterators/iter-zip.rs @@ -0,0 +1,113 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that .zip() specialization preserves side effects +// in sideeffectful iterator adaptors. + +use std::cell::Cell; + +#[derive(Debug)] +struct CountClone(Cell); + +fn count_clone() -> CountClone { CountClone(Cell::new(0)) } + +impl PartialEq for CountClone { + fn eq(&self, rhs: &i32) -> bool { + self.0.get() == *rhs + } +} + +impl Clone for CountClone { + fn clone(&self) -> Self { + let ret = CountClone(self.0.clone()); + let n = self.0.get(); + self.0.set(n + 1); + ret + } +} + +fn test_zip_cloned_sideffectful() { + let xs = [count_clone(), count_clone(), count_clone(), count_clone()]; + let ys = [count_clone(), count_clone()]; + + for _ in xs.iter().cloned().zip(ys.iter().cloned()) { } + + assert_eq!(&xs, &[1, 1, 1, 0][..]); + assert_eq!(&ys, &[1, 1][..]); + + let xs = [count_clone(), count_clone()]; + let ys = [count_clone(), count_clone(), count_clone(), count_clone()]; + + for _ in xs.iter().cloned().zip(ys.iter().cloned()) { } + + assert_eq!(&xs, &[1, 1][..]); + assert_eq!(&ys, &[1, 1, 0, 0][..]); +} + +fn test_zip_map_sideffectful() { + let mut xs = [0; 6]; + let mut ys = [0; 4]; + + for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) { } + + assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]); + assert_eq!(&ys, &[1, 1, 1, 1]); + + let mut xs = [0; 4]; + let mut ys = [0; 6]; + + for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) { } + + assert_eq!(&xs, &[1, 1, 1, 1]); + assert_eq!(&ys, &[1, 1, 1, 1, 0, 0]); +} + +fn test_zip_map_rev_sideffectful() { + let mut xs = [0; 6]; + let mut ys = [0; 4]; + + { + let mut it = xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)); + it.next_back(); + } + assert_eq!(&xs, &[0, 0, 0, 1, 1, 1]); + assert_eq!(&ys, &[0, 0, 0, 1]); + + let mut xs = [0; 6]; + let mut ys = [0; 4]; + + { + let mut it = xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)); + (&mut it).take(5).count(); + it.next_back(); + } + assert_eq!(&xs, &[1, 1, 1, 1, 1, 1]); + assert_eq!(&ys, &[1, 1, 1, 1]); +} + +fn test_zip_nested_sideffectful() { + let mut xs = [0; 6]; + let ys = [0; 4]; + + { + // test that it has the side effect nested inside enumerate + let it = xs.iter_mut().map(|x| *x = 1).enumerate().zip(&ys); + it.count(); + } + assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]); +} + +fn main() { + test_zip_cloned_sideffectful(); + test_zip_map_sideffectful(); + test_zip_map_rev_sideffectful(); + test_zip_nested_sideffectful(); +} diff --git a/src/test/run-pass/macros/assert-eq-macro-success.rs b/src/test/run-pass/macros/assert-eq-macro-success.rs new file mode 100644 index 00000000000..a96147db4e1 --- /dev/null +++ b/src/test/run-pass/macros/assert-eq-macro-success.rs @@ -0,0 +1,23 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Point { x : isize } + +pub fn main() { + assert_eq!(14,14); + assert_eq!("abc".to_string(),"abc".to_string()); + assert_eq!(Box::new(Point{x:34}),Box::new(Point{x:34})); + assert_eq!(&Point{x:34},&Point{x:34}); + assert_eq!(42, 42, "foo bar"); + assert_eq!(42, 42, "a {} c", "b"); + assert_eq!(42, 42, "{x}, {y}, {z}", x = 1, y = 2, z = 3); +} diff --git a/src/test/run-pass/macros/assert-eq-macro-unsized.rs b/src/test/run-pass/macros/assert-eq-macro-unsized.rs new file mode 100644 index 00000000000..b9e93b175a4 --- /dev/null +++ b/src/test/run-pass/macros/assert-eq-macro-unsized.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + assert_eq!([1, 2, 3][..], vec![1, 2, 3][..]); +} diff --git a/src/test/run-pass/macros/assert-ne-macro-success.rs b/src/test/run-pass/macros/assert-ne-macro-success.rs new file mode 100644 index 00000000000..e554607233f --- /dev/null +++ b/src/test/run-pass/macros/assert-ne-macro-success.rs @@ -0,0 +1,23 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Point { x : isize } + +pub fn main() { + assert_ne!(666,14); + assert_ne!("666".to_string(),"abc".to_string()); + assert_ne!(Box::new(Point{x:666}),Box::new(Point{x:34})); + assert_ne!(&Point{x:666},&Point{x:34}); + assert_ne!(666, 42, "no gods no masters"); + assert_ne!(666, 42, "6 {} 6", "6"); + assert_ne!(666, 42, "{x}, {y}, {z}", x = 6, y = 6, z = 6); +} diff --git a/src/test/run-pass/macros/assert-ne-macro-unsized.rs b/src/test/run-pass/macros/assert-ne-macro-unsized.rs new file mode 100644 index 00000000000..8833eb34918 --- /dev/null +++ b/src/test/run-pass/macros/assert-ne-macro-unsized.rs @@ -0,0 +1,14 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + assert_ne!([6, 6, 6][..], vec![1, 2, 3][..]); +} diff --git a/src/test/run-pass/macros/auxiliary/macro-comma-support.rs b/src/test/run-pass/macros/auxiliary/macro-comma-support.rs new file mode 100644 index 00000000000..6eafd520a72 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro-comma-support.rs @@ -0,0 +1,11 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +() diff --git a/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs b/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs new file mode 100644 index 00000000000..aea3c749930 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro-include-items-expr.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-test: this is not a test + +1 diff --git a/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs b/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs new file mode 100644 index 00000000000..da72aaef805 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro-include-items-item.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// ignore-test: this is not a test + +fn foo() { bar() } diff --git a/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs b/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs new file mode 100644 index 00000000000..4f55ac4f65f --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro_crate_def_only.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_export] +macro_rules! make_a_5 { + () => (5) +} diff --git a/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs b/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs new file mode 100644 index 00000000000..4f75e2b5d75 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro_crate_nonterminal.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn increment(x: usize) -> usize { + x + 1 +} + +#[macro_export] +macro_rules! increment { + ($x:expr) => ($crate::increment($x)) +} + +pub fn check_local() { + assert_eq!(increment!(3), 4); +} diff --git a/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs b/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs new file mode 100644 index 00000000000..84e944f69b9 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro_export_inner_module.rs @@ -0,0 +1,16 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner { + #[macro_export] + macro_rules! foo { + () => (1) + } +} diff --git a/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs b/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs new file mode 100644 index 00000000000..fd2e52bb355 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/macro_with_super_1.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +#[macro_export] +macro_rules! declare { + () => ( + pub fn aaa() {} + + pub mod bbb { + use super::aaa; + + pub fn ccc() { + aaa(); + } + } + ) +} diff --git a/src/test/run-pass/macros/auxiliary/two_macros.rs b/src/test/run-pass/macros/auxiliary/two_macros.rs new file mode 100644 index 00000000000..0da6ba13696 --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/two_macros.rs @@ -0,0 +1,15 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[macro_export] +macro_rules! macro_one { ($($t:tt)*) => ($($t)*) } + +#[macro_export] +macro_rules! macro_two { ($($t:tt)*) => ($($t)*) } diff --git a/src/test/run-pass/macros/auxiliary/unstable-macros.rs b/src/test/run-pass/macros/auxiliary/unstable-macros.rs new file mode 100644 index 00000000000..836164a721a --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/unstable-macros.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(staged_api)] +#![stable(feature = "unit_test", since = "1.0.0")] + +#[unstable(feature = "unstable_macros", issue = "0")] +#[macro_export] +macro_rules! unstable_macro{ () => () } diff --git a/src/test/run-pass/macros/auxiliary/use-macro-self.rs b/src/test/run-pass/macros/auxiliary/use-macro-self.rs new file mode 100644 index 00000000000..cdc519a5fdb --- /dev/null +++ b/src/test/run-pass/macros/auxiliary/use-macro-self.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod foobarius {} + +#[macro_export] +macro_rules! foobarius { + () => { () } +} diff --git a/src/test/run-pass/macros/colorful-write-macros.rs b/src/test/run-pass/macros/colorful-write-macros.rs new file mode 100644 index 00000000000..37eaf2e8cde --- /dev/null +++ b/src/test/run-pass/macros/colorful-write-macros.rs @@ -0,0 +1,43 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::io::Write; +use std::fmt; + +struct Foo<'a> { + writer: &'a mut (Write+'a), + other: &'a str, +} + +struct Bar; + +impl fmt::Write for Bar { + fn write_str(&mut self, _: &str) -> fmt::Result { + Ok(()) + } +} + +fn borrowing_writer_from_struct_and_formatting_struct_field(foo: Foo) { + write!(foo.writer, "{}", foo.other); +} + +fn main() { + let mut w = Vec::new(); + write!(&mut w as &mut Write, ""); + write!(&mut w, ""); // should coerce + println!("ok"); + + let mut s = Bar; + { + use std::fmt::Write; + write!(&mut s, "test"); + } +} diff --git a/src/test/run-pass/macros/conditional-debug-macro-on.rs b/src/test/run-pass/macros/conditional-debug-macro-on.rs new file mode 100644 index 00000000000..14e911f61fc --- /dev/null +++ b/src/test/run-pass/macros/conditional-debug-macro-on.rs @@ -0,0 +1,18 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + // exits early if println! evaluates its arguments, otherwise it + // will hit the panic. + println!("{:?}", { if true { return; } }); + + panic!(); +} diff --git a/src/test/run-pass/macros/die-macro.rs b/src/test/run-pass/macros/die-macro.rs new file mode 100644 index 00000000000..65ba591404b --- /dev/null +++ b/src/test/run-pass/macros/die-macro.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Just testing that panic!() type checks in statement or expr + + +#![allow(unreachable_code)] + +fn f() { + panic!(); + + let _x: isize = panic!(); +} + +pub fn main() { + +} diff --git a/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs new file mode 100644 index 00000000000..8356eb3ecd6 --- /dev/null +++ b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(trace_macros, log_syntax)] + +// make sure these macros can be used as in the various places that +// macros can occur. + +// items +trace_macros!(false); +log_syntax!(); + +fn main() { + + // statements + trace_macros!(false); + log_syntax!(); + + // expressions + (trace_macros!(false), + log_syntax!()); +} diff --git a/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout new file mode 100644 index 00000000000..b28b04f6431 --- /dev/null +++ b/src/test/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout @@ -0,0 +1,3 @@ + + + diff --git a/src/test/run-pass/macros/macro-2.rs b/src/test/run-pass/macros/macro-2.rs new file mode 100644 index 00000000000..cfce7f9c8c1 --- /dev/null +++ b/src/test/run-pass/macros/macro-2.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + + macro_rules! mylambda_tt { + ($x:ident, $body:expr) => ({ + fn f($x: isize) -> isize { return $body; }; + f + }) + } + + assert_eq!(mylambda_tt!(y, y * 2)(8), 16); +} diff --git a/src/test/run-pass/macros/macro-at-most-once-rep.rs b/src/test/run-pass/macros/macro-at-most-once-rep.rs new file mode 100644 index 00000000000..3625e0e7efa --- /dev/null +++ b/src/test/run-pass/macros/macro-at-most-once-rep.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// The logic for parsing Kleene operators in macros has a special case to disambiguate `?`. +// Specifically, `$(pat)?` is the ZeroOrOne operator whereas `$(pat)?+` or `$(pat)?*` are the +// ZeroOrMore and OneOrMore operators using `?` as a separator. These tests are intended to +// exercise that logic in the macro parser. +// +// Moreover, we also throw in some tests for using a separator with `?`, which is meaningless but +// included for consistency with `+` and `*`. +// +// This test focuses on non-error cases and making sure the correct number of repetitions happen. + +// edition:2018 + +#![feature(macro_at_most_once_rep)] + +macro_rules! foo { + ($($a:ident)? ; $num:expr) => { { + let mut x = 0; + + $( + x += $a; + )? + + assert_eq!(x, $num); + } } +} + +pub fn main() { + let a = 1; + + // accept 0 or 1 repetitions + foo!( ; 0); + foo!(a ; 1); +} diff --git a/src/test/run-pass/macros/macro-attribute-expansion.rs b/src/test/run-pass/macros/macro-attribute-expansion.rs new file mode 100644 index 00000000000..2f4e62e0faa --- /dev/null +++ b/src/test/run-pass/macros/macro-attribute-expansion.rs @@ -0,0 +1,26 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! descriptions { + ($name:ident is $desc:expr) => { + // Check that we will correctly expand attributes + #[doc = $desc] + #[allow(dead_code)] + const $name : &'static str = $desc; + } +} + +// item +descriptions! { DOG is "an animal" } +descriptions! { RUST is "a language" } + +pub fn main() { +} diff --git a/src/test/run-pass/macros/macro-attributes.rs b/src/test/run-pass/macros/macro-attributes.rs new file mode 100644 index 00000000000..70190d495a5 --- /dev/null +++ b/src/test/run-pass/macros/macro-attributes.rs @@ -0,0 +1,34 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(custom_attribute)] + +macro_rules! compiles_fine { + (#[$at:meta]) => { + // test that the different types of attributes work + #[attribute] + /// Documentation! + #[$at] + + // check that the attributes are recognised by requiring this + // to be removed to avoid a compile error + #[cfg(always_remove)] + static MISTYPED: () = "foo"; + } +} + +// item +compiles_fine!(#[foo]); + +pub fn main() { + // statement + compiles_fine!(#[bar]); +} diff --git a/src/test/run-pass/macros/macro-block-nonterminal.rs b/src/test/run-pass/macros/macro-block-nonterminal.rs new file mode 100644 index 00000000000..02ad360880f --- /dev/null +++ b/src/test/run-pass/macros/macro-block-nonterminal.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! do_block{ + ($val:block) => {$val} +} + +fn main() { + let s; + do_block!({ s = "it works!"; }); + assert_eq!(s, "it works!"); +} diff --git a/src/test/run-pass/macros/macro-comma-behavior.rs b/src/test/run-pass/macros/macro-comma-behavior.rs new file mode 100644 index 00000000000..bfa32817b10 --- /dev/null +++ b/src/test/run-pass/macros/macro-comma-behavior.rs @@ -0,0 +1,99 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ideally, any macro call with a trailing comma should behave +// identically to a call without the comma. +// +// This checks the behavior of macros with trailing commas in key +// places where regressions in behavior seem highly possible (due +// to it being e.g. a place where the addition of an argument +// causes it to go down a code path with subtly different behavior). +// +// There is a companion test in compile-fail. + +// compile-flags: --test -C debug_assertions=yes +// revisions: std core + +#![cfg_attr(core, no_std)] + +#[cfg(std)] use std::fmt; +#[cfg(core)] use core::fmt; + +// an easy mistake in the implementation of 'assert!' +// would cause this to say "explicit panic" +#[test] +#[should_panic(expected = "assertion failed")] +fn assert_1arg() { + assert!(false,); +} + +// same as 'assert_1arg' +#[test] +#[should_panic(expected = "assertion failed")] +fn debug_assert_1arg() { + debug_assert!(false,); +} + +// make sure we don't accidentally forward to `write!("text")` +#[cfg(std)] +#[test] +fn writeln_1arg() { + use fmt::Write; + + let mut s = String::new(); + writeln!(&mut s,).unwrap(); + assert_eq!(&s, "\n"); +} + +// A number of format_args-like macros have special-case treatment +// for a single message string, which is not formatted. +// +// This test ensures that the addition of a trailing comma does not +// suddenly cause these strings to get formatted when they otherwise +// would not be. This is an easy mistake to make by having such a macro +// accept ", $($tok:tt)*" instead of ", $($tok:tt)+" after its minimal +// set of arguments. +// +// (Example: Issue #48042) +#[test] +fn to_format_or_not_to_format() { + // ("{}" is the easiest string to test because if this gets + // sent to format_args!, it'll simply fail to compile. + // "{{}}" is an example of an input that could compile and + // produce an incorrect program, but testing the panics + // would be burdensome.) + let falsum = || false; + + assert!(true, "{}",); + + // assert_eq!(1, 1, "{}",); // see compile-fail + // assert_ne!(1, 2, "{}",); // see compile-fail + + debug_assert!(true, "{}",); + + // debug_assert_eq!(1, 1, "{}",); // see compile-fail + // debug_assert_ne!(1, 2, "{}",); // see compile-fail + // eprint!("{}",); // see compile-fail + // eprintln!("{}",); // see compile-fail + // format!("{}",); // see compile-fail + // format_args!("{}",); // see compile-fail + + if falsum() { panic!("{}",); } + + // print!("{}",); // see compile-fail + // println!("{}",); // see compile-fail + // unimplemented!("{}",); // see compile-fail + + if falsum() { unreachable!("{}",); } + + // write!(&mut stdout, "{}",); // see compile-fail + // writeln!(&mut stdout, "{}",); // see compile-fail +} diff --git a/src/test/run-pass/macros/macro-comma-support.rs b/src/test/run-pass/macros/macro-comma-support.rs new file mode 100644 index 00000000000..f674123aac7 --- /dev/null +++ b/src/test/run-pass/macros/macro-comma-support.rs @@ -0,0 +1,360 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is meant to be a comprehensive test of invocations with/without +// trailing commas (or other, similar optionally-trailing separators). +// Every macro is accounted for, even those not tested in this file. +// (There will be a note indicating why). + +// std and core are both tested because they may contain separate +// implementations for some macro_rules! macros as an implementation +// detail. + +// ignore-pretty issue #37195 + +// compile-flags: --test -C debug_assertions=yes +// revisions: std core + +#![cfg_attr(core, no_std)] + +#![feature(concat_idents)] + +#[cfg(std)] use std::fmt; +#[cfg(core)] use core::fmt; + +#[test] +fn assert() { + assert!(true); + assert!(true,); + assert!(true, "hello"); + assert!(true, "hello",); + assert!(true, "hello {}", "world"); + assert!(true, "hello {}", "world",); +} + +#[test] +fn assert_eq() { + assert_eq!(1, 1); + assert_eq!(1, 1,); + assert_eq!(1, 1, "hello"); + assert_eq!(1, 1, "hello",); + assert_eq!(1, 1, "hello {}", "world"); + assert_eq!(1, 1, "hello {}", "world",); +} + +#[test] +fn assert_ne() { + assert_ne!(1, 2); + assert_ne!(1, 2,); + assert_ne!(1, 2, "hello"); + assert_ne!(1, 2, "hello",); + assert_ne!(1, 2, "hello {}", "world"); + assert_ne!(1, 2, "hello {}", "world",); +} + +#[test] +fn cfg() { + let _ = cfg!(pants); + let _ = cfg!(pants,); + let _ = cfg!(pants = "pants"); + let _ = cfg!(pants = "pants",); + let _ = cfg!(all(pants)); + let _ = cfg!(all(pants),); + let _ = cfg!(all(pants,)); + let _ = cfg!(all(pants,),); +} + +#[test] +fn column() { + let _ = column!(); +} + +// compile_error! is in a companion to this test in compile-fail + +#[test] +fn concat() { + let _ = concat!(); + let _ = concat!("hello"); + let _ = concat!("hello",); + let _ = concat!("hello", " world"); + let _ = concat!("hello", " world",); +} + +#[test] +fn concat_idents() { + fn foo() {} + fn foobar() {} + + concat_idents!(foo)(); + concat_idents!(foo,)(); + concat_idents!(foo, bar)(); + concat_idents!(foo, bar,)(); +} + +#[test] +fn debug_assert() { + debug_assert!(true); + debug_assert!(true, ); + debug_assert!(true, "hello"); + debug_assert!(true, "hello",); + debug_assert!(true, "hello {}", "world"); + debug_assert!(true, "hello {}", "world",); +} + +#[test] +fn debug_assert_eq() { + debug_assert_eq!(1, 1); + debug_assert_eq!(1, 1,); + debug_assert_eq!(1, 1, "hello"); + debug_assert_eq!(1, 1, "hello",); + debug_assert_eq!(1, 1, "hello {}", "world"); + debug_assert_eq!(1, 1, "hello {}", "world",); +} + +#[test] +fn debug_assert_ne() { + debug_assert_ne!(1, 2); + debug_assert_ne!(1, 2,); + debug_assert_ne!(1, 2, "hello"); + debug_assert_ne!(1, 2, "hello",); + debug_assert_ne!(1, 2, "hello {}", "world"); + debug_assert_ne!(1, 2, "hello {}", "world",); +} + +#[test] +fn env() { + let _ = env!("PATH"); + let _ = env!("PATH",); + let _ = env!("PATH", "not found"); + let _ = env!("PATH", "not found",); +} + +#[cfg(std)] +#[test] +fn eprint() { + eprint!("hello"); + eprint!("hello",); + eprint!("hello {}", "world"); + eprint!("hello {}", "world",); +} + +#[cfg(std)] +#[test] +fn eprintln() { + eprintln!(); + eprintln!("hello"); + eprintln!("hello",); + eprintln!("hello {}", "world"); + eprintln!("hello {}", "world",); +} + +#[test] +fn file() { + let _ = file!(); +} + +#[cfg(std)] +#[test] +fn format() { + let _ = format!("hello"); + let _ = format!("hello",); + let _ = format!("hello {}", "world"); + let _ = format!("hello {}", "world",); +} + +#[test] +fn format_args() { + let _ = format_args!("hello"); + let _ = format_args!("hello",); + let _ = format_args!("hello {}", "world"); + let _ = format_args!("hello {}", "world",); +} + +#[test] +fn include() { + let _ = include!("auxiliary/macro-comma-support.rs"); + let _ = include!("auxiliary/macro-comma-support.rs",); +} + +#[test] +fn include_bytes() { + let _ = include_bytes!("auxiliary/macro-comma-support.rs"); + let _ = include_bytes!("auxiliary/macro-comma-support.rs",); +} + +#[test] +fn include_str() { + let _ = include_str!("auxiliary/macro-comma-support.rs"); + let _ = include_str!("auxiliary/macro-comma-support.rs",); +} + +#[test] +fn line() { + let _ = line!(); +} + +#[test] +fn module_path() { + let _ = module_path!(); +} + +#[test] +fn option_env() { + let _ = option_env!("PATH"); + let _ = option_env!("PATH",); +} + +#[test] +fn panic() { + // prevent 'unreachable code' warnings + let falsum = || false; + + if falsum() { panic!(); } + if falsum() { panic!("hello"); } + if falsum() { panic!("hello",); } + if falsum() { panic!("hello {}", "world"); } + if falsum() { panic!("hello {}", "world",); } +} + +#[cfg(std)] +#[test] +fn print() { + print!("hello"); + print!("hello",); + print!("hello {}", "world"); + print!("hello {}", "world",); +} + +#[cfg(std)] +#[test] +fn println() { + println!(); + println!("hello"); + println!("hello",); + println!("hello {}", "world"); + println!("hello {}", "world",); +} + +// select! is too troublesome and unlikely to be stabilized + +// stringify! is N/A + +#[cfg(std)] +#[test] +fn thread_local() { + // this has an optional trailing *semicolon* + thread_local! { + #[allow(unused)] pub static A: () = () + } + + thread_local! { + #[allow(unused)] pub static AA: () = (); + } + + thread_local! { + #[allow(unused)] pub static AAA: () = (); + #[allow(unused)] pub static AAAA: () = () + } + + thread_local! { + #[allow(unused)] pub static AAAAG: () = (); + #[allow(unused)] pub static AAAAGH: () = (); + } +} + +#[test] +fn try() { + fn inner() -> Result<(), ()> { + try!(Ok(())); + try!(Ok(()),); + Ok(()) + } + + inner().unwrap(); +} + +#[test] +fn unimplemented() { + // prevent 'unreachable code' warnings + let falsum = || false; + + if falsum() { unimplemented!(); } + if falsum() { unimplemented!("hello"); } + if falsum() { unimplemented!("hello",); } + if falsum() { unimplemented!("hello {}", "world"); } + if falsum() { unimplemented!("hello {}", "world",); } +} + +#[test] +fn unreachable() { + // prevent 'unreachable code' warnings + let falsum = || false; + + if falsum() { unreachable!(); } + if falsum() { unreachable!("hello"); } + if falsum() { unreachable!("hello",); } + if falsum() { unreachable!("hello {}", "world"); } + if falsum() { unreachable!("hello {}", "world",); } +} + +#[cfg(std)] +#[test] +fn vec() { + let _: Vec<()> = vec![]; + let _ = vec![0]; + let _ = vec![0,]; + let _ = vec![0, 1]; + let _ = vec![0, 1,]; +} + +// give a test body access to a fmt::Formatter, which seems +// to be the easiest way to use 'write!' on core. +macro_rules! test_with_formatter { + ( + #[test] + fn $fname:ident($f:ident: &mut fmt::Formatter) $block:block + ) => { + #[test] + fn $fname() { + struct Struct; + impl fmt::Display for Struct { + fn fmt(&self, $f: &mut fmt::Formatter) -> fmt::Result { + Ok($block) + } + } + + // suppress "unused" + assert!(true, "{}", Struct); + } + }; +} + +test_with_formatter! { + #[test] + fn write(f: &mut fmt::Formatter) { + let _ = write!(f, "hello"); + let _ = write!(f, "hello",); + let _ = write!(f, "hello {}", "world"); + let _ = write!(f, "hello {}", "world",); + } +} + +test_with_formatter! { + #[test] + fn writeln(f: &mut fmt::Formatter) { + let _ = writeln!(f); + let _ = writeln!(f,); + let _ = writeln!(f, "hello"); + let _ = writeln!(f, "hello",); + let _ = writeln!(f, "hello {}", "world"); + let _ = writeln!(f, "hello {}", "world",); + } +} diff --git a/src/test/run-pass/macros/macro-crate-def-only.rs b/src/test/run-pass/macros/macro-crate-def-only.rs new file mode 100644 index 00000000000..3a48d0489ce --- /dev/null +++ b/src/test/run-pass/macros/macro-crate-def-only.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:macro_crate_def_only.rs + + +#[macro_use] #[no_link] +extern crate macro_crate_def_only; + +pub fn main() { + assert_eq!(5, make_a_5!()); +} diff --git a/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs b/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs new file mode 100644 index 00000000000..c2a9729ec1c --- /dev/null +++ b/src/test/run-pass/macros/macro-crate-nonterminal-renamed.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:macro_crate_nonterminal.rs + +#[macro_use] +extern crate macro_crate_nonterminal as new_name; + +pub fn main() { + new_name::check_local(); + assert_eq!(increment!(5), 6); +} diff --git a/src/test/run-pass/macros/macro-crate-nonterminal.rs b/src/test/run-pass/macros/macro-crate-nonterminal.rs new file mode 100644 index 00000000000..114d8961817 --- /dev/null +++ b/src/test/run-pass/macros/macro-crate-nonterminal.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:macro_crate_nonterminal.rs + +#[macro_use] +extern crate macro_crate_nonterminal; + +pub fn main() { + macro_crate_nonterminal::check_local(); + assert_eq!(increment!(5), 6); +} diff --git a/src/test/run-pass/macros/macro-crate-use.rs b/src/test/run-pass/macros/macro-crate-use.rs new file mode 100644 index 00000000000..b74d5ec91b5 --- /dev/null +++ b/src/test/run-pass/macros/macro-crate-use.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn increment(x: usize) -> usize { + x + 1 +} + +#[macro_export] +macro_rules! increment { + ($x:expr) => ({ + use $crate::increment; + increment($x) + }) +} + +fn main() { + assert_eq!(increment!(3), 4); +} diff --git a/src/test/run-pass/macros/macro-deep_expansion.rs b/src/test/run-pass/macros/macro-deep_expansion.rs new file mode 100644 index 00000000000..d6def354673 --- /dev/null +++ b/src/test/run-pass/macros/macro-deep_expansion.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! foo2 { + () => { + "foo" + } +} + +macro_rules! foo { + () => { + foo2!() + } +} + +fn main() { + assert_eq!(concat!(foo!(), "bar"), "foobar") +} diff --git a/src/test/run-pass/macros/macro-delimiter-significance.rs b/src/test/run-pass/macros/macro-delimiter-significance.rs new file mode 100644 index 00000000000..0b6b183e6e8 --- /dev/null +++ b/src/test/run-pass/macros/macro-delimiter-significance.rs @@ -0,0 +1,14 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + vec![1_usize, 2, 3].len(); +} diff --git a/src/test/run-pass/macros/macro-doc-comments.rs b/src/test/run-pass/macros/macro-doc-comments.rs new file mode 100644 index 00000000000..2115022f17f --- /dev/null +++ b/src/test/run-pass/macros/macro-doc-comments.rs @@ -0,0 +1,36 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +macro_rules! doc { + ( + $(#[$outer:meta])* + mod $i:ident { + $(#![$inner:meta])* + } + ) => + ( + $(#[$outer])* + pub mod $i { + $(#![$inner])* + } + ) +} + +doc! { + /// Outer doc + mod Foo { + //! Inner doc + } +} + +fn main() { } diff --git a/src/test/run-pass/macros/macro-doc-escapes.rs b/src/test/run-pass/macros/macro-doc-escapes.rs new file mode 100644 index 00000000000..5253d960c8d --- /dev/null +++ b/src/test/run-pass/macros/macro-doc-escapes.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// When expanding a macro, documentation attributes (including documentation comments) must be +// passed "as is" without being parsed. Otherwise, some text will be incorrectly interpreted as +// escape sequences, leading to an ICE. +// +// Related issues: #25929, #25943 + +macro_rules! homura { + (#[$x:meta]) => () +} + +homura! { + /// \madoka \x41 +} + +fn main() { } diff --git a/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs b/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs new file mode 100644 index 00000000000..b12e00eccc9 --- /dev/null +++ b/src/test/run-pass/macros/macro-doc-raw-str-hashes.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// The number of `#`s used to wrap the documentation comment should differ regarding the content. +// +// Related issue: #27489 + +macro_rules! homura { + ($x:expr, #[$y:meta]) => (assert_eq!($x, stringify!($y))) +} + +fn main() { + homura! { + r#"doc = r" Madoka""#, + /// Madoka + }; + + homura! { + r##"doc = r#" One quote mark: ["]"#"##, + /// One quote mark: ["] + }; + + homura! { + r##"doc = r#" Two quote marks: [""]"#"##, + /// Two quote marks: [""] + }; + + homura! { + r#####"doc = r####" Raw string ending sequences: ["###]"####"#####, + /// Raw string ending sequences: ["###] + }; +} diff --git a/src/test/run-pass/macros/macro-export-inner-module.rs b/src/test/run-pass/macros/macro-export-inner-module.rs new file mode 100644 index 00000000000..e114790f71a --- /dev/null +++ b/src/test/run-pass/macros/macro-export-inner-module.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +//aux-build:macro_export_inner_module.rs + +#[macro_use] #[no_link] +extern crate macro_export_inner_module; + +pub fn main() { + assert_eq!(1, foo!()); +} diff --git a/src/test/run-pass/macros/macro-first-set.rs b/src/test/run-pass/macros/macro-first-set.rs new file mode 100644 index 00000000000..984a31d4d52 --- /dev/null +++ b/src/test/run-pass/macros/macro-first-set.rs @@ -0,0 +1,289 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![cfg_attr(stage0, feature(macro_vis_matcher))] + +//{{{ issue 40569 ============================================================== + +macro_rules! my_struct { + ($(#[$meta:meta])* $ident:ident) => { + $(#[$meta])* struct $ident; + } +} + +my_struct!(#[derive(Debug, PartialEq)] Foo40569); + +fn test_40569() { + assert_eq!(Foo40569, Foo40569); +} + +//}}} + +//{{{ issue 26444 ============================================================== + +macro_rules! foo_26444 { + ($($beginning:ident),*; $middle:ident; $($end:ident),*) => { + stringify!($($beginning,)* $middle $(,$end)*) + } +} + +fn test_26444() { + assert_eq!("a , b , c , d , e", foo_26444!(a, b; c; d, e)); + assert_eq!("f", foo_26444!(; f ;)); +} + +macro_rules! pat_26444 { + ($fname:ident $($arg:pat)* =) => {} +} + +pat_26444!(foo 1 2 5...7 =); +pat_26444!(bar Some(ref x) Ok(ref mut y) &(w, z) =); + +//}}} + +//{{{ issue 40984 ============================================================== + +macro_rules! thread_local_40984 { + () => {}; + ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => { + thread_local_40984!($($rest)*); + }; + ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => {}; +} + +thread_local_40984! { + // no docs + #[allow(unused)] + static FOO: i32 = 42; + /// docs + pub static BAR: String = String::from("bar"); + + // look at these restrictions!! + pub(crate) static BAZ: usize = 0; + pub(in foo) static QUUX: usize = 0; +} + +//}}} + +//{{{ issue 35650 ============================================================== + +macro_rules! size { + ($ty:ty) => { + std::mem::size_of::<$ty>() + }; + ($size:tt) => { + $size + }; +} + +fn test_35650() { + assert_eq!(size!(u64), 8); + assert_eq!(size!(5), 5); +} + +//}}} + +//{{{ issue 27832 ============================================================== + +macro_rules! m { + ( $i:ident ) => (); + ( $t:tt $j:tt ) => (); +} + +m!(c); +m!(t 9); +m!(0 9); +m!(struct); +m!(struct Foo); + +macro_rules! m2 { + ( $b:expr ) => (); + ( $t:tt $u:tt ) => (); +} + +m2!(3); +m2!(1 2); +m2!(_ 1); +m2!(enum Foo); + +//}}} + +//{{{ issue 39964 ============================================================== + +macro_rules! foo_39964 { + ($a:ident) => {}; + (_) => {}; +} + +foo_39964!(_); + +//}}} + +//{{{ issue 34030 ============================================================== + +macro_rules! foo_34030 { + ($($t:ident),* /) => {}; +} + +foo_34030!(a, b/); +foo_34030!(a/); +foo_34030!(/); + +//}}} + +//{{{ issue 24189 ============================================================== + +macro_rules! foo_24189 { + ( + pub enum $name:ident { + $( #[$attr:meta] )* $var:ident + } + ) => { + pub enum $name { + $( #[$attr] )* $var + } + }; +} + +foo_24189! { + pub enum Foo24189 { + #[doc = "Bar"] Baz + } +} + +macro_rules! serializable { + ( + $(#[$struct_meta:meta])* + pub struct $name:ident { + $( + $(#[$field_meta:meta])* + $field:ident: $type_:ty + ),* , + } + ) => { + $(#[$struct_meta])* + pub struct $name { + $( + $(#[$field_meta])* + $field: $type_ + ),* , + } + } +} + +serializable! { + #[allow(dead_code)] + /// This is a test + pub struct Tester { + #[allow(dead_code)] + name: String, + } +} + +macro_rules! foo_24189_c { + ( $( > )* $x:ident ) => { }; +} +foo_24189_c!( > a ); + +fn test_24189() { + let _ = Foo24189::Baz; + let _ = Tester { name: "".to_owned() }; +} + +//}}} + +//{{{ issue 50903 ============================================================== + +macro_rules! foo_50903 { + ($($lif:lifetime ,)* #) => {}; +} + +foo_50903!('a, 'b, #); +foo_50903!('a, #); +foo_50903!(#); + +//}}} + +//{{{ issue 51477 ============================================================== + +macro_rules! foo_51477 { + ($lifetime:lifetime) => { + "last token is lifetime" + }; + ($other:tt) => { + "last token is other" + }; + ($first:tt $($rest:tt)*) => { + foo_51477!($($rest)*) + }; +} + +fn test_51477() { + assert_eq!("last token is lifetime", foo_51477!('a)); + assert_eq!("last token is other", foo_51477!(@)); + assert_eq!("last token is lifetime", foo_51477!(@ {} 'a)); +} + +//}}} + +//{{{ some more tests ========================================================== + +macro_rules! test_block { + (< $($b:block)* >) => {} +} + +test_block!(<>); +test_block!(<{}>); +test_block!(<{1}{2}>); + +macro_rules! test_ty { + ($($t:ty),* $(,)*) => {} +} + +test_ty!(); +test_ty!(,); +test_ty!(u8); +test_ty!(u8,); + +macro_rules! test_path { + ($($t:path),* $(,)*) => {} +} + +test_path!(); +test_path!(,); +test_path!(::std); +test_path!(std::u8,); +test_path!(any, super, super::super::self::path, X::Z<'a, T=U>); + +macro_rules! test_meta_block { + ($($m:meta)* $b:block) => {}; +} + +test_meta_block!(windows {}); + +macro_rules! test_lifetime { + (1. $($l:lifetime)* $($b:block)*) => {}; + (2. $($b:block)* $($l:lifetime)*) => {}; +} + +test_lifetime!(1. 'a 'b {} {}); +test_lifetime!(2. {} {} 'a 'b); + +//}}} + +fn main() { + test_26444(); + test_40569(); + test_35650(); + test_24189(); + test_51477(); +} + diff --git a/src/test/run-pass/macros/macro-follow.rs b/src/test/run-pass/macros/macro-follow.rs new file mode 100644 index 00000000000..2cb2e43fd65 --- /dev/null +++ b/src/test/run-pass/macros/macro-follow.rs @@ -0,0 +1,193 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check the macro follow sets (see corresponding cfail test). + +// FOLLOW(pat) = {FatArrow, Comma, Eq, Or, Ident(if), Ident(in)} +macro_rules! follow_pat { + ($p:pat =>) => {}; + ($p:pat ,) => {}; + ($p:pat =) => {}; + ($p:pat |) => {}; + ($p:pat if) => {}; + ($p:pat in) => {}; +} +// FOLLOW(expr) = {FatArrow, Comma, Semicolon} +macro_rules! follow_expr { + ($e:expr =>) => {}; + ($e:expr ,) => {}; + ($e:expr ;) => {}; +} +// FOLLOW(ty) = {OpenDelim(Brace), Comma, FatArrow, Colon, Eq, Gt, Semi, Or, +// Ident(as), Ident(where), OpenDelim(Bracket), Nonterminal(Block)} +macro_rules! follow_ty { + ($t:ty {}) => {}; + ($t:ty ,) => {}; + ($t:ty =>) => {}; + ($t:ty :) => {}; + ($t:ty =) => {}; + ($t:ty >) => {}; + ($t:ty ;) => {}; + ($t:ty |) => {}; + ($t:ty as) => {}; + ($t:ty where) => {}; + ($t:ty []) => {}; + ($t:ty $b:block) => {}; +} +// FOLLOW(stmt) = FOLLOW(expr) +macro_rules! follow_stmt { + ($s:stmt =>) => {}; + ($s:stmt ,) => {}; + ($s:stmt ;) => {}; +} +// FOLLOW(path) = FOLLOW(ty) +macro_rules! follow_path { + ($p:path {}) => {}; + ($p:path ,) => {}; + ($p:path =>) => {}; + ($p:path :) => {}; + ($p:path =) => {}; + ($p:path >) => {}; + ($p:path ;) => {}; + ($p:path |) => {}; + ($p:path as) => {}; + ($p:path where) => {}; + ($p:path []) => {}; + ($p:path $b:block) => {}; +} +// FOLLOW(block) = any token +macro_rules! follow_block { + ($b:block ()) => {}; + ($b:block []) => {}; + ($b:block {}) => {}; + ($b:block ,) => {}; + ($b:block =>) => {}; + ($b:block :) => {}; + ($b:block =) => {}; + ($b:block >) => {}; + ($b:block ;) => {}; + ($b:block |) => {}; + ($b:block +) => {}; + ($b:block ident) => {}; + ($b:block $p:pat) => {}; + ($b:block $e:expr) => {}; + ($b:block $t:ty) => {}; + ($b:block $s:stmt) => {}; + ($b:block $p:path) => {}; + ($b:block $b:block) => {}; + ($b:block $i:ident) => {}; + ($b:block $t:tt) => {}; + ($b:block $i:item) => {}; + ($b:block $m:meta) => {}; +} +// FOLLOW(ident) = any token +macro_rules! follow_ident { + ($i:ident ()) => {}; + ($i:ident []) => {}; + ($i:ident {}) => {}; + ($i:ident ,) => {}; + ($i:ident =>) => {}; + ($i:ident :) => {}; + ($i:ident =) => {}; + ($i:ident >) => {}; + ($i:ident ;) => {}; + ($i:ident |) => {}; + ($i:ident +) => {}; + ($i:ident ident) => {}; + ($i:ident $p:pat) => {}; + ($i:ident $e:expr) => {}; + ($i:ident $t:ty) => {}; + ($i:ident $s:stmt) => {}; + ($i:ident $p:path) => {}; + ($i:ident $b:block) => {}; + ($i:ident $i:ident) => {}; + ($i:ident $t:tt) => {}; + ($i:ident $i:item) => {}; + ($i:ident $m:meta) => {}; +} +// FOLLOW(tt) = any token +macro_rules! follow_tt { + ($t:tt ()) => {}; + ($t:tt []) => {}; + ($t:tt {}) => {}; + ($t:tt ,) => {}; + ($t:tt =>) => {}; + ($t:tt :) => {}; + ($t:tt =) => {}; + ($t:tt >) => {}; + ($t:tt ;) => {}; + ($t:tt |) => {}; + ($t:tt +) => {}; + ($t:tt ident) => {}; + ($t:tt $p:pat) => {}; + ($t:tt $e:expr) => {}; + ($t:tt $t:ty) => {}; + ($t:tt $s:stmt) => {}; + ($t:tt $p:path) => {}; + ($t:tt $b:block) => {}; + ($t:tt $i:ident) => {}; + ($t:tt $t:tt) => {}; + ($t:tt $i:item) => {}; + ($t:tt $m:meta) => {}; +} +// FOLLOW(item) = any token +macro_rules! follow_item { + ($i:item ()) => {}; + ($i:item []) => {}; + ($i:item {}) => {}; + ($i:item ,) => {}; + ($i:item =>) => {}; + ($i:item :) => {}; + ($i:item =) => {}; + ($i:item >) => {}; + ($i:item ;) => {}; + ($i:item |) => {}; + ($i:item +) => {}; + ($i:item ident) => {}; + ($i:item $p:pat) => {}; + ($i:item $e:expr) => {}; + ($i:item $t:ty) => {}; + ($i:item $s:stmt) => {}; + ($i:item $p:path) => {}; + ($i:item $b:block) => {}; + ($i:item $i:ident) => {}; + ($i:item $t:tt) => {}; + ($i:item $i:item) => {}; + ($i:item $m:meta) => {}; +} +// FOLLOW(meta) = any token +macro_rules! follow_meta { + ($m:meta ()) => {}; + ($m:meta []) => {}; + ($m:meta {}) => {}; + ($m:meta ,) => {}; + ($m:meta =>) => {}; + ($m:meta :) => {}; + ($m:meta =) => {}; + ($m:meta >) => {}; + ($m:meta ;) => {}; + ($m:meta |) => {}; + ($m:meta +) => {}; + ($m:meta ident) => {}; + ($m:meta $p:pat) => {}; + ($m:meta $e:expr) => {}; + ($m:meta $t:ty) => {}; + ($m:meta $s:stmt) => {}; + ($m:meta $p:path) => {}; + ($m:meta $b:block) => {}; + ($m:meta $i:ident) => {}; + ($m:meta $t:tt) => {}; + ($m:meta $i:item) => {}; + ($m:meta $m:meta) => {}; +} + +fn main() {} + diff --git a/src/test/run-pass/macros/macro-followed-by-seq.rs b/src/test/run-pass/macros/macro-followed-by-seq.rs new file mode 100644 index 00000000000..8b796187664 --- /dev/null +++ b/src/test/run-pass/macros/macro-followed-by-seq.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #25436: check that things which can be +// followed by any token also permit X* to come afterwards. + +macro_rules! foo { + ( $a:tt $($b:tt)* ) => { }; + ( $a:ident $($b:tt)* ) => { }; + ( $a:item $($b:tt)* ) => { }; + ( $a:block $($b:tt)* ) => { }; + ( $a:meta $($b:tt)* ) => { } +} + +fn main() { } diff --git a/src/test/run-pass/macros/macro-include-items.rs b/src/test/run-pass/macros/macro-include-items.rs new file mode 100644 index 00000000000..d5d459bf28d --- /dev/null +++ b/src/test/run-pass/macros/macro-include-items.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// ignore-pretty issue #37195 + +fn bar() {} + +include!(concat!("", "", "auxiliary/", "macro-include-items-item.rs")); + +fn main() { + foo(); + assert_eq!(include!(concat!("", "auxiliary/", "macro-include-items-expr.rs")), 1_usize); +} diff --git a/src/test/run-pass/macros/macro-interpolation.rs b/src/test/run-pass/macros/macro-interpolation.rs new file mode 100644 index 00000000000..bc0c15bd403 --- /dev/null +++ b/src/test/run-pass/macros/macro-interpolation.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! overly_complicated { + ($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) => + ({ + fn $fnname($arg: $ty) -> Option<$ty> $body + match $fnname($val) { + Some($pat) => { + $res + } + _ => { panic!(); } + } + }) + +} + +pub fn main() { + assert!(overly_complicated!(f, x, Option, { return Some(x); }, + Some(8), Some(y), y) == 8) + +} diff --git a/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs b/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs new file mode 100644 index 00000000000..457b7232f0a --- /dev/null +++ b/src/test/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +macro_rules! four { + () => (4) +} + +fn main() { + let _x: [u16; four!()]; +} diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs b/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs new file mode 100644 index 00000000000..eadef980377 --- /dev/null +++ b/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + ($l:lifetime, $l2:lifetime) => { + fn f<$l: $l2, $l2>(arg: &$l str, arg2: &$l2 str) -> &$l str { + arg + } + } +} + +pub fn main() { + foo!('a, 'b); + let x: &'static str = f("hi", "there"); + assert_eq!("hi", x); +} diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs b/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs new file mode 100644 index 00000000000..e7c59007702 --- /dev/null +++ b/src/test/run-pass/macros/macro-lifetime-used-with-labels.rs @@ -0,0 +1,46 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![allow(unreachable_code)] + +macro_rules! x { + ($a:lifetime) => { + $a: loop { + break $a; + panic!("failed"); + } + } +} +macro_rules! br { + ($a:lifetime) => { + break $a; + } +} +macro_rules! br2 { + ($b:lifetime) => { + 'b: loop { + break $b; // this $b should refer to the outer loop. + } + } +} +fn main() { + x!('a); + 'c: loop { + br!('c); + panic!("failed"); + } + 'b: loop { + br2!('b); + panic!("failed"); + } +} diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr b/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr new file mode 100644 index 00000000000..729178fb8f1 --- /dev/null +++ b/src/test/run-pass/macros/macro-lifetime-used-with-labels.stderr @@ -0,0 +1,11 @@ +warning: label name `'b` shadows a label name that is already in scope + --> $DIR/macro-lifetime-used-with-labels.rs:31:9 + | +LL | 'b: loop { + | ^^ lifetime 'b already in scope +... +LL | 'b: loop { + | -- first declared here +LL | br2!('b); + | --------- in this macro invocation + diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-static.rs b/src/test/run-pass/macros/macro-lifetime-used-with-static.rs new file mode 100644 index 00000000000..2b37ce461cb --- /dev/null +++ b/src/test/run-pass/macros/macro-lifetime-used-with-static.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + ($l:lifetime) => { + fn f(arg: &$l str) -> &$l str { + arg + } + } +} + +pub fn main() { + foo!('static); + let x: &'static str = f("hi"); + assert_eq!("hi", x); +} diff --git a/src/test/run-pass/macros/macro-lifetime.rs b/src/test/run-pass/macros/macro-lifetime.rs new file mode 100644 index 00000000000..f385d73e5bb --- /dev/null +++ b/src/test/run-pass/macros/macro-lifetime.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + ($l:lifetime) => { + fn f<$l>(arg: &$l str) -> &$l str { + arg + } + } +} + +pub fn main() { + foo!('a); + let x: &'static str = f("hi"); + assert_eq!("hi", x); +} diff --git a/src/test/run-pass/macros/macro-literal.rs b/src/test/run-pass/macros/macro-literal.rs new file mode 100644 index 00000000000..ecbb47757d1 --- /dev/null +++ b/src/test/run-pass/macros/macro-literal.rs @@ -0,0 +1,144 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(macro_literal_matcher)] + +macro_rules! mtester { + ($l:literal) => { + &format!("macro caught literal: {}", $l) + }; + ($e:expr) => { + &format!("macro caught expr: {}", $e) + }; +} + +macro_rules! two_negative_literals { + ($l1:literal $l2:literal) => { + &format!("macro caught literals: {}, {}", $l1, $l2) + }; +} + +macro_rules! only_expr { + ($e:expr) => { + &format!("macro caught expr: {}", $e) + }; +} + +macro_rules! mtester_dbg { + ($l:literal) => { + &format!("macro caught literal: {:?}", $l) + }; + ($e:expr) => { + &format!("macro caught expr: {:?}", $e) + }; +} + +macro_rules! catch_range { + ($s:literal ..= $e:literal) => { + &format!("macro caught literal: {} ..= {}", $s, $e) + }; + (($s:expr) ..= ($e:expr)) => { // Must use ')' before '..=' + &format!("macro caught expr: {} ..= {}", $s, $e) + }; +} + +macro_rules! pat_match { + ($s:literal ..= $e:literal) => { + match 3 { + $s ..= $e => "literal, in range", + _ => "literal, other", + } + }; + ($s:pat) => { + match 3 { + $s => "pat, single", + _ => "pat, other", + } + }; +} + +macro_rules! match_attr { + (#[$attr:meta] $e:literal) => { + "attr matched literal" + }; + (#[$attr:meta] $e:expr) => { + "attr matched expr" + }; +} + +macro_rules! match_produced_attr { + ($lit: literal) => { + // Struct with doc comment passed via $literal + #[doc = $lit] + struct LiteralProduced; + }; + ($expr: expr) => { + struct ExprProduced; + }; +} + +macro_rules! test_user { + ($s:literal, $e:literal) => { + { + let mut v = Vec::new(); + for i in $s .. $e { + v.push(i); + } + "literal" + } + }; + ($s:expr, $e: expr) => { + { + let mut v = Vec::new(); + for i in $s .. $e { + v.push(i); + } + "expr" + } + }; +} + +pub fn main() { + // Cases where 'literal' catches + assert_eq!(mtester!("str"), "macro caught literal: str"); + assert_eq!(mtester!(2), "macro caught literal: 2"); + assert_eq!(mtester!(2.2), "macro caught literal: 2.2"); + assert_eq!(mtester!(1u32), "macro caught literal: 1"); + assert_eq!(mtester!(0x32), "macro caught literal: 50"); + assert_eq!(mtester!('c'), "macro caught literal: c"); + assert_eq!(mtester!(-1.2), "macro caught literal: -1.2"); + assert_eq!(two_negative_literals!(-2 -3), "macro caught literals: -2, -3"); + assert_eq!(catch_range!(2 ..= 3), "macro caught literal: 2 ..= 3"); + assert_eq!(match_attr!(#[attr] 1), "attr matched literal"); + assert_eq!(test_user!(10, 20), "literal"); + assert_eq!(mtester!(false), "macro caught literal: false"); + assert_eq!(mtester!(true), "macro caught literal: true"); + match_produced_attr!("a"); + let _a = LiteralProduced; + assert_eq!(pat_match!(1 ..= 3), "literal, in range"); + assert_eq!(pat_match!(4 ..= 6), "literal, other"); + + // Cases where 'expr' catches + assert_eq!(mtester!((-1.2)), "macro caught expr: -1.2"); + assert_eq!(only_expr!(-1.2), "macro caught expr: -1.2"); + assert_eq!(mtester!((1 + 3)), "macro caught expr: 4"); + assert_eq!(mtester_dbg!(()), "macro caught expr: ()"); + assert_eq!(catch_range!((1 + 1) ..= (2 + 2)), "macro caught expr: 2 ..= 4"); + assert_eq!(match_attr!(#[attr] (1 + 2)), "attr matched expr"); + assert_eq!(test_user!(10, (20 + 2)), "expr"); + + match_produced_attr!((3 + 2)); + let _b = ExprProduced; + + // Cases where 'pat' matched + assert_eq!(pat_match!(3), "pat, single"); + assert_eq!(pat_match!(6), "pat, other"); +} diff --git a/src/test/run-pass/macros/macro-meta-items.rs b/src/test/run-pass/macros/macro-meta-items.rs new file mode 100644 index 00000000000..d19c33b2e3a --- /dev/null +++ b/src/test/run-pass/macros/macro-meta-items.rs @@ -0,0 +1,40 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg foo + +macro_rules! compiles_fine { + ($at:meta) => { + #[cfg($at)] + static MISTYPED: () = "foo"; + } +} +macro_rules! emit { + ($at:meta) => { + #[cfg($at)] + static MISTYPED: &'static str = "foo"; + } +} + +// item +compiles_fine!(bar); +emit!(foo); + +fn foo() { + println!("{}", MISTYPED); +} + +pub fn main() { + // statement + compiles_fine!(baz); + emit!(baz); + println!("{}", MISTYPED); +} diff --git a/src/test/run-pass/macros/macro-method-issue-4621.rs b/src/test/run-pass/macros/macro-method-issue-4621.rs new file mode 100644 index 00000000000..17f6b84d108 --- /dev/null +++ b/src/test/run-pass/macros/macro-method-issue-4621.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct A; + +macro_rules! make_thirteen_method {() => (fn thirteen(&self)->isize {13})} +impl A { make_thirteen_method!(); } + +fn main() { + assert_eq!(A.thirteen(),13); +} diff --git a/src/test/run-pass/macros/macro-multiple-items.rs b/src/test/run-pass/macros/macro-multiple-items.rs new file mode 100644 index 00000000000..6ebfead9761 --- /dev/null +++ b/src/test/run-pass/macros/macro-multiple-items.rs @@ -0,0 +1,26 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! make_foo { + () => ( + struct Foo; + + impl Foo { + fn bar(&self) {} + } + ) +} + +make_foo!(); + +pub fn main() { + Foo.bar() +} diff --git a/src/test/run-pass/macros/macro-named-default.rs b/src/test/run-pass/macros/macro-named-default.rs new file mode 100644 index 00000000000..1a7674ad4e6 --- /dev/null +++ b/src/test/run-pass/macros/macro-named-default.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! default { + ($($x:tt)*) => { $($x)* } +} + +default! { + struct A; +} + +impl A { + default! { + fn foo(&self) {} + } +} + +fn main() { + A.foo(); +} diff --git a/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs b/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs new file mode 100644 index 00000000000..276aef879e0 --- /dev/null +++ b/src/test/run-pass/macros/macro-nested_definition_issue-31946.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + println!("{}", { + macro_rules! foo { + ($name:expr) => { concat!("hello ", $name) } + } + foo!("rust") + }); +} diff --git a/src/test/run-pass/macros/macro-nested_expr.rs b/src/test/run-pass/macros/macro-nested_expr.rs new file mode 100644 index 00000000000..5af4649f58b --- /dev/null +++ b/src/test/run-pass/macros/macro-nested_expr.rs @@ -0,0 +1,33 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #42164 + +#![feature(decl_macro)] +#![allow(dead_code)] + +pub macro m($inner_str:expr) { + #[doc = $inner_str] + struct S; +} + +macro_rules! define_f { + ($name:expr) => { + #[export_name = $name] + fn f() {} + } +} + +fn main() { + define_f!(concat!("exported_", "f")); + m!(stringify!(foo)); +} + diff --git a/src/test/run-pass/macros/macro-nested_stmt_macros.rs b/src/test/run-pass/macros/macro-nested_stmt_macros.rs new file mode 100644 index 00000000000..81400927d88 --- /dev/null +++ b/src/test/run-pass/macros/macro-nested_stmt_macros.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + () => { + struct Bar; + struct Baz; + } +} + +macro_rules! grault { + () => { + foo!(); + struct Xyzzy; + } +} + +fn static_assert_exists() { } + +fn main() { + grault!(); + static_assert_exists::(); + static_assert_exists::(); + static_assert_exists::(); +} diff --git a/src/test/run-pass/macros/macro-nt-list.rs b/src/test/run-pass/macros/macro-nt-list.rs new file mode 100644 index 00000000000..55388ed278f --- /dev/null +++ b/src/test/run-pass/macros/macro-nt-list.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +macro_rules! list { + ( ($($id:ident),*) ) => (()); + ( [$($id:ident),*] ) => (()); + ( {$($id:ident),*} ) => (()); +} + +macro_rules! tt_list { + ( ($($tt:tt),*) ) => (()); +} + +pub fn main() { + list!( () ); + list!( [] ); + list!( {} ); + + tt_list!( (a, b, c) ); + tt_list!( () ); +} diff --git a/src/test/run-pass/macros/macro-of-higher-order.rs b/src/test/run-pass/macros/macro-of-higher-order.rs new file mode 100644 index 00000000000..9a535881197 --- /dev/null +++ b/src/test/run-pass/macros/macro-of-higher-order.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! higher_order { + (subst $lhs:tt => $rhs:tt) => ({ + macro_rules! anon { $lhs => $rhs } + anon!(1_usize, 2_usize, "foo") + }); +} + +macro_rules! outer { + ($x:expr; $fragment:ident) => { + macro_rules! inner { ($y:$fragment) => { $x + $y } } + } +} + +fn main() { + let val = higher_order!(subst ($x:expr, $y:expr, $foo:expr) => (($x + $y, $foo))); + assert_eq!(val, (3, "foo")); + + outer!(2; expr); + assert_eq!(inner!(3), 5); +} diff --git a/src/test/run-pass/macros/macro-pat-follow.rs b/src/test/run-pass/macros/macro-pat-follow.rs new file mode 100644 index 00000000000..12cbfa84505 --- /dev/null +++ b/src/test/run-pass/macros/macro-pat-follow.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! pat_in { + ($p:pat in $e:expr) => {{ + let mut iter = $e.into_iter(); + while let $p = iter.next() {} + }} +} + +macro_rules! pat_if { + ($p:pat if $e:expr) => {{ + match Some(1u8) { + $p if $e => {}, + _ => {} + } + }} +} + +macro_rules! pat_bar { + ($p:pat | $p2:pat) => {{ + match Some(1u8) { + $p | $p2 => {}, + _ => {} + } + }} +} + +fn main() { + pat_in!(Some(_) in 0..10); + pat_if!(Some(x) if x > 0); + pat_bar!(Some(1u8) | None); +} diff --git a/src/test/run-pass/macros/macro-pat-neg-lit.rs b/src/test/run-pass/macros/macro-pat-neg-lit.rs new file mode 100644 index 00000000000..ddde5d32e39 --- /dev/null +++ b/src/test/run-pass/macros/macro-pat-neg-lit.rs @@ -0,0 +1,36 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! enum_number { + ($name:ident { $($variant:ident = $value:expr, )* }) => { + enum $name { + $($variant = $value,)* + } + + fn foo(value: i32) -> Option<$name> { + match value { + $( $value => Some($name::$variant), )* + _ => None + } + } + } +} + +enum_number!(Change { + Down = -1, + None = 0, + Up = 1, +}); + +fn main() { + if let Some(Change::Down) = foo(-1) {} else { panic!() } +} + diff --git a/src/test/run-pass/macros/macro-pat.rs b/src/test/run-pass/macros/macro-pat.rs new file mode 100644 index 00000000000..1ed0663fc5a --- /dev/null +++ b/src/test/run-pass/macros/macro-pat.rs @@ -0,0 +1,75 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! mypat { + () => ( + Some('y') + ) +} + +macro_rules! char_x { + () => ( + 'x' + ) +} + +macro_rules! some { + ($x:pat) => ( + Some($x) + ) +} + +macro_rules! indirect { + () => ( + some!(char_x!()) + ) +} + +macro_rules! ident_pat { + ($x:ident) => ( + $x + ) +} + +fn f(c: Option) -> usize { + match c { + Some('x') => 1, + mypat!() => 2, + _ => 3, + } +} + +pub fn main() { + assert_eq!(1, f(Some('x'))); + assert_eq!(2, f(Some('y'))); + assert_eq!(3, f(None)); + + assert_eq!(1, match Some('x') { + Some(char_x!()) => 1, + _ => 2, + }); + + assert_eq!(1, match Some('x') { + some!(char_x!()) => 1, + _ => 2, + }); + + assert_eq!(1, match Some('x') { + indirect!() => 1, + _ => 2, + }); + + assert_eq!(3, { + let ident_pat!(x) = 2; + x+1 + }); +} diff --git a/src/test/run-pass/macros/macro-path.rs b/src/test/run-pass/macros/macro-path.rs new file mode 100644 index 00000000000..fc874f0d0ca --- /dev/null +++ b/src/test/run-pass/macros/macro-path.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +mod m { + pub type t = isize; +} + +macro_rules! foo { + ($p:path) => ({ + fn f() -> $p { 10 }; + f() + }) +} + +pub fn main() { + assert_eq!(foo!(m::t), 10); +} diff --git a/src/test/run-pass/macros/macro-pub-matcher.rs b/src/test/run-pass/macros/macro-pub-matcher.rs new file mode 100644 index 00000000000..7d8bb430232 --- /dev/null +++ b/src/test/run-pass/macros/macro-pub-matcher.rs @@ -0,0 +1,129 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code, unused_imports)] +#![cfg_attr(stage0, feature(macro_vis_matcher))] +#![feature(crate_visibility_modifier)] + +/** +Ensure that `:vis` matches can be captured in existing positions, and passed +through without the need for reparse tricks. +*/ +macro_rules! vis_passthru { + ($vis:vis const $name:ident: $ty:ty = $e:expr;) => { $vis const $name: $ty = $e; }; + ($vis:vis enum $name:ident {}) => { $vis struct $name {} }; + ($vis:vis extern "C" fn $name:ident() {}) => { $vis extern "C" fn $name() {} }; + ($vis:vis fn $name:ident() {}) => { $vis fn $name() {} }; + ($vis:vis mod $name:ident {}) => { $vis mod $name {} }; + ($vis:vis static $name:ident: $ty:ty = $e:expr;) => { $vis static $name: $ty = $e; }; + ($vis:vis struct $name:ident;) => { $vis struct $name; }; + ($vis:vis trait $name:ident {}) => { $vis trait $name {} }; + ($vis:vis type $name:ident = $ty:ty;) => { $vis type $name = $ty; }; + ($vis:vis use $path:ident as $name:ident;) => { $vis use self::$path as $name; }; +} + +mod with_pub { + vis_passthru! { pub const A: i32 = 0; } + vis_passthru! { pub enum B {} } + vis_passthru! { pub extern "C" fn c() {} } + vis_passthru! { pub mod d {} } + vis_passthru! { pub static E: i32 = 0; } + vis_passthru! { pub struct F; } + vis_passthru! { pub trait G {} } + vis_passthru! { pub type H = i32; } + vis_passthru! { pub use A as I; } +} + +mod without_pub { + vis_passthru! { const A: i32 = 0; } + vis_passthru! { enum B {} } + vis_passthru! { extern "C" fn c() {} } + vis_passthru! { mod d {} } + vis_passthru! { static E: i32 = 0; } + vis_passthru! { struct F; } + vis_passthru! { trait G {} } + vis_passthru! { type H = i32; } + vis_passthru! { use A as I; } +} + +mod with_pub_restricted { + vis_passthru! { pub(crate) const A: i32 = 0; } + vis_passthru! { pub(crate) enum B {} } + vis_passthru! { pub(crate) extern "C" fn c() {} } + vis_passthru! { pub(crate) mod d {} } + vis_passthru! { pub(crate) static E: i32 = 0; } + vis_passthru! { pub(crate) struct F; } + vis_passthru! { pub(crate) trait G {} } + vis_passthru! { pub(crate) type H = i32; } + vis_passthru! { pub(crate) use A as I; } +} + +mod with_crate { + vis_passthru! { crate const A: i32 = 0; } + vis_passthru! { crate enum B {} } + vis_passthru! { crate extern "C" fn c() {} } + vis_passthru! { crate mod d {} } + vis_passthru! { crate static E: i32 = 0; } + vis_passthru! { crate struct F; } + vis_passthru! { crate trait G {} } + vis_passthru! { crate type H = i32; } + vis_passthru! { crate use A as I; } +} + +mod garden { + mod with_pub_restricted_path { + vis_passthru! { pub(in garden) const A: i32 = 0; } + vis_passthru! { pub(in garden) enum B {} } + vis_passthru! { pub(in garden) extern "C" fn c() {} } + vis_passthru! { pub(in garden) mod d {} } + vis_passthru! { pub(in garden) static E: i32 = 0; } + vis_passthru! { pub(in garden) struct F; } + vis_passthru! { pub(in garden) trait G {} } + vis_passthru! { pub(in garden) type H = i32; } + vis_passthru! { pub(in garden) use A as I; } + } +} + +/* +Ensure that the `:vis` matcher works in a more complex situation: parsing a +struct definition. +*/ +macro_rules! vis_parse_struct { + ($(#[$($attrs:tt)*])* $vis:vis struct $name:ident {$($body:tt)*}) => { + vis_parse_struct! { @parse_fields $(#[$($attrs)*])*, $vis, $name, $($body)* } + }; + + ($(#[$($attrs:tt)*])* $vis:vis struct $name:ident ($($body:tt)*);) => { + vis_parse_struct! { @parse_tuple $(#[$($attrs)*])*, $vis, $name, $($body)* } + }; + + (@parse_fields + $(#[$attrs:meta])*, $vis:vis, $name:ident, $($fvis:vis $fname:ident: $fty:ty),* $(,)*) => { + $(#[$attrs])* $vis struct $name { $($fvis $fname: $fty,)* } + }; + + (@parse_tuple + $(#[$attrs:meta])*, $vis:vis, $name:ident, $($fvis:vis $fty:ty),* $(,)*) => { + $(#[$attrs])* $vis struct $name ( $($fvis $fty,)* ); + }; +} + +mod test_struct { + vis_parse_struct! { pub(crate) struct A { pub a: i32, b: i32, pub(crate) c: i32 } } + vis_parse_struct! { pub struct B { a: i32, pub(crate) b: i32, pub c: i32 } } + vis_parse_struct! { struct C { pub(crate) a: i32, pub b: i32, c: i32 } } + + vis_parse_struct! { pub(crate) struct D (pub i32, i32, pub(crate) i32); } + vis_parse_struct! { pub struct E (i32, pub(crate) i32, pub i32); } + vis_parse_struct! { struct F (pub(crate) i32, pub i32, i32); } +} + +fn main() {} diff --git a/src/test/run-pass/macros/macro-seq-followed-by-seq.rs b/src/test/run-pass/macros/macro-seq-followed-by-seq.rs new file mode 100644 index 00000000000..594717ffcdb --- /dev/null +++ b/src/test/run-pass/macros/macro-seq-followed-by-seq.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test of allowing two sequences repetitions in a row, +// functionality added as byproduct of RFC amendment #1384 +// https://github.com/rust-lang/rfcs/pull/1384 + +// Old version of Rust would reject this macro definition, even though +// there are no local ambiguities (the initial `banana` and `orange` +// tokens are enough for the expander to distinguish which case is +// intended). +macro_rules! foo { + ( $(banana $a:ident)* $(orange $b:tt)* ) => { }; +} + +fn main() { + foo!( banana id1 banana id2 + orange hi orange (hello world) ); +} diff --git a/src/test/run-pass/macros/macro-stability.rs b/src/test/run-pass/macros/macro-stability.rs new file mode 100644 index 00000000000..a5c0cbbcde4 --- /dev/null +++ b/src/test/run-pass/macros/macro-stability.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:unstable-macros.rs + +#![feature(unstable_macros)] + +#[macro_use] extern crate unstable_macros; + +#[unstable(feature = "local_unstable", issue = "0")] +macro_rules! local_unstable { () => () } + +fn main() { + unstable_macro!(); + local_unstable!(); +} diff --git a/src/test/run-pass/macros/macro-stmt.rs b/src/test/run-pass/macros/macro-stmt.rs new file mode 100644 index 00000000000..98b0dcb8336 --- /dev/null +++ b/src/test/run-pass/macros/macro-stmt.rs @@ -0,0 +1,41 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! myfn { + ( $f:ident, ( $( $x:ident ),* ), $body:block ) => ( + fn $f( $( $x : isize),* ) -> isize $body + ) +} + +myfn!(add, (a,b), { return a+b; } ); + +pub fn main() { + + macro_rules! mylet { + ($x:ident, $val:expr) => ( + let $x = $val; + ) + } + + mylet!(y, 8*2); + assert_eq!(y, 16); + + myfn!(mult, (a,b), { a*b } ); + + assert_eq!(mult(2, add(4,4)), 16); + + macro_rules! actually_an_expr_macro { + () => ( 16 ) + } + + assert_eq!({ actually_an_expr_macro!() }, 16); + +} diff --git a/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs b/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs new file mode 100644 index 00000000000..22e983dd9ce --- /dev/null +++ b/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + () => { + struct Bar; + struct Baz; + } +} + +macro_rules! grault { + () => {{ + foo!(); + struct Xyzzy; + 0 + }} +} + +fn main() { + let x = grault!(); + assert_eq!(x, 0); +} diff --git a/src/test/run-pass/macros/macro-tt-followed-by-seq.rs b/src/test/run-pass/macros/macro-tt-followed-by-seq.rs new file mode 100644 index 00000000000..204fdcf7049 --- /dev/null +++ b/src/test/run-pass/macros/macro-tt-followed-by-seq.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #25436: permit token-trees to be followed +// by sequences, enabling more general parsing. + +use self::Join::*; + +#[derive(Debug)] +enum Join { + Keep(A,B), + Skip(A,B), +} + +macro_rules! parse_list { + ( < $a:expr; > $($b:tt)* ) => { Keep(parse_item!($a),parse_list!($($b)*)) }; + ( $a:tt $($b:tt)* ) => { Skip(parse_item!($a), parse_list!($($b)*)) }; + ( ) => { () }; +} + +macro_rules! parse_item { + ( $x:expr ) => { $x } +} + +fn main() { + let list = parse_list!(<1;> 2 <3;> 4); + assert_eq!("Keep(1, Skip(2, Keep(3, Skip(4, ()))))", + format!("{:?}", list)); +} diff --git a/src/test/run-pass/macros/macro-use-all-and-none.rs b/src/test/run-pass/macros/macro-use-all-and-none.rs new file mode 100644 index 00000000000..6e035ff7f39 --- /dev/null +++ b/src/test/run-pass/macros/macro-use-all-and-none.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:two_macros.rs + +#[macro_use] +#[macro_use()] +extern crate two_macros; + +pub fn main() { + macro_one!(); + macro_two!(); +} diff --git a/src/test/run-pass/macros/macro-use-all.rs b/src/test/run-pass/macros/macro-use-all.rs new file mode 100644 index 00000000000..8bbec89ace2 --- /dev/null +++ b/src/test/run-pass/macros/macro-use-all.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:two_macros.rs + +#[macro_use] +extern crate two_macros; + +pub fn main() { + macro_one!(); + macro_two!(); +} diff --git a/src/test/run-pass/macros/macro-use-both.rs b/src/test/run-pass/macros/macro-use-both.rs new file mode 100644 index 00000000000..5e5b4b778a2 --- /dev/null +++ b/src/test/run-pass/macros/macro-use-both.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:two_macros.rs + +#[macro_use(macro_one, macro_two)] +extern crate two_macros; + +pub fn main() { + macro_one!(); + macro_two!(); +} diff --git a/src/test/run-pass/macros/macro-use-one.rs b/src/test/run-pass/macros/macro-use-one.rs new file mode 100644 index 00000000000..bdd9cc25b63 --- /dev/null +++ b/src/test/run-pass/macros/macro-use-one.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:two_macros.rs + +#[macro_use(macro_two)] +extern crate two_macros; + +pub fn main() { + macro_two!(); +} diff --git a/src/test/run-pass/macros/macro-with-attrs1.rs b/src/test/run-pass/macros/macro-with-attrs1.rs new file mode 100644 index 00000000000..4b2413d2deb --- /dev/null +++ b/src/test/run-pass/macros/macro-with-attrs1.rs @@ -0,0 +1,23 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg foo + + +#[cfg(foo)] +macro_rules! foo { () => (1) } + +#[cfg(not(foo))] +macro_rules! foo { () => (2) } + +pub fn main() { + assert_eq!(foo!(), 1); +} diff --git a/src/test/run-pass/macros/macro-with-attrs2.rs b/src/test/run-pass/macros/macro-with-attrs2.rs new file mode 100644 index 00000000000..37fc4ba6f2b --- /dev/null +++ b/src/test/run-pass/macros/macro-with-attrs2.rs @@ -0,0 +1,21 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[cfg(foo)] +macro_rules! foo { () => (1) } + +#[cfg(not(foo))] +macro_rules! foo { () => (2) } + +pub fn main() { + assert_eq!(foo!(), 2); +} diff --git a/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs b/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs new file mode 100644 index 00000000000..830ec620fca --- /dev/null +++ b/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +macro_rules! expr { ($e: expr) => { $e } } + +macro_rules! spawn { + ($($code: tt)*) => { + expr!(thread::spawn(move|| {$($code)*}).join()) + } +} + +pub fn main() { + spawn! { + println!("stmt"); + }; + let _ = spawn! { + println!("expr"); + }; +} diff --git a/src/test/run-pass/macros/macro_with_super_2.rs b/src/test/run-pass/macros/macro_with_super_2.rs new file mode 100644 index 00000000000..2c984f86f0b --- /dev/null +++ b/src/test/run-pass/macros/macro_with_super_2.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:macro_with_super_1.rs + +// pretty-expanded FIXME #23616 + +#[macro_use] +extern crate macro_with_super_1; + +declare!(); + +fn main() { + bbb::ccc(); +} diff --git a/src/test/run-pass/macros/macros-in-extern.rs b/src/test/run-pass/macros/macros-in-extern.rs new file mode 100644 index 00000000000..2d3d2a9589c --- /dev/null +++ b/src/test/run-pass/macros/macros-in-extern.rs @@ -0,0 +1,40 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32 + +#![feature(decl_macro, macros_in_extern)] + +macro_rules! returns_isize( + ($ident:ident) => ( + fn $ident() -> isize; + ) +); + +macro takes_u32_returns_u32($ident:ident) { + fn $ident (arg: u32) -> u32; +} + +macro_rules! emits_nothing( + () => () +); + +fn main() { + assert_eq!(unsafe { rust_get_test_int() }, 1isize); + assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEFu32); +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + returns_isize!(rust_get_test_int); + takes_u32_returns_u32!(rust_dbg_extern_identity_u32); + emits_nothing!(); +} diff --git a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs new file mode 100644 index 00000000000..f0431b92570 --- /dev/null +++ b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// Test parsing binary operators after macro invocations. + +// pretty-expanded FIXME #23616 + +#![feature(macro_rules)] + +macro_rules! id { + ($e: expr) => { $e } +} + +fn foo() { + id!(1) + 1; + id![1] - 1; + id!(1) * 1; + id![1] / 1; + id!(1) % 1; + + id!(1) & 1; + id![1] | 1; + id!(1) ^ 1; + + let mut x = 1; + id![x] = 2; + id!(x) += 1; + + id!(1f64).clone(); + + id!([1, 2, 3])[1]; + id![drop](1); + + id!(true) && true; + id![true] || true; +} + +fn main() {} diff --git a/src/test/run-pass/macros/paths-in-macro-invocations.rs b/src/test/run-pass/macros/paths-in-macro-invocations.rs new file mode 100644 index 00000000000..358c97d468b --- /dev/null +++ b/src/test/run-pass/macros/paths-in-macro-invocations.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:two_macros.rs + +extern crate two_macros; + +::two_macros::macro_one!(); +two_macros::macro_one!(); + +mod foo { pub use two_macros::macro_one as bar; } + +trait T { + foo::bar!(); + ::foo::bar!(); +} + +struct S { + x: foo::bar!(i32), + y: ::foo::bar!(i32), +} + +impl S { + foo::bar!(); + ::foo::bar!(); +} + +fn main() { + foo::bar!(); + ::foo::bar!(); + + let _ = foo::bar!(0); + let _ = ::foo::bar!(0); + + let foo::bar!(_) = 0; + let ::foo::bar!(_) = 0; +} diff --git a/src/test/run-pass/macros/pub-item-inside-macro.rs b/src/test/run-pass/macros/pub-item-inside-macro.rs new file mode 100644 index 00000000000..f17d0ac47b6 --- /dev/null +++ b/src/test/run-pass/macros/pub-item-inside-macro.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #14660 + +// pretty-expanded FIXME #23616 + +mod bleh { + macro_rules! foo { + () => { + pub fn bar() { } + } + } + + foo!(); +} + +fn main() { + bleh::bar(); +} diff --git a/src/test/run-pass/macros/pub-method-inside-macro.rs b/src/test/run-pass/macros/pub-method-inside-macro.rs new file mode 100644 index 00000000000..3bd48c11def --- /dev/null +++ b/src/test/run-pass/macros/pub-method-inside-macro.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #17436 + +// pretty-expanded FIXME #23616 + +mod bleh { + macro_rules! foo { + () => { + pub fn bar(&self) { } + } + } + + pub struct S; + + impl S { + foo!(); + } +} + +fn main() { + bleh::S.bar(); +} diff --git a/src/test/run-pass/macros/semi-after-macro-ty.rs b/src/test/run-pass/macros/semi-after-macro-ty.rs new file mode 100644 index 00000000000..1eaa8c49222 --- /dev/null +++ b/src/test/run-pass/macros/semi-after-macro-ty.rs @@ -0,0 +1,18 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! foo { + ($t:ty; $p:path;) => {} +} + +fn main() { + foo!(i32; i32;); +} diff --git a/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs b/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs new file mode 100644 index 00000000000..faf02af5387 --- /dev/null +++ b/src/test/run-pass/macros/stmt_expr_attr_macro_parse.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! m { + ($e:expr) => { + "expr includes attr" + }; + (#[$attr:meta] $e:expr) => { + "expr excludes attr" + } +} + +macro_rules! n { + (#[$attr:meta] $e:expr) => { + "expr excludes attr" + }; + ($e:expr) => { + "expr includes attr" + } +} + +fn main() { + assert_eq!(m!(#[attr] 1), "expr includes attr"); + assert_eq!(n!(#[attr] 1), "expr excludes attr"); +} diff --git a/src/test/run-pass/macros/syntax-extension-cfg.rs b/src/test/run-pass/macros/syntax-extension-cfg.rs new file mode 100644 index 00000000000..f3b2f1df219 --- /dev/null +++ b/src/test/run-pass/macros/syntax-extension-cfg.rs @@ -0,0 +1,34 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: --cfg foo --cfg qux="foo" + + +pub fn main() { + // check + if ! cfg!(foo) { panic!() } + if cfg!(not(foo)) { panic!() } + + if ! cfg!(qux="foo") { panic!() } + if cfg!(not(qux="foo")) { panic!() } + + if ! cfg!(all(foo, qux="foo")) { panic!() } + if cfg!(not(all(foo, qux="foo"))) { panic!() } + if cfg!(all(not(all(foo, qux="foo")))) { panic!() } + + if cfg!(not_a_cfg) { panic!() } + if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() } + if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() } + if ! cfg!(any(not_a_cfg, foo)) { panic!() } + + if ! cfg!(not(not_a_cfg)) { panic!() } + if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { panic!() } +} diff --git a/src/test/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment b/src/test/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment new file mode 100644 index 00000000000..d752015a4dc --- /dev/null +++ b/src/test/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment @@ -0,0 +1,7 @@ +/* this is for run-pass/syntax-extension-source-utils.rs */ + +{ + assert!(file!().ends_with("includeme.fragment")); + assert_eq!(line!(), 5u32); + format!("victory robot {}", line!()) +} diff --git a/src/test/run-pass/macros/syntax-extension-source-utils.rs b/src/test/run-pass/macros/syntax-extension-source-utils.rs new file mode 100644 index 00000000000..ffa4adb0136 --- /dev/null +++ b/src/test/run-pass/macros/syntax-extension-source-utils.rs @@ -0,0 +1,47 @@ +// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// ignore-pretty issue #37195 + +pub mod m1 { + pub mod m2 { + pub fn where_am_i() -> String { + (module_path!()).to_string() + } + } +} + +macro_rules! indirect_line { () => ( line!() ) } + +pub fn main() { + assert_eq!(line!(), 27); + assert_eq!(column!(), 16); + assert_eq!(indirect_line!(), 29); + assert!((file!().ends_with("syntax-extension-source-utils.rs"))); + assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string()); + assert!(include!("syntax-extension-source-utils-files/includeme.\ + fragment").to_string() + == "victory robot 6".to_string()); + + assert!( + include_str!("syntax-extension-source-utils-files/includeme.\ + fragment").to_string() + .starts_with("/* this is for ")); + assert!( + include_bytes!("syntax-extension-source-utils-files/includeme.fragment") + [1] == (42 as u8)); // '*' + // The Windows tests are wrapped in an extra module for some reason + assert!((m1::m2::where_am_i().ends_with("m1::m2"))); + + assert_eq!((46, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5))); +} diff --git a/src/test/run-pass/macros/try-macro.rs b/src/test/run-pass/macros/try-macro.rs new file mode 100644 index 00000000000..4a8f55ac83c --- /dev/null +++ b/src/test/run-pass/macros/try-macro.rs @@ -0,0 +1,58 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::num::{ParseFloatError, ParseIntError}; + +fn main() { + assert_eq!(simple(), Ok(1)); + assert_eq!(nested(), Ok(2)); + assert_eq!(merge_ok(), Ok(3.0)); + assert_eq!(merge_int_err(), Err(Error::Int)); + assert_eq!(merge_float_err(), Err(Error::Float)); +} + +fn simple() -> Result { + Ok(try!("1".parse())) +} + +fn nested() -> Result { + Ok(try!(try!("2".parse::()).to_string().parse::())) +} + +fn merge_ok() -> Result { + Ok(try!("1".parse::()) as f32 + try!("2.0".parse::())) +} + +fn merge_int_err() -> Result { + Ok(try!("a".parse::()) as f32 + try!("2.0".parse::())) +} + +fn merge_float_err() -> Result { + Ok(try!("1".parse::()) as f32 + try!("b".parse::())) +} + +#[derive(Debug, PartialEq)] +enum Error { + Int, + Float, +} + +impl From for Error { + fn from(_: ParseIntError) -> Error { + Error::Int + } +} + +impl From for Error { + fn from(_: ParseFloatError) -> Error { + Error::Float + } +} diff --git a/src/test/run-pass/macros/two-macro-use.rs b/src/test/run-pass/macros/two-macro-use.rs new file mode 100644 index 00000000000..28c18d71991 --- /dev/null +++ b/src/test/run-pass/macros/two-macro-use.rs @@ -0,0 +1,21 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:two_macros.rs + +#[macro_use(macro_one)] +#[macro_use(macro_two)] +extern crate two_macros; + +pub fn main() { + macro_one!(); + macro_two!(); +} diff --git a/src/test/run-pass/macros/type-macros-hlist.rs b/src/test/run-pass/macros/type-macros-hlist.rs new file mode 100644 index 00000000000..41d4cef07f2 --- /dev/null +++ b/src/test/run-pass/macros/type-macros-hlist.rs @@ -0,0 +1,88 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::*; + +#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +struct Nil; + // empty HList +#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] +struct Cons(H, T); + // cons cell of HList + + // trait to classify valid HLists +trait HList { } +impl HList for Nil { } +impl HList for Cons { } + +// term-level macro for HLists +macro_rules! hlist({ } => { Nil } ; { $ head : expr } => { + Cons ( $ head , Nil ) } ; { + $ head : expr , $ ( $ tail : expr ) , * } => { + Cons ( $ head , hlist ! ( $ ( $ tail ) , * ) ) } ;); + +// type-level macro for HLists +macro_rules! HList({ } => { Nil } ; { $ head : ty } => { + Cons < $ head , Nil > } ; { + $ head : ty , $ ( $ tail : ty ) , * } => { + Cons < $ head , HList ! ( $ ( $ tail ) , * ) > } ;); + +// nil case for HList append +impl Add for Nil { + type + Output + = + Ys; + + fn add(self, rhs: Ys) -> Ys { rhs } +} + +// cons case for HList append +impl Add for Cons + where Xs: Add { + type + Output + = + Cons; + + fn add(self, rhs: Ys) -> Cons { Cons(self.0, self.1 + rhs) } +} + +// type macro Expr allows us to expand the + operator appropriately +macro_rules! Expr({ ( $ ( $ LHS : tt ) + ) } => { Expr ! ( $ ( $ LHS ) + ) } ; + { HList ! [ $ ( $ LHS : tt ) * ] + $ ( $ RHS : tt ) + } => { + < Expr ! ( HList ! [ $ ( $ LHS ) * ] ) as Add < Expr ! ( + $ ( $ RHS ) + ) >> :: Output } ; { + $ LHS : tt + $ ( $ RHS : tt ) + } => { + < Expr ! ( $ LHS ) as Add < Expr ! ( $ ( $ RHS ) + ) >> :: + Output } ; { $ LHS : ty } => { $ LHS } ;); + +// test demonstrating term level `xs + ys` and type level `Expr!(Xs + Ys)` +fn main() { + fn aux(xs: Xs, ys: Ys) -> Expr!(Xs + Ys) where + Xs: Add { + xs + ys + } + + let xs: HList!(& str , bool , Vec < u64 >) = + hlist!("foo" , false , vec ! [ ]); + let ys: HList!(u64 , [ u8 ; 3 ] , ( )) = + hlist!(0 , [ 0 , 1 , 2 ] , ( )); + + // demonstrate recursive expansion of Expr! + let zs: + Expr!(( + HList ! [ & str ] + HList ! [ bool ] + HList ! [ Vec < u64 > + ] ) + ( HList ! [ u64 ] + HList ! [ [ u8 ; 3 ] , ( ) ] ) + + HList ! [ ]) = aux(xs, ys); + assert_eq!(zs , hlist ! [ + "foo" , false , vec ! [ ] , 0 , [ 0 , 1 , 2 ] , ( ) ]) +} diff --git a/src/test/run-pass/macros/type-macros-simple.rs b/src/test/run-pass/macros/type-macros-simple.rs new file mode 100644 index 00000000000..8f091ec192b --- /dev/null +++ b/src/test/run-pass/macros/type-macros-simple.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +macro_rules! Tuple { + { $A:ty,$B:ty } => { ($A, $B) } +} + +fn main() { + let x: Tuple!(i32, i32) = (1, 2); +} + +fn issue_36540() { + let i32 = 0; + macro_rules! m { () => { i32 } } + struct S(m!(), T) where T: Trait; + + let x: m!() = m!(); + std::cell::Cell::::new(m!()); + impl std::ops::Index for Trait<(m!(), T)> + where T: Trait + { + type Output = m!(); + fn index(&self, i: m!()) -> &m!() { + unimplemented!() + } + } +} + +trait Trait {} +impl Trait for i32 {} diff --git a/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs b/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs new file mode 100644 index 00000000000..31bf37ec0a9 --- /dev/null +++ b/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs @@ -0,0 +1,39 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum T { + A(isize), + B(f64) +} + +// after fixing #9384 and implementing hygiene for match bindings, +// this now fails because the insertion of the 'y' into the match +// doesn't cause capture. Making this macro hygienic (as I've done) +// could very well make this test case completely pointless.... + +macro_rules! test { + ($id1:ident, $id2:ident, $e:expr) => ( + fn foo(a:T, b:T) -> T { + match (a, b) { + (T::A($id1), T::A($id2)) => T::A($e), + (T::B($id1), T::B($id2)) => T::B($e), + _ => panic!() + } + } + ) +} + +test!(x,y,x + y); + +pub fn main() { + foo(T::A(1), T::A(2)); +} diff --git a/src/test/run-pass/macros/use-macro-self.rs b/src/test/run-pass/macros/use-macro-self.rs new file mode 100644 index 00000000000..fb816f9e78f --- /dev/null +++ b/src/test/run-pass/macros/use-macro-self.rs @@ -0,0 +1,21 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:use-macro-self.rs + +#[macro_use] +extern crate use_macro_self; + +use use_macro_self::foobarius::{self}; + +fn main() { + let _: () = foobarius!(); // OK, the macro returns `()` +} diff --git a/src/test/run-pass/methods/auxiliary/method_self_arg1.rs b/src/test/run-pass/methods/auxiliary/method_self_arg1.rs new file mode 100644 index 00000000000..785a8b05664 --- /dev/null +++ b/src/test/run-pass/methods/auxiliary/method_self_arg1.rs @@ -0,0 +1,47 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +#![feature(box_syntax)] + +static mut COUNT: u64 = 1; + +pub fn get_count() -> u64 { unsafe { COUNT } } + +#[derive(Copy, Clone)] +pub struct Foo; + +impl Foo { + pub fn foo(self, x: &Foo) { + unsafe { COUNT *= 2; } + // Test internal call. + Foo::bar(&self); + Foo::bar(x); + + Foo::baz(self); + Foo::baz(*x); + + Foo::qux(box self); + Foo::qux(box *x); + } + + pub fn bar(&self) { + unsafe { COUNT *= 3; } + } + + pub fn baz(self) { + unsafe { COUNT *= 5; } + } + + pub fn qux(self: Box) { + unsafe { COUNT *= 7; } + } +} diff --git a/src/test/run-pass/methods/auxiliary/method_self_arg2.rs b/src/test/run-pass/methods/auxiliary/method_self_arg2.rs new file mode 100644 index 00000000000..3761d58087e --- /dev/null +++ b/src/test/run-pass/methods/auxiliary/method_self_arg2.rs @@ -0,0 +1,64 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type = "lib"] + +#![feature(box_syntax)] + +static mut COUNT: u64 = 1; + +pub fn get_count() -> u64 { unsafe { COUNT } } + +#[derive(Copy, Clone)] +pub struct Foo; + +impl Foo { + pub fn run_trait(self) { + unsafe { COUNT *= 17; } + // Test internal call. + Bar::foo1(&self); + Bar::foo2(self); + Bar::foo3(box self); + + Bar::bar1(&self); + Bar::bar2(self); + Bar::bar3(box self); + } +} + +pub trait Bar : Sized { + fn foo1(&self); + fn foo2(self); + fn foo3(self: Box); + + fn bar1(&self) { + unsafe { COUNT *= 7; } + } + fn bar2(self) { + unsafe { COUNT *= 11; } + } + fn bar3(self: Box) { + unsafe { COUNT *= 13; } + } +} + +impl Bar for Foo { + fn foo1(&self) { + unsafe { COUNT *= 2; } + } + + fn foo2(self) { + unsafe { COUNT *= 3; } + } + + fn foo3(self: Box) { + unsafe { COUNT *= 5; } + } +} diff --git a/src/test/run-pass/methods/method-argument-inference-associated-type.rs b/src/test/run-pass/methods/method-argument-inference-associated-type.rs new file mode 100644 index 00000000000..0db38516cb9 --- /dev/null +++ b/src/test/run-pass/methods/method-argument-inference-associated-type.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct ClientMap; +pub struct ClientMap2; + +pub trait Service { + type Request; + fn call(&self, _req: Self::Request); +} + +pub struct S(T); + +impl Service for ClientMap { + type Request = S>; + fn call(&self, _req: Self::Request) {} +} + + +impl Service for ClientMap2 { + type Request = (Box,); + fn call(&self, _req: Self::Request) {} +} + + +fn main() { + ClientMap.call(S { 0: Box::new(|_msgid| ()) }); + ClientMap.call(S(Box::new(|_msgid| ()))); + ClientMap2.call((Box::new(|_msgid| ()),)); +} diff --git a/src/test/run-pass/methods/method-attributes.rs b/src/test/run-pass/methods/method-attributes.rs new file mode 100644 index 00000000000..b1afbd8d11c --- /dev/null +++ b/src/test/run-pass/methods/method-attributes.rs @@ -0,0 +1,40 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pp-exact - Make sure we print all the attributes +// pretty-expanded FIXME #23616 + +#![feature(custom_attribute)] + +#[frobable] +trait frobable { + #[frob_attr] + fn frob(&self); + #[defrob_attr] + fn defrob(&self); +} + +#[int_frobable] +impl frobable for isize { + #[frob_attr1] + fn frob(&self) { + #![frob_attr2] + } + + #[defrob_attr1] + fn defrob(&self) { + #![defrob_attr2] + } +} + +pub fn main() { } diff --git a/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs b/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs new file mode 100644 index 00000000000..f98a35bb9e3 --- /dev/null +++ b/src/test/run-pass/methods/method-early-bound-lifetimes-on-self.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that we successfully handle methods where the `self` type has +// an early-bound lifetime. Issue #18208. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +use std::marker; + +struct Cursor<'a> { + m: marker::PhantomData<&'a ()> +} + +trait CursorNavigator { + fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; +} + +struct SimpleNavigator; + +impl CursorNavigator for SimpleNavigator { + fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool { + false + } +} + +fn main() { + let mut c = Cursor { m: marker::PhantomData }; + let n = SimpleNavigator; + n.init_cursor(&mut c); +} diff --git a/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs b/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs new file mode 100644 index 00000000000..7e6f0d9e27b --- /dev/null +++ b/src/test/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs @@ -0,0 +1,54 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that an `&mut self` method, when invoked on a place whose +// type is `&mut [u8]`, passes in a pointer to the place and not a +// temporary. Issue #19147. + +use std::slice; +use std::cmp; + +trait MyWriter { + fn my_write(&mut self, buf: &[u8]) -> Result<(), ()>; +} + +impl<'a> MyWriter for &'a mut [u8] { + fn my_write(&mut self, buf: &[u8]) -> Result<(), ()> { + let amt = cmp::min(self.len(), buf.len()); + self[..amt].clone_from_slice(&buf[..amt]); + + let write_len = buf.len(); + unsafe { + *self = slice::from_raw_parts_mut( + self.as_mut_ptr().add(write_len), + self.len() - write_len + ); + } + + Ok(()) + } +} + +fn main() { + let mut buf = [0; 6]; + + { + let mut writer: &mut [_] = &mut buf; + writer.my_write(&[0, 1, 2]).unwrap(); + writer.my_write(&[3, 4, 5]).unwrap(); + } + + // If `my_write` is not modifying `buf` in place, then we will + // wind up with `[3, 4, 5, 0, 0, 0]` because the first call to + // `my_write()` doesn't update the starting point for the write. + + assert_eq!(buf, [0, 1, 2, 3, 4, 5]); +} diff --git a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs new file mode 100644 index 00000000000..a56e5b5170d --- /dev/null +++ b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs @@ -0,0 +1,69 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// Test that we handle projection types which wind up important for +// resolving methods. This test was reduced from a larger example; the +// call to `foo()` at the end was failing to resolve because the +// winnowing stage of method resolution failed to handle an associated +// type projection. + +// pretty-expanded FIXME #23616 + +#![feature(associated_types)] + +trait Hasher { + type Output; + fn finish(&self) -> Self::Output; +} + +trait Hash { + fn hash(&self, h: &mut H); +} + +trait HashState { + type Wut: Hasher; + fn hasher(&self) -> Self::Wut; +} + +struct SipHasher; +impl Hasher for SipHasher { + type Output = u64; + fn finish(&self) -> u64 { 4 } +} + +impl Hash for isize { + fn hash(&self, h: &mut SipHasher) {} +} + +struct SipState; +impl HashState for SipState { + type Wut = SipHasher; + fn hasher(&self) -> SipHasher { SipHasher } +} + +struct Map { + s: S, +} + +impl Map + where S: HashState, + ::Wut: Hasher, +{ + fn foo(&self, k: K) where K: Hash< ::Wut> {} +} + +fn foo>(map: &Map) { + map.foo(22); +} + +fn main() {} diff --git a/src/test/run-pass/methods/method-projection.rs b/src/test/run-pass/methods/method-projection.rs new file mode 100644 index 00000000000..a997c8ffbfb --- /dev/null +++ b/src/test/run-pass/methods/method-projection.rs @@ -0,0 +1,80 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can use method notation to call methods based on a +// projection bound from a trait. Issue #20469. + +/////////////////////////////////////////////////////////////////////////// + + +trait MakeString { + fn make_string(&self) -> String; +} + +impl MakeString for isize { + fn make_string(&self) -> String { + format!("{}", *self) + } +} + +impl MakeString for usize { + fn make_string(&self) -> String { + format!("{}", *self) + } +} + +/////////////////////////////////////////////////////////////////////////// + +trait Foo { + type F: MakeString; + + fn get(&self) -> &Self::F; +} + +fn foo(f: &F) -> String { + f.get().make_string() +} + +/////////////////////////////////////////////////////////////////////////// + +struct SomeStruct { + field: isize, +} + +impl Foo for SomeStruct { + type F = isize; + + fn get(&self) -> &isize { + &self.field + } +} + +/////////////////////////////////////////////////////////////////////////// + +struct SomeOtherStruct { + field: usize, +} + +impl Foo for SomeOtherStruct { + type F = usize; + + fn get(&self) -> &usize { + &self.field + } +} + +fn main() { + let x = SomeStruct { field: 22 }; + assert_eq!(foo(&x), format!("22")); + + let x = SomeOtherStruct { field: 44 }; + assert_eq!(foo(&x), format!("44")); +} diff --git a/src/test/run-pass/methods/method-recursive-blanket-impl.rs b/src/test/run-pass/methods/method-recursive-blanket-impl.rs new file mode 100644 index 00000000000..d1cd974070f --- /dev/null +++ b/src/test/run-pass/methods/method-recursive-blanket-impl.rs @@ -0,0 +1,49 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we don't trigger on the blanket impl for all `&'a T` but +// rather keep autoderefing and trigger on the underlying impl. To +// know not to stop at the blanket, we have to recursively evaluate +// the `T:Foo` bound. + +// pretty-expanded FIXME #23616 + +use std::marker::Sized; + +// Note: this must be generic for the problem to show up +trait Foo { + fn foo(&self, a: A); +} + +impl Foo for [u8] { + fn foo(&self, a: u8) {} +} + +impl<'a, A, T> Foo for &'a T where T: Foo { + fn foo(&self, a: A) { + Foo::foo(*self, a) + } +} + +trait Bar { + fn foo(&self); +} + +struct MyType; + +impl Bar for MyType { + fn foo(&self) {} +} + +fn main() { + let mut m = MyType; + (&mut m).foo() +} diff --git a/src/test/run-pass/methods/method-self-arg-aux1.rs b/src/test/run-pass/methods/method-self-arg-aux1.rs new file mode 100644 index 00000000000..c56a69ae4cd --- /dev/null +++ b/src/test/run-pass/methods/method-self-arg-aux1.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test method calls with self as an argument (cross-crate) + +#![feature(box_syntax)] + +// aux-build:method_self_arg1.rs +extern crate method_self_arg1; +use method_self_arg1::Foo; + +fn main() { + let x = Foo; + // Test external call. + Foo::bar(&x); + Foo::baz(x); + Foo::qux(box x); + + x.foo(&x); + + assert_eq!(method_self_arg1::get_count(), 2*3*3*3*5*5*5*7*7*7); +} diff --git a/src/test/run-pass/methods/method-self-arg-aux2.rs b/src/test/run-pass/methods/method-self-arg-aux2.rs new file mode 100644 index 00000000000..1dffa813ceb --- /dev/null +++ b/src/test/run-pass/methods/method-self-arg-aux2.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test method calls with self as an argument (cross-crate) + +#![feature(box_syntax)] + +// aux-build:method_self_arg2.rs +extern crate method_self_arg2; +use method_self_arg2::{Foo, Bar}; + +fn main() { + let x = Foo; + // Test external call. + Bar::foo1(&x); + Bar::foo2(x); + Bar::foo3(box x); + + Bar::bar1(&x); + Bar::bar2(x); + Bar::bar3(box x); + + x.run_trait(); + + assert_eq!(method_self_arg2::get_count(), 2*2*3*3*5*5*7*7*11*11*13*13*17); +} diff --git a/src/test/run-pass/methods/method-self-arg-trait.rs b/src/test/run-pass/methods/method-self-arg-trait.rs new file mode 100644 index 00000000000..9429d69a156 --- /dev/null +++ b/src/test/run-pass/methods/method-self-arg-trait.rs @@ -0,0 +1,79 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test method calls with self as an argument + +#![feature(box_syntax)] + +static mut COUNT: u64 = 1; + +#[derive(Copy, Clone)] +struct Foo; + +trait Bar : Sized { + fn foo1(&self); + fn foo2(self); + fn foo3(self: Box); + + fn bar1(&self) { + unsafe { COUNT *= 7; } + } + fn bar2(self) { + unsafe { COUNT *= 11; } + } + fn bar3(self: Box) { + unsafe { COUNT *= 13; } + } +} + +impl Bar for Foo { + fn foo1(&self) { + unsafe { COUNT *= 2; } + } + + fn foo2(self) { + unsafe { COUNT *= 3; } + } + + fn foo3(self: Box) { + unsafe { COUNT *= 5; } + } +} + +impl Foo { + fn baz(self) { + unsafe { COUNT *= 17; } + // Test internal call. + Bar::foo1(&self); + Bar::foo2(self); + Bar::foo3(box self); + + Bar::bar1(&self); + Bar::bar2(self); + Bar::bar3(box self); + } +} + +fn main() { + let x = Foo; + // Test external call. + Bar::foo1(&x); + Bar::foo2(x); + Bar::foo3(box x); + + Bar::bar1(&x); + Bar::bar2(x); + Bar::bar3(box x); + + x.baz(); + + unsafe { assert_eq!(COUNT, 2*2*3*3*5*5*7*7*11*11*13*13*17); } +} diff --git a/src/test/run-pass/methods/method-self-arg.rs b/src/test/run-pass/methods/method-self-arg.rs new file mode 100644 index 00000000000..38e8dfe3e4b --- /dev/null +++ b/src/test/run-pass/methods/method-self-arg.rs @@ -0,0 +1,58 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test method calls with self as an argument + +#![feature(box_syntax)] + +static mut COUNT: usize = 1; + +#[derive(Copy, Clone)] +struct Foo; + +impl Foo { + fn foo(self, x: &Foo) { + unsafe { COUNT *= 2; } + // Test internal call. + Foo::bar(&self); + Foo::bar(x); + + Foo::baz(self); + Foo::baz(*x); + + Foo::qux(box self); + Foo::qux(box *x); + } + + fn bar(&self) { + unsafe { COUNT *= 3; } + } + + fn baz(self) { + unsafe { COUNT *= 5; } + } + + fn qux(self: Box) { + unsafe { COUNT *= 7; } + } +} + +fn main() { + let x = Foo; + // Test external call. + Foo::bar(&x); + Foo::baz(x); + Foo::qux(box x); + + x.foo(&x); + + unsafe { assert_eq!(COUNT, 2*3*3*3*5*5*5*7*7*7); } +} diff --git a/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs b/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs new file mode 100644 index 00000000000..bb1b90ebfdf --- /dev/null +++ b/src/test/run-pass/methods/method-two-trait-defer-resolution-1.rs @@ -0,0 +1,47 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Test that we pick which version of `foo` to run based on the +// type that is (ultimately) inferred for `x`. + + +trait foo { + fn foo(&self) -> i32; +} + +impl foo for Vec { + fn foo(&self) -> i32 {1} +} + +impl foo for Vec { + fn foo(&self) -> i32 {2} +} + +fn call_foo_uint() -> i32 { + let mut x = Vec::new(); + let y = x.foo(); + x.push(0u32); + y +} + +fn call_foo_int() -> i32 { + let mut x = Vec::new(); + let y = x.foo(); + x.push(0i32); + y +} + +fn main() { + assert_eq!(call_foo_uint(), 1); + assert_eq!(call_foo_int(), 2); +} diff --git a/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs b/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs new file mode 100644 index 00000000000..3550326327d --- /dev/null +++ b/src/test/run-pass/methods/method-two-trait-defer-resolution-2.rs @@ -0,0 +1,58 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that when we write `x.foo()`, we do not have to know the +// complete type of `x` in order to type-check the method call. In +// this case, we know that `x: Vec<_1>`, but we don't know what type +// `_1` is (because the call to `push` comes later). To pick between +// the impls, we would have to know `_1`, since we have to know +// whether `_1: MyCopy` or `_1 == Box`. However (and this is the +// point of the test), we don't have to pick between the two impls -- +// it is enough to know that `foo` comes from the `Foo` trait. We can +// codegen the call as `Foo::foo(&x)` and let the specific impl get +// chosen later. + +#![feature(box_syntax)] + +trait Foo { + fn foo(&self) -> isize; +} + +trait MyCopy { fn foo(&self) { } } +impl MyCopy for i32 { } + +impl Foo for Vec { + fn foo(&self) -> isize {1} +} + +impl Foo for Vec> { + fn foo(&self) -> isize {2} +} + +fn call_foo_copy() -> isize { + let mut x = Vec::new(); + let y = x.foo(); + x.push(0_i32); + y +} + +fn call_foo_other() -> isize { + let mut x: Vec<_> = Vec::new(); + let y = x.foo(); + let z: Box = box 0; + x.push(z); + y +} + +fn main() { + assert_eq!(call_foo_copy(), 1); + assert_eq!(call_foo_other(), 2); +} diff --git a/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs b/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs new file mode 100644 index 00000000000..89ac0fc890c --- /dev/null +++ b/src/test/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we select between traits A and B. To do that, we must +// consider the `Sized` bound. + +// pretty-expanded FIXME #23616 + +trait A { + fn foo(self); +} + +trait B { + fn foo(self); +} + +impl A for *const T { + fn foo(self) {} +} + +impl B for *const [T] { + fn foo(self) {} +} + +fn main() { + let x: [isize; 4] = [1,2,3,4]; + let xptr = &x[..] as *const [isize]; + xptr.foo(); +} diff --git a/src/test/run-pass/methods/method-where-clause.rs b/src/test/run-pass/methods/method-where-clause.rs new file mode 100644 index 00000000000..721de2bf8e1 --- /dev/null +++ b/src/test/run-pass/methods/method-where-clause.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can use method notation to call methods based on a +// where clause type, and not only type parameters. + + +trait Foo { + fn foo(&self) -> i32; +} + +impl Foo for Option +{ + fn foo(&self) -> i32 { + self.unwrap_or(22) + } +} + +impl Foo for Option +{ + fn foo(&self) -> i32 { + self.unwrap_or(22) as i32 + } +} + +fn check(x: Option) -> (i32, i32) + where Option : Foo +{ + let y: Option = None; + (x.foo(), y.foo()) +} + +fn main() { + assert_eq!(check(Some(23u32)), (23, 22)); + assert_eq!(check(Some(23)), (23, 22)); +} diff --git a/src/test/run-pass/mir/auxiliary/mir_external_refs.rs b/src/test/run-pass/mir/auxiliary/mir_external_refs.rs new file mode 100644 index 00000000000..4cad98004d7 --- /dev/null +++ b/src/test/run-pass/mir/auxiliary/mir_external_refs.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub struct S(pub u8); + +impl S { + pub fn hey() -> u8 { 24 } +} + +pub trait X { + fn hoy(&self) -> u8 { 25 } +} + +impl X for S {} + +pub enum E { + U(u8) +} + +pub fn regular_fn() -> u8 { 12 } diff --git a/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs b/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs new file mode 100644 index 00000000000..85323d56616 --- /dev/null +++ b/src/test/run-pass/mir/mir-inlining/ice-issue-45493.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:-Zmir-opt-level=2 + +trait Array { + type Item; +} + +fn foo() { + let _: *mut A::Item = std::ptr::null_mut(); +} + +struct Foo; +impl Array for Foo { type Item = i32; } + +fn main() { + foo::(); +} diff --git a/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs b/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs new file mode 100644 index 00000000000..f5401279c89 --- /dev/null +++ b/src/test/run-pass/mir/mir-inlining/ice-issue-45885.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:-Zmir-opt-level=2 + +pub enum Enum { + A, + B, +} + +trait SliceIndex { + type Output; + fn get(&self) -> &Self::Output; +} + +impl SliceIndex for usize { + type Output = Enum; + #[inline(never)] + fn get(&self) -> &Enum { + &Enum::A + } +} + +#[inline(always)] +fn index(t: &T) -> &T::Output { + t.get() +} + +fn main() { + match *index(&0) { Enum::A => true, _ => false }; +} diff --git a/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs b/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs new file mode 100644 index 00000000000..ff5bf4e75a3 --- /dev/null +++ b/src/test/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags:-Zmir-opt-level=2 +pub trait Foo { + fn bar(&self) -> usize { 2 } +} + +impl Foo for () { + fn bar(&self) -> usize { 3 } +} + +// Test a case where MIR would inline the default trait method +// instead of bailing out. Issue #40473. +fn main() { + let result = ().bar(); + assert_eq!(result, 3); +} diff --git a/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs b/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs new file mode 100644 index 00000000000..3fc2ce44eaa --- /dev/null +++ b/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This code was creating an ICE in the MIR type checker. The reason +// is that we are reifying a reference to a function (`foo::<'x>`), +// which involves extracting its signature, but we were not +// normalizing the signature afterwards. As a result, we sometimes got +// errors around the `>::Value`, which can be +// normalized to `f64`. + +#![allow(dead_code)] + +trait Foo<'x> { + type Value; +} + +impl<'x> Foo<'x> for u32 { + type Value = f64; +} + +struct Providers<'x> { + foo: for<'y> fn(x: &'x u32, y: &'y u32) -> >::Value, +} + +fn foo<'y, 'x: 'x>(x: &'x u32, y: &'y u32) -> >::Value { + *x as f64 +} + +fn main() { + Providers { foo }; +} diff --git a/src/test/run-pass/mir/mir_adt_construction.rs b/src/test/run-pass/mir/mir_adt_construction.rs new file mode 100644 index 00000000000..066edfef0ad --- /dev/null +++ b/src/test/run-pass/mir/mir_adt_construction.rs @@ -0,0 +1,102 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt; + +#[repr(C)] +enum CEnum { + Hello = 30, + World = 60 +} + +fn test1(c: CEnum) -> i32 { + let c2 = CEnum::Hello; + match (c, c2) { + (CEnum::Hello, CEnum::Hello) => 42, + (CEnum::World, CEnum::Hello) => 0, + _ => 1 + } +} + +#[repr(packed)] +struct Pakd { + a: u64, + b: u32, + c: u16, + d: u8, + e: () +} + +// It is unsafe to use #[derive(Debug)] on a packed struct because the code generated by the derive +// macro takes references to the fields instead of accessing them directly. +impl fmt::Debug for Pakd { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + // It's important that we load the fields into locals by-value here. This will do safe + // unaligned loads into the locals, then pass references to the properly-aligned locals to + // the formatting code. + let Pakd { a, b, c, d, e } = *self; + f.debug_struct("Pakd") + .field("a", &a) + .field("b", &b) + .field("c", &c) + .field("d", &d) + .field("e", &e) + .finish() + } +} + +// It is unsafe to use #[derive(PartialEq)] on a packed struct because the code generated by the +// derive macro takes references to the fields instead of accessing them directly. +impl PartialEq for Pakd { + fn eq(&self, other: &Pakd) -> bool { + self.a == other.a && + self.b == other.b && + self.c == other.c && + self.d == other.d && + self.e == other.e + } +} + +impl Drop for Pakd { + fn drop(&mut self) {} +} + +fn test2() -> Pakd { + Pakd { a: 42, b: 42, c: 42, d: 42, e: () } +} + +#[derive(PartialEq, Debug)] +struct TupleLike(u64, u32); + +fn test3() -> TupleLike { + TupleLike(42, 42) +} + +fn test4(x: fn(u64, u32) -> TupleLike) -> (TupleLike, TupleLike) { + let y = TupleLike; + (x(42, 84), y(42, 84)) +} + +fn test5(x: fn(u32) -> Option) -> (Option, Option) { + let y = Some; + (x(42), y(42)) +} + +fn main() { + assert_eq!(test1(CEnum::Hello), 42); + assert_eq!(test1(CEnum::World), 0); + assert_eq!(test2(), Pakd { a: 42, b: 42, c: 42, d: 42, e: () }); + assert_eq!(test3(), TupleLike(42, 42)); + let t4 = test4(TupleLike); + assert_eq!(t4.0, t4.1); + let t5 = test5(Some); + assert_eq!(t5.0, t5.1); +} diff --git a/src/test/run-pass/mir/mir_ascription_coercion.rs b/src/test/run-pass/mir/mir_ascription_coercion.rs new file mode 100644 index 00000000000..f52467e5ae8 --- /dev/null +++ b/src/test/run-pass/mir/mir_ascription_coercion.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that the result of type ascription has adjustments applied + +#![feature(type_ascription)] + +fn main() { + let x = [1, 2, 3]; + // The RHS should coerce to &[i32] + let _y : &[i32] = &x : &[i32; 3]; +} diff --git a/src/test/run-pass/mir/mir_augmented_assignments.rs b/src/test/run-pass/mir/mir_augmented_assignments.rs new file mode 100644 index 00000000000..dfc6a016185 --- /dev/null +++ b/src/test/run-pass/mir/mir_augmented_assignments.rs @@ -0,0 +1,170 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; +use std::ops::{ + AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, MulAssign, RemAssign, + ShlAssign, ShrAssign, SubAssign, +}; + +#[derive(Debug, PartialEq)] +struct Int(i32); + +struct Slice([i32]); + +impl Slice { + fn new(slice: &mut [i32]) -> &mut Slice { + unsafe { + mem::transmute(slice) + } + } +} + +fn main() { + main_mir(); +} + +fn main_mir() { + let mut x = Int(1); + + x += Int(2); + assert_eq!(x, Int(0b11)); + + x &= Int(0b01); + assert_eq!(x, Int(0b01)); + + x |= Int(0b10); + assert_eq!(x, Int(0b11)); + + x ^= Int(0b01); + assert_eq!(x, Int(0b10)); + + x /= Int(2); + assert_eq!(x, Int(1)); + + x *= Int(3); + assert_eq!(x, Int(3)); + + x %= Int(2); + assert_eq!(x, Int(1)); + + // overloaded RHS + x <<= 1u8; + assert_eq!(x, Int(2)); + + x <<= 1u16; + assert_eq!(x, Int(4)); + + x >>= 1u8; + assert_eq!(x, Int(2)); + + x >>= 1u16; + assert_eq!(x, Int(1)); + + x -= Int(1); + assert_eq!(x, Int(0)); + + // indexed LHS + // FIXME(mir-drop): use the vec![..] macro + let mut v = Vec::new(); + v.push(Int(1)); + v.push(Int(2)); + v[0] += Int(2); + assert_eq!(v[0], Int(3)); + + // unsized RHS + let mut array = [0, 1, 2]; + *Slice::new(&mut array) += 1; + assert_eq!(array[0], 1); + assert_eq!(array[1], 2); + assert_eq!(array[2], 3); + +} + +impl AddAssign for Int { + fn add_assign(&mut self, rhs: Int) { + self.0 += rhs.0; + } +} + +impl BitAndAssign for Int { + fn bitand_assign(&mut self, rhs: Int) { + self.0 &= rhs.0; + } +} + +impl BitOrAssign for Int { + fn bitor_assign(&mut self, rhs: Int) { + self.0 |= rhs.0; + } +} + +impl BitXorAssign for Int { + fn bitxor_assign(&mut self, rhs: Int) { + self.0 ^= rhs.0; + } +} + +impl DivAssign for Int { + fn div_assign(&mut self, rhs: Int) { + self.0 /= rhs.0; + } +} + +impl MulAssign for Int { + fn mul_assign(&mut self, rhs: Int) { + self.0 *= rhs.0; + } +} + +impl RemAssign for Int { + fn rem_assign(&mut self, rhs: Int) { + self.0 %= rhs.0; + } +} + +impl ShlAssign for Int { + fn shl_assign(&mut self, rhs: u8) { + self.0 <<= rhs; + } +} + +impl ShlAssign for Int { + fn shl_assign(&mut self, rhs: u16) { + self.0 <<= rhs; + } +} + +impl ShrAssign for Int { + fn shr_assign(&mut self, rhs: u8) { + self.0 >>= rhs; + } +} + +impl ShrAssign for Int { + fn shr_assign(&mut self, rhs: u16) { + self.0 >>= rhs; + } +} + +impl SubAssign for Int { + fn sub_assign(&mut self, rhs: Int) { + self.0 -= rhs.0; + } +} + +impl AddAssign for Slice { + fn add_assign(&mut self, rhs: i32) { + for lhs in &mut self.0 { + *lhs += rhs; + } + } +} diff --git a/src/test/run-pass/mir/mir_autoderef.rs b/src/test/run-pass/mir/mir_autoderef.rs new file mode 100644 index 00000000000..c2d7e6d99ee --- /dev/null +++ b/src/test/run-pass/mir/mir_autoderef.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::{Deref, DerefMut}; + +pub struct MyRef(u32); + +impl Deref for MyRef { + type Target = u32; + fn deref(&self) -> &u32 { &self.0 } +} + +impl DerefMut for MyRef { + fn deref_mut(&mut self) -> &mut u32 { &mut self.0 } +} + + +fn deref(x: &MyRef) -> &u32 { + x +} + +fn deref_mut(x: &mut MyRef) -> &mut u32 { + x +} + +fn main() { + let mut r = MyRef(2); + assert_eq!(deref(&r) as *const _, &r.0 as *const _); + assert_eq!(deref_mut(&mut r) as *mut _, &mut r.0 as *mut _); +} diff --git a/src/test/run-pass/mir/mir_boxing.rs b/src/test/run-pass/mir/mir_boxing.rs new file mode 100644 index 00000000000..31b10975a4a --- /dev/null +++ b/src/test/run-pass/mir/mir_boxing.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn test() -> Box { + box 42 +} + +fn main() { + assert_eq!(*test(), 42); +} diff --git a/src/test/run-pass/mir/mir_build_match_comparisons.rs b/src/test/run-pass/mir/mir_build_match_comparisons.rs new file mode 100644 index 00000000000..45ac6566637 --- /dev/null +++ b/src/test/run-pass/mir/mir_build_match_comparisons.rs @@ -0,0 +1,68 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn test1(x: i8) -> i32 { + match x { + 1...10 => 0, + _ => 1, + } +} + +const U: Option = Some(10); +const S: &'static str = "hello"; + +fn test2(x: i8) -> i32 { + match Some(x) { + U => 0, + _ => 1, + } +} + +fn test3(x: &'static str) -> i32 { + match x { + S => 0, + _ => 1, + } +} + +enum Opt { + Some { v: T }, + None +} + +fn test4(x: u64) -> i32 { + let opt = Opt::Some{ v: x }; + match opt { + Opt::Some { v: 10 } => 0, + _ => 1, + } +} + + +fn main() { + assert_eq!(test1(0), 1); + assert_eq!(test1(1), 0); + assert_eq!(test1(2), 0); + assert_eq!(test1(5), 0); + assert_eq!(test1(9), 0); + assert_eq!(test1(10), 0); + assert_eq!(test1(11), 1); + assert_eq!(test1(20), 1); + assert_eq!(test2(10), 0); + assert_eq!(test2(0), 1); + assert_eq!(test2(20), 1); + assert_eq!(test3("hello"), 0); + assert_eq!(test3(""), 1); + assert_eq!(test3("world"), 1); + assert_eq!(test4(10), 0); + assert_eq!(test4(0), 1); + assert_eq!(test4(20), 1); +} diff --git a/src/test/run-pass/mir/mir_call_with_associated_type.rs b/src/test/run-pass/mir/mir_call_with_associated_type.rs new file mode 100644 index 00000000000..1d960d1b716 --- /dev/null +++ b/src/test/run-pass/mir/mir_call_with_associated_type.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Trait { + type Type; +} + +impl<'a> Trait for &'a () { + type Type = u32; +} + +fn foo<'a>(t: <&'a () as Trait>::Type) -> <&'a () as Trait>::Type { + t +} + +fn main() { + assert_eq!(foo(4), 4); +} diff --git a/src/test/run-pass/mir/mir_calls_to_shims.rs b/src/test/run-pass/mir/mir_calls_to_shims.rs new file mode 100644 index 00000000000..d9cdec40694 --- /dev/null +++ b/src/test/run-pass/mir/mir_calls_to_shims.rs @@ -0,0 +1,59 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default + +#![feature(fn_traits)] +#![feature(never_type)] + +use std::panic; + +fn foo(x: u32, y: u32) -> u32 { x/y } +fn foo_diverges() -> ! { panic!() } + +fn test_fn_ptr(mut t: T) + where T: Fn(u32, u32) -> u32, +{ + let as_fn = >::call; + assert_eq!(as_fn(&t, (9, 3)), 3); + let as_fn_mut = >::call_mut; + assert_eq!(as_fn_mut(&mut t, (18, 3)), 6); + let as_fn_once = >::call_once; + assert_eq!(as_fn_once(t, (24, 3)), 8); +} + +fn assert_panics(f: F) where F: FnOnce() { + let f = panic::AssertUnwindSafe(f); + let result = panic::catch_unwind(move || { + f.0() + }); + if let Ok(..) = result { + panic!("diverging function returned"); + } +} + +fn test_fn_ptr_panic(mut t: T) + where T: Fn() -> ! +{ + let as_fn = >::call; + assert_panics(|| as_fn(&t, ())); + let as_fn_mut = >::call_mut; + assert_panics(|| as_fn_mut(&mut t, ())); + let as_fn_once = >::call_once; + assert_panics(|| as_fn_once(t, ())); +} + +fn main() { + test_fn_ptr(foo); + test_fn_ptr(foo as fn(u32, u32) -> u32); + test_fn_ptr_panic(foo_diverges); + test_fn_ptr_panic(foo_diverges as fn() -> !); +} diff --git a/src/test/run-pass/mir/mir_cast_fn_ret.rs b/src/test/run-pass/mir/mir_cast_fn_ret.rs new file mode 100644 index 00000000000..d2d29120855 --- /dev/null +++ b/src/test/run-pass/mir/mir_cast_fn_ret.rs @@ -0,0 +1,31 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub extern "C" fn tuple2() -> (u16, u8) { + (1, 2) +} + +pub extern "C" fn tuple3() -> (u8, u8, u8) { + (1, 2, 3) +} + +pub fn test2() -> u8 { + tuple2().1 +} + +pub fn test3() -> u8 { + tuple3().2 +} + +fn main() { + assert_eq!(test2(), 2); + assert_eq!(test3(), 3); +} diff --git a/src/test/run-pass/mir/mir_codegen_array.rs b/src/test/run-pass/mir/mir_codegen_array.rs new file mode 100644 index 00000000000..a0cd3c8dd12 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_array.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn into_inner() -> [u64; 1024] { + let mut x = 10 + 20; + [x; 1024] +} + +fn main(){ + let x: &[u64] = &[30; 1024]; + assert_eq!(&into_inner()[..], x); +} diff --git a/src/test/run-pass/mir/mir_codegen_array_2.rs b/src/test/run-pass/mir/mir_codegen_array_2.rs new file mode 100644 index 00000000000..2734bc71b58 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_array_2.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn into_inner(x: u64) -> [u64; 1024] { + [x; 2*4*8*16] +} + +fn main(){ + let x: &[u64] = &[42; 1024]; + assert_eq!(&into_inner(42)[..], x); +} diff --git a/src/test/run-pass/mir/mir_codegen_call_converging.rs b/src/test/run-pass/mir/mir_codegen_call_converging.rs new file mode 100644 index 00000000000..d7bce4d5be3 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_call_converging.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn converging_fn() -> u64 { + 43 +} + +fn mir() -> u64 { + let x; + loop { + x = converging_fn(); + break; + } + x +} + +fn main() { + assert_eq!(mir(), 43); +} diff --git a/src/test/run-pass/mir/mir_codegen_calls.rs b/src/test/run-pass/mir/mir_codegen_calls.rs new file mode 100644 index 00000000000..33ffab40428 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_calls.rs @@ -0,0 +1,201 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(fn_traits, test)] + +extern crate test; + +fn test1(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) { + // Test passing a number of arguments including a fat pointer. + // Also returning via an out pointer + fn callee(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) { + (a, b, c) + } + callee(a, b, c) +} + +fn test2(a: isize) -> isize { + // Test passing a single argument. + // Not using out pointer. + fn callee(a: isize) -> isize { + a + } + callee(a) +} + +#[derive(PartialEq, Eq, Debug)] +struct Foo; +impl Foo { + fn inherent_method(&self, a: isize) -> isize { a } +} + +fn test3(x: &Foo, a: isize) -> isize { + // Test calling inherent method + x.inherent_method(a) +} + +trait Bar { + fn extension_method(&self, a: isize) -> isize { a } +} +impl Bar for Foo {} + +fn test4(x: &Foo, a: isize) -> isize { + // Test calling extension method + x.extension_method(a) +} + +fn test5(x: &Bar, a: isize) -> isize { + // Test calling method on trait object + x.extension_method(a) +} + +fn test6(x: &T, a: isize) -> isize { + // Test calling extension method on generic callee + x.extension_method(a) +} + +trait One { + fn one() -> T; +} +impl One for isize { + fn one() -> isize { 1 } +} + +fn test7() -> isize { + // Test calling trait static method + ::one() +} + +struct Two; +impl Two { + fn two() -> isize { 2 } +} + +fn test8() -> isize { + // Test calling impl static method + Two::two() +} + +extern fn simple_extern(x: u32, y: (u32, u32)) -> u32 { + x + y.0 * y.1 +} + +fn test9() -> u32 { + simple_extern(41, (42, 43)) +} + +fn test_closure(f: &F, x: i32, y: i32) -> i32 + where F: Fn(i32, i32) -> i32 +{ + f(x, y) +} + +fn test_fn_object(f: &Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { + f(x, y) +} + +fn test_fn_impl(f: &&Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { + // This call goes through the Fn implementation for &Fn provided in + // core::ops::impls. It expands to a static Fn::call() that calls the + // Fn::call() implementation of the object shim underneath. + f(x, y) +} + +fn test_fn_direct_call(f: &F, x: i32, y: i32) -> i32 + where F: Fn(i32, i32) -> i32 +{ + f.call((x, y)) +} + +fn test_fn_const_call(f: &F) -> i32 + where F: Fn(i32, i32) -> i32 +{ + f.call((100, -1)) +} + +fn test_fn_nil_call(f: &F) -> i32 + where F: Fn() -> i32 +{ + f() +} + +fn test_fn_transmute_zst(x: ()) -> [(); 1] { + fn id(x: T) -> T {x} + + id(unsafe { + std::mem::transmute(x) + }) +} + +fn test_fn_ignored_pair() -> ((), ()) { + ((), ()) +} + +fn test_fn_ignored_pair_0() { + test_fn_ignored_pair().0 +} + +fn id(x: T) -> T { x } + +fn ignored_pair_named() -> (Foo, Foo) { + (Foo, Foo) +} + +fn test_fn_ignored_pair_named() -> (Foo, Foo) { + id(ignored_pair_named()) +} + +fn test_fn_nested_pair(x: &((f32, f32), u32)) -> (f32, f32) { + let y = *x; + let z = y.0; + (z.0, z.1) +} + +fn test_fn_const_arg_by_ref(mut a: [u64; 4]) -> u64 { + // Mutate the by-reference argument, which won't work with + // a non-immediate constant unless it's copied to the stack. + let a = test::black_box(&mut a); + a[0] += a[1]; + a[0] += a[2]; + a[0] += a[3]; + a[0] +} + +fn main() { + assert_eq!(test1(1, (2, 3), &[4, 5, 6]), (1, (2, 3), &[4, 5, 6][..])); + assert_eq!(test2(98), 98); + assert_eq!(test3(&Foo, 42), 42); + assert_eq!(test4(&Foo, 970), 970); + assert_eq!(test5(&Foo, 8576), 8576); + assert_eq!(test6(&Foo, 12367), 12367); + assert_eq!(test7(), 1); + assert_eq!(test8(), 2); + assert_eq!(test9(), 41 + 42 * 43); + + let r = 3; + let closure = |x: i32, y: i32| { r*(x + (y*2)) }; + assert_eq!(test_fn_const_call(&closure), 294); + assert_eq!(test_closure(&closure, 100, 1), 306); + let function_object = &closure as &Fn(i32, i32) -> i32; + assert_eq!(test_fn_object(function_object, 100, 2), 312); + assert_eq!(test_fn_impl(&function_object, 100, 3), 318); + assert_eq!(test_fn_direct_call(&closure, 100, 4), 324); + + assert_eq!(test_fn_nil_call(&(|| 42)), 42); + assert_eq!(test_fn_transmute_zst(()), [()]); + + assert_eq!(test_fn_ignored_pair_0(), ()); + assert_eq!(test_fn_ignored_pair_named(), (Foo, Foo)); + assert_eq!(test_fn_nested_pair(&((1.0, 2.0), 0)), (1.0, 2.0)); + + const ARRAY: [u64; 4] = [1, 2, 3, 4]; + assert_eq!(test_fn_const_arg_by_ref(ARRAY), 1 + 2 + 3 + 4); +} diff --git a/src/test/run-pass/mir/mir_codegen_calls_variadic.rs b/src/test/run-pass/mir/mir_codegen_calls_variadic.rs new file mode 100644 index 00000000000..ee32f2d0e0f --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_calls_variadic.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + fn rust_interesting_average(_: i64, ...) -> f64; +} + +fn test(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 { + unsafe { + rust_interesting_average(6, a, a as f64, + b, b as f64, + c, c as f64, + d, d as f64, + e, e as f64, + f, g) as i64 + } +} + +fn main(){ + assert_eq!(test(10, 20, 30, 40, 50, 60_i64, 60.0_f64), 70); +} diff --git a/src/test/run-pass/mir/mir_codegen_critical_edge.rs b/src/test/run-pass/mir/mir_codegen_critical_edge.rs new file mode 100644 index 00000000000..48a5d6ab0f0 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_critical_edge.rs @@ -0,0 +1,53 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This code produces a CFG with critical edges that, if we don't +// handle properly, will cause invalid codegen. + +#![feature(rustc_attrs)] + +enum State { + Both, + Front, + Back +} + +pub struct Foo { + state: State, + a: A, + b: B +} + +impl Foo +where A: Iterator, B: Iterator +{ + // This is the function we care about + fn next(&mut self) -> Option { + match self.state { + State::Both => match self.a.next() { + elt @ Some(..) => elt, + None => { + self.state = State::Back; + self.b.next() + } + }, + State::Front => self.a.next(), + State::Back => self.b.next(), + } + } +} + +// Make sure we actually codegen a version of the function +pub fn do_stuff(mut f: Foo>, Box>>) { + let _x = f.next(); +} + +fn main() {} diff --git a/src/test/run-pass/mir/mir_codegen_spike1.rs b/src/test/run-pass/mir/mir_codegen_spike1.rs new file mode 100644 index 00000000000..0317aa0b509 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_spike1.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A simple spike test for MIR version of codegen. + +fn sum(x: i32, y: i32) -> i32 { + x + y +} + +fn main() { + let x = sum(22, 44); + assert_eq!(x, 66); + println!("sum()={:?}", x); +} diff --git a/src/test/run-pass/mir/mir_codegen_switch.rs b/src/test/run-pass/mir/mir_codegen_switch.rs new file mode 100644 index 00000000000..d793337925d --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_switch.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Abc { + A(u8), + B(i8), + C, + D, +} + +fn foo(x: Abc) -> i32 { + match x { + Abc::C => 3, + Abc::D => 4, + Abc::B(_) => 2, + Abc::A(_) => 1, + } +} + +fn foo2(x: Abc) -> bool { + match x { + Abc::D => true, + _ => false + } +} + +fn main() { + assert_eq!(1, foo(Abc::A(42))); + assert_eq!(2, foo(Abc::B(-100))); + assert_eq!(3, foo(Abc::C)); + assert_eq!(4, foo(Abc::D)); + + assert_eq!(false, foo2(Abc::A(1))); + assert_eq!(false, foo2(Abc::B(2))); + assert_eq!(false, foo2(Abc::C)); + assert_eq!(true, foo2(Abc::D)); +} diff --git a/src/test/run-pass/mir/mir_codegen_switchint.rs b/src/test/run-pass/mir/mir_codegen_switchint.rs new file mode 100644 index 00000000000..ef0a98a6e70 --- /dev/null +++ b/src/test/run-pass/mir/mir_codegen_switchint.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn foo(x: i8) -> i32 { + match x { + 1 => 0, + _ => 1, + } +} + +fn main() { + assert_eq!(foo(0), 1); + assert_eq!(foo(1), 0); +} diff --git a/src/test/run-pass/mir/mir_coercion_casts.rs b/src/test/run-pass/mir/mir_coercion_casts.rs new file mode 100644 index 00000000000..3de87029e0f --- /dev/null +++ b/src/test/run-pass/mir/mir_coercion_casts.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests the coercion casts are handled properly + +fn main() { + // This should produce only a reification of f, + // not a fn -> fn cast as well + let _ = f as fn(&()); +} + +fn f<'a>(_: &'a ()) { } diff --git a/src/test/run-pass/mir/mir_coercions.rs b/src/test/run-pass/mir/mir_coercions.rs new file mode 100644 index 00000000000..79a8030e9b5 --- /dev/null +++ b/src/test/run-pass/mir/mir_coercions.rs @@ -0,0 +1,81 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(coerce_unsized, unsize)] + +use std::ops::CoerceUnsized; +use std::marker::Unsize; + +fn identity_coercion(x: &(Fn(u32)->u32 + Send)) -> &Fn(u32)->u32 { + x +} +fn fn_coercions(f: &fn(u32) -> u32) -> + (unsafe fn(u32) -> u32, + &(Fn(u32) -> u32+Send)) +{ + (*f, f) +} + +fn simple_array_coercion(x: &[u8; 3]) -> &[u8] { x } + +fn square(a: u32) -> u32 { a * a } + +#[derive(PartialEq,Eq)] +struct PtrWrapper<'a, T: 'a+?Sized>(u32, u32, (), &'a T); +impl<'a, T: ?Sized+Unsize, U: ?Sized> + CoerceUnsized> for PtrWrapper<'a, T> {} + +struct TrivPtrWrapper<'a, T: 'a+?Sized>(&'a T); +impl<'a, T: ?Sized+Unsize, U: ?Sized> + CoerceUnsized> for TrivPtrWrapper<'a, T> {} + +fn coerce_ptr_wrapper(p: PtrWrapper<[u8; 3]>) -> PtrWrapper<[u8]> { + p +} + +fn coerce_triv_ptr_wrapper(p: TrivPtrWrapper<[u8; 3]>) -> TrivPtrWrapper<[u8]> { + p +} + +fn coerce_fat_ptr_wrapper(p: PtrWrapper u32+Send>) + -> PtrWrapper u32> { + p +} + +fn coerce_ptr_wrapper_poly<'a, T, Trait: ?Sized>(p: PtrWrapper<'a, T>) + -> PtrWrapper<'a, Trait> + where PtrWrapper<'a, T>: CoerceUnsized> +{ + p +} + +fn main() { + let a = [0,1,2]; + let square_local : fn(u32) -> u32 = square; + let (f,g) = fn_coercions(&square_local); + assert_eq!(f as usize, square as usize); + assert_eq!(g(4), 16); + assert_eq!(identity_coercion(g)(5), 25); + + assert_eq!(simple_array_coercion(&a), &a); + let w = coerce_ptr_wrapper(PtrWrapper(2,3,(),&a)); + assert!(w == PtrWrapper(2,3,(),&a) as PtrWrapper<[u8]>); + + let w = coerce_triv_ptr_wrapper(TrivPtrWrapper(&a)); + assert_eq!(&w.0, &a); + + let z = coerce_fat_ptr_wrapper(PtrWrapper(2,3,(),&square_local)); + assert_eq!((z.3)(6), 36); + + let z: PtrWrapper u32> = + coerce_ptr_wrapper_poly(PtrWrapper(2,3,(),&square_local)); + assert_eq!((z.3)(6), 36); +} diff --git a/src/test/run-pass/mir/mir_constval_adts.rs b/src/test/run-pass/mir/mir_constval_adts.rs new file mode 100644 index 00000000000..d35dd9c441b --- /dev/null +++ b/src/test/run-pass/mir/mir_constval_adts.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Point { + _x: i32, + _y: i32, +} + +#[derive(PartialEq, Eq, Debug)] +struct Newtype(T); + +const STRUCT: Point = Point { _x: 42, _y: 42 }; +const TUPLE1: (i32, i32) = (42, 42); +const TUPLE2: (&'static str, &'static str) = ("hello","world"); +const PAIR_NEWTYPE: (Newtype, Newtype) = (Newtype(42), Newtype(42)); + +fn mir() -> (Point, (i32, i32), (&'static str, &'static str), (Newtype, Newtype)) { + let struct1 = STRUCT; + let tuple1 = TUPLE1; + let tuple2 = TUPLE2; + let pair_newtype = PAIR_NEWTYPE; + (struct1, tuple1, tuple2, pair_newtype) +} + +const NEWTYPE: Newtype<&'static str> = Newtype("foobar"); + +fn test_promoted_newtype_str_ref() { + let x = &NEWTYPE; + assert_eq!(x, &Newtype("foobar")); +} + +fn main(){ + assert_eq!(mir(), (STRUCT, TUPLE1, TUPLE2, PAIR_NEWTYPE)); + test_promoted_newtype_str_ref(); +} + diff --git a/src/test/run-pass/mir/mir_drop_order.rs b/src/test/run-pass/mir/mir_drop_order.rs new file mode 100644 index 00000000000..abc21eee636 --- /dev/null +++ b/src/test/run-pass/mir/mir_drop_order.rs @@ -0,0 +1,58 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default + +use std::cell::RefCell; +use std::panic; + +pub struct DropLogger<'a> { + id: usize, + log: &'a panic::AssertUnwindSafe>> +} + +impl<'a> Drop for DropLogger<'a> { + fn drop(&mut self) { + self.log.0.borrow_mut().push(self.id); + } +} + +struct InjectedFailure; + +#[allow(unreachable_code)] +fn main() { + let log = panic::AssertUnwindSafe(RefCell::new(vec![])); + let d = |id| DropLogger { id: id, log: &log }; + let get = || -> Vec<_> { + let mut m = log.0.borrow_mut(); + let n = m.drain(..); + n.collect() + }; + + { + let _x = (d(0), &d(1), d(2), &d(3)); + // all borrows are extended - nothing has been dropped yet + assert_eq!(get(), vec![]); + } + // in a let-statement, extended places are dropped + // *after* the let result (tho they have the same scope + // as far as scope-based borrowck goes). + assert_eq!(get(), vec![0, 2, 3, 1]); + + let _ = std::panic::catch_unwind(|| { + (d(4), &d(5), d(6), &d(7), panic!(InjectedFailure)); + }); + + // here, the temporaries (5/7) live until the end of the + // containing statement, which is destroyed after the operands + // (4/6) on a panic. + assert_eq!(get(), vec![6, 4, 7, 5]); +} diff --git a/src/test/run-pass/mir/mir_early_return_scope.rs b/src/test/run-pass/mir/mir_early_return_scope.rs new file mode 100644 index 00000000000..27b90722328 --- /dev/null +++ b/src/test/run-pass/mir/mir_early_return_scope.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +static mut DROP: bool = false; + +struct ConnWrap(Conn); +impl ::std::ops::Deref for ConnWrap { + type Target=Conn; + fn deref(&self) -> &Conn { &self.0 } +} + +struct Conn; +impl Drop for Conn { + fn drop(&mut self) { unsafe { DROP = true; } } +} + +fn inner() { + let conn = &*match Some(ConnWrap(Conn)) { + Some(val) => val, + None => return, + }; + return; +} + +fn main() { + inner(); + unsafe { + assert_eq!(DROP, true); + } +} diff --git a/src/test/run-pass/mir/mir_fat_ptr.rs b/src/test/run-pass/mir/mir_fat_ptr.rs new file mode 100644 index 00000000000..b3facb3b4c4 --- /dev/null +++ b/src/test/run-pass/mir/mir_fat_ptr.rs @@ -0,0 +1,62 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// test that ordinary fat pointer operations work. + +struct Wrapper(u32, T); + +struct FatPtrContainer<'a> { + ptr: &'a [u8] +} + +fn fat_ptr_project(a: &Wrapper<[u8]>) -> &[u8] { + &a.1 +} + +fn fat_ptr_simple(a: &[u8]) -> &[u8] { + a +} + +fn fat_ptr_via_local(a: &[u8]) -> &[u8] { + let x = a; + x +} + +fn fat_ptr_from_struct(s: FatPtrContainer) -> &[u8] { + s.ptr +} + +fn fat_ptr_to_struct(a: &[u8]) -> FatPtrContainer { + FatPtrContainer { ptr: a } +} + +fn fat_ptr_store_to<'a>(a: &'a [u8], b: &mut &'a [u8]) { + *b = a; +} + +fn fat_ptr_constant() -> &'static str { + "HELLO" +} + +fn main() { + let a = Wrapper(4, [7,6,5]); + + let p = fat_ptr_project(&a); + let p = fat_ptr_simple(p); + let p = fat_ptr_via_local(p); + let p = fat_ptr_from_struct(fat_ptr_to_struct(p)); + + let mut target : &[u8] = &[42]; + fat_ptr_store_to(p, &mut target); + assert_eq!(target, &a.1); + + assert_eq!(fat_ptr_constant(), "HELLO"); +} diff --git a/src/test/run-pass/mir/mir_fat_ptr_drop.rs b/src/test/run-pass/mir/mir_fat_ptr_drop.rs new file mode 100644 index 00000000000..84528b3296a --- /dev/null +++ b/src/test/run-pass/mir/mir_fat_ptr_drop.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// test that ordinary fat pointer operations work. + +#![feature(braced_empty_structs)] +#![feature(rustc_attrs)] + +use std::sync::atomic; +use std::sync::atomic::Ordering::SeqCst; + +static COUNTER: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT; + +struct DropMe { +} + +impl Drop for DropMe { + fn drop(&mut self) { + COUNTER.fetch_add(1, SeqCst); + } +} + +fn fat_ptr_move_then_drop(a: Box<[DropMe]>) { + let b = a; +} + +fn main() { + let a: Box<[DropMe]> = Box::new([DropMe { }]); + fat_ptr_move_then_drop(a); + assert_eq!(COUNTER.load(SeqCst), 1); +} diff --git a/src/test/run-pass/mir/mir_heavy_promoted.rs b/src/test/run-pass/mir/mir_heavy_promoted.rs new file mode 100644 index 00000000000..2f788f1408d --- /dev/null +++ b/src/test/run-pass/mir/mir_heavy_promoted.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten apparently only works in optimized mode + +const TEST_DATA: [u8; 32 * 1024 * 1024] = [42; 32 * 1024 * 1024]; + +// Check that the promoted copy of TEST_DATA doesn't +// leave an alloca from an unused temp behind, which, +// without optimizations, can still blow the stack. +fn main() { + println!("{}", TEST_DATA.len()); +} diff --git a/src/test/run-pass/mir/mir_match_arm_guard.rs b/src/test/run-pass/mir/mir_match_arm_guard.rs new file mode 100644 index 00000000000..b53f8535079 --- /dev/null +++ b/src/test/run-pass/mir/mir_match_arm_guard.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #30527 - We were not generating arms with guards in certain cases. + +fn match_with_guard(x: Option) -> i8 { + match x { + Some(xyz) if xyz > 100 => 0, + Some(_) => -1, + None => -2 + } +} + +fn main() { + assert_eq!(match_with_guard(Some(111)), 0); + assert_eq!(match_with_guard(Some(2)), -1); + assert_eq!(match_with_guard(None), -2); +} diff --git a/src/test/run-pass/mir/mir_misc_casts.rs b/src/test/run-pass/mir/mir_misc_casts.rs new file mode 100644 index 00000000000..081814edcd1 --- /dev/null +++ b/src/test/run-pass/mir/mir_misc_casts.rs @@ -0,0 +1,330 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn func(){} + +const STR: &'static str = "hello"; +const BSTR: &'static [u8; 5] = b"hello"; + +fn from_ptr() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, *const ()) { + let f = 1_usize as *const String; + let c1 = f as isize; + let c2 = f as usize; + let c3 = f as i8; + let c4 = f as i16; + let c5 = f as i32; + let c6 = f as i64; + let c7 = f as u8; + let c8 = f as u16; + let c9 = f as u32; + let c10 = f as u64; + let c11 = f as *const (); + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11) +} + +fn from_1() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1 as isize; + let c2 = 1 as usize; + let c3 = 1 as i8; + let c4 = 1 as i16; + let c5 = 1 as i32; + let c6 = 1 as i64; + let c7 = 1 as u8; + let c8 = 1 as u16; + let c9 = 1 as u32; + let c10 = 1 as u64; + let c11 = 1 as f32; + let c12 = 1 as f64; + let c13 = 1 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1usize() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_usize as isize; + let c2 = 1_usize as usize; + let c3 = 1_usize as i8; + let c4 = 1_usize as i16; + let c5 = 1_usize as i32; + let c6 = 1_usize as i64; + let c7 = 1_usize as u8; + let c8 = 1_usize as u16; + let c9 = 1_usize as u32; + let c10 = 1_usize as u64; + let c11 = 1_usize as f32; + let c12 = 1_usize as f64; + let c13 = 1_usize as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1isize() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_isize as isize; + let c2 = 1_isize as usize; + let c3 = 1_isize as i8; + let c4 = 1_isize as i16; + let c5 = 1_isize as i32; + let c6 = 1_isize as i64; + let c7 = 1_isize as u8; + let c8 = 1_isize as u16; + let c9 = 1_isize as u32; + let c10 = 1_isize as u64; + let c11 = 1_isize as f32; + let c12 = 1_isize as f64; + let c13 = 1_isize as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1u8() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_u8 as isize; + let c2 = 1_u8 as usize; + let c3 = 1_u8 as i8; + let c4 = 1_u8 as i16; + let c5 = 1_u8 as i32; + let c6 = 1_u8 as i64; + let c7 = 1_u8 as u8; + let c8 = 1_u8 as u16; + let c9 = 1_u8 as u32; + let c10 = 1_u8 as u64; + let c11 = 1_u8 as f32; + let c12 = 1_u8 as f64; + let c13 = 1_u8 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1i8() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_i8 as isize; + let c2 = 1_i8 as usize; + let c3 = 1_i8 as i8; + let c4 = 1_i8 as i16; + let c5 = 1_i8 as i32; + let c6 = 1_i8 as i64; + let c7 = 1_i8 as u8; + let c8 = 1_i8 as u16; + let c9 = 1_i8 as u32; + let c10 = 1_i8 as u64; + let c11 = 1_i8 as f32; + let c12 = 1_i8 as f64; + let c13 = 1_i8 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1u16() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_u16 as isize; + let c2 = 1_u16 as usize; + let c3 = 1_u16 as i8; + let c4 = 1_u16 as i16; + let c5 = 1_u16 as i32; + let c6 = 1_u16 as i64; + let c7 = 1_u16 as u8; + let c8 = 1_u16 as u16; + let c9 = 1_u16 as u32; + let c10 = 1_u16 as u64; + let c11 = 1_u16 as f32; + let c12 = 1_u16 as f64; + let c13 = 1_u16 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1i16() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_i16 as isize; + let c2 = 1_i16 as usize; + let c3 = 1_i16 as i8; + let c4 = 1_i16 as i16; + let c5 = 1_i16 as i32; + let c6 = 1_i16 as i64; + let c7 = 1_i16 as u8; + let c8 = 1_i16 as u16; + let c9 = 1_i16 as u32; + let c10 = 1_i16 as u64; + let c11 = 1_i16 as f32; + let c12 = 1_i16 as f64; + let c13 = 1_i16 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1u32() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_u32 as isize; + let c2 = 1_u32 as usize; + let c3 = 1_u32 as i8; + let c4 = 1_u32 as i16; + let c5 = 1_u32 as i32; + let c6 = 1_u32 as i64; + let c7 = 1_u32 as u8; + let c8 = 1_u32 as u16; + let c9 = 1_u32 as u32; + let c10 = 1_u32 as u64; + let c11 = 1_u32 as f32; + let c12 = 1_u32 as f64; + let c13 = 1_u32 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1i32() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_i32 as isize; + let c2 = 1_i32 as usize; + let c3 = 1_i32 as i8; + let c4 = 1_i32 as i16; + let c5 = 1_i32 as i32; + let c6 = 1_i32 as i64; + let c7 = 1_i32 as u8; + let c8 = 1_i32 as u16; + let c9 = 1_i32 as u32; + let c10 = 1_i32 as u64; + let c11 = 1_i32 as f32; + let c12 = 1_i32 as f64; + let c13 = 1_i32 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1u64() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_u64 as isize; + let c2 = 1_u64 as usize; + let c3 = 1_u64 as i8; + let c4 = 1_u64 as i16; + let c5 = 1_u64 as i32; + let c6 = 1_u64 as i64; + let c7 = 1_u64 as u8; + let c8 = 1_u64 as u16; + let c9 = 1_u64 as u32; + let c10 = 1_u64 as u64; + let c11 = 1_u64 as f32; + let c12 = 1_u64 as f64; + let c13 = 1_u64 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_1i64() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { + let c1 = 1_i64 as isize; + let c2 = 1_i64 as usize; + let c3 = 1_i64 as i8; + let c4 = 1_i64 as i16; + let c5 = 1_i64 as i32; + let c6 = 1_i64 as i64; + let c7 = 1_i64 as u8; + let c8 = 1_i64 as u16; + let c9 = 1_i64 as u32; + let c10 = 1_i64 as u64; + let c11 = 1_i64 as f32; + let c12 = 1_i64 as f64; + let c13 = 1_i64 as *const String; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) +} + +fn from_bool() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64) { + let c1 = true as isize; + let c2 = true as usize; + let c3 = true as i8; + let c4 = true as i16; + let c5 = true as i32; + let c6 = true as i64; + let c7 = true as u8; + let c8 = true as u16; + let c9 = true as u32; + let c10 = true as u64; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) +} + +fn from_1f32() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64) { + let c1 = 1.0_f32 as isize; + let c2 = 1.0_f32 as usize; + let c3 = 1.0_f32 as i8; + let c4 = 1.0_f32 as i16; + let c5 = 1.0_f32 as i32; + let c6 = 1.0_f32 as i64; + let c7 = 1.0_f32 as u8; + let c8 = 1.0_f32 as u16; + let c9 = 1.0_f32 as u32; + let c10 = 1.0_f32 as u64; + let c11 = 1.0_f32 as f32; + let c12 = 1.0_f32 as f64; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) +} + +fn from_1f64() +-> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64) { + let c1 = 1.0f64 as isize; + let c2 = 1.0f64 as usize; + let c3 = 1.0f64 as i8; + let c4 = 1.0f64 as i16; + let c5 = 1.0f64 as i32; + let c6 = 1.0f64 as i64; + let c7 = 1.0f64 as u8; + let c8 = 1.0f64 as u16; + let c9 = 1.0f64 as u32; + let c10 = 1.0f64 as u64; + let c11 = 1.0f64 as f32; + let c12 = 1.0f64 as f64; + (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) +} + +fn other_casts() +-> (*const u8, *const isize, *const u8, *const u8) { + let c1 = func as *const u8; + let c2 = c1 as *const isize; + + let r = &42u32; + let _ = r as *const u32; + + // fat-ptr -> fat-ptr -> fat-raw-ptr -> thin-ptr + let c3 = STR as &str as *const str as *const u8; + + let c4 = BSTR as *const [u8] as *const [u16] as *const u8; + (c1, c2, c3, c4) +} + +pub fn assert_eq_13(l: (isize, usize, i8, i16, i32, i64, u8, + u16, u32, u64, f32, f64, *const String), + r: (isize, usize, i8, i16, i32, i64, u8, + u16, u32, u64, f32, f64, *const String)) -> bool { + let (l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13) = l; + let (r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13) = r; + l1 == r1 && l2 == r2 && l3 == r3 && l4 == r4 && l5 == r5 && l6 == r6 && l7 == r7 && + l8 == r8 && l9 == r9 && l10 == r10 && l11 == r11 && l12 == r12 && l13 == r13 +} + + +pub fn main() { + let f = 1_usize as *const String; + let t13 = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, f); + let t12 = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0); + assert_eq_13(from_1(), t13); + assert_eq_13(from_1usize(), t13); + assert_eq_13(from_1isize(), t13); + assert_eq_13(from_1u8(), t13); + assert_eq_13(from_1i8(), t13); + assert_eq_13(from_1u16(), t13); + assert_eq_13(from_1i16(), t13); + assert_eq_13(from_1u32(), t13); + assert_eq_13(from_1i32(), t13); + assert_eq_13(from_1u64(), t13); + assert_eq_13(from_1i64(), t13); + assert_eq!(from_1f32(), t12); + assert_eq!(from_1f64(), t12); + + assert_eq!(from_ptr(), (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 as *const ())); + assert_eq!(from_bool(), (1, 1, 1, 1, 1, 1, 1, 1, 1, 1)); + + assert_eq!(other_casts(), (func as *const u8, func as *const isize, + STR as *const str as *const u8, BSTR as *const [u8] as *const u8)); +} diff --git a/src/test/run-pass/mir/mir_overflow_off.rs b/src/test/run-pass/mir/mir_overflow_off.rs new file mode 100644 index 00000000000..9d6624b53d0 --- /dev/null +++ b/src/test/run-pass/mir/mir_overflow_off.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z force-overflow-checks=off + +// Test that with MIR codegen, overflow checks can be +// turned off, even when they're from core::ops::*. + +use std::ops::*; + +fn main() { + assert_eq!(i8::neg(-0x80), -0x80); + + assert_eq!(u8::add(0xff, 1), 0_u8); + assert_eq!(u8::sub(0, 1), 0xff_u8); + assert_eq!(u8::mul(0xff, 2), 0xfe_u8); + assert_eq!(u8::shl(1, 9), 2_u8); + assert_eq!(u8::shr(2, 9), 1_u8); +} diff --git a/src/test/run-pass/mir/mir_raw_fat_ptr.rs b/src/test/run-pass/mir/mir_raw_fat_ptr.rs new file mode 100644 index 00000000000..b5ae15b2ce1 --- /dev/null +++ b/src/test/run-pass/mir/mir_raw_fat_ptr.rs @@ -0,0 +1,168 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// check raw fat pointer ops in mir +// FIXME: please improve this when we get monomorphization support + +use std::mem; + +#[derive(Debug, PartialEq, Eq)] +struct ComparisonResults { + lt: bool, + le: bool, + gt: bool, + ge: bool, + eq: bool, + ne: bool +} + +const LT: ComparisonResults = ComparisonResults { + lt: true, + le: true, + gt: false, + ge: false, + eq: false, + ne: true +}; + +const EQ: ComparisonResults = ComparisonResults { + lt: false, + le: true, + gt: false, + ge: true, + eq: true, + ne: false +}; + +const GT: ComparisonResults = ComparisonResults { + lt: false, + le: false, + gt: true, + ge: true, + eq: false, + ne: true +}; + +fn compare_su8(a: *const S<[u8]>, b: *const S<[u8]>) -> ComparisonResults { + ComparisonResults { + lt: a < b, + le: a <= b, + gt: a > b, + ge: a >= b, + eq: a == b, + ne: a != b + } +} + +fn compare_au8(a: *const [u8], b: *const [u8]) -> ComparisonResults { + ComparisonResults { + lt: a < b, + le: a <= b, + gt: a > b, + ge: a >= b, + eq: a == b, + ne: a != b + } +} + +fn compare_foo<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> ComparisonResults { + ComparisonResults { + lt: a < b, + le: a <= b, + gt: a > b, + ge: a >= b, + eq: a == b, + ne: a != b + } +} + +fn simple_eq<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> bool { + let result = a == b; + result +} + +fn assert_inorder(a: &[T], + compare: fn(T, T) -> ComparisonResults) { + for i in 0..a.len() { + for j in 0..a.len() { + let cres = compare(a[i], a[j]); + if i < j { + assert_eq!(cres, LT); + } else if i == j { + assert_eq!(cres, EQ); + } else { + assert_eq!(cres, GT); + } + } + } +} + +trait Foo { fn foo(&self) -> usize; } +impl Foo for T { + fn foo(&self) -> usize { + mem::size_of::() + } +} + +struct S(u32, T); + +fn main() { + let array = [0,1,2,3,4]; + let array2 = [5,6,7,8,9]; + + // fat ptr comparison: addr then extra + + // check ordering for arrays + let mut ptrs: Vec<*const [u8]> = vec![ + &array[0..0], &array[0..1], &array, &array[1..] + ]; + + let array_addr = &array as *const [u8] as *const u8 as usize; + let array2_addr = &array2 as *const [u8] as *const u8 as usize; + if array2_addr < array_addr { + ptrs.insert(0, &array2); + } else { + ptrs.push(&array2); + } + assert_inorder(&ptrs, compare_au8); + + let u8_ = (0u8, 1u8); + let u32_ = (4u32, 5u32); + + // check ordering for ptrs + let buf: &mut [*const Foo] = &mut [ + &u8_, &u8_.0, + &u32_, &u32_.0, + ]; + buf.sort_by(|u,v| { + let u : [*const (); 2] = unsafe { mem::transmute(*u) }; + let v : [*const (); 2] = unsafe { mem::transmute(*v) }; + u.cmp(&v) + }); + assert_inorder(buf, compare_foo); + + // check ordering for structs containing arrays + let ss: (S<[u8; 2]>, + S<[u8; 3]>, + S<[u8; 2]>) = ( + S(7, [8, 9]), + S(10, [11, 12, 13]), + S(4, [5, 6]) + ); + assert_inorder(&[ + &ss.0 as *const S<[u8]>, + &ss.1 as *const S<[u8]>, + &ss.2 as *const S<[u8]> + ], compare_su8); + + assert!(simple_eq(&0u8 as *const _, &0u8 as *const _)); + assert!(!simple_eq(&0u8 as *const _, &1u8 as *const _)); +} diff --git a/src/test/run-pass/mir/mir_refs_correct.rs b/src/test/run-pass/mir/mir_refs_correct.rs new file mode 100644 index 00000000000..1166b6188c2 --- /dev/null +++ b/src/test/run-pass/mir/mir_refs_correct.rs @@ -0,0 +1,219 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:mir_external_refs.rs + +extern crate mir_external_refs as ext; + +struct S(u8); +#[derive(Debug, PartialEq, Eq)] +struct Unit; + +impl S { + fn hey() -> u8 { 42 } + fn hey2(&self) -> u8 { 44 } +} + +trait X { + fn hoy(&self) -> u8 { 43 } + fn hoy2() -> u8 { 45 } +} + +trait F { + fn f(self, other: U) -> u64; +} + +impl F for u32 { + fn f(self, other: u32) -> u64 { self as u64 + other as u64 } +} + +impl F for u32 { + fn f(self, other: u64) -> u64 { self as u64 - other } +} + +impl F for u64 { + fn f(self, other: u64) -> u64 { self * other } +} + +impl F for u64 { + fn f(self, other: u32) -> u64 { self ^ other as u64 } +} + +trait T { + fn staticmeth(i: I, o: O) -> (I, O) { (i, o) } +} + +impl T for O {} + +impl X for S {} + +enum E { + U(u8) +} + +#[derive(PartialEq, Debug, Eq)] +enum CEnum { + A = 0x321, + B = 0x123 +} + +const C: u8 = 84; +const C2: [u8; 5] = [42; 5]; +const C3: [u8; 3] = [42, 41, 40]; +const C4: fn(u8) -> S = S; + +fn regular() -> u8 { + 21 +} + +fn parametric(u: T) -> T { + u +} + +fn t1() -> fn()->u8 { + regular +} + +fn t2() -> fn(u8)->E { + E::U +} + +fn t3() -> fn(u8)->S { + S +} + +fn t4() -> fn()->u8 { + S::hey +} + +fn t5() -> fn(&S)-> u8 { + ::hoy +} + + +fn t6() -> fn()->u8{ + ext::regular_fn +} + +fn t7() -> fn(u8)->ext::E { + ext::E::U +} + +fn t8() -> fn(u8)->ext::S { + ext::S +} + +fn t9() -> fn()->u8 { + ext::S::hey +} + +fn t10() -> fn(&ext::S)->u8 { + ::hoy +} + +fn t11() -> fn(u8)->u8 { + parametric +} + +fn t12() -> u8 { + C +} + +fn t13() -> [u8; 5] { + C2 +} + +fn t13_2() -> [u8; 3] { + C3 +} + +fn t14() -> fn()-> u8 { + ::hoy2 +} + +fn t15() -> fn(&S)-> u8 { + S::hey2 +} + +fn t16() -> fn(u32, u32)->u64 { + F::f +} + +fn t17() -> fn(u32, u64)->u64 { + F::f +} + +fn t18() -> fn(u64, u64)->u64 { + F::f +} + +fn t19() -> fn(u64, u32)->u64 { + F::f +} + +fn t20() -> fn(u64, u32)->(u64, u32) { + >::staticmeth +} + +fn t21() -> Unit { + Unit +} + +fn t22() -> Option { + None +} + +fn t23() -> (CEnum, CEnum) { + (CEnum::A, CEnum::B) +} + +fn t24() -> fn(u8) -> S { + C4 +} + +fn main() { + assert_eq!(t1()(), regular()); + + assert_eq!(t2() as *mut (), E::U as *mut ()); + assert_eq!(t3() as *mut (), S as *mut ()); + + assert_eq!(t4()(), S::hey()); + let s = S(42); + assert_eq!(t5()(&s), ::hoy(&s)); + + + assert_eq!(t6()(), ext::regular_fn()); + assert_eq!(t7() as *mut (), ext::E::U as *mut ()); + assert_eq!(t8() as *mut (), ext::S as *mut ()); + + assert_eq!(t9()(), ext::S::hey()); + let sext = ext::S(6); + assert_eq!(t10()(&sext), ::hoy(&sext)); + + let p = parametric::; + assert_eq!(t11() as *mut (), p as *mut ()); + + assert_eq!(t12(), C); + assert_eq!(t13(), C2); + assert_eq!(t13_2(), C3); + + assert_eq!(t14()(), ::hoy2()); + assert_eq!(t15()(&s), S::hey2(&s)); + assert_eq!(t16()(10u32, 20u32), F::f(10u32, 20u32)); + assert_eq!(t17()(30u32, 10u64), F::f(30u32, 10u64)); + assert_eq!(t18()(50u64, 5u64), F::f(50u64, 5u64)); + assert_eq!(t19()(322u64, 2u32), F::f(322u64, 2u32)); + assert_eq!(t20()(123u64, 38u32), >::staticmeth(123, 38)); + assert_eq!(t21(), Unit); + assert_eq!(t22(), None); + assert_eq!(t23(), (CEnum::A, CEnum::B)); + assert_eq!(t24(), C4); +} diff --git a/src/test/run-pass/mir/mir_small_agg_arg.rs b/src/test/run-pass/mir/mir_small_agg_arg.rs new file mode 100644 index 00000000000..48eae959b4e --- /dev/null +++ b/src/test/run-pass/mir/mir_small_agg_arg.rs @@ -0,0 +1,17 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo((x, y): (i8, i8)) { +} + +fn main() { + foo((0, 1)); +} diff --git a/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs b/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs new file mode 100644 index 00000000000..f94b44a1eea --- /dev/null +++ b/src/test/run-pass/mir/mir_struct_with_assoc_ty.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::marker::PhantomData; + +pub trait DataBind { + type Data; +} + +impl DataBind for Global { + type Data = T; +} + +pub struct Global(PhantomData); + +pub struct Data { + pub offsets: as DataBind>::Data, +} + +fn create_data() -> Data { + let mut d = Data { offsets: [1, 2] }; + d.offsets[0] = 3; + d +} + + +fn main() { + let d = create_data(); + assert_eq!(d.offsets[0], 3); + assert_eq!(d.offsets[1], 2); +} diff --git a/src/test/run-pass/mir/mir_temp_promotions.rs b/src/test/run-pass/mir/mir_temp_promotions.rs new file mode 100644 index 00000000000..ba3e85a0dcf --- /dev/null +++ b/src/test/run-pass/mir/mir_temp_promotions.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn test1(f: f32) -> bool { + // test that we properly promote temporaries to allocas when a temporary is assigned to + // multiple times (assignment is still happening once ∀ possible dataflows). + !(f.is_nan() || f.is_infinite()) +} + +fn main() { + assert_eq!(test1(0.0), true); +} diff --git a/src/test/run-pass/mir/mir_void_return.rs b/src/test/run-pass/mir/mir_void_return.rs new file mode 100644 index 00000000000..c984bfd8cb1 --- /dev/null +++ b/src/test/run-pass/mir/mir_void_return.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn mir() -> (){ + let x = 1; + let mut y = 0; + while y < x { + y += 1 + } +} + +pub fn main() { + mir(); +} diff --git a/src/test/run-pass/mir/mir_void_return_2.rs b/src/test/run-pass/mir/mir_void_return_2.rs new file mode 100644 index 00000000000..fbe457fdd83 --- /dev/null +++ b/src/test/run-pass/mir/mir_void_return_2.rs @@ -0,0 +1,20 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn nil() {} + +fn mir(){ + nil() +} + +pub fn main() { + mir(); +} diff --git a/src/test/run-pass/modules/auxiliary/two_macros_2.rs b/src/test/run-pass/modules/auxiliary/two_macros_2.rs new file mode 100644 index 00000000000..b16cd3a4210 --- /dev/null +++ b/src/test/run-pass/modules/auxiliary/two_macros_2.rs @@ -0,0 +1,13 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +macro_rules! macro_one { ($($t:tt)*) => ($($t)*) } + +macro_rules! macro_two { ($($t:tt)*) => ($($t)*) } diff --git a/src/test/run-pass/modules/mod-inside-fn.rs b/src/test/run-pass/modules/mod-inside-fn.rs new file mode 100644 index 00000000000..da7a3d97c10 --- /dev/null +++ b/src/test/run-pass/modules/mod-inside-fn.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn f() -> isize { + mod m { + pub fn g() -> isize { 720 } + } + + m::g() +} + +pub fn main() { + assert_eq!(f(), 720); +} diff --git a/src/test/run-pass/modules/mod-view-items.rs b/src/test/run-pass/modules/mod-view-items.rs new file mode 100644 index 00000000000..ecca9c7ce95 --- /dev/null +++ b/src/test/run-pass/modules/mod-view-items.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test view items inside non-file-level mods + +// This is a regression test for an issue where we were failing to +// pretty-print such view items. If that happens again, this should +// begin failing. + +// pretty-expanded FIXME #23616 + +mod m { + pub fn f() -> Vec { Vec::new() } +} + +pub fn main() { let _x = m::f(); } diff --git a/src/test/run-pass/modules/mod_dir_implicit.rs b/src/test/run-pass/modules/mod_dir_implicit.rs new file mode 100644 index 00000000000..e9a1d6cfa29 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_implicit.rs @@ -0,0 +1,18 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +mod mod_dir_implicit_aux; + +pub fn main() { + assert_eq!(mod_dir_implicit_aux::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_dir_implicit_aux/compiletest-ignore-dir b/src/test/run-pass/modules/mod_dir_implicit_aux/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs b/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs new file mode 100644 index 00000000000..8687b33cac3 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_implicit_aux/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn foo() -> isize { 10 } diff --git a/src/test/run-pass/modules/mod_dir_path.rs b/src/test/run-pass/modules/mod_dir_path.rs new file mode 100644 index 00000000000..d614b2fb860 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_path.rs @@ -0,0 +1,32 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +mod mod_dir_simple { + #[path = "test.rs"] + pub mod syrup; +} + +pub fn main() { + assert_eq!(mod_dir_simple::syrup::foo(), 10); + + #[path = "auxiliary"] + mod foo { + mod two_macros_2; + } + + #[path = "auxiliary"] + mod bar { + macro_rules! m { () => { mod two_macros_2; } } + m!(); + } +} diff --git a/src/test/run-pass/modules/mod_dir_path2.rs b/src/test/run-pass/modules/mod_dir_path2.rs new file mode 100644 index 00000000000..9b116d534d9 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_path2.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +#[path = "mod_dir_simple"] +mod pancakes { + #[path = "test.rs"] + pub mod syrup; +} + +pub fn main() { + assert_eq!(pancakes::syrup::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_dir_path3.rs b/src/test/run-pass/modules/mod_dir_path3.rs new file mode 100644 index 00000000000..5bdf2ca2e59 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_path3.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +#[path = "mod_dir_simple"] +mod pancakes { + pub mod test; +} + +pub fn main() { + assert_eq!(pancakes::test::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_dir_path_multi.rs b/src/test/run-pass/modules/mod_dir_path_multi.rs new file mode 100644 index 00000000000..e6a22c21cbc --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_path_multi.rs @@ -0,0 +1,27 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +#[path = "mod_dir_simple"] +mod biscuits { + pub mod test; +} + +#[path = "mod_dir_simple"] +mod gravy { + pub mod test; +} + +pub fn main() { + assert_eq!(biscuits::test::foo(), 10); + assert_eq!(gravy::test::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_dir_recursive.rs b/src/test/run-pass/modules/mod_dir_recursive.rs new file mode 100644 index 00000000000..88dc845bcb5 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_recursive.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +// Testing that the parser for each file tracks its modules +// and paths independently. The load_another_mod module should +// not try to reuse the 'mod_dir_simple' path. + +mod mod_dir_simple { + pub mod load_another_mod; +} + +pub fn main() { + assert_eq!(mod_dir_simple::load_another_mod::test::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_dir_simple.rs b/src/test/run-pass/modules/mod_dir_simple.rs new file mode 100644 index 00000000000..cb45b3cadaf --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_simple.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +mod mod_dir_simple { + pub mod test; +} + +pub fn main() { + assert_eq!(mod_dir_simple::test::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_dir_simple/compiletest-ignore-dir b/src/test/run-pass/modules/mod_dir_simple/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs b/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs new file mode 100644 index 00000000000..40717782b92 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_simple/load_another_mod.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[path = "test.rs"] +pub mod test; diff --git a/src/test/run-pass/modules/mod_dir_simple/test.rs b/src/test/run-pass/modules/mod_dir_simple/test.rs new file mode 100644 index 00000000000..8687b33cac3 --- /dev/null +++ b/src/test/run-pass/modules/mod_dir_simple/test.rs @@ -0,0 +1,12 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn foo() -> isize { 10 } diff --git a/src/test/run-pass/modules/mod_file.rs b/src/test/run-pass/modules/mod_file.rs new file mode 100644 index 00000000000..26bf83ca5a4 --- /dev/null +++ b/src/test/run-pass/modules/mod_file.rs @@ -0,0 +1,20 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +// Testing that a plain .rs file can load modules from other source files + +mod mod_file_aux; + +pub fn main() { + assert_eq!(mod_file_aux::foo(), 10); +} diff --git a/src/test/run-pass/modules/mod_file_aux.rs b/src/test/run-pass/modules/mod_file_aux.rs new file mode 100644 index 00000000000..a7810a3cae1 --- /dev/null +++ b/src/test/run-pass/modules/mod_file_aux.rs @@ -0,0 +1,14 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-test Not a test. Used by other tests + +pub fn foo() -> isize { 10 } diff --git a/src/test/run-pass/modules/mod_file_with_path_attr.rs b/src/test/run-pass/modules/mod_file_with_path_attr.rs new file mode 100644 index 00000000000..ede610bcfad --- /dev/null +++ b/src/test/run-pass/modules/mod_file_with_path_attr.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty issue #37195 + +// Testing that a plain .rs file can load modules from other source files + +#[path = "mod_file_aux.rs"] +mod m; + +pub fn main() { + assert_eq!(m::foo(), 10); +} diff --git a/src/test/run-pass/modules/module-polymorphism3-files/compiletest-ignore-dir b/src/test/run-pass/modules/module-polymorphism3-files/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs new file mode 100644 index 00000000000..2242daa2d80 --- /dev/null +++ b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs @@ -0,0 +1,11 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub type T = f32; diff --git a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs new file mode 100644 index 00000000000..543d672b0ab --- /dev/null +++ b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs @@ -0,0 +1,11 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub type T = f64; diff --git a/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs new file mode 100644 index 00000000000..7151796c8ec --- /dev/null +++ b/src/test/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs @@ -0,0 +1,11 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub type T = float; diff --git a/src/test/run-pass/moves/move-1-unique.rs b/src/test/run-pass/moves/move-1-unique.rs new file mode 100644 index 00000000000..1557f13b10d --- /dev/null +++ b/src/test/run-pass/moves/move-1-unique.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +#[derive(Clone)] +struct Triple { + x: isize, + y: isize, + z: isize, +} + +fn test(x: bool, foo: Box) -> isize { + let bar = foo; + let mut y: Box; + if x { y = bar; } else { y = box Triple{x: 4, y: 5, z: 6}; } + return y.y; +} + +pub fn main() { + let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; + assert_eq!(test(true, x.clone()), 2); + assert_eq!(test(true, x.clone()), 2); + assert_eq!(test(true, x.clone()), 2); + assert_eq!(test(false, x), 5); +} diff --git a/src/test/run-pass/moves/move-2-unique.rs b/src/test/run-pass/moves/move-2-unique.rs new file mode 100644 index 00000000000..270a5990496 --- /dev/null +++ b/src/test/run-pass/moves/move-2-unique.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct X { x: isize, y: isize, z: isize } + +pub fn main() { + let x: Box<_> = box X{x: 1, y: 2, z: 3}; + let y = x; + assert_eq!(y.y, 2); +} diff --git a/src/test/run-pass/moves/move-2.rs b/src/test/run-pass/moves/move-2.rs new file mode 100644 index 00000000000..9207c71e083 --- /dev/null +++ b/src/test/run-pass/moves/move-2.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct X { x: isize, y: isize, z: isize } + +pub fn main() { let x: Box<_> = box X {x: 1, y: 2, z: 3}; let y = x; assert_eq!(y.y, 2); } diff --git a/src/test/run-pass/moves/move-3-unique.rs b/src/test/run-pass/moves/move-3-unique.rs new file mode 100644 index 00000000000..6f86674104c --- /dev/null +++ b/src/test/run-pass/moves/move-3-unique.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +#[derive(Clone)] +struct Triple { + x: isize, + y: isize, + z: isize, +} + +fn test(x: bool, foo: Box) -> isize { + let bar = foo; + let mut y: Box; + if x { y = bar; } else { y = box Triple {x: 4, y: 5, z: 6}; } + return y.y; +} + +pub fn main() { + let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; + for _ in 0_usize..10000_usize { + assert_eq!(test(true, x.clone()), 2); + } + assert_eq!(test(false, x), 5); +} diff --git a/src/test/run-pass/moves/move-4-unique.rs b/src/test/run-pass/moves/move-4-unique.rs new file mode 100644 index 00000000000..0876f37fd2d --- /dev/null +++ b/src/test/run-pass/moves/move-4-unique.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Triple {a: isize, b: isize, c: isize} + +fn test(foo: Box) -> Box { + let foo = foo; + let bar = foo; + let baz = bar; + let quux = baz; + return quux; +} + +pub fn main() { + let x = box Triple{a: 1, b: 2, c: 3}; + let y = test(x); + assert_eq!(y.c, 3); +} diff --git a/src/test/run-pass/moves/move-4.rs b/src/test/run-pass/moves/move-4.rs new file mode 100644 index 00000000000..61dcc08805b --- /dev/null +++ b/src/test/run-pass/moves/move-4.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Triple { a: isize, b: isize, c: isize } + +fn test(foo: Box) -> Box { + let foo = foo; + let bar = foo; + let baz = bar; + let quux = baz; + return quux; +} + +pub fn main() { + let x = box Triple{a: 1, b: 2, c: 3}; + let y = test(x); + assert_eq!(y.c, 3); +} diff --git a/src/test/run-pass/moves/move-arg-2-unique.rs b/src/test/run-pass/moves/move-arg-2-unique.rs new file mode 100644 index 00000000000..279b6d49358 --- /dev/null +++ b/src/test/run-pass/moves/move-arg-2-unique.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn test(foo: Box> ) { assert_eq!((*foo)[0], 10); } + +pub fn main() { + let x = box vec![10]; + // Test forgetting a local by move-in + test(x); + + // Test forgetting a temporary by move-in. + test(box vec![10]); +} diff --git a/src/test/run-pass/moves/move-arg-2.rs b/src/test/run-pass/moves/move-arg-2.rs new file mode 100644 index 00000000000..a813d7ec922 --- /dev/null +++ b/src/test/run-pass/moves/move-arg-2.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn test(foo: Box>) { assert_eq!((*foo)[0], 10); } + +pub fn main() { + let x = box vec![10]; + // Test forgetting a local by move-in + test(x); + + // Test forgetting a temporary by move-in. + test(box vec![10]); +} diff --git a/src/test/run-pass/moves/move-arg.rs b/src/test/run-pass/moves/move-arg.rs new file mode 100644 index 00000000000..1fa10fe48b4 --- /dev/null +++ b/src/test/run-pass/moves/move-arg.rs @@ -0,0 +1,15 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn test(foo: isize) { assert_eq!(foo, 10); } + +pub fn main() { let x = 10; test(x); } diff --git a/src/test/run-pass/moves/move-nullary-fn.rs b/src/test/run-pass/moves/move-nullary-fn.rs new file mode 100644 index 00000000000..b737c8c066c --- /dev/null +++ b/src/test/run-pass/moves/move-nullary-fn.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #922 +// pretty-expanded FIXME #23616 + +fn f2(_thing: F) where F: FnOnce() { } + +fn f(thing: F) where F: FnOnce() { + f2(thing); +} + +pub fn main() { + f(|| {}); +} diff --git a/src/test/run-pass/moves/move-out-of-field.rs b/src/test/run-pass/moves/move-out-of-field.rs new file mode 100644 index 00000000000..8c91c524f26 --- /dev/null +++ b/src/test/run-pass/moves/move-out-of-field.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::string::String; + +struct StringBuffer { + s: String, +} + +impl StringBuffer { + pub fn append(&mut self, v: &str) { + self.s.push_str(v); + } +} + +fn to_string(sb: StringBuffer) -> String { + sb.s +} + +pub fn main() { + let mut sb = StringBuffer { + s: String::new(), + }; + sb.append("Hello, "); + sb.append("World!"); + let str = to_string(sb); + assert_eq!(str, "Hello, World!"); +} diff --git a/src/test/run-pass/moves/move-scalar.rs b/src/test/run-pass/moves/move-scalar.rs new file mode 100644 index 00000000000..c72be92654c --- /dev/null +++ b/src/test/run-pass/moves/move-scalar.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + + let y: isize = 42; + let mut x: isize; + x = y; + assert_eq!(x, 42); +} diff --git a/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs b/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs new file mode 100644 index 00000000000..857bf7ff260 --- /dev/null +++ b/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +pub fn main() { + let x = "Hello world!".to_string(); + thread::spawn(move|| { + println!("{}", x); + }).join(); +} diff --git a/src/test/run-pass/nll/issue-47153-generic-const.rs b/src/test/run-pass/nll/issue-47153-generic-const.rs new file mode 100644 index 00000000000..ac41179bcac --- /dev/null +++ b/src/test/run-pass/nll/issue-47153-generic-const.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Regression test for #47153: constants in a generic context (such as +// a trait) used to ICE. + +#![feature(nll)] +#![allow(warnings)] + +trait Foo { + const B: bool = true; +} + +struct Bar { x: T } + +impl Bar { + const B: bool = true; +} + +fn main() { } diff --git a/src/test/run-pass/nll/issue-47589.rs b/src/test/run-pass/nll/issue-47589.rs new file mode 100644 index 00000000000..f960cfd7fb3 --- /dev/null +++ b/src/test/run-pass/nll/issue-47589.rs @@ -0,0 +1,35 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] + +pub struct DescriptorSet<'a> { + pub slots: Vec> +} + +pub trait ResourcesTrait<'r>: Sized { + type DescriptorSet: 'r; +} + +pub struct Resources; + +impl<'a> ResourcesTrait<'a> for Resources { + type DescriptorSet = DescriptorSet<'a>; +} + +pub enum AttachInfo<'a, R: ResourcesTrait<'a>> { + NextDescriptorSet(Box) +} + +fn main() { + let _x = DescriptorSet {slots: Vec::new()}; +} diff --git a/src/test/run-pass/nll/issue-48623-closure.rs b/src/test/run-pass/nll/issue-48623-closure.rs new file mode 100644 index 00000000000..312aa6d577a --- /dev/null +++ b/src/test/run-pass/nll/issue-48623-closure.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] + +struct WithDrop; + +impl Drop for WithDrop { + fn drop(&mut self) {} +} + +fn reborrow_from_closure(r: &mut ()) -> &mut () { + let d = WithDrop; + (move || { d; &mut *r })() +} + +fn main() {} diff --git a/src/test/run-pass/nll/issue-48623-generator.rs b/src/test/run-pass/nll/issue-48623-generator.rs new file mode 100644 index 00000000000..24b25c4db16 --- /dev/null +++ b/src/test/run-pass/nll/issue-48623-generator.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] +#![feature(generators, generator_trait)] + +struct WithDrop; + +impl Drop for WithDrop { + fn drop(&mut self) {} +} + +fn reborrow_from_generator(r: &mut ()) { + let d = WithDrop; + move || { d; yield; &mut *r }; +} + +fn main() {} diff --git a/src/test/run-pass/nll/issue-50343.rs b/src/test/run-pass/nll/issue-50343.rs new file mode 100644 index 00000000000..f33baa288fa --- /dev/null +++ b/src/test/run-pass/nll/issue-50343.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] +#![deny(unused_mut)] + +fn main() { + vec![42].iter().map(|_| ()).count(); + vec![(42, 22)].iter().map(|(_x, _y)| ()).count(); +} diff --git a/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs b/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs new file mode 100644 index 00000000000..3e40b527ef4 --- /dev/null +++ b/src/test/run-pass/nll/issue-50461-used-mut-from-moves.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] +#![deny(unused_mut)] + +struct Foo { + pub value: i32 +} + +fn use_foo_mut(mut foo: Foo) { + foo = foo; + println!("{}", foo.value); +} + +fn main() { + use_foo_mut(Foo { value: 413 }); +} diff --git a/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs new file mode 100644 index 00000000000..781dded6272 --- /dev/null +++ b/src/test/run-pass/nll/issue-53123-raw-pointer-cast.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] +#![allow(unused_variables)] + +pub trait TryTransform { + fn try_transform(self, f: F) + where + Self: Sized, + F: FnOnce(Self); +} + +impl<'a, T> TryTransform for &'a mut T { + fn try_transform(self, f: F) + where + // The bug was that `Self: Sized` caused the lifetime of `this` to "extend" for all + // of 'a instead of only lasting as long as the binding is used (for just that line). + Self: Sized, + F: FnOnce(Self), + { + let this: *mut T = self as *mut T; + f(self); + } +} + +fn main() { +} diff --git a/src/test/run-pass/nll/mutating_references.rs b/src/test/run-pass/nll/mutating_references.rs new file mode 100644 index 00000000000..1cf9e3aae90 --- /dev/null +++ b/src/test/run-pass/nll/mutating_references.rs @@ -0,0 +1,36 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] + +struct List { + value: T, + next: Option>>, +} + +fn to_refs(mut list: &mut List) -> Vec<&mut T> { + let mut result = vec![]; + loop { + result.push(&mut list.value); + if let Some(n) = list.next.as_mut() { + list = n; + } else { + return result; + } + } +} + +fn main() { + let mut list = List { value: 1, next: None }; + let vec = to_refs(&mut list); + assert_eq!(vec![&mut 1], vec); +} diff --git a/src/test/run-pass/nll/process_or_insert_default.rs b/src/test/run-pass/nll/process_or_insert_default.rs new file mode 100644 index 00000000000..57fbfb642ea --- /dev/null +++ b/src/test/run-pass/nll/process_or_insert_default.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(nll)] + +use std::collections::HashMap; + +fn process_or_insert_default(map: &mut HashMap, key: usize) { + match map.get_mut(&key) { + Some(value) => { + process(value); + } + None => { + map.insert(key, "".to_string()); + } + } +} + +fn process(x: &str) { + assert_eq!(x, "Hello, world"); +} + +fn main() { + let map = &mut HashMap::new(); + map.insert(22, format!("Hello, world")); + map.insert(44, format!("Goodbye, world")); + process_or_insert_default(map, 22); + process_or_insert_default(map, 66); + assert_eq!(map[&66], ""); +} diff --git a/src/test/run-pass/nll/rc-loop.rs b/src/test/run-pass/nll/rc-loop.rs new file mode 100644 index 00000000000..420f09707f1 --- /dev/null +++ b/src/test/run-pass/nll/rc-loop.rs @@ -0,0 +1,41 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// A test for something that NLL enables. It sometimes happens that +// the `while let` pattern makes some borrows from a variable (in this +// case, `x`) that you need in order to compute the next value for +// `x`. The lexical checker makes this very painful. The NLL checker +// does not. + +#![feature(nll)] + +use std::rc::Rc; + +#[derive(Debug, PartialEq, Eq)] +enum Foo { + Base(usize), + Next(Rc), +} + +fn find_base(mut x: Rc) -> Rc { + while let Foo::Next(n) = &*x { + x = n.clone(); + } + x +} + +fn main() { + let chain = Rc::new(Foo::Next(Rc::new(Foo::Base(44)))); + let base = find_base(chain); + assert_eq!(&*base, &Foo::Base(44)); +} + diff --git a/src/test/run-pass/non_modrs_mods/foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod.rs new file mode 100644 index 00000000000..7d37c6d9399 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod.rs @@ -0,0 +1,14 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. +// +// ignore-test: not a test, used by non_modrs_mods.rs + +pub mod inner_modrs_mod; +pub mod inner_foors_mod; diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir b/src/test/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs new file mode 100644 index 00000000000..77cab972352 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs new file mode 100644 index 00000000000..b61667cfd88 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs new file mode 100644 index 00000000000..b61667cfd88 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs new file mode 100644 index 00000000000..77cab972352 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir b/src/test/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs new file mode 100644 index 00000000000..77cab972352 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs new file mode 100644 index 00000000000..b61667cfd88 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs new file mode 100644 index 00000000000..b61667cfd88 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs new file mode 100644 index 00000000000..77cab972352 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs new file mode 100644 index 00000000000..9e3f10f12ed --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/modrs_mod/mod.rs @@ -0,0 +1,12 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner_modrs_mod; +pub mod inner_foors_mod; diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs new file mode 100644 index 00000000000..226e6fda0a4 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod inner_modrs_mod; diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs new file mode 100644 index 00000000000..b61667cfd88 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub fn foo() {} diff --git a/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs new file mode 100644 index 00000000000..77cab972352 --- /dev/null +++ b/src/test/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs @@ -0,0 +1,11 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod innest; diff --git a/src/test/run-pass/numbers-arithmetic/arith-0.rs b/src/test/run-pass/numbers-arithmetic/arith-0.rs new file mode 100644 index 00000000000..4d432cd5b4e --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/arith-0.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let a: isize = 10; + println!("{}", a); + assert_eq!(a * (a - 1), 90); +} diff --git a/src/test/run-pass/numbers-arithmetic/arith-1.rs b/src/test/run-pass/numbers-arithmetic/arith-1.rs new file mode 100644 index 00000000000..b78b359ced0 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/arith-1.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let i32_a: isize = 10; + assert_eq!(i32_a, 10); + assert_eq!(i32_a - 10, 0); + assert_eq!(i32_a / 10, 1); + assert_eq!(i32_a - 20, -10); + assert_eq!(i32_a << 10, 10240); + assert_eq!(i32_a << 16, 655360); + assert_eq!(i32_a * 16, 160); + assert_eq!(i32_a * i32_a * i32_a, 1000); + assert_eq!(i32_a * i32_a * i32_a * i32_a, 10000); + assert_eq!(i32_a * i32_a / i32_a * i32_a, 100); + assert_eq!(i32_a * (i32_a - 1) << (2 + i32_a as usize), 368640); + let i32_b: isize = 0x10101010; + assert_eq!(i32_b + 1 - 1, i32_b); + assert_eq!(i32_b << 1, i32_b << 1); + assert_eq!(i32_b >> 1, i32_b >> 1); + assert_eq!(i32_b & i32_b << 1, 0); + println!("{}", i32_b | i32_b << 1); + assert_eq!(i32_b | i32_b << 1, 0x30303030); +} diff --git a/src/test/run-pass/numbers-arithmetic/arith-2.rs b/src/test/run-pass/numbers-arithmetic/arith-2.rs new file mode 100644 index 00000000000..91e207c2b2f --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/arith-2.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let i32_c: isize = 0x10101010; + assert_eq!(i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3), + i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3)); +} diff --git a/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs b/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs new file mode 100644 index 00000000000..dc672d50d7f --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/arith-unsigned.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_comparisons)] + +// Unsigned integer operations +pub fn main() { + assert!((0u8 < 255u8)); + assert!((0u8 <= 255u8)); + assert!((255u8 > 0u8)); + assert!((255u8 >= 0u8)); + assert_eq!(250u8 / 10u8, 25u8); + assert_eq!(255u8 % 10u8, 5u8); + assert!((0u16 < 60000u16)); + assert!((0u16 <= 60000u16)); + assert!((60000u16 > 0u16)); + assert!((60000u16 >= 0u16)); + assert_eq!(60000u16 / 10u16, 6000u16); + assert_eq!(60005u16 % 10u16, 5u16); + assert!((0u32 < 4000000000u32)); + assert!((0u32 <= 4000000000u32)); + assert!((4000000000u32 > 0u32)); + assert!((4000000000u32 >= 0u32)); + assert_eq!(4000000000u32 / 10u32, 400000000u32); + assert_eq!(4000000005u32 % 10u32, 5u32); + // 64-bit numbers have some flakiness yet. Not tested + +} diff --git a/src/test/run-pass/numbers-arithmetic/div-mod.rs b/src/test/run-pass/numbers-arithmetic/div-mod.rs new file mode 100644 index 00000000000..d04638f790b --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/div-mod.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +pub fn main() { + let x: isize = 15; + let y: isize = 5; + assert_eq!(x / 5, 3); + assert_eq!(x / 4, 3); + assert_eq!(x / 3, 5); + assert_eq!(x / y, 3); + assert_eq!(15 / y, 3); + assert_eq!(x % 5, 0); + assert_eq!(x % 4, 3); + assert_eq!(x % 3, 0); + assert_eq!(x % y, 0); + assert_eq!(15 % y, 0); +} diff --git a/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs b/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs new file mode 100644 index 00000000000..97f5f39a9e5 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs @@ -0,0 +1,63 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no i128 support + +#![deny(const_err)] + +use std::{f32, f64}; + +// Forces evaluation of constants, triggering hard error +fn force(_: T) {} + +fn main() { + { const X: u16 = -1. as u16; force(X); } + { const X: u128 = -100. as u128; force(X); } + + { const X: i8 = f32::NAN as i8; force(X); } + { const X: i32 = f32::NAN as i32; force(X); } + { const X: u64 = f32::NAN as u64; force(X); } + { const X: u128 = f32::NAN as u128; force(X); } + + { const X: i8 = f32::INFINITY as i8; force(X); } + { const X: u32 = f32::INFINITY as u32; force(X); } + { const X: i128 = f32::INFINITY as i128; force(X); } + { const X: u128 = f32::INFINITY as u128; force(X); } + + { const X: u8 = f32::NEG_INFINITY as u8; force(X); } + { const X: u16 = f32::NEG_INFINITY as u16; force(X); } + { const X: i64 = f32::NEG_INFINITY as i64; force(X); } + { const X: i128 = f32::NEG_INFINITY as i128; force(X); } + + { const X: i8 = f64::NAN as i8; force(X); } + { const X: i32 = f64::NAN as i32; force(X); } + { const X: u64 = f64::NAN as u64; force(X); } + { const X: u128 = f64::NAN as u128; force(X); } + + { const X: i8 = f64::INFINITY as i8; force(X); } + { const X: u32 = f64::INFINITY as u32; force(X); } + { const X: i128 = f64::INFINITY as i128; force(X); } + { const X: u128 = f64::INFINITY as u128; force(X); } + + { const X: u8 = f64::NEG_INFINITY as u8; force(X); } + { const X: u16 = f64::NEG_INFINITY as u16; force(X); } + { const X: i64 = f64::NEG_INFINITY as i64; force(X); } + { const X: i128 = f64::NEG_INFINITY as i128; force(X); } + + { const X: u8 = 256. as u8; force(X); } + { const X: i8 = -129. as i8; force(X); } + { const X: i8 = 128. as i8; force(X); } + { const X: i32 = 2147483648. as i32; force(X); } + { const X: i32 = -2147483904. as i32; force(X); } + { const X: u32 = 4294967296. as u32; force(X); } + { const X: u128 = 1e40 as u128; force(X); } + { const X: i128 = 1e40 as i128; force(X); } +} diff --git a/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs b/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs new file mode 100644 index 00000000000..e3e724cbe77 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float-literal-inference.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S { + z: f64 +} + +pub fn main() { + let x: f32 = 4.0; + println!("{}", x); + let y: f64 = 64.0; + println!("{}", y); + let z = S { z: 1.0 }; + println!("{}", z.z); +} diff --git a/src/test/run-pass/numbers-arithmetic/float-nan.rs b/src/test/run-pass/numbers-arithmetic/float-nan.rs new file mode 100644 index 00000000000..7725859eec6 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float-nan.rs @@ -0,0 +1,93 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::f64; + +pub fn main() { + let nan: f64 = f64::NAN; + assert!((nan).is_nan()); + + let inf: f64 = f64::INFINITY; + let neg_inf: f64 = -f64::INFINITY; + assert_eq!(-inf, neg_inf); + + assert!( nan != nan); + assert!( nan != -nan); + assert!(-nan != -nan); + assert!(-nan != nan); + + assert!( nan != 1.); + assert!( nan != 0.); + assert!( nan != inf); + assert!( nan != -inf); + + assert!( 1. != nan); + assert!( 0. != nan); + assert!( inf != nan); + assert!(-inf != nan); + + assert!(!( nan == nan)); + assert!(!( nan == -nan)); + assert!(!( nan == 1.)); + assert!(!( nan == 0.)); + assert!(!( nan == inf)); + assert!(!( nan == -inf)); + assert!(!( 1. == nan)); + assert!(!( 0. == nan)); + assert!(!( inf == nan)); + assert!(!(-inf == nan)); + assert!(!(-nan == nan)); + assert!(!(-nan == -nan)); + + assert!(!( nan > nan)); + assert!(!( nan > -nan)); + assert!(!( nan > 0.)); + assert!(!( nan > inf)); + assert!(!( nan > -inf)); + assert!(!( 0. > nan)); + assert!(!( inf > nan)); + assert!(!(-inf > nan)); + assert!(!(-nan > nan)); + + assert!(!(nan < 0.)); + assert!(!(nan < 1.)); + assert!(!(nan < -1.)); + assert!(!(nan < inf)); + assert!(!(nan < -inf)); + assert!(!(nan < nan)); + assert!(!(nan < -nan)); + + assert!(!( 0. < nan)); + assert!(!( 1. < nan)); + assert!(!( -1. < nan)); + assert!(!( inf < nan)); + assert!(!(-inf < nan)); + assert!(!(-nan < nan)); + + assert!((nan + inf).is_nan()); + assert!((nan + -inf).is_nan()); + assert!((nan + 0.).is_nan()); + assert!((nan + 1.).is_nan()); + assert!((nan * 1.).is_nan()); + assert!((nan / 1.).is_nan()); + assert!((nan / 0.).is_nan()); + assert!((0.0/0.0f64).is_nan()); + assert!((-inf + inf).is_nan()); + assert!((inf - inf).is_nan()); + + assert!(!(-1.0f64).is_nan()); + assert!(!(0.0f64).is_nan()); + assert!(!(0.1f64).is_nan()); + assert!(!(1.0f64).is_nan()); + assert!(!(inf).is_nan()); + assert!(!(-inf).is_nan()); + assert!(!(1./-inf).is_nan()); +} diff --git a/src/test/run-pass/numbers-arithmetic/float-signature.rs b/src/test/run-pass/numbers-arithmetic/float-signature.rs new file mode 100644 index 00000000000..12a25aa6e8e --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float-signature.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + fn foo(n: f64) -> f64 { return n + 0.12345; } + let n: f64 = 0.1; + let m: f64 = foo(n); + println!("{}", m); +} diff --git a/src/test/run-pass/numbers-arithmetic/float.rs b/src/test/run-pass/numbers-arithmetic/float.rs new file mode 100644 index 00000000000..597b4630683 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let pi = 3.1415927f64; + println!("{}", -pi * (pi + 2.0 / pi) - pi * 5.0); + if pi == 5.0 || pi < 10.0 || pi <= 2.0 || pi != 22.0 / 7.0 || pi >= 10.0 + || pi > 1.0 { + println!("yes"); + } +} diff --git a/src/test/run-pass/numbers-arithmetic/float2.rs b/src/test/run-pass/numbers-arithmetic/float2.rs new file mode 100644 index 00000000000..70c7c600f40 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float2.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let a = 1.5e6f64; + let b = 1.5E6f64; + let c = 1e6f64; + let d = 1E6f64; + let e = 3.0f32; + let f = 5.9f64; + let g = 1e6f32; + let h = 1.0e7f64; + let i = 1.0E7f64; + let j = 3.1e+9f64; + let k = 3.2e-10f64; + assert_eq!(a, b); + assert!((c < b)); + assert_eq!(c, d); + assert!((e < g)); + assert!((f < h)); + assert_eq!(g, 1000000.0f32); + assert_eq!(h, i); + assert!((j > k)); + assert!((k < a)); +} diff --git a/src/test/run-pass/numbers-arithmetic/float_math.rs b/src/test/run-pass/numbers-arithmetic/float_math.rs new file mode 100644 index 00000000000..d86ad34c9d8 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/float_math.rs @@ -0,0 +1,31 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(core_intrinsics)] + +use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast}; + +#[inline(never)] +pub fn test_operations(a: f64, b: f64) { + // make sure they all map to the correct operation + unsafe { + assert_eq!(fadd_fast(a, b), a + b); + assert_eq!(fsub_fast(a, b), a - b); + assert_eq!(fmul_fast(a, b), a * b); + assert_eq!(fdiv_fast(a, b), a / b); + assert_eq!(frem_fast(a, b), a % b); + } +} + +fn main() { + test_operations(1., 2.); + test_operations(10., 5.); +} diff --git a/src/test/run-pass/numbers-arithmetic/floatlits.rs b/src/test/run-pass/numbers-arithmetic/floatlits.rs new file mode 100644 index 00000000000..34f52ccb33a --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/floatlits.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +pub fn main() { + let f = 4.999999999999f64; + assert!((f > 4.90f64)); + assert!((f < 5.0f64)); + let g = 4.90000000001e-10f64; + assert!((g > 5e-11f64)); + assert!((g < 5e-9f64)); +} diff --git a/src/test/run-pass/numbers-arithmetic/i128-ffi.rs b/src/test/run-pass/numbers-arithmetic/i128-ffi.rs new file mode 100644 index 00000000000..747a05f6062 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/i128-ffi.rs @@ -0,0 +1,41 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(improper_ctypes)] + +// MSVC doesn't support 128 bit integers, and other Windows +// C compilers have very inconsistent views on how the ABI +// should look like. + +// ignore-windows +// ignore-32bit + +#[link(name = "rust_test_helpers", kind = "static")] +extern "C" { + fn identity(f: u128) -> u128; + fn square(f: i128) -> i128; + fn sub(f: i128, f: i128) -> i128; +} + +fn main() { + unsafe { + let a = 0x734C_C2F2_A521; + let b = 0x33EE_0E2A_54E2_59DA_A0E7_8E41; + let b_out = identity(b); + assert_eq!(b, b_out); + let a_square = square(a); + assert_eq!(b, a_square as u128); + let k = 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; + let k_d = 0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420; + let k_out = sub(k_d, k); + assert_eq!(k, k_out); + } +} diff --git a/src/test/run-pass/numbers-arithmetic/i128.rs b/src/test/run-pass/numbers-arithmetic/i128.rs new file mode 100644 index 00000000000..c3d4a638290 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/i128.rs @@ -0,0 +1,121 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +// ignore-emscripten i128 doesn't work + +// compile-flags: -Z borrowck=compare + +#![feature(test)] + +extern crate test; +use test::black_box as b; + +fn main() { + let x: i128 = -1; + assert_eq!(0, !x); + let y: i128 = -2; + assert_eq!(!1, y); + let z: i128 = 0xABCD_EF; + assert_eq!(z * z, 0x734C_C2F2_A521); + assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); + assert_eq!(-z * -z, 0x734C_C2F2_A521); + assert_eq!(-z * -z * -z * -z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); + assert_eq!(-z + -z + -z + -z, -0x2AF3_7BC); + let k: i128 = -0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; + assert_eq!(k + k, -0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); + assert_eq!(0, k - k); + assert_eq!(-0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k + z); + assert_eq!(-0x1000_0000_0000_0000_0000_0000_0000_000, + k + 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!(-0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); + assert_eq!(-k, k / -1); + assert_eq!(-0x91A2_B3C4_D5E6_F8, k >> 65); + assert_eq!(-0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); + assert!(k < z); + assert!(y > k); + assert!(y < x); + assert_eq!(x as i64, -1); + assert_eq!(z as i64, 0xABCD_EF); + assert_eq!(k as i64, -0xFEDC_BA98_7654_3210); + assert_eq!(k as u128, 0xFEDC_BA98_7654_3210_0123_4567_89AB_CDF0); + assert_eq!(-k as u128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!((-z as f64) as i128, -z); + assert_eq!((-z as f32) as i128, -z); + assert_eq!((-z as f64 * 16.0) as i128, -z * 16); + assert_eq!((-z as f32 * 16.0) as i128, -z * 16); + // Same stuff as above, but blackboxed, to force use of intrinsics + let x: i128 = b(-1); + assert_eq!(0, !x); + let y: i128 = b(-2); + assert_eq!(!1, y); + let z: i128 = b(0xABCD_EF); + assert_eq!(z * z, 0x734C_C2F2_A521); + assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); + assert_eq!(-z * -z, 0x734C_C2F2_A521); + assert_eq!(-z * -z * -z * -z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); + assert_eq!(-z + -z + -z + -z, -0x2AF3_7BC); + let k: i128 = b(-0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!(k + k, -0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); + assert_eq!(0, k - k); + assert_eq!(-0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k + z); + assert_eq!(-0x1000_0000_0000_0000_0000_0000_0000_000, + k + 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!(-0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); + assert_eq!(-k, k / -1); + assert_eq!(-0x91A2_B3C4_D5E6_F8, k >> 65); + assert_eq!(-0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); + assert!(k < z); + assert!(y > k); + assert!(y < x); + assert_eq!(x as i64, -1); + assert_eq!(z as i64, 0xABCD_EF); + assert_eq!(k as i64, -0xFEDC_BA98_7654_3210); + assert_eq!(k as u128, 0xFEDC_BA98_7654_3210_0123_4567_89AB_CDF0); + assert_eq!(-k as u128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!((-z as f64) as i128, -z); + assert_eq!((-z as f32) as i128, -z); + assert_eq!((-z as f64 * 16.0) as i128, -z * 16); + assert_eq!((-z as f32 * 16.0) as i128, -z * 16); + // formatting + let j: i128 = -(1 << 67); + assert_eq!("-147573952589676412928", format!("{}", j)); + assert_eq!("fffffffffffffff80000000000000000", format!("{:x}", j)); + assert_eq!("3777777777777777777760000000000000000000000", format!("{:o}", j)); + assert_eq!("1111111111111111111111111111111111111111111111111111111111111\ + 0000000000000000000000000000000000000000000000000000000000000000000", + format!("{:b}", j)); + assert_eq!("-147573952589676412928", format!("{:?}", j)); + // common traits + assert_eq!(x, b(x.clone())); + // overflow checks + assert_eq!((-z).checked_mul(-z), Some(0x734C_C2F2_A521)); + assert_eq!((z).checked_mul(z), Some(0x734C_C2F2_A521)); + assert_eq!((k).checked_mul(k), None); + let l: i128 = b(i128::min_value()); + let o: i128 = b(17); + assert_eq!(l.checked_sub(b(2)), None); + assert_eq!(l.checked_add(l), None); + assert_eq!((-(l + 1)).checked_add(2), None); + assert_eq!(l.checked_sub(l), Some(0)); + assert_eq!(b(1u128).checked_shl(b(127)), Some(1 << 127)); + assert_eq!(o.checked_shl(b(128)), None); + + // https://github.com/rust-lang/rust/issues/41228 + assert_eq!(b(-87559967289969187895646876466835277875_i128) / + b(84285771033834995895337664386045050880_i128), + -1i128); + + // iter-arithmetic traits + assert_eq!(10i128, [1i128, 2, 3, 4].iter().sum()); + assert_eq!(24i128, [1i128, 2, 3, 4].iter().product()); +} diff --git a/src/test/run-pass/numbers-arithmetic/i32-sub.rs b/src/test/run-pass/numbers-arithmetic/i32-sub.rs new file mode 100644 index 00000000000..12a0004ca48 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/i32-sub.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +pub fn main() { let mut x: i32 = -400; x = 0 - x; assert_eq!(x, 400); } diff --git a/src/test/run-pass/numbers-arithmetic/i8-incr.rs b/src/test/run-pass/numbers-arithmetic/i8-incr.rs new file mode 100644 index 00000000000..e9779d202b0 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/i8-incr.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +pub fn main() { + let mut x: i8 = -12; + let y: i8 = -12; + x = x + 1; + x = x - 1; + assert_eq!(x, y); +} diff --git a/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs b/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs new file mode 100644 index 00000000000..92094f7b058 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/int-abs-overflow.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -Z force-overflow-checks=on +// ignore-emscripten no threads support + +use std::thread; + +fn main() { + assert!(thread::spawn(|| i8::min_value().abs()).join().is_err()); + assert!(thread::spawn(|| i16::min_value().abs()).join().is_err()); + assert!(thread::spawn(|| i32::min_value().abs()).join().is_err()); + assert!(thread::spawn(|| i64::min_value().abs()).join().is_err()); + assert!(thread::spawn(|| isize::min_value().abs()).join().is_err()); +} diff --git a/src/test/run-pass/numbers-arithmetic/int.rs b/src/test/run-pass/numbers-arithmetic/int.rs new file mode 100644 index 00000000000..7d8af653833 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/int.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +// pretty-expanded FIXME #23616 + +pub fn main() { let _x: isize = 10; } diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs new file mode 100644 index 00000000000..814d7de01a4 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-radix.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub fn main() { + let a = 0xBEEF_isize; + let b = 0o755_isize; + let c = 0b10101_isize; + let d = -0xBEEF_isize; + let e = -0o755_isize; + let f = -0b10101_isize; + + assert_eq!(a, 48879); + assert_eq!(b, 493); + assert_eq!(c, 21); + assert_eq!(d, -48879); + assert_eq!(e, -493); + assert_eq!(f, -21); + + +} diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs new file mode 100644 index 00000000000..240d235c712 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo(_: *const ()) {} + +fn main() { + let a = 3; + foo(&a as *const _ as *const ()); +} diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs new file mode 100644 index 00000000000..7b10a049dc6 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() { + println!("{}", std::mem::size_of_val(&1)); +} diff --git a/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs new file mode 100644 index 00000000000..ecbadb94a82 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs @@ -0,0 +1,70 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub fn main() { + fn id_i8(n: i8) -> i8 { n } + fn id_i16(n: i16) -> i16 { n } + fn id_i32(n: i32) -> i32 { n } + fn id_i64(n: i64) -> i64 { n } + + fn id_uint(n: usize) -> usize { n } + fn id_u8(n: u8) -> u8 { n } + fn id_u16(n: u16) -> u16 { n } + fn id_u32(n: u32) -> u32 { n } + fn id_u64(n: u64) -> u64 { n } + + let _i: i8 = -128; + let j = -128; + id_i8(j); + id_i8(-128); + + let _i: i16 = -32_768; + let j = -32_768; + id_i16(j); + id_i16(-32_768); + + let _i: i32 = -2_147_483_648; + let j = -2_147_483_648; + id_i32(j); + id_i32(-2_147_483_648); + + let _i: i64 = -9_223_372_036_854_775_808; + let j = -9_223_372_036_854_775_808; + id_i64(j); + id_i64(-9_223_372_036_854_775_808); + + let _i: usize = 1; + let j = 1; + id_uint(j); + id_uint(1); + + let _i: u8 = 255; + let j = 255; + id_u8(j); + id_u8(255); + + let _i: u16 = 65_535; + let j = 65_535; + id_u16(j); + id_u16(65_535); + + let _i: u32 = 4_294_967_295; + let j = 4_294_967_295; + id_u32(j); + id_u32(4_294_967_295); + + let _i: u64 = 18_446_744_073_709_551_615; + let j = 18_446_744_073_709_551_615; + id_u64(j); + id_u64(18_446_744_073_709_551_615); +} diff --git a/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs new file mode 100644 index 00000000000..704aca19367 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -C debug_assertions=yes +// ignore-wasm32-bare compiled with panic=abort by default +// ignore-emscripten dies with an LLVM error + +use std::panic; + +fn main() { + macro_rules! overflow_test { + ($t:ident) => ( + let r = panic::catch_unwind(|| { + ($t::max_value()).next_power_of_two() + }); + assert!(r.is_err()); + + let r = panic::catch_unwind(|| { + (($t::max_value() >> 1) + 2).next_power_of_two() + }); + assert!(r.is_err()); + ) + } + overflow_test!(u8); + overflow_test!(u16); + overflow_test!(u32); + overflow_test!(u64); + overflow_test!(u128); +} diff --git a/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs new file mode 100644 index 00000000000..e581f7c97cc --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -C debug_assertions=no +// ignore-emscripten dies with an LLVM error + +fn main() { + for i in 129..256 { + assert_eq!((i as u8).next_power_of_two(), 0); + } + + assert_eq!(((1u16 << 15) + 1).next_power_of_two(), 0); + assert_eq!(((1u32 << 31) + 1).next_power_of_two(), 0); + assert_eq!(((1u64 << 63) + 1).next_power_of_two(), 0); + assert_eq!(((1u128 << 127) + 1).next_power_of_two(), 0); +} diff --git a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs new file mode 100644 index 00000000000..6d3653e7977 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs @@ -0,0 +1,456 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags: -C debug-assertions +// +// Test std::num::Wrapping for {uN, iN, usize, isize} + +#![feature(test)] + +extern crate test; + +use std::num::Wrapping; +use std::ops::{ + Add, Sub, Mul, Div, Rem, BitXor, BitOr, BitAnd, + AddAssign, SubAssign, MulAssign, DivAssign, RemAssign, BitXorAssign, BitOrAssign, BitAndAssign, + Shl, Shr, ShlAssign, ShrAssign +}; +use test::black_box; + +macro_rules! int_modules { + ($(($name:ident, $size:expr),)*) => ($( + mod $name { + pub const BITS: usize = $size; + pub use std::$name::*; + } + )*) +} + +int_modules! { + (i8, 8), + (i16, 16), + (i32, 32), + (i64, 64), + (u8, 8), + (u16, 16), + (u32, 32), + (u64, 64), +} + +#[cfg(target_pointer_width = "32")] +int_modules! { + (isize, 32), + (usize, 32), +} + +#[cfg(target_pointer_width = "64")] +int_modules! { + (isize, 64), + (usize, 64), +} + +fn main() { + test_ops(); + test_op_assigns(); + test_sh_ops(); + test_sh_op_assigns(); +} + +fn test_ops() { + macro_rules! op_test { + ($op:ident ($lhs:expr, $rhs:expr) == $ans:expr) => { + assert_eq!(black_box(Wrapping($lhs).$op(Wrapping($rhs))), Wrapping($ans)); + // FIXME(30524): uncomment this test when it's implemented + // assert_eq!(black_box(Wrapping($lhs).$op($rhs)), Wrapping($ans)); + } + } + + op_test!(add(i8::MAX, 1) == i8::MIN); + op_test!(add(i16::MAX, 1) == i16::MIN); + op_test!(add(i32::MAX, 1) == i32::MIN); + op_test!(add(i64::MAX, 1) == i64::MIN); + op_test!(add(isize::MAX, 1) == isize::MIN); + + op_test!(add(u8::MAX, 1) == 0); + op_test!(add(u16::MAX, 1) == 0); + op_test!(add(u32::MAX, 1) == 0); + op_test!(add(u64::MAX, 1) == 0); + op_test!(add(usize::MAX, 1) == 0); + + + op_test!(sub(i8::MIN, 1) == i8::MAX); + op_test!(sub(i16::MIN, 1) == i16::MAX); + op_test!(sub(i32::MIN, 1) == i32::MAX); + op_test!(sub(i64::MIN, 1) == i64::MAX); + op_test!(sub(isize::MIN, 1) == isize::MAX); + + op_test!(sub(0u8, 1) == u8::MAX); + op_test!(sub(0u16, 1) == u16::MAX); + op_test!(sub(0u32, 1) == u32::MAX); + op_test!(sub(0u64, 1) == u64::MAX); + op_test!(sub(0usize, 1) == usize::MAX); + + + op_test!(mul(i8::MAX, 2) == -2); + op_test!(mul(i16::MAX, 2) == -2); + op_test!(mul(i32::MAX, 2) == -2); + op_test!(mul(i64::MAX, 2) == -2); + op_test!(mul(isize::MAX, 2) == -2); + + op_test!(mul(u8::MAX, 2) == u8::MAX - 1); + op_test!(mul(u16::MAX, 2) == u16::MAX - 1); + op_test!(mul(u32::MAX, 2) == u32::MAX - 1); + op_test!(mul(u64::MAX, 2) == u64::MAX - 1); + op_test!(mul(usize::MAX, 2) == usize::MAX - 1); + + + op_test!(div(i8::MIN, -1) == i8::MIN); + op_test!(div(i16::MIN, -1) == i16::MIN); + op_test!(div(i32::MIN, -1) == i32::MIN); + op_test!(div(i64::MIN, -1) == i64::MIN); + op_test!(div(isize::MIN, -1) == isize::MIN); + + + op_test!(rem(i8::MIN, -1) == 0); + op_test!(rem(i16::MIN, -1) == 0); + op_test!(rem(i32::MIN, -1) == 0); + op_test!(rem(i64::MIN, -1) == 0); + op_test!(rem(isize::MIN, -1) == 0); + + // these are not that interesting, just testing to make sure they are implemented correctly + op_test!(bitxor(0b101010i8, 0b100110) == 0b001100); + op_test!(bitxor(0b101010i16, 0b100110) == 0b001100); + op_test!(bitxor(0b101010i32, 0b100110) == 0b001100); + op_test!(bitxor(0b101010i64, 0b100110) == 0b001100); + op_test!(bitxor(0b101010isize, 0b100110) == 0b001100); + + op_test!(bitxor(0b101010u8, 0b100110) == 0b001100); + op_test!(bitxor(0b101010u16, 0b100110) == 0b001100); + op_test!(bitxor(0b101010u32, 0b100110) == 0b001100); + op_test!(bitxor(0b101010u64, 0b100110) == 0b001100); + op_test!(bitxor(0b101010usize, 0b100110) == 0b001100); + + + op_test!(bitor(0b101010i8, 0b100110) == 0b101110); + op_test!(bitor(0b101010i16, 0b100110) == 0b101110); + op_test!(bitor(0b101010i32, 0b100110) == 0b101110); + op_test!(bitor(0b101010i64, 0b100110) == 0b101110); + op_test!(bitor(0b101010isize, 0b100110) == 0b101110); + + op_test!(bitor(0b101010u8, 0b100110) == 0b101110); + op_test!(bitor(0b101010u16, 0b100110) == 0b101110); + op_test!(bitor(0b101010u32, 0b100110) == 0b101110); + op_test!(bitor(0b101010u64, 0b100110) == 0b101110); + op_test!(bitor(0b101010usize, 0b100110) == 0b101110); + + + op_test!(bitand(0b101010i8, 0b100110) == 0b100010); + op_test!(bitand(0b101010i16, 0b100110) == 0b100010); + op_test!(bitand(0b101010i32, 0b100110) == 0b100010); + op_test!(bitand(0b101010i64, 0b100110) == 0b100010); + op_test!(bitand(0b101010isize, 0b100110) == 0b100010); + + op_test!(bitand(0b101010u8, 0b100110) == 0b100010); + op_test!(bitand(0b101010u16, 0b100110) == 0b100010); + op_test!(bitand(0b101010u32, 0b100110) == 0b100010); + op_test!(bitand(0b101010u64, 0b100110) == 0b100010); + op_test!(bitand(0b101010usize, 0b100110) == 0b100010); +} + +fn test_op_assigns() { + macro_rules! op_assign_test { + ($op:ident ($initial:expr, $rhs:expr) == $ans:expr) => { + { + let mut tmp = Wrapping($initial); + tmp = black_box(tmp); + tmp.$op(Wrapping($rhs)); + assert_eq!(black_box(tmp), Wrapping($ans)); + } + + // also test that a &Wrapping right-hand side is possible + { + let mut tmp = Wrapping($initial); + tmp = black_box(tmp); + tmp.$op(&Wrapping($rhs)); + assert_eq!(black_box(tmp), Wrapping($ans)); + } + + // FIXME(30524): Uncomment this test + /* + { + let mut tmp = Wrapping($initial); + tmp = black_box(tmp); + tmp.$op($rhs); + assert_eq!(black_box(tmp), Wrapping($ans)); + } + */ + } + } + op_assign_test!(add_assign(i8::MAX, 1) == i8::MIN); + op_assign_test!(add_assign(i16::MAX, 1) == i16::MIN); + op_assign_test!(add_assign(i32::MAX, 1) == i32::MIN); + op_assign_test!(add_assign(i64::MAX, 1) == i64::MIN); + op_assign_test!(add_assign(isize::MAX, 1) == isize::MIN); + + op_assign_test!(add_assign(u8::MAX, 1) == u8::MIN); + op_assign_test!(add_assign(u16::MAX, 1) == u16::MIN); + op_assign_test!(add_assign(u32::MAX, 1) == u32::MIN); + op_assign_test!(add_assign(u64::MAX, 1) == u64::MIN); + op_assign_test!(add_assign(usize::MAX, 1) == usize::MIN); + + + op_assign_test!(sub_assign(i8::MIN, 1) == i8::MAX); + op_assign_test!(sub_assign(i16::MIN, 1) == i16::MAX); + op_assign_test!(sub_assign(i32::MIN, 1) == i32::MAX); + op_assign_test!(sub_assign(i64::MIN, 1) == i64::MAX); + op_assign_test!(sub_assign(isize::MIN, 1) == isize::MAX); + + op_assign_test!(sub_assign(u8::MIN, 1) == u8::MAX); + op_assign_test!(sub_assign(u16::MIN, 1) == u16::MAX); + op_assign_test!(sub_assign(u32::MIN, 1) == u32::MAX); + op_assign_test!(sub_assign(u64::MIN, 1) == u64::MAX); + op_assign_test!(sub_assign(usize::MIN, 1) == usize::MAX); + + + op_assign_test!(mul_assign(i8::MAX, 2) == -2); + op_assign_test!(mul_assign(i16::MAX, 2) == -2); + op_assign_test!(mul_assign(i32::MAX, 2) == -2); + op_assign_test!(mul_assign(i64::MAX, 2) == -2); + op_assign_test!(mul_assign(isize::MAX, 2) == -2); + + op_assign_test!(mul_assign(u8::MAX, 2) == u8::MAX - 1); + op_assign_test!(mul_assign(u16::MAX, 2) == u16::MAX - 1); + op_assign_test!(mul_assign(u32::MAX, 2) == u32::MAX - 1); + op_assign_test!(mul_assign(u64::MAX, 2) == u64::MAX - 1); + op_assign_test!(mul_assign(usize::MAX, 2) == usize::MAX - 1); + + + op_assign_test!(div_assign(i8::MIN, -1) == i8::MIN); + op_assign_test!(div_assign(i16::MIN, -1) == i16::MIN); + op_assign_test!(div_assign(i32::MIN, -1) == i32::MIN); + op_assign_test!(div_assign(i64::MIN, -1) == i64::MIN); + op_assign_test!(div_assign(isize::MIN, -1) == isize::MIN); + + + op_assign_test!(rem_assign(i8::MIN, -1) == 0); + op_assign_test!(rem_assign(i16::MIN, -1) == 0); + op_assign_test!(rem_assign(i32::MIN, -1) == 0); + op_assign_test!(rem_assign(i64::MIN, -1) == 0); + op_assign_test!(rem_assign(isize::MIN, -1) == 0); + + + // these are not that interesting, just testing to make sure they are implemented correctly + op_assign_test!(bitxor_assign(0b101010i8, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010i16, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010i32, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010i64, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010isize, 0b100110) == 0b001100); + + op_assign_test!(bitxor_assign(0b101010u8, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010u16, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010u32, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010u64, 0b100110) == 0b001100); + op_assign_test!(bitxor_assign(0b101010usize, 0b100110) == 0b001100); + + + op_assign_test!(bitor_assign(0b101010i8, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010i16, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010i32, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010i64, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010isize, 0b100110) == 0b101110); + + op_assign_test!(bitor_assign(0b101010u8, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010u16, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010u32, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010u64, 0b100110) == 0b101110); + op_assign_test!(bitor_assign(0b101010usize, 0b100110) == 0b101110); + + + op_assign_test!(bitand_assign(0b101010i8, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010i16, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010i32, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010i64, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010isize, 0b100110) == 0b100010); + + op_assign_test!(bitand_assign(0b101010u8, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010u16, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010u32, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010u64, 0b100110) == 0b100010); + op_assign_test!(bitand_assign(0b101010usize, 0b100110) == 0b100010); +} + +fn test_sh_ops() { + macro_rules! sh_test { + ($op:ident ($lhs:expr, $rhs:expr) == $ans:expr) => { + assert_eq!(black_box(Wrapping($lhs).$op($rhs)), Wrapping($ans)); + } + } + // NOTE: This will break for i8 if we ever get i/u128 + macro_rules! sh_test_all { + ($t:ty) => { + sh_test!(shl(i8::MAX, (i8::BITS + 1) as $t) == -2); + sh_test!(shl(i16::MAX, (i16::BITS + 1) as $t) == -2); + sh_test!(shl(i32::MAX, (i32::BITS + 1) as $t) == -2); + sh_test!(shl(i64::MAX, (i64::BITS + 1) as $t) == -2); + sh_test!(shl(isize::MAX, (isize::BITS + 1) as $t) == -2); + + sh_test!(shl(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX - 1); + sh_test!(shl(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX - 1); + sh_test!(shl(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX - 1); + sh_test!(shl(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX - 1); + sh_test!(shl(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX - 1); + + + sh_test!(shr(i8::MAX, (i8::BITS + 1) as $t) == i8::MAX / 2); + sh_test!(shr(i16::MAX, (i16::BITS + 1) as $t) == i16::MAX / 2); + sh_test!(shr(i32::MAX, (i32::BITS + 1) as $t) == i32::MAX / 2); + sh_test!(shr(i64::MAX, (i64::BITS + 1) as $t) == i64::MAX / 2); + sh_test!(shr(isize::MAX, (isize::BITS + 1) as $t) == isize::MAX / 2); + + sh_test!(shr(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX / 2); + sh_test!(shr(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX / 2); + sh_test!(shr(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX / 2); + sh_test!(shr(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX / 2); + sh_test!(shr(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX / 2); + } + } + macro_rules! sh_test_negative_all { + ($t:ty) => { + sh_test!(shr(i8::MAX, -((i8::BITS + 1) as $t)) == -2); + sh_test!(shr(i16::MAX, -((i16::BITS + 1) as $t)) == -2); + sh_test!(shr(i32::MAX, -((i32::BITS + 1) as $t)) == -2); + sh_test!(shr(i64::MAX, -((i64::BITS + 1) as $t)) == -2); + sh_test!(shr(isize::MAX, -((isize::BITS + 1) as $t)) == -2); + + sh_test!(shr(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX - 1); + sh_test!(shr(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX - 1); + sh_test!(shr(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX - 1); + sh_test!(shr(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX - 1); + sh_test!(shr(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX - 1); + + + sh_test!(shl(i8::MAX, -((i8::BITS + 1) as $t)) == i8::MAX / 2); + sh_test!(shl(i16::MAX, -((i16::BITS + 1) as $t)) == i16::MAX / 2); + sh_test!(shl(i32::MAX, -((i32::BITS + 1) as $t)) == i32::MAX / 2); + sh_test!(shl(i64::MAX, -((i64::BITS + 1) as $t)) == i64::MAX / 2); + sh_test!(shl(isize::MAX, -((isize::BITS + 1) as $t)) == isize::MAX / 2); + + sh_test!(shl(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX / 2); + sh_test!(shl(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX / 2); + sh_test!(shl(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX / 2); + sh_test!(shl(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX / 2); + sh_test!(shl(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX / 2); + } + } + // FIXME(#23545): Uncomment the remaining tests + //sh_test_all!(i8); + //sh_test_all!(u8); + //sh_test_all!(i16); + //sh_test_all!(u16); + //sh_test_all!(i32); + //sh_test_all!(u32); + //sh_test_all!(i64); + //sh_test_all!(u64); + //sh_test_all!(isize); + sh_test_all!(usize); + + //sh_test_negative_all!(i8); + //sh_test_negative_all!(i16); + //sh_test_negative_all!(i32); + //sh_test_negative_all!(i64); + //sh_test_negative_all!(isize); +} + +fn test_sh_op_assigns() { + macro_rules! sh_assign_test { + ($op:ident ($initial:expr, $rhs:expr) == $ans:expr) => {{ + let mut tmp = Wrapping($initial); + tmp = black_box(tmp); + tmp.$op($rhs); + assert_eq!(black_box(tmp), Wrapping($ans)); + }} + } + macro_rules! sh_assign_test_all { + ($t:ty) => { + sh_assign_test!(shl_assign(i8::MAX, (i8::BITS + 1) as $t) == -2); + sh_assign_test!(shl_assign(i16::MAX, (i16::BITS + 1) as $t) == -2); + sh_assign_test!(shl_assign(i32::MAX, (i32::BITS + 1) as $t) == -2); + sh_assign_test!(shl_assign(i64::MAX, (i64::BITS + 1) as $t) == -2); + sh_assign_test!(shl_assign(isize::MAX, (isize::BITS + 1) as $t) == -2); + + sh_assign_test!(shl_assign(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX - 1); + sh_assign_test!(shl_assign(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX - 1); + sh_assign_test!(shl_assign(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX - 1); + sh_assign_test!(shl_assign(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX - 1); + sh_assign_test!(shl_assign(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX - 1); + + + sh_assign_test!(shr_assign(i8::MAX, (i8::BITS + 1) as $t) == i8::MAX / 2); + sh_assign_test!(shr_assign(i16::MAX, (i16::BITS + 1) as $t) == i16::MAX / 2); + sh_assign_test!(shr_assign(i32::MAX, (i32::BITS + 1) as $t) == i32::MAX / 2); + sh_assign_test!(shr_assign(i64::MAX, (i64::BITS + 1) as $t) == i64::MAX / 2); + sh_assign_test!(shr_assign(isize::MAX, (isize::BITS + 1) as $t) == isize::MAX / 2); + + sh_assign_test!(shr_assign(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX / 2); + sh_assign_test!(shr_assign(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX / 2); + sh_assign_test!(shr_assign(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX / 2); + sh_assign_test!(shr_assign(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX / 2); + sh_assign_test!(shr_assign(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX / 2); + } + } + macro_rules! sh_assign_test_negative_all { + ($t:ty) => { + sh_assign_test!(shr_assign(i8::MAX, -((i8::BITS + 1) as $t)) == -2); + sh_assign_test!(shr_assign(i16::MAX, -((i16::BITS + 1) as $t)) == -2); + sh_assign_test!(shr_assign(i32::MAX, -((i32::BITS + 1) as $t)) == -2); + sh_assign_test!(shr_assign(i64::MAX, -((i64::BITS + 1) as $t)) == -2); + sh_assign_test!(shr_assign(isize::MAX, -((isize::BITS + 1) as $t)) == -2); + + sh_assign_test!(shr_assign(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX - 1); + sh_assign_test!(shr_assign(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX - 1); + sh_assign_test!(shr_assign(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX - 1); + sh_assign_test!(shr_assign(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX - 1); + sh_assign_test!(shr_assign(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX - 1); + + + sh_assign_test!(shl_assign(i8::MAX, -((i8::BITS + 1) as $t)) == i8::MAX / 2); + sh_assign_test!(shl_assign(i16::MAX, -((i16::BITS + 1) as $t)) == i16::MAX / 2); + sh_assign_test!(shl_assign(i32::MAX, -((i32::BITS + 1) as $t)) == i32::MAX / 2); + sh_assign_test!(shl_assign(i64::MAX, -((i64::BITS + 1) as $t)) == i64::MAX / 2); + sh_assign_test!(shl_assign(isize::MAX, -((isize::BITS + 1) as $t)) == isize::MAX / 2); + + sh_assign_test!(shl_assign(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX / 2); + sh_assign_test!(shl_assign(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX / 2); + sh_assign_test!(shl_assign(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX / 2); + sh_assign_test!(shl_assign(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX / 2); + sh_assign_test!(shl_assign(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX / 2); + } + } + + // FIXME(#23545): Uncomment the remaining tests + //sh_assign_test_all!(i8); + //sh_assign_test_all!(u8); + //sh_assign_test_all!(i16); + //sh_assign_test_all!(u16); + //sh_assign_test_all!(i32); + //sh_assign_test_all!(u32); + //sh_assign_test_all!(i64); + //sh_assign_test_all!(u64); + //sh_assign_test_all!(isize); + sh_assign_test_all!(usize); + + //sh_assign_test_negative_all!(i8); + //sh_assign_test_negative_all!(i16); + //sh_assign_test_negative_all!(i32); + //sh_assign_test_negative_all!(i64); + //sh_assign_test_negative_all!(isize); +} diff --git a/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs b/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs new file mode 100644 index 00000000000..22db67bf920 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/numeric-method-autoexport.rs @@ -0,0 +1,35 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This file is intended to test only that methods are automatically +// reachable for each numeric type, for each exported impl, with no imports +// necessary. Testing the methods of the impls is done within the source +// file for each numeric type. + +use std::ops::Add; + +pub fn main() { +// ints + // num + assert_eq!(15_isize.add(6_isize), 21_isize); + assert_eq!(15_i8.add(6i8), 21_i8); + assert_eq!(15_i16.add(6i16), 21_i16); + assert_eq!(15_i32.add(6i32), 21_i32); + assert_eq!(15_i64.add(6i64), 21_i64); + +// uints + // num + assert_eq!(15_usize.add(6_usize), 21_usize); + assert_eq!(15_u8.add(6u8), 21_u8); + assert_eq!(15_u16.add(6u16), 21_u16); + assert_eq!(15_u32.add(6u32), 21_u32); + assert_eq!(15_u64.add(6u64), 21_u64); +} diff --git a/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs b/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs new file mode 100644 index 00000000000..16042128901 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/promoted_overflow_opt.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(const_err)] + +// compile-flags: -O + +fn main() { + let x = &(0u32 - 1); + assert_eq!(*x, u32::max_value()) +} diff --git a/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs b/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs new file mode 100644 index 00000000000..a822ac604fa --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/saturating-float-casts.rs @@ -0,0 +1,145 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction. +// compile-flags: -Z saturating-float-casts + +#![feature(test, stmt_expr_attributes)] +#![deny(overflowing_literals)] +extern crate test; + +use std::{f32, f64}; +use std::{u8, i8, u16, i16, u32, i32, u64, i64}; +#[cfg(not(target_os="emscripten"))] +use std::{u128, i128}; +use test::black_box; + +macro_rules! test { + ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ( + // black_box disables constant evaluation to test run-time conversions: + assert_eq!(black_box::<$src_ty>($val) as $dest_ty, $expected, + "run-time {} -> {}", stringify!($src_ty), stringify!($dest_ty)); + ); + + ($fval:expr, f* -> $ity:ident, $ival:expr) => ( + test!($fval, f32 -> $ity, $ival); + test!($fval, f64 -> $ity, $ival); + ) +} + +// This macro tests const eval in addition to run-time evaluation. +// If and when saturating casts are adopted, this macro should be merged with test!() to ensure +// that run-time and const eval agree on inputs that currently trigger a const eval error. +macro_rules! test_c { + ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ({ + test!($val, $src_ty -> $dest_ty, $expected); + { + const X: $src_ty = $val; + const Y: $dest_ty = X as $dest_ty; + assert_eq!(Y, $expected, + "const eval {} -> {}", stringify!($src_ty), stringify!($dest_ty)); + } + }); + + ($fval:expr, f* -> $ity:ident, $ival:expr) => ( + test_c!($fval, f32 -> $ity, $ival); + test_c!($fval, f64 -> $ity, $ival); + ) +} + +macro_rules! common_fptoi_tests { + ($fty:ident -> $($ity:ident)+) => ({ $( + test!($fty::NAN, $fty -> $ity, 0); + test!($fty::INFINITY, $fty -> $ity, $ity::MAX); + test!($fty::NEG_INFINITY, $fty -> $ity, $ity::MIN); + // These two tests are not solely float->int tests, in particular the latter relies on + // `u128::MAX as f32` not being UB. But that's okay, since this file tests int->float + // as well, the test is just slightly misplaced. + test!($ity::MIN as $fty, $fty -> $ity, $ity::MIN); + test!($ity::MAX as $fty, $fty -> $ity, $ity::MAX); + test_c!(0., $fty -> $ity, 0); + test_c!($fty::MIN_POSITIVE, $fty -> $ity, 0); + test!(-0.9, $fty -> $ity, 0); + test_c!(1., $fty -> $ity, 1); + test_c!(42., $fty -> $ity, 42); + )+ }); + + (f* -> $($ity:ident)+) => ({ + common_fptoi_tests!(f32 -> $($ity)+); + common_fptoi_tests!(f64 -> $($ity)+); + }) +} + +macro_rules! fptoui_tests { + ($fty: ident -> $($ity: ident)+) => ({ $( + test!(-0., $fty -> $ity, 0); + test!(-$fty::MIN_POSITIVE, $fty -> $ity, 0); + test!(-0.99999994, $fty -> $ity, 0); + test!(-1., $fty -> $ity, 0); + test!(-100., $fty -> $ity, 0); + test!(#[allow(overflowing_literals)] -1e50, $fty -> $ity, 0); + test!(#[allow(overflowing_literals)] -1e130, $fty -> $ity, 0); + )+ }); + + (f* -> $($ity:ident)+) => ({ + fptoui_tests!(f32 -> $($ity)+); + fptoui_tests!(f64 -> $($ity)+); + }) +} + +pub fn main() { + common_fptoi_tests!(f* -> i8 i16 i32 i64 u8 u16 u32 u64); + fptoui_tests!(f* -> u8 u16 u32 u64); + // FIXME emscripten does not support i128 + #[cfg(not(target_os="emscripten"))] { + common_fptoi_tests!(f* -> i128 u128); + fptoui_tests!(f* -> u128); + } + + // The following tests cover edge cases for some integer types. + + // # u8 + test_c!(254., f* -> u8, 254); + test!(256., f* -> u8, 255); + + // # i8 + test_c!(-127., f* -> i8, -127); + test!(-129., f* -> i8, -128); + test_c!(126., f* -> i8, 126); + test!(128., f* -> i8, 127); + + // # i32 + // -2147483648. is i32::MIN (exactly) + test_c!(-2147483648., f* -> i32, i32::MIN); + // 2147483648. is i32::MAX rounded up + test!(2147483648., f32 -> i32, 2147483647); + // With 24 significand bits, floats with magnitude in [2^30 + 1, 2^31] are rounded to + // multiples of 2^7. Therefore, nextDown(round(i32::MAX)) is 2^31 - 128: + test_c!(2147483520., f32 -> i32, 2147483520); + // Similarly, nextUp(i32::MIN) is i32::MIN + 2^8 and nextDown(i32::MIN) is i32::MIN - 2^7 + test!(-2147483904., f* -> i32, i32::MIN); + test_c!(-2147483520., f* -> i32, -2147483520); + + // # u32 + // round(MAX) and nextUp(round(MAX)) + test_c!(4294967040., f* -> u32, 4294967040); + test!(4294967296., f* -> u32, 4294967295); + + // # u128 + #[cfg(not(target_os="emscripten"))] + { + // float->int: + test_c!(f32::MAX, f32 -> u128, 0xffffff00000000000000000000000000); + // nextDown(f32::MAX) = 2^128 - 2 * 2^104 + const SECOND_LARGEST_F32: f32 = 340282326356119256160033759537265639424.; + test_c!(SECOND_LARGEST_F32, f32 -> u128, 0xfffffe00000000000000000000000000); + } +} diff --git a/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs b/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs new file mode 100644 index 00000000000..3effc8de97f --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/shift-near-oflo.rs @@ -0,0 +1,110 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// compile-flags: -C debug-assertions + +// Check that we do *not* overflow on a number of edge cases. +// (compare with test/run-fail/overflowing-{lsh,rsh}*.rs) + +fn main() { + test_left_shift(); + test_right_shift(); +} + +pub static mut HACK: i32 = 0; + +// Work around constant-evaluation +// The point of this test is to exercise the code generated for execution at runtime, +// `id` can never be flagged as a const fn by future aggressive analyses... +// due to the modification of the static +#[inline(never)] +fn id(x: T) -> T { + unsafe { HACK += 1; } + x +} + +fn test_left_shift() { + // negative rhs can panic, but values in [0,N-1] are okay for iN + + macro_rules! tests { + ($iN:ty, $uN:ty, $max_rhs:expr, $expect_i:expr, $expect_u:expr) => { { + let x = (1 as $iN) << id(0); + assert_eq!(x, 1); + let x = (1 as $uN) << id(0); + assert_eq!(x, 1); + let x = (1 as $iN) << id($max_rhs); + assert_eq!(x, $expect_i); + let x = (1 as $uN) << id($max_rhs); + assert_eq!(x, $expect_u); + // high-order bits on LHS are silently discarded without panic. + let x = (3 as $iN) << id($max_rhs); + assert_eq!(x, $expect_i); + let x = (3 as $uN) << id($max_rhs); + assert_eq!(x, $expect_u); + } } + } + + let x = 1_i8 << id(0); + assert_eq!(x, 1); + let x = 1_u8 << id(0); + assert_eq!(x, 1); + let x = 1_i8 << id(7); + assert_eq!(x, std::i8::MIN); + let x = 1_u8 << id(7); + assert_eq!(x, 0x80); + // high-order bits on LHS are silently discarded without panic. + let x = 3_i8 << id(7); + assert_eq!(x, std::i8::MIN); + let x = 3_u8 << id(7); + assert_eq!(x, 0x80); + + // above is (approximately) expanded from: + tests!(i8, u8, 7, std::i8::MIN, 0x80_u8); + + tests!(i16, u16, 15, std::i16::MIN, 0x8000_u16); + tests!(i32, u32, 31, std::i32::MIN, 0x8000_0000_u32); + tests!(i64, u64, 63, std::i64::MIN, 0x8000_0000_0000_0000_u64); +} + +fn test_right_shift() { + // negative rhs can panic, but values in [0,N-1] are okay for iN + + macro_rules! tests { + ($iN:ty, $uN:ty, $max_rhs:expr, + $signbit_i:expr, $highbit_i:expr, $highbit_u:expr) => + { { + let x = (1 as $iN) >> id(0); + assert_eq!(x, 1); + let x = (1 as $uN) >> id(0); + assert_eq!(x, 1); + let x = ($highbit_i) >> id($max_rhs-1); + assert_eq!(x, 1); + let x = ($highbit_u) >> id($max_rhs); + assert_eq!(x, 1); + // sign-bit is carried by arithmetic right shift + let x = ($signbit_i) >> id($max_rhs); + assert_eq!(x, -1); + // low-order bits on LHS are silently discarded without panic. + let x = ($highbit_i + 1) >> id($max_rhs-1); + assert_eq!(x, 1); + let x = ($highbit_u + 1) >> id($max_rhs); + assert_eq!(x, 1); + let x = ($signbit_i + 1) >> id($max_rhs); + assert_eq!(x, -1); + } } + } + + tests!(i8, u8, 7, std::i8::MIN, 0x40_i8, 0x80_u8); + tests!(i16, u16, 15, std::i16::MIN, 0x4000_u16, 0x8000_u16); + tests!(i32, u32, 31, std::i32::MIN, 0x4000_0000_u32, 0x8000_0000_u32); + tests!(i64, u64, 63, std::i64::MIN, + 0x4000_0000_0000_0000_u64, 0x8000_0000_0000_0000_u64); +} diff --git a/src/test/run-pass/numbers-arithmetic/shift-various-types.rs b/src/test/run-pass/numbers-arithmetic/shift-various-types.rs new file mode 100644 index 00000000000..1ae94255adf --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/shift-various-types.rs @@ -0,0 +1,58 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can do shifts by any integral type. + + +struct Panolpy { + i8: i8, + i16: i16, + i32: i32, + i64: i64, + isize: isize, + + u8: u8, + u16: u16, + u32: u32, + u64: u64, + usize: usize, +} + +fn foo(p: &Panolpy) { + assert_eq!(22 >> p.i8, 11); + assert_eq!(22 >> p.i16, 11); + assert_eq!(22 >> p.i32, 11); + assert_eq!(22 >> p.i64, 11); + assert_eq!(22 >> p.isize, 11); + + assert_eq!(22 >> p.u8, 11); + assert_eq!(22 >> p.u16, 11); + assert_eq!(22 >> p.u32, 11); + assert_eq!(22 >> p.u64, 11); + assert_eq!(22 >> p.usize, 11); +} + +fn main() { + let p = Panolpy { + i8: 1, + i16: 1, + i32: 1, + i64: 1, + isize: 1, + + u8: 1, + u16: 1, + u32: 1, + u64: 1, + usize: 1, + }; + foo(&p) +} diff --git a/src/test/run-pass/numbers-arithmetic/shift.rs b/src/test/run-pass/numbers-arithmetic/shift.rs new file mode 100644 index 00000000000..e9d48f1a1af --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/shift.rs @@ -0,0 +1,86 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] +#![allow(overflowing_literals)] + +// Testing shifts for various combinations of integers +// Issue #1570 + + +pub fn main() { + test_misc(); + test_expr(); + test_const(); +} + +fn test_misc() { + assert_eq!(1 << 1 << 1 << 1 << 1 << 1, 32); +} + +fn test_expr() { + let v10 = 10 as usize; + let v4 = 4 as u8; + let v2 = 2 as u8; + assert_eq!(v10 >> v2 as usize, v2 as usize); + assert_eq!(v10 << v4 as usize, 160 as usize); + + let v10 = 10 as u8; + let v4 = 4 as usize; + let v2 = 2 as usize; + assert_eq!(v10 >> v2 as usize, v2 as u8); + assert_eq!(v10 << v4 as usize, 160 as u8); + + let v10 = 10 as isize; + let v4 = 4 as i8; + let v2 = 2 as i8; + assert_eq!(v10 >> v2 as usize, v2 as isize); + assert_eq!(v10 << v4 as usize, 160 as isize); + + let v10 = 10 as i8; + let v4 = 4 as isize; + let v2 = 2 as isize; + assert_eq!(v10 >> v2 as usize, v2 as i8); + assert_eq!(v10 << v4 as usize, 160 as i8); + + let v10 = 10 as usize; + let v4 = 4 as isize; + let v2 = 2 as isize; + assert_eq!(v10 >> v2 as usize, v2 as usize); + assert_eq!(v10 << v4 as usize, 160 as usize); +} + +fn test_const() { + static r1_1: usize = 10_usize >> 2_usize; + static r2_1: usize = 10_usize << 4_usize; + assert_eq!(r1_1, 2 as usize); + assert_eq!(r2_1, 160 as usize); + + static r1_2: u8 = 10u8 >> 2_usize; + static r2_2: u8 = 10u8 << 4_usize; + assert_eq!(r1_2, 2 as u8); + assert_eq!(r2_2, 160 as u8); + + static r1_3: isize = 10 >> 2_usize; + static r2_3: isize = 10 << 4_usize; + assert_eq!(r1_3, 2 as isize); + assert_eq!(r2_3, 160 as isize); + + static r1_4: i8 = 10i8 >> 2_usize; + static r2_4: i8 = 10i8 << 4_usize; + assert_eq!(r1_4, 2 as i8); + assert_eq!(r2_4, 160 as i8); + + static r1_5: usize = 10_usize >> 2_usize; + static r2_5: usize = 10_usize << 4_usize; + assert_eq!(r1_5, 2 as usize); + assert_eq!(r2_5, 160 as usize); +} diff --git a/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs b/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs new file mode 100644 index 00000000000..b0ff7a255ab --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/signed-shift-const-eval.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +enum test { thing = -5 >> 1_usize } +pub fn main() { + assert_eq!(test::thing as isize, -3); +} diff --git a/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs b/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs new file mode 100644 index 00000000000..99dfd3ba1cf --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/u128-as-f32.rs @@ -0,0 +1,59 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten u128 not supported + +#![feature(test)] +#![deny(overflowing_literals)] +extern crate test; + +use std::f32; +use std::u128; +use test::black_box; + +macro_rules! test { + ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ({ + { + const X: $src_ty = $val; + const Y: $dest_ty = X as $dest_ty; + assert_eq!(Y, $expected, + "const eval {} -> {}", stringify!($src_ty), stringify!($dest_ty)); + } + // black_box disables constant evaluation to test run-time conversions: + assert_eq!(black_box::<$src_ty>($val) as $dest_ty, $expected, + "run-time {} -> {}", stringify!($src_ty), stringify!($dest_ty)); + }); +} + +pub fn main() { + // nextDown(f32::MAX) = 2^128 - 2 * 2^104 + const SECOND_LARGEST_F32: f32 = 340282326356119256160033759537265639424.; + + // f32::MAX - 0.5 ULP and smaller should be rounded down + test!(0xfffffe00000000000000000000000000, u128 -> f32, SECOND_LARGEST_F32); + test!(0xfffffe7fffffffffffffffffffffffff, u128 -> f32, SECOND_LARGEST_F32); + test!(0xfffffe80000000000000000000000000, u128 -> f32, SECOND_LARGEST_F32); + // numbers within < 0.5 ULP of f32::MAX it should be rounded to f32::MAX + test!(0xfffffe80000000000000000000000001, u128 -> f32, f32::MAX); + test!(0xfffffeffffffffffffffffffffffffff, u128 -> f32, f32::MAX); + test!(0xffffff00000000000000000000000000, u128 -> f32, f32::MAX); + test!(0xffffff00000000000000000000000001, u128 -> f32, f32::MAX); + test!(0xffffff7fffffffffffffffffffffffff, u128 -> f32, f32::MAX); + // f32::MAX + 0.5 ULP and greater should be rounded to infinity + test!(0xffffff80000000000000000000000000, u128 -> f32, f32::INFINITY); + test!(0xffffff80000000f00000000000000000, u128 -> f32, f32::INFINITY); + test!(0xffffff87ffffffffffffffff00000001, u128 -> f32, f32::INFINITY); + + // u128->f64 should not be affected by the u128->f32 checks + test!(0xffffff80000000000000000000000000, u128 -> f64, + 340282356779733661637539395458142568448.0); + test!(u128::MAX, u128 -> f64, 340282366920938463463374607431768211455.0); +} diff --git a/src/test/run-pass/numbers-arithmetic/u128.rs b/src/test/run-pass/numbers-arithmetic/u128.rs new file mode 100644 index 00000000000..c03d39e8416 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/u128.rs @@ -0,0 +1,132 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten u128 not supported + +// compile-flags: -Z borrowck=compare + +#![feature(test)] + +extern crate test; +use test::black_box as b; + +fn main() { + let x: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFF; + assert_eq!(0, !x); + assert_eq!(0, !x); + let y: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFE; + assert_eq!(!1, y); + assert_eq!(x, y | 1); + assert_eq!(0xFAFF_0000_FF8F_0000__FFFF_0000_FFFF_FFFE, + y & + 0xFAFF_0000_FF8F_0000__FFFF_0000_FFFF_FFFF); + let z: u128 = 0xABCD_EF; + assert_eq!(z * z, 0x734C_C2F2_A521); + assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); + assert_eq!(z + z + z + z, 0x2AF3_7BC); + let k: u128 = 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; + assert_eq!(k + k, 0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); + assert_eq!(0, k - k); + assert_eq!(0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k - z); + assert_eq!(0x1000_0000_0000_0000_0000_0000_0000_000, + k - 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!(0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); + assert_eq!(0, k % 42); + assert_eq!(15, z % 42); + assert_eq!(0x169D_A8020_CEC18, k % 0x3ACB_FE49_FF24_AC); + assert_eq!(0x91A2_B3C4_D5E6_F7, k >> 65); + assert_eq!(0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); + assert!(k > z); + assert!(y > k); + assert!(y < x); + assert_eq!(x as u64, !0); + assert_eq!(z as u64, 0xABCD_EF); + assert_eq!(k as u64, 0xFEDC_BA98_7654_3210); + assert_eq!(k as i128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); + assert_eq!((z as f64) as u128, z); + assert_eq!((z as f32) as u128, z); + assert_eq!((z as f64 * 16.0) as u128, z * 16); + assert_eq!((z as f32 * 16.0) as u128, z * 16); + let l :u128 = 432 << 100; + assert_eq!((l as f32) as u128, l); + assert_eq!((l as f64) as u128, l); + // formatting + let j: u128 = 1 << 67; + assert_eq!("147573952589676412928", format!("{}", j)); + assert_eq!("80000000000000000", format!("{:x}", j)); + assert_eq!("20000000000000000000000", format!("{:o}", j)); + assert_eq!("10000000000000000000000000000000000000000000000000000000000000000000", + format!("{:b}", j)); + assert_eq!("340282366920938463463374607431768211455", + format!("{}", u128::max_value())); + assert_eq!("147573952589676412928", format!("{:?}", j)); + // common traits + assert_eq!(x, b(x.clone())); + // overflow checks + assert_eq!((z).checked_mul(z), Some(0x734C_C2F2_A521)); + assert_eq!((k).checked_mul(k), None); + let l: u128 = b(u128::max_value() - 10); + let o: u128 = b(17); + assert_eq!(l.checked_add(b(11)), None); + assert_eq!(l.checked_sub(l), Some(0)); + assert_eq!(o.checked_sub(b(18)), None); + assert_eq!(b(1u128).checked_shl(b(127)), Some(1 << 127)); + assert_eq!(o.checked_shl(b(128)), None); + + // Test cases for all udivmodti4 branches. + // case "0X/0X" + assert_eq!(b(0x69545bd57727c050_u128) / + b(0x3283527a3350d88c_u128), + 2u128); + // case "0X/KX" + assert_eq!(b(0x0_8003c9c50b473ae6_u128) / + b(0x1_283e8838c30fa8f4_u128), + 0u128); + // case "K0/K0" + assert_eq!(b(0xc43f42a207978720_u128 << 64) / + b(0x098e62b74c23cf1a_u128 << 64), + 20u128); + // case "KK/K0" for power-of-two D. + assert_eq!(b(0xa9008fb6c9d81e42_0e25730562a601c8_u128) / + b(1u128 << 120), + 169u128); + // case "KK/K0" with N >= D (https://github.com/rust-lang/rust/issues/41228). + assert_eq!(b(0xe4d26e59f0640328_06da5b06efe83a41_u128) / + b(0x330fcb030ea4447c_u128 << 64), + 4u128); + assert_eq!(b(3u128 << 64 | 1) / + b(3u128 << 64), + 1u128); + // case "KK/K0" with N < D. + assert_eq!(b(0x6655c9fb66ca2884_e2d1dfd470158c62_u128) / + b(0xb35b667cab7e355b_u128 << 64), + 0u128); + // case "KX/0K" for power-of-two D. + assert_eq!(b(0x3e49dd84feb2df59_7b2f97d93a253969_u128) / + b(1u128 << 4), + 0x03e49dd84feb2df5_97b2f97d93a25396_u128); + // case "KX/0K" in general. + assert_eq!(b(0x299692b3a1dae5bd_6162e6f489d2620e_u128) / + b(0x900b6f027571d6f7_u128), + 0x49e95f54b0442578_u128); + // case "KX/KK" with N >= D. + assert_eq!(b(0xc7b889180b67b07d_bc1a3c88783d35b5_u128) / + b(0x1d7e69f53160b9e2_60074771e852f244_u128), + 6u128); + // case "KX/KK" with N < D. + assert_eq!(b(0x679289ac23bb334f_36144401cf882172_u128) / + b(0x7b0b271b64865f05_f54a7b72746c062f_u128), + 0u128); + + // iter-arithmetic traits + assert_eq!(10u128, [1u128, 2, 3, 4].iter().sum()); + assert_eq!(24u128, [1u128, 2, 3, 4].iter().product()); +} diff --git a/src/test/run-pass/numbers-arithmetic/u32-decr.rs b/src/test/run-pass/numbers-arithmetic/u32-decr.rs new file mode 100644 index 00000000000..e86d3abefa7 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/u32-decr.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +pub fn main() { + let mut word: u32 = 200000; + word = word - 1; + assert_eq!(word, 199999); +} diff --git a/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs b/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs new file mode 100644 index 00000000000..2567da479f1 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/u8-incr-decr.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +// These constants were chosen because they aren't used anywhere +// in the rest of the generated code so they're easily grep-able. + +pub fn main() { + let mut x: u8 = 19; // 0x13 + + let mut y: u8 = 35; // 0x23 + + x = x + 7; // 0x7 + + y = y - 9; // 0x9 + + assert_eq!(x, y); +} diff --git a/src/test/run-pass/numbers-arithmetic/u8-incr.rs b/src/test/run-pass/numbers-arithmetic/u8-incr.rs new file mode 100644 index 00000000000..ca49efaade6 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/u8-incr.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +pub fn main() { + let mut x: u8 = 12; + let y: u8 = 12; + x = x + 1; + x = x - 1; + assert_eq!(x, y); + // x = 14; + // x = x + 1; + +} diff --git a/src/test/run-pass/numbers-arithmetic/uint.rs b/src/test/run-pass/numbers-arithmetic/uint.rs new file mode 100644 index 00000000000..01ee2167c72 --- /dev/null +++ b/src/test/run-pass/numbers-arithmetic/uint.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + +// pretty-expanded FIXME #23616 + +pub fn main() { let _x: usize = 10 as usize; } diff --git a/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs b/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs new file mode 100644 index 00000000000..3c8cba13ae7 --- /dev/null +++ b/src/test/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs @@ -0,0 +1,40 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ops::Deref; + +struct DerefWithHelper { + pub helper: H, + pub value: Option +} + +trait Helper { + fn helper_borrow(&self) -> &T; +} + +impl Helper for Option { + fn helper_borrow(&self) -> &T { + self.as_ref().unwrap() + } +} + +impl> Deref for DerefWithHelper { + type Target = T; + + fn deref(&self) -> &T { + self.helper.helper_borrow() + } +} + +// Test cross-crate autoderef + vtable. +pub fn check(x: T, y: T) -> bool { + let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), value: None }; + d.eq(&y) +} diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-count.rs b/src/test/run-pass/overloaded/overloaded-autoderef-count.rs new file mode 100644 index 00000000000..0e07be53829 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-autoderef-count.rs @@ -0,0 +1,84 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cell::Cell; +use std::ops::{Deref, DerefMut}; + +#[derive(PartialEq)] +struct DerefCounter { + count_imm: Cell, + count_mut: usize, + value: T +} + +impl DerefCounter { + fn new(value: T) -> DerefCounter { + DerefCounter { + count_imm: Cell::new(0), + count_mut: 0, + value: value + } + } + + fn counts(&self) -> (usize, usize) { + (self.count_imm.get(), self.count_mut) + } +} + +impl Deref for DerefCounter { + type Target = T; + + fn deref(&self) -> &T { + self.count_imm.set(self.count_imm.get() + 1); + &self.value + } +} + +impl DerefMut for DerefCounter { + fn deref_mut(&mut self) -> &mut T { + self.count_mut += 1; + &mut self.value + } +} + +#[derive(PartialEq, Debug)] +struct Point { + x: isize, + y: isize +} + +impl Point { + fn get(&self) -> (isize, isize) { + (self.x, self.y) + } +} + +pub fn main() { + let mut p = DerefCounter::new(Point {x: 0, y: 0}); + + let _ = p.x; + assert_eq!(p.counts(), (1, 0)); + + let _ = &p.x; + assert_eq!(p.counts(), (2, 0)); + + let _ = &mut p.y; + assert_eq!(p.counts(), (2, 1)); + + p.x += 3; + assert_eq!(p.counts(), (2, 2)); + + p.get(); + assert_eq!(p.counts(), (3, 2)); + + // Check the final state. + assert_eq!(*p, Point {x: 3, y: 0}); +} diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs b/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs new file mode 100644 index 00000000000..f4f42add88f --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-autoderef-indexing.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::ops::Deref; + +struct DerefArray<'a, T:'a> { + inner: &'a [T] +} + +impl<'a, T> Deref for DerefArray<'a, T> { + type Target = &'a [T]; + + fn deref<'b>(&'b self) -> &'b &'a [T] { + &self.inner + } +} + +pub fn main() { + let a = &[1, 2, 3]; + assert_eq!(DerefArray {inner: a}[1], 2); +} diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-order.rs b/src/test/run-pass/overloaded/overloaded-autoderef-order.rs new file mode 100644 index 00000000000..1480b036542 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-autoderef-order.rs @@ -0,0 +1,81 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::rc::Rc; +use std::ops::Deref; + +#[derive(Copy, Clone)] +struct DerefWrapper { + x: X, + y: Y +} + +impl DerefWrapper { + fn get_x(self) -> X { + self.x + } +} + +impl Deref for DerefWrapper { + type Target = Y; + + fn deref(&self) -> &Y { + &self.y + } +} + +mod priv_test { + use std::ops::Deref; + + #[derive(Copy, Clone)] + pub struct DerefWrapperHideX { + x: X, + pub y: Y + } + + impl DerefWrapperHideX { + pub fn new(x: X, y: Y) -> DerefWrapperHideX { + DerefWrapperHideX { + x: x, + y: y + } + } + } + + impl Deref for DerefWrapperHideX { + type Target = Y; + + fn deref(&self) -> &Y { + &self.y + } + } +} + +pub fn main() { + let nested = DerefWrapper {x: true, y: DerefWrapper {x: 0, y: 1}}; + + // Use the first field that you can find. + assert_eq!(nested.x, true); + assert_eq!((*nested).x, 0); + + // Same for methods, even though there are multiple + // candidates (at different nesting levels). + assert_eq!(nested.get_x(), true); + assert_eq!((*nested).get_x(), 0); + + // Also go through multiple levels of indirection. + assert_eq!(Rc::new(nested).x, true); + + let nested_priv = priv_test::DerefWrapperHideX::new(true, DerefWrapper {x: 0, y: 1}); + assert_eq!(nested_priv.x, 0); + assert_eq!((*nested_priv).x, 0); +} diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs b/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs new file mode 100644 index 00000000000..2ed9032f86e --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::ops::Deref; + +struct DerefWithHelper { + helper: H, + value: T +} + +trait Helper { + fn helper_borrow(&self) -> &T; +} + +impl Helper for Option { + fn helper_borrow(&self) -> &T { + self.as_ref().unwrap() + } +} + +impl> Deref for DerefWithHelper { + type Target = T; + + fn deref(&self) -> &T { + self.helper.helper_borrow() + } +} + +struct Foo {x: isize} + +impl Foo { + fn foo(&self) -> isize {self.x} +} + +pub fn main() { + let x: DerefWithHelper, Foo> = + DerefWithHelper { helper: Some(Foo {x: 5}), value: Foo { x: 2 } }; + assert_eq!(x.foo(), 5); +} diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs b/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs new file mode 100644 index 00000000000..9408d02ba33 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-autoderef-xcrate.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:overloaded_autoderef_xc.rs + + +extern crate overloaded_autoderef_xc; + +fn main() { + assert!(overloaded_autoderef_xc::check(5, 5)); +} diff --git a/src/test/run-pass/overloaded/overloaded-autoderef.rs b/src/test/run-pass/overloaded/overloaded-autoderef.rs new file mode 100644 index 00000000000..7be57400da0 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-autoderef.rs @@ -0,0 +1,54 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(box_syntax, core)] + +use std::cell::RefCell; +use std::rc::Rc; + +#[derive(PartialEq, Debug)] +struct Point { + x: isize, + y: isize +} + +pub fn main() { + let box_5: Box<_> = box 5_usize; + let point = Rc::new(Point {x: 2, y: 4}); + assert_eq!(point.x, 2); + assert_eq!(point.y, 4); + + let i = Rc::new(RefCell::new(2)); + let i_value = *i.borrow(); + *i.borrow_mut() = 5; + assert_eq!((i_value, *i.borrow()), (2, 5)); + + let s = Rc::new("foo".to_string()); + assert_eq!(&**s, "foo"); + + let mut_s = Rc::new(RefCell::new(String::from("foo"))); + mut_s.borrow_mut().push_str("bar"); + // HACK assert_eq! would panic here because it stores the LHS and RHS in two locals. + assert_eq!(&**mut_s.borrow(), "foobar"); + assert_eq!(&**mut_s.borrow_mut(), "foobar"); + + let p = Rc::new(RefCell::new(Point {x: 1, y: 2})); + p.borrow_mut().x = 3; + p.borrow_mut().y += 3; + assert_eq!(*p.borrow(), Point {x: 3, y: 5}); + + let v = Rc::new(RefCell::new([1, 2, 3])); + v.borrow_mut()[0] = 3; + v.borrow_mut()[1] += 3; + assert_eq!((v.borrow()[0], v.borrow()[1], v.borrow()[2]), (3, 5, 3)); +} diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs b/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs new file mode 100644 index 00000000000..d80ed4531fe --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-calls-object-one-arg.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests calls to closure arguments where the closure takes 1 argument. +// This is a bit tricky due to rust-call ABI. + + +fn foo(f: &mut FnMut(isize) -> isize) -> isize { + f(22) +} + +fn main() { + let z = foo(&mut |x| x *100); + assert_eq!(z, 2200); +} diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs b/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs new file mode 100644 index 00000000000..bfc815baeaa --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-calls-object-two-args.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests calls to closure arguments where the closure takes 2 arguments. +// This is a bit tricky due to rust-call ABI. + + +fn foo(f: &mut FnMut(isize, isize) -> isize) -> isize { + f(1, 2) +} + +fn main() { + let z = foo(&mut |x, y| x * 10 + y); + assert_eq!(z, 12); +} diff --git a/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs b/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs new file mode 100644 index 00000000000..ebabaf09f57 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-calls-object-zero-args.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests calls to closure arguments where the closure takes 0 arguments. +// This is a bit tricky due to rust-call ABI. + + +fn foo(f: &mut FnMut() -> isize) -> isize { + f() +} + +fn main() { + let z = foo(&mut || 22); + assert_eq!(z, 22); +} diff --git a/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs b/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs new file mode 100644 index 00000000000..6db534d3081 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-calls-param-vtables.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that nested vtables work with overloaded calls. + +// pretty-expanded FIXME #23616 + +#![feature(unboxed_closures, fn_traits)] + +use std::marker::PhantomData; +use std::ops::Fn; +use std::ops::Add; + +struct G(PhantomData); + +impl<'a, A: Add> Fn<(A,)> for G { + extern "rust-call" fn call(&self, (arg,): (A,)) -> i32 { + arg.add(1) + } +} + +impl<'a, A: Add> FnMut<(A,)> for G { + extern "rust-call" fn call_mut(&mut self, args: (A,)) -> i32 { self.call(args) } +} + +impl<'a, A: Add> FnOnce<(A,)> for G { + type Output = i32; + extern "rust-call" fn call_once(self, args: (A,)) -> i32 { self.call(args) } +} + +fn main() { + // ICE trigger + (G(PhantomData))(1); +} diff --git a/src/test/run-pass/overloaded/overloaded-calls-simple.rs b/src/test/run-pass/overloaded/overloaded-calls-simple.rs new file mode 100644 index 00000000000..825263c891d --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-calls-simple.rs @@ -0,0 +1,88 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(lang_items, unboxed_closures, fn_traits)] + +use std::ops::{Fn, FnMut, FnOnce}; + +struct S1 { + x: i32, + y: i32, +} + +impl FnMut<(i32,)> for S1 { + extern "rust-call" fn call_mut(&mut self, (z,): (i32,)) -> i32 { + self.x * self.y * z + } +} + +impl FnOnce<(i32,)> for S1 { + type Output = i32; + extern "rust-call" fn call_once(mut self, args: (i32,)) -> i32 { + self.call_mut(args) + } +} + +struct S2 { + x: i32, + y: i32, +} + +impl Fn<(i32,)> for S2 { + extern "rust-call" fn call(&self, (z,): (i32,)) -> i32 { + self.x * self.y * z + } +} + +impl FnMut<(i32,)> for S2 { + extern "rust-call" fn call_mut(&mut self, args: (i32,)) -> i32 { self.call(args) } +} + +impl FnOnce<(i32,)> for S2 { + type Output = i32; + extern "rust-call" fn call_once(self, args: (i32,)) -> i32 { self.call(args) } +} + +struct S3 { + x: i32, + y: i32, +} + +impl FnOnce<(i32,i32)> for S3 { + type Output = i32; + extern "rust-call" fn call_once(self, (z,zz): (i32,i32)) -> i32 { + self.x * self.y * z * zz + } +} + +fn main() { + let mut s = S1 { + x: 3, + y: 3, + }; + let ans = s(3); + + assert_eq!(ans, 27); + let s = S2 { + x: 3, + y: 3, + }; + let ans = s.call((3,)); + assert_eq!(ans, 27); + + let s = S3 { + x: 3, + y: 3, + }; + let ans = s(3, 1); + assert_eq!(ans, 27); +} diff --git a/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs b/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs new file mode 100644 index 00000000000..de8915493da --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-calls-zero-args.rs @@ -0,0 +1,40 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(unboxed_closures, fn_traits)] + +use std::ops::FnMut; + +struct S { + x: i32, + y: i32, +} + +impl FnMut<()> for S { + extern "rust-call" fn call_mut(&mut self, (): ()) -> i32 { + self.x * self.y + } +} + +impl FnOnce<()> for S { + type Output = i32; + extern "rust-call" fn call_once(mut self, args: ()) -> i32 { self.call_mut(args) } +} + +fn main() { + let mut s = S { + x: 3, + y: 3, + }; + let ans = s(); + assert_eq!(ans, 9); +} diff --git a/src/test/run-pass/overloaded/overloaded-deref-count.rs b/src/test/run-pass/overloaded/overloaded-deref-count.rs new file mode 100644 index 00000000000..79040afbd0e --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-deref-count.rs @@ -0,0 +1,88 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::cell::Cell; +use std::ops::{Deref, DerefMut}; +use std::vec::Vec; + +struct DerefCounter { + count_imm: Cell, + count_mut: usize, + value: T +} + +impl DerefCounter { + fn new(value: T) -> DerefCounter { + DerefCounter { + count_imm: Cell::new(0), + count_mut: 0, + value: value + } + } + + fn counts(&self) -> (usize, usize) { + (self.count_imm.get(), self.count_mut) + } +} + +impl Deref for DerefCounter { + type Target = T; + + fn deref(&self) -> &T { + self.count_imm.set(self.count_imm.get() + 1); + &self.value + } +} + +impl DerefMut for DerefCounter { + fn deref_mut(&mut self) -> &mut T { + self.count_mut += 1; + &mut self.value + } +} + +pub fn main() { + let mut n = DerefCounter::new(0); + let mut v = DerefCounter::new(Vec::new()); + + let _ = *n; // Immutable deref + copy a POD. + assert_eq!(n.counts(), (1, 0)); + + let _ = (&*n, &*v); // Immutable deref + borrow. + assert_eq!(n.counts(), (2, 0)); assert_eq!(v.counts(), (1, 0)); + + let _ = (&mut *n, &mut *v); // Mutable deref + mutable borrow. + assert_eq!(n.counts(), (2, 1)); assert_eq!(v.counts(), (1, 1)); + + let mut v2 = Vec::new(); + v2.push(1); + + *n = 5; *v = v2; // Mutable deref + assignment. + assert_eq!(n.counts(), (2, 2)); assert_eq!(v.counts(), (1, 2)); + + *n -= 3; // Mutable deref + assignment with binary operation. + assert_eq!(n.counts(), (2, 3)); + + // Immutable deref used for calling a method taking &self. (The + // typechecker is smarter now about doing this.) + (*n).to_string(); + assert_eq!(n.counts(), (3, 3)); + + // Mutable deref used for calling a method taking &mut self. + (*v).push(2); + assert_eq!(v.counts(), (1, 3)); + + // Check the final states. + assert_eq!(*n, 2); + let expected: &[_] = &[1, 2]; + assert_eq!((*v), expected); +} diff --git a/src/test/run-pass/overloaded/overloaded-deref.rs b/src/test/run-pass/overloaded/overloaded-deref.rs new file mode 100644 index 00000000000..779d1b2391e --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-deref.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cell::RefCell; +use std::rc::Rc; +use std::string::String; + +#[derive(PartialEq, Debug)] +struct Point { + x: isize, + y: isize +} + +pub fn main() { + assert_eq!(*Rc::new(5), 5); + assert_eq!(***Rc::new(Box::new(Box::new(5))), 5); + assert_eq!(*Rc::new(Point {x: 2, y: 4}), Point {x: 2, y: 4}); + + let i = Rc::new(RefCell::new(2)); + let i_value = *(*i).borrow(); + *(*i).borrow_mut() = 5; + assert_eq!((i_value, *(*i).borrow()), (2, 5)); + + let s = Rc::new("foo".to_string()); + assert_eq!(*s, "foo".to_string()); + assert_eq!((*s), "foo"); + + let mut_s = Rc::new(RefCell::new(String::from("foo"))); + (*(*mut_s).borrow_mut()).push_str("bar"); + // assert_eq! would panic here because it stores the LHS and RHS in two locals. + assert_eq!((*(*mut_s).borrow()), "foobar"); + assert_eq!((*(*mut_s).borrow_mut()), "foobar"); + + let p = Rc::new(RefCell::new(Point {x: 1, y: 2})); + (*(*p).borrow_mut()).x = 3; + (*(*p).borrow_mut()).y += 3; + assert_eq!(*(*p).borrow(), Point {x: 3, y: 5}); + + let v = Rc::new(RefCell::new(vec![1, 2, 3])); + (*(*v).borrow_mut())[0] = 3; + (*(*v).borrow_mut())[1] += 3; + assert_eq!(((*(*v).borrow())[0], + (*(*v).borrow())[1], + (*(*v).borrow())[2]), (3, 5, 3)); +} diff --git a/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs b/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs new file mode 100644 index 00000000000..7c23e8e28f8 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-index-assoc-list.rs @@ -0,0 +1,58 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test overloading of the `[]` operator. In particular test that it +// takes its argument *by reference*. + +use std::ops::Index; + +struct AssociationList { + pairs: Vec> } + +#[derive(Clone)] +struct AssociationPair { + key: K, + value: V +} + +impl AssociationList { + fn push(&mut self, key: K, value: V) { + self.pairs.push(AssociationPair {key: key, value: value}); + } +} + +impl<'a, K: PartialEq + std::fmt::Debug, V:Clone> Index<&'a K> for AssociationList { + type Output = V; + + fn index(&self, index: &K) -> &V { + for pair in &self.pairs { + if pair.key == *index { + return &pair.value + } + } + panic!("No value found for key: {:?}", index); + } +} + +pub fn main() { + let foo = "foo".to_string(); + let bar = "bar".to_string(); + + let mut list = AssociationList {pairs: Vec::new()}; + list.push(foo.clone(), 22); + list.push(bar.clone(), 44); + + assert_eq!(list[&foo], 22); + assert_eq!(list[&bar], 44); + + assert_eq!(list[&foo], 22); + assert_eq!(list[&bar], 44); +} diff --git a/src/test/run-pass/overloaded/overloaded-index-autoderef.rs b/src/test/run-pass/overloaded/overloaded-index-autoderef.rs new file mode 100644 index 00000000000..024bd4e2bb7 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-index-autoderef.rs @@ -0,0 +1,87 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// Test overloaded indexing combined with autoderef. + +#![feature(box_syntax, core)] + +use std::ops::{Index, IndexMut}; + +struct Foo { + x: isize, + y: isize, +} + +impl Index for Foo { + type Output = isize; + + fn index(&self, z: isize) -> &isize { + if z == 0 { + &self.x + } else { + &self.y + } + } +} + +impl IndexMut for Foo { + fn index_mut(&mut self, z: isize) -> &mut isize { + if z == 0 { + &mut self.x + } else { + &mut self.y + } + } +} + +trait Int { + fn get(self) -> isize; + fn get_from_ref(&self) -> isize; + fn inc(&mut self); +} + +impl Int for isize { + fn get(self) -> isize { self } + fn get_from_ref(&self) -> isize { *self } + fn inc(&mut self) { *self += 1; } +} + +fn main() { + let mut f: Box<_> = box Foo { + x: 1, + y: 2, + }; + + assert_eq!(f[1], 2); + + f[0] = 3; + + assert_eq!(f[0], 3); + + // Test explicit IndexMut where `f` must be autoderef: + { + let p = &mut f[1]; + *p = 4; + } + + // Test explicit Index where `f` must be autoderef: + { + let p = &f[1]; + assert_eq!(*p, 4); + } + + // Test calling methods with `&mut self`, `self, and `&self` receivers: + f[1].inc(); + assert_eq!(f[1].get(), 5); + assert_eq!(f[1].get_from_ref(), 5); +} diff --git a/src/test/run-pass/overloaded/overloaded-index-in-field.rs b/src/test/run-pass/overloaded/overloaded-index-in-field.rs new file mode 100644 index 00000000000..3302a4e3a7d --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-index-in-field.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test using overloaded indexing when the "map" is stored in a +// field. This caused problems at some point. + +use std::ops::Index; + +struct Foo { + x: isize, + y: isize, +} + +struct Bar { + foo: Foo +} + +impl Index for Foo { + type Output = isize; + + fn index(&self, z: isize) -> &isize { + if z == 0 { + &self.x + } else { + &self.y + } + } +} + +trait Int { + fn get(self) -> isize; + fn get_from_ref(&self) -> isize; + fn inc(&mut self); +} + +impl Int for isize { + fn get(self) -> isize { self } + fn get_from_ref(&self) -> isize { *self } + fn inc(&mut self) { *self += 1; } +} + +fn main() { + let f = Bar { foo: Foo { + x: 1, + y: 2, + } }; + assert_eq!(f.foo[1].get(), 2); +} diff --git a/src/test/run-pass/overloaded/overloaded-index.rs b/src/test/run-pass/overloaded/overloaded-index.rs new file mode 100644 index 00000000000..8ae612764a7 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded-index.rs @@ -0,0 +1,74 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::{Index, IndexMut}; + +struct Foo { + x: isize, + y: isize, +} + +impl Index for Foo { + type Output = isize; + + fn index(&self, z: isize) -> &isize { + if z == 0 { + &self.x + } else { + &self.y + } + } +} + +impl IndexMut for Foo { + fn index_mut(&mut self, z: isize) -> &mut isize { + if z == 0 { + &mut self.x + } else { + &mut self.y + } + } +} + +trait Int { + fn get(self) -> isize; + fn get_from_ref(&self) -> isize; + fn inc(&mut self); +} + +impl Int for isize { + fn get(self) -> isize { self } + fn get_from_ref(&self) -> isize { *self } + fn inc(&mut self) { *self += 1; } +} + +fn main() { + let mut f = Foo { + x: 1, + y: 2, + }; + assert_eq!(f[1], 2); + f[0] = 3; + assert_eq!(f[0], 3); + { + let p = &mut f[1]; + *p = 4; + } + { + let p = &f[1]; + assert_eq!(*p, 4); + } + + // Test calling methods with `&mut self`, `self, and `&self` receivers: + f[1].inc(); + assert_eq!(f[1].get(), 5); + assert_eq!(f[1].get_from_ref(), 5); +} diff --git a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs new file mode 100644 index 00000000000..d092df32957 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs @@ -0,0 +1,103 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we choose Deref or DerefMut appropriately based on mutability of ref bindings (#15609). + +use std::ops::{Deref, DerefMut}; + +struct DerefOk(T); +struct DerefMutOk(T); + +impl Deref for DerefOk { + type Target = T; + fn deref(&self) -> &Self::Target { + &self.0 + } +} + +impl DerefMut for DerefOk { + fn deref_mut(&mut self) -> &mut Self::Target { + panic!() + } +} + +impl Deref for DerefMutOk { + type Target = T; + fn deref(&self) -> &Self::Target { + panic!() + } +} + +impl DerefMut for DerefMutOk { + fn deref_mut(&mut self) -> &mut Self::Target { + &mut self.0 + } +} + +fn main() { + // Check that mutable ref binding in match picks DerefMut + let mut b = DerefMutOk(0); + match *b { + ref mut n => n, + }; + + // Check that mutable ref binding in let picks DerefMut + let mut y = DerefMutOk(1); + let ref mut z = *y; + + // Check that immutable ref binding in match picks Deref + let mut b = DerefOk(2); + match *b { + ref n => n, + }; + + // Check that immutable ref binding in let picks Deref + let mut y = DerefOk(3); + let ref z = *y; + + // Check that mixed mutable/immutable ref binding in match picks DerefMut + let mut b = DerefMutOk((0, 9)); + match *b { + (ref mut n, ref m) => (n, m), + }; + + let mut b = DerefMutOk((0, 9)); + match *b { + (ref n, ref mut m) => (n, m), + }; + + // Check that mixed mutable/immutable ref binding in let picks DerefMut + let mut y = DerefMutOk((1, 8)); + let (ref mut z, ref a) = *y; + + let mut y = DerefMutOk((1, 8)); + let (ref z, ref mut a) = *y; + + // Check that multiple immutable ref bindings in match picks Deref + let mut b = DerefOk((2, 7)); + match *b { + (ref n, ref m) => (n, m), + }; + + // Check that multiple immutable ref bindings in let picks Deref + let mut y = DerefOk((3, 6)); + let (ref z, ref a) = *y; + + // Check that multiple mutable ref bindings in match picks DerefMut + let mut b = DerefMutOk((4, 5)); + match *b { + (ref mut n, ref mut m) => (n, m), + }; + + // Check that multiple mutable ref bindings in let picks DerefMut + let mut y = DerefMutOk((5, 4)); + let (ref mut z, ref mut a) = *y; +} diff --git a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs new file mode 100644 index 00000000000..8f0b3356d07 --- /dev/null +++ b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we choose Deref or DerefMut appropriately based on mutability of ref bindings (#15609). + +fn main() { + use std::cell::RefCell; + + struct S { + node: E, + } + + enum E { + Foo(u32), + Bar, + } + + // Check match + let x = RefCell::new(S { node: E::Foo(0) }); + + let mut b = x.borrow_mut(); + match b.node { + E::Foo(ref mut n) => *n += 1, + _ => (), + } + + // Check let + let x = RefCell::new(0); + let mut y = x.borrow_mut(); + let ref mut z = *y; + + fn foo(a: &mut RefCell>) { + if let Some(ref mut s) = *a.borrow_mut() { + s.push('a') + } + } +} diff --git a/src/test/run-pass/packed/auxiliary/packed.rs b/src/test/run-pass/packed/auxiliary/packed.rs new file mode 100644 index 00000000000..828be41cd41 --- /dev/null +++ b/src/test/run-pass/packed/auxiliary/packed.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(repr_packed)] + +#[repr(packed)] +pub struct P1S5 { + a: u8, + b: u32 +} + +#[repr(packed(2))] +pub struct P2S6 { + a: u8, + b: u32, + c: u8 +} + +#[repr(C, packed(2))] +pub struct P2CS8 { + a: u8, + b: u32, + c: u8 +} diff --git a/src/test/run-pass/packed/packed-struct-borrow-element.rs b/src/test/run-pass/packed/packed-struct-borrow-element.rs new file mode 100644 index 00000000000..5d5bcbd325d --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-borrow-element.rs @@ -0,0 +1,46 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten weird assertion? + +#![feature(repr_packed)] + +#[repr(packed)] +struct Foo1 { + bar: u8, + baz: usize +} + +#[repr(packed(2))] +struct Foo2 { + bar: u8, + baz: usize +} + +#[repr(C, packed(4))] +struct Foo4C { + bar: u8, + baz: usize +} + +pub fn main() { + let foo = Foo1 { bar: 1, baz: 2 }; + let brw = unsafe { &foo.baz }; + assert_eq!(*brw, 2); + + let foo = Foo2 { bar: 1, baz: 2 }; + let brw = unsafe { &foo.baz }; + assert_eq!(*brw, 2); + + let foo = Foo4C { bar: 1, baz: 2 }; + let brw = unsafe { &foo.baz }; + assert_eq!(*brw, 2); +} diff --git a/src/test/run-pass/packed/packed-struct-drop-aligned.rs b/src/test/run-pass/packed/packed-struct-drop-aligned.rs new file mode 100644 index 00000000000..8cc29797772 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-drop-aligned.rs @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cell::Cell; +use std::mem; + +struct Aligned<'a> { + drop_count: &'a Cell +} + +#[inline(never)] +fn check_align(ptr: *const Aligned) { + assert_eq!(ptr as usize % mem::align_of::(), + 0); +} + +impl<'a> Drop for Aligned<'a> { + fn drop(&mut self) { + check_align(self); + self.drop_count.set(self.drop_count.get() + 1); + } +} + +#[repr(packed)] +struct Packed<'a>(u8, Aligned<'a>); + +fn main() { + let drop_count = &Cell::new(0); + { + let mut p = Packed(0, Aligned { drop_count }); + p.1 = Aligned { drop_count }; + assert_eq!(drop_count.get(), 1); + } + assert_eq!(drop_count.get(), 2); +} diff --git a/src/test/run-pass/packed/packed-struct-generic-layout.rs b/src/test/run-pass/packed/packed-struct-generic-layout.rs new file mode 100644 index 00000000000..30f7124f243 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-generic-layout.rs @@ -0,0 +1,41 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + + +use std::mem; + +#[repr(packed)] +struct S { + a: T, + b: u8, + c: S +} + +pub fn main() { + unsafe { + let s = S { a: 0xff_ff_ff_ffu32, b: 1, c: 0xaa_aa_aa_aa as i32 }; + let transd : [u8; 9] = mem::transmute(s); + // Don't worry about endianness, the numbers are palindromic. + assert_eq!(transd, + [0xff, 0xff, 0xff, 0xff, + 1, + 0xaa, 0xaa, 0xaa, 0xaa]); + + + let s = S { a: 1u8, b: 2u8, c: 0b10000001_10000001 as i16}; + let transd : [u8; 4] = mem::transmute(s); + // Again, no endianness problems. + assert_eq!(transd, + [1, 2, 0b10000001, 0b10000001]); + } +} diff --git a/src/test/run-pass/packed/packed-struct-generic-size.rs b/src/test/run-pass/packed/packed-struct-generic-size.rs new file mode 100644 index 00000000000..6df51f45729 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-generic-size.rs @@ -0,0 +1,56 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +#![allow(unused_comparisons)] + +#![feature(repr_packed)] + +use std::mem; + +#[repr(packed)] +struct P1 { + a: T, + b: u8, + c: S +} + +#[repr(packed(2))] +struct P2 { + a: T, + b: u8, + c: S +} + +#[repr(C, packed(4))] +struct P4C { + a: T, + b: u8, + c: S +} + +macro_rules! check { + ($t:ty, $align:expr, $size:expr) => ({ + assert_eq!(mem::align_of::<$t>(), $align); + assert_eq!(mem::size_of::<$t>(), $size); + }); +} + +pub fn main() { + check!(P1::, 1, 3); + check!(P1::, 1, 11); + + check!(P2::, 1, 3); + check!(P2::, 2, 12); + + check!(P4C::, 1, 3); + check!(P4C::, 4, 12); +} diff --git a/src/test/run-pass/packed/packed-struct-generic-size.stderr b/src/test/run-pass/packed/packed-struct-generic-size.stderr new file mode 100644 index 00000000000..f9c343b60b0 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-generic-size.stderr @@ -0,0 +1,36 @@ +warning: unnecessary path disambiguator + --> $DIR/packed-struct-generic-size.rs:48:14 + | +LL | check!(P1::, 1, 3); + | ^^ try removing `::` + +warning: unnecessary path disambiguator + --> $DIR/packed-struct-generic-size.rs:49:14 + | +LL | check!(P1::, 1, 11); + | ^^ try removing `::` + +warning: unnecessary path disambiguator + --> $DIR/packed-struct-generic-size.rs:51:14 + | +LL | check!(P2::, 1, 3); + | ^^ try removing `::` + +warning: unnecessary path disambiguator + --> $DIR/packed-struct-generic-size.rs:52:14 + | +LL | check!(P2::, 2, 12); + | ^^ try removing `::` + +warning: unnecessary path disambiguator + --> $DIR/packed-struct-generic-size.rs:54:15 + | +LL | check!(P4C::, 1, 3); + | ^^ try removing `::` + +warning: unnecessary path disambiguator + --> $DIR/packed-struct-generic-size.rs:55:15 + | +LL | check!(P4C::, 4, 12); + | ^^ try removing `::` + diff --git a/src/test/run-pass/packed/packed-struct-layout.rs b/src/test/run-pass/packed/packed-struct-layout.rs new file mode 100644 index 00000000000..2c9216a96c2 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-layout.rs @@ -0,0 +1,37 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; + +#[repr(packed)] +struct S4 { + a: u8, + b: [u8; 3], +} + +#[repr(packed)] +struct S5 { + a: u8, + b: u32 +} + +pub fn main() { + unsafe { + let s4 = S4 { a: 1, b: [2,3,4] }; + let transd : [u8; 4] = mem::transmute(s4); + assert_eq!(transd, [1, 2, 3, 4]); + + let s5 = S5 { a: 1, b: 0xff_00_00_ff }; + let transd : [u8; 5] = mem::transmute(s5); + // Don't worry about endianness, the u32 is palindromic. + assert_eq!(transd, [1, 0xff, 0, 0, 0xff]); + } +} diff --git a/src/test/run-pass/packed/packed-struct-match.rs b/src/test/run-pass/packed/packed-struct-match.rs new file mode 100644 index 00000000000..e349a4e7f54 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-match.rs @@ -0,0 +1,56 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(repr_packed)] + +#[repr(packed)] +struct Foo1 { + bar: u8, + baz: usize +} + +#[repr(packed(2))] +struct Foo2 { + bar: u8, + baz: usize +} + +#[repr(C, packed(4))] +struct Foo4C { + bar: u8, + baz: usize +} + +pub fn main() { + let foo1 = Foo1 { bar: 1, baz: 2 }; + match foo1 { + Foo1 {bar, baz} => { + assert_eq!(bar, 1); + assert_eq!(baz, 2); + } + } + + let foo2 = Foo2 { bar: 1, baz: 2 }; + match foo2 { + Foo2 {bar, baz} => { + assert_eq!(bar, 1); + assert_eq!(baz, 2); + } + } + + let foo4 = Foo4C { bar: 1, baz: 2 }; + match foo4 { + Foo4C {bar, baz} => { + assert_eq!(bar, 1); + assert_eq!(baz, 2); + } + } +} diff --git a/src/test/run-pass/packed/packed-struct-optimized-enum.rs b/src/test/run-pass/packed/packed-struct-optimized-enum.rs new file mode 100644 index 00000000000..e22e8c26fe5 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-optimized-enum.rs @@ -0,0 +1,46 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[repr(packed)] +struct Packed(T); + +impl Copy for Packed {} +impl Clone for Packed { + fn clone(&self) -> Self { *self } +} + +fn sanity_check_size(one: T) { + let two = [one, one]; + let stride = (&two[1] as *const _ as usize) - (&two[0] as *const _ as usize); + let (size, align) = (std::mem::size_of::(), std::mem::align_of::()); + assert_eq!(stride, size); + assert_eq!(size % align, 0); +} + +fn main() { + // This can fail if rustc and LLVM disagree on the size of a type. + // In this case, `Option>` was erroneously not + // marked as packed despite needing alignment `1` and containing + // its `&()` discriminant, which has alignment larger than `1`. + sanity_check_size((Some(Packed((&(), 0))), true)); + + // In #46769, `Option<(Packed<&()>, bool)>` was found to have + // pointer alignment, without actually being aligned in size. + // E.g. on 64-bit platforms, it had alignment `8` but size `9`. + type PackedRefAndBool<'a> = (Packed<&'a ()>, bool); + sanity_check_size::>(Some((Packed(&()), true))); + + // Make sure we don't pay for the enum optimization in size, + // e.g. we shouldn't need extra padding after the packed data. + assert_eq!(std::mem::align_of::>(), 1); + assert_eq!(std::mem::size_of::>(), + std::mem::size_of::()); +} diff --git a/src/test/run-pass/packed/packed-struct-size-xc.rs b/src/test/run-pass/packed/packed-struct-size-xc.rs new file mode 100644 index 00000000000..5b1fb6b92c7 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-size-xc.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:packed.rs + + +extern crate packed; + +use std::mem; + +macro_rules! check { + ($t:ty, $align:expr, $size:expr) => ({ + assert_eq!(mem::align_of::<$t>(), $align); + assert_eq!(mem::size_of::<$t>(), $size); + }); +} + +pub fn main() { + check!(packed::P1S5, 1, 5); + check!(packed::P2S6, 2, 6); + check!(packed::P2CS8, 2, 8); +} diff --git a/src/test/run-pass/packed/packed-struct-size.rs b/src/test/run-pass/packed/packed-struct-size.rs new file mode 100644 index 00000000000..85e7f1544a0 --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-size.rs @@ -0,0 +1,169 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +#![feature(repr_packed)] + + +use std::mem; + +#[repr(packed)] +struct P1S4 { + a: u8, + b: [u8; 3], +} + +#[repr(packed(2))] +struct P2S4 { + a: u8, + b: [u8; 3], +} + +#[repr(packed)] +struct P1S5 { + a: u8, + b: u32 +} + +#[repr(packed(2))] +struct P2S2 { + a: u8, + b: u8 +} + +#[repr(packed(2))] +struct P2S6 { + a: u8, + b: u32 +} + +#[repr(packed(2))] +struct P2S12 { + a: u32, + b: u64 +} + +#[repr(packed)] +struct P1S13 { + a: i64, + b: f32, + c: u8, +} + +#[repr(packed(2))] +struct P2S14 { + a: i64, + b: f32, + c: u8, +} + +#[repr(packed(4))] +struct P4S16 { + a: u8, + b: f32, + c: i64, + d: u16, +} + +#[repr(C, packed(4))] +struct P4CS20 { + a: u8, + b: f32, + c: i64, + d: u16, +} + +enum Foo { + Bar = 1, + Baz = 2 +} + +#[repr(packed)] +struct P1S3_Foo { + a: u8, + b: u16, + c: Foo +} + +#[repr(packed(2))] +struct P2_Foo { + a: Foo, +} + +#[repr(packed(2))] +struct P2S3_Foo { + a: u8, + b: u16, + c: Foo +} + +#[repr(packed)] +struct P1S7_Option { + a: f32, + b: u8, + c: u16, + d: Option> +} + +#[repr(packed(2))] +struct P2_Option { + a: Option> +} + +#[repr(packed(2))] +struct P2S7_Option { + a: f32, + b: u8, + c: u16, + d: Option> +} + +// Placing packed structs in statics should work +static TEST_P1S4: P1S4 = P1S4 { a: 1, b: [2, 3, 4] }; +static TEST_P1S5: P1S5 = P1S5 { a: 3, b: 67 }; +static TEST_P1S3_Foo: P1S3_Foo = P1S3_Foo { a: 1, b: 2, c: Foo::Baz }; +static TEST_P2S2: P2S2 = P2S2 { a: 1, b: 2 }; +static TEST_P2S4: P2S4 = P2S4 { a: 1, b: [2, 3, 4] }; +static TEST_P2S6: P2S6 = P2S6 { a: 1, b: 2 }; +static TEST_P2S12: P2S12 = P2S12 { a: 1, b: 2 }; +static TEST_P4S16: P4S16 = P4S16 { a: 1, b: 2.0, c: 3, d: 4 }; +static TEST_P4CS20: P4CS20 = P4CS20 { a: 1, b: 2.0, c: 3, d: 4 }; + +fn align_to(value: usize, align: usize) -> usize { + (value + (align - 1)) & !(align - 1) +} + +macro_rules! check { + ($t:ty, $align:expr, $size:expr) => ({ + assert_eq!(mem::align_of::<$t>(), $align); + assert_eq!(mem::size_of::<$t>(), $size); + }); +} + +pub fn main() { + check!(P1S4, 1, 4); + check!(P1S5, 1, 5); + check!(P1S13, 1, 13); + check!(P1S3_Foo, 1, 3 + mem::size_of::()); + check!(P1S7_Option, 1, 7 + mem::size_of::>>()); + + check!(P2S2, 1, 2); + check!(P2S4, 1, 4); + check!(P2S6, 2, 6); + check!(P2S12, 2, 12); + check!(P2S14, 2, 14); + check!(P4S16, 4, 16); + check!(P4CS20, 4, 20); + check!(P2S3_Foo, 2, align_to(3 + mem::size_of::(), 2)); + check!(P2S7_Option, 2, align_to(7 + mem::size_of::(), 2)); +} diff --git a/src/test/run-pass/packed/packed-struct-vec.rs b/src/test/run-pass/packed/packed-struct-vec.rs new file mode 100644 index 00000000000..d64bfe0033b --- /dev/null +++ b/src/test/run-pass/packed/packed-struct-vec.rs @@ -0,0 +1,131 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(repr_packed)] + +use std::fmt; +use std::mem; + +#[repr(packed)] +#[derive(Copy, Clone)] +struct Foo1 { + bar: u8, + baz: u64 +} + +impl PartialEq for Foo1 { + fn eq(&self, other: &Foo1) -> bool { + self.bar == other.bar && self.baz == other.baz + } +} + +impl fmt::Debug for Foo1 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let bar = self.bar; + let baz = self.baz; + + f.debug_struct("Foo1") + .field("bar", &bar) + .field("baz", &baz) + .finish() + } +} + +#[repr(packed(2))] +#[derive(Copy, Clone)] +struct Foo2 { + bar: u8, + baz: u64 +} + +impl PartialEq for Foo2 { + fn eq(&self, other: &Foo2) -> bool { + self.bar == other.bar && self.baz == other.baz + } +} + +impl fmt::Debug for Foo2 { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let bar = self.bar; + let baz = self.baz; + + f.debug_struct("Foo2") + .field("bar", &bar) + .field("baz", &baz) + .finish() + } +} + +#[repr(C, packed(4))] +#[derive(Copy, Clone)] +struct Foo4C { + bar: u8, + baz: u64 +} + +impl PartialEq for Foo4C { + fn eq(&self, other: &Foo4C) -> bool { + self.bar == other.bar && self.baz == other.baz + } +} + +impl fmt::Debug for Foo4C { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + let bar = self.bar; + let baz = self.baz; + + f.debug_struct("Foo4C") + .field("bar", &bar) + .field("baz", &baz) + .finish() + } +} + +pub fn main() { + let foo1s = [Foo1 { bar: 1, baz: 2 }; 10]; + + assert_eq!(mem::align_of::<[Foo1; 10]>(), 1); + assert_eq!(mem::size_of::<[Foo1; 10]>(), 90); + + for i in 0..10 { + assert_eq!(foo1s[i], Foo1 { bar: 1, baz: 2}); + } + + for &foo in &foo1s { + assert_eq!(foo, Foo1 { bar: 1, baz: 2 }); + } + + let foo2s = [Foo2 { bar: 1, baz: 2 }; 10]; + + assert_eq!(mem::align_of::<[Foo2; 10]>(), 2); + assert_eq!(mem::size_of::<[Foo2; 10]>(), 100); + + for i in 0..10 { + assert_eq!(foo2s[i], Foo2 { bar: 1, baz: 2}); + } + + for &foo in &foo2s { + assert_eq!(foo, Foo2 { bar: 1, baz: 2 }); + } + + let foo4s = [Foo4C { bar: 1, baz: 2 }; 10]; + + assert_eq!(mem::align_of::<[Foo4C; 10]>(), 4); + assert_eq!(mem::size_of::<[Foo4C; 10]>(), 120); + + for i in 0..10 { + assert_eq!(foo4s[i], Foo4C { bar: 1, baz: 2}); + } + + for &foo in &foo4s { + assert_eq!(foo, Foo4C { bar: 1, baz: 2 }); + } +} diff --git a/src/test/run-pass/packed/packed-tuple-struct-layout.rs b/src/test/run-pass/packed/packed-tuple-struct-layout.rs new file mode 100644 index 00000000000..c709a40cabb --- /dev/null +++ b/src/test/run-pass/packed/packed-tuple-struct-layout.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; + +#[repr(packed)] +struct S4(u8,[u8; 3]); + +#[repr(packed)] +struct S5(u8,u32); + +pub fn main() { + unsafe { + let s4 = S4(1, [2,3,4]); + let transd : [u8; 4] = mem::transmute(s4); + assert_eq!(transd, [1, 2, 3, 4]); + + let s5 = S5(1, 0xff_00_00_ff); + let transd : [u8; 5] = mem::transmute(s5); + // Don't worry about endianness, the u32 is palindromic. + assert_eq!(transd, [1, 0xff, 0, 0, 0xff]); + } +} diff --git a/src/test/run-pass/packed/packed-tuple-struct-size.rs b/src/test/run-pass/packed/packed-tuple-struct-size.rs new file mode 100644 index 00000000000..b4e24925f75 --- /dev/null +++ b/src/test/run-pass/packed/packed-tuple-struct-size.rs @@ -0,0 +1,90 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#![feature(repr_packed)] + +use std::mem; + +#[repr(packed)] +struct P1S4(u8,[u8; 3]); + +#[repr(packed(2))] +struct P2S4(u8,[u8; 3]); + +#[repr(packed)] +struct P1S5(u8, u32); + +#[repr(packed(2))] +struct P2S6(u8, u32); + +#[repr(packed)] +struct P1S13(i64, f32, u8); + +#[repr(packed(2))] +struct P2S14(i64, f32, u8); + +#[repr(packed(4))] +struct P4S16(u8, f32, i64, u16); + +#[repr(C, packed(4))] +struct P4CS20(u8, f32, i64, u16); + +enum Foo { + Bar = 1, + Baz = 2 +} + +#[repr(packed)] +struct P1S3_Foo(u8, u16, Foo); + +#[repr(packed(2))] +struct P2_Foo(Foo); + +#[repr(packed(2))] +struct P2S3_Foo(u8, u16, Foo); + +#[repr(packed)] +struct P1S7_Option(f32, u8, u16, Option>); + +#[repr(packed(2))] +struct P2_Option(Option>); + +#[repr(packed(2))] +struct P2S7_Option(f32, u8, u16, Option>); + +fn align_to(value: usize, align: usize) -> usize { + (value + (align - 1)) & !(align - 1) +} + +macro_rules! check { + ($t:ty, $align:expr, $size:expr) => ({ + assert_eq!(mem::align_of::<$t>(), $align); + assert_eq!(mem::size_of::<$t>(), $size); + }); +} + +pub fn main() { + check!(P1S4, 1, 4); + check!(P1S5, 1, 5); + check!(P1S13, 1, 13); + check!(P1S3_Foo, 1, 3 + mem::size_of::()); + check!(P1S7_Option, 1, 7 + mem::size_of::>>()); + + check!(P2S4, 1, 4); + check!(P2S6, 2, 6); + check!(P2S14, 2, 14); + check!(P4S16, 4, 16); + check!(P4CS20, 4, 20); + check!(P2S3_Foo, 2, align_to(3 + mem::size_of::(), 2)); + check!(P2S7_Option, 2, align_to(7 + mem::size_of::(), 2)); +} diff --git a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs new file mode 100644 index 00000000000..5bff65d0cfa --- /dev/null +++ b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs @@ -0,0 +1,50 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags:-C panic=abort +// aux-build:exit-success-if-unwind.rs +// no-prefer-dynamic +// ignore-cloudabi no processes +// ignore-emscripten no processes +// ignore-macos + +extern crate exit_success_if_unwind; + +use std::process::Command; +use std::env; + +fn main() { + let mut args = env::args_os(); + let me = args.next().unwrap(); + + if let Some(s) = args.next() { + if &*s == "foo" { + exit_success_if_unwind::bar(do_panic); + } + } + + let mut cmd = Command::new(env::args_os().next().unwrap()); + cmd.arg("foo"); + + + // ARMv6 hanges while printing the backtrace, see #41004 + if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") { + cmd.env("RUST_BACKTRACE", "0"); + } + + let s = cmd.status(); + assert!(s.unwrap().code() != Some(0)); +} + +fn do_panic() { + panic!("try to catch me"); +} diff --git a/src/test/run-pass/panic-runtime/abort.rs b/src/test/run-pass/panic-runtime/abort.rs new file mode 100644 index 00000000000..2275efa188e --- /dev/null +++ b/src/test/run-pass/panic-runtime/abort.rs @@ -0,0 +1,53 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags:-C panic=abort +// no-prefer-dynamic +// ignore-cloudabi no processes +// ignore-emscripten no processes +// ignore-macos + +use std::process::Command; +use std::env; + +struct Bomb; + +impl Drop for Bomb { + fn drop(&mut self) { + std::process::exit(0); + } +} + +fn main() { + let mut args = env::args_os(); + let me = args.next().unwrap(); + + if let Some(s) = args.next() { + if &*s == "foo" { + + let _bomb = Bomb; + + panic!("try to catch me"); + } + } + + let mut cmd = Command::new(env::args_os().next().unwrap()); + cmd.arg("foo"); + + // ARMv6 hanges while printing the backtrace, see #41004 + if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") { + cmd.env("RUST_BACKTRACE", "0"); + } + + let s = cmd.status(); + assert!(s.unwrap().code() != Some(0)); +} diff --git a/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs b/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs new file mode 100644 index 00000000000..9e5fc592b1a --- /dev/null +++ b/src/test/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] + +struct Bomb; + +impl Drop for Bomb { + fn drop(&mut self) { + std::process::exit(0); + } +} + +pub fn bar(f: fn()) { + let _bomb = Bomb; + f(); +} diff --git a/src/test/run-pass/panic-runtime/link-to-abort.rs b/src/test/run-pass/panic-runtime/link-to-abort.rs new file mode 100644 index 00000000000..5016c9591b0 --- /dev/null +++ b/src/test/run-pass/panic-runtime/link-to-abort.rs @@ -0,0 +1,21 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags:-C panic=abort +// no-prefer-dynamic +// ignore-macos + +#![feature(panic_abort)] + +extern crate panic_abort; + +fn main() {} diff --git a/src/test/run-pass/panic-runtime/link-to-unwind.rs b/src/test/run-pass/panic-runtime/link-to-unwind.rs new file mode 100644 index 00000000000..47d7aeaef26 --- /dev/null +++ b/src/test/run-pass/panic-runtime/link-to-unwind.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// no-prefer-dynamic + +#![feature(panic_unwind)] + +extern crate panic_unwind; + +fn main() { +} diff --git a/src/test/run-pass/panic-runtime/lto-abort.rs b/src/test/run-pass/panic-runtime/lto-abort.rs new file mode 100644 index 00000000000..6e3dbe1d0f3 --- /dev/null +++ b/src/test/run-pass/panic-runtime/lto-abort.rs @@ -0,0 +1,43 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags:-C lto -C panic=abort +// no-prefer-dynamic +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::process::Command; +use std::env; + +struct Bomb; + +impl Drop for Bomb { + fn drop(&mut self) { + std::process::exit(0); + } +} + +fn main() { + let mut args = env::args_os(); + let me = args.next().unwrap(); + + if let Some(s) = args.next() { + if &*s == "foo" { + + let _bomb = Bomb; + + panic!("try to catch me"); + } + } + let s = Command::new(env::args_os().next().unwrap()).arg("foo").status(); + assert!(s.unwrap().code() != Some(0)); +} diff --git a/src/test/run-pass/panic-runtime/lto-unwind.rs b/src/test/run-pass/panic-runtime/lto-unwind.rs new file mode 100644 index 00000000000..a0caa4e80c2 --- /dev/null +++ b/src/test/run-pass/panic-runtime/lto-unwind.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags:-C lto -C panic=unwind +// no-prefer-dynamic +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::process::Command; +use std::env; + +struct Bomb; + +impl Drop for Bomb { + fn drop(&mut self) { + println!("hurray you ran me"); + } +} + +fn main() { + let mut args = env::args_os(); + let me = args.next().unwrap(); + + if let Some(s) = args.next() { + if &*s == "foo" { + + let _bomb = Bomb; + + panic!("try to catch me"); + } + } + let s = Command::new(env::args_os().next().unwrap()).arg("foo").output(); + let s = s.unwrap(); + assert!(!s.status.success()); + assert!(String::from_utf8_lossy(&s.stdout).contains("hurray you ran me")); +} diff --git a/src/test/run-pass/panics/panic-handler-chain.rs b/src/test/run-pass/panics/panic-handler-chain.rs new file mode 100644 index 00000000000..c4c3dc1963e --- /dev/null +++ b/src/test/run-pass/panics/panic-handler-chain.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// ignore-emscripten no threads support + +#![feature(std_panic)] + +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::panic; +use std::thread; + +static A: AtomicUsize = AtomicUsize::new(0); +static B: AtomicUsize = AtomicUsize::new(0); + +fn main() { + panic::set_hook(Box::new(|_| { A.fetch_add(1, Ordering::SeqCst); })); + let hook = panic::take_hook(); + panic::set_hook(Box::new(move |info| { + B.fetch_add(1, Ordering::SeqCst); + hook(info); + })); + + let _ = thread::spawn(|| { + panic!(); + }).join(); + + assert_eq!(1, A.load(Ordering::SeqCst)); + assert_eq!(1, B.load(Ordering::SeqCst)); +} diff --git a/src/test/run-pass/panics/panic-handler-flail-wildly.rs b/src/test/run-pass/panics/panic-handler-flail-wildly.rs new file mode 100644 index 00000000000..5715202067e --- /dev/null +++ b/src/test/run-pass/panics/panic-handler-flail-wildly.rs @@ -0,0 +1,63 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// ignore-emscripten no threads support + +#![feature(std_panic)] + +use std::panic; +use std::thread; + +fn a() { + panic::set_hook(Box::new(|_| println!("hello yes this is a"))); + panic::take_hook(); + panic::set_hook(Box::new(|_| println!("hello yes this is a part 2"))); + panic::take_hook(); +} + +fn b() { + panic::take_hook(); + panic::take_hook(); + panic::take_hook(); + panic::take_hook(); + panic::take_hook(); + panic!(); +} + +fn c() { + panic::set_hook(Box::new(|_| ())); + panic::set_hook(Box::new(|_| ())); + panic::set_hook(Box::new(|_| ())); + panic::set_hook(Box::new(|_| ())); + panic::set_hook(Box::new(|_| ())); + panic::set_hook(Box::new(|_| ())); + panic!(); +} + +fn main() { + for _ in 0..10 { + let mut handles = vec![]; + for _ in 0..10 { + handles.push(thread::spawn(a)); + } + for _ in 0..10 { + handles.push(thread::spawn(b)); + } + for _ in 0..10 { + handles.push(thread::spawn(c)); + } + for handle in handles { + let _ = handle.join(); + } + } +} diff --git a/src/test/run-pass/panics/panic-handler-set-twice.rs b/src/test/run-pass/panics/panic-handler-set-twice.rs new file mode 100644 index 00000000000..340333b119e --- /dev/null +++ b/src/test/run-pass/panics/panic-handler-set-twice.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(std_panic)] + +// ignore-emscripten no threads support + +use std::sync::atomic::{AtomicUsize, Ordering}; +use std::panic; +use std::thread; + +static A: AtomicUsize = AtomicUsize::new(0); + +fn main() { + panic::set_hook(Box::new(|_| ())); + panic::set_hook(Box::new(|info| { A.fetch_add(1, Ordering::SeqCst); })); + + let _ = thread::spawn(|| { + panic!(); + }).join(); + + assert_eq!(1, A.load(Ordering::SeqCst)); +} diff --git a/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs b/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs new file mode 100644 index 00000000000..f5dd2716d2c --- /dev/null +++ b/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs @@ -0,0 +1,46 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// ignore-emscripten no threads support + +use std::thread; + +static mut dropped: bool = false; + +struct A { + b: B, +} + +struct B { + foo: isize, +} + +impl Drop for A { + fn drop(&mut self) { + panic!() + } +} + +impl Drop for B { + fn drop(&mut self) { + unsafe { dropped = true; } + } +} + +pub fn main() { + let ret = thread::spawn(move|| { + let _a = A { b: B { foo: 3 } }; + }).join(); + assert!(ret.is_err()); + unsafe { assert!(dropped); } +} diff --git a/src/test/run-pass/panics/panic-recover-propagate.rs b/src/test/run-pass/panics/panic-recover-propagate.rs new file mode 100644 index 00000000000..42571615105 --- /dev/null +++ b/src/test/run-pass/panics/panic-recover-propagate.rs @@ -0,0 +1,36 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; +use std::panic; +use std::thread; + +static A: AtomicUsize = ATOMIC_USIZE_INIT; + +fn main() { + panic::set_hook(Box::new(|_| { + A.fetch_add(1, Ordering::SeqCst); + })); + + let result = thread::spawn(|| { + let result = panic::catch_unwind(|| { + panic!("hi there"); + }); + + panic::resume_unwind(result.unwrap_err()); + }).join(); + + let msg = *result.unwrap_err().downcast::<&'static str>().unwrap(); + assert_eq!("hi there", msg); + assert_eq!(1, A.load(Ordering::SeqCst)); +} diff --git a/src/test/run-pass/panics/panic-safe.rs b/src/test/run-pass/panics/panic-safe.rs new file mode 100644 index 00000000000..0d1ce110639 --- /dev/null +++ b/src/test/run-pass/panics/panic-safe.rs @@ -0,0 +1,61 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +use std::panic::{UnwindSafe, AssertUnwindSafe}; +use std::cell::RefCell; +use std::sync::{Mutex, RwLock, Arc}; +use std::rc::Rc; + +struct Foo { a: i32 } + +fn assert() {} + +fn main() { + assert::(); + assert::<&i32>(); + assert::<*mut i32>(); + assert::<*const i32>(); + assert::(); + assert::(); + assert::<&str>(); + assert::(); + assert::<&Foo>(); + assert::>(); + assert::(); + assert::>(); + assert::>(); + assert::>(); + assert::>(); + assert::<&Mutex>(); + assert::<&RwLock>(); + assert::>(); + assert::>(); + assert::>(); + + trait Trait: UnwindSafe {} + assert::>(); + + fn bar() { + assert::>(); + assert::>(); + } + fn baz() { + assert::>(); + assert::>(); + assert::>(); + assert::>(); + assert::<&AssertUnwindSafe>(); + assert::>>(); + assert::>>(); + } +} diff --git a/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs b/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs new file mode 100644 index 00000000000..19cdede5518 --- /dev/null +++ b/src/test/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs @@ -0,0 +1,19 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait A { + fn frob(&self); +} + +impl A for isize { fn frob(&self) {} } + +pub fn frob(t: T) { + t.frob(); +} diff --git a/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs b/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs new file mode 100644 index 00000000000..fd97f210a55 --- /dev/null +++ b/src/test/run-pass/privacy/auxiliary/privacy_reexport.rs @@ -0,0 +1,16 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub extern crate core; +pub use foo as bar; + +pub mod foo { + pub fn frob() {} +} diff --git a/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs b/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs new file mode 100644 index 00000000000..e4890f4fe2d --- /dev/null +++ b/src/test/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod a { + pub use a::b::c; + + pub mod b { + pub mod c { + fn f(){} + fn g(){} + } + } +} diff --git a/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs new file mode 100644 index 00000000000..41aafd64cb3 --- /dev/null +++ b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate1.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo { + pub name: isize +} diff --git a/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs new file mode 100644 index 00000000000..d59d7f2a613 --- /dev/null +++ b/src/test/run-pass/privacy/auxiliary/pub_use_xcrate2.rs @@ -0,0 +1,13 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +extern crate pub_use_xcrate1; + +pub use pub_use_xcrate1::Foo; diff --git a/src/test/run-pass/privacy/priv-impl-prim-ty.rs b/src/test/run-pass/privacy/priv-impl-prim-ty.rs new file mode 100644 index 00000000000..2cb4dee90af --- /dev/null +++ b/src/test/run-pass/privacy/priv-impl-prim-ty.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:priv-impl-prim-ty.rs + +// pretty-expanded FIXME #23616 + +extern crate priv_impl_prim_ty as bar; + +pub fn main() { + bar::frob(1); + +} diff --git a/src/test/run-pass/privacy/privacy-ns.rs b/src/test/run-pass/privacy/privacy-ns.rs new file mode 100644 index 00000000000..f11ff3f41a1 --- /dev/null +++ b/src/test/run-pass/privacy/privacy-ns.rs @@ -0,0 +1,124 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + + +// Check we do the correct privacy checks when we import a name and there is an +// item with that name in both the value and type namespaces. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] +#![allow(unused_imports)] + + +// public type, private value +pub mod foo1 { + pub trait Bar { + fn dummy(&self) { } + } + pub struct Baz; + + fn Bar() { } +} + +fn test_unused1() { + use foo1::*; +} + +fn test_single1() { + use foo1::Bar; + + let _x: Box; +} + +fn test_list1() { + use foo1::{Bar,Baz}; + + let _x: Box; +} + +fn test_glob1() { + use foo1::*; + + let _x: Box; +} + +// private type, public value +pub mod foo2 { + trait Bar { + fn dummy(&self) { } + } + pub struct Baz; + + pub fn Bar() { } +} + +fn test_unused2() { + use foo2::*; +} + +fn test_single2() { + use foo2::Bar; + + Bar(); +} + +fn test_list2() { + use foo2::{Bar,Baz}; + + Bar(); +} + +fn test_glob2() { + use foo2::*; + + Bar(); +} + +// public type, public value +pub mod foo3 { + pub trait Bar { + fn dummy(&self) { } + } + pub struct Baz; + + pub fn Bar() { } +} + +fn test_unused3() { + use foo3::*; +} + +fn test_single3() { + use foo3::Bar; + + Bar(); + let _x: Box; +} + +fn test_list3() { + use foo3::{Bar,Baz}; + + Bar(); + let _x: Box; +} + +fn test_glob3() { + use foo3::*; + + Bar(); + let _x: Box; +} + +fn main() { +} diff --git a/src/test/run-pass/privacy/privacy-reexport.rs b/src/test/run-pass/privacy/privacy-reexport.rs new file mode 100644 index 00000000000..a12f7bb2611 --- /dev/null +++ b/src/test/run-pass/privacy/privacy-reexport.rs @@ -0,0 +1,23 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:privacy_reexport.rs + +// pretty-expanded FIXME #23616 + +extern crate privacy_reexport; + +pub fn main() { + // Check that public extern crates are visible to outside crates + privacy_reexport::core::cell::Cell::new(0); + + privacy_reexport::bar::frob(); +} diff --git a/src/test/run-pass/privacy/privacy1.rs b/src/test/run-pass/privacy/privacy1.rs new file mode 100644 index 00000000000..7c1dbb500d8 --- /dev/null +++ b/src/test/run-pass/privacy/privacy1.rs @@ -0,0 +1,32 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub mod test2 { + // This used to generate an ICE (make sure that default functions are + // parented to their trait to find the first private thing as the trait). + + struct B; + trait A { fn foo(&self) {} } + impl A for B {} + + mod tests { + use super::A; + fn foo() { + let a = super::B; + a.foo(); + } + } +} + + +pub fn main() {} diff --git a/src/test/run-pass/privacy/private-class-field.rs b/src/test/run-pass/privacy/private-class-field.rs new file mode 100644 index 00000000000..2910c462c2b --- /dev/null +++ b/src/test/run-pass/privacy/private-class-field.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +struct cat { + meows : usize, + + how_hungry : isize, +} + +impl cat { + pub fn meow_count(&mut self) -> usize { self.meows } +} + +fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } +} + +pub fn main() { + let mut nyan : cat = cat(52, 99); + assert_eq!(nyan.meow_count(), 52); +} diff --git a/src/test/run-pass/privacy/private-method.rs b/src/test/run-pass/privacy/private-method.rs new file mode 100644 index 00000000000..a0f012a6059 --- /dev/null +++ b/src/test/run-pass/privacy/private-method.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct cat { + meows : usize, + + how_hungry : isize, +} + +impl cat { + pub fn play(&mut self) { + self.meows += 1_usize; + self.nap(); + } +} + +impl cat { + fn nap(&mut self) { for _ in 1_usize..10_usize { } } +} + +fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } +} + +pub fn main() { + let mut nyan : cat = cat(52_usize, 99); + nyan.play(); +} diff --git a/src/test/run-pass/privacy/pub-extern-privacy.rs b/src/test/run-pass/privacy/pub-extern-privacy.rs new file mode 100644 index 00000000000..a86133fb283 --- /dev/null +++ b/src/test/run-pass/privacy/pub-extern-privacy.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +// pretty-expanded FIXME #23616 + +use std::mem::transmute; + +mod a { + extern { + pub fn free(x: *const u8); + } +} + +pub fn main() { + unsafe { + a::free(transmute(0_usize)); + } +} diff --git a/src/test/run-pass/privacy/pub-use-xcrate.rs b/src/test/run-pass/privacy/pub-use-xcrate.rs new file mode 100644 index 00000000000..f9c2de224db --- /dev/null +++ b/src/test/run-pass/privacy/pub-use-xcrate.rs @@ -0,0 +1,25 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:pub_use_xcrate1.rs +// aux-build:pub_use_xcrate2.rs + +// pretty-expanded FIXME #23616 + +extern crate pub_use_xcrate2; + +use pub_use_xcrate2::Foo; + +pub fn main() { + let _foo: Foo = Foo { + name: 0 + }; +} diff --git a/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs b/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs new file mode 100644 index 00000000000..4ca7c735308 --- /dev/null +++ b/src/test/run-pass/privacy/pub_use_mods_xcrate_exe.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:pub_use_mods_xcrate.rs + +// pretty-expanded FIXME #23616 + +#![allow(unused_imports)] + +extern crate pub_use_mods_xcrate; +use pub_use_mods_xcrate::a::c; + +pub fn main(){} diff --git a/src/test/run-pass/process/process-envs.rs b/src/test/run-pass/process/process-envs.rs new file mode 100644 index 00000000000..4fb21d4dc66 --- /dev/null +++ b/src/test/run-pass/process/process-envs.rs @@ -0,0 +1,62 @@ +// Copyright 2014, 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::process::Command; +use std::env; +use std::collections::HashMap; + +#[cfg(all(unix, not(target_os="android")))] +pub fn env_cmd() -> Command { + Command::new("env") +} +#[cfg(target_os="android")] +pub fn env_cmd() -> Command { + let mut cmd = Command::new("/system/bin/sh"); + cmd.arg("-c").arg("set"); + cmd +} + +#[cfg(windows)] +pub fn env_cmd() -> Command { + let mut cmd = Command::new("cmd"); + cmd.arg("/c").arg("set"); + cmd +} + +fn main() { + // save original environment + let old_env = env::var_os("RUN_TEST_NEW_ENV"); + + env::set_var("RUN_TEST_NEW_ENV", "123"); + + // create filtered environment vector + let filtered_env : HashMap = + env::vars().filter(|&(ref k, _)| k == "PATH").collect(); + + let mut cmd = env_cmd(); + cmd.env_clear(); + cmd.envs(&filtered_env); + + // restore original environment + match old_env { + None => env::remove_var("RUN_TEST_NEW_ENV"), + Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val) + } + + let result = cmd.output().unwrap(); + let output = String::from_utf8_lossy(&result.stdout); + + assert!(!output.contains("RUN_TEST_NEW_ENV"), + "found RUN_TEST_NEW_ENV inside of:\n\n{}", output); +} diff --git a/src/test/run-pass/process/process-exit.rs b/src/test/run-pass/process/process-exit.rs new file mode 100644 index 00000000000..e43631e3189 --- /dev/null +++ b/src/test/run-pass/process/process-exit.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::env; +use std::process::{self, Command, Stdio}; + +fn main() { + let args: Vec = env::args().collect(); + if args.len() > 1 && args[1] == "child" { + child(); + } else { + parent(); + } +} + +fn parent() { + let args: Vec = env::args().collect(); + let status = Command::new(&args[0]).arg("child").status().unwrap(); + assert_eq!(status.code(), Some(2)); +} + +fn child() -> i32 { + process::exit(2); +} diff --git a/src/test/run-pass/process/process-remove-from-env.rs b/src/test/run-pass/process/process-remove-from-env.rs new file mode 100644 index 00000000000..d9c35f3e993 --- /dev/null +++ b/src/test/run-pass/process/process-remove-from-env.rs @@ -0,0 +1,56 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::process::Command; +use std::env; + +#[cfg(all(unix, not(target_os="android")))] +pub fn env_cmd() -> Command { + Command::new("env") +} +#[cfg(target_os="android")] +pub fn env_cmd() -> Command { + let mut cmd = Command::new("/system/bin/sh"); + cmd.arg("-c").arg("set"); + cmd +} + +#[cfg(windows)] +pub fn env_cmd() -> Command { + let mut cmd = Command::new("cmd"); + cmd.arg("/c").arg("set"); + cmd +} + +fn main() { + // save original environment + let old_env = env::var_os("RUN_TEST_NEW_ENV"); + + env::set_var("RUN_TEST_NEW_ENV", "123"); + + let mut cmd = env_cmd(); + cmd.env_remove("RUN_TEST_NEW_ENV"); + + // restore original environment + match old_env { + None => env::remove_var("RUN_TEST_NEW_ENV"), + Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val) + } + + let result = cmd.output().unwrap(); + let output = String::from_utf8_lossy(&result.stdout); + + assert!(!output.contains("RUN_TEST_NEW_ENV"), + "found RUN_TEST_NEW_ENV inside of:\n\n{}", output); +} diff --git a/src/test/run-pass/process/process-sigpipe.rs b/src/test/run-pass/process/process-sigpipe.rs new file mode 100644 index 00000000000..d1e3fba14cf --- /dev/null +++ b/src/test/run-pass/process/process-sigpipe.rs @@ -0,0 +1,45 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +// ignore-android since the dynamic linker sets a SIGPIPE handler (to do +// a crash report) so inheritance is moot on the entire platform + +// libstd ignores SIGPIPE, and other libraries may set signal masks. +// Make sure that these behaviors don't get inherited to children +// spawned via std::process, since they're needed for traditional UNIX +// filter behavior. This test checks that `yes | head` terminates +// (instead of running forever), and that it does not print an error +// message about a broken pipe. + +// ignore-cloudabi no subprocesses support +// ignore-emscripten no threads support + +use std::process; +use std::thread; + +#[cfg(unix)] +fn main() { + // Just in case `yes` doesn't check for EPIPE... + thread::spawn(|| { + thread::sleep_ms(5000); + process::exit(1); + }); + let output = process::Command::new("sh").arg("-c").arg("yes | head").output().unwrap(); + assert!(output.status.success()); + assert!(output.stderr.len() == 0); +} + +#[cfg(not(unix))] +fn main() { + // Not worried about signal masks on other platforms +} diff --git a/src/test/run-pass/process/process-spawn-nonexistent.rs b/src/test/run-pass/process/process-spawn-nonexistent.rs new file mode 100644 index 00000000000..926e93104f3 --- /dev/null +++ b/src/test/run-pass/process/process-spawn-nonexistent.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::io::ErrorKind; +use std::process::Command; + +fn main() { + assert_eq!(Command::new("nonexistent") + .spawn() + .unwrap_err() + .kind(), + ErrorKind::NotFound); +} diff --git a/src/test/run-pass/process/process-spawn-with-unicode-params.rs b/src/test/run-pass/process/process-spawn-with-unicode-params.rs new file mode 100644 index 00000000000..70ed7982508 --- /dev/null +++ b/src/test/run-pass/process/process-spawn-with-unicode-params.rs @@ -0,0 +1,86 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// no-prefer-dynamic + +// The test copies itself into a subdirectory with a non-ASCII name and then +// runs it as a child process within the subdirectory. The parent process +// also adds an environment variable and an argument, both containing +// non-ASCII characters. The child process ensures all the strings are +// intact. + +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::io::prelude::*; +use std::io; +use std::fs; +use std::process::Command; +use std::env; +use std::path::Path; + +fn main() { + let my_args = env::args().collect::>(); + let my_cwd = env::current_dir().unwrap(); + let my_env = env::vars().collect::>(); + let my_path = env::current_exe().unwrap(); + let my_dir = my_path.parent().unwrap(); + let my_ext = my_path.extension().and_then(|s| s.to_str()).unwrap_or(""); + + // some non-ASCII characters + let blah = "\u{3c0}\u{42f}\u{97f3}\u{e6}\u{221e}"; + + let child_name = "child"; + let child_dir = format!("process-spawn-with-unicode-params-{}", blah); + + // parameters sent to child / expected to be received from parent + let arg = blah; + let cwd = my_dir.join(&child_dir); + let env = ("RUST_TEST_PROC_SPAWN_UNICODE".to_string(), blah.to_string()); + + // am I the parent or the child? + if my_args.len() == 1 { // parent + + let child_filestem = Path::new(child_name); + let child_filename = child_filestem.with_extension(my_ext); + let child_path = cwd.join(&child_filename); + + // make a separate directory for the child + let _ = fs::create_dir(&cwd); + fs::copy(&my_path, &child_path).unwrap(); + + // run child + let p = Command::new(&child_path) + .arg(arg) + .current_dir(&cwd) + .env(&env.0, &env.1) + .spawn().unwrap().wait_with_output().unwrap(); + + // display the output + io::stdout().write_all(&p.stdout).unwrap(); + io::stderr().write_all(&p.stderr).unwrap(); + + // make sure the child succeeded + assert!(p.status.success()); + + } else { // child + + // check working directory (don't try to compare with `cwd` here!) + assert!(my_cwd.ends_with(&child_dir)); + + // check arguments + assert_eq!(&*my_args[1], arg); + + // check environment variable + assert!(my_env.contains(&env)); + + }; +} diff --git a/src/test/run-pass/process/process-status-inherits-stdin.rs b/src/test/run-pass/process/process-status-inherits-stdin.rs new file mode 100644 index 00000000000..1b09d5e52bc --- /dev/null +++ b/src/test/run-pass/process/process-status-inherits-stdin.rs @@ -0,0 +1,45 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi no processes +// ignore-emscripten no processes + +use std::env; +use std::io; +use std::io::Write; +use std::process::{Command, Stdio}; + +fn main() { + let mut args = env::args(); + let me = args.next().unwrap(); + let arg = args.next(); + match arg.as_ref().map(|s| &s[..]) { + None => { + let mut s = Command::new(&me) + .arg("a1") + .stdin(Stdio::piped()) + .spawn() + .unwrap(); + s.stdin.take().unwrap().write_all(b"foo\n").unwrap(); + let s = s.wait().unwrap(); + assert!(s.success()); + } + Some("a1") => { + let s = Command::new(&me).arg("a2").status().unwrap(); + assert!(s.success()); + } + Some(..) => { + let mut s = String::new(); + io::stdin().read_line(&mut s).unwrap(); + assert_eq!(s, "foo\n"); + } + } +} diff --git a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs new file mode 100644 index 00000000000..770733b8939 --- /dev/null +++ b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +struct Point { + x: isize, + y: isize +} + +struct Character { + pos: Box, +} + +fn get_x(x: &Character) -> &isize { + // interesting case because the scope of this + // borrow of the unique pointer is in fact + // larger than the fn itself + return &x.pos.x; +} + +pub fn main() { +} diff --git a/src/test/run-pass/regions/regions-addr-of-ret.rs b/src/test/run-pass/regions/regions-addr-of-ret.rs new file mode 100644 index 00000000000..a9953edb2f5 --- /dev/null +++ b/src/test/run-pass/regions/regions-addr-of-ret.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn f(x: &isize) -> &isize { + return &*x; +} + +pub fn main() { + let three = &3; + println!("{}", *f(three)); +} diff --git a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs new file mode 100644 index 00000000000..a7801136a84 --- /dev/null +++ b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the compiler considers the 'a bound declared in the +// trait. Issue #20890. + +// pretty-expanded FIXME #23616 + +trait Foo<'a> { + type Value: 'a; + + fn get(&self) -> &'a Self::Value; +} + +fn takes_foo<'a,F: Foo<'a>>(f: &'a F) { + // This call would be illegal, because it results in &'a F::Value, + // and the only way we know that `F::Value : 'a` is because of the + // trait declaration. + + f.get(); +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs new file mode 100644 index 00000000000..b81d3056813 --- /dev/null +++ b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the compiler considers the 'static bound declared in the +// trait. Issue #20890. + +// pretty-expanded FIXME #23616 + +trait Foo { + type Value: 'static; + fn dummy(&self) { } +} + +fn require_static() {} + +fn takes_foo() { + require_static::() +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-borrow-at.rs b/src/test/run-pass/regions/regions-borrow-at.rs new file mode 100644 index 00000000000..02603292d1b --- /dev/null +++ b/src/test/run-pass/regions/regions-borrow-at.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn foo(x: &usize) -> usize { + *x +} + +pub fn main() { + let p: Box<_> = box 22; + let r = foo(&*p); + println!("r={}", r); + assert_eq!(r, 22); +} diff --git a/src/test/run-pass/regions/regions-borrow-evec-fixed.rs b/src/test/run-pass/regions/regions-borrow-evec-fixed.rs new file mode 100644 index 00000000000..50336cf8cdc --- /dev/null +++ b/src/test/run-pass/regions/regions-borrow-evec-fixed.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn foo(x: &[isize]) -> isize { + x[0] +} + +pub fn main() { + let p = &[1,2,3,4,5]; + assert_eq!(foo(p), 1); +} diff --git a/src/test/run-pass/regions/regions-borrow-evec-uniq.rs b/src/test/run-pass/regions/regions-borrow-evec-uniq.rs new file mode 100644 index 00000000000..5f61ab89635 --- /dev/null +++ b/src/test/run-pass/regions/regions-borrow-evec-uniq.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn foo(x: &[isize]) -> isize { + x[0] +} + +pub fn main() { + let p = vec![1,2,3,4,5]; + let r = foo(&p); + assert_eq!(r, 1); + + let p = vec![5,4,3,2,1]; + let r = foo(&p); + assert_eq!(r, 5); +} diff --git a/src/test/run-pass/regions/regions-borrow-uniq.rs b/src/test/run-pass/regions/regions-borrow-uniq.rs new file mode 100644 index 00000000000..cc88528f64b --- /dev/null +++ b/src/test/run-pass/regions/regions-borrow-uniq.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn foo(x: &usize) -> usize { + *x +} + +pub fn main() { + let p: Box<_> = box 3; + let r = foo(&*p); + assert_eq!(r, 3); +} diff --git a/src/test/run-pass/regions/regions-bot.rs b/src/test/run-pass/regions/regions-bot.rs new file mode 100644 index 00000000000..d3af66b4162 --- /dev/null +++ b/src/test/run-pass/regions/regions-bot.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A very limited test of the "bottom" region + + +fn produce_static() -> &'static T { panic!(); } + +fn foo(_x: &T) -> &usize { produce_static() } + +pub fn main() { +} diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs new file mode 100644 index 00000000000..d5d2408d5d2 --- /dev/null +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(issue_5723_bootstrap)] + +trait Foo { + fn dummy(&self) { } +} + +fn foo<'a, 'b, 'c:'a+'b, 'd>() { +} + +pub fn main() { } diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs new file mode 100644 index 00000000000..50073f8b9f0 --- /dev/null +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +#![feature(issue_5723_bootstrap)] + +trait Foo { + fn dummy(&self) { } +} + +fn foo<'a>(x: Box) { +} + +fn bar<'a, T: 'a>() { +} + +pub fn main() { } diff --git a/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs b/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs new file mode 100644 index 00000000000..b2bf71f02fb --- /dev/null +++ b/src/test/run-pass/regions/regions-close-over-type-parameter-successfully.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A test where we (successfully) close over a reference into +// an object. + +#![feature(box_syntax)] + +trait SomeTrait { fn get(&self) -> isize; } + +impl<'a> SomeTrait for &'a isize { + fn get(&self) -> isize { + **self + } +} + +fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box { + box v as Box +} + +fn main() { + let i: isize = 22; + let obj = make_object(&i); + assert_eq!(22, obj.get()); +} diff --git a/src/test/run-pass/regions/regions-copy-closure.rs b/src/test/run-pass/regions/regions-copy-closure.rs new file mode 100644 index 00000000000..a5f0860be16 --- /dev/null +++ b/src/test/run-pass/regions/regions-copy-closure.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct closure_box<'a> { + cl: Box, +} + +fn box_it<'a>(x: Box) -> closure_box<'a> { + closure_box {cl: x} +} + +pub fn main() { + let mut i = 3; + assert_eq!(i, 3); + { + let cl = || i += 1; + let mut cl_box = box_it(Box::new(cl)); + (cl_box.cl)(); + } + assert_eq!(i, 4); +} diff --git a/src/test/run-pass/regions/regions-creating-enums2.rs b/src/test/run-pass/regions/regions-creating-enums2.rs new file mode 100644 index 00000000000..84d4a261f1d --- /dev/null +++ b/src/test/run-pass/regions/regions-creating-enums2.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum ast<'a> { + num(usize), + add(&'a ast<'a>, &'a ast<'a>) +} + +fn mk_add_ok<'r>(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> { + ast::add(x, y) +} + +pub fn main() { +} diff --git a/src/test/run-pass/regions/regions-creating-enums5.rs b/src/test/run-pass/regions/regions-creating-enums5.rs new file mode 100644 index 00000000000..24ba0c17611 --- /dev/null +++ b/src/test/run-pass/regions/regions-creating-enums5.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum ast<'a> { + num(usize), + add(&'a ast<'a>, &'a ast<'a>) +} + +fn mk_add_ok<'a>(x: &'a ast<'a>, y: &'a ast<'a>, _z: &ast) -> ast<'a> { + ast::add(x, y) +} + +pub fn main() { +} diff --git a/src/test/run-pass/regions/regions-debruijn-of-object.rs b/src/test/run-pass/regions/regions-debruijn-of-object.rs new file mode 100644 index 00000000000..71464f30ef0 --- /dev/null +++ b/src/test/run-pass/regions/regions-debruijn-of-object.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct ctxt<'tcx> { + x: &'tcx i32 +} + +trait AstConv<'tcx> { + fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>; +} + +fn foo(conv: &AstConv) { } + +fn bar<'tcx>(conv: &AstConv<'tcx>) { + foo(conv) +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-dependent-addr-of.rs b/src/test/run-pass/regions/regions-dependent-addr-of.rs new file mode 100644 index 00000000000..2a86d8aa4e5 --- /dev/null +++ b/src/test/run-pass/regions/regions-dependent-addr-of.rs @@ -0,0 +1,123 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test lifetimes are linked properly when we create dependent region pointers. +// Issue #3148. + +#![feature(box_patterns)] +#![feature(box_syntax)] + +struct A { + value: B +} + +struct B { + v1: isize, + v2: [isize; 3], + v3: Vec , + v4: C, + v5: Box, + v6: Option +} + +#[derive(Copy, Clone)] +struct C { + f: isize +} + +fn get_v1(a: &A) -> &isize { + // Region inferencer must deduce that &v < L2 < L1 + let foo = &a.value; // L1 + &foo.v1 // L2 +} + +fn get_v2(a: &A, i: usize) -> &isize { + let foo = &a.value; + &foo.v2[i] +} + +fn get_v3(a: &A, i: usize) -> &isize { + let foo = &a.value; + &foo.v3[i] +} + +fn get_v4(a: &A, _i: usize) -> &isize { + let foo = &a.value; + &foo.v4.f +} + +fn get_v5(a: &A, _i: usize) -> &isize { + let foo = &a.value; + &foo.v5.f +} + +fn get_v6_a(a: &A, _i: usize) -> &isize { + match a.value.v6 { + Some(ref v) => &v.f, + None => panic!() + } +} + +fn get_v6_b(a: &A, _i: usize) -> &isize { + match *a { + A { value: B { v6: Some(ref v), .. } } => &v.f, + _ => panic!() + } +} + +fn get_v6_c(a: &A, _i: usize) -> &isize { + match a { + &A { value: B { v6: Some(ref v), .. } } => &v.f, + _ => panic!() + } +} + +fn get_v5_ref(a: &A, _i: usize) -> &isize { + match &a.value { + &B {v5: box C {f: ref v}, ..} => v + } +} + +pub fn main() { + let a = A {value: B {v1: 22, + v2: [23, 24, 25], + v3: vec![26, 27, 28], + v4: C { f: 29 }, + v5: box C { f: 30 }, + v6: Some(C { f: 31 })}}; + + let p = get_v1(&a); + assert_eq!(*p, a.value.v1); + + let p = get_v2(&a, 1); + assert_eq!(*p, a.value.v2[1]); + + let p = get_v3(&a, 1); + assert_eq!(*p, a.value.v3[1]); + + let p = get_v4(&a, 1); + assert_eq!(*p, a.value.v4.f); + + let p = get_v5(&a, 1); + assert_eq!(*p, a.value.v5.f); + + let p = get_v6_a(&a, 1); + assert_eq!(*p, a.value.v6.unwrap().f); + + let p = get_v6_b(&a, 1); + assert_eq!(*p, a.value.v6.unwrap().f); + + let p = get_v6_c(&a, 1); + assert_eq!(*p, a.value.v6.unwrap().f); + + let p = get_v5_ref(&a, 1); + assert_eq!(*p, a.value.v5.f); +} diff --git a/src/test/run-pass/regions/regions-dependent-autofn.rs b/src/test/run-pass/regions/regions-dependent-autofn.rs new file mode 100644 index 00000000000..19b345575c3 --- /dev/null +++ b/src/test/run-pass/regions/regions-dependent-autofn.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test lifetimes are linked properly when we autoslice a vector. +// Issue #3148. + +// pretty-expanded FIXME #23616 + +fn subslice(v: F) -> F where F: FnOnce() { v } + +fn both(v: F) -> F where F: FnOnce() { + subslice(subslice(v)) +} + +pub fn main() { + both(main); +} diff --git a/src/test/run-pass/regions/regions-dependent-autoslice.rs b/src/test/run-pass/regions/regions-dependent-autoslice.rs new file mode 100644 index 00000000000..12e14ed49b9 --- /dev/null +++ b/src/test/run-pass/regions/regions-dependent-autoslice.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test lifetimes are linked properly when we autoslice a vector. +// Issue #3148. + +fn subslice1<'r>(v: &'r [usize]) -> &'r [usize] { v } + +fn both<'r>(v: &'r [usize]) -> &'r [usize] { + subslice1(subslice1(v)) +} + +pub fn main() { + let v = vec![1,2,3]; + both(&v); +} diff --git a/src/test/run-pass/regions/regions-dependent-let-ref.rs b/src/test/run-pass/regions/regions-dependent-let-ref.rs new file mode 100644 index 00000000000..fa0955bc351 --- /dev/null +++ b/src/test/run-pass/regions/regions-dependent-let-ref.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test lifetimes are linked properly when we take reference +// to interior. + +// pretty-expanded FIXME #23616 + +struct Foo(isize); +pub fn main() { + // Here the lifetime of the `&` should be at least the + // block, since a ref binding is created to the interior. + let &Foo(ref _x) = &Foo(3); +} diff --git a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs new file mode 100644 index 00000000000..77659c100ff --- /dev/null +++ b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs @@ -0,0 +1,44 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to compile calls to associated fns like +// `decode()` where the bound on the `Self` parameter references a +// lifetime parameter of the trait. This example indicates why trait +// lifetime parameters must be early bound in the type of the +// associated item. + +// pretty-expanded FIXME #23616 + +use std::marker; + +pub enum Value<'v> { + A(&'v str), + B, +} + +pub trait Decoder<'v> { + fn read(&mut self) -> Value<'v>; +} + +pub trait Decodable<'v, D: Decoder<'v>> { + fn decode(d: &mut D) -> Self; +} + +impl<'v, D: Decoder<'v>> Decodable<'v, D> for () { + fn decode(d: &mut D) -> () { + match d.read() { + Value::A(..) => (), + Value::B => Decodable::decode(d), + } + } +} + +pub fn main() { } diff --git a/src/test/run-pass/regions/regions-early-bound-trait-param.rs b/src/test/run-pass/regions/regions-early-bound-trait-param.rs new file mode 100644 index 00000000000..220614c9203 --- /dev/null +++ b/src/test/run-pass/regions/regions-early-bound-trait-param.rs @@ -0,0 +1,144 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that you can use an early-bound lifetime parameter as +// on of the generic parameters in a trait. + +#![feature(box_syntax)] + +trait Trait<'a> { + fn long(&'a self) -> isize; + fn short<'b>(&'b self) -> isize; +} + +fn poly_invoke<'c, T: Trait<'c>>(x: &'c T) -> (isize, isize) { + let l = x.long(); + let s = x.short(); + (l,s) +} + +fn object_invoke1<'d>(x: &'d Trait<'d>) -> (isize, isize) { + let l = x.long(); + let s = x.short(); + (l,s) +} + +struct Struct1<'e> { + f: &'e (Trait<'e>+'e) +} + +fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (isize,isize) { + let l = x.f.long(); + let s = x.f.short(); + (l,s) +} + +struct Struct2<'h, 'i:'h> { + f: &'h (Trait<'i>+'h) +} + +fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> isize { + x.short() +} + +fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> isize { + x.f.short() +} + +trait MakerTrait { + fn mk() -> Self; +} + +fn make_val() -> T { + MakerTrait::mk() +} + +trait RefMakerTrait<'q> { + fn mk(_: Self) -> &'q Self; +} + +fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T { + RefMakerTrait::mk(t) +} + +impl<'s> Trait<'s> for (isize,isize) { + fn long(&'s self) -> isize { + let &(x,_) = self; + x + } + fn short<'b>(&'b self) -> isize { + let &(_,y) = self; + y + } +} + +impl<'t> MakerTrait for Box+'static> { + fn mk() -> Box+'static> { + let tup: Box<(isize, isize)> = box (4,5); + tup as Box + } +} + +enum List<'l> { + Cons(isize, &'l List<'l>), + Null +} + +impl<'l> List<'l> { + fn car<'m>(&'m self) -> isize { + match self { + &List::Cons(car, _) => car, + &List::Null => panic!(), + } + } + fn cdr<'n>(&'n self) -> &'l List<'l> { + match self { + &List::Cons(_, cdr) => cdr, + &List::Null => panic!(), + } + } +} + +impl<'t> RefMakerTrait<'t> for List<'t> { + fn mk(l:List<'t>) -> &'t List<'t> { + l.cdr() + } +} + +pub fn main() { + let t = (2,3); + let o = &t as &Trait; + let s1 = Struct1 { f: o }; + let s2 = Struct2 { f: o }; + assert_eq!(poly_invoke(&t), (2,3)); + assert_eq!(object_invoke1(&t), (2,3)); + assert_eq!(field_invoke1(&s1), (2,3)); + assert_eq!(object_invoke2(&t), 3); + assert_eq!(field_invoke2(&s2), 3); + + let m : Box = make_val(); + // assert_eq!(object_invoke1(&*m), (4,5)); + // ~~~~~~~~~~~~~~~~~~~ + // this call yields a compilation error; see compile-fail/dropck-object-cycle.rs + // for details. + assert_eq!(object_invoke2(&*m), 5); + + // The RefMakerTrait above is pretty strange (i.e. it is strange + // to consume a value of type T and return a &T). Easiest thing + // that came to my mind: consume a cell of a linked list and + // return a reference to the list it points to. + let l0 = List::Null; + let l1 = List::Cons(1, &l0); + let l2 = List::Cons(2, &l1); + let rl1 = &l1; + let r = make_ref(l2); + assert_eq!(rl1.car(), r.car()); +} diff --git a/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs b/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs new file mode 100644 index 00000000000..718ab873a41 --- /dev/null +++ b/src/test/run-pass/regions/regions-early-bound-used-in-bound-method.rs @@ -0,0 +1,40 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that you can use a fn lifetime parameter as part of +// the value for a type parameter in a bound. + + +trait GetRef<'a> { + fn get(&self) -> &'a isize; +} + +#[derive(Copy, Clone)] +struct Box<'a> { + t: &'a isize +} + +impl<'a> GetRef<'a> for Box<'a> { + fn get(&self) -> &'a isize { + self.t + } +} + +impl<'a> Box<'a> { + fn add<'b,G:GetRef<'b>>(&self, g2: G) -> isize { + *self.t + *g2.get() + } +} + +pub fn main() { + let b1 = Box { t: &3 }; + assert_eq!(b1.add(b1), 6); +} diff --git a/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs b/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs new file mode 100644 index 00000000000..e994303643f --- /dev/null +++ b/src/test/run-pass/regions/regions-early-bound-used-in-bound.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that you can use a fn lifetime parameter as part of +// the value for a type parameter in a bound. + + +trait GetRef<'a, T> { + fn get(&self) -> &'a T; +} + +#[derive(Copy, Clone)] +struct Box<'a, T:'a> { + t: &'a T +} + +impl<'a,T:Clone> GetRef<'a,T> for Box<'a,T> { + fn get(&self) -> &'a T { + self.t + } +} + +fn add<'a,G:GetRef<'a, isize>>(g1: G, g2: G) -> isize { + *g1.get() + *g2.get() +} + +pub fn main() { + let b1 = Box { t: &3 }; + assert_eq!(add(b1, b1), 6); +} diff --git a/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs b/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs new file mode 100644 index 00000000000..fd4e46b5392 --- /dev/null +++ b/src/test/run-pass/regions/regions-early-bound-used-in-type-param.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that you can use a fn lifetime parameter as part of +// the value for a type parameter in a bound. + + +trait Get { + fn get(&self) -> T; +} + +#[derive(Copy, Clone)] +struct Box { + t: T +} + +impl Get for Box { + fn get(&self) -> T { + self.t.clone() + } +} + +fn add<'a,G:Get<&'a isize>>(g1: G, g2: G) -> isize { + *g1.get() + *g2.get() +} + +pub fn main() { + let b1 = Box { t: &3 }; + assert_eq!(add(b1, b1), 6); +} diff --git a/src/test/run-pass/regions/regions-escape-into-other-fn.rs b/src/test/run-pass/regions/regions-escape-into-other-fn.rs new file mode 100644 index 00000000000..1601e73aff9 --- /dev/null +++ b/src/test/run-pass/regions/regions-escape-into-other-fn.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn foo(x: &usize) -> &usize { x } +fn bar(x: &usize) -> usize { *x } + +pub fn main() { + let p: Box<_> = box 3; + assert_eq!(bar(foo(&*p)), 3); +} diff --git a/src/test/run-pass/regions/regions-expl-self.rs b/src/test/run-pass/regions/regions-expl-self.rs new file mode 100644 index 00000000000..1af6febb53a --- /dev/null +++ b/src/test/run-pass/regions/regions-expl-self.rs @@ -0,0 +1,24 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that you can insert an explicit lifetime in explicit self. + +// pretty-expanded FIXME #23616 + +struct Foo { + f: usize +} + +impl Foo { + pub fn foo<'a>(&'a self) {} +} + +pub fn main() {} diff --git a/src/test/run-pass/regions/regions-fn-subtyping-2.rs b/src/test/run-pass/regions/regions-fn-subtyping-2.rs new file mode 100644 index 00000000000..a23c5005f07 --- /dev/null +++ b/src/test/run-pass/regions/regions-fn-subtyping-2.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #2263. + +// Here, `f` is a function that takes a pointer `x` and a function +// `g`, where `g` requires its argument `y` to be in the same region +// that `x` is in. +// pretty-expanded FIXME #23616 + +fn has_same_region(f: Box FnMut(&'a isize, Box)>) { + // `f` should be the type that `wants_same_region` wants, but + // right now the compiler complains that it isn't. + wants_same_region(f); +} + +fn wants_same_region(_f: Box FnMut(&'b isize, Box)>) { +} + +pub fn main() { +} diff --git a/src/test/run-pass/regions/regions-fn-subtyping.rs b/src/test/run-pass/regions/regions-fn-subtyping.rs new file mode 100644 index 00000000000..e561fa74346 --- /dev/null +++ b/src/test/run-pass/regions/regions-fn-subtyping.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #2263. + +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +// Should pass region checking. +fn ok(f: Box) { + // Here, g is a function that can accept a usize pointer with + // lifetime r, and f is a function that can accept a usize pointer + // with any lifetime. The assignment g = f should be OK (i.e., + // f's type should be a subtype of g's type), because f can be + // used in any context that expects g's type. But this currently + // fails. + let mut g: Box FnMut(&'r usize)> = Box::new(|x| { }); + g = f; +} + +// This version is the same as above, except that here, g's type is +// inferred. +fn ok_inferred(f: Box) { + let mut g: Box FnMut(&'r usize)> = Box::new(|_| {}); + g = f; +} + +pub fn main() { +} diff --git a/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs b/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs new file mode 100644 index 00000000000..67a77940742 --- /dev/null +++ b/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we recognize that if you have +// +// 'a : 'static +// +// then +// +// 'a : 'b + +fn test<'a,'b>(x: &'a i32) -> &'b i32 + where 'a: 'static +{ + x +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs new file mode 100644 index 00000000000..6ac09930f85 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-addr-of.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem::swap; + +pub fn main() { + let mut x = 4; + + for i in 0_usize..3 { + // ensure that the borrow in this alt + // does not interfere with the swap + // below. note that it would it you + // naively borrowed &x for the lifetime + // of the variable x, as we once did + match i { + i => { + let y = &x; + assert!(i < *y); + } + } + let mut y = 4; + swap(&mut y, &mut x); + } +} diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs new file mode 100644 index 00000000000..2ad1378de04 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-view.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn view(x: &[T]) -> &[T] {x} + +pub fn main() { + let v = vec![1, 2, 3]; + let x = view(&v); + let y = view(x); + assert!((v[0] == x[0]) && (v[0] == y[0])); +} diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs new file mode 100644 index 00000000000..d527f298ce0 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn borrow(x: &T) -> &T {x} + +pub fn main() { + let x: Box<_> = box 3; + loop { + let y = borrow(&*x); + assert_eq!(*x, *y); + break; + } +} diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope.rs b/src/test/run-pass/regions/regions-infer-borrow-scope.rs new file mode 100644 index 00000000000..f3660d8dd17 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-borrow-scope.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct Point {x: isize, y: isize} + +fn x_coord(p: &Point) -> &isize { + return &p.x; +} + +pub fn main() { + let p: Box<_> = box Point {x: 3, y: 4}; + let xc = x_coord(&*p); + assert_eq!(*xc, 3); +} diff --git a/src/test/run-pass/regions/regions-infer-call-2.rs b/src/test/run-pass/regions/regions-infer-call-2.rs new file mode 100644 index 00000000000..8fcfd5f2ee5 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-call-2.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } + +fn with(f: F) -> T where F: FnOnce(&isize) -> T { + f(&20) +} + +fn has_one<'a>(x: &'a isize) -> isize { + with(|y| takes_two(x, y)) +} + +pub fn main() { + assert_eq!(has_one(&2), 22); +} diff --git a/src/test/run-pass/regions/regions-infer-call.rs b/src/test/run-pass/regions/regions-infer-call.rs new file mode 100644 index 00000000000..42ab24705de --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-call.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } + +fn has_two<'a,'b>(x: &'a isize, y: &'b isize) -> isize { + takes_two(x, y) +} + +pub fn main() { + assert_eq!(has_two(&20, &2), 22); +} diff --git a/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs b/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs new file mode 100644 index 00000000000..fc152fd275a --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-contravariance-due-to-ret.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +struct boxed_int<'a> { + f: &'a isize, +} + +fn max<'r>(bi: &'r boxed_int, f: &'r isize) -> isize { + if *bi.f > *f {*bi.f} else {*f} +} + +fn with(bi: &boxed_int) -> isize { + let i = 22; + max(bi, &i) +} + +pub fn main() { + let g = 21; + let foo = boxed_int { f: &g }; + assert_eq!(with(&foo), 22); +} diff --git a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs new file mode 100644 index 00000000000..f6ed97195c1 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test an edge case in region inference: the lifetime of the borrow +// of `*x` must be extended to at least 'a. + +// pretty-expanded FIXME #23616 + +fn foo<'a,'b>(x: &'a &'b mut isize) -> &'a isize { + let y = &*x; // should be inferred to have type &'a &'b mut isize... + + // ...because if we inferred, say, &'x &'b mut isize where 'x <= 'a, + // this reborrow would be illegal: + &**y +} + +pub fn main() { + /* Just want to know that it compiles. */ +} diff --git a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs new file mode 100644 index 00000000000..7af25be1d03 --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +// check that the &isize here does not cause us to think that `foo` +// contains region pointers +// pretty-expanded FIXME #23616 + +struct foo(Box); + +fn take_foo(x: T) {} + +fn have_foo(f: foo) { + take_foo(f); +} + +fn main() {} diff --git a/src/test/run-pass/regions/regions-infer-static-from-proc.rs b/src/test/run-pass/regions/regions-infer-static-from-proc.rs new file mode 100644 index 00000000000..2a3cb3735ec --- /dev/null +++ b/src/test/run-pass/regions/regions-infer-static-from-proc.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Check that the 'static bound on a proc influences lifetimes of +// region variables contained within (otherwise, region inference will +// give `x` a very short lifetime). + +// pretty-expanded FIXME #23616 + +static i: usize = 3; +fn foo(_: F) {} +fn read(_: usize) { } +pub fn main() { + let x = &i; + foo(move|| { + read(*x); + }); +} diff --git a/src/test/run-pass/regions/regions-issue-21422.rs b/src/test/run-pass/regions/regions-issue-21422.rs new file mode 100644 index 00000000000..6e76793e8b9 --- /dev/null +++ b/src/test/run-pass/regions/regions-issue-21422.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #21422, which was related to failing to +// add inference constraints that the operands of a binary operator +// should outlive the binary operation itself. + +// pretty-expanded FIXME #23616 + +pub struct P<'a> { + _ptr: *const &'a u8, +} + +impl <'a> PartialEq for P<'a> { + fn eq(&self, other: &P<'a>) -> bool { + (self as *const _) == (other as *const _) + } +} + +fn main() {} diff --git a/src/test/run-pass/regions/regions-issue-22246.rs b/src/test/run-pass/regions/regions-issue-22246.rs new file mode 100644 index 00000000000..8a54f30133e --- /dev/null +++ b/src/test/run-pass/regions/regions-issue-22246.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #22246 -- we should be able to deduce +// that `&'a B::Owned` implies that `B::Owned : 'a`. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +use std::ops::Deref; + +pub trait ToOwned: Sized { + type Owned: Borrow; + fn to_owned(&self) -> Self::Owned; +} + +pub trait Borrow { + fn borrow(&self) -> &Borrowed; +} + +pub struct Foo { + owned: B::Owned +} + +fn foo(this: &Foo) -> &B { + this.owned.borrow() +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs new file mode 100644 index 00000000000..1a294dceab8 --- /dev/null +++ b/src/test/run-pass/regions/regions-lifetime-nonfree-late-bound.rs @@ -0,0 +1,45 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is a regression test for the ICE from issue #10846. +// +// The original issue causing the ICE: the LUB-computations during +// type inference were encountering late-bound lifetimes, and +// asserting that such lifetimes should have already been substituted +// with a concrete lifetime. +// +// However, those encounters were occurring within the lexical scope +// of the binding for the late-bound lifetime; that is, the late-bound +// lifetimes were perfectly valid. The core problem was that the type +// folding code was over-zealously passing back all lifetimes when +// doing region-folding, when really all clients of the region-folding +// case only want to see FREE lifetime variables, not bound ones. + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { + fn explicit() { + fn test(_x: Option>) where F: FnMut(Box FnMut(&'a isize)>) {} + test(Some(box |_f: Box FnMut(&'a isize)>| {})); + } + + // The code below is shorthand for the code above (and more likely + // to represent what one encounters in practice). + fn implicit() { + fn test(_x: Option>) where F: FnMut(Box< FnMut(& isize)>) {} + test(Some(box |_f: Box< FnMut(& isize)>| {})); + } + + explicit(); + implicit(); +} diff --git a/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs new file mode 100644 index 00000000000..758473634cb --- /dev/null +++ b/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test verifies that temporary lifetime is correctly computed +// for static objects in enclosing scopes. + + +use std::cmp::PartialEq; + +fn f(o: &mut Option) { + assert_eq!(*o, None); +} + +pub fn main() { + mod t { + enum E {V=1, A=0} + static C: E = E::V; + } + + f::(&mut None); +} diff --git a/src/test/run-pass/regions/regions-link-fn-args.rs b/src/test/run-pass/regions/regions-link-fn-args.rs new file mode 100644 index 00000000000..cb52c69cbe3 --- /dev/null +++ b/src/test/run-pass/regions/regions-link-fn-args.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that region inference correctly links up the regions when a +// `ref` borrow occurs inside a fn argument. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +fn with<'a, F>(_: F) where F: FnOnce(&'a Vec) -> &'a Vec { } + +fn foo() { + with(|&ref ints| ints); +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs new file mode 100644 index 00000000000..907746a65ee --- /dev/null +++ b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a corner case of LUB coercion. In this case, one arm of the +// match requires a deref coercion and the other doesn't, and there +// is an extra `&` on the `rc`. We want to be sure that the lifetime +// assigned to this `&rc` value is not `'a` but something smaller. In +// other words, the type from `rc` is `&'a Rc` and the type +// from `&rc` should be `&'x &'a Rc`, where `'x` is something +// small. + +use std::rc::Rc; + +#[derive(Clone)] +enum CachedMir<'mir> { + Ref(&'mir String), + Owned(Rc), +} + +impl<'mir> CachedMir<'mir> { + fn get_ref<'a>(&'a self) -> &'a String { + match *self { + CachedMir::Ref(r) => r, + CachedMir::Owned(ref rc) => &rc, + } + } +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-mock-codegen.rs b/src/test/run-pass/regions/regions-mock-codegen.rs new file mode 100644 index 00000000000..6d521432849 --- /dev/null +++ b/src/test/run-pass/regions/regions-mock-codegen.rs @@ -0,0 +1,65 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +#![feature(allocator_api)] + +use std::alloc::{Alloc, Global, Layout, handle_alloc_error}; +use std::ptr::NonNull; + +struct arena(()); + +struct Bcx<'a> { + fcx: &'a Fcx<'a> +} + +struct Fcx<'a> { + arena: &'a arena, + ccx: &'a Ccx +} + +struct Ccx { + x: isize +} + +fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> { + unsafe { + let layout = Layout::new::(); + let ptr = Global.alloc(layout).unwrap_or_else(|_| handle_alloc_error(layout)); + &*(ptr.as_ptr() as *const _) + } +} + +fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> { + return alloc(bcx.fcx.arena); +} + +fn g(fcx : &Fcx) { + let bcx = Bcx { fcx: fcx }; + let bcx2 = h(&bcx); + unsafe { + Global.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::()); + } +} + +fn f(ccx : &Ccx) { + let a = arena(()); + let fcx = Fcx { arena: &a, ccx: ccx }; + return g(&fcx); +} + +pub fn main() { + let ccx = Ccx { x: 0 }; + f(&ccx); +} diff --git a/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs b/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs new file mode 100644 index 00000000000..0f2fa1f7c78 --- /dev/null +++ b/src/test/run-pass/regions/regions-no-bound-in-argument-cleanup.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::marker; + +pub struct Foo(marker::PhantomData); + +impl Iterator for Foo { + type Item = T; + + fn next(&mut self) -> Option { + None + } +} + +impl Drop for Foo { + fn drop(&mut self) { + self.next(); + } +} + +pub fn foo<'a>(_: Foo<&'a ()>) {} + +pub fn main() {} diff --git a/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs b/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs new file mode 100644 index 00000000000..3d0d5f2dbcf --- /dev/null +++ b/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #12856: a lifetime formal binding introduced by a generic fn +// should not upset the variance inference for actual occurrences of +// that lifetime in type expressions. + + +pub trait HasLife<'a> { + fn dummy(&'a self) { } // just to induce a variance on 'a +} + +trait UseLife01 { + fn refs<'a, H: HasLife<'a>>(&'a self) -> H; +} + +trait UseLife02 { + fn refs<'a, T: 'a, H: HasType<&'a T>>(&'a self) -> H; +} + + +pub trait HasType +{ + fn dummy(&self, t: T) -> T { panic!() } +} + + +trait UseLife03 { + fn refs<'a, H: HasType<&'a T>>(&'a self) -> H where T: 'a; +} + + +// (The functions below were not actually a problem observed during +// fixing of #12856; they just seem like natural tests to put in to +// cover a couple more points in the testing space) + +pub fn top_refs_1<'a, H: HasLife<'a>>(_s: &'a ()) -> H { + unimplemented!() +} + +pub fn top_refs_2<'a, T: 'a, H: HasType<&'a T>>(_s: &'a ()) -> H { + unimplemented!() +} + +pub fn main() {} diff --git a/src/test/run-pass/regions/regions-nullary-variant.rs b/src/test/run-pass/regions/regions-nullary-variant.rs new file mode 100644 index 00000000000..b24e2496350 --- /dev/null +++ b/src/test/run-pass/regions/regions-nullary-variant.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum roption<'a> { + a, b(&'a usize) +} + +fn mk(cond: bool, ptr: &usize) -> roption { + if cond {roption::a} else {roption::b(ptr)} +} + +pub fn main() {} diff --git a/src/test/run-pass/regions/regions-params.rs b/src/test/run-pass/regions/regions-params.rs new file mode 100644 index 00000000000..b7060cb2b94 --- /dev/null +++ b/src/test/run-pass/regions/regions-params.rs @@ -0,0 +1,28 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn region_identity(x: &usize) -> &usize { x } + +fn apply(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) } + +fn parameterized(x: &usize) -> usize { + let z = apply(x, ({|y| + region_identity(y) + })); + *z +} + +pub fn main() { + let x = 3; + assert_eq!(parameterized(&x), 3); +} diff --git a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs new file mode 100644 index 00000000000..0a30dcb721f --- /dev/null +++ b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that the type checker permits us to reassign `z` which +// started out with a longer lifetime and was reassigned to a shorter +// one (it should infer to be the intersection). + +// pretty-expanded FIXME #23616 + +fn foo(x: &isize) { + let a = 1; + let mut z = x; + z = &a; +} + +pub fn main() { + foo(&1); +} diff --git a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs new file mode 100644 index 00000000000..28455b1f3cf --- /dev/null +++ b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that the type checker permits us to reassign `z` which +// started out with a longer lifetime and was reassigned to a shorter +// one (it should infer to be the intersection). + +// pretty-expanded FIXME #23616 + +fn foo(x: &isize) { + let a = 1; + match x { + mut z => { + z = &a; + } + } +} + +pub fn main() { + foo(&1); +} diff --git a/src/test/run-pass/regions/regions-refcell.rs b/src/test/run-pass/regions/regions-refcell.rs new file mode 100644 index 00000000000..0042edb65ad --- /dev/null +++ b/src/test/run-pass/regions/regions-refcell.rs @@ -0,0 +1,55 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is a regression test for something that only came up while +// attempting to bootstrap librustc with new destructor lifetime +// semantics. + + +use std::collections::HashMap; +use std::cell::RefCell; + +// This version does not yet work (associated type issues)... +#[cfg(cannot_use_this_yet)] +fn foo<'a>(map: RefCell>) { + let one = [1]; + assert_eq!(map.borrow().get("one"), Some(&one[..])); +} + +#[cfg(cannot_use_this_yet_either)] +// ... and this version does not work (the lifetime of `one` is +// supposed to match the lifetime `'a`) ... +fn foo<'a>(map: RefCell>) { + let one = [1]; + assert_eq!(map.borrow().get("one"), Some(&&one[..])); +} + +#[cfg(all(not(cannot_use_this_yet),not(cannot_use_this_yet_either)))] +fn foo<'a>(map: RefCell>) { + // ...so instead we walk through the trivial slice and make sure + // it contains the element we expect. + + for (i, &x) in map.borrow().get("one").unwrap().iter().enumerate() { + assert_eq!((i, x), (0, 1)); + } +} + +fn main() { + let zer = [0]; + let one = [1]; + let two = [2]; + let mut map = HashMap::new(); + map.insert("zero", &zer[..]); + map.insert("one", &one[..]); + map.insert("two", &two[..]); + let map = RefCell::new(map); + foo(map); +} diff --git a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs new file mode 100644 index 00000000000..86d84172629 --- /dev/null +++ b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -0,0 +1,68 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that this fairly specialized, but also reasonable, pattern +// typechecks. The pattern involves regions bound in closures that +// wind up related to inference variables. +// +// NB. Changes to the region implementations have broken this pattern +// a few times, but it happens to be used in the compiler so those +// changes were caught. However, those uses in the compiler could +// easily get changed or refactored away in the future. + +#![feature(box_syntax)] + +struct Ctxt<'tcx> { + x: &'tcx Vec +} + +struct Foo<'a,'tcx:'a> { + cx: &'a Ctxt<'tcx>, +} + +impl<'a,'tcx> Foo<'a,'tcx> { + fn bother(&mut self) -> isize { + self.elaborate_bounds(Box::new(|this| { + // (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`, + // where `'f0` and `'f1` are fresh, free regions that + // result from the bound regions on the closure, and `'2` + // is a region inference variable created by the call. Due + // to the constraints on the type, we find that `'_2 : 'f1 + // + 'f2` must hold (and can be assumed by the callee). + // Region inference has to do some clever stuff to avoid + // inferring `'_2` to be `'static` in this case, because + // it is created outside the closure but then related to + // regions bound by the closure itself. See the + // `region_constraints.rs` file (and the `givens` field, in + // particular) for more details. + this.foo() + })) + } + + fn foo(&mut self) -> isize { + 22 + } + + fn elaborate_bounds( + &mut self, + mut mk_cand: Box FnMut(&mut Foo<'b, 'tcx>) -> isize>) + -> isize + { + mk_cand(self) + } +} + +fn main() { + let v = vec![]; + let cx = Ctxt { x: &v }; + let mut foo = Foo { cx: &cx }; + assert_eq!(foo.bother(), 22); // just so the code is not dead, basically +} diff --git a/src/test/run-pass/regions/regions-return-interior-of-option.rs b/src/test/run-pass/regions/regions-return-interior-of-option.rs new file mode 100644 index 00000000000..6566969185c --- /dev/null +++ b/src/test/run-pass/regions/regions-return-interior-of-option.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn get(opt: &Option) -> &T { + match *opt { + Some(ref v) => v, + None => panic!("none") + } +} + +pub fn main() { + let mut x = Some(23); + + { + let y = get(&x); + assert_eq!(*y, 23); + } + + x = Some(24); + + { + let y = get(&x); + assert_eq!(*y, 24); + } +} diff --git a/src/test/run-pass/regions/regions-scope-chain-example.rs b/src/test/run-pass/regions/regions-scope-chain-example.rs new file mode 100644 index 00000000000..973f7bd5319 --- /dev/null +++ b/src/test/run-pass/regions/regions-scope-chain-example.rs @@ -0,0 +1,51 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is an example where the older inference algorithm failed. The +// specifics of why it failed are somewhat, but not entirely, tailed +// to the algorithm. Ultimately the problem is that when computing the +// mutual supertype of both sides of the `if` it would be faced with a +// choice of tightening bounds or unifying variables and it took the +// wrong path. The new algorithm avoids this problem and hence this +// example typechecks correctly. + +// pretty-expanded FIXME #23616 + +enum ScopeChain<'a> { + Link(Scope<'a>), + End +} + +type Scope<'a> = &'a ScopeChain<'a>; + +struct OuterContext; + +struct Context<'a> { + foo: &'a OuterContext +} + +impl<'a> Context<'a> { + fn foo(&mut self, scope: Scope) { + let link = if 1 < 2 { + let l = ScopeChain::Link(scope); + self.take_scope(&l); + l + } else { + ScopeChain::Link(scope) + }; + self.take_scope(&link); + } + + fn take_scope(&mut self, x: Scope) { + } +} + +fn main() { } diff --git a/src/test/run-pass/regions/regions-self-impls.rs b/src/test/run-pass/regions/regions-self-impls.rs new file mode 100644 index 00000000000..027c7698bf8 --- /dev/null +++ b/src/test/run-pass/regions/regions-self-impls.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct Clam<'a> { + chowder: &'a isize +} + +trait get_chowder<'a> { + fn get_chowder(&self) -> &'a isize; +} + +impl<'a> get_chowder<'a> for Clam<'a> { + fn get_chowder(&self) -> &'a isize { return self.chowder; } +} + +pub fn main() { + let clam = Clam { chowder: &3 }; + println!("{}", *clam.get_chowder()); + clam.get_chowder(); +} diff --git a/src/test/run-pass/regions/regions-self-in-enums.rs b/src/test/run-pass/regions/regions-self-in-enums.rs new file mode 100644 index 00000000000..5cb9ad7774c --- /dev/null +++ b/src/test/run-pass/regions/regions-self-in-enums.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum int_wrapper<'a> { + int_wrapper_ctor(&'a isize) +} + +pub fn main() { + let x = 3; + let y = int_wrapper::int_wrapper_ctor(&x); + let mut z : &isize; + match y { + int_wrapper::int_wrapper_ctor(zz) => { z = zz; } + } + println!("{}", *z); +} diff --git a/src/test/run-pass/regions/regions-simple.rs b/src/test/run-pass/regions/regions-simple.rs new file mode 100644 index 00000000000..66492b966d1 --- /dev/null +++ b/src/test/run-pass/regions/regions-simple.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let mut x: isize = 3; + let y: &mut isize = &mut x; + *y = 5; + println!("{}", *y); +} diff --git a/src/test/run-pass/regions/regions-static-bound.rs b/src/test/run-pass/regions/regions-static-bound.rs new file mode 100644 index 00000000000..7a8e91ccdda --- /dev/null +++ b/src/test/run-pass/regions/regions-static-bound.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a () + where 'a: 'static { t } +fn static_id<'a>(t: &'a ()) -> &'static () + where 'a: 'static { t } +fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () + where 'a: 'b, 'b: 'static { t } +fn ref_id<'a>(t: &'a ()) -> &'a () where 'static: 'a { t } + +static UNIT: () = (); + +fn main() +{ + let mut val : &'static () = &UNIT; + invariant_id(&mut val); + static_id(val); + static_id_indirect(val); + ref_id(val); +} diff --git a/src/test/run-pass/regions/regions-static-closure.rs b/src/test/run-pass/regions/regions-static-closure.rs new file mode 100644 index 00000000000..fa579a31806 --- /dev/null +++ b/src/test/run-pass/regions/regions-static-closure.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct closure_box<'a> { + cl: Box, +} + +fn box_it<'a>(x: Box) -> closure_box<'a> { + closure_box {cl: x} +} + +fn call_static_closure(mut cl: closure_box<'static>) { + (cl.cl)(); +} + +pub fn main() { + let cl_box = box_it(Box::new(|| println!("Hello, world!"))); + call_static_closure(cl_box); +} diff --git a/src/test/run-pass/regions/regions-trait-object-1.rs b/src/test/run-pass/regions/regions-trait-object-1.rs new file mode 100644 index 00000000000..63bbe31d431 --- /dev/null +++ b/src/test/run-pass/regions/regions-trait-object-1.rs @@ -0,0 +1,45 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This is a regression test for something that only came up while +// attempting to bootstrap libsyntax; it is adapted from +// `syntax::ext::tt::generic_extension`. + + +pub struct E<'a> { + pub f: &'a u8, +} +impl<'b> E<'b> { + pub fn m(&self) -> &'b u8 { self.f } +} + +pub struct P<'c> { + pub g: &'c u8, +} +pub trait M { + fn n(&self) -> u8; +} +impl<'d> M for P<'d> { + fn n(&self) -> u8 { *self.g } +} + +fn extension<'e>(x: &'e E<'e>) -> Box { + loop { + let p = P { g: x.m() }; + return Box::new(p) as Box; + } +} + +fn main() { + let w = E { f: &10 }; + let o = extension(&w); + assert_eq!(o.n(), 10); +} diff --git a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs new file mode 100644 index 00000000000..ffab7dc2e41 --- /dev/null +++ b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a type which is contravariant with respect to its region +// parameter compiles successfully when used in a contravariant way. +// +// Note: see compile-fail/variance-regions-*.rs for the tests that check that the +// variance inference works in the first place. + +// pretty-expanded FIXME #23616 + +struct Contravariant<'a> { + f: &'a isize +} + +fn use_<'a>(c: Contravariant<'a>) { + let x = 3; + + // 'b winds up being inferred to this call. + // Contravariant<'a> <: Contravariant<'call> is true + // if 'call <= 'a, which is true, so no error. + collapse(&x, c); + + fn collapse<'b>(x: &'b isize, c: Contravariant<'b>) { } +} + +pub fn main() {} diff --git a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs new file mode 100644 index 00000000000..ea0051c6b26 --- /dev/null +++ b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a type which is covariant with respect to its region +// parameter is successful when used in a covariant way. +// +// Note: see compile-fail/variance-regions-*.rs for the tests that +// check that the variance inference works in the first place. + +// This is covariant with respect to 'a, meaning that +// Covariant<'foo> <: Covariant<'static> because +// 'foo <= 'static +// pretty-expanded FIXME #23616 + +struct Covariant<'a> { + f: extern "Rust" fn(&'a isize) +} + +fn use_<'a>(c: Covariant<'a>) { + // OK Because Covariant<'a> <: Covariant<'static> iff 'a <= 'static + let _: Covariant<'static> = c; +} + +pub fn main() {} diff --git a/src/test/run-pass/rfcs/rfc-1014-2.rs b/src/test/run-pass/rfcs/rfc-1014-2.rs new file mode 100644 index 00000000000..f0ff8561243 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1014-2.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(libc)] + +extern crate libc; + +type DWORD = u32; +type HANDLE = *mut u8; +type BOOL = i32; + +#[cfg(windows)] +extern "system" { + fn SetStdHandle(nStdHandle: DWORD, nHandle: HANDLE) -> BOOL; +} + +#[cfg(windows)] +fn close_stdout() { + const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; + unsafe { SetStdHandle(STD_OUTPUT_HANDLE, 0 as HANDLE); } +} + +#[cfg(windows)] +fn main() { + close_stdout(); + println!("hello world"); +} + +#[cfg(not(windows))] +fn main() {} diff --git a/src/test/run-pass/rfcs/rfc-1014.rs b/src/test/run-pass/rfcs/rfc-1014.rs new file mode 100644 index 00000000000..35290ae8e6a --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1014.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-cloudabi stdout does not map to file descriptor 1 by default +// ignore-wasm32-bare no libc + +#![feature(libc)] + +extern crate libc; + +type DWORD = u32; +type HANDLE = *mut u8; + +#[cfg(windows)] +extern "system" { + fn GetStdHandle(which: DWORD) -> HANDLE; + fn CloseHandle(handle: HANDLE) -> i32; +} + +#[cfg(windows)] +fn close_stdout() { + const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; + unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); } +} + +#[cfg(not(windows))] +fn close_stdout() { + unsafe { libc::close(1); } +} + +fn main() { + close_stdout(); + println!("hello world"); +} diff --git a/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs b/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs new file mode 100644 index 00000000000..e873b1946d9 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(as_cell)] + +use std::cell::Cell; + +fn main() { + let slice: &mut [i32] = &mut [1, 2, 3]; + let cell_slice: &Cell<[i32]> = Cell::from_mut(slice); + let slice_cell: &[Cell] = cell_slice.as_slice_of_cells(); + + assert_eq!(slice_cell.len(), 3); +} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs new file mode 100644 index 00000000000..b245b659559 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::error::Error; + +fn main() -> Result<(), Box> { + Ok(()) +} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs new file mode 100644 index 00000000000..62ad0e2489a --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs @@ -0,0 +1,12 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() {} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs new file mode 100644 index 00000000000..bff6f9a6bca --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(process_exitcode_placeholder)] + +use std::process::ExitCode; + +fn main() -> ExitCode { + ExitCode::SUCCESS +} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs new file mode 100644 index 00000000000..6c3f2fe4ea5 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs @@ -0,0 +1,14 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(termination_trait_lib)] + +fn main() -> impl std::process::Termination { } diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs new file mode 100644 index 00000000000..cf63737d07f --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs @@ -0,0 +1,16 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::io::Error; + +fn main() -> Result<(), Box> { + Ok(()) +} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs new file mode 100644 index 00000000000..d61876d422a --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::io::Error; + +fn main() -> Result<(), Error> { + Ok(()) +} diff --git a/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs new file mode 100644 index 00000000000..4f60eda0d9a --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs @@ -0,0 +1,14 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn main() -> Result<(), &'static str> { + Ok(()) +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs new file mode 100644 index 00000000000..f0ef9ca37b3 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax, box_patterns)] + +struct Foo{} + +pub fn main() { + let b = box Foo{}; + let box f = &b; + let _: &Foo = f; + + match &&&b { + box f => { + let _: &Foo = f; + }, + _ => panic!(), + } +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs new file mode 100644 index 00000000000..ac245ba6ff8 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs @@ -0,0 +1,50 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +const CONST_REF: &[u8; 3] = b"foo"; + +trait Foo { + const CONST_REF_DEFAULT: &'static [u8; 3] = b"bar"; + const CONST_REF: &'static [u8; 3]; +} + +impl Foo for i32 { + const CONST_REF: &'static [u8; 3] = b"jjj"; +} + +impl Foo for i64 { + const CONST_REF_DEFAULT: &'static [u8; 3] = b"ggg"; + const CONST_REF: &'static [u8; 3] = b"fff"; +} + +// Check that (associated and free) const references are not mistaken for a +// non-reference pattern (in which case they would be auto-dereferenced, making +// the types mismatched). + +fn const_ref() -> bool { + let f = b"foo"; + match f { + CONST_REF => true, + _ => false, + } +} + +fn associated_const_ref() -> bool { + match (b"bar", b"jjj", b"ggg", b"fff") { + (i32::CONST_REF_DEFAULT, i32::CONST_REF, i64::CONST_REF_DEFAULT, i64::CONST_REF) => true, + _ => false, + } +} + +pub fn main() { + assert!(const_ref()); + assert!(associated_const_ref()); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs new file mode 100644 index 00000000000..6ea3b6f99ce --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs @@ -0,0 +1,55 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Wrapper { + Wrap(i32), +} + +use Wrapper::Wrap; + +pub fn main() { + let Wrap(x) = &Wrap(3); + println!("{}", *x); + + let Wrap(x) = &mut Wrap(3); + println!("{}", *x); + + if let Some(x) = &Some(3) { + println!("{}", *x); + } else { + panic!(); + } + + if let Some(x) = &mut Some(3) { + println!("{}", *x); + } else { + panic!(); + } + + if let Some(x) = &mut Some(3) { + *x += 1; + } else { + panic!(); + } + + while let Some(x) = &Some(3) { + println!("{}", *x); + break; + } + while let Some(x) = &mut Some(3) { + println!("{}", *x); + break; + } + while let Some(x) = &mut Some(3) { + *x += 1; + break; + } +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs new file mode 100644 index 00000000000..e85d11f073d --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let mut tups = vec![(0u8, 1u8)]; + + for (n, m) in &tups { + let _: &u8 = n; + let _: &u8 = m; + } + + for (n, m) in &mut tups { + *n += 1; + *m += 2; + } + + assert_eq!(tups, vec![(1u8, 3u8)]); + + for (n, m) in tups { + println!("{} {}", m, n); + } +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs new file mode 100644 index 00000000000..2aad9ccd6ef --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs @@ -0,0 +1,258 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn some_or_wildcard(r: &Option, b: &i32) { + let _: &i32 = match r { + Some(a) => a, + _ => b, + }; +} + +fn none_or_wildcard(r: &Option, b: &i32) { + let _: &i32 = match r { + None => b, + _ => b, + }; +} + +fn some_or_ref_none(r: &Option, b: &i32) { + let _: &i32 = match r { + Some(a) => a, + &None => b, + }; +} + +fn ref_some_or_none(r: &Option, b: &i32) { + let _: &i32 = match r { + &Some(ref a) => a, + None => b, + }; +} + +fn some_or_self(r: &Option) { + let _: &Option = match r { + Some(n) => { + let _: &i32 = n; + r + }, + x => x, + }; +} + +fn multiple_deref(r: &&&&&Option) { + let _: i32 = match r { + Some(a) => *a, + None => 5, + }; +} + +fn match_with_or() { + // FIXME(tschottdorf): #44912. + // + // let x = &Some((3, 3)); + // let _: &i32 = match x { + // Some((x, 3)) | &Some((ref x, 5)) => x, + // _ => &5i32, + // }; +} + +fn nested_mixed() { + match (&Some(5), &Some(6)) { + (Some(a), &Some(mut b)) => { + // Here, the `a` will be `&i32`, because in the first half of the tuple + // we hit a non-reference pattern and shift into `ref` mode. + // + // In the second half of the tuple there's no non-reference pattern, + // so `b` will be `i32` (bound with `move` mode). Moreover, `b` is + // mutable. + let _: &i32 = a; + b = 7; + let _: i32 = b; + }, + _ => {}, + }; +} + +fn nested_mixed_multiple_deref_1() { + let x = (1, &Some(5)); + let y = &Some(x); + match y { + Some((a, Some(b))) => { + let _: &i32 = a; + let _: &i32 = b; + }, + _ => {}, + }; +} + +fn nested_mixed_multiple_deref_2() { + let x = &Some(5); + let y = &x; + match y { + Some(z) => { + let _: &i32 = z; + }, + _ => {}, + } +} + +fn new_mutable_reference() { + let mut x = &mut Some(5); + match &mut x { + Some(y) => { + *y = 5; + }, + None => { }, + } + + match &mut x { + Some(y) => { + println!("{}", *y); + }, + None => {}, + } +} + +fn let_implicit_ref_binding() { + struct Foo(i32); + + // Note that these rules apply to any pattern matching + // whether it be in a `match` or a `let`. + // For example, `x` here is a `ref` binding: + let Foo(x) = &Foo(3); + let _: &i32 = x; +} + +fn explicit_mut_binding() { + match &Some(5i32) { + Some(mut n) => { + n += 1; + let _ = n; + } + None => {}, + }; + + match &mut Some(5i32) { + Some(n) => { + *n += 1; + let _ = n; + } + None => {}, + }; + + match &mut &mut Some(5i32) { + Some(n) => { + let _: &mut i32 = n; + } + None => {}, + }; +} + +fn tuple_mut_and_mut_mut() { + match (Some(5i32), &Some(5i32)) { + (Some(n), Some(m)) => { + // `n` and `m` are bound as immutable references. Make new references from them to + // assert that. + let r = n; + let _ = r; + let q = m; + let _ = q; + + // Assert the types. Note that we use `n` and `m` here which would fail had they been + // moved due to the assignments above. + let _: i32 = n; + let _: &i32 = m; + } + (_, _) => {}, + }; + + match (&Some(5i32), &&Some(5i32)) { + (Some(n), Some(m)) => { + let _: &i32 = n; + let _: &i32 = m; + } + (_, _) => {}, + }; + + match &mut &mut (Some(5i32), Some(5i32)) { + (Some(n), Some(m)) => { + // Dereferenced through &mut &mut, so a mutable binding results. + let _: &mut i32 = n; + let _: &mut i32 = m; + } + (_, _) => {}, + }; + + match (&mut Some(5i32), &mut &mut Some(5i32)) { + (Some(n), Some(m)) => { + let _: &mut i32 = n; + let _: &mut i32 = m; + } + (_, _) => {}, + }; +} + +fn min_mir_embedded_type() { + // The reduced invocation that an ICE was diagnosed with (was consuming + // adjustments in wrong order). + match (0u8, &&Some(5i32)) { + (_, Some(m)) => { + let _: &i32 = m; + } + (_, _) => {}, + }; +} + +fn no_autoderef() { + // Binding. + let x = &3; + println!("{}", *x); + + // Wildcard. + let _ = &3; + + // Constant of generic type (string) + const Y: &'static str = "foo"; + assert_eq!(0, match "foo" { + Y => 0, + _ => 1, + }); + + // Reference pattern. + let &x = &3; +} + +pub fn main() { + let r: &Option = &Some(3); + let b = &4i32; + + none_or_wildcard(r, b); + some_or_wildcard(r, b); + some_or_ref_none(r, b); + ref_some_or_none(r, b); + + some_or_self(r); + multiple_deref(&&&&r); + match_with_or(); + + nested_mixed(); + nested_mixed_multiple_deref_1(); + nested_mixed_multiple_deref_2(); + + new_mutable_reference(); + explicit_mut_binding(); + tuple_mut_and_mut_mut(); + min_mir_embedded_type(); + + let_implicit_ref_binding(); + + no_autoderef(); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs new file mode 100644 index 00000000000..ac6f61b32b7 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs @@ -0,0 +1,43 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn with_u8() { + let s = 5u8; + let r = match &s { + 4 => false, + 5 => true, + _ => false, + }; + assert!(r); +} + +// A string literal isn't mistaken for a non-ref pattern (in which case we'd +// deref `s` and mess things up). +fn with_str() { + let s: &'static str = "abc"; + match s { + "abc" => true, + _ => panic!(), + }; +} + +// Ditto with byte strings. +fn with_bytes() { + let s: &'static [u8] = b"abc"; + match s { + b"abc" => true, + _ => panic!(), + }; +} + +pub fn main() { + with_str(); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs new file mode 100644 index 00000000000..3c8463f77ef --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let i = 5; + match &&&&i { + 1 ..= 3 => panic!(), + 3 ..= 8 => {}, + _ => panic!(), + } +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs new file mode 100644 index 00000000000..7cdd35acaad --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs @@ -0,0 +1,26 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn foo<'a, 'b>(x: &'a &'b Option) -> &'a u32 { + let x: &'a &'a Option = x; + match x { + Some(r) => { + let _: &u32 = r; + r + }, + &None => panic!(), + } +} + +pub fn main() { + let x = Some(5); + foo(&&x); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs new file mode 100644 index 00000000000..c8144e09fc8 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs @@ -0,0 +1,24 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we "reset" the mode as we pass through a `&` pattern. +// +// cc #46688 + +fn surprise(x: i32) { + assert_eq!(x, 2); +} + +fn main() { + let x = &(1, &2); + let (_, &b) = x; + surprise(b); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs new file mode 100644 index 00000000000..90fa52bc903 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(slice_patterns)] + +fn slice_pat() { + let sl: &[u8] = b"foo"; + + match sl { + [first, remainder..] => { + let _: &u8 = first; + assert_eq!(first, &b'f'); + assert_eq!(remainder, b"oo"); + } + [] => panic!(), + } +} + +fn slice_pat_omission() { + match &[0, 1, 2] { + [..] => {} + }; +} + +fn main() { + slice_pat(); + slice_pat_omission(); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs new file mode 100644 index 00000000000..5e41f012137 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug, PartialEq)] +struct Foo { + x: u8, +} + +pub fn main() { + let mut foo = Foo { + x: 1, + }; + + match &mut foo { + Foo{x: n} => { + *n += 1; + }, + }; + + assert_eq!(foo, Foo{x: 2}); + + let Foo{x: n} = &foo; + assert_eq!(*n, 2); +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs new file mode 100644 index 00000000000..072332cd9d0 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs @@ -0,0 +1,28 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +enum Foo { + Bar(Option, (), (), Vec), + Baz, +} + +pub fn main() { + let foo = Foo::Bar(Some(1), (), (), vec![2, 3]); + + match &foo { + Foo::Baz => panic!(), + Foo::Bar(None, ..) => panic!(), + Foo::Bar(Some(n), .., v) => { + assert_eq!((*v).len(), 2); + assert_eq!(*n, 1); + } + } +} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs new file mode 100644 index 00000000000..830e6f5e5ba --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs @@ -0,0 +1,22 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + let foo = (Some(1), (), (), vec![2, 3]); + + match &foo { + (Some(n), .., v) => { + assert_eq!((*v).len(), 2); + assert_eq!(*n, 1); + } + (None, (), (), ..) => panic!(), + } +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs new file mode 100644 index 00000000000..0dbc5c8f969 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![crate_type = "rlib"] +#![feature(non_exhaustive)] + +#[non_exhaustive] +pub enum NonExhaustiveEnum { + Unit, + Tuple(u32), + Struct { field: u32 } +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs new file mode 100644 index 00000000000..25764457701 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(non_exhaustive)] + +#[non_exhaustive] +pub struct NormalStruct { + pub first_field: u16, + pub second_field: u16, +} + +#[non_exhaustive] +pub struct UnitStruct; + +#[non_exhaustive] +pub struct TupleStruct (pub u16, pub u16); diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs new file mode 100644 index 00000000000..2975126709b --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![crate_type = "rlib"] +#![feature(non_exhaustive)] + +pub enum NonExhaustiveVariants { + #[non_exhaustive] Unit, + #[non_exhaustive] Tuple(u32), + #[non_exhaustive] Struct { field: u32 } +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs new file mode 100644 index 00000000000..ff8b473b43b --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs @@ -0,0 +1,63 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:enums.rs +extern crate enums; + +// ignore-pretty issue #37199 + +use enums::NonExhaustiveEnum; + +fn main() { + let enum_unit = NonExhaustiveEnum::Unit; + + match enum_unit { + NonExhaustiveEnum::Unit => 1, + NonExhaustiveEnum::Tuple(_) => 2, + // This particular arm tests that a enum marked as non-exhaustive + // will not error if its variants are matched exhaustively. + NonExhaustiveEnum::Struct { field } => field, + _ => 0 // no error with wildcard + }; + + match enum_unit { + _ => "no error with only wildcard" + }; + + + // issue #53549 - check that variant constructors can still be called normally. + + match NonExhaustiveEnum::Unit { + NonExhaustiveEnum::Unit => {}, + _ => {} + }; + + match NonExhaustiveEnum::Tuple(2) { + NonExhaustiveEnum::Tuple(2) => {}, + _ => {} + }; + + match (NonExhaustiveEnum::Unit {}) { + NonExhaustiveEnum::Unit {} => {}, + _ => {} + }; + + match (NonExhaustiveEnum::Tuple { 0: 2 }) { + NonExhaustiveEnum::Tuple { 0: 2 } => {}, + _ => {} + }; + + match (NonExhaustiveEnum::Struct { field: 2 }) { + NonExhaustiveEnum::Struct { field: 2 } => {}, + _ => {} + }; + +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs new file mode 100644 index 00000000000..8f0274f318d --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(non_exhaustive)] + +#[non_exhaustive] +pub enum NonExhaustiveEnum { + Unit, + Tuple(u32), + Struct { field: u32 } +} + +fn main() { + let enum_unit = NonExhaustiveEnum::Unit; + + match enum_unit { + NonExhaustiveEnum::Unit => "first", + NonExhaustiveEnum::Tuple(_) => "second", + NonExhaustiveEnum::Struct { .. } => "third", + }; +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs new file mode 100644 index 00000000000..2bfdddc8eb7 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:structs.rs +extern crate structs; + +use structs::{NormalStruct, UnitStruct, TupleStruct}; + +// We only test matching here as we cannot create non-exhaustive +// structs from another crate. ie. they'll never pass in run-pass tests. + +fn match_structs(ns: NormalStruct, ts: TupleStruct, us: UnitStruct) { + let NormalStruct { first_field, second_field, .. } = ns; + + let TupleStruct { 0: first, 1: second, .. } = ts; + + let UnitStruct { .. } = us; +} + +fn main() { } diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs new file mode 100644 index 00000000000..6c71c05709c --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(non_exhaustive)] + +#[non_exhaustive] +pub struct NormalStruct { + pub first_field: u16, + pub second_field: u16, +} + +#[non_exhaustive] +pub struct UnitStruct; + +#[non_exhaustive] +pub struct TupleStruct (pub u16, pub u16); + +fn main() { + let ns = NormalStruct { first_field: 640, second_field: 480 }; + + let NormalStruct { first_field, second_field } = ns; + + let ts = TupleStruct { 0: 340, 1: 480 }; + let ts_constructor = TupleStruct(340, 480); + + let TupleStruct { 0: first, 1: second } = ts; + let TupleStruct(first, second) = ts_constructor; + + let us = UnitStruct {}; + let us_constructor = UnitStruct; + + let UnitStruct { } = us; +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs new file mode 100644 index 00000000000..2122534facb --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:variants.rs +extern crate variants; + +use variants::NonExhaustiveVariants; + +/* + * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for + * variants. See issue #44109 and PR 45394. + */ +// ignore-test + +fn main() { + let variant_tuple = NonExhaustiveVariants::Tuple { 0: 340 }; + let variant_struct = NonExhaustiveVariants::Struct { field: 340 }; + + match variant_struct { + NonExhaustiveVariants::Unit => "", + NonExhaustiveVariants::Struct { field, .. } => "", + NonExhaustiveVariants::Tuple(fe_tpl, ..) => "" + }; +} diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs new file mode 100644 index 00000000000..e339c046b18 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(non_exhaustive)] + +/* + * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for + * variants. See issue #44109 and PR 45394. + */ +// ignore-test + +pub enum NonExhaustiveVariants { + #[non_exhaustive] Unit, + #[non_exhaustive] Tuple(u32), + #[non_exhaustive] Struct { field: u32 } +} + +fn main() { + let variant_tuple = NonExhaustiveVariants::Tuple(340); + let variant_struct = NonExhaustiveVariants::Struct { field: 340 }; + + match variant_tuple { + NonExhaustiveVariants::Unit => "", + NonExhaustiveVariants::Tuple(fe_tpl) => "", + NonExhaustiveVariants::Struct { field } => "" + }; +} diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs new file mode 100644 index 00000000000..71904acae72 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs @@ -0,0 +1,52 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(crate_in_paths)] + +use crate::m::f; +use crate as root; + +mod m { + pub fn f() -> u8 { 1 } + pub fn g() -> u8 { 2 } + pub fn h() -> u8 { 3 } + + // OK, visibilities are implicitly absolute like imports + pub(in crate::m) struct S; +} + +mod n { + use crate::m::f; + use crate as root; + pub fn check() { + assert_eq!(f(), 1); + assert_eq!(crate::m::g(), 2); + assert_eq!(root::m::h(), 3); + } +} + +mod p { + use {super::f, crate::m::g, self::root::m::h}; + use crate as root; + pub fn check() { + assert_eq!(f(), 1); + assert_eq!(g(), 2); + assert_eq!(h(), 3); + } +} + +fn main() { + assert_eq!(f(), 1); + assert_eq!(crate::m::g(), 2); + assert_eq!(root::m::h(), 3); + n::check(); + p::check(); +} diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr new file mode 100644 index 00000000000..f95237fbbea --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr @@ -0,0 +1,8 @@ +warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable + --> $DIR/crate-path-absolute.rs:12:12 + | +LL | #![feature(crate_in_paths)] + | ^^^^^^^^^^^^^^ + | + = note: #[warn(stable_features)] on by default + diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs new file mode 100644 index 00000000000..37821777822 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs @@ -0,0 +1,25 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(crate_in_paths)] +#![feature(crate_visibility_modifier)] + +mod m { + pub struct Z; + pub struct S1(crate (::m::Z)); // OK + pub struct S2((crate ::m::Z)); // OK + pub struct S3(crate ::m::Z); // OK + pub struct S4(crate crate::m::Z); // OK +} + +fn main() { + crate struct S; // OK (item in statement position) +} diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr new file mode 100644 index 00000000000..91f918dbd2c --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr @@ -0,0 +1,8 @@ +warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable + --> $DIR/crate-path-visibility-ambiguity.rs:12:12 + | +LL | #![feature(crate_in_paths)] + | ^^^^^^^^^^^^^^ + | + = note: #[warn(stable_features)] on by default + diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs new file mode 100644 index 00000000000..a5214d796cd --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[derive(Debug, PartialEq)] +pub struct S; + +#[derive(Debug)] +pub struct Z; + +pub trait Tr<'a> {} diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs new file mode 100644 index 00000000000..b13602297a4 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate.rs +// compile-flags:--extern xcrate +// edition:2018 + +use xcrate::Z; + +fn f() { + use xcrate; + use xcrate as ycrate; + let s = xcrate::S; + assert_eq!(format!("{:?}", s), "S"); + let z = ycrate::Z; + assert_eq!(format!("{:?}", z), "Z"); +} + +fn main() { + let s = ::xcrate::S; + assert_eq!(format!("{:?}", s), "S"); + let z = Z; + assert_eq!(format!("{:?}", z), "Z"); +} diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs new file mode 100644 index 00000000000..0d84ccc3d32 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:xcrate.rs +// compile-flags:--extern xcrate + +#![feature(extern_in_paths)] + +use extern::xcrate::Z; + +type A = extern::xcrate::S; +type B = for<'a> extern::xcrate::Tr<'a>; + +fn f() { + use extern::xcrate; + use extern::xcrate as ycrate; + let s = xcrate::S; + assert_eq!(format!("{:?}", s), "S"); + let z = ycrate::Z; + assert_eq!(format!("{:?}", z), "Z"); +} + +fn main() { + let s = extern::xcrate::S; + assert_eq!(format!("{:?}", s), "S"); + let z = Z; + assert_eq!(format!("{:?}", z), "Z"); + assert_eq!(A {}, extern::xcrate::S {}); +} diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs new file mode 100644 index 00000000000..a8fa07af14d --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs @@ -0,0 +1,20 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that `#[test]` works with extern-absolute-paths enabled. +// +// Regression test for #47075. + +// edition:2018 +// compile-flags: --test + +#[test] +fn test() {} diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs new file mode 100644 index 00000000000..dfd9fbd2774 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs @@ -0,0 +1,24 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// edition:2018 + +// Tests that `core` and `std` are always available. +use core::iter; +use std::io; +// FIXME(eddyb) Add a `meta` crate to the distribution. +// use meta; + +fn main() { + for _ in iter::once(()) { + io::stdout(); + } +} diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs new file mode 100644 index 00000000000..95db3873619 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs @@ -0,0 +1,25 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem; + +#[r#repr(r#C, r#packed)] +struct Test { + a: bool, b: u64 +} + +#[r#derive(r#Debug)] +struct Test2(u32); + +pub fn main() { + assert_eq!(mem::size_of::(), 9); + assert_eq!("Test2(123)", format!("{:?}", Test2(123))); +} diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs new file mode 100644 index 00000000000..38c00f4a7e1 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs @@ -0,0 +1,30 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +fn r#fn(r#match: u32) -> u32 { + r#match +} + +pub fn main() { + let r#struct = 1; + assert_eq!(1, r#struct); + + let foo = 2; + assert_eq!(2, r#foo); + + let r#bar = 3; + assert_eq!(3, bar); + + assert_eq!(4, r#fn(4)); + + let r#true = false; + assert_eq!(r#true, false); +} diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs new file mode 100644 index 00000000000..b3ea7b28362 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs @@ -0,0 +1,42 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug, PartialEq, Eq)] +struct IntWrapper(u32); + +#[derive(Debug, Ord, PartialOrd, PartialEq, Eq, Hash, Copy, Clone, Default)] +struct HasKeywordField { + r#struct: u32, +} + +struct Generic(T); + +trait Trait { + fn r#trait(&self) -> u32; +} +impl Trait for Generic { + fn r#trait(&self) -> u32 { + self.0 + } +} + +pub fn main() { + assert_eq!(IntWrapper(1), r#IntWrapper(1)); + + match IntWrapper(2) { + r#IntWrapper(r#struct) => assert_eq!(2, r#struct), + } + + assert_eq!("HasKeywordField { struct: 3 }", format!("{:?}", HasKeywordField { r#struct: 3 })); + + assert_eq!(4, Generic(4).0); + assert_eq!(5, Generic(5).r#trait()); +} diff --git a/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs new file mode 100644 index 00000000000..ed39498526d --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs @@ -0,0 +1,48 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(decl_macro)] + +r#macro_rules! r#struct { + ($r#struct:expr) => { $r#struct } +} + +macro_rules! old_macro { + ($a:expr) => {$a} +} + +macro r#decl_macro($r#fn:expr) { + $r#fn +} + +macro passthrough($id:ident) { + $id +} + +macro_rules! test_pat_match { + (a) => { 6 }; + (r#a) => { 7 }; +} + +pub fn main() { + r#println!("{struct}", r#struct = 1); + assert_eq!(2, r#struct!(2)); + assert_eq!(3, r#old_macro!(3)); + assert_eq!(4, decl_macro!(4)); + + let r#match = 5; + assert_eq!(5, passthrough!(r#match)); + + assert_eq!("r#struct", stringify!(r#struct)); + + assert_eq!(6, test_pat_match!(a)); + assert_eq!(7, test_pat_match!(r#a)); +} diff --git a/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs b/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs new file mode 100644 index 00000000000..29e8ab8ed1f --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(if_while_or_patterns)] + +enum E { + V(u8), + U(u8), + W, +} +use E::*; + +fn main() { + let mut e = V(10); + + if let V(x) | U(x) = e { + assert_eq!(x, 10); + } + while let V(x) | U(x) = e { + assert_eq!(x, 10); + e = W; + } +} diff --git a/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs b/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs new file mode 100644 index 00000000000..156e240e442 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2302-self-struct-ctor.rs @@ -0,0 +1,129 @@ +// run-pass + +#![feature(self_struct_ctor)] + +#![allow(dead_code)] + +use std::fmt::Display; + +struct ST1(i32, i32); + +impl ST1 { + fn new() -> Self { + ST1(0, 1) + } + + fn ctor() -> Self { + Self(1,2) // Self as a constructor + } + + fn pattern(self) { + match self { + Self(x, y) => println!("{} {}", x, y), // Self as a pattern + } + } +} + +struct ST2(T); // With type parameter + +impl ST2 where T: Display { + + fn ctor(v: T) -> Self { + Self(v) + } + + fn pattern(&self) { + match self { + Self(ref v) => println!("{}", v), + } + } +} + +struct ST3<'a>(&'a i32); // With lifetime parameter + +impl<'a> ST3<'a> { + + fn ctor(v: &'a i32) -> Self { + Self(v) + } + + fn pattern(self) { + let Self(ref v) = self; + println!("{}", v); + } +} + +struct ST4(usize); + +impl ST4 { + fn map(opt: Option) -> Option { + opt.map(Self) // use `Self` as a function passed somewhere + } +} + +struct ST5; // unit struct + +impl ST5 { + fn ctor() -> Self { + Self // `Self` as a unit struct value + } + + fn pattern(self) -> Self { + match self { + Self => Self, // `Self` as a unit struct value for matching + } + } +} + +struct ST6(i32); +type T = ST6; +impl T { + fn ctor() -> Self { + ST6(1) + } + + fn type_alias(self) { + let Self(_x) = match self { Self(x) => Self(x) }; + let _opt: Option = Some(0).map(Self); + } +} + +struct ST7(T1, T2); + +impl ST7 { + + fn ctor() -> Self { + Self(1, 2) + } + + fn pattern(self) -> Self { + match self { + Self(x, y) => Self(x, y), + } + } +} + +fn main() { + let v1 = ST1::ctor(); + v1.pattern(); + + let v2 = ST2::ctor(10); + v2.pattern(); + + let local = 42; + let v3 = ST3::ctor(&local); + v3.pattern(); + + let v4 = Some(1usize); + let _ = ST4::map(v4); + + let v5 = ST5::ctor(); + v5.pattern(); + + let v6 = ST6::ctor(); + v6.type_alias(); + + let v7 = ST7::::ctor(); + let r = v7.pattern(); + println!("{} {}", r.0, r.1) +} diff --git a/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs b/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs new file mode 100644 index 00000000000..755e3cb8c3b --- /dev/null +++ b/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that removed keywords are allowed as identifiers. +fn main () { + let offsetof = (); + let alignof = (); + let sizeof = (); + let pure = (); +} + +fn offsetof() {} +fn alignof() {} +fn sizeof() {} +fn pure() {} diff --git a/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs b/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs new file mode 100644 index 00000000000..a6b46d9c00c --- /dev/null +++ b/src/test/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +macro_rules! foo { + (#[$attr:meta] $x:ident) => { + #[$attr] + struct $x { + x: u32 + } + } +} + +foo! { #[derive(PartialEq, Eq)] Foo } + +const FOO: Foo = Foo { x: 0 }; + +fn main() { + let y = Foo { x: 1 }; + match y { + FOO => { } + _ => { } + } +} diff --git a/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs b/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs new file mode 100644 index 00000000000..2dfe62b044a --- /dev/null +++ b/src/test/run-pass/rfcs/rfc1445/eq-allows-match.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +#[derive(PartialEq, Eq)] +struct Foo { + x: u32 +} + +const FOO: Foo = Foo { x: 0 }; + +fn main() { + let y = Foo { x: 1 }; + match y { + FOO => { } + _ => { } + } +} diff --git a/src/test/run-pass/rfcs/rfc1623.rs b/src/test/run-pass/rfcs/rfc1623.rs new file mode 100644 index 00000000000..ddb83317fd9 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc1623.rs @@ -0,0 +1,84 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +#![allow(dead_code)] + +// very simple test for a 'static static with default lifetime +static STATIC_STR: &str = "&'static str"; +const CONST_STR: &str = "&'static str"; + +// this should be the same as without default: +static EXPLICIT_STATIC_STR: &'static str = "&'static str"; +const EXPLICIT_CONST_STR: &'static str = "&'static str"; + +// a function that elides to an unbound lifetime for both in- and output +fn id_u8_slice(arg: &[u8]) -> &[u8] { + arg +} + +// one with a function, argument elided +static STATIC_SIMPLE_FN: &fn(&[u8]) -> &[u8] = &(id_u8_slice as fn(&[u8]) -> &[u8]); +const CONST_SIMPLE_FN: &fn(&[u8]) -> &[u8] = &(id_u8_slice as fn(&[u8]) -> &[u8]); + +// this should be the same as without elision +static STATIC_NON_ELIDED_fN: &for<'a> fn(&'a [u8]) -> &'a [u8] = + &(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]); +const CONST_NON_ELIDED_fN: &for<'a> fn(&'a [u8]) -> &'a [u8] = + &(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]); + +// another function that elides, each to a different unbound lifetime +fn multi_args(a: &u8, b: &u8, c: &u8) {} + +static STATIC_MULTI_FN: &fn(&u8, &u8, &u8) = &(multi_args as fn(&u8, &u8, &u8)); +const CONST_MULTI_FN: &fn(&u8, &u8, &u8) = &(multi_args as fn(&u8, &u8, &u8)); + +struct Foo<'a> { + bools: &'a [bool], +} + +static STATIC_FOO: Foo = Foo { bools: &[true, false] }; +const CONST_FOO: Foo = Foo { bools: &[true, false] }; + +type Bar<'a> = Foo<'a>; + +static STATIC_BAR: Bar = Bar { bools: &[true, false] }; +const CONST_BAR: Bar = Bar { bools: &[true, false] }; + +type Baz<'a> = fn(&'a [u8]) -> Option; + +fn baz(e: &[u8]) -> Option { + e.first().map(|x| *x) +} + +static STATIC_BAZ: &Baz = &(baz as Baz); +const CONST_BAZ: &Baz = &(baz as Baz); + +static BYTES: &[u8] = &[1, 2, 3]; + +fn main() { + // make sure that the lifetime is actually elided (and not defaulted) + let x = &[1u8, 2, 3]; + STATIC_SIMPLE_FN(x); + CONST_SIMPLE_FN(x); + + STATIC_BAZ(BYTES); // neees static lifetime + CONST_BAZ(BYTES); + + // make sure this works with different lifetimes + let a = &1; + { + let b = &2; + let c = &3; + CONST_MULTI_FN(a, b, c); + } +} diff --git a/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs b/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs new file mode 100644 index 00000000000..7438ba21bfc --- /dev/null +++ b/src/test/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs @@ -0,0 +1,15 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +#![crate_type = "staticlib"] + +#[no_mangle] +pub extern "C" fn foo(x:i32) -> i32 { x } diff --git a/src/test/run-pass/rfcs/rfc1717/library-override.rs b/src/test/run-pass/rfcs/rfc1717/library-override.rs new file mode 100644 index 00000000000..6e0ff447081 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc1717/library-override.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with +// compile-flags: -lstatic=wronglibrary:rust_test_helpers + +#[link(name = "wronglibrary", kind = "dylib")] +extern "C" { + pub fn rust_dbg_extern_identity_u32(x: u32) -> u32; +} + +fn main() { + unsafe { + rust_dbg_extern_identity_u32(42); + } +} diff --git a/src/test/run-pass/rfcs/rfc1857-drop-order.rs b/src/test/run-pass/rfcs/rfc1857-drop-order.rs new file mode 100644 index 00000000000..66edfd06730 --- /dev/null +++ b/src/test/run-pass/rfcs/rfc1857-drop-order.rs @@ -0,0 +1,234 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare compiled with panic=abort by default + +#![allow(dead_code, unreachable_code)] + +use std::cell::RefCell; +use std::rc::Rc; +use std::panic::{self, AssertUnwindSafe, UnwindSafe}; + +// This struct is used to record the order in which elements are dropped +struct PushOnDrop { + vec: Rc>>, + val: u32 +} + +impl PushOnDrop { + fn new(val: u32, vec: Rc>>) -> PushOnDrop { + PushOnDrop { vec, val } + } +} + +impl Drop for PushOnDrop { + fn drop(&mut self) { + self.vec.borrow_mut().push(self.val) + } +} + +impl UnwindSafe for PushOnDrop { } + +// Structs +struct TestStruct { + x: PushOnDrop, + y: PushOnDrop, + z: PushOnDrop +} + +// Tuple structs +struct TestTupleStruct(PushOnDrop, PushOnDrop, PushOnDrop); + +// Enum variants +enum TestEnum { + Tuple(PushOnDrop, PushOnDrop, PushOnDrop), + Struct { x: PushOnDrop, y: PushOnDrop, z: PushOnDrop } +} + +fn test_drop_tuple() { + // Tuple fields are dropped in the same order they are declared + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let test_tuple = (PushOnDrop::new(1, dropped_fields.clone()), + PushOnDrop::new(2, dropped_fields.clone())); + drop(test_tuple); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); + + // Panic during construction means that fields are treated as local variables + // Therefore they are dropped in reverse order of initialization + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + (PushOnDrop::new(2, cloned.clone()), + PushOnDrop::new(1, cloned.clone()), + panic!("this panic is caught :D")); + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); +} + +fn test_drop_struct() { + // Struct fields are dropped in the same order they are declared + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let test_struct = TestStruct { + x: PushOnDrop::new(1, dropped_fields.clone()), + y: PushOnDrop::new(2, dropped_fields.clone()), + z: PushOnDrop::new(3, dropped_fields.clone()), + }; + drop(test_struct); + assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); + + // The same holds for tuple structs + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let test_tuple_struct = TestTupleStruct(PushOnDrop::new(1, dropped_fields.clone()), + PushOnDrop::new(2, dropped_fields.clone()), + PushOnDrop::new(3, dropped_fields.clone())); + drop(test_tuple_struct); + assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); + + // Panic during struct construction means that fields are treated as local variables + // Therefore they are dropped in reverse order of initialization + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + TestStruct { + x: PushOnDrop::new(2, cloned.clone()), + y: PushOnDrop::new(1, cloned.clone()), + z: panic!("this panic is caught :D") + }; + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); + + // Test with different initialization order + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + TestStruct { + y: PushOnDrop::new(2, cloned.clone()), + x: PushOnDrop::new(1, cloned.clone()), + z: panic!("this panic is caught :D") + }; + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); + + // The same holds for tuple structs + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + TestTupleStruct(PushOnDrop::new(2, cloned.clone()), + PushOnDrop::new(1, cloned.clone()), + panic!("this panic is caught :D")); + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); +} + +fn test_drop_enum() { + // Enum variants are dropped in the same order they are declared + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let test_struct_enum = TestEnum::Struct { + x: PushOnDrop::new(1, dropped_fields.clone()), + y: PushOnDrop::new(2, dropped_fields.clone()), + z: PushOnDrop::new(3, dropped_fields.clone()) + }; + drop(test_struct_enum); + assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); + + // The same holds for tuple enum variants + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let test_tuple_enum = TestEnum::Tuple(PushOnDrop::new(1, dropped_fields.clone()), + PushOnDrop::new(2, dropped_fields.clone()), + PushOnDrop::new(3, dropped_fields.clone())); + drop(test_tuple_enum); + assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); + + // Panic during enum construction means that fields are treated as local variables + // Therefore they are dropped in reverse order of initialization + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + TestEnum::Struct { + x: PushOnDrop::new(2, cloned.clone()), + y: PushOnDrop::new(1, cloned.clone()), + z: panic!("this panic is caught :D") + }; + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); + + // Test with different initialization order + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + TestEnum::Struct { + y: PushOnDrop::new(2, cloned.clone()), + x: PushOnDrop::new(1, cloned.clone()), + z: panic!("this panic is caught :D") + }; + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); + + // The same holds for tuple enum variants + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + TestEnum::Tuple(PushOnDrop::new(2, cloned.clone()), + PushOnDrop::new(1, cloned.clone()), + panic!("this panic is caught :D")); + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); +} + +fn test_drop_list() { + // Elements in a Vec are dropped in the same order they are pushed + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let xs = vec![PushOnDrop::new(1, dropped_fields.clone()), + PushOnDrop::new(2, dropped_fields.clone()), + PushOnDrop::new(3, dropped_fields.clone())]; + drop(xs); + assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); + + // The same holds for arrays + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let xs = [PushOnDrop::new(1, dropped_fields.clone()), + PushOnDrop::new(2, dropped_fields.clone()), + PushOnDrop::new(3, dropped_fields.clone())]; + drop(xs); + assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); + + // Panic during vec construction means that fields are treated as local variables + // Therefore they are dropped in reverse order of initialization + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + vec![ + PushOnDrop::new(2, cloned.clone()), + PushOnDrop::new(1, cloned.clone()), + panic!("this panic is caught :D") + ]; + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); + + // The same holds for arrays + let dropped_fields = Rc::new(RefCell::new(Vec::new())); + let cloned = AssertUnwindSafe(dropped_fields.clone()); + panic::catch_unwind(|| { + [ + PushOnDrop::new(2, cloned.clone()), + PushOnDrop::new(1, cloned.clone()), + panic!("this panic is caught :D") + ]; + }).err().unwrap(); + assert_eq!(*dropped_fields.borrow(), &[1, 2]); +} + +fn main() { + test_drop_tuple(); + test_drop_struct(); + test_drop_enum(); + test_drop_list(); +} diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs new file mode 100644 index 00000000000..c609f0dd83e --- /dev/null +++ b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs @@ -0,0 +1,38 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(arbitrary_self_types)] + +use std::rc::Rc; + +struct Foo(String); + +impl Foo { + unsafe fn foo(self: *const Self) -> *const str { + (*self).0.as_ref() + } + + fn complicated_1(self: *const Rc) -> &'static str { + "Foo::complicated_1" + } + + unsafe fn complicated_2(self: Rc<*const Self>) -> *const str { + (**self).0.as_ref() + } +} + +fn main() { + let foo = Foo("abc123".into()); + assert_eq!("abc123", unsafe { &*(&foo as *const Foo).foo() }); + assert_eq!("Foo::complicated_1", std::ptr::null::>().complicated_1()); + let rc = Rc::new(&foo as *const Foo); + assert_eq!("abc123", unsafe { &*rc.complicated_2()}); +} diff --git a/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs new file mode 100644 index 00000000000..86b3c86564b --- /dev/null +++ b/src/test/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs @@ -0,0 +1,71 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(arbitrary_self_types)] + +use std::ptr; + +trait Foo { + fn foo(self: *const Self) -> &'static str; + + unsafe fn bar(self: *const Self) -> i64; + + unsafe fn complicated(self: *const *const Self) -> i64 where Self: Sized { + (*self).bar() + } +} + +impl Foo for i32 { + fn foo(self: *const Self) -> &'static str { + "I'm an i32!" + } + + unsafe fn bar(self: *const Self) -> i64 { + *self as i64 + } +} + +impl Foo for u32 { + fn foo(self: *const Self) -> &'static str { + "I'm a u32!" + } + + unsafe fn bar(self: *const Self) -> i64 { + *self as i64 + } +} + +fn main() { + let null_i32 = ptr::null::() as *const Foo; + let null_u32 = ptr::null::() as *const Foo; + + assert_eq!("I'm an i32!", null_i32.foo()); + assert_eq!("I'm a u32!", null_u32.foo()); + + let valid_i32 = 5i32; + let valid_i32_thin = &valid_i32 as *const i32; + assert_eq!("I'm an i32!", valid_i32_thin.foo()); + assert_eq!(5, unsafe { valid_i32_thin.bar() }); + assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() }); + let valid_i32_fat = valid_i32_thin as *const Foo; + assert_eq!("I'm an i32!", valid_i32_fat.foo()); + assert_eq!(5, unsafe { valid_i32_fat.bar() }); + + let valid_u32 = 18u32; + let valid_u32_thin = &valid_u32 as *const u32; + assert_eq!("I'm a u32!", valid_u32_thin.foo()); + assert_eq!(18, unsafe { valid_u32_thin.bar() }); + assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() }); + let valid_u32_fat = valid_u32_thin as *const Foo; + assert_eq!("I'm a u32!", valid_u32_fat.foo()); + assert_eq!(18, unsafe { valid_u32_fat.bar() }); + +} diff --git a/src/test/run-pass/self/arbitrary_self_types_silly.rs b/src/test/run-pass/self/arbitrary_self_types_silly.rs new file mode 100644 index 00000000000..9fb023403ec --- /dev/null +++ b/src/test/run-pass/self/arbitrary_self_types_silly.rs @@ -0,0 +1,31 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(arbitrary_self_types)] + +struct Foo; +struct Bar; + +impl std::ops::Deref for Bar { + type Target = Foo; + + fn deref(&self) -> &Foo { + &Foo + } +} + +impl Foo { + fn bar(self: Bar) -> i32 { 3 } +} + +fn main() { + assert_eq!(3, Bar.bar()); +} diff --git a/src/test/run-pass/self/arbitrary_self_types_struct.rs b/src/test/run-pass/self/arbitrary_self_types_struct.rs new file mode 100644 index 00000000000..bc526701b6c --- /dev/null +++ b/src/test/run-pass/self/arbitrary_self_types_struct.rs @@ -0,0 +1,35 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(arbitrary_self_types)] + +use std::rc::Rc; + +struct Foo { + x: i32, + y: i32, +} + +impl Foo { + fn x(self: &Rc) -> i32 { + self.x + } + + fn y(self: Rc) -> i32 { + self.y + } +} + +fn main() { + let foo = Rc::new(Foo {x: 3, y: 4}); + assert_eq!(3, foo.x()); + assert_eq!(4, foo.y()); +} diff --git a/src/test/run-pass/self/arbitrary_self_types_trait.rs b/src/test/run-pass/self/arbitrary_self_types_trait.rs new file mode 100644 index 00000000000..bd06573c99b --- /dev/null +++ b/src/test/run-pass/self/arbitrary_self_types_trait.rs @@ -0,0 +1,30 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(arbitrary_self_types)] + +use std::rc::Rc; + +trait Trait { + fn trait_method<'a>(self: &'a Box>) -> &'a [i32]; +} + +impl Trait for Vec { + fn trait_method<'a>(self: &'a Box>) -> &'a [i32] { + &***self + } +} + +fn main() { + let v = vec![1,2,3]; + + assert_eq!(&[1,2,3], Box::new(Rc::new(v)).trait_method()); +} diff --git a/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs b/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs new file mode 100644 index 00000000000..e75e848db24 --- /dev/null +++ b/src/test/run-pass/self/arbitrary_self_types_unsized_struct.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(arbitrary_self_types)] + +use std::rc::Rc; + +struct Foo(T); + +impl Foo<[u8]> { + fn len(self: Rc) -> usize { + self.0.len() + } +} + +fn main() { + let rc = Rc::new(Foo([1u8,2,3])) as Rc>; + assert_eq!(3, rc.len()); +} diff --git a/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs b/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs new file mode 100644 index 00000000000..dafa66d9286 --- /dev/null +++ b/src/test/run-pass/self/auxiliary/explicit_self_xcrate.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait Foo { + #[inline(always)] + fn f(&self); +} + +pub struct Bar { + pub x: String +} + +impl Foo for Bar { + #[inline(always)] + fn f(&self) { + println!("{}", (*self).x); + } +} diff --git a/src/test/run-pass/self/builtin-superkinds-self-type.rs b/src/test/run-pass/self/builtin-superkinds-self-type.rs new file mode 100644 index 00000000000..a7754e06892 --- /dev/null +++ b/src/test/run-pass/self/builtin-superkinds-self-type.rs @@ -0,0 +1,30 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests the ability for the Self type in default methods to use +// capabilities granted by builtin kinds as supertraits. + + +use std::sync::mpsc::{Sender, channel}; + +trait Foo : Send + Sized + 'static { + fn foo(self, tx: Sender) { + tx.send(self).unwrap(); + } +} + +impl Foo for T { } + +pub fn main() { + let (tx, rx) = channel(); + 1193182.foo(tx); + assert_eq!(rx.recv().unwrap(), 1193182); +} diff --git a/src/test/run-pass/self/by-value-self-in-mut-slot.rs b/src/test/run-pass/self/by-value-self-in-mut-slot.rs new file mode 100644 index 00000000000..d7f9ac6cc76 --- /dev/null +++ b/src/test/run-pass/self/by-value-self-in-mut-slot.rs @@ -0,0 +1,32 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct X { + a: isize +} + +trait Changer { + fn change(self) -> Self; +} + +impl Changer for X { + fn change(mut self) -> X { + self.a = 55; + self + } +} + +pub fn main() { + let x = X { a: 32 }; + let new_x = x.change(); + assert_eq!(new_x.a, 55); +} diff --git a/src/test/run-pass/self/explicit-self-closures.rs b/src/test/run-pass/self/explicit-self-closures.rs new file mode 100644 index 00000000000..0144433010f --- /dev/null +++ b/src/test/run-pass/self/explicit-self-closures.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test to make sure that explicit self params work inside closures + +// pretty-expanded FIXME #23616 + +struct Box { + x: usize +} + +impl Box { + pub fn set_many(&mut self, xs: &[usize]) { + for x in xs { self.x = *x; } + } +} + +pub fn main() {} diff --git a/src/test/run-pass/self/explicit-self-generic.rs b/src/test/run-pass/self/explicit-self-generic.rs new file mode 100644 index 00000000000..cf1546810a4 --- /dev/null +++ b/src/test/run-pass/self/explicit-self-generic.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +#[derive(Copy, Clone)] +struct LM { resize_at: usize, size: usize } + +enum HashMap { + HashMap_(LM, Vec<(K,V)>) +} + +fn linear_map() -> HashMap { + HashMap::HashMap_(LM{ + resize_at: 32, + size: 0}, Vec::new()) +} + +impl HashMap { + pub fn len(&mut self) -> usize { + match *self { + HashMap::HashMap_(ref l, _) => l.size + } + } +} + +pub fn main() { + let mut m: Box<_> = box linear_map::<(),()>(); + assert_eq!(m.len(), 0); +} diff --git a/src/test/run-pass/self/explicit-self-objects-uniq.rs b/src/test/run-pass/self/explicit-self-objects-uniq.rs new file mode 100644 index 00000000000..373325aca06 --- /dev/null +++ b/src/test/run-pass/self/explicit-self-objects-uniq.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +trait Foo { + fn f(self: Box); +} + +struct S { + x: isize +} + +impl Foo for S { + fn f(self: Box) { + assert_eq!(self.x, 3); + } +} + +pub fn main() { + let x = box S { x: 3 }; + let y = x as Box; + y.f(); +} diff --git a/src/test/run-pass/self/explicit-self.rs b/src/test/run-pass/self/explicit-self.rs new file mode 100644 index 00000000000..862d02bda0c --- /dev/null +++ b/src/test/run-pass/self/explicit-self.rs @@ -0,0 +1,82 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_upper_case_globals)] + +#![feature(box_syntax)] + +static tau: f64 = 2.0*3.14159265358979323; + +struct Point {x: f64, y: f64} +struct Size {w: f64, h: f64} +enum shape { + circle(Point, f64), + rectangle(Point, Size) +} + + +fn compute_area(shape: &shape) -> f64 { + match *shape { + shape::circle(_, radius) => 0.5 * tau * radius * radius, + shape::rectangle(_, ref size) => size.w * size.h + } +} + +impl shape { + // self is in the implicit self region + pub fn select<'r, T>(&self, threshold: f64, a: &'r T, b: &'r T) + -> &'r T { + if compute_area(self) > threshold {a} else {b} + } +} + +fn select_based_on_unit_circle<'r, T>( + threshold: f64, a: &'r T, b: &'r T) -> &'r T { + + let shape = &shape::circle(Point{x: 0.0, y: 0.0}, 1.0); + shape.select(threshold, a, b) +} + +#[derive(Clone)] +struct thing { + x: A +} + +#[derive(Clone)] +struct A { + a: isize +} + +fn thing(x: A) -> thing { + thing { + x: x + } +} + +impl thing { + pub fn bar(self: Box) -> isize { self.x.a } + pub fn quux(&self) -> isize { self.x.a } + pub fn baz<'a>(&'a self) -> &'a A { &self.x } + pub fn spam(self) -> isize { self.x.a } +} + +trait Nus { fn f(&self); } +impl Nus for thing { fn f(&self) {} } + +pub fn main() { + let y: Box<_> = box thing(A {a: 10}); + assert_eq!(y.clone().bar(), 10); + assert_eq!(y.quux(), 10); + + let z = thing(A {a: 11}); + assert_eq!(z.spam(), 11); +} diff --git a/src/test/run-pass/self/explicit_self_xcrate_exe.rs b/src/test/run-pass/self/explicit_self_xcrate_exe.rs new file mode 100644 index 00000000000..3847bb4c661 --- /dev/null +++ b/src/test/run-pass/self/explicit_self_xcrate_exe.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:explicit_self_xcrate.rs + +// pretty-expanded FIXME #23616 + +extern crate explicit_self_xcrate; +use explicit_self_xcrate::{Foo, Bar}; + +pub fn main() { + let x = Bar { x: "hello".to_string() }; + x.f(); +} diff --git a/src/test/run-pass/self/move-self.rs b/src/test/run-pass/self/move-self.rs new file mode 100644 index 00000000000..d414a11edf4 --- /dev/null +++ b/src/test/run-pass/self/move-self.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S { + x: String +} + +impl S { + pub fn foo(self) { + self.bar(); + } + + pub fn bar(self) { + println!("{}", self.x); + } +} + +pub fn main() { + let x = S { x: "Hello!".to_string() }; + x.foo(); +} diff --git a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs new file mode 100644 index 00000000000..2ea1dcb221e --- /dev/null +++ b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that a trait is still object-safe (and usable) if it has +// methods with by-value self so long as they require `Self : Sized`. + + +trait Counter { + fn tick(&mut self) -> u32; + fn get(self) -> u32 where Self : Sized; +} + +struct CCounter { + c: u32 +} + +impl Counter for CCounter { + fn tick(&mut self) -> u32 { self.c += 1; self.c } + fn get(self) -> u32 where Self : Sized { self.c } +} + +fn tick1(mut c: C) -> u32 { + tick2(&mut c); + c.get() +} + +fn tick2(c: &mut Counter) { + tick3(c); +} + +fn tick3(c: &mut C) { + c.tick(); + c.tick(); +} + +fn main() { + let mut c = CCounter { c: 0 }; + let value = tick1(c); + assert_eq!(value, 2); +} diff --git a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs new file mode 100644 index 00000000000..5f8ae3ce495 --- /dev/null +++ b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that a trait is still object-safe (and usable) if it has +// generic methods so long as they require `Self : Sized`. + + +trait Counter { + fn tick(&mut self) -> u32; + fn with(&self, f: F) where Self : Sized; +} + +struct CCounter { + c: u32 +} + +impl Counter for CCounter { + fn tick(&mut self) -> u32 { self.c += 1; self.c } + fn with(&self, f: F) { f(self.c); } +} + +fn tick1(c: &mut C) { + tick2(c); + c.with(|i| ()); +} + +fn tick2(c: &mut Counter) { + tick3(c); +} + +fn tick3(c: &mut C) { + c.tick(); + c.tick(); +} + +fn main() { + let mut c = CCounter { c: 0 }; + tick1(&mut c); + assert_eq!(c.tick(), 3); +} diff --git a/src/test/run-pass/self/object-safety-sized-self-return-Self.rs b/src/test/run-pass/self/object-safety-sized-self-return-Self.rs new file mode 100644 index 00000000000..09e28473fa7 --- /dev/null +++ b/src/test/run-pass/self/object-safety-sized-self-return-Self.rs @@ -0,0 +1,49 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that a trait is still object-safe (and usable) if it has +// methods that return `Self` so long as they require `Self : Sized`. + + +trait Counter { + fn new() -> Self where Self : Sized; + fn tick(&mut self) -> u32; +} + +struct CCounter { + c: u32 +} + +impl Counter for CCounter { + fn new() -> CCounter { CCounter { c: 0 } } + fn tick(&mut self) -> u32 { self.c += 1; self.c } +} + +fn preticked() -> C { + let mut c: C = Counter::new(); + tick(&mut c); + c +} + +fn tick(c: &mut Counter) { + tick_generic(c); +} + +fn tick_generic(c: &mut C) { + c.tick(); + c.tick(); +} + +fn main() { + let mut c = preticked::(); + tick(&mut c); + assert_eq!(c.tick(), 5); +} diff --git a/src/test/run-pass/self/self-impl.rs b/src/test/run-pass/self/self-impl.rs new file mode 100644 index 00000000000..c0a7eee437c --- /dev/null +++ b/src/test/run-pass/self/self-impl.rs @@ -0,0 +1,78 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can use `Self` types in impls in the expected way. + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +struct Foo; + +// Test uses on inherent impl. +impl Foo { + fn foo(_x: Self, _y: &Self, _z: Box) -> Self { + Foo + } + + fn baz() { + // Test that Self cannot be shadowed. + type Foo = i32; + // There is no empty method on i32. + Self::empty(); + + let _: Self = Foo; + } + + fn empty() {} +} + +// Test uses when implementing a trait and with a type parameter. +pub struct Baz { + pub f: X, +} + +trait SuperBar { + type SuperQux; +} + +trait Bar: SuperBar { + type Qux; + + fn bar(x: Self, y: &Self, z: Box, _: Self::SuperQux) -> Self; + fn dummy(&self, x: X) { } +} + +impl SuperBar for Box> { + type SuperQux = bool; +} + +impl Bar for Box> { + type Qux = i32; + + fn bar(_x: Self, _y: &Self, _z: Box, _: Self::SuperQux) -> Self { + let _: Self::Qux = 42; + let _: >::Qux = 42; + + let _: Self::SuperQux = true; + let _: ::SuperQux = true; + + box Baz { f: 42 } + } +} + +fn main() { + let _: Foo = Foo::foo(Foo, &Foo, box Foo); + let _: Box> = Bar::bar(box Baz { f: 42 }, + &box Baz { f: 42 }, + box box Baz { f: 42 }, + true); +} diff --git a/src/test/run-pass/self/self-in-mut-slot-default-method.rs b/src/test/run-pass/self/self-in-mut-slot-default-method.rs new file mode 100644 index 00000000000..058ad2ef64e --- /dev/null +++ b/src/test/run-pass/self/self-in-mut-slot-default-method.rs @@ -0,0 +1,46 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct X { + a: isize +} + +trait Changer : Sized { + fn change(mut self) -> Self { + self.set_to(55); + self + } + + fn change_again(mut self: Box) -> Box { + self.set_to(45); + self + } + + fn set_to(&mut self, a: isize); +} + +impl Changer for X { + fn set_to(&mut self, a: isize) { + self.a = a; + } +} + +pub fn main() { + let x = X { a: 32 }; + let new_x = x.change(); + assert_eq!(new_x.a, 55); + + let x: Box<_> = box new_x; + let new_x = x.change_again(); + assert_eq!(new_x.a, 45); +} diff --git a/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs b/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs new file mode 100644 index 00000000000..d32f1e13804 --- /dev/null +++ b/src/test/run-pass/self/self-in-mut-slot-immediate-value.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Assert that `mut self` on an immediate value doesn't +// allow mutating the original - issue #10615. + + +#[derive(Copy, Clone)] +struct Value { + n: isize +} + +impl Value { + fn squared(mut self) -> Value { + self.n *= self.n; + self + } +} + +pub fn main() { + let x = Value { n: 3 }; + let y = x.squared(); + assert_eq!(x.n, 3); + assert_eq!(y.n, 9); +} diff --git a/src/test/run-pass/self/self-in-typedefs.rs b/src/test/run-pass/self/self-in-typedefs.rs new file mode 100644 index 00000000000..92eccb47e18 --- /dev/null +++ b/src/test/run-pass/self/self-in-typedefs.rs @@ -0,0 +1,43 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unions_with_drop_fields)] + +#![feature(self_in_typedefs)] +#![feature(untagged_unions)] + +#![allow(dead_code)] + +enum A<'a, T: 'a> +where + Self: Send, T: PartialEq +{ + Foo(&'a Self), + Bar(T), +} + +struct B<'a, T: 'a> +where + Self: Send, T: PartialEq +{ + foo: &'a Self, + bar: T, +} + +union C<'a, T: 'a> +where + Self: Send, T: PartialEq +{ + foo: &'a Self, + bar: T, +} + +fn main() {} diff --git a/src/test/run-pass/self/self-re-assign.rs b/src/test/run-pass/self/self-re-assign.rs new file mode 100644 index 00000000000..982cc6675fa --- /dev/null +++ b/src/test/run-pass/self/self-re-assign.rs @@ -0,0 +1,27 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensure assigning an owned or managed variable to itself works. In particular, +// that we do not glue_drop before we glue_take (#3290). + +#![feature(box_syntax)] + +use std::rc::Rc; + +pub fn main() { + let mut x: Box<_> = box 3; + x = x; + assert_eq!(*x, 3); + + let mut x = Rc::new(3); + x = x; + assert_eq!(*x, 3); +} diff --git a/src/test/run-pass/self/self-shadowing-import.rs b/src/test/run-pass/self/self-shadowing-import.rs new file mode 100644 index 00000000000..fbf965df06b --- /dev/null +++ b/src/test/run-pass/self/self-shadowing-import.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod a { + pub mod b { + pub mod a { + pub fn foo() -> isize { return 1; } + } + } +} + +mod c { + use a::b::a; + pub fn bar() { assert_eq!(a::foo(), 1); } +} + +pub fn main() { c::bar(); } diff --git a/src/test/run-pass/self/self-type-param.rs b/src/test/run-pass/self/self-type-param.rs new file mode 100644 index 00000000000..13e28e62e5e --- /dev/null +++ b/src/test/run-pass/self/self-type-param.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait MyTrait { + fn f(&self) -> Self; +} + +struct S { + x: isize +} + +impl MyTrait for S { + fn f(&self) -> S { + S { x: 3 } + } +} + +pub fn main() {} diff --git a/src/test/run-pass/self/string-self-append.rs b/src/test/run-pass/self/string-self-append.rs new file mode 100644 index 00000000000..54729856a6a --- /dev/null +++ b/src/test/run-pass/self/string-self-append.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub fn main() { + // Make sure we properly handle repeated self-appends. + let mut a: String = "A".to_string(); + let mut i = 20; + let mut expected_len = 1; + while i > 0 { + println!("{}", a.len()); + assert_eq!(a.len(), expected_len); + a = format!("{}{}", a, a); + i -= 1; + expected_len *= 2; + } +} diff --git a/src/test/run-pass/self/ufcs-explicit-self.rs b/src/test/run-pass/self/ufcs-explicit-self.rs new file mode 100644 index 00000000000..df86065904d --- /dev/null +++ b/src/test/run-pass/self/ufcs-explicit-self.rs @@ -0,0 +1,59 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +#[derive(Copy, Clone)] +struct Foo { + f: isize, +} + +impl Foo { + fn foo(self: Foo, x: isize) -> isize { + self.f + x + } + fn bar(self: &Foo, x: isize) -> isize { + self.f + x + } + fn baz(self: Box, x: isize) -> isize { + self.f + x + } +} + +#[derive(Copy, Clone)] +struct Bar { + f: T, +} + +impl Bar { + fn foo(self: Bar, x: isize) -> isize { + x + } + fn bar<'a>(self: &'a Bar, x: isize) -> isize { + x + } + fn baz(self: Bar, x: isize) -> isize { + x + } +} + +fn main() { + let foo: Box<_> = box Foo { + f: 1, + }; + println!("{} {} {}", foo.foo(2), foo.bar(2), foo.baz(2)); + let bar: Box<_> = box Bar { + f: 1, + }; + println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2)); + let bar: Box> = bar; + println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2)); +} diff --git a/src/test/run-pass/self/uniq-self-in-mut-slot.rs b/src/test/run-pass/self/uniq-self-in-mut-slot.rs new file mode 100644 index 00000000000..46d51d48547 --- /dev/null +++ b/src/test/run-pass/self/uniq-self-in-mut-slot.rs @@ -0,0 +1,33 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct X { + a: isize +} + +trait Changer { + fn change(self: Box) -> Box; +} + +impl Changer for X { + fn change(mut self: Box) -> Box { + self.a = 55; + self + } +} + +pub fn main() { + let x: Box<_> = box X { a: 32 }; + let new_x = x.change(); + assert_eq!(new_x.a, 55); +} diff --git a/src/test/run-pass/self/where-for-self.rs b/src/test/run-pass/self/where-for-self.rs new file mode 100644 index 00000000000..147ab0be74a --- /dev/null +++ b/src/test/run-pass/self/where-for-self.rs @@ -0,0 +1,61 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can quantify lifetimes outside a constraint (i.e., including +// the self type) in a where clause. + + +static mut COUNT: u32 = 1; + +trait Bar<'a> { + fn bar(&self); +} + +trait Baz<'a> +{ + fn baz(&self); +} + +impl<'a, 'b> Bar<'b> for &'a u32 { + fn bar(&self) { + unsafe { COUNT *= 2; } + } +} + +impl<'a, 'b> Baz<'b> for &'a u32 { + fn baz(&self) { + unsafe { COUNT *= 3; } + } +} + +// Test we can use the syntax for HRL including the self type. +fn foo1(x: &T) + where for<'a, 'b> &'a T: Bar<'b> +{ + x.bar() +} + +// Test we can quantify multiple bounds (i.e., the precedence is sensible). +fn foo2(x: &T) + where for<'a, 'b> &'a T: Bar<'b> + Baz<'b> +{ + x.baz(); + x.bar() +} + +fn main() { + let x = 42; + foo1(&x); + foo2(&x); + unsafe { + assert_eq!(COUNT, 12); + } +} diff --git a/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs b/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs new file mode 100644 index 00000000000..72f1f73a81b --- /dev/null +++ b/src/test/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs @@ -0,0 +1,14 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[no_mangle] +pub extern "C" fn foo() -> usize { + 1234 +} diff --git a/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs b/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs new file mode 100644 index 00000000000..c57d161d8f5 --- /dev/null +++ b/src/test/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#[inline] +pub fn cci_fn() -> usize { + 1200 +} + +pub const CCI_CONST: usize = 34; diff --git a/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs b/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs new file mode 100644 index 00000000000..6f48978a000 --- /dev/null +++ b/src/test/run-pass/sepcomp/auxiliary/sepcomp_lib.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -C codegen-units=3 --crate-type=rlib,dylib -g + +pub mod a { + pub fn one() -> usize { + 1 + } +} + +pub mod b { + pub fn two() -> usize { + 2 + } +} + +pub mod c { + use a::one; + use b::two; + pub fn three() -> usize { + one() + two() + } +} diff --git a/src/test/run-pass/sepcomp/sepcomp-cci.rs b/src/test/run-pass/sepcomp/sepcomp-cci.rs new file mode 100644 index 00000000000..beeece32337 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-cci.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-bitrig +// compile-flags: -C codegen-units=3 +// aux-build:sepcomp_cci_lib.rs + +// Test accessing cross-crate inlined items from multiple compilation units. + + +extern crate sepcomp_cci_lib; +use sepcomp_cci_lib::{cci_fn, CCI_CONST}; + +fn call1() -> usize { + cci_fn() + CCI_CONST +} + +mod a { + use sepcomp_cci_lib::{cci_fn, CCI_CONST}; + pub fn call2() -> usize { + cci_fn() + CCI_CONST + } +} + +mod b { + use sepcomp_cci_lib::{cci_fn, CCI_CONST}; + pub fn call3() -> usize { + cci_fn() + CCI_CONST + } +} + +fn main() { + assert_eq!(call1(), 1234); + assert_eq!(a::call2(), 1234); + assert_eq!(b::call3(), 1234); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-extern.rs b/src/test/run-pass/sepcomp/sepcomp-extern.rs new file mode 100644 index 00000000000..ae392febc27 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-extern.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-bitrig +// compile-flags: -C codegen-units=3 +// aux-build:sepcomp-extern-lib.rs + +// Test accessing external items from multiple compilation units. + +extern crate sepcomp_extern_lib; + +extern { + fn foo() -> usize; +} + +fn call1() -> usize { + unsafe { foo() } +} + +mod a { + pub fn call2() -> usize { + unsafe { ::foo() } + } +} + +mod b { + pub fn call3() -> usize { + unsafe { ::foo() } + } +} + +fn main() { + assert_eq!(call1(), 1234); + assert_eq!(a::call2(), 1234); + assert_eq!(b::call3(), 1234); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs new file mode 100644 index 00000000000..96993d3a7be --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-bitrig +// compile-flags: -C codegen-units=3 + +// Test references to items that haven't been codegened yet. + +// Generate some code in the first compilation unit before declaring any +// modules. This ensures that the first module doesn't go into the same +// compilation unit as the top-level module. + +fn pad() -> usize { 0 } + +mod b { + pub fn three() -> usize { + ::one() + ::a::two() + } +} + +mod a { + pub fn two() -> usize { + ::one() + ::one() + } +} + +fn one() -> usize { + 1 +} + +fn main() { + assert_eq!(one(), 1); + assert_eq!(a::two(), 2); + assert_eq!(b::three(), 3); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-fns.rs b/src/test/run-pass/sepcomp/sepcomp-fns.rs new file mode 100644 index 00000000000..3d917cb70e3 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-fns.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-bitrig +// compile-flags: -C codegen-units=3 + +// Test basic separate compilation functionality. The functions should be able +// to call each other even though they will be placed in different compilation +// units. + +// Generate some code in the first compilation unit before declaring any +// modules. This ensures that the first module doesn't go into the same +// compilation unit as the top-level module. + +fn one() -> usize { 1 } + +mod a { + pub fn two() -> usize { + ::one() + ::one() + } +} + +mod b { + pub fn three() -> usize { + ::one() + ::a::two() + } +} + +fn main() { + assert_eq!(one(), 1); + assert_eq!(a::two(), 2); + assert_eq!(b::three(), 3); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs b/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs new file mode 100644 index 00000000000..03b837cdcf4 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-lib-lto.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Check that we can use `-C lto` when linking against libraries that were +// separately compiled. + +// aux-build:sepcomp_lib.rs +// compile-flags: -C lto -g +// no-prefer-dynamic + +extern crate sepcomp_lib; +use sepcomp_lib::a::one; +use sepcomp_lib::b::two; +use sepcomp_lib::c::three; + +fn main() { + assert_eq!(one(), 1); + assert_eq!(two(), 2); + assert_eq!(three(), 3); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-lib.rs b/src/test/run-pass/sepcomp/sepcomp-lib.rs new file mode 100644 index 00000000000..11ad12611e1 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-lib.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:sepcomp_lib.rs + +// Test linking against a library built with -C codegen-units > 1 + + +extern crate sepcomp_lib; +use sepcomp_lib::a::one; +use sepcomp_lib::b::two; +use sepcomp_lib::c::three; + +fn main() { + assert_eq!(one(), 1); + assert_eq!(two(), 2); + assert_eq!(three(), 3); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-statics.rs b/src/test/run-pass/sepcomp/sepcomp-statics.rs new file mode 100644 index 00000000000..7022a5eee71 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-statics.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-bitrig +// compile-flags: -C codegen-units=3 + +// Test references to static items across compilation units. + + +fn pad() -> usize { 0 } + +const ONE: usize = 1; + +mod b { + // Separate compilation always switches to the LLVM module with the fewest + // instructions. Make sure we have some instructions in this module so + // that `a` and `b` don't go into the same compilation unit. + fn pad() -> usize { 0 } + + pub static THREE: usize = ::ONE + ::a::TWO; +} + +mod a { + fn pad() -> usize { 0 } + + pub const TWO: usize = ::ONE + ::ONE; +} + +fn main() { + assert_eq!(ONE, 1); + assert_eq!(a::TWO, 2); + assert_eq!(b::THREE, 3); +} diff --git a/src/test/run-pass/sepcomp/sepcomp-unwind.rs b/src/test/run-pass/sepcomp/sepcomp-unwind.rs new file mode 100644 index 00000000000..15b07653224 --- /dev/null +++ b/src/test/run-pass/sepcomp/sepcomp-unwind.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-bitrig +// compile-flags: -C codegen-units=3 +// ignore-emscripten no threads support + +// Test unwinding through multiple compilation units. + +// According to acrichto, in the distant past `ld -r` (which is used during +// linking when codegen-units > 1) was known to produce object files with +// damaged unwinding tables. This may be related to GNU binutils bug #6893 +// ("Partial linking results in corrupt .eh_frame_hdr"), but I'm not certain. +// In any case, this test should let us know if enabling parallel codegen ever +// breaks unwinding. + + +use std::thread; + +fn pad() -> usize { 0 } + +mod a { + pub fn f() { + panic!(); + } +} + +mod b { + pub fn g() { + ::a::f(); + } +} + +fn main() { + thread::spawn(move|| { ::b::g() }).join().unwrap_err(); +} diff --git a/src/test/run-pass/simd/simd-generics.rs b/src/test/run-pass/simd/simd-generics.rs new file mode 100644 index 00000000000..b69b6f0a4cd --- /dev/null +++ b/src/test/run-pass/simd/simd-generics.rs @@ -0,0 +1,49 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + +#![feature(repr_simd, platform_intrinsics)] + +use std::ops; + +#[repr(simd)] +#[derive(Copy, Clone)] +struct f32x4(f32, f32, f32, f32); + +extern "platform-intrinsic" { + fn simd_add(x: T, y: T) -> T; +} + +fn add>(lhs: T, rhs: T) -> T { + lhs + rhs +} + +impl ops::Add for f32x4 { + type Output = f32x4; + + fn add(self, rhs: f32x4) -> f32x4 { + unsafe {simd_add(self, rhs)} + } +} + +pub fn main() { + let lr = f32x4(1.0f32, 2.0f32, 3.0f32, 4.0f32); + + // lame-o + let f32x4(x, y, z, w) = add(lr, lr); + assert_eq!(x, 2.0f32); + assert_eq!(y, 4.0f32); + assert_eq!(z, 6.0f32); + assert_eq!(w, 8.0f32); +} diff --git a/src/test/run-pass/simd/simd-intrinsic-float-math.rs b/src/test/run-pass/simd/simd-intrinsic-float-math.rs new file mode 100644 index 00000000000..216855db747 --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-float-math.rs @@ -0,0 +1,113 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten +// ignore-android + +// FIXME: this test fails on arm-android because the NDK version 14 is too old. +// It needs at least version 18. We disable it on all android build bots because +// there is no way in compile-test to disable it for an (arch,os) pair. + +// Test that the simd floating-point math intrinsics produce correct results. + +#![feature(repr_simd, platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct f32x4(pub f32, pub f32, pub f32, pub f32); + +extern "platform-intrinsic" { + fn simd_fsqrt(x: T) -> T; + fn simd_fabs(x: T) -> T; + fn simd_fsin(x: T) -> T; + fn simd_fcos(x: T) -> T; + fn simd_ceil(x: T) -> T; + fn simd_fexp(x: T) -> T; + fn simd_fexp2(x: T) -> T; + fn simd_floor(x: T) -> T; + fn simd_fma(x: T, y: T, z: T) -> T; + fn simd_flog(x: T) -> T; + fn simd_flog10(x: T) -> T; + fn simd_flog2(x: T) -> T; + fn simd_fpow(x: T, y: T) -> T; + fn simd_fpowi(x: T, y: i32) -> T; +} + +macro_rules! assert_approx_eq_f32 { + ($a:expr, $b:expr) => ({ + let (a, b) = (&$a, &$b); + assert!((*a - *b).abs() < 1.0e-6, + "{} is not approximately equal to {}", *a, *b); + }) +} +macro_rules! assert_approx_eq { + ($a:expr, $b:expr) => ({ + let a = $a; + let b = $b; + assert_approx_eq_f32!(a.0, b.0); + assert_approx_eq_f32!(a.1, b.1); + assert_approx_eq_f32!(a.2, b.2); + assert_approx_eq_f32!(a.3, b.3); + }) +} + +fn main() { + let x = f32x4(1.0, 1.0, 1.0, 1.0); + let y = f32x4(-1.0, -1.0, -1.0, -1.0); + let z = f32x4(0.0, 0.0, 0.0, 0.0); + + let h = f32x4(0.5, 0.5, 0.5, 0.5); + + unsafe { + let r = simd_fabs(y); + assert_approx_eq!(x, r); + + let r = simd_fcos(z); + assert_approx_eq!(x, r); + + let r = simd_ceil(h); + assert_approx_eq!(x, r); + + let r = simd_fexp(z); + assert_approx_eq!(x, r); + + let r = simd_fexp2(z); + assert_approx_eq!(x, r); + + let r = simd_floor(h); + assert_approx_eq!(z, r); + + let r = simd_fma(x, h, h); + assert_approx_eq!(x, r); + + let r = simd_fsqrt(x); + assert_approx_eq!(x, r); + + let r = simd_flog(x); + assert_approx_eq!(z, r); + + let r = simd_flog2(x); + assert_approx_eq!(z, r); + + let r = simd_flog10(x); + assert_approx_eq!(z, r); + + let r = simd_fpow(h, x); + assert_approx_eq!(h, r); + + let r = simd_fpowi(h, 1); + assert_approx_eq!(h, r); + + let r = simd_fsin(z); + assert_approx_eq!(z, r); + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs b/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs new file mode 100644 index 00000000000..a146b4b2f70 --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-float-minmax.rs @@ -0,0 +1,64 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten +// min-llvm-version 7.0 +// error-pattern: panicked + +// Test that the simd_f{min,max} intrinsics produce the correct results. + +#![feature(repr_simd, platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct f32x4(pub f32, pub f32, pub f32, pub f32); + +extern "platform-intrinsic" { + fn simd_fmin(x: T, y: T) -> T; + fn simd_fmax(x: T, y: T) -> T; +} + +fn main() { + let x = f32x4(1.0, 2.0, 3.0, 4.0); + let y = f32x4(2.0, 1.0, 4.0, 3.0); + + #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] + let nan = ::std::f32::NAN; + // MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit. + // See https://github.com/rust-lang/rust/issues/52746. + #[cfg(any(target_arch = "mips", target_arch = "mips64"))] + let nan = f32::from_bits(::std::f32::NAN.to_bits() - 1); + + let n = f32x4(nan, nan, nan, nan); + + unsafe { + let min0 = simd_fmin(x, y); + let min1 = simd_fmin(y, x); + assert_eq!(min0, min1); + let e = f32x4(1.0, 1.0, 3.0, 3.0); + assert_eq!(min0, e); + let minn = simd_fmin(x, n); + assert_eq!(minn, x); + let minn = simd_fmin(y, n); + assert_eq!(minn, y); + + let max0 = simd_fmax(x, y); + let max1 = simd_fmax(y, x); + assert_eq!(max0, max1); + let e = f32x4(2.0, 2.0, 4.0, 4.0); + assert_eq!(max0, e); + let maxn = simd_fmax(x, n); + assert_eq!(maxn, x); + let maxn = simd_fmax(y, n); + assert_eq!(maxn, y); + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs b/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs new file mode 100644 index 00000000000..c1094336c29 --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-arithmetic.rs @@ -0,0 +1,130 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// ignore-emscripten FIXME(#45351) hits an LLVM assert + +#![feature(repr_simd, platform_intrinsics)] + +#[repr(simd)] +#[derive(Copy, Clone)] +struct i32x4(pub i32, pub i32, pub i32, pub i32); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct u32x4(pub u32, pub u32, pub u32, pub u32); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct f32x4(pub f32, pub f32, pub f32, pub f32); + +macro_rules! all_eq { + ($a: expr, $b: expr) => {{ + let a = $a; + let b = $b; + assert!(a.0 == b.0 && a.1 == b.1 && a.2 == b.2 && a.3 == b.3); + }} +} + +extern "platform-intrinsic" { + fn simd_add(x: T, y: T) -> T; + fn simd_sub(x: T, y: T) -> T; + fn simd_mul(x: T, y: T) -> T; + fn simd_div(x: T, y: T) -> T; + fn simd_rem(x: T, y: T) -> T; + fn simd_shl(x: T, y: T) -> T; + fn simd_shr(x: T, y: T) -> T; + fn simd_and(x: T, y: T) -> T; + fn simd_or(x: T, y: T) -> T; + fn simd_xor(x: T, y: T) -> T; +} + +fn main() { + let x1 = i32x4(1, 2, 3, 4); + let y1 = u32x4(1, 2, 3, 4); + let z1 = f32x4(1.0, 2.0, 3.0, 4.0); + let x2 = i32x4(2, 3, 4, 5); + let y2 = u32x4(2, 3, 4, 5); + let z2 = f32x4(2.0, 3.0, 4.0, 5.0); + + unsafe { + all_eq!(simd_add(x1, x2), i32x4(3, 5, 7, 9)); + all_eq!(simd_add(x2, x1), i32x4(3, 5, 7, 9)); + all_eq!(simd_add(y1, y2), u32x4(3, 5, 7, 9)); + all_eq!(simd_add(y2, y1), u32x4(3, 5, 7, 9)); + all_eq!(simd_add(z1, z2), f32x4(3.0, 5.0, 7.0, 9.0)); + all_eq!(simd_add(z2, z1), f32x4(3.0, 5.0, 7.0, 9.0)); + + all_eq!(simd_mul(x1, x2), i32x4(2, 6, 12, 20)); + all_eq!(simd_mul(x2, x1), i32x4(2, 6, 12, 20)); + all_eq!(simd_mul(y1, y2), u32x4(2, 6, 12, 20)); + all_eq!(simd_mul(y2, y1), u32x4(2, 6, 12, 20)); + all_eq!(simd_mul(z1, z2), f32x4(2.0, 6.0, 12.0, 20.0)); + all_eq!(simd_mul(z2, z1), f32x4(2.0, 6.0, 12.0, 20.0)); + + all_eq!(simd_sub(x2, x1), i32x4(1, 1, 1, 1)); + all_eq!(simd_sub(x1, x2), i32x4(-1, -1, -1, -1)); + all_eq!(simd_sub(y2, y1), u32x4(1, 1, 1, 1)); + all_eq!(simd_sub(y1, y2), u32x4(!0, !0, !0, !0)); + all_eq!(simd_sub(z2, z1), f32x4(1.0, 1.0, 1.0, 1.0)); + all_eq!(simd_sub(z1, z2), f32x4(-1.0, -1.0, -1.0, -1.0)); + + all_eq!(simd_div(x1, x1), i32x4(1, 1, 1, 1)); + all_eq!(simd_div(i32x4(2, 4, 6, 8), i32x4(2, 2, 2, 2)), x1); + all_eq!(simd_div(y1, y1), u32x4(1, 1, 1, 1)); + all_eq!(simd_div(u32x4(2, 4, 6, 8), u32x4(2, 2, 2, 2)), y1); + all_eq!(simd_div(z1, z1), f32x4(1.0, 1.0, 1.0, 1.0)); + all_eq!(simd_div(z1, z2), f32x4(1.0/2.0, 2.0/3.0, 3.0/4.0, 4.0/5.0)); + all_eq!(simd_div(z2, z1), f32x4(2.0/1.0, 3.0/2.0, 4.0/3.0, 5.0/4.0)); + + all_eq!(simd_rem(x1, x1), i32x4(0, 0, 0, 0)); + all_eq!(simd_rem(x2, x1), i32x4(0, 1, 1, 1)); + all_eq!(simd_rem(y1, y1), u32x4(0, 0, 0, 0)); + all_eq!(simd_rem(y2, y1), u32x4(0, 1, 1, 1)); + all_eq!(simd_rem(z1, z1), f32x4(0.0, 0.0, 0.0, 0.0)); + all_eq!(simd_rem(z1, z2), z1); + all_eq!(simd_rem(z2, z1), f32x4(0.0, 1.0, 1.0, 1.0)); + + all_eq!(simd_shl(x1, x2), i32x4(1 << 2, 2 << 3, 3 << 4, 4 << 5)); + all_eq!(simd_shl(x2, x1), i32x4(2 << 1, 3 << 2, 4 << 3, 5 << 4)); + all_eq!(simd_shl(y1, y2), u32x4(1 << 2, 2 << 3, 3 << 4, 4 << 5)); + all_eq!(simd_shl(y2, y1), u32x4(2 << 1, 3 << 2, 4 << 3, 5 << 4)); + + // test right-shift by assuming left-shift is correct + all_eq!(simd_shr(simd_shl(x1, x2), x2), x1); + all_eq!(simd_shr(simd_shl(x2, x1), x1), x2); + all_eq!(simd_shr(simd_shl(y1, y2), y2), y1); + all_eq!(simd_shr(simd_shl(y2, y1), y1), y2); + + // ensure we get logical vs. arithmetic shifts correct + let (a, b, c, d) = (-12, -123, -1234, -12345); + all_eq!(simd_shr(i32x4(a, b, c, d), x1), i32x4(a >> 1, b >> 2, c >> 3, d >> 4)); + all_eq!(simd_shr(u32x4(a as u32, b as u32, c as u32, d as u32), y1), + u32x4((a as u32) >> 1, (b as u32) >> 2, (c as u32) >> 3, (d as u32) >> 4)); + + all_eq!(simd_and(x1, x2), i32x4(0, 2, 0, 4)); + all_eq!(simd_and(x2, x1), i32x4(0, 2, 0, 4)); + all_eq!(simd_and(y1, y2), u32x4(0, 2, 0, 4)); + all_eq!(simd_and(y2, y1), u32x4(0, 2, 0, 4)); + + all_eq!(simd_or(x1, x2), i32x4(3, 3, 7, 5)); + all_eq!(simd_or(x2, x1), i32x4(3, 3, 7, 5)); + all_eq!(simd_or(y1, y2), u32x4(3, 3, 7, 5)); + all_eq!(simd_or(y2, y1), u32x4(3, 3, 7, 5)); + + all_eq!(simd_xor(x1, x2), i32x4(3, 1, 7, 1)); + all_eq!(simd_xor(x2, x1), i32x4(3, 1, 7, 1)); + all_eq!(simd_xor(y1, y2), u32x4(3, 1, 7, 1)); + all_eq!(simd_xor(y2, y1), u32x4(3, 1, 7, 1)); + + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs b/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs new file mode 100644 index 00000000000..e24a141e6e0 --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs @@ -0,0 +1,130 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten FIXME(#45351) hits an LLVM assert + +#![feature(repr_simd, platform_intrinsics, concat_idents, test)] +#![allow(non_camel_case_types)] + +extern crate test; + +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct i32x4(i32, i32, i32, i32); +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct i8x4(i8, i8, i8, i8); + +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct u32x4(u32, u32, u32, u32); +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct u8x4(u8, u8, u8, u8); + +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct f32x4(f32, f32, f32, f32); + +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct f64x4(f64, f64, f64, f64); + + +extern "platform-intrinsic" { + fn simd_cast(x: T) -> U; +} + +const A: i32 = -1234567; +const B: i32 = 12345678; +const C: i32 = -123456789; +const D: i32 = 1234567890; + +trait Foo { + fn is_float() -> bool { false } + fn in_range(x: i32) -> bool; +} +impl Foo for i32 { + fn in_range(_: i32) -> bool { true } +} +impl Foo for i8 { + fn in_range(x: i32) -> bool { -128 <= x && x < 128 } +} +impl Foo for u32 { + fn in_range(x: i32) -> bool { 0 <= x } +} +impl Foo for u8 { + fn in_range(x: i32) -> bool { 0 <= x && x < 128 } +} +impl Foo for f32 { + fn is_float() -> bool { true } + fn in_range(_: i32) -> bool { true } +} +impl Foo for f64 { + fn is_float() -> bool { true } + fn in_range(_: i32) -> bool { true } +} + +fn main() { + macro_rules! test { + ($from: ident, $to: ident) => {{ + // force the casts to actually happen, or else LLVM/rustc + // may fold them and get slightly different results. + let (a, b, c, d) = test::black_box((A as $from, B as $from, C as $from, D as $from)); + // the SIMD vectors are all FOOx4, so we can concat_idents + // so we don't have to pass in the extra args to the macro + let mut from = simd_cast(concat_idents!($from, x4)(a, b, c, d)); + let mut to = concat_idents!($to, x4)(a as $to, + b as $to, + c as $to, + d as $to); + // assist type inference, it needs to know what `from` is + // for the `if` statements. + to == from; + + // there are platform differences for some out of range + // casts, so we just normalize such things: it's OK for + // "invalid" calculations to result in nonsense answers. + // (E.g. negative float to unsigned integer goes through a + // library routine on the default i686 platforms, and the + // implementation of that routine differs on e.g. Linux + // vs. macOS, resulting in different answers.) + if $from::is_float() { + if !$to::in_range(A) { from.0 = 0 as $to; to.0 = 0 as $to; } + if !$to::in_range(B) { from.1 = 0 as $to; to.1 = 0 as $to; } + if !$to::in_range(C) { from.2 = 0 as $to; to.2 = 0 as $to; } + if !$to::in_range(D) { from.3 = 0 as $to; to.3 = 0 as $to; } + } + + assert!(to == from, + "{} -> {} ({:?} != {:?})", stringify!($from), stringify!($to), + from, to); + }} + } + macro_rules! tests { + (: $($to: ident),*) => { () }; + // repeating the list twice is easier than writing a cartesian + // product macro + ($from: ident $(, $from_: ident)*: $($to: ident),*) => { + fn $from() { unsafe { $( test!($from, $to); )* } } + tests!($($from_),*: $($to),*) + }; + ($($types: ident),*) => {{ + tests!($($types),* : $($types),*); + $($types();)* + }} + } + + // test various combinations, including truncation, + // signed/unsigned extension, and floating point casts. + tests!(i32, i8, u32, u8, f32); + tests!(i32, u32, f32, f64) +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs b/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs new file mode 100644 index 00000000000..0c36d88dafd --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-comparison.rs @@ -0,0 +1,116 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten FIXME(#45351) hits an LLVM assert + +#![feature(repr_simd, platform_intrinsics, concat_idents)] +#![allow(non_camel_case_types)] + +use std::f32::NAN; + +#[repr(simd)] +#[derive(Copy, Clone)] +struct i32x4(i32, i32, i32, i32); +#[repr(simd)] +#[derive(Copy, Clone)] +struct u32x4(pub u32, pub u32, pub u32, pub u32); +#[repr(simd)] +#[derive(Copy, Clone)] +struct f32x4(pub f32, pub f32, pub f32, pub f32); + +extern "platform-intrinsic" { + fn simd_eq(x: T, y: T) -> U; + fn simd_ne(x: T, y: T) -> U; + fn simd_lt(x: T, y: T) -> U; + fn simd_le(x: T, y: T) -> U; + fn simd_gt(x: T, y: T) -> U; + fn simd_ge(x: T, y: T) -> U; +} + +macro_rules! cmp { + ($method: ident($lhs: expr, $rhs: expr)) => {{ + let lhs = $lhs; + let rhs = $rhs; + let e: u32x4 = concat_idents!(simd_, $method)($lhs, $rhs); + // assume the scalar version is correct/the behaviour we want. + assert!((e.0 != 0) == lhs.0 .$method(&rhs.0)); + assert!((e.1 != 0) == lhs.1 .$method(&rhs.1)); + assert!((e.2 != 0) == lhs.2 .$method(&rhs.2)); + assert!((e.3 != 0) == lhs.3 .$method(&rhs.3)); + }} +} +macro_rules! tests { + ($($lhs: ident, $rhs: ident;)*) => {{ + $( + (|| { + cmp!(eq($lhs, $rhs)); + cmp!(ne($lhs, $rhs)); + + // test both directions + cmp!(lt($lhs, $rhs)); + cmp!(lt($rhs, $lhs)); + + cmp!(le($lhs, $rhs)); + cmp!(le($rhs, $lhs)); + + cmp!(gt($lhs, $rhs)); + cmp!(gt($rhs, $lhs)); + + cmp!(ge($lhs, $rhs)); + cmp!(ge($rhs, $lhs)); + })(); + )* + }} +} +fn main() { + // 13 vs. -100 tests that we get signed vs. unsigned comparisons + // correct (i32: 13 > -100, u32: 13 < -100). let i1 = i32x4(10, -11, 12, 13); + let i1 = i32x4(10, -11, 12, 13); + let i2 = i32x4(5, -5, 20, -100); + let i3 = i32x4(10, -11, 20, -100); + + let u1 = u32x4(10, !11+1, 12, 13); + let u2 = u32x4(5, !5+1, 20, !100+1); + let u3 = u32x4(10, !11+1, 20, !100+1); + + let f1 = f32x4(10.0, -11.0, 12.0, 13.0); + let f2 = f32x4(5.0, -5.0, 20.0, -100.0); + let f3 = f32x4(10.0, -11.0, 20.0, -100.0); + + unsafe { + tests! { + i1, i1; + u1, u1; + f1, f1; + + i1, i2; + u1, u2; + f1, f2; + + i1, i3; + u1, u3; + f1, f3; + } + } + + // NAN comparisons are special: + // -11 (*) 13 + // -5 -100 (*) + let f4 = f32x4(NAN, f1.1, NAN, f2.3); + + unsafe { + tests! { + f1, f4; + f2, f4; + f4, f4; + } + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs b/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs new file mode 100644 index 00000000000..0dd1cae18f1 --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-elements.rs @@ -0,0 +1,135 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten FIXME(#45351) hits an LLVM assert + +#![feature(repr_simd, platform_intrinsics)] + +#[repr(simd)] +#[derive(Copy, Clone, Debug, PartialEq)] +#[allow(non_camel_case_types)] +struct i32x2(i32, i32); +#[repr(simd)] +#[derive(Copy, Clone, Debug, PartialEq)] +#[allow(non_camel_case_types)] +struct i32x3(i32, i32, i32); +#[repr(simd)] +#[derive(Copy, Clone, Debug, PartialEq)] +#[allow(non_camel_case_types)] +struct i32x4(i32, i32, i32, i32); +#[repr(simd)] +#[derive(Copy, Clone, Debug, PartialEq)] +#[allow(non_camel_case_types)] +struct i32x8(i32, i32, i32, i32, + i32, i32, i32, i32); + +extern "platform-intrinsic" { + fn simd_insert(x: T, idx: u32, y: E) -> T; + fn simd_extract(x: T, idx: u32) -> E; + + fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; + fn simd_shuffle3(x: T, y: T, idx: [u32; 3]) -> U; + fn simd_shuffle4(x: T, y: T, idx: [u32; 4]) -> U; + fn simd_shuffle8(x: T, y: T, idx: [u32; 8]) -> U; +} + +macro_rules! all_eq { + ($a: expr, $b: expr) => {{ + let a = $a; + let b = $b; + // type inference works better with the concrete type on the + // left, but humans work better with the expected on the + // right. + assert!(b == a, + "{:?} != {:?}", a, b); + }} +} + +fn main() { + let x2 = i32x2(20, 21); + let x3 = i32x3(30, 31, 32); + let x4 = i32x4(40, 41, 42, 43); + let x8 = i32x8(80, 81, 82, 83, 84, 85, 86, 87); + unsafe { + all_eq!(simd_insert(x2, 0, 100), i32x2(100, 21)); + all_eq!(simd_insert(x2, 1, 100), i32x2(20, 100)); + + all_eq!(simd_insert(x3, 0, 100), i32x3(100, 31, 32)); + all_eq!(simd_insert(x3, 1, 100), i32x3(30, 100, 32)); + all_eq!(simd_insert(x3, 2, 100), i32x3(30, 31, 100)); + + all_eq!(simd_insert(x4, 0, 100), i32x4(100, 41, 42, 43)); + all_eq!(simd_insert(x4, 1, 100), i32x4(40, 100, 42, 43)); + all_eq!(simd_insert(x4, 2, 100), i32x4(40, 41, 100, 43)); + all_eq!(simd_insert(x4, 3, 100), i32x4(40, 41, 42, 100)); + + all_eq!(simd_insert(x8, 0, 100), i32x8(100, 81, 82, 83, 84, 85, 86, 87)); + all_eq!(simd_insert(x8, 1, 100), i32x8(80, 100, 82, 83, 84, 85, 86, 87)); + all_eq!(simd_insert(x8, 2, 100), i32x8(80, 81, 100, 83, 84, 85, 86, 87)); + all_eq!(simd_insert(x8, 3, 100), i32x8(80, 81, 82, 100, 84, 85, 86, 87)); + all_eq!(simd_insert(x8, 4, 100), i32x8(80, 81, 82, 83, 100, 85, 86, 87)); + all_eq!(simd_insert(x8, 5, 100), i32x8(80, 81, 82, 83, 84, 100, 86, 87)); + all_eq!(simd_insert(x8, 6, 100), i32x8(80, 81, 82, 83, 84, 85, 100, 87)); + all_eq!(simd_insert(x8, 7, 100), i32x8(80, 81, 82, 83, 84, 85, 86, 100)); + + all_eq!(simd_extract(x2, 0), 20); + all_eq!(simd_extract(x2, 1), 21); + + all_eq!(simd_extract(x3, 0), 30); + all_eq!(simd_extract(x3, 1), 31); + all_eq!(simd_extract(x3, 2), 32); + + all_eq!(simd_extract(x4, 0), 40); + all_eq!(simd_extract(x4, 1), 41); + all_eq!(simd_extract(x4, 2), 42); + all_eq!(simd_extract(x4, 3), 43); + + all_eq!(simd_extract(x8, 0), 80); + all_eq!(simd_extract(x8, 1), 81); + all_eq!(simd_extract(x8, 2), 82); + all_eq!(simd_extract(x8, 3), 83); + all_eq!(simd_extract(x8, 4), 84); + all_eq!(simd_extract(x8, 5), 85); + all_eq!(simd_extract(x8, 6), 86); + all_eq!(simd_extract(x8, 7), 87); + } + + let y2 = i32x2(120, 121); + let y3 = i32x3(130, 131, 132); + let y4 = i32x4(140, 141, 142, 143); + let y8 = i32x8(180, 181, 182, 183, 184, 185, 186, 187); + unsafe { + all_eq!(simd_shuffle2(x2, y2, [3, 0]), i32x2(121, 20)); + all_eq!(simd_shuffle3(x2, y2, [3, 0, 1]), i32x3(121, 20, 21)); + all_eq!(simd_shuffle4(x2, y2, [3, 0, 1, 2]), i32x4(121, 20, 21, 120)); + all_eq!(simd_shuffle8(x2, y2, [3, 0, 1, 2, 1, 2, 3, 0]), + i32x8(121, 20, 21, 120, 21, 120, 121, 20)); + + all_eq!(simd_shuffle2(x3, y3, [4, 2]), i32x2(131, 32)); + all_eq!(simd_shuffle3(x3, y3, [4, 2, 3]), i32x3(131, 32, 130)); + all_eq!(simd_shuffle4(x3, y3, [4, 2, 3, 0]), i32x4(131, 32, 130, 30)); + all_eq!(simd_shuffle8(x3, y3, [4, 2, 3, 0, 1, 5, 5, 1]), + i32x8(131, 32, 130, 30, 31, 132, 132, 31)); + + all_eq!(simd_shuffle2(x4, y4, [7, 2]), i32x2(143, 42)); + all_eq!(simd_shuffle3(x4, y4, [7, 2, 5]), i32x3(143, 42, 141)); + all_eq!(simd_shuffle4(x4, y4, [7, 2, 5, 0]), i32x4(143, 42, 141, 40)); + all_eq!(simd_shuffle8(x4, y4, [7, 2, 5, 0, 3, 6, 4, 1]), + i32x8(143, 42, 141, 40, 43, 142, 140, 41)); + + all_eq!(simd_shuffle2(x8, y8, [11, 5]), i32x2(183, 85)); + all_eq!(simd_shuffle3(x8, y8, [11, 5, 15]), i32x3(183, 85, 187)); + all_eq!(simd_shuffle4(x8, y8, [11, 5, 15, 0]), i32x4(183, 85, 187, 80)); + all_eq!(simd_shuffle8(x8, y8, [11, 5, 15, 0, 3, 8, 12, 1]), + i32x8(183, 85, 187, 80, 83, 180, 184, 81)); + } + +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs new file mode 100644 index 00000000000..5f6a72a8e1e --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-gather.rs @@ -0,0 +1,152 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten +// min-llvm-version 6.0 + +// Test that the simd_{gather,scatter} intrinsics produce the correct results. + +#![feature(repr_simd, platform_intrinsics)] +#![allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct x4(pub T, pub T, pub T, pub T); + +extern "platform-intrinsic" { + fn simd_gather(x: T, y: U, z: V) -> T; + fn simd_scatter(x: T, y: U, z: V) -> (); +} + +fn main() { + let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; + + let default = x4(-3_f32, -3., -3., -3.); + let s_strided = x4(0_f32, 2., -3., 6.); + let mask = x4(-1_i32, -1, 0, -1); + + // reading from *const + unsafe { + let pointer = &x[0] as *const f32; + let pointers = x4( + pointer.offset(0) as *const f32, + pointer.offset(2), + pointer.offset(4), + pointer.offset(6) + ); + + let r_strided = simd_gather(default, pointers, mask); + + assert_eq!(r_strided, s_strided); + } + + // reading from *mut + unsafe { + let pointer = &mut x[0] as *mut f32; + let pointers = x4( + pointer.offset(0) as *mut f32, + pointer.offset(2), + pointer.offset(4), + pointer.offset(6) + ); + + let r_strided = simd_gather(default, pointers, mask); + + assert_eq!(r_strided, s_strided); + } + + // writing to *mut + unsafe { + let pointer = &mut x[0] as *mut f32; + let pointers = x4( + pointer.offset(0) as *mut f32, + pointer.offset(2), + pointer.offset(4), + pointer.offset(6) + ); + + let values = x4(42_f32, 43_f32, 44_f32, 45_f32); + simd_scatter(values, pointers, mask); + + assert_eq!(x, [42., 1., 43., 3., 4., 5., 45., 7.]); + } + + // test modifying array of *const f32 + let mut y = [ + &x[0] as *const f32, + &x[1] as *const f32, + &x[2] as *const f32, + &x[3] as *const f32, + &x[4] as *const f32, + &x[5] as *const f32, + &x[6] as *const f32, + &x[7] as *const f32 + ]; + + let default = x4(y[0], y[0], y[0], y[0]); + let s_strided = x4(y[0], y[2], y[0], y[6]); + + // reading from *const + unsafe { + let pointer = &y[0] as *const *const f32; + let pointers = x4( + pointer.offset(0) as *const *const f32, + pointer.offset(2), + pointer.offset(4), + pointer.offset(6) + ); + + let r_strided = simd_gather(default, pointers, mask); + + assert_eq!(r_strided, s_strided); + } + + // reading from *mut + unsafe { + let pointer = &mut y[0] as *mut *const f32; + let pointers = x4( + pointer.offset(0) as *mut *const f32, + pointer.offset(2), + pointer.offset(4), + pointer.offset(6) + ); + + let r_strided = simd_gather(default, pointers, mask); + + assert_eq!(r_strided, s_strided); + } + + // writing to *mut + unsafe { + let pointer = &mut y[0] as *mut *const f32; + let pointers = x4( + pointer.offset(0) as *mut *const f32, + pointer.offset(2), + pointer.offset(4), + pointer.offset(6) + ); + + let values = x4(y[7], y[6], y[5], y[1]); + simd_scatter(values, pointers, mask); + + let s = [ + &x[7] as *const f32, + &x[1] as *const f32, + &x[6] as *const f32, + &x[3] as *const f32, + &x[4] as *const f32, + &x[5] as *const f32, + &x[1] as *const f32, + &x[7] as *const f32 + ]; + assert_eq!(y, s); + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs b/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs new file mode 100644 index 00000000000..822101558ce --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-reduction.rs @@ -0,0 +1,174 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// ignore-emscripten + +// Test that the simd_reduce_{op} intrinsics produce the correct results. + +#![feature(repr_simd, platform_intrinsics)] +#[allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone)] +struct i32x4(pub i32, pub i32, pub i32, pub i32); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct u32x4(pub u32, pub u32, pub u32, pub u32); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct f32x4(pub f32, pub f32, pub f32, pub f32); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct b8x4(pub i8, pub i8, pub i8, pub i8); + +#[repr(simd)] +#[derive(Copy, Clone)] +struct b8x16( + pub i8, pub i8, pub i8, pub i8, + pub i8, pub i8, pub i8, pub i8, + pub i8, pub i8, pub i8, pub i8, + pub i8, pub i8, pub i8, pub i8 +); + +extern "platform-intrinsic" { + fn simd_reduce_add_unordered(x: T) -> U; + fn simd_reduce_mul_unordered(x: T) -> U; + fn simd_reduce_add_ordered(x: T, acc: U) -> U; + fn simd_reduce_mul_ordered(x: T, acc: U) -> U; + fn simd_reduce_min(x: T) -> U; + fn simd_reduce_max(x: T) -> U; + fn simd_reduce_min_nanless(x: T) -> U; + fn simd_reduce_max_nanless(x: T) -> U; + fn simd_reduce_and(x: T) -> U; + fn simd_reduce_or(x: T) -> U; + fn simd_reduce_xor(x: T) -> U; + fn simd_reduce_all(x: T) -> bool; + fn simd_reduce_any(x: T) -> bool; +} + +fn main() { + unsafe { + let x = i32x4(1, -2, 3, 4); + let r: i32 = simd_reduce_add_unordered(x); + assert_eq!(r, 6_i32); + let r: i32 = simd_reduce_mul_unordered(x); + assert_eq!(r, -24_i32); + let r: i32 = simd_reduce_add_ordered(x, -1); + assert_eq!(r, 5_i32); + let r: i32 = simd_reduce_mul_ordered(x, -1); + assert_eq!(r, 24_i32); + + let r: i32 = simd_reduce_min(x); + assert_eq!(r, -2_i32); + let r: i32 = simd_reduce_max(x); + assert_eq!(r, 4_i32); + + let x = i32x4(-1, -1, -1, -1); + let r: i32 = simd_reduce_and(x); + assert_eq!(r, -1_i32); + let r: i32 = simd_reduce_or(x); + assert_eq!(r, -1_i32); + let r: i32 = simd_reduce_xor(x); + assert_eq!(r, 0_i32); + + let x = i32x4(-1, -1, 0, -1); + let r: i32 = simd_reduce_and(x); + assert_eq!(r, 0_i32); + let r: i32 = simd_reduce_or(x); + assert_eq!(r, -1_i32); + let r: i32 = simd_reduce_xor(x); + assert_eq!(r, -1_i32); + } + + unsafe { + let x = u32x4(1, 2, 3, 4); + let r: u32 = simd_reduce_add_unordered(x); + assert_eq!(r, 10_u32); + let r: u32 = simd_reduce_mul_unordered(x); + assert_eq!(r, 24_u32); + let r: u32 = simd_reduce_add_ordered(x, 1); + assert_eq!(r, 11_u32); + let r: u32 = simd_reduce_mul_ordered(x, 2); + assert_eq!(r, 48_u32); + + let r: u32 = simd_reduce_min(x); + assert_eq!(r, 1_u32); + let r: u32 = simd_reduce_max(x); + assert_eq!(r, 4_u32); + + let t = u32::max_value(); + let x = u32x4(t, t, t, t); + let r: u32 = simd_reduce_and(x); + assert_eq!(r, t); + let r: u32 = simd_reduce_or(x); + assert_eq!(r, t); + let r: u32 = simd_reduce_xor(x); + assert_eq!(r, 0_u32); + + let x = u32x4(t, t, 0, t); + let r: u32 = simd_reduce_and(x); + assert_eq!(r, 0_u32); + let r: u32 = simd_reduce_or(x); + assert_eq!(r, t); + let r: u32 = simd_reduce_xor(x); + assert_eq!(r, t); + } + + unsafe { + let x = f32x4(1., -2., 3., 4.); + let r: f32 = simd_reduce_add_unordered(x); + assert_eq!(r, 6_f32); + let r: f32 = simd_reduce_mul_unordered(x); + assert_eq!(r, -24_f32); + // FIXME: only works correctly for accumulator, 0: + // https://bugs.llvm.org/show_bug.cgi?id=36734 + let r: f32 = simd_reduce_add_ordered(x, 0.); + assert_eq!(r, 6_f32); + // FIXME: only works correctly for accumulator, 1: + // https://bugs.llvm.org/show_bug.cgi?id=36734 + let r: f32 = simd_reduce_mul_ordered(x, 1.); + assert_eq!(r, -24_f32); + + let r: f32 = simd_reduce_min(x); + assert_eq!(r, -2_f32); + let r: f32 = simd_reduce_max(x); + assert_eq!(r, 4_f32); + let r: f32 = simd_reduce_min_nanless(x); + assert_eq!(r, -2_f32); + let r: f32 = simd_reduce_max_nanless(x); + assert_eq!(r, 4_f32); + } + + unsafe { + let x = b8x4(!0, !0, !0, !0); + let r: bool = simd_reduce_all(x); + assert_eq!(r, true); + let r: bool = simd_reduce_any(x); + assert_eq!(r, true); + + let x = b8x4(!0, !0, 0, !0); + let r: bool = simd_reduce_all(x); + assert_eq!(r, false); + let r: bool = simd_reduce_any(x); + assert_eq!(r, true); + + let x = b8x4(0, 0, 0, 0); + let r: bool = simd_reduce_all(x); + assert_eq!(r, false); + let r: bool = simd_reduce_any(x); + assert_eq!(r, false); + } +} diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-select.rs b/src/test/run-pass/simd/simd-intrinsic-generic-select.rs new file mode 100644 index 00000000000..590a2990270 --- /dev/null +++ b/src/test/run-pass/simd/simd-intrinsic-generic-select.rs @@ -0,0 +1,149 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// ignore-emscripten + +// Test that the simd_select intrinsics produces correct results. + +#![feature(repr_simd, platform_intrinsics)] +#[allow(non_camel_case_types)] + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct i32x4(pub i32, pub i32, pub i32, pub i32); + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct u32x4(pub u32, pub u32, pub u32, pub u32); + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct f32x4(pub f32, pub f32, pub f32, pub f32); + +#[repr(simd)] +#[derive(Copy, Clone, PartialEq, Debug)] +struct b8x4(pub i8, pub i8, pub i8, pub i8); + +extern "platform-intrinsic" { + fn simd_select(x: T, a: U, b: U) -> U; +} + +fn main() { + let m0 = b8x4(!0, !0, !0, !0); + let m1 = b8x4(0, 0, 0, 0); + let m2 = b8x4(!0, !0, 0, 0); + let m3 = b8x4(0, 0, !0, !0); + let m4 = b8x4(!0, 0, !0, 0); + + unsafe { + let a = i32x4(1, -2, 3, 4); + let b = i32x4(5, 6, -7, 8); + + let r: i32x4 = simd_select(m0, a, b); + let e = a; + assert_eq!(r, e); + + let r: i32x4 = simd_select(m1, a, b); + let e = b; + assert_eq!(r, e); + + let r: i32x4 = simd_select(m2, a, b); + let e = i32x4(1, -2, -7, 8); + assert_eq!(r, e); + + let r: i32x4 = simd_select(m3, a, b); + let e = i32x4(5, 6, 3, 4); + assert_eq!(r, e); + + let r: i32x4 = simd_select(m4, a, b); + let e = i32x4(1, 6, 3, 8); + assert_eq!(r, e); + } + + unsafe { + let a = u32x4(1, 2, 3, 4); + let b = u32x4(5, 6, 7, 8); + + let r: u32x4 = simd_select(m0, a, b); + let e = a; + assert_eq!(r, e); + + let r: u32x4 = simd_select(m1, a, b); + let e = b; + assert_eq!(r, e); + + let r: u32x4 = simd_select(m2, a, b); + let e = u32x4(1, 2, 7, 8); + assert_eq!(r, e); + + let r: u32x4 = simd_select(m3, a, b); + let e = u32x4(5, 6, 3, 4); + assert_eq!(r, e); + + let r: u32x4 = simd_select(m4, a, b); + let e = u32x4(1, 6, 3, 8); + assert_eq!(r, e); + } + + unsafe { + let a = f32x4(1., 2., 3., 4.); + let b = f32x4(5., 6., 7., 8.); + + let r: f32x4 = simd_select(m0, a, b); + let e = a; + assert_eq!(r, e); + + let r: f32x4 = simd_select(m1, a, b); + let e = b; + assert_eq!(r, e); + + let r: f32x4 = simd_select(m2, a, b); + let e = f32x4(1., 2., 7., 8.); + assert_eq!(r, e); + + let r: f32x4 = simd_select(m3, a, b); + let e = f32x4(5., 6., 3., 4.); + assert_eq!(r, e); + + let r: f32x4 = simd_select(m4, a, b); + let e = f32x4(1., 6., 3., 8.); + assert_eq!(r, e); + } + + unsafe { + let t = !0 as i8; + let f = 0 as i8; + let a = b8x4(t, f, t, f); + let b = b8x4(f, f, f, t); + + let r: b8x4 = simd_select(m0, a, b); + let e = a; + assert_eq!(r, e); + + let r: b8x4 = simd_select(m1, a, b); + let e = b; + assert_eq!(r, e); + + let r: b8x4 = simd_select(m2, a, b); + let e = b8x4(t, f, f, t); + assert_eq!(r, e); + + let r: b8x4 = simd_select(m3, a, b); + let e = b8x4(f, f, t, f); + assert_eq!(r, e); + + let r: b8x4 = simd_select(m4, a, b); + let e = b8x4(t, f, t, t); + assert_eq!(r, e); + } +} diff --git a/src/test/run-pass/simd/simd-size-align.rs b/src/test/run-pass/simd/simd-size-align.rs new file mode 100644 index 00000000000..6a1189ef2db --- /dev/null +++ b/src/test/run-pass/simd/simd-size-align.rs @@ -0,0 +1,74 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + + +#![feature(repr_simd)] +#![allow(non_camel_case_types)] + +use std::mem; + +/// `T` should satisfy `size_of T (mod min_align_of T) === 0` to be stored at `Vec` properly +/// Please consult the issue #20460 +fn check() { + assert_eq!(mem::size_of::() % mem::min_align_of::(), 0) +} + +fn main() { + check::(); + check::(); + check::(); + check::(); + check::(); + check::(); + check::(); + + check::(); + check::(); + check::(); + check::(); + check::(); + check::(); + check::(); + + check::(); + check::(); + check::(); + check::(); + check::(); + check::(); + check::(); +} + +#[repr(simd)] struct u8x2(u8, u8); +#[repr(simd)] struct u8x3(u8, u8, u8); +#[repr(simd)] struct u8x4(u8, u8, u8, u8); +#[repr(simd)] struct u8x5(u8, u8, u8, u8, u8); +#[repr(simd)] struct u8x6(u8, u8, u8, u8, u8, u8); +#[repr(simd)] struct u8x7(u8, u8, u8, u8, u8, u8, u8); +#[repr(simd)] struct u8x8(u8, u8, u8, u8, u8, u8, u8, u8); + +#[repr(simd)] struct i16x2(i16, i16); +#[repr(simd)] struct i16x3(i16, i16, i16); +#[repr(simd)] struct i16x4(i16, i16, i16, i16); +#[repr(simd)] struct i16x5(i16, i16, i16, i16, i16); +#[repr(simd)] struct i16x6(i16, i16, i16, i16, i16, i16); +#[repr(simd)] struct i16x7(i16, i16, i16, i16, i16, i16, i16); +#[repr(simd)] struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); + +#[repr(simd)] struct f32x2(f32, f32); +#[repr(simd)] struct f32x3(f32, f32, f32); +#[repr(simd)] struct f32x4(f32, f32, f32, f32); +#[repr(simd)] struct f32x5(f32, f32, f32, f32, f32); +#[repr(simd)] struct f32x6(f32, f32, f32, f32, f32, f32); +#[repr(simd)] struct f32x7(f32, f32, f32, f32, f32, f32, f32); +#[repr(simd)] struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32); diff --git a/src/test/run-pass/simd/simd-target-feature-mixup.rs b/src/test/run-pass/simd/simd-target-feature-mixup.rs new file mode 100644 index 00000000000..7ac91592d81 --- /dev/null +++ b/src/test/run-pass/simd/simd-target-feature-mixup.rs @@ -0,0 +1,193 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +#![allow(overflowing_literals)] + +// ignore-emscripten + +#![feature(repr_simd, target_feature, cfg_target_feature)] +#![feature(avx512_target_feature)] + +use std::process::{Command, ExitStatus}; +use std::env; + +fn main() { + if let Some(level) = env::args().nth(1) { + return test::main(&level) + } + + let me = env::current_exe().unwrap(); + for level in ["sse", "avx", "avx512"].iter() { + let status = Command::new(&me).arg(level).status().unwrap(); + if status.success() { + println!("success with {}", level); + continue + } + + // We don't actually know if our computer has the requisite target features + // for the test below. Testing for that will get added to libstd later so + // for now just assume sigill means this is a machine that can't run this test. + if is_sigill(status) { + println!("sigill with {}, assuming spurious", level); + continue + } + panic!("invalid status at {}: {}", level, status); + } +} + +#[cfg(unix)] +fn is_sigill(status: ExitStatus) -> bool { + use std::os::unix::prelude::*; + status.signal() == Some(4) +} + +#[cfg(windows)] +fn is_sigill(status: ExitStatus) -> bool { + status.code() == Some(0xc000001d) +} + +#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] +#[allow(nonstandard_style)] +mod test { + // An SSE type + #[repr(simd)] + #[derive(PartialEq, Debug, Clone, Copy)] + struct __m128i(u64, u64); + + // An AVX type + #[repr(simd)] + #[derive(PartialEq, Debug, Clone, Copy)] + struct __m256i(u64, u64, u64, u64); + + // An AVX-512 type + #[repr(simd)] + #[derive(PartialEq, Debug, Clone, Copy)] + struct __m512i(u64, u64, u64, u64, u64, u64, u64, u64); + + pub fn main(level: &str) { + unsafe { + main_normal(level); + main_sse(level); + if level == "sse" { + return + } + main_avx(level); + if level == "avx" { + return + } + main_avx512(level); + } + } + + macro_rules! mains { + ($( + $(#[$attr:meta])* + unsafe fn $main:ident(level: &str) { + ... + } + )*) => ($( + $(#[$attr])* + unsafe fn $main(level: &str) { + let m128 = __m128i(1, 2); + let m256 = __m256i(3, 4, 5, 6); + let m512 = __m512i(7, 8, 9, 10, 11, 12, 13, 14); + assert_eq!(id_sse_128(m128), m128); + assert_eq!(id_sse_256(m256), m256); + assert_eq!(id_sse_512(m512), m512); + + if level == "sse" { + return + } + assert_eq!(id_avx_128(m128), m128); + assert_eq!(id_avx_256(m256), m256); + assert_eq!(id_avx_512(m512), m512); + + if level == "avx" { + return + } + assert_eq!(id_avx512_128(m128), m128); + assert_eq!(id_avx512_256(m256), m256); + assert_eq!(id_avx512_512(m512), m512); + } + )*) + } + + mains! { + unsafe fn main_normal(level: &str) { ... } + #[target_feature(enable = "sse2")] + unsafe fn main_sse(level: &str) { ... } + #[target_feature(enable = "avx")] + unsafe fn main_avx(level: &str) { ... } + #[target_feature(enable = "avx512bw")] + unsafe fn main_avx512(level: &str) { ... } + } + + + #[target_feature(enable = "sse2")] + unsafe fn id_sse_128(a: __m128i) -> __m128i { + assert_eq!(a, __m128i(1, 2)); + a.clone() + } + + #[target_feature(enable = "sse2")] + unsafe fn id_sse_256(a: __m256i) -> __m256i { + assert_eq!(a, __m256i(3, 4, 5, 6)); + a.clone() + } + + #[target_feature(enable = "sse2")] + unsafe fn id_sse_512(a: __m512i) -> __m512i { + assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14)); + a.clone() + } + + #[target_feature(enable = "avx")] + unsafe fn id_avx_128(a: __m128i) -> __m128i { + assert_eq!(a, __m128i(1, 2)); + a.clone() + } + + #[target_feature(enable = "avx")] + unsafe fn id_avx_256(a: __m256i) -> __m256i { + assert_eq!(a, __m256i(3, 4, 5, 6)); + a.clone() + } + + #[target_feature(enable = "avx")] + unsafe fn id_avx_512(a: __m512i) -> __m512i { + assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14)); + a.clone() + } + + #[target_feature(enable = "avx512bw")] + unsafe fn id_avx512_128(a: __m128i) -> __m128i { + assert_eq!(a, __m128i(1, 2)); + a.clone() + } + + #[target_feature(enable = "avx512bw")] + unsafe fn id_avx512_256(a: __m256i) -> __m256i { + assert_eq!(a, __m256i(3, 4, 5, 6)); + a.clone() + } + + #[target_feature(enable = "avx512bw")] + unsafe fn id_avx512_512(a: __m512i) -> __m512i { + assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14)); + a.clone() + } +} + +#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] +mod test { + pub fn main(level: &str) {} +} diff --git a/src/test/run-pass/simd/simd-type.rs b/src/test/run-pass/simd/simd-type.rs new file mode 100644 index 00000000000..a1a655eec86 --- /dev/null +++ b/src/test/run-pass/simd/simd-type.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +#![feature(repr_simd)] + +#[repr(simd)] +struct RGBA { + r: f32, + g: f32, + b: f32, + a: f32 +} + +pub fn main() {} diff --git a/src/test/run-pass/simd/simd-upgraded.rs b/src/test/run-pass/simd/simd-upgraded.rs new file mode 100644 index 00000000000..e255c4d47a7 --- /dev/null +++ b/src/test/run-pass/simd/simd-upgraded.rs @@ -0,0 +1,34 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] +#![allow(non_camel_case_types)] + +// Test that removed LLVM SIMD intrinsics continue +// to work via the "AutoUpgrade" mechanism. + +#![feature(cfg_target_feature, repr_simd)] +#![feature(platform_intrinsics, stmt_expr_attributes)] + +#[repr(simd)] +#[derive(PartialEq, Debug)] +struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); + +fn main() { + #[cfg(target_feature = "sse2")] unsafe { + extern "platform-intrinsic" { + fn x86_mm_min_epi16(x: i16x8, y: i16x8) -> i16x8; + } + assert_eq!(x86_mm_min_epi16(i16x8(0, 1, 2, 3, 4, 5, 6, 7), + i16x8(7, 6, 5, 4, 3, 2, 1, 0)), + i16x8(0, 1, 2, 3, 3, 2, 1, 0)); + }; +} diff --git a/src/test/run-pass/specialization/README.md b/src/test/run-pass/specialization/README.md new file mode 100644 index 00000000000..1373a2cf81b --- /dev/null +++ b/src/test/run-pass/specialization/README.md @@ -0,0 +1,37 @@ +Tests that specialization is working correctly: + +- Dispatch + - [On methods](specialization-basics.rs), includes: + - Specialization via adding a trait bound + - Including both remote and local traits + - Specialization via pure structure (e.g. `(T, U)` vs `(T, T)`) + - Specialization via concrete types vs unknown types + - In top level of the trait reference + - Embedded within another type (`Vec` vs `Vec`) + - [Specialization based on super trait relationships](specialization-super-traits.rs) + - [On assoc fns](specialization-assoc-fns.rs) + - [Ensure that impl order doesn't matter](specialization-out-of-order.rs) + +- Item inheritance + - [Correct default cascading for methods](specialization-default-methods.rs) + - Inheritance works across impls with varying generics + - [With projections](specialization-translate-projections.rs) + - [With projections that involve input types](specialization-translate-projections-with-params.rs) + +- Normalization issues + - [Non-default assoc types can be projected](specialization-projection.rs) + - Including non-specialized cases + - Including specialized cases + - [Specialized Impls can happen on projections](specialization-on-projection.rs) + - [Projections and aliases play well together](specialization-projection-alias.rs) + - [Projections involving specialization allowed in the trait ref for impls, and overlap can still be determined](specialization-overlap-projection.rs) + - Only works for the simple case where the most specialized impl directly + provides a non-`default` associated type + +- Across crates + - [For traits defined in upstream crate](specialization-allowed-cross-crate.rs) + - [Full method dispatch tests, drawing from upstream crate](specialization-cross-crate.rs) + - Including *additional* local specializations + - [Full method dispatch tests, *without* turning on specialization in local crate](specialization-cross-crate-no-gate.rs) + - [Test that defaults cascade correctly from upstream crates](specialization-cross-crate-defaults.rs) + - Including *additional* local use of defaults diff --git a/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs b/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs new file mode 100644 index 00000000000..f484e98640f --- /dev/null +++ b/src/test/run-pass/specialization/assoc-ty-graph-cycle.rs @@ -0,0 +1,35 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Make sure we don't crash with a cycle error during coherence. + +#![feature(specialization)] + +trait Trait { + type Assoc; +} + +impl Trait for Vec { + default type Assoc = (); +} + +impl Trait for Vec { + type Assoc = u8; +} + +impl Trait for String { + type Assoc = (); +} + +impl Trait< as Trait>::Assoc> for String {} + +fn main() {} diff --git a/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs b/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs new file mode 100644 index 00000000000..b62d80b589f --- /dev/null +++ b/src/test/run-pass/specialization/auxiliary/cross_crates_defaults.rs @@ -0,0 +1,49 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +#![feature(specialization)] + +// First, test only use of explicit `default` items: + +pub trait Foo { + fn foo(&self) -> bool; +} + +impl Foo for T { + default fn foo(&self) -> bool { false } +} + +impl Foo for i32 {} + +impl Foo for i64 { + fn foo(&self) -> bool { true } +} + +// Next, test mixture of explicit `default` and provided methods: + +pub trait Bar { + fn bar(&self) -> i32 { 0 } +} + +impl Bar for T {} // use the provided method + +impl Bar for i32 { + fn bar(&self) -> i32 { 1 } +} +impl<'a> Bar for &'a str {} + +impl Bar for Vec { + default fn bar(&self) -> i32 { 2 } +} +impl Bar for Vec {} +impl Bar for Vec { + fn bar(&self) -> i32 { 3 } +} diff --git a/src/test/run-pass/specialization/auxiliary/go_trait.rs b/src/test/run-pass/specialization/auxiliary/go_trait.rs new file mode 100644 index 00000000000..044bb606b40 --- /dev/null +++ b/src/test/run-pass/specialization/auxiliary/go_trait.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(specialization)] + +// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. + +pub trait Go { + fn go(&self, arg: isize); +} + +pub fn go(this: &G, arg: isize) { + this.go(arg) +} + +pub trait GoMut { + fn go_mut(&mut self, arg: isize); +} + +pub fn go_mut(this: &mut G, arg: isize) { + this.go_mut(arg) +} + +pub trait GoOnce { + fn go_once(self, arg: isize); +} + +pub fn go_once(this: G, arg: isize) { + this.go_once(arg) +} + +impl GoMut for G + where G : Go +{ + default fn go_mut(&mut self, arg: isize) { + go(&*self, arg) + } +} + +impl GoOnce for G + where G : GoMut +{ + default fn go_once(mut self, arg: isize) { + go_mut(&mut self, arg) + } +} diff --git a/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs b/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs new file mode 100644 index 00000000000..1d235336de8 --- /dev/null +++ b/src/test/run-pass/specialization/auxiliary/specialization_cross_crate.rs @@ -0,0 +1,82 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(specialization)] + +pub trait Foo { + fn foo(&self) -> &'static str; +} + +impl Foo for T { + default fn foo(&self) -> &'static str { + "generic" + } +} + +impl Foo for T { + default fn foo(&self) -> &'static str { + "generic Clone" + } +} + +impl Foo for (T, U) where T: Clone, U: Clone { + default fn foo(&self) -> &'static str { + "generic pair" + } +} + +impl Foo for (T, T) { + default fn foo(&self) -> &'static str { + "generic uniform pair" + } +} + +impl Foo for (u8, u32) { + default fn foo(&self) -> &'static str { + "(u8, u32)" + } +} + +impl Foo for (u8, u8) { + default fn foo(&self) -> &'static str { + "(u8, u8)" + } +} + +impl Foo for Vec { + default fn foo(&self) -> &'static str { + "generic Vec" + } +} + +impl Foo for Vec { + fn foo(&self) -> &'static str { + "Vec" + } +} + +impl Foo for String { + fn foo(&self) -> &'static str { + "String" + } +} + +impl Foo for i32 { + fn foo(&self) -> &'static str { + "i32" + } +} + +pub trait MyMarker {} +impl Foo for T { + default fn foo(&self) -> &'static str { + "generic Clone + MyMarker" + } +} diff --git a/src/test/run-pass/specialization/cross-crate-defaults.rs b/src/test/run-pass/specialization/cross-crate-defaults.rs new file mode 100644 index 00000000000..ee978755cbd --- /dev/null +++ b/src/test/run-pass/specialization/cross-crate-defaults.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:cross_crates_defaults.rs + +#![feature(specialization)] + +extern crate cross_crates_defaults; + +use cross_crates_defaults::*; + +struct LocalDefault; +struct LocalOverride; + +impl Foo for LocalDefault {} + +impl Foo for LocalOverride { + fn foo(&self) -> bool { true } +} + +fn test_foo() { + assert!(!0i8.foo()); + assert!(!0i32.foo()); + assert!(0i64.foo()); + + assert!(!LocalDefault.foo()); + assert!(LocalOverride.foo()); +} + +fn test_bar() { + assert!(0u8.bar() == 0); + assert!(0i32.bar() == 1); + assert!("hello".bar() == 0); + assert!(vec![()].bar() == 2); + assert!(vec![0i32].bar() == 2); + assert!(vec![0i64].bar() == 3); +} + +fn main() { + test_foo(); + test_bar(); +} diff --git a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs new file mode 100644 index 00000000000..4a481beffd2 --- /dev/null +++ b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:go_trait.rs + +#![feature(specialization)] + +extern crate go_trait; + +use go_trait::{Go,GoMut}; +use std::fmt::Debug; +use std::default::Default; + +struct MyThingy; + +impl Go for MyThingy { + fn go(&self, arg: isize) { } +} + +impl GoMut for MyThingy { + fn go_mut(&mut self, arg: isize) { } +} + +fn main() { } diff --git a/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs b/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs new file mode 100644 index 00000000000..dd060f8ef40 --- /dev/null +++ b/src/test/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(specialization)] + +// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. + +pub trait Go { + fn go(&self, arg: isize); +} + +pub fn go(this: &G, arg: isize) { + this.go(arg) +} + +pub trait GoMut { + fn go_mut(&mut self, arg: isize); +} + +pub fn go_mut(this: &mut G, arg: isize) { + this.go_mut(arg) +} + +pub trait GoOnce { + fn go_once(self, arg: isize); +} + +pub fn go_once(this: G, arg: isize) { + this.go_once(arg) +} + +default impl GoMut for G + where G : Go +{ + fn go_mut(&mut self, arg: isize) { + go(&*self, arg) + } +} + +default impl GoOnce for G + where G : GoMut +{ + fn go_once(mut self, arg: isize) { + go_mut(&mut self, arg) + } +} diff --git a/src/test/run-pass/specialization/defaultimpl/out-of-order.rs b/src/test/run-pass/specialization/defaultimpl/out-of-order.rs new file mode 100644 index 00000000000..e78b0657944 --- /dev/null +++ b/src/test/run-pass/specialization/defaultimpl/out-of-order.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that you can list the more specific impl before the more general one. + +#![feature(specialization)] + +trait Foo { + type Out; +} + +impl Foo for bool { + type Out = (); +} + +default impl Foo for T { + type Out = bool; +} + +fn main() {} diff --git a/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs b/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs new file mode 100644 index 00000000000..00381bb09c9 --- /dev/null +++ b/src/test/run-pass/specialization/defaultimpl/overlap-projection.rs @@ -0,0 +1,35 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that impls on projected self types can resolve overlap, even when the +// projections involve specialization, so long as the associated type is +// provided by the most specialized impl. + +#![feature(specialization)] + +trait Assoc { + type Output; +} + +default impl Assoc for T { + type Output = bool; +} + +impl Assoc for u8 { type Output = u8; } +impl Assoc for u16 { type Output = u16; } + +trait Foo {} +impl Foo for u32 {} +impl Foo for ::Output {} +impl Foo for ::Output {} + +fn main() {} diff --git a/src/test/run-pass/specialization/defaultimpl/projection.rs b/src/test/run-pass/specialization/defaultimpl/projection.rs new file mode 100644 index 00000000000..989f4f286f2 --- /dev/null +++ b/src/test/run-pass/specialization/defaultimpl/projection.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Make sure we *can* project non-defaulted associated types +// cf compile-fail/specialization-default-projection.rs + +// First, do so without any use of specialization + +trait Foo { + type Assoc; +} + +impl Foo for T { + type Assoc = (); +} + +fn generic_foo() -> ::Assoc { + () +} + +// Next, allow for one layer of specialization + +trait Bar { + type Assoc; +} + +default impl Bar for T { + type Assoc = (); +} + +impl Bar for T { + type Assoc = u8; +} + +fn generic_bar_clone() -> ::Assoc { + 0u8 +} + +fn main() { +} diff --git a/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs new file mode 100644 index 00000000000..440b8d748a4 --- /dev/null +++ b/src/test/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs @@ -0,0 +1,44 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Tests that we can combine a default impl that supplies one method with a +// full impl that supplies the other, and they can invoke one another. + +#![feature(specialization)] + +trait Foo { + fn foo_one(&self) -> &'static str; + fn foo_two(&self) -> &'static str; + fn foo_three(&self) -> &'static str; +} + +struct MyStruct; + +default impl Foo for T { + fn foo_one(&self) -> &'static str { + self.foo_three() + } +} + +impl Foo for MyStruct { + fn foo_two(&self) -> &'static str { + self.foo_one() + } + + fn foo_three(&self) -> &'static str { + "generic" + } +} + +fn main() { + assert!(MyStruct.foo_two() == "generic"); +} diff --git a/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs b/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs new file mode 100644 index 00000000000..4a481beffd2 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:go_trait.rs + +#![feature(specialization)] + +extern crate go_trait; + +use go_trait::{Go,GoMut}; +use std::fmt::Debug; +use std::default::Default; + +struct MyThingy; + +impl Go for MyThingy { + fn go(&self, arg: isize) { } +} + +impl GoMut for MyThingy { + fn go_mut(&mut self, arg: isize) { } +} + +fn main() { } diff --git a/src/test/run-pass/specialization/specialization-assoc-fns.rs b/src/test/run-pass/specialization/specialization-assoc-fns.rs new file mode 100644 index 00000000000..e6db162a70b --- /dev/null +++ b/src/test/run-pass/specialization/specialization-assoc-fns.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that non-method associated functions can be specialized + +#![feature(specialization)] + +trait Foo { + fn mk() -> Self; +} + +impl Foo for T { + default fn mk() -> T { + T::default() + } +} + +impl Foo for Vec { + fn mk() -> Vec { + vec![0] + } +} + +fn main() { + let v1: Vec = Foo::mk(); + let v2: Vec = Foo::mk(); + + assert!(v1.len() == 0); + assert!(v2.len() == 1); +} diff --git a/src/test/run-pass/specialization/specialization-basics.rs b/src/test/run-pass/specialization/specialization-basics.rs new file mode 100644 index 00000000000..7638b91c3bc --- /dev/null +++ b/src/test/run-pass/specialization/specialization-basics.rs @@ -0,0 +1,108 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Tests a variety of basic specialization scenarios and method +// dispatch for them. + +trait Foo { + fn foo(&self) -> &'static str; +} + +impl Foo for T { + default fn foo(&self) -> &'static str { + "generic" + } +} + +impl Foo for T { + default fn foo(&self) -> &'static str { + "generic Clone" + } +} + +impl Foo for (T, U) where T: Clone, U: Clone { + default fn foo(&self) -> &'static str { + "generic pair" + } +} + +impl Foo for (T, T) { + default fn foo(&self) -> &'static str { + "generic uniform pair" + } +} + +impl Foo for (u8, u32) { + default fn foo(&self) -> &'static str { + "(u8, u32)" + } +} + +impl Foo for (u8, u8) { + default fn foo(&self) -> &'static str { + "(u8, u8)" + } +} + +impl Foo for Vec { + default fn foo(&self) -> &'static str { + "generic Vec" + } +} + +impl Foo for Vec { + fn foo(&self) -> &'static str { + "Vec" + } +} + +impl Foo for String { + fn foo(&self) -> &'static str { + "String" + } +} + +impl Foo for i32 { + fn foo(&self) -> &'static str { + "i32" + } +} + +struct NotClone; + +trait MyMarker {} +impl Foo for T { + default fn foo(&self) -> &'static str { + "generic Clone + MyMarker" + } +} + +#[derive(Clone)] +struct MarkedAndClone; +impl MyMarker for MarkedAndClone {} + +fn main() { + assert!(NotClone.foo() == "generic"); + assert!(0u8.foo() == "generic Clone"); + assert!(vec![NotClone].foo() == "generic"); + assert!(vec![0u8].foo() == "generic Vec"); + assert!(vec![0i32].foo() == "Vec"); + assert!(0i32.foo() == "i32"); + assert!(String::new().foo() == "String"); + assert!(((), 0).foo() == "generic pair"); + assert!(((), ()).foo() == "generic uniform pair"); + assert!((0u8, 0u32).foo() == "(u8, u32)"); + assert!((0u8, 0u8).foo() == "(u8, u8)"); + assert!(MarkedAndClone.foo() == "generic Clone + MyMarker"); +} diff --git a/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs b/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs new file mode 100644 index 00000000000..0427a9a429a --- /dev/null +++ b/src/test/run-pass/specialization/specialization-cross-crate-no-gate.rs @@ -0,0 +1,31 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that specialization works even if only the upstream crate enables it + +// aux-build:specialization_cross_crate.rs + +extern crate specialization_cross_crate; + +use specialization_cross_crate::*; + +fn main() { + assert!(0u8.foo() == "generic Clone"); + assert!(vec![0u8].foo() == "generic Vec"); + assert!(vec![0i32].foo() == "Vec"); + assert!(0i32.foo() == "i32"); + assert!(String::new().foo() == "String"); + assert!(((), 0).foo() == "generic pair"); + assert!(((), ()).foo() == "generic uniform pair"); + assert!((0u8, 0u32).foo() == "(u8, u32)"); + assert!((0u8, 0u8).foo() == "(u8, u8)"); +} diff --git a/src/test/run-pass/specialization/specialization-cross-crate.rs b/src/test/run-pass/specialization/specialization-cross-crate.rs new file mode 100644 index 00000000000..9520c0c0d61 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-cross-crate.rs @@ -0,0 +1,60 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:specialization_cross_crate.rs + +#![feature(specialization)] + +extern crate specialization_cross_crate; + +use specialization_cross_crate::*; + +struct NotClone; + +#[derive(Clone)] +struct MarkedAndClone; +impl MyMarker for MarkedAndClone {} + +struct MyType(T); +impl Foo for MyType { + default fn foo(&self) -> &'static str { + "generic MyType" + } +} + +impl Foo for MyType { + fn foo(&self) -> &'static str { + "MyType" + } +} + +struct MyOtherType; +impl Foo for MyOtherType {} + +fn main() { + assert!(NotClone.foo() == "generic"); + assert!(0u8.foo() == "generic Clone"); + assert!(vec![NotClone].foo() == "generic"); + assert!(vec![0u8].foo() == "generic Vec"); + assert!(vec![0i32].foo() == "Vec"); + assert!(0i32.foo() == "i32"); + assert!(String::new().foo() == "String"); + assert!(((), 0).foo() == "generic pair"); + assert!(((), ()).foo() == "generic uniform pair"); + assert!((0u8, 0u32).foo() == "(u8, u32)"); + assert!((0u8, 0u8).foo() == "(u8, u8)"); + assert!(MarkedAndClone.foo() == "generic Clone + MyMarker"); + + assert!(MyType(()).foo() == "generic MyType"); + assert!(MyType(0u8).foo() == "MyType"); + assert!(MyOtherType.foo() == "generic"); +} diff --git a/src/test/run-pass/specialization/specialization-default-methods.rs b/src/test/run-pass/specialization/specialization-default-methods.rs new file mode 100644 index 00000000000..e384687f866 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-default-methods.rs @@ -0,0 +1,96 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Test that default methods are cascaded correctly + +// First, test only use of explicit `default` items: + +trait Foo { + fn foo(&self) -> bool; +} + +// Specialization tree for Foo: +// +// T +// / \ +// i32 i64 + +impl Foo for T { + default fn foo(&self) -> bool { false } +} + +impl Foo for i32 {} + +impl Foo for i64 { + fn foo(&self) -> bool { true } +} + +fn test_foo() { + assert!(!0i8.foo()); + assert!(!0i32.foo()); + assert!(0i64.foo()); +} + +// Next, test mixture of explicit `default` and provided methods: + +trait Bar { + fn bar(&self) -> i32 { 0 } +} + +// Specialization tree for Bar. +// Uses of $ designate that method is provided +// +// $Bar (the trait) +// | +// T +// /|\ +// / | \ +// / | \ +// / | \ +// / | \ +// / | \ +// $i32 &str $Vec +// /\ +// / \ +// Vec $Vec + +// use the provided method +impl Bar for T {} + +impl Bar for i32 { + fn bar(&self) -> i32 { 1 } +} +impl<'a> Bar for &'a str {} + +impl Bar for Vec { + default fn bar(&self) -> i32 { 2 } +} +impl Bar for Vec {} +impl Bar for Vec { + fn bar(&self) -> i32 { 3 } +} + +fn test_bar() { + assert!(0u8.bar() == 0); + assert!(0i32.bar() == 1); + assert!("hello".bar() == 0); + assert!(vec![()].bar() == 2); + assert!(vec![0i32].bar() == 2); + assert!(vec![0i64].bar() == 3); +} + +fn main() { + test_foo(); + test_bar(); +} diff --git a/src/test/run-pass/specialization/specialization-on-projection.rs b/src/test/run-pass/specialization/specialization-on-projection.rs new file mode 100644 index 00000000000..39af761fd48 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-on-projection.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Ensure that specialization works for impls defined directly on a projection + +trait Foo {} + +trait Assoc { + type Item; +} + +impl Foo for T {} + +struct Struct; + +impl Assoc for Struct { + type Item = u8; +} + +impl Foo for Struct {} + +fn main() {} diff --git a/src/test/run-pass/specialization/specialization-out-of-order.rs b/src/test/run-pass/specialization/specialization-out-of-order.rs new file mode 100644 index 00000000000..1bc2a5f9af7 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-out-of-order.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that you can list the more specific impl before the more general one. + +#![feature(specialization)] + +trait Foo { + type Out; +} + +impl Foo for bool { + type Out = (); +} + +impl Foo for T { + default type Out = bool; +} + +fn main() {} diff --git a/src/test/run-pass/specialization/specialization-overlap-projection.rs b/src/test/run-pass/specialization/specialization-overlap-projection.rs new file mode 100644 index 00000000000..4223f8144c1 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-overlap-projection.rs @@ -0,0 +1,35 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Test that impls on projected self types can resolve overlap, even when the +// projections involve specialization, so long as the associated type is +// provided by the most specialized impl. + +#![feature(specialization)] + +trait Assoc { + type Output; +} + +impl Assoc for T { + default type Output = bool; +} + +impl Assoc for u8 { type Output = u8; } +impl Assoc for u16 { type Output = u16; } + +trait Foo {} +impl Foo for u32 {} +impl Foo for ::Output {} +impl Foo for ::Output {} + +fn main() {} diff --git a/src/test/run-pass/specialization/specialization-projection-alias.rs b/src/test/run-pass/specialization/specialization-projection-alias.rs new file mode 100644 index 00000000000..f2f10765344 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-projection-alias.rs @@ -0,0 +1,34 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Regression test for ICE when combining specialized associated types and type +// aliases + +trait Id_ { + type Out; +} + +type Id = ::Out; + +impl Id_ for T { + default type Out = T; +} + +fn test_proection() { + let x: Id = panic!(); +} + +fn main() { + +} diff --git a/src/test/run-pass/specialization/specialization-projection.rs b/src/test/run-pass/specialization/specialization-projection.rs new file mode 100644 index 00000000000..2bed94ccbc1 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-projection.rs @@ -0,0 +1,51 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Make sure we *can* project non-defaulted associated types +// cf compile-fail/specialization-default-projection.rs + +// First, do so without any use of specialization + +trait Foo { + type Assoc; +} + +impl Foo for T { + type Assoc = (); +} + +fn generic_foo() -> ::Assoc { + () +} + +// Next, allow for one layer of specialization + +trait Bar { + type Assoc; +} + +impl Bar for T { + default type Assoc = (); +} + +impl Bar for T { + type Assoc = u8; +} + +fn generic_bar_clone() -> ::Assoc { + 0u8 +} + +fn main() { +} diff --git a/src/test/run-pass/specialization/specialization-super-traits.rs b/src/test/run-pass/specialization/specialization-super-traits.rs new file mode 100644 index 00000000000..d7c340f890d --- /dev/null +++ b/src/test/run-pass/specialization/specialization-super-traits.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +// Test that you can specialize via an explicit trait hierarchy + +// FIXME: this doesn't work yet... + +trait Parent {} +trait Child: Parent {} + +trait Foo {} + +impl Foo for T {} +impl Foo for T {} + +fn main() {} diff --git a/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs b/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs new file mode 100644 index 00000000000..1ead57e8adc --- /dev/null +++ b/src/test/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs @@ -0,0 +1,43 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(specialization)] + +trait Iterator { + fn next(&self); +} + +trait WithAssoc { + type Item; +} + +impl<'a> WithAssoc for &'a () { + type Item = &'a u32; +} + +struct Cloned(I); + +impl<'a, I, T: 'a> Iterator for Cloned + where I: WithAssoc, T: Clone +{ + fn next(&self) {} +} + +impl<'a, I, T: 'a> Iterator for Cloned + where I: WithAssoc, T: Copy +{ + +} + +fn main() { + Cloned(&()).next(); +} diff --git a/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs b/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs new file mode 100644 index 00000000000..ba823c43557 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-translate-projections-with-params.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Ensure that provided items are inherited properly even when impls vary in +// type parameters *and* rely on projections, and the type parameters are input +// types on the trait. + +#![feature(specialization)] + +trait Trait { + fn convert(&self) -> T; +} +trait WithAssoc { + type Item; + fn as_item(&self) -> &Self::Item; +} + +impl Trait for T where T: WithAssoc, U: Clone { + fn convert(&self) -> U { + self.as_item().clone() + } +} + +impl WithAssoc for u8 { + type Item = u8; + fn as_item(&self) -> &u8 { self } +} + +impl Trait for u8 {} + +fn main() { + assert!(3u8.convert() == 3u8); +} diff --git a/src/test/run-pass/specialization/specialization-translate-projections.rs b/src/test/run-pass/specialization/specialization-translate-projections.rs new file mode 100644 index 00000000000..796485017c5 --- /dev/null +++ b/src/test/run-pass/specialization/specialization-translate-projections.rs @@ -0,0 +1,43 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// Ensure that provided items are inherited properly even when impls vary in +// type parameters *and* rely on projections. + +#![feature(specialization)] + +use std::convert::Into; + +trait Trait { + fn to_u8(&self) -> u8; +} +trait WithAssoc { + type Item; + fn to_item(&self) -> Self::Item; +} + +impl Trait for T where T: WithAssoc, U: Into { + fn to_u8(&self) -> u8 { + self.to_item().into() + } +} + +impl WithAssoc for u8 { + type Item = u8; + fn to_item(&self) -> u8 { *self } +} + +impl Trait for u8 {} + +fn main() { + assert!(3u8.to_u8() == 3u8); +} diff --git a/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs b/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs new file mode 100644 index 00000000000..2ccdb4e0864 --- /dev/null +++ b/src/test/run-pass/statics/auxiliary/static-function-pointer-aux.rs @@ -0,0 +1,15 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub fn f(x: isize) -> isize { -x } + +pub static F: fn(isize) -> isize = f; +pub static mut MutF: fn(isize) -> isize = f; diff --git a/src/test/run-pass/statics/auxiliary/static-methods-crate.rs b/src/test/run-pass/statics/auxiliary/static-methods-crate.rs new file mode 100644 index 00000000000..b8fd59bf703 --- /dev/null +++ b/src/test/run-pass/statics/auxiliary/static-methods-crate.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="static_methods_crate"] +#![crate_type = "lib"] + +pub trait read: Sized { + fn readMaybe(s: String) -> Option; +} + +impl read for isize { + fn readMaybe(s: String) -> Option { + s.parse().ok() + } +} + +impl read for bool { + fn readMaybe(s: String) -> Option { + match &*s { + "true" => Some(true), + "false" => Some(false), + _ => None + } + } +} + +pub fn read(s: String) -> T { + match read::readMaybe(s) { + Some(x) => x, + _ => panic!("read panicked!") + } +} diff --git a/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs b/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs new file mode 100644 index 00000000000..2193e12bceb --- /dev/null +++ b/src/test/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub mod num { + pub trait Num2 { + fn from_int2(n: isize) -> Self; + } +} + +pub mod f64 { + impl ::num::Num2 for f64 { + #[inline] + fn from_int2(n: isize) -> f64 { return n as f64; } + } +} diff --git a/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs b/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs new file mode 100644 index 00000000000..44e875fbe3c --- /dev/null +++ b/src/test/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs @@ -0,0 +1,21 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod num { + pub trait Num2 { + fn from_int2(n: isize) -> Self; + } +} + +pub mod f64 { + impl ::num::Num2 for f64 { + fn from_int2(n: isize) -> f64 { return n as f64; } + } +} diff --git a/src/test/run-pass/statics/auxiliary/static_mut_xc.rs b/src/test/run-pass/statics/auxiliary/static_mut_xc.rs new file mode 100644 index 00000000000..9d677e3dc46 --- /dev/null +++ b/src/test/run-pass/statics/auxiliary/static_mut_xc.rs @@ -0,0 +1,11 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub static mut a: isize = 3; diff --git a/src/test/run-pass/statics/static-fn-inline-xc.rs b/src/test/run-pass/statics/static-fn-inline-xc.rs new file mode 100644 index 00000000000..a30c3dba3c3 --- /dev/null +++ b/src/test/run-pass/statics/static-fn-inline-xc.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:static_fn_inline_xc_aux.rs + +// pretty-expanded FIXME #23616 + +extern crate static_fn_inline_xc_aux as mycore; + +use mycore::num; + +pub fn main() { + let _1: f64 = num::Num2::from_int2(1); +} diff --git a/src/test/run-pass/statics/static-fn-trait-xc.rs b/src/test/run-pass/statics/static-fn-trait-xc.rs new file mode 100644 index 00000000000..da6108c7852 --- /dev/null +++ b/src/test/run-pass/statics/static-fn-trait-xc.rs @@ -0,0 +1,22 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:static_fn_trait_xc_aux.rs + +// pretty-expanded FIXME #23616 + +extern crate static_fn_trait_xc_aux as mycore; + +use mycore::num; + +pub fn main() { + let _1: f64 = num::Num2::from_int2(1); +} diff --git a/src/test/run-pass/statics/static-function-pointer-xc.rs b/src/test/run-pass/statics/static-function-pointer-xc.rs new file mode 100644 index 00000000000..19231ca5134 --- /dev/null +++ b/src/test/run-pass/statics/static-function-pointer-xc.rs @@ -0,0 +1,27 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:static-function-pointer-aux.rs + +extern crate static_function_pointer_aux as aux; + +fn f(x: isize) -> isize { x } + +pub fn main() { + assert_eq!(aux::F(42), -42); + unsafe { + assert_eq!(aux::MutF(42), -42); + aux::MutF = f; + assert_eq!(aux::MutF(42), 42); + aux::MutF = aux::f; + assert_eq!(aux::MutF(42), -42); + } +} diff --git a/src/test/run-pass/statics/static-function-pointer.rs b/src/test/run-pass/statics/static-function-pointer.rs new file mode 100644 index 00000000000..e923ee7308e --- /dev/null +++ b/src/test/run-pass/statics/static-function-pointer.rs @@ -0,0 +1,26 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +fn f(x: isize) -> isize { x } +fn g(x: isize) -> isize { 2 * x } + +static F: fn(isize) -> isize = f; +static mut G: fn(isize) -> isize = f; + +pub fn main() { + assert_eq!(F(42), 42); + unsafe { + assert_eq!(G(42), 42); + G = g; + assert_eq!(G(42), 84); + } +} diff --git a/src/test/run-pass/statics/static-impl.rs b/src/test/run-pass/statics/static-impl.rs new file mode 100644 index 00000000000..b1cbd5de0b9 --- /dev/null +++ b/src/test/run-pass/statics/static-impl.rs @@ -0,0 +1,76 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + + +pub trait plus { + fn plus(&self) -> isize; +} + +mod a { + use plus; + impl plus for usize { fn plus(&self) -> isize { *self as isize + 20 } } +} + +mod b { + use plus; + impl plus for String { fn plus(&self) -> isize { 200 } } +} + +trait uint_utils { + fn str(&self) -> String; + fn multi(&self, f: F) where F: FnMut(usize); +} + +impl uint_utils for usize { + fn str(&self) -> String { + self.to_string() + } + fn multi(&self, mut f: F) where F: FnMut(usize) { + let mut c = 0_usize; + while c < *self { f(c); c += 1_usize; } + } +} + +trait vec_utils { + fn length_(&self, ) -> usize; + fn iter_(&self, f: F) where F: FnMut(&T); + fn map_(&self, f: F) -> Vec where F: FnMut(&T) -> U; +} + +impl vec_utils for Vec { + fn length_(&self) -> usize { self.len() } + fn iter_(&self, mut f: F) where F: FnMut(&T) { for x in self { f(x); } } + fn map_(&self, mut f: F) -> Vec where F: FnMut(&T) -> U { + let mut r = Vec::new(); + for elt in self { + r.push(f(elt)); + } + r + } +} + +pub fn main() { + assert_eq!(10_usize.plus(), 30); + assert_eq!(("hi".to_string()).plus(), 200); + + assert_eq!((vec![1]).length_().str(), "1".to_string()); + let vect = vec![3, 4].map_(|a| *a + 4); + assert_eq!(vect[0], 7); + let vect = (vec![3, 4]).map_::(|a| *a as usize + 4_usize); + assert_eq!(vect[0], 7_usize); + let mut x = 0_usize; + 10_usize.multi(|_n| x += 2_usize ); + assert_eq!(x, 20_usize); +} diff --git a/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs b/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs new file mode 100644 index 00000000000..e70984df37e --- /dev/null +++ b/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Deserializer { + fn read_int(&self) -> isize; +} + +trait Deserializable { + fn deserialize(d: &D) -> Self; +} + +impl Deserializable for isize { + fn deserialize(d: &D) -> isize { + return d.read_int(); + } +} + +struct FromThinAir { dummy: () } + +impl Deserializer for FromThinAir { + fn read_int(&self) -> isize { 22 } +} + +pub fn main() { + let d = FromThinAir { dummy: () }; + let i: isize = Deserializable::deserialize(&d); + assert_eq!(i, 22); +} diff --git a/src/test/run-pass/statics/static-method-xcrate.rs b/src/test/run-pass/statics/static-method-xcrate.rs new file mode 100644 index 00000000000..f9bae7f3a3b --- /dev/null +++ b/src/test/run-pass/statics/static-method-xcrate.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:static-methods-crate.rs + +extern crate static_methods_crate; + +use static_methods_crate::read; + +pub fn main() { + let result: isize = read("5".to_string()); + assert_eq!(result, 5); + assert_eq!(read::readMaybe("false".to_string()), Some(false)); + assert_eq!(read::readMaybe("foo".to_string()), None::); +} diff --git a/src/test/run-pass/statics/static-methods-in-traits.rs b/src/test/run-pass/statics/static-methods-in-traits.rs new file mode 100644 index 00000000000..cdf2168f7dc --- /dev/null +++ b/src/test/run-pass/statics/static-methods-in-traits.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod a { + pub trait Foo { + fn foo() -> Self; + } + + impl Foo for isize { + fn foo() -> isize { + 3 + } + } + + impl Foo for usize { + fn foo() -> usize { + 5 + } + } +} + +pub fn main() { + let x: isize = a::Foo::foo(); + let y: usize = a::Foo::foo(); + assert_eq!(x, 3); + assert_eq!(y, 5); +} diff --git a/src/test/run-pass/statics/static-methods-in-traits2.rs b/src/test/run-pass/statics/static-methods-in-traits2.rs new file mode 100644 index 00000000000..7e50cc58618 --- /dev/null +++ b/src/test/run-pass/statics/static-methods-in-traits2.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait Number: NumConv { + fn from(n: T) -> Self; +} + +impl Number for f64 { + fn from(n: T) -> f64 { n.to_float() } +} + +pub trait NumConv { + fn to_float(&self) -> f64; +} + +impl NumConv for f64 { + fn to_float(&self) -> f64 { *self } +} + +pub fn main() { + let _: f64 = Number::from(0.0f64); +} diff --git a/src/test/run-pass/statics/static-mut-foreign.rs b/src/test/run-pass/statics/static-mut-foreign.rs new file mode 100644 index 00000000000..d9e43ddea71 --- /dev/null +++ b/src/test/run-pass/statics/static-mut-foreign.rs @@ -0,0 +1,51 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Constants (static variables) can be used to match in patterns, but mutable +// statics cannot. This ensures that there's some form of error if this is +// attempted. + +// ignore-wasm32-bare no libc to test ffi with + +#![feature(libc)] + +extern crate libc; + +#[link(name = "rust_test_helpers", kind = "static")] +extern { + static mut rust_dbg_static_mut: libc::c_int; + pub fn rust_dbg_static_mut_check_four(); +} + +unsafe fn static_bound(_: &'static libc::c_int) {} + +fn static_bound_set(a: &'static mut libc::c_int) { + *a = 3; +} + +unsafe fn run() { + assert_eq!(rust_dbg_static_mut, 3); + rust_dbg_static_mut = 4; + assert_eq!(rust_dbg_static_mut, 4); + rust_dbg_static_mut_check_four(); + rust_dbg_static_mut += 1; + assert_eq!(rust_dbg_static_mut, 5); + rust_dbg_static_mut *= 3; + assert_eq!(rust_dbg_static_mut, 15); + rust_dbg_static_mut = -3; + assert_eq!(rust_dbg_static_mut, -3); + static_bound(&rust_dbg_static_mut); + static_bound_set(&mut rust_dbg_static_mut); +} + +pub fn main() { + unsafe { run() } +} diff --git a/src/test/run-pass/statics/static-mut-xc.rs b/src/test/run-pass/statics/static-mut-xc.rs new file mode 100644 index 00000000000..1e8f5f34ea6 --- /dev/null +++ b/src/test/run-pass/statics/static-mut-xc.rs @@ -0,0 +1,49 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Constants (static variables) can be used to match in patterns, but mutable +// statics cannot. This ensures that there's some form of error if this is +// attempted. + +// aux-build:static_mut_xc.rs + + +extern crate static_mut_xc; + +unsafe fn static_bound(_: &'static isize) {} + +fn static_bound_set(a: &'static mut isize) { + *a = 3; +} + +unsafe fn run() { + assert_eq!(static_mut_xc::a, 3); + static_mut_xc::a = 4; + assert_eq!(static_mut_xc::a, 4); + static_mut_xc::a += 1; + assert_eq!(static_mut_xc::a, 5); + static_mut_xc::a *= 3; + assert_eq!(static_mut_xc::a, 15); + static_mut_xc::a = -3; + assert_eq!(static_mut_xc::a, -3); + static_bound(&static_mut_xc::a); + static_bound_set(&mut static_mut_xc::a); +} + +pub fn main() { + unsafe { run() } +} + +pub mod inner { + pub static mut a: isize = 4; +} diff --git a/src/test/run-pass/statics/static-recursive.rs b/src/test/run-pass/statics/static-recursive.rs new file mode 100644 index 00000000000..606604e5f6f --- /dev/null +++ b/src/test/run-pass/statics/static-recursive.rs @@ -0,0 +1,46 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; + +struct StaticDoubleLinked { + prev: &'static StaticDoubleLinked, + next: &'static StaticDoubleLinked, + data: i32, + head: bool +} + +static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true}; +static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false}; +static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false}; + + +pub fn main() { + unsafe { assert_eq!(S, *(S as *const *const u8)); } + + let mut test_vec = Vec::new(); + let mut cur = &L1; + loop { + test_vec.push(cur.data); + cur = cur.next; + if cur.head { break } + } + assert_eq!(&test_vec, &[1,2,3]); + + let mut test_vec = Vec::new(); + let mut cur = &L1; + loop { + cur = cur.prev; + test_vec.push(cur.data); + if cur.head { break } + } + assert_eq!(&test_vec, &[3,2,1]); +} diff --git a/src/test/run-pass/structs-enums/align-struct.rs b/src/test/run-pass/structs-enums/align-struct.rs new file mode 100644 index 00000000000..122734e817a --- /dev/null +++ b/src/test/run-pass/structs-enums/align-struct.rs @@ -0,0 +1,255 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] +#![feature(repr_packed)] + +use std::mem; + +// Raising alignment +#[repr(align(16))] +#[derive(Clone, Copy, Debug)] +struct Align16(i32); + +// Lowering has no effect +#[repr(align(1))] +struct Align1(i32); + +// Multiple attributes take the max +#[repr(align(4))] +#[repr(align(16))] +#[repr(align(8))] +struct AlignMany(i32); + +// Raising alignment may not alter size. +#[repr(align(8))] +#[allow(dead_code)] +struct Align8Many { + a: i32, + b: i32, + c: i32, + d: u8, +} + +enum Enum { + #[allow(dead_code)] + A(i32), + B(Align16) +} + +// Nested alignment - use `#[repr(C)]` to suppress field reordering for sizeof test +#[repr(C)] +struct Nested { + a: i32, + b: i32, + c: Align16, + d: i8, +} + +#[repr(packed)] +struct Packed(i32); + +#[repr(align(16))] +struct AlignContainsPacked { + a: Packed, + b: Packed, +} + +#[repr(C, packed(4))] +struct Packed4C { + a: u32, + b: u64, +} + +#[repr(align(16))] +struct AlignContainsPacked4C { + a: Packed4C, + b: u64, +} + +// The align limit was originally smaller (2^15). +// Check that it works with big numbers. +#[repr(align(0x10000))] +struct AlignLarge { + stuff: [u8; 0x10000], +} + +union UnionContainsAlign { + a: Align16, + b: f32 +} + +impl Align16 { + // return aligned type + pub fn new(i: i32) -> Align16 { + Align16(i) + } + // pass aligned type + pub fn consume(a: Align16) -> i32 { + a.0 + } +} + +const CONST_ALIGN16: Align16 = Align16(7); +static STATIC_ALIGN16: Align16 = Align16(8); + +// Check the actual address is aligned +fn is_aligned_to(p: &T, align: usize) -> bool { + let addr = p as *const T as usize; + (addr & (align - 1)) == 0 +} + +pub fn main() { + // check alignment and size by type and value + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::size_of::(), 16); + + let a = Align16(7); + assert_eq!(a.0, 7); + assert_eq!(mem::align_of_val(&a), 16); + assert_eq!(mem::size_of_val(&a), 16); + + assert!(is_aligned_to(&a, 16)); + + // lowering should have no effect + assert_eq!(mem::align_of::(), 4); + assert_eq!(mem::size_of::(), 4); + let a = Align1(7); + assert_eq!(a.0, 7); + assert_eq!(mem::align_of_val(&a), 4); + assert_eq!(mem::size_of_val(&a), 4); + assert!(is_aligned_to(&a, 4)); + + // when multiple attributes are specified the max should be used + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::size_of::(), 16); + let a = AlignMany(7); + assert_eq!(a.0, 7); + assert_eq!(mem::align_of_val(&a), 16); + assert_eq!(mem::size_of_val(&a), 16); + assert!(is_aligned_to(&a, 16)); + + // raising alignment should not reduce size + assert_eq!(mem::align_of::(), 8); + assert_eq!(mem::size_of::(), 16); + let a = Align8Many { a: 1, b: 2, c: 3, d: 4 }; + assert_eq!(a.a, 1); + assert_eq!(mem::align_of_val(&a), 8); + assert_eq!(mem::size_of_val(&a), 16); + assert!(is_aligned_to(&a, 8)); + + // return type + let a = Align16::new(1); + assert_eq!(mem::align_of_val(&a), 16); + assert_eq!(mem::size_of_val(&a), 16); + assert_eq!(a.0, 1); + assert!(is_aligned_to(&a, 16)); + assert_eq!(Align16::consume(a), 1); + + // check const alignment, size and value + assert_eq!(mem::align_of_val(&CONST_ALIGN16), 16); + assert_eq!(mem::size_of_val(&CONST_ALIGN16), 16); + assert_eq!(CONST_ALIGN16.0, 7); + assert!(is_aligned_to(&CONST_ALIGN16, 16)); + + // check global static alignment, size and value + assert_eq!(mem::align_of_val(&STATIC_ALIGN16), 16); + assert_eq!(mem::size_of_val(&STATIC_ALIGN16), 16); + assert_eq!(STATIC_ALIGN16.0, 8); + assert!(is_aligned_to(&STATIC_ALIGN16, 16)); + + // Note that the size of Nested may change if struct field re-ordering is enabled + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::size_of::(), 48); + let a = Nested{ a: 1, b: 2, c: Align16(3), d: 4}; + assert_eq!(mem::align_of_val(&a), 16); + assert_eq!(mem::align_of_val(&a.b), 4); + assert_eq!(mem::align_of_val(&a.c), 16); + assert_eq!(mem::size_of_val(&a), 48); + assert!(is_aligned_to(&a, 16)); + // check the correct fields are indexed + assert_eq!(a.a, 1); + assert_eq!(a.b, 2); + assert_eq!(a.c.0, 3); + assert_eq!(a.d, 4); + + // enum should be aligned to max alignment + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::align_of_val(&Enum::B(Align16(0))), 16); + let e = Enum::B(Align16(15)); + match e { + Enum::B(ref a) => { + assert_eq!(a.0, 15); + assert_eq!(mem::align_of_val(a), 16); + assert_eq!(mem::size_of_val(a), 16); + }, + _ => () + } + assert!(is_aligned_to(&e, 16)); + + // check union alignment + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::size_of::(), 16); + let u = UnionContainsAlign { a: Align16(10) }; + unsafe { + assert_eq!(mem::align_of_val(&u.a), 16); + assert_eq!(mem::size_of_val(&u.a), 16); + assert_eq!(u.a.0, 10); + let UnionContainsAlign { a } = u; + assert_eq!(a.0, 10); + } + + // arrays of aligned elements should also be aligned + assert_eq!(mem::align_of::<[Align16;2]>(), 16); + assert_eq!(mem::size_of::<[Align16;2]>(), 32); + + let a = [Align16(0), Align16(1)]; + assert_eq!(mem::align_of_val(&a[0]), 16); + assert_eq!(mem::align_of_val(&a[1]), 16); + assert!(is_aligned_to(&a, 16)); + + // check heap value is aligned + assert_eq!(mem::align_of_val(Box::new(Align16(0)).as_ref()), 16); + + // check heap array is aligned + let a = vec!(Align16(0), Align16(1)); + assert_eq!(mem::align_of_val(&a[0]), 16); + assert_eq!(mem::align_of_val(&a[1]), 16); + + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::size_of::(), 16); + let a = AlignContainsPacked { a: Packed(1), b: Packed(2) }; + assert_eq!(mem::align_of_val(&a), 16); + assert_eq!(mem::align_of_val(&a.a), 1); + assert_eq!(mem::align_of_val(&a.b), 1); + assert_eq!(mem::size_of_val(&a), 16); + assert!(is_aligned_to(&a, 16)); + + assert_eq!(mem::align_of::(), 16); + assert_eq!(mem::size_of::(), 32); + let a = AlignContainsPacked4C { a: Packed4C{ a: 1, b: 2 }, b: 3 }; + assert_eq!(mem::align_of_val(&a), 16); + assert_eq!(mem::align_of_val(&a.a), 4); + assert_eq!(mem::align_of_val(&a.b), mem::align_of::()); + assert_eq!(mem::size_of_val(&a), 32); + assert!(is_aligned_to(&a, 16)); + + let mut large = box AlignLarge { + stuff: [0; 0x10000], + }; + large.stuff[0] = 132; + *large.stuff.last_mut().unwrap() = 102; + assert_eq!(large.stuff[0], 132); + assert_eq!(large.stuff.last(), Some(&102)); + assert_eq!(mem::align_of::(), 0x10000); + assert_eq!(mem::align_of_val(&*large), 0x10000); + assert!(is_aligned_to(&*large, 0x10000)); +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class.rs new file mode 100644 index 00000000000..08a13fd8bcc --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod kitties { + pub struct cat { + meows : usize, + + pub how_hungry : isize, + } + + pub fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs new file mode 100644 index 00000000000..7d147832f09 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_2.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod kitties { + pub struct cat { + meows : usize, + + pub how_hungry : isize, + + } + + impl cat { + pub fn speak(&self) {} + } + + pub fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs new file mode 100644 index 00000000000..ec1bf108dcb --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_3.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod kitties { + pub struct cat { + meows : usize, + + pub how_hungry : isize, + } + + impl cat { + pub fn speak(&mut self) { self.meows += 1; } + pub fn meow_count(&mut self) -> usize { self.meows } + } + + pub fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs new file mode 100644 index 00000000000..300cc31632e --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_4.rs @@ -0,0 +1,51 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod kitties { + pub struct cat { + meows : usize, + + pub how_hungry : isize, + pub name : String, + } + + impl cat { + pub fn speak(&mut self) { self.meow(); } + + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } else { + println!("Not hungry!"); + return false; + } + } + } + + impl cat { + pub fn meow(&mut self) { + println!("Meow"); + self.meows += 1; + if self.meows % 5 == 0 { + self.how_hungry += 1; + } + } + } + + pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs new file mode 100644 index 00000000000..c902a6c7dca --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_6.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod kitties { + + pub struct cat { + info : Vec , + meows : usize, + + pub how_hungry : isize, + } + + impl cat { + pub fn speak(&mut self, stuff: Vec ) { + self.meows += stuff.len(); + } + + pub fn meow_count(&mut self) -> usize { self.meows } + } + + pub fn cat(in_x : usize, in_y : isize, in_info: Vec ) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + info: in_info + } + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs new file mode 100644 index 00000000000..f54a39d61ef --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_cast.rs @@ -0,0 +1,60 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod kitty { + use std::fmt; + + pub struct cat { + meows : usize, + pub how_hungry : isize, + pub name : String, + } + + impl fmt::Display for cat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.name) + } + } + + impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1; + if self.meows % 5 == 0 { + self.how_hungry += 1; + } + } + + } + + impl cat { + pub fn speak(&mut self) { self.meow(); } + + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } + else { + println!("Not hungry!"); + return false; + } + } + } + + pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs b/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs new file mode 100644 index 00000000000..7ca3d7c4ac9 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/cci_class_trait.rs @@ -0,0 +1,15 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub mod animals { + pub trait noisy { + fn speak(&mut self); + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs b/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs new file mode 100644 index 00000000000..734e57a774d --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/empty-struct.rs @@ -0,0 +1,19 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct XEmpty1 {} +pub struct XEmpty2; +pub struct XEmpty7(); + +pub enum XE { + XEmpty3 {}, + XEmpty4, + XEmpty6(), +} diff --git a/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs b/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs new file mode 100644 index 00000000000..b7bde4a74a5 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub use Foo::*; + +pub enum Foo { + A, + B(isize), + C { a: isize }, +} + +impl Foo { + pub fn foo() {} +} + +pub mod nest { + pub use self::Bar::*; + + pub enum Bar { + D, + E(isize), + F { a: isize }, + } + + impl Bar { + pub fn foo() {} + } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs b/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs new file mode 100644 index 00000000000..3bf39b788db --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/namespaced_enums.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub enum Foo { + A, + B(isize), + C { a: isize }, +} + +impl Foo { + pub fn foo() {} + pub fn bar(&self) {} +} diff --git a/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs b/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs new file mode 100644 index 00000000000..be3414b7ad2 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs @@ -0,0 +1,13 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub struct Au(pub isize); diff --git a/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs b/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs new file mode 100644 index 00000000000..26941b726d4 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_type="lib"] + +pub struct S { + pub x: isize, + pub y: isize, +} diff --git a/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs b/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs new file mode 100644 index 00000000000..201f028b6b6 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs @@ -0,0 +1,18 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![crate_name="struct_variant_xc_aux"] +#![crate_type = "lib"] + +#[derive(Copy, Clone)] +pub enum Enum { + Variant(u8), + StructVariant { arg: u8 } +} diff --git a/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs b/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs new file mode 100644 index 00000000000..334f7829bd1 --- /dev/null +++ b/src/test/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs @@ -0,0 +1,16 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct S { + pub x: isize, + pub y: isize, +} + +pub type S2 = S; diff --git a/src/test/run-pass/structs-enums/borrow-tuple-fields.rs b/src/test/run-pass/structs-enums/borrow-tuple-fields.rs new file mode 100644 index 00000000000..c7f9c481579 --- /dev/null +++ b/src/test/run-pass/structs-enums/borrow-tuple-fields.rs @@ -0,0 +1,48 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo(isize, isize); + +fn main() { + let x = (1, 2); + let a = &x.0; + let b = &x.0; + assert_eq!(*a, 1); + assert_eq!(*b, 1); + + let mut x = (1, 2); + { + let a = &x.0; + let b = &mut x.1; + *b = 5; + assert_eq!(*a, 1); + } + assert_eq!(x.0, 1); + assert_eq!(x.1, 5); + + + let x = Foo(1, 2); + let a = &x.0; + let b = &x.0; + assert_eq!(*a, 1); + assert_eq!(*b, 1); + + let mut x = Foo(1, 2); + { + let a = &x.0; + let b = &mut x.1; + *b = 5; + assert_eq!(*a, 1); + } + assert_eq!(x.0, 1); + assert_eq!(x.1, 5); +} diff --git a/src/test/run-pass/structs-enums/class-attributes-1.rs b/src/test/run-pass/structs-enums/class-attributes-1.rs new file mode 100644 index 00000000000..c5926bc1586 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-attributes-1.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pp-exact - Make sure we actually print the attributes +#![feature(custom_attribute)] + +struct cat { + name: String, +} + +impl Drop for cat { + #[cat_dropper] + fn drop(&mut self) { println!("{} landed on hir feet" , self . name); } +} + + +#[cat_maker] +fn cat(name: String) -> cat { cat{name: name,} } + +pub fn main() { let _kitty = cat("Spotty".to_string()); } diff --git a/src/test/run-pass/structs-enums/class-attributes-2.rs b/src/test/run-pass/structs-enums/class-attributes-2.rs new file mode 100644 index 00000000000..f9d88de145a --- /dev/null +++ b/src/test/run-pass/structs-enums/class-attributes-2.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#![feature(custom_attribute)] + +struct cat { + name: String, +} + +impl Drop for cat { + #[cat_dropper] + /** + Actually, cats don't always land on their feet when you drop them. + */ + fn drop(&mut self) { + println!("{} landed on hir feet", self.name); + } +} + +#[cat_maker] +/** +Maybe it should technically be a kitten_maker. +*/ +fn cat(name: String) -> cat { + cat { + name: name + } +} + +pub fn main() { + let _kitty = cat("Spotty".to_string()); +} diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs b/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs new file mode 100644 index 00000000000..c28244a9f90 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_class_cast.rs + +#![feature(box_syntax)] + +extern crate cci_class_cast; + +use std::string::ToString; +use cci_class_cast::kitty::cat; + +fn print_out(thing: Box, expected: String) { + let actual = (*thing).to_string(); + println!("{}", actual); + assert_eq!(actual.to_string(), expected); +} + +pub fn main() { + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + print_out(nyan, "nyan".to_string()); +} diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs b/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs new file mode 100644 index 00000000000..e2efc146c4b --- /dev/null +++ b/src/test/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs @@ -0,0 +1,103 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +trait noisy { + fn speak(&mut self) -> isize; +} + +struct dog { + barks: usize, + + volume: isize, +} + +impl dog { + fn bark(&mut self) -> isize { + println!("Woof {} {}", self.barks, self.volume); + self.barks += 1_usize; + if self.barks % 3_usize == 0_usize { + self.volume += 1; + } + if self.barks % 10_usize == 0_usize { + self.volume -= 2; + } + println!("Grrr {} {}", self.barks, self.volume); + self.volume + } +} + +impl noisy for dog { + fn speak(&mut self) -> isize { + self.bark() + } +} + +fn dog() -> dog { + dog { + volume: 0, + barks: 0_usize + } +} + +#[derive(Clone)] +struct cat { + meows: usize, + + how_hungry: isize, + name: String, +} + +impl noisy for cat { + fn speak(&mut self) -> isize { + self.meow() as isize + } +} + +impl cat { + pub fn meow_count(&self) -> usize { + self.meows + } +} + +impl cat { + fn meow(&mut self) -> usize { + println!("Meow"); + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { + self.how_hungry += 1; + } + self.meows + } +} + +fn cat(in_x: usize, in_y: isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } +} + + +fn annoy_neighbors(critter: &mut noisy) { + for _i in 0_usize..10 { critter.speak(); } +} + +pub fn main() { + let mut nyan: cat = cat(0_usize, 2, "nyan".to_string()); + let mut whitefang: dog = dog(); + annoy_neighbors(&mut nyan); + annoy_neighbors(&mut whitefang); + assert_eq!(nyan.meow_count(), 10_usize); + assert_eq!(whitefang.volume, 1); +} diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait.rs b/src/test/run-pass/structs-enums/class-cast-to-trait.rs new file mode 100644 index 00000000000..695318d0ee7 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-cast-to-trait.rs @@ -0,0 +1,68 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// ignore-freebsd FIXME fails on BSD + + +trait noisy { + fn speak(&mut self); +} + +struct cat { + meows: usize, + how_hungry: isize, + name: String, +} + +impl noisy for cat { + fn speak(&mut self) { self.meow(); } +} + +impl cat { + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } + else { + println!("Not hungry!"); + return false; + } + } +} + +impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1; + if self.meows % 5 == 0 { + self.how_hungry += 1; + } + } +} + +fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } +} + + +pub fn main() { + let mut nyan = cat(0, 2, "nyan".to_string()); + let mut nyan: &mut noisy = &mut nyan; + nyan.speak(); +} diff --git a/src/test/run-pass/structs-enums/class-dtor.rs b/src/test/run-pass/structs-enums/class-dtor.rs new file mode 100644 index 00000000000..13559906795 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-dtor.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct cat { + done : extern fn(usize), + meows : usize, +} + +impl Drop for cat { + fn drop(&mut self) { + (self.done)(self.meows); + } +} + +fn cat(done: extern fn(usize)) -> cat { + cat { + meows: 0, + done: done + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/class-exports.rs b/src/test/run-pass/structs-enums/class-exports.rs new file mode 100644 index 00000000000..b4bce42e647 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-exports.rs @@ -0,0 +1,40 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +/* Test that exporting a class also exports its + public fields and methods */ + +use kitty::cat; + +mod kitty { + pub struct cat { + meows: usize, + name: String, + } + + impl cat { + pub fn get_name(&self) -> String { self.name.clone() } + } + + pub fn cat(in_name: String) -> cat { + cat { + name: in_name, + meows: 0 + } + } +} + +pub fn main() { + assert_eq!(cat("Spreckles".to_string()).get_name(), + "Spreckles".to_string()); +} diff --git a/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs b/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs new file mode 100644 index 00000000000..6ceaab93e79 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs @@ -0,0 +1,116 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::cmp; + +#[derive(Copy, Clone, Debug)] +enum cat_type { tuxedo, tabby, tortoiseshell } + +impl cmp::PartialEq for cat_type { + fn eq(&self, other: &cat_type) -> bool { + ((*self) as usize) == ((*other) as usize) + } + fn ne(&self, other: &cat_type) -> bool { !(*self).eq(other) } +} + +// Very silly -- this just returns the value of the name field +// for any isize value that's less than the meows field + +// ok: T should be in scope when resolving the trait ref for map +struct cat { + // Yes, you can have negative meows + meows : isize, + + how_hungry : isize, + name : T, +} + +impl cat { + pub fn speak(&mut self) { self.meow(); } + + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } else { + println!("Not hungry!"); + return false; + } + } + fn len(&self) -> usize { self.meows as usize } + fn is_empty(&self) -> bool { self.meows == 0 } + fn clear(&mut self) {} + fn contains_key(&self, k: &isize) -> bool { *k <= self.meows } + + fn find(&self, k: &isize) -> Option<&T> { + if *k <= self.meows { + Some(&self.name) + } else { + None + } + } + fn insert(&mut self, k: isize, _: T) -> bool { + self.meows += k; + true + } + + fn find_mut(&mut self, _k: &isize) -> Option<&mut T> { panic!() } + + fn remove(&mut self, k: &isize) -> bool { + if self.find(k).is_some() { + self.meows -= *k; true + } else { + false + } + } + + fn pop(&mut self, _k: &isize) -> Option { panic!() } + + fn swap(&mut self, _k: isize, _v: T) -> Option { panic!() } +} + +impl cat { + pub fn get(&self, k: &isize) -> &T { + match self.find(k) { + Some(v) => { v } + None => { panic!("epic fail"); } + } + } + + pub fn new(in_x: isize, in_y: isize, in_name: T) -> cat { + cat{meows: in_x, how_hungry: in_y, name: in_name } + } +} + +impl cat { + fn meow(&mut self) { + self.meows += 1; + println!("Meow {}", self.meows); + if self.meows % 5 == 0 { + self.how_hungry += 1; + } + } +} + +pub fn main() { + let mut nyan: cat = cat::new(0, 2, "nyan".to_string()); + for _ in 1_usize..5 { nyan.speak(); } + assert_eq!(*nyan.find(&1).unwrap(), "nyan".to_string()); + assert_eq!(nyan.find(&10), None); + let mut spotty: cat = cat::new(2, 57, cat_type::tuxedo); + for _ in 0_usize..6 { spotty.speak(); } + assert_eq!(spotty.len(), 8); + assert!((spotty.contains_key(&2))); + assert_eq!(spotty.get(&3), &cat_type::tuxedo); +} diff --git a/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs b/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs new file mode 100644 index 00000000000..4f319cf8ea4 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs @@ -0,0 +1,68 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// aux-build:cci_class_trait.rs +extern crate cci_class_trait; +use cci_class_trait::animals::noisy; + +struct cat { + meows: usize, + + how_hungry : isize, + name : String, +} + +impl cat { + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } + else { + println!("Not hungry!"); + return false; + } + } +} + +impl noisy for cat { + fn speak(&mut self) { self.meow(); } +} + +impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { + self.how_hungry += 1; + } + } +} + +fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } +} + + +pub fn main() { + let mut nyan = cat(0_usize, 2, "nyan".to_string()); + nyan.eat(); + assert!((!nyan.eat())); + for _ in 1_usize..10_usize { nyan.speak(); }; + assert!((nyan.eat())); +} diff --git a/src/test/run-pass/structs-enums/class-implement-traits.rs b/src/test/run-pass/structs-enums/class-implement-traits.rs new file mode 100644 index 00000000000..e582940c1e4 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-implement-traits.rs @@ -0,0 +1,73 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +trait noisy { + fn speak(&mut self); +} + +#[derive(Clone)] +struct cat { + meows : usize, + + how_hungry : isize, + name : String, +} + +impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { + self.how_hungry += 1; + } + } +} + +impl cat { + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } else { + println!("Not hungry!"); + return false; + } + } +} + +impl noisy for cat { + fn speak(&mut self) { self.meow(); } +} + +fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name.clone() + } +} + + +fn make_speak(mut c: C) { + c.speak(); +} + +pub fn main() { + let mut nyan = cat(0_usize, 2, "nyan".to_string()); + nyan.eat(); + assert!((!nyan.eat())); + for _ in 1_usize..10_usize { + make_speak(nyan.clone()); + } +} diff --git a/src/test/run-pass/structs-enums/class-method-cross-crate.rs b/src/test/run-pass/structs-enums/class-method-cross-crate.rs new file mode 100644 index 00000000000..010f735beee --- /dev/null +++ b/src/test/run-pass/structs-enums/class-method-cross-crate.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_class_2.rs + +extern crate cci_class_2; +use cci_class_2::kitties::cat; + +pub fn main() { + let nyan : cat = cat(52, 99); + let kitty = cat(1000, 2); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); + nyan.speak(); +} diff --git a/src/test/run-pass/structs-enums/class-methods-cross-crate.rs b/src/test/run-pass/structs-enums/class-methods-cross-crate.rs new file mode 100644 index 00000000000..ca4a783b70a --- /dev/null +++ b/src/test/run-pass/structs-enums/class-methods-cross-crate.rs @@ -0,0 +1,24 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_class_3.rs + +extern crate cci_class_3; +use cci_class_3::kitties::cat; + +pub fn main() { + let mut nyan : cat = cat(52, 99); + let kitty = cat(1000, 2); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); + nyan.speak(); + assert_eq!(nyan.meow_count(), 53); +} diff --git a/src/test/run-pass/structs-enums/class-methods.rs b/src/test/run-pass/structs-enums/class-methods.rs new file mode 100644 index 00000000000..8cc6025dc43 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-methods.rs @@ -0,0 +1,40 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +struct cat { + meows : usize, + + how_hungry : isize, +} + +impl cat { + pub fn speak(&mut self) { self.meows += 1; } + pub fn meow_count(&mut self) -> usize { self.meows } +} + +fn cat(in_x: usize, in_y: isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } +} + +pub fn main() { + let mut nyan: cat = cat(52, 99); + let kitty = cat(1000, 2); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); + nyan.speak(); + assert_eq!(nyan.meow_count(), 53); +} diff --git a/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs b/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs new file mode 100644 index 00000000000..7ee98125148 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-poly-methods-cross-crate.rs @@ -0,0 +1,26 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_class_6.rs + +extern crate cci_class_6; +use cci_class_6::kitties::cat; + +pub fn main() { + let mut nyan : cat = cat::(52_usize, 99, vec!['p']); + let mut kitty = cat(1000_usize, 2, vec!["tabby".to_string()]); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); + nyan.speak(vec![1_usize,2_usize,3_usize]); + assert_eq!(nyan.meow_count(), 55_usize); + kitty.speak(vec!["meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string()]); + assert_eq!(kitty.meow_count(), 1004_usize); +} diff --git a/src/test/run-pass/structs-enums/class-poly-methods.rs b/src/test/run-pass/structs-enums/class-poly-methods.rs new file mode 100644 index 00000000000..e32ba9d0239 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-poly-methods.rs @@ -0,0 +1,46 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +struct cat { + info : Vec , + meows : usize, + + how_hungry : isize, +} + +impl cat { + pub fn speak(&mut self, stuff: Vec ) { + self.meows += stuff.len(); + } + pub fn meow_count(&mut self) -> usize { self.meows } +} + +fn cat(in_x : usize, in_y : isize, in_info: Vec ) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + info: in_info + } +} + +pub fn main() { + let mut nyan : cat = cat::(52, 99, vec![9]); + let mut kitty = cat(1000, 2, vec!["tabby".to_string()]); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); + nyan.speak(vec![1,2,3]); + assert_eq!(nyan.meow_count(), 55); + kitty.speak(vec!["meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string()]); + assert_eq!(kitty.meow_count(), 1004); +} diff --git a/src/test/run-pass/structs-enums/class-separate-impl.rs b/src/test/run-pass/structs-enums/class-separate-impl.rs new file mode 100644 index 00000000000..a1c9afaa634 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-separate-impl.rs @@ -0,0 +1,74 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#![feature(box_syntax)] + +use std::fmt; + +struct cat { + meows : usize, + + how_hungry : isize, + name : String, +} + +impl cat { + pub fn speak(&mut self) { self.meow(); } + + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } + else { + println!("Not hungry!"); + return false; + } + } +} + +impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1; + if self.meows % 5 == 0 { + self.how_hungry += 1; + } + } +} + +fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } +} + +impl fmt::Display for cat { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + write!(f, "{}", self.name) + } +} + +fn print_out(thing: Box, expected: String) { + let actual = (*thing).to_string(); + println!("{}", actual); + assert_eq!(actual.to_string(), expected); +} + +pub fn main() { + let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; + print_out(nyan, "nyan".to_string()); +} diff --git a/src/test/run-pass/structs-enums/class-str-field.rs b/src/test/run-pass/structs-enums/class-str-field.rs new file mode 100644 index 00000000000..5ad60dfd6d9 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-str-field.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +struct cat { + + name : String, + +} + +fn cat(in_name: String) -> cat { + cat { + name: in_name + } +} + +pub fn main() { + let _nyan = cat("nyan".to_string()); +} diff --git a/src/test/run-pass/structs-enums/class-typarams.rs b/src/test/run-pass/structs-enums/class-typarams.rs new file mode 100644 index 00000000000..d3b4083f843 --- /dev/null +++ b/src/test/run-pass/structs-enums/class-typarams.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +use std::marker::PhantomData; + +struct cat { + meows : usize, + how_hungry : isize, + m: PhantomData +} + +impl cat { + pub fn speak(&mut self) { self.meows += 1; } + pub fn meow_count(&mut self) -> usize { self.meows } +} + +fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + m: PhantomData + } +} + + +pub fn main() { + let _nyan : cat = cat::(52, 99); + // let mut kitty = cat(1000, 2); +} diff --git a/src/test/run-pass/structs-enums/classes-cross-crate.rs b/src/test/run-pass/structs-enums/classes-cross-crate.rs new file mode 100644 index 00000000000..c9cc609e8a1 --- /dev/null +++ b/src/test/run-pass/structs-enums/classes-cross-crate.rs @@ -0,0 +1,23 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_class_4.rs + +extern crate cci_class_4; +use cci_class_4::kitties::cat; + +pub fn main() { + let mut nyan = cat(0_usize, 2, "nyan".to_string()); + nyan.eat(); + assert!((!nyan.eat())); + for _ in 1_usize..10_usize { nyan.speak(); }; + assert!((nyan.eat())); +} diff --git a/src/test/run-pass/structs-enums/classes-self-referential.rs b/src/test/run-pass/structs-enums/classes-self-referential.rs new file mode 100644 index 00000000000..49016d14b9d --- /dev/null +++ b/src/test/run-pass/structs-enums/classes-self-referential.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +// pretty-expanded FIXME #23616 + +struct kitten { + cat: Option, +} + +fn kitten(cat: Option) -> kitten { + kitten { + cat: cat + } +} + +type cat = Box; + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs b/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs new file mode 100644 index 00000000000..c90ae80036f --- /dev/null +++ b/src/test/run-pass/structs-enums/classes-simple-cross-crate.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:cci_class.rs + +extern crate cci_class; +use cci_class::kitties::cat; + +pub fn main() { + let nyan : cat = cat(52, 99); + let kitty = cat(1000, 2); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); +} diff --git a/src/test/run-pass/structs-enums/classes-simple-method.rs b/src/test/run-pass/structs-enums/classes-simple-method.rs new file mode 100644 index 00000000000..6eaf8939dcc --- /dev/null +++ b/src/test/run-pass/structs-enums/classes-simple-method.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct cat { + meows : usize, + + how_hungry : isize, +} + +impl cat { + pub fn speak(&mut self) {} +} + +fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } +} + +pub fn main() { + let mut nyan : cat = cat(52, 99); + let kitty = cat(1000, 2); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); + nyan.speak(); +} diff --git a/src/test/run-pass/structs-enums/classes-simple.rs b/src/test/run-pass/structs-enums/classes-simple.rs new file mode 100644 index 00000000000..771943802aa --- /dev/null +++ b/src/test/run-pass/structs-enums/classes-simple.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct cat { + meows : usize, + + how_hungry : isize, +} + +fn cat(in_x : usize, in_y : isize) -> cat { + cat { + meows: in_x, + how_hungry: in_y + } +} + +pub fn main() { + let nyan : cat = cat(52, 99); + let kitty = cat(1000, 2); + assert_eq!(nyan.how_hungry, 99); + assert_eq!(kitty.how_hungry, 2); +} diff --git a/src/test/run-pass/structs-enums/classes.rs b/src/test/run-pass/structs-enums/classes.rs new file mode 100644 index 00000000000..f40fe3e8186 --- /dev/null +++ b/src/test/run-pass/structs-enums/classes.rs @@ -0,0 +1,60 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct cat { + meows : usize, + + how_hungry : isize, + name : String, +} + +impl cat { + pub fn speak(&mut self) { self.meow(); } + + pub fn eat(&mut self) -> bool { + if self.how_hungry > 0 { + println!("OM NOM NOM"); + self.how_hungry -= 2; + return true; + } else { + println!("Not hungry!"); + return false; + } + } +} + +impl cat { + fn meow(&mut self) { + println!("Meow"); + self.meows += 1_usize; + if self.meows % 5_usize == 0_usize { + self.how_hungry += 1; + } + } +} + +fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { + cat { + meows: in_x, + how_hungry: in_y, + name: in_name + } +} + +pub fn main() { + let mut nyan = cat(0_usize, 2, "nyan".to_string()); + nyan.eat(); + assert!((!nyan.eat())); + for _ in 1_usize..10_usize { nyan.speak(); }; + assert!((nyan.eat())); +} diff --git a/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs b/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs new file mode 100644 index 00000000000..3d75786654d --- /dev/null +++ b/src/test/run-pass/structs-enums/codegen-tag-static-padding.rs @@ -0,0 +1,69 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Issue #13186 + +// For simplicity of explanations assuming code is compiled for x86_64 +// Linux ABI. + +// Size of TestOption is 16, and alignment of TestOption is 8. +// Size of u8 is 1, and alignment of u8 is 1. +// So size of Request is 24, and alignment of Request must be 8: +// the maximum alignment of its fields. +// Last 7 bytes of Request struct are not occupied by any fields. + + + +enum TestOption { + TestNone, + TestSome(T), +} + +pub struct Request { + foo: TestOption, + bar: u8, +} + +fn default_instance() -> &'static Request { + static instance: Request = Request { + // LLVM does not allow to specify alignment of expressions, thus + // alignment of `foo` in constant is 1, not 8. + foo: TestOption::TestNone, + bar: 17, + // Space after last field is not occupied by any data, but it is + // reserved to make struct aligned properly. If compiler does + // not insert padding after last field when emitting constant, + // size of struct may be not equal to size of struct, and + // compiler crashes in internal assertion check. + }; + &instance +} + +fn non_default_instance() -> &'static Request { + static instance: Request = Request { + foo: TestOption::TestSome(0x1020304050607080), + bar: 19, + }; + &instance +} + +pub fn main() { + match default_instance() { + &Request { foo: TestOption::TestNone, bar: 17 } => {}, + _ => panic!(), + }; + match non_default_instance() { + &Request { foo: TestOption::TestSome(0x1020304050607080), bar: 19 } => {}, + _ => panic!(), + }; +} diff --git a/src/test/run-pass/structs-enums/compare-generic-enums.rs b/src/test/run-pass/structs-enums/compare-generic-enums.rs new file mode 100644 index 00000000000..60d6cd2746b --- /dev/null +++ b/src/test/run-pass/structs-enums/compare-generic-enums.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +type an_int = isize; + +fn cmp(x: Option, y: Option) -> bool { + x == y +} + +pub fn main() { + assert!(!cmp(Some(3), None)); + assert!(!cmp(Some(3), Some(4))); + assert!(cmp(Some(3), Some(3))); + assert!(cmp(None, None)); +} diff --git a/src/test/run-pass/structs-enums/discrim-explicit-23030.rs b/src/test/run-pass/structs-enums/discrim-explicit-23030.rs new file mode 100644 index 00000000000..73053131865 --- /dev/null +++ b/src/test/run-pass/structs-enums/discrim-explicit-23030.rs @@ -0,0 +1,157 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue 23030: Workaround overflowing discriminant +// with explicit assignments. + +// See also compile-fail/overflow-discrim.rs, which shows what +// happens if you leave the OhNo explicit cases out here. + +use std::{i8,u8,i16,u16,i32,u32,i64,u64,isize,usize}; + +fn f_i8() { + #[repr(i8)] + enum A { + Ok = i8::MAX - 1, + Ok2, + OhNo = i8::MIN, + NotTheEnd = -1, + Zero, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); + let z = (A::NotTheEnd, A::Zero).1 as i8; + assert_eq!(z, 0); +} + +fn f_u8() { + #[repr(u8)] + enum A { + Ok = u8::MAX - 1, + Ok2, + OhNo = u8::MIN, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); +} + +fn f_i16() { + #[repr(i16)] + enum A { + Ok = i16::MAX - 1, + Ok2, + OhNo = i16::MIN, + NotTheEnd = -1, + Zero, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); + let z = (A::NotTheEnd, A::Zero).1 as i16; + assert_eq!(z, 0); +} + +fn f_u16() { + #[repr(u16)] + enum A { + Ok = u16::MAX - 1, + Ok2, + OhNo = u16::MIN, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); +} + +fn f_i32() { + #[repr(i32)] + enum A { + Ok = i32::MAX - 1, + Ok2, + OhNo = i32::MIN, + NotTheEnd = -1, + Zero, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); + let z = (A::NotTheEnd, A::Zero).1 as i32; + assert_eq!(z, 0); +} + +fn f_u32() { + #[repr(u32)] + enum A { + Ok = u32::MAX - 1, + Ok2, + OhNo = u32::MIN, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); +} + +fn f_i64() { + #[repr(i64)] + enum A { + Ok = i64::MAX - 1, + Ok2, + OhNo = i64::MIN, + NotTheEnd = -1, + Zero, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); + let z = (A::NotTheEnd, A::Zero).1 as i64; + assert_eq!(z, 0); +} + +fn f_u64() { + #[repr(u64)] + enum A { + Ok = u64::MAX - 1, + Ok2, + OhNo = u64::MIN, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); +} + +fn f_isize() { + #[repr(isize)] + enum A { + Ok = isize::MAX - 1, + Ok2, + OhNo = isize::MIN, + NotTheEnd = -1, + Zero, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); + let z = (A::NotTheEnd, A::Zero).1 as isize; + assert_eq!(z, 0); +} + +fn f_usize() { + #[repr(usize)] + enum A { + Ok = usize::MAX - 1, + Ok2, + OhNo = usize::MIN, + } + + let _x = (A::Ok, A::Ok2, A::OhNo); +} + +fn main() { + f_i8(); f_u8(); + f_i16(); f_u16(); + f_i32(); f_u32(); + f_i64(); f_u64(); + + f_isize(); f_usize(); +} diff --git a/src/test/run-pass/structs-enums/empty-struct-braces.rs b/src/test/run-pass/structs-enums/empty-struct-braces.rs new file mode 100644 index 00000000000..7deb90cc3e8 --- /dev/null +++ b/src/test/run-pass/structs-enums/empty-struct-braces.rs @@ -0,0 +1,222 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Empty struct defined with braces add names into type namespace +// Empty struct defined without braces add names into both type and value namespaces + +// aux-build:empty-struct.rs + +extern crate empty_struct; +use empty_struct::*; + +struct Empty1 {} +struct Empty2; +struct Empty7(); + +#[derive(PartialEq, Eq)] +struct Empty3 {} + +const Empty3: Empty3 = Empty3 {}; + +enum E { + Empty4 {}, + Empty5, + Empty6(), +} + +fn local() { + let e1: Empty1 = Empty1 {}; + let e2: Empty2 = Empty2 {}; + let e2: Empty2 = Empty2; + let e3: Empty3 = Empty3 {}; + let e3: Empty3 = Empty3; + let e4: E = E::Empty4 {}; + let e5: E = E::Empty5 {}; + let e5: E = E::Empty5; + let e6: E = E::Empty6 {}; + let e6: E = E::Empty6(); + let ctor6: fn() -> E = E::Empty6; + let e7: Empty7 = Empty7 {}; + let e7: Empty7 = Empty7(); + let ctor7: fn() -> Empty7 = Empty7; + + match e1 { + Empty1 {} => {} + } + match e2 { + Empty2 {} => {} + } + match e3 { + Empty3 {} => {} + } + match e4 { + E::Empty4 {} => {} + _ => {} + } + match e5 { + E::Empty5 {} => {} + _ => {} + } + match e6 { + E::Empty6 {} => {} + _ => {} + } + match e7 { + Empty7 {} => {} + } + + match e1 { + Empty1 { .. } => {} + } + match e2 { + Empty2 { .. } => {} + } + match e3 { + Empty3 { .. } => {} + } + match e4 { + E::Empty4 { .. } => {} + _ => {} + } + match e5 { + E::Empty5 { .. } => {} + _ => {} + } + match e6 { + E::Empty6 { .. } => {} + _ => {} + } + match e7 { + Empty7 { .. } => {} + } + + match e2 { + Empty2 => {} + } + match e3 { + Empty3 => {} + } + match e5 { + E::Empty5 => {} + _ => {} + } + match e6 { + E::Empty6() => {} + _ => {} + } + match e6 { + E::Empty6(..) => {} + _ => {} + } + match e7 { + Empty7() => {} + } + match e7 { + Empty7(..) => {} + } + + let e11: Empty1 = Empty1 { ..e1 }; + let e22: Empty2 = Empty2 { ..e2 }; + let e33: Empty3 = Empty3 { ..e3 }; + let e77: Empty7 = Empty7 { ..e7 }; +} + +fn xcrate() { + let e1: XEmpty1 = XEmpty1 {}; + let e2: XEmpty2 = XEmpty2 {}; + let e2: XEmpty2 = XEmpty2; + let e3: XE = XE::XEmpty3 {}; + let e4: XE = XE::XEmpty4 {}; + let e4: XE = XE::XEmpty4; + let e6: XE = XE::XEmpty6 {}; + let e6: XE = XE::XEmpty6(); + let ctor6: fn() -> XE = XE::XEmpty6; + let e7: XEmpty7 = XEmpty7 {}; + let e7: XEmpty7 = XEmpty7(); + let ctor7: fn() -> XEmpty7 = XEmpty7; + + match e1 { + XEmpty1 {} => {} + } + match e2 { + XEmpty2 {} => {} + } + match e3 { + XE::XEmpty3 {} => {} + _ => {} + } + match e4 { + XE::XEmpty4 {} => {} + _ => {} + } + match e6 { + XE::XEmpty6 {} => {} + _ => {} + } + match e7 { + XEmpty7 {} => {} + } + + match e1 { + XEmpty1 { .. } => {} + } + match e2 { + XEmpty2 { .. } => {} + } + match e3 { + XE::XEmpty3 { .. } => {} + _ => {} + } + match e4 { + XE::XEmpty4 { .. } => {} + _ => {} + } + match e6 { + XE::XEmpty6 { .. } => {} + _ => {} + } + match e7 { + XEmpty7 { .. } => {} + } + + match e2 { + XEmpty2 => {} + } + match e4 { + XE::XEmpty4 => {} + _ => {} + } + match e6 { + XE::XEmpty6() => {} + _ => {} + } + match e6 { + XE::XEmpty6(..) => {} + _ => {} + } + match e7 { + XEmpty7() => {} + } + match e7 { + XEmpty7(..) => {} + } + + let e11: XEmpty1 = XEmpty1 { ..e1 }; + let e22: XEmpty2 = XEmpty2 { ..e2 }; + let e77: XEmpty7 = XEmpty7 { ..e7 }; +} + +fn main() { + local(); + xcrate(); +} diff --git a/src/test/run-pass/structs-enums/empty-tag.rs b/src/test/run-pass/structs-enums/empty-tag.rs new file mode 100644 index 00000000000..eab02fd5741 --- /dev/null +++ b/src/test/run-pass/structs-enums/empty-tag.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#[derive(Copy, Clone, Debug)] +enum chan { chan_t, } + +impl PartialEq for chan { + fn eq(&self, other: &chan) -> bool { + ((*self) as usize) == ((*other) as usize) + } + fn ne(&self, other: &chan) -> bool { !(*self).eq(other) } +} + +fn wrapper3(i: chan) { + assert_eq!(i, chan::chan_t); +} + +pub fn main() { + let wrapped = {||wrapper3(chan::chan_t)}; + wrapped(); +} diff --git a/src/test/run-pass/structs-enums/enum-alignment.rs b/src/test/run-pass/structs-enums/enum-alignment.rs new file mode 100644 index 00000000000..862025ea934 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-alignment.rs @@ -0,0 +1,33 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +use std::mem; + +fn addr_of(ptr: &T) -> usize { + ptr as *const T as usize +} + +fn is_aligned(ptr: &T) -> bool { + unsafe { + let addr: usize = mem::transmute(ptr); + (addr % mem::min_align_of::()) == 0 + } +} + +pub fn main() { + let x = Some(0u64); + match x { + None => panic!(), + Some(ref y) => assert!(is_aligned(y)) + } +} diff --git a/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs b/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs new file mode 100644 index 00000000000..838db705817 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs @@ -0,0 +1,42 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +/*! + * C-like enums have to be represented as LLVM ints, not wrapped in a + * struct, because it's important for the FFI that they interoperate + * with C integers/enums, and the ABI can treat structs differently. + * For example, on i686-linux-gnu, a struct return value is passed by + * storing to a hidden out parameter, whereas an integer would be + * returned in a register. + * + * This test just checks that the ABIs for the enum and the plain + * integer are compatible, rather than actually calling C code. + * The unused parameter to `foo` is to increase the likelihood of + * crashing if something goes wrong here. + */ + +#[repr(u32)] +enum Foo { + A = 0, + B = 23 +} + +#[inline(never)] +extern "C" fn foo(_x: usize) -> Foo { Foo::B } + +pub fn main() { + unsafe { + let f: extern "C" fn(usize) -> u32 = + ::std::mem::transmute(foo as extern "C" fn(usize) -> Foo); + assert_eq!(f(0xDEADBEEF), Foo::B as u32); + } +} diff --git a/src/test/run-pass/structs-enums/enum-discr.rs b/src/test/run-pass/structs-enums/enum-discr.rs new file mode 100644 index 00000000000..0962f41f78d --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-discr.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +enum Animal { + Cat = 0, + Dog = 1, + Horse = 2, + Snake = 3, +} + +enum Hero { + Batman = -1, + Superman = -2, + Ironman = -3, + Spiderman = -4 +} + +pub fn main() { + let pet: Animal = Animal::Snake; + let hero: Hero = Hero::Superman; + assert_eq!(pet as usize, 3); + assert_eq!(hero as isize, -2); +} diff --git a/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs b/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs new file mode 100644 index 00000000000..55bf80138b9 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs @@ -0,0 +1,62 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +use std::mem::size_of; + +enum Ei8 { + Ai8 = -1, + Bi8 = 0 +} + +enum Eu8 { + Au8 = 0, + Bu8 = 0x80 +} + +enum Ei16 { + Ai16 = -1, + Bi16 = 0x80 +} + +enum Eu16 { + Au16 = 0, + Bu16 = 0x8000 +} + +enum Ei32 { + Ai32 = -1, + Bi32 = 0x8000 +} + +enum Eu32 { + Au32 = 0, + Bu32 = 0x8000_0000 +} + +enum Ei64 { + Ai64 = -1, + Bi64 = 0x8000_0000 +} + +pub fn main() { + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 2); + assert_eq!(size_of::(), 2); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 4); + #[cfg(target_pointer_width = "64")] + assert_eq!(size_of::(), 8); + #[cfg(target_pointer_width = "32")] + assert_eq!(size_of::(), 4); +} diff --git a/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs b/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs new file mode 100644 index 00000000000..b4f8b5427e0 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs @@ -0,0 +1,120 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem::{size_of, align_of}; + +#[repr(i8)] +enum Ei8 { + Ai8 = 0, + Bi8 = 1 +} + +#[repr(u8)] +enum Eu8 { + Au8 = 0, + Bu8 = 1 +} + +#[repr(i16)] +enum Ei16 { + Ai16 = 0, + Bi16 = 1 +} + +#[repr(u16)] +enum Eu16 { + Au16 = 0, + Bu16 = 1 +} + +#[repr(i32)] +enum Ei32 { + Ai32 = 0, + Bi32 = 1 +} + +#[repr(u32)] +enum Eu32 { + Au32 = 0, + Bu32 = 1 +} + +#[repr(i64)] +enum Ei64 { + Ai64 = 0, + Bi64 = 1 +} + +#[repr(u64)] +enum Eu64 { + Au64 = 0, + Bu64 = 1 +} + +#[repr(isize)] +enum Eint { + Aint = 0, + Bint = 1 +} + +#[repr(usize)] +enum Euint { + Auint = 0, + Buint = 1 +} + +#[repr(u8)] +enum Eu8NonCLike { + _None, + _Some(T), +} + +#[repr(i64)] +enum Ei64NonCLike { + _None, + _Some(T), +} + +#[repr(u64)] +enum Eu64NonCLike { + _None, + _Some(T), +} + +pub fn main() { + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 1); + assert_eq!(size_of::(), 2); + assert_eq!(size_of::(), 2); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 4); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), 8); + assert_eq!(size_of::(), size_of::()); + assert_eq!(size_of::(), size_of::()); + assert_eq!(size_of::>(), 1); + assert_eq!(size_of::>(), 8); + assert_eq!(size_of::>(), 8); + let u8_expected_size = round_up(9, align_of::>()); + assert_eq!(size_of::>(), u8_expected_size); + let array_expected_size = round_up(28, align_of::>()); + assert_eq!(size_of::>(), array_expected_size); + assert_eq!(size_of::>(), 32); + + assert_eq!(align_of::(), align_of::()); + assert_eq!(align_of::>(), align_of::()); +} + +// Rounds x up to the next multiple of a +fn round_up(x: usize, a: usize) -> usize { + ((x + (a - 1)) / a) * a +} diff --git a/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs b/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs new file mode 100644 index 00000000000..731cb003776 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-discrim-range-overflow.rs @@ -0,0 +1,36 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] + +// pretty-expanded FIXME #23616 + +pub enum E64 { + H64 = 0x7FFF_FFFF_FFFF_FFFF, + L64 = 0x8000_0000_0000_0000 +} +pub enum E32 { + H32 = 0x7FFF_FFFF, + L32 = 0x8000_0000 +} + +pub fn f(e64: E64, e32: E32) -> (bool,bool) { + (match e64 { + E64::H64 => true, + E64::L64 => false + }, + match e32 { + E32::H32 => true, + E32::L32 => false + }) +} + +pub fn main() { } diff --git a/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs b/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs new file mode 100644 index 00000000000..6b38de6f6b3 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-discrim-width-stuff.rs @@ -0,0 +1,54 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(overflowing_literals)] +#![allow(dead_code)] + +macro_rules! check { + ($m:ident, $t:ty, $v:expr) => {{ + mod $m { + use std::mem::size_of; + #[derive(Copy, Clone, Debug)] + enum E { + V = $v, + A = 0 + } + static C: E = E::V; + pub fn check() { + assert_eq!(size_of::(), size_of::<$t>()); + assert_eq!(E::V as $t, $v as $t); + assert_eq!(C as $t, $v as $t); + assert_eq!(format!("{:?}", E::V), "V".to_string()); + assert_eq!(format!("{:?}", C), "V".to_string()); + } + } + $m::check(); + }} +} + +pub fn main() { + check!(a, u8, 0x17); + check!(b, u8, 0xe8); + check!(c, u16, 0x1727); + check!(d, u16, 0xe8d8); + check!(e, u32, 0x17273747); + check!(f, u32, 0xe8d8c8b8); + + check!(z, i8, 0x17); + check!(y, i8, -0x17); + check!(x, i16, 0x1727); + check!(w, i16, -0x1727); + check!(v, i32, 0x17273747); + check!(u, i32, -0x17273747); + + enum Simple { A, B } + assert_eq!(::std::mem::size_of::(), 1); +} diff --git a/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs b/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs new file mode 100644 index 00000000000..5c02bf28884 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-disr-val-pretty.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +// pp-exact + + +enum color { red = 1, green, blue, imaginary = -1, } + +pub fn main() { + test_color(color::red, 1, "red".to_string()); + test_color(color::green, 2, "green".to_string()); + test_color(color::blue, 3, "blue".to_string()); + test_color(color::imaginary, -1, "imaginary".to_string()); +} + +fn test_color(color: color, val: isize, _name: String) { + assert_eq!(color as isize , val); +} diff --git a/src/test/run-pass/structs-enums/enum-export-inheritance.rs b/src/test/run-pass/structs-enums/enum-export-inheritance.rs new file mode 100644 index 00000000000..050479d28dc --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-export-inheritance.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod a { + pub enum Foo { + Bar, + Baz, + Boo + } +} + +pub fn main() { + let _x = a::Foo::Bar; +} diff --git a/src/test/run-pass/structs-enums/enum-layout-optimization.rs b/src/test/run-pass/structs-enums/enum-layout-optimization.rs new file mode 100644 index 00000000000..fcc5cc07996 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-layout-optimization.rs @@ -0,0 +1,60 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we will do various size optimizations to enum layout, but +// *not* if `#[repr(u8)]` or `#[repr(C)]` is passed. See also #40029. + +#![allow(dead_code)] + +use std::mem; + +enum Nullable { + Alive(T), + Dropped, +} + +#[repr(u8)] +enum NullableU8 { + Alive(T), + Dropped, +} + +#[repr(C)] +enum NullableC { + Alive(T), + Dropped, +} + +struct StructNewtype(T); + +#[repr(C)] +struct StructNewtypeC(T); + +enum EnumNewtype { Variant(T) } + +#[repr(u8)] +enum EnumNewtypeU8 { Variant(T) } + +#[repr(C)] +enum EnumNewtypeC { Variant(T) } + +fn main() { + assert!(mem::size_of::>() == mem::size_of::>>()); + assert!(mem::size_of::>() < mem::size_of::>>()); + assert!(mem::size_of::>() < mem::size_of::>>()); + + assert!(mem::size_of::() == mem::size_of::>()); + assert!(mem::size_of::() == mem::size_of::>()); + + assert!(mem::size_of::() == mem::size_of::>()); + assert!(mem::size_of::() < mem::size_of::>()); + assert!(mem::size_of::() < mem::size_of::>()); +} diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs new file mode 100644 index 00000000000..14eac687ecf --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs @@ -0,0 +1,178 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test deserializes an enum in-place by transmuting to a union that +// should have the same layout, and manipulating the tag and payloads +// independently. This verifies that `repr(some_int)` has a stable representation, +// and that we don't miscompile these kinds of manipulations. + +use std::time::Duration; +use std::mem; + +#[repr(C, u8)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +enum MyEnum { + A(u32), // Single primitive value + B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct +} + +#[repr(C)] +struct MyEnumRepr { + tag: MyEnumTag, + payload: MyEnumPayload, +} + +#[repr(C)] +#[allow(non_snake_case)] +union MyEnumPayload { + A: MyEnumVariantA, + B: MyEnumVariantB, + D: MyEnumVariantD, + E: MyEnumVariantE, +} + +#[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); + +fn main() { + let result: Vec> = vec![ + Ok(MyEnum::A(17)), + Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::C), + Err(()), + Ok(MyEnum::D(Some(407))), + Ok(MyEnum::D(None)), + Ok(MyEnum::E(Duration::from_secs(100))), + Err(()), + ]; + + // Binary serialized version of the above (little-endian) + let input: Vec = vec![ + 0, 17, 0, 0, 0, + 1, 206, 121, 4, + 2, + 8, /* invalid tag value */ + 3, 0, 151, 1, 0, 0, + 3, 1, + 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, /* incomplete value */ + ]; + + let mut output = vec![]; + let mut buf = &input[..]; + + unsafe { + // This should be safe, because we don't match on it unless it's fully formed, + // and it doesn't have a destructor. + let mut dest: MyEnum = mem::uninitialized(); + while buf.len() > 0 { + match parse_my_enum(&mut dest, &mut buf) { + Ok(()) => output.push(Ok(dest)), + Err(()) => output.push(Err(())), + } + } + } + + assert_eq!(output, result); +} + +fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { + unsafe { + // Should be correct to do this transmute. + let dest: &'a mut MyEnumRepr = mem::transmute(dest); + let tag = read_u8(buf)?; + + dest.tag = match tag { + 0 => MyEnumTag::A, + 1 => MyEnumTag::B, + 2 => MyEnumTag::C, + 3 => MyEnumTag::D, + 4 => MyEnumTag::E, + _ => return Err(()), + }; + + match dest.tag { + MyEnumTag::A => { + dest.payload.A.0 = read_u32_le(buf)?; + } + MyEnumTag::B => { + dest.payload.B.x = read_u8(buf)?; + dest.payload.B.y = read_u16_le(buf)? as i16; + } + MyEnumTag::C => { + /* do nothing */ + } + MyEnumTag::D => { + let is_some = read_u8(buf)? == 0; + if is_some { + dest.payload.D.0 = Some(read_u32_le(buf)?); + } else { + dest.payload.D.0 = None; + } + } + MyEnumTag::E => { + let secs = read_u64_le(buf)?; + let nanos = read_u32_le(buf)?; + dest.payload.E.0 = Duration::new(secs, nanos); + } + } + Ok(()) + } +} + + + +// reader helpers + +fn read_u64_le(buf: &mut &[u8]) -> Result { + if buf.len() < 8 { return Err(()) } + let val = (buf[0] as u64) << 0 + | (buf[1] as u64) << 8 + | (buf[2] as u64) << 16 + | (buf[3] as u64) << 24 + | (buf[4] as u64) << 32 + | (buf[5] as u64) << 40 + | (buf[6] as u64) << 48 + | (buf[7] as u64) << 56; + *buf = &buf[8..]; + Ok(val) +} + +fn read_u32_le(buf: &mut &[u8]) -> Result { + if buf.len() < 4 { return Err(()) } + let val = (buf[0] as u32) << 0 + | (buf[1] as u32) << 8 + | (buf[2] as u32) << 16 + | (buf[3] as u32) << 24; + *buf = &buf[4..]; + Ok(val) +} + +fn read_u16_le(buf: &mut &[u8]) -> Result { + if buf.len() < 2 { return Err(()) } + let val = (buf[0] as u16) << 0 + | (buf[1] as u16) << 8; + *buf = &buf[2..]; + Ok(val) +} + +fn read_u8(buf: &mut &[u8]) -> Result { + if buf.len() < 1 { return Err(()) } + let val = buf[0]; + *buf = &buf[1..]; + Ok(val) +} diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs new file mode 100644 index 00000000000..80c4339af9d --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-c.rs @@ -0,0 +1,178 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test deserializes an enum in-place by transmuting to a union that +// should have the same layout, and manipulating the tag and payloads +// independently. This verifies that `repr(some_int)` has a stable representation, +// and that we don't miscompile these kinds of manipulations. + +use std::time::Duration; +use std::mem; + +#[repr(C)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +enum MyEnum { + A(u32), // Single primitive value + B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct +} + +#[repr(C)] +struct MyEnumRepr { + tag: MyEnumTag, + payload: MyEnumPayload, +} + +#[repr(C)] +#[allow(non_snake_case)] +union MyEnumPayload { + A: MyEnumVariantA, + B: MyEnumVariantB, + D: MyEnumVariantD, + E: MyEnumVariantE, +} + +#[repr(C)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); + +fn main() { + let result: Vec> = vec![ + Ok(MyEnum::A(17)), + Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::C), + Err(()), + Ok(MyEnum::D(Some(407))), + Ok(MyEnum::D(None)), + Ok(MyEnum::E(Duration::from_secs(100))), + Err(()), + ]; + + // Binary serialized version of the above (little-endian) + let input: Vec = vec![ + 0, 17, 0, 0, 0, + 1, 206, 121, 4, + 2, + 8, /* invalid tag value */ + 3, 0, 151, 1, 0, 0, + 3, 1, + 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, /* incomplete value */ + ]; + + let mut output = vec![]; + let mut buf = &input[..]; + + unsafe { + // This should be safe, because we don't match on it unless it's fully formed, + // and it doesn't have a destructor. + let mut dest: MyEnum = mem::uninitialized(); + while buf.len() > 0 { + match parse_my_enum(&mut dest, &mut buf) { + Ok(()) => output.push(Ok(dest)), + Err(()) => output.push(Err(())), + } + } + } + + assert_eq!(output, result); +} + +fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { + unsafe { + // Should be correct to do this transmute. + let dest: &'a mut MyEnumRepr = mem::transmute(dest); + let tag = read_u8(buf)?; + + dest.tag = match tag { + 0 => MyEnumTag::A, + 1 => MyEnumTag::B, + 2 => MyEnumTag::C, + 3 => MyEnumTag::D, + 4 => MyEnumTag::E, + _ => return Err(()), + }; + + match dest.tag { + MyEnumTag::A => { + dest.payload.A.0 = read_u32_le(buf)?; + } + MyEnumTag::B => { + dest.payload.B.x = read_u8(buf)?; + dest.payload.B.y = read_u16_le(buf)? as i16; + } + MyEnumTag::C => { + /* do nothing */ + } + MyEnumTag::D => { + let is_some = read_u8(buf)? == 0; + if is_some { + dest.payload.D.0 = Some(read_u32_le(buf)?); + } else { + dest.payload.D.0 = None; + } + } + MyEnumTag::E => { + let secs = read_u64_le(buf)?; + let nanos = read_u32_le(buf)?; + dest.payload.E.0 = Duration::new(secs, nanos); + } + } + Ok(()) + } +} + + + +// reader helpers + +fn read_u64_le(buf: &mut &[u8]) -> Result { + if buf.len() < 8 { return Err(()) } + let val = (buf[0] as u64) << 0 + | (buf[1] as u64) << 8 + | (buf[2] as u64) << 16 + | (buf[3] as u64) << 24 + | (buf[4] as u64) << 32 + | (buf[5] as u64) << 40 + | (buf[6] as u64) << 48 + | (buf[7] as u64) << 56; + *buf = &buf[8..]; + Ok(val) +} + +fn read_u32_le(buf: &mut &[u8]) -> Result { + if buf.len() < 4 { return Err(()) } + let val = (buf[0] as u32) << 0 + | (buf[1] as u32) << 8 + | (buf[2] as u32) << 16 + | (buf[3] as u32) << 24; + *buf = &buf[4..]; + Ok(val) +} + +fn read_u16_le(buf: &mut &[u8]) -> Result { + if buf.len() < 2 { return Err(()) } + let val = (buf[0] as u16) << 0 + | (buf[1] as u16) << 8; + *buf = &buf[2..]; + Ok(val) +} + +fn read_u8(buf: &mut &[u8]) -> Result { + if buf.len() < 1 { return Err(()) } + let val = buf[0]; + *buf = &buf[1..]; + Ok(val) +} diff --git a/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs b/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs new file mode 100644 index 00000000000..4c1fe8db1cd --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-non-c-like-repr-int.rs @@ -0,0 +1,174 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// This test deserializes an enum in-place by transmuting to a union that +// should have the same layout, and manipulating the tag and payloads +// independently. This verifies that `repr(some_int)` has a stable representation, +// and that we don't miscompile these kinds of manipulations. + +use std::time::Duration; +use std::mem; + +#[repr(u8)] +#[derive(Copy, Clone, Eq, PartialEq, Debug)] +enum MyEnum { + A(u32), // Single primitive value + B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal + C, // Empty + D(Option), // Contains an enum + E(Duration), // Contains a struct +} + +#[allow(non_snake_case)] +#[repr(C)] +union MyEnumRepr { + A: MyEnumVariantA, + B: MyEnumVariantB, + C: MyEnumVariantC, + D: MyEnumVariantD, + E: MyEnumVariantE, +} + +#[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(MyEnumTag, u32); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB { tag: MyEnumTag, x: u8, y: i16 } +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantC(MyEnumTag); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(MyEnumTag, Option); +#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(MyEnumTag, Duration); + +fn main() { + let result: Vec> = vec![ + Ok(MyEnum::A(17)), + Ok(MyEnum::B { x: 206, y: 1145 }), + Ok(MyEnum::C), + Err(()), + Ok(MyEnum::D(Some(407))), + Ok(MyEnum::D(None)), + Ok(MyEnum::E(Duration::from_secs(100))), + Err(()), + ]; + + // Binary serialized version of the above (little-endian) + let input: Vec = vec![ + 0, 17, 0, 0, 0, + 1, 206, 121, 4, + 2, + 8, /* invalid tag value */ + 3, 0, 151, 1, 0, 0, + 3, 1, + 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, /* incomplete value */ + ]; + + let mut output = vec![]; + let mut buf = &input[..]; + + unsafe { + // This should be safe, because we don't match on it unless it's fully formed, + // and it doesn't have a destructor. + let mut dest: MyEnum = mem::uninitialized(); + while buf.len() > 0 { + match parse_my_enum(&mut dest, &mut buf) { + Ok(()) => output.push(Ok(dest)), + Err(()) => output.push(Err(())), + } + } + } + + assert_eq!(output, result); +} + +fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { + unsafe { + // Should be correct to do this transmute. + let dest: &'a mut MyEnumRepr = mem::transmute(dest); + let tag = read_u8(buf)?; + + dest.A.0 = match tag { + 0 => MyEnumTag::A, + 1 => MyEnumTag::B, + 2 => MyEnumTag::C, + 3 => MyEnumTag::D, + 4 => MyEnumTag::E, + _ => return Err(()), + }; + + match dest.B.tag { + MyEnumTag::A => { + dest.A.1 = read_u32_le(buf)?; + } + MyEnumTag::B => { + dest.B.x = read_u8(buf)?; + dest.B.y = read_u16_le(buf)? as i16; + } + MyEnumTag::C => { + /* do nothing */ + } + MyEnumTag::D => { + let is_some = read_u8(buf)? == 0; + if is_some { + dest.D.1 = Some(read_u32_le(buf)?); + } else { + dest.D.1 = None; + } + } + MyEnumTag::E => { + let secs = read_u64_le(buf)?; + let nanos = read_u32_le(buf)?; + dest.E.1 = Duration::new(secs, nanos); + } + } + Ok(()) + } +} + + + +// reader helpers + +fn read_u64_le(buf: &mut &[u8]) -> Result { + if buf.len() < 8 { return Err(()) } + let val = (buf[0] as u64) << 0 + | (buf[1] as u64) << 8 + | (buf[2] as u64) << 16 + | (buf[3] as u64) << 24 + | (buf[4] as u64) << 32 + | (buf[5] as u64) << 40 + | (buf[6] as u64) << 48 + | (buf[7] as u64) << 56; + *buf = &buf[8..]; + Ok(val) +} + +fn read_u32_le(buf: &mut &[u8]) -> Result { + if buf.len() < 4 { return Err(()) } + let val = (buf[0] as u32) << 0 + | (buf[1] as u32) << 8 + | (buf[2] as u32) << 16 + | (buf[3] as u32) << 24; + *buf = &buf[4..]; + Ok(val) +} + +fn read_u16_le(buf: &mut &[u8]) -> Result { + if buf.len() < 2 { return Err(()) } + let val = (buf[0] as u16) << 0 + | (buf[1] as u16) << 8; + *buf = &buf[2..]; + Ok(val) +} + +fn read_u8(buf: &mut &[u8]) -> Result { + if buf.len() < 1 { return Err(()) } + let val = buf[0]; + *buf = &buf[1..]; + Ok(val) +} diff --git a/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs new file mode 100644 index 00000000000..f5f90c62b88 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-null-pointer-opt.rs @@ -0,0 +1,74 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem::size_of; +use std::num::NonZeroUsize; +use std::ptr::NonNull; +use std::rc::Rc; +use std::sync::Arc; + +trait Trait { fn dummy(&self) { } } +trait Mirror { type Image; } +impl Mirror for T { type Image = T; } +struct ParamTypeStruct(T); +struct AssocTypeStruct(::Image); + +fn main() { + // Functions + assert_eq!(size_of::(), size_of::>()); + assert_eq!(size_of::(), size_of::>()); + + // Slices - &str / &[T] / &mut [T] + assert_eq!(size_of::<&str>(), size_of::>()); + assert_eq!(size_of::<&[isize]>(), size_of::>()); + assert_eq!(size_of::<&mut [isize]>(), size_of::>()); + + // Traits - Box / &Trait / &mut Trait + assert_eq!(size_of::>(), size_of::>>()); + assert_eq!(size_of::<&Trait>(), size_of::>()); + assert_eq!(size_of::<&mut Trait>(), size_of::>()); + + // Pointers - Box + assert_eq!(size_of::>(), size_of::>>()); + + // The optimization can't apply to raw pointers + assert!(size_of::>() != size_of::<*const isize>()); + assert!(Some(0 as *const isize).is_some()); // Can't collapse None to null + + struct Foo { + _a: Box + } + struct Bar(Box); + + // Should apply through structs + assert_eq!(size_of::(), size_of::>()); + assert_eq!(size_of::(), size_of::>()); + // and tuples + assert_eq!(size_of::<(u8, Box)>(), size_of::)>>()); + // and fixed-size arrays + assert_eq!(size_of::<[Box; 1]>(), size_of::; 1]>>()); + + // Should apply to NonZero + assert_eq!(size_of::(), size_of::>()); + assert_eq!(size_of::>(), size_of::>>()); + + // Should apply to types that use NonZero internally + assert_eq!(size_of::>(), size_of::>>()); + assert_eq!(size_of::>(), size_of::>>()); + assert_eq!(size_of::>(), size_of::>>()); + + // Should apply to types that have NonZero transitively + assert_eq!(size_of::(), size_of::>()); + + // Should apply to types where the pointer is substituted + assert_eq!(size_of::<&u8>(), size_of::>>()); + assert_eq!(size_of::<&u8>(), size_of::>>()); +} diff --git a/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs b/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs new file mode 100644 index 00000000000..21d48112841 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::result::Result; +use std::result::Result::Ok; + +static C: Result<(), Box> = Ok(()); + +// This is because of yet another bad assertion (ICE) about the null side of a nullable enum. +// So we won't actually compile if the bug is present, but we check the value in main anyway. + +pub fn main() { + assert!(C.is_ok()); +} diff --git a/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs b/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs new file mode 100644 index 00000000000..431d105f01f --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs @@ -0,0 +1,27 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +/*! + * This is a regression test for a bug in LLVM, fixed in upstream r179587, + * where the switch instructions generated for destructuring enums + * represented with nullable pointers could be misoptimized in some cases. + */ + +enum List { Nil, Cons(X, Box>) } +pub fn main() { + match List::Cons(10, box List::Nil) { + List::Cons(10, _) => {} + List::Nil => {} + _ => panic!() + } +} diff --git a/src/test/run-pass/structs-enums/enum-univariant-repr.rs b/src/test/run-pass/structs-enums/enum-univariant-repr.rs new file mode 100644 index 00000000000..7f78da64b67 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-univariant-repr.rs @@ -0,0 +1,61 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::mem; + +// Univariant C-like enum +#[repr(i32)] +enum Univariant { + X = 17 +} + +#[repr(u16)] +enum UnivariantWithoutDescr { + Y +} + +#[repr(u8)] +enum UnivariantWithData { + Z(u8), +} + +pub fn main() { + { + assert_eq!(4, mem::size_of::()); + assert_eq!(17, Univariant::X as i32); + + let enums: &[Univariant] = + &[Univariant::X, Univariant::X, Univariant::X]; + let ints: &[i32] = unsafe { mem::transmute(enums) }; + // check it has the same memory layout as i32 + assert_eq!(&[17, 17, 17], ints); + } + + { + assert_eq!(2, mem::size_of::()); + let descr = UnivariantWithoutDescr::Y as u16; + + let enums: &[UnivariantWithoutDescr] = + &[UnivariantWithoutDescr::Y, UnivariantWithoutDescr::Y, UnivariantWithoutDescr::Y]; + let ints: &[u16] = unsafe { mem::transmute(enums) }; + // check it has the same memory layout as u16 + assert_eq!(&[descr, descr, descr], ints); + } + + { + assert_eq!(2, mem::size_of::()); + + match UnivariantWithData::Z(4) { + UnivariantWithData::Z(x) => assert_eq!(x, 4), + } + } +} diff --git a/src/test/run-pass/structs-enums/enum-variants.rs b/src/test/run-pass/structs-enums/enum-variants.rs new file mode 100644 index 00000000000..1eff9ad413d --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-variants.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +enum Animal { + Dog (String, f64), + Cat { name: String, weight: f64 } +} + +pub fn main() { + let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); + a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 }; + // permuting the fields should work too + let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_string() }; +} diff --git a/src/test/run-pass/structs-enums/enum-vec-initializer.rs b/src/test/run-pass/structs-enums/enum-vec-initializer.rs new file mode 100644 index 00000000000..9a2abdbb706 --- /dev/null +++ b/src/test/run-pass/structs-enums/enum-vec-initializer.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Flopsy { + Bunny = 2 +} + +const BAR:usize = Flopsy::Bunny as usize; +const BAR2:usize = BAR; + +pub fn main() { + let _v = [0; Flopsy::Bunny as usize]; + let _v = [0; BAR]; + let _v = [0; BAR2]; + const BAR3:usize = BAR2; + let _v = [0; BAR3]; +} diff --git a/src/test/run-pass/structs-enums/export-abstract-tag.rs b/src/test/run-pass/structs-enums/export-abstract-tag.rs new file mode 100644 index 00000000000..6de6e1847fe --- /dev/null +++ b/src/test/run-pass/structs-enums/export-abstract-tag.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// We can export tags without exporting the variants to create a simple +// sort of ADT. + +// pretty-expanded FIXME #23616 + +mod foo { + pub enum t { t1, } + + pub fn f() -> t { return t::t1; } +} + +pub fn main() { let _v: foo::t = foo::f(); } diff --git a/src/test/run-pass/structs-enums/export-tag-variant.rs b/src/test/run-pass/structs-enums/export-tag-variant.rs new file mode 100644 index 00000000000..700ad4fbe7e --- /dev/null +++ b/src/test/run-pass/structs-enums/export-tag-variant.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +// pretty-expanded FIXME #23616 + +mod foo { + pub enum t { t1, } +} + +pub fn main() { let _v = foo::t::t1; } diff --git a/src/test/run-pass/structs-enums/expr-if-struct.rs b/src/test/run-pass/structs-enums/expr-if-struct.rs new file mode 100644 index 00000000000..25777fba274 --- /dev/null +++ b/src/test/run-pass/structs-enums/expr-if-struct.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + + +// Tests for if as expressions returning nominal types + +#[derive(Copy, Clone)] +struct I { i: isize } + +fn test_rec() { + let rs = if true { I {i: 100} } else { I {i: 101} }; + assert_eq!(rs.i, 100); +} + +#[derive(Copy, Clone, Debug)] +enum mood { happy, sad, } + +impl PartialEq for mood { + fn eq(&self, other: &mood) -> bool { + ((*self) as usize) == ((*other) as usize) + } + fn ne(&self, other: &mood) -> bool { !(*self).eq(other) } +} + +fn test_tag() { + let rs = if true { mood::happy } else { mood::sad }; + assert_eq!(rs, mood::happy); +} + +pub fn main() { test_rec(); test_tag(); } diff --git a/src/test/run-pass/structs-enums/expr-match-struct.rs b/src/test/run-pass/structs-enums/expr-match-struct.rs new file mode 100644 index 00000000000..7c18eff1c46 --- /dev/null +++ b/src/test/run-pass/structs-enums/expr-match-struct.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + + +// Tests for match as expressions resulting in struct types +#[derive(Copy, Clone)] +struct R { i: isize } + +fn test_rec() { + let rs = match true { true => R {i: 100}, _ => panic!() }; + assert_eq!(rs.i, 100); +} + +#[derive(Copy, Clone, Debug)] +enum mood { happy, sad, } + +impl PartialEq for mood { + fn eq(&self, other: &mood) -> bool { + ((*self) as usize) == ((*other) as usize) + } + fn ne(&self, other: &mood) -> bool { !(*self).eq(other) } +} + +fn test_tag() { + let rs = match true { true => { mood::happy } false => { mood::sad } }; + assert_eq!(rs, mood::happy); +} + +pub fn main() { test_rec(); test_tag(); } diff --git a/src/test/run-pass/structs-enums/field-destruction-order.rs b/src/test/run-pass/structs-enums/field-destruction-order.rs new file mode 100644 index 00000000000..5b9d1530321 --- /dev/null +++ b/src/test/run-pass/structs-enums/field-destruction-order.rs @@ -0,0 +1,56 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// In theory, it doesn't matter what order destructors are run in for rust +// because we have explicit ownership of values meaning that there's no need to +// run one before another. With unsafe code, however, there may be a safe +// interface which relies on fields having their destructors run in a particular +// order. At the time of this writing, std::rt::sched::Scheduler is an example +// of a structure which contains unsafe handles to FFI-like types, and the +// destruction order of the fields matters in the sense that some handles need +// to get destroyed before others. +// +// In C++, destruction order happens bottom-to-top in order of field +// declarations, but we currently run them top-to-bottom. I don't think the +// order really matters that much as long as we define what it is. + + +struct A; +struct B; +struct C { + a: A, + b: B, +} + +static mut hit: bool = false; + +impl Drop for A { + fn drop(&mut self) { + unsafe { + assert!(!hit); + hit = true; + } + } +} + +impl Drop for B { + fn drop(&mut self) { + unsafe { + assert!(hit); + } + } +} + +pub fn main() { + let _c = C { a: A, b: B }; +} diff --git a/src/test/run-pass/structs-enums/foreign-struct.rs b/src/test/run-pass/structs-enums/foreign-struct.rs new file mode 100644 index 00000000000..1e4955bd5ec --- /dev/null +++ b/src/test/run-pass/structs-enums/foreign-struct.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Passing enums by value + +// pretty-expanded FIXME #23616 + +pub enum void { } + +mod bindgen { + use super::void; + + extern { + pub fn printf(v: void); + } +} + +pub fn main() { } diff --git a/src/test/run-pass/structs-enums/functional-struct-upd.rs b/src/test/run-pass/structs-enums/functional-struct-upd.rs new file mode 100644 index 00000000000..6fe028c5145 --- /dev/null +++ b/src/test/run-pass/structs-enums/functional-struct-upd.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct Foo { + x: isize, + y: isize +} + +pub fn main() { + let a = Foo { x: 1, y: 2 }; + let c = Foo { x: 4, .. a}; + println!("{:?}", c); +} diff --git a/src/test/run-pass/structs-enums/ivec-tag.rs b/src/test/run-pass/structs-enums/ivec-tag.rs new file mode 100644 index 00000000000..fb7585f9989 --- /dev/null +++ b/src/test/run-pass/structs-enums/ivec-tag.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +fn producer(tx: &Sender>) { + tx.send( + vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, + 13]).unwrap(); +} + +pub fn main() { + let (tx, rx) = channel::>(); + let prod = thread::spawn(move|| { + producer(&tx) + }); + + let _data: Vec = rx.recv().unwrap(); + prod.join(); +} diff --git a/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs b/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs new file mode 100644 index 00000000000..8334dc532e0 --- /dev/null +++ b/src/test/run-pass/structs-enums/module-qualified-struct-destructure.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod m { + pub struct S { + pub x: isize, + pub y: isize + } +} + +pub fn main() { + let x = m::S { x: 1, y: 2 }; + let m::S { x: _a, y: _b } = x; +} diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs new file mode 100644 index 00000000000..1f57c9dd473 --- /dev/null +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// aux-build:namespaced_enum_emulate_flat.rs + +// pretty-expanded FIXME #23616 + +extern crate namespaced_enum_emulate_flat; + +use namespaced_enum_emulate_flat::{Foo, A, B, C}; +use namespaced_enum_emulate_flat::nest::{Bar, D, E, F}; + +fn _f(f: Foo) { + match f { + A | B(_) | C { .. } => {} + } +} + +fn _f2(f: Bar) { + match f { + D | E(_) | F { .. } => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs new file mode 100644 index 00000000000..1185519dac6 --- /dev/null +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub use Foo::*; +use nest::{Bar, D, E, F}; + +pub enum Foo { + A, + B(isize), + C { a: isize }, +} + +impl Foo { + pub fn foo() {} +} + +fn _f(f: Foo) { + match f { + A | B(_) | C { .. } => {} + } +} + +mod nest { + pub use self::Bar::*; + + pub enum Bar { + D, + E(isize), + F { a: isize }, + } + + impl Bar { + pub fn foo() {} + } +} + +fn _f2(f: Bar) { + match f { + D | E(_) | F { .. } => {} + } +} + +fn main() {} diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs new file mode 100644 index 00000000000..aff4125ef17 --- /dev/null +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:namespaced_enums.rs + +// pretty-expanded FIXME #23616 + +extern crate namespaced_enums; + +fn _f(f: namespaced_enums::Foo) { + use namespaced_enums::Foo::*; + + match f { + A | B(_) | C { .. } => {} + } +} + +mod m { + pub use namespaced_enums::Foo::*; +} + +fn _f2(f: namespaced_enums::Foo) { + match f { + m::A | m::B(_) | m::C { .. } => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs new file mode 100644 index 00000000000..85af2f0d9d6 --- /dev/null +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod m2 { + pub enum Foo { + A, + B(isize), + C { a: isize }, + } + + impl Foo { + pub fn foo() {} + } +} + +mod m { + pub use m2::Foo::*; +} + +fn _f(f: m2::Foo) { + use m2::Foo::*; + + match f { + A | B(_) | C { .. } => {} + } +} + +fn _f2(f: m2::Foo) { + match f { + m::A | m::B(_) | m::C { .. } => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs b/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs new file mode 100644 index 00000000000..d107a9386c3 --- /dev/null +++ b/src/test/run-pass/structs-enums/namespaced-enums-xcrate.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:namespaced_enums.rs + +// pretty-expanded FIXME #23616 + +extern crate namespaced_enums; + +use namespaced_enums::Foo; + +fn _foo (f: Foo) { + match f { + Foo::A | Foo::B(_) | Foo::C { .. } => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/namespaced-enums.rs b/src/test/run-pass/structs-enums/namespaced-enums.rs new file mode 100644 index 00000000000..05a4c190712 --- /dev/null +++ b/src/test/run-pass/structs-enums/namespaced-enums.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Foo { + A, + B(isize), + C { a: isize }, +} + +fn _foo (f: Foo) { + match f { + Foo::A | Foo::B(_) | Foo::C { .. } => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/nested-enum-same-names.rs b/src/test/run-pass/structs-enums/nested-enum-same-names.rs new file mode 100644 index 00000000000..6e294b27abf --- /dev/null +++ b/src/test/run-pass/structs-enums/nested-enum-same-names.rs @@ -0,0 +1,36 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +/* + +#7770 ICE with sibling methods containing same-name-enum containing + same-name-member + +If you have two methods in an impl block, each containing an enum +(with the same name), each containing at least one value with the same +name, rustc gives the same LLVM symbol for the two of them and fails, +as it does not include the method name in the symbol name. + +*/ + +pub struct Foo; +impl Foo { + pub fn foo() { + enum Panic { Common }; + } + pub fn bar() { + enum Panic { Common }; + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs b/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs new file mode 100644 index 00000000000..2221deeb5ae --- /dev/null +++ b/src/test/run-pass/structs-enums/newtype-struct-drop-run.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Make sure the destructor is run for newtype structs. + +use std::cell::Cell; + +struct Foo<'a>(&'a Cell); + +impl<'a> Drop for Foo<'a> { + fn drop(&mut self) { + let Foo(i) = *self; + i.set(23); + } +} + +pub fn main() { + let y = &Cell::new(32); + { + let _x = Foo(y); + } + assert_eq!(y.get(), 23); +} diff --git a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs new file mode 100644 index 00000000000..6bdf69478ae --- /dev/null +++ b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub struct Fd(u32); + +fn foo(a: u32) {} + +impl Drop for Fd { + fn drop(&mut self) { + unsafe { + let Fd(s) = *self; + foo(s); + } + } +} + +pub fn main() { +} diff --git a/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs b/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs new file mode 100644 index 00000000000..d83552b063c --- /dev/null +++ b/src/test/run-pass/structs-enums/newtype-struct-xc-2.rs @@ -0,0 +1,25 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:newtype_struct_xc.rs + +// pretty-expanded FIXME #23616 + +extern crate newtype_struct_xc; +use newtype_struct_xc::Au; + +fn f() -> Au { + Au(2) +} + +pub fn main() { + let _ = f(); +} diff --git a/src/test/run-pass/structs-enums/newtype-struct-xc.rs b/src/test/run-pass/structs-enums/newtype-struct-xc.rs new file mode 100644 index 00000000000..d88ddd7298c --- /dev/null +++ b/src/test/run-pass/structs-enums/newtype-struct-xc.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:newtype_struct_xc.rs + +// pretty-expanded FIXME #23616 + +extern crate newtype_struct_xc; + +pub fn main() { + let _ = newtype_struct_xc::Au(2); +} diff --git a/src/test/run-pass/structs-enums/nonzero-enum.rs b/src/test/run-pass/structs-enums/nonzero-enum.rs new file mode 100644 index 00000000000..7a6afec4e6d --- /dev/null +++ b/src/test/run-pass/structs-enums/nonzero-enum.rs @@ -0,0 +1,39 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem::size_of; + +enum E { + A = 1, + B = 2, + C = 3, +} + +struct S { + a: u16, + b: u8, + e: E, +} + +fn main() { + assert_eq!(size_of::(), 1); + assert_eq!(size_of::>(), 1); + assert_eq!(size_of::>(), 1); + assert_eq!(size_of::>(), size_of::()); + let enone = None::; + let esome = Some(E::A); + if let Some(..) = enone { + panic!(); + } + if let None = esome { + panic!(); + } +} diff --git a/src/test/run-pass/structs-enums/numeric-fields.rs b/src/test/run-pass/structs-enums/numeric-fields.rs new file mode 100644 index 00000000000..e311722d651 --- /dev/null +++ b/src/test/run-pass/structs-enums/numeric-fields.rs @@ -0,0 +1,22 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S(u8, u16); + +fn main() { + let s = S{1: 10, 0: 11}; + match s { + S{0: a, 1: b, ..} => { + assert_eq!(a, 11); + assert_eq!(b, 10); + } + } +} diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs new file mode 100644 index 00000000000..86d8af174ac --- /dev/null +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs @@ -0,0 +1,68 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the lifetime of the enclosing `&` is used for the object +// lifetime bound. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +use std::fmt::Display; + +trait Test { + fn foo(&self) { } +} + +struct Ref<'a,T:'a+?Sized> { + r: &'a T +} + +struct Ref2<'a,'b,T:'a+'b+?Sized> { + a: &'a T, + b: &'b T +} + +struct SomeStruct<'a> { + t: Ref<'a,Test>, + u: Ref<'a,Test+'a>, +} + +fn a<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn c<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn d<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn e<'a>(_: Ref<'a, Display+'static>) {} +fn g<'a, 'b>(_: Ref2<'a, 'b, Display+'static>) {} + + +fn main() { + // Inside a function body, we can just infer all + // lifetimes, to allow Ref<'tmp, Display+'static> + // and Ref2<'tmp, 'tmp, Display+'static>. + let x = &0 as &(Display+'static); + let r: Ref = Ref { r: x }; + let r2: Ref2 = Ref2 { a: x, b: x }; + e(r); + g(r2); +} diff --git a/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs new file mode 100644 index 00000000000..cd88f7a42d0 --- /dev/null +++ b/src/test/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the lifetime from the enclosing `&` is "inherited" +// through the `MyBox` struct. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Test { + fn foo(&self) { } +} + +struct SomeStruct<'a> { + t: &'a MyBox, + u: &'a MyBox, +} + +struct MyBox { + b: Box +} + +fn a<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.t = t; +} + +fn b<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +// see also compile-fail/object-lifetime-default-from-rptr-box-error.rs + +fn d<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { + ss.u = t; +} + +fn main() { +} diff --git a/src/test/run-pass/structs-enums/rec-align-u32.rs b/src/test/run-pass/structs-enums/rec-align-u32.rs new file mode 100644 index 00000000000..e2c960b89cb --- /dev/null +++ b/src/test/run-pass/structs-enums/rec-align-u32.rs @@ -0,0 +1,64 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #2303 + +#![feature(intrinsics)] + +use std::mem; + +mod rusti { + extern "rust-intrinsic" { + pub fn pref_align_of() -> usize; + pub fn min_align_of() -> usize; + } +} + +// This is the type with the questionable alignment +#[derive(Debug)] +struct Inner { + c64: u32 +} + +// This is the type that contains the type with the +// questionable alignment, for testing +#[derive(Debug)] +struct Outer { + c8: u8, + t: Inner +} + +mod m { + pub fn align() -> usize { 4 } + pub fn size() -> usize { 8 } +} + +pub fn main() { + unsafe { + let x = Outer {c8: 22, t: Inner {c64: 44}}; + + // Send it through the shape code + let y = format!("{:?}", x); + + println!("align inner = {:?}", rusti::min_align_of::()); + println!("size outer = {:?}", mem::size_of::()); + println!("y = {:?}", y); + + // per clang/gcc the alignment of `inner` is 4 on x86. + assert_eq!(rusti::min_align_of::(), m::align()); + + // per clang/gcc the size of `outer` should be 12 + // because `inner`s alignment was 4. + assert_eq!(mem::size_of::(), m::size()); + + assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); + } +} diff --git a/src/test/run-pass/structs-enums/rec-align-u64.rs b/src/test/run-pass/structs-enums/rec-align-u64.rs new file mode 100644 index 00000000000..6fe3aefaef5 --- /dev/null +++ b/src/test/run-pass/structs-enums/rec-align-u64.rs @@ -0,0 +1,109 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare seems unimportant to test + +// Issue #2303 + +#![feature(intrinsics)] + +use std::mem; + +mod rusti { + extern "rust-intrinsic" { + pub fn pref_align_of() -> usize; + pub fn min_align_of() -> usize; + } +} + +// This is the type with the questionable alignment +#[derive(Debug)] +struct Inner { + c64: u64 +} + +// This is the type that contains the type with the +// questionable alignment, for testing +#[derive(Debug)] +struct Outer { + c8: u8, + t: Inner +} + + +#[cfg(any(target_os = "android", + target_os = "cloudabi", + target_os = "dragonfly", + target_os = "emscripten", + target_os = "freebsd", + target_os = "linux", + target_os = "macos", + target_os = "netbsd", + target_os = "openbsd", + target_os = "solaris"))] +mod m { + #[cfg(target_arch = "x86")] + pub mod m { + pub fn align() -> usize { 4 } + pub fn size() -> usize { 12 } + } + + #[cfg(not(target_arch = "x86"))] + pub mod m { + pub fn align() -> usize { 8 } + pub fn size() -> usize { 16 } + } +} + +#[cfg(target_os = "bitrig")] +mod m { + #[cfg(target_arch = "x86_64")] + pub mod m { + pub fn align() -> usize { 8 } + pub fn size() -> usize { 16 } + } +} + +#[cfg(target_os = "windows")] +mod m { + #[cfg(target_arch = "x86")] + pub mod m { + pub fn align() -> usize { 8 } + pub fn size() -> usize { 16 } + } + + #[cfg(target_arch = "x86_64")] + pub mod m { + pub fn align() -> usize { 8 } + pub fn size() -> usize { 16 } + } +} + +pub fn main() { + unsafe { + let x = Outer {c8: 22, t: Inner {c64: 44}}; + + let y = format!("{:?}", x); + + println!("align inner = {:?}", rusti::min_align_of::()); + println!("size outer = {:?}", mem::size_of::()); + println!("y = {:?}", y); + + // per clang/gcc the alignment of `Inner` is 4 on x86. + assert_eq!(rusti::min_align_of::(), m::m::align()); + + // per clang/gcc the size of `Outer` should be 12 + // because `Inner`s alignment was 4. + assert_eq!(mem::size_of::(), m::m::size()); + + assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); + } +} diff --git a/src/test/run-pass/structs-enums/rec-auto.rs b/src/test/run-pass/structs-enums/rec-auto.rs new file mode 100644 index 00000000000..db9a97bd036 --- /dev/null +++ b/src/test/run-pass/structs-enums/rec-auto.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +// Issue #50. + +struct X { foo: String, bar: String } + +pub fn main() { + let x = X {foo: "hello".to_string(), bar: "world".to_string()}; + println!("{}", x.foo.clone()); + println!("{}", x.bar.clone()); +} diff --git a/src/test/run-pass/structs-enums/rec-extend.rs b/src/test/run-pass/structs-enums/rec-extend.rs new file mode 100644 index 00000000000..c20ff37222c --- /dev/null +++ b/src/test/run-pass/structs-enums/rec-extend.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + + + +struct Point {x: isize, y: isize} + +pub fn main() { + let origin: Point = Point {x: 0, y: 0}; + let right: Point = Point {x: origin.x + 10,.. origin}; + let up: Point = Point {y: origin.y + 10,.. origin}; + assert_eq!(origin.x, 0); + assert_eq!(origin.y, 0); + assert_eq!(right.x, 10); + assert_eq!(right.y, 0); + assert_eq!(up.x, 0); + assert_eq!(up.y, 10); +} diff --git a/src/test/run-pass/structs-enums/rec-tup.rs b/src/test/run-pass/structs-enums/rec-tup.rs new file mode 100644 index 00000000000..ae8819cb5b8 --- /dev/null +++ b/src/test/run-pass/structs-enums/rec-tup.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +#[derive(Copy, Clone)] +struct Point {x: isize, y: isize} + +type rect = (Point, Point); + +fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } +fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } + +fn f(r: rect, x1: isize, y1: isize, x2: isize, y2: isize) { + assert_eq!(fst(r).x, x1); + assert_eq!(fst(r).y, y1); + assert_eq!(snd(r).x, x2); + assert_eq!(snd(r).y, y2); +} + +pub fn main() { + let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); + assert_eq!(fst(r).x, 10); + assert_eq!(fst(r).y, 20); + assert_eq!(snd(r).x, 11); + assert_eq!(snd(r).y, 22); + let r2 = r; + let x: isize = fst(r2).x; + assert_eq!(x, 10); + f(r, 10, 20, 11, 22); + f(r2, 10, 20, 11, 22); +} diff --git a/src/test/run-pass/structs-enums/rec.rs b/src/test/run-pass/structs-enums/rec.rs new file mode 100644 index 00000000000..c8e8f81e085 --- /dev/null +++ b/src/test/run-pass/structs-enums/rec.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#[derive(Copy, Clone)] +struct Rect {x: isize, y: isize, w: isize, h: isize} + +fn f(r: Rect, x: isize, y: isize, w: isize, h: isize) { + assert_eq!(r.x, x); + assert_eq!(r.y, y); + assert_eq!(r.w, w); + assert_eq!(r.h, h); +} + +pub fn main() { + let r: Rect = Rect {x: 10, y: 20, w: 100, h: 200}; + assert_eq!(r.x, 10); + assert_eq!(r.y, 20); + assert_eq!(r.w, 100); + assert_eq!(r.h, 200); + let r2: Rect = r; + let x: isize = r2.x; + assert_eq!(x, 10); + f(r, 10, 20, 100, 200); + f(r2, 10, 20, 100, 200); +} diff --git a/src/test/run-pass/structs-enums/record-pat.rs b/src/test/run-pass/structs-enums/record-pat.rs new file mode 100644 index 00000000000..966749b8354 --- /dev/null +++ b/src/test/run-pass/structs-enums/record-pat.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_shorthand_field_patterns)] + +enum t1 { a(isize), b(usize), } +struct T2 {x: t1, y: isize} +enum t3 { c(T2, usize), } + +fn m(input: t3) -> isize { + match input { + t3::c(T2 {x: t1::a(m), ..}, _) => { return m; } + t3::c(T2 {x: t1::b(m), y: y}, z) => { return ((m + z) as isize) + y; } + } +} + +pub fn main() { + assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4)), 10); + assert_eq!(m(t3::c(T2 {x: t1::b(10), y: 5}, 4)), 19); +} diff --git a/src/test/run-pass/structs-enums/resource-in-struct.rs b/src/test/run-pass/structs-enums/resource-in-struct.rs new file mode 100644 index 00000000000..e8ac8ed749c --- /dev/null +++ b/src/test/run-pass/structs-enums/resource-in-struct.rs @@ -0,0 +1,47 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Ensures that class dtors run if the object is inside an enum +// variant + +use std::cell::Cell; + +type closable<'a> = &'a Cell; + +struct close_res<'a> { + i: closable<'a>, + +} + +impl<'a> Drop for close_res<'a> { + fn drop(&mut self) { + self.i.set(false); + } +} + +fn close_res(i: closable) -> close_res { + close_res { + i: i + } +} + +enum option { none, some(T), } + +fn sink(_res: option) { } + +pub fn main() { + let c = &Cell::new(true); + sink(option::none); + sink(option::some(close_res(c))); + assert!(!c.get()); +} diff --git a/src/test/run-pass/structs-enums/simple-generic-tag.rs b/src/test/run-pass/structs-enums/simple-generic-tag.rs new file mode 100644 index 00000000000..be73224c7ec --- /dev/null +++ b/src/test/run-pass/structs-enums/simple-generic-tag.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + +// pretty-expanded FIXME #23616 + +enum clam { a(T), } + +pub fn main() { } diff --git a/src/test/run-pass/structs-enums/simple-match-generic-tag.rs b/src/test/run-pass/structs-enums/simple-match-generic-tag.rs new file mode 100644 index 00000000000..7093ba5138d --- /dev/null +++ b/src/test/run-pass/structs-enums/simple-match-generic-tag.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +enum opt { none, some(T) } + +pub fn main() { + let x = opt::none::; + match x { + opt::none:: => { println!("hello world"); } + opt::some(_) => { } + } +} diff --git a/src/test/run-pass/structs-enums/small-enum-range-edge.rs b/src/test/run-pass/structs-enums/small-enum-range-edge.rs new file mode 100644 index 00000000000..5b2a3ca3caf --- /dev/null +++ b/src/test/run-pass/structs-enums/small-enum-range-edge.rs @@ -0,0 +1,37 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// Tests the range assertion wraparound case when reading discriminants. + +#[repr(u8)] +#[derive(Copy, Clone)] +enum Eu { Lu = 0, Hu = 255 } + +static CLu: Eu = Eu::Lu; +static CHu: Eu = Eu::Hu; + +#[repr(i8)] +#[derive(Copy, Clone)] +enum Es { Ls = -128, Hs = 127 } + +static CLs: Es = Es::Ls; +static CHs: Es = Es::Hs; + +pub fn main() { + assert_eq!((Eu::Hu as u8).wrapping_add(1), Eu::Lu as u8); + assert_eq!((Es::Hs as i8).wrapping_add(1), Es::Ls as i8); + assert_eq!(CLu as u8, Eu::Lu as u8); + assert_eq!(CHu as u8, Eu::Hu as u8); + assert_eq!(CLs as i8, Es::Ls as i8); + assert_eq!(CHs as i8, Es::Hs as i8); +} diff --git a/src/test/run-pass/structs-enums/small-enums-with-fields.rs b/src/test/run-pass/structs-enums/small-enums-with-fields.rs new file mode 100644 index 00000000000..9e4d4395695 --- /dev/null +++ b/src/test/run-pass/structs-enums/small-enums-with-fields.rs @@ -0,0 +1,43 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::mem::size_of; + +#[derive(PartialEq, Debug)] +enum Either { Left(T), Right(U) } + +macro_rules! check { + ($t:ty, $sz:expr, $($e:expr, $s:expr),*) => {{ + assert_eq!(size_of::<$t>(), $sz); + $({ + static S: $t = $e; + let v: $t = $e; + assert_eq!(S, v); + assert_eq!(format!("{:?}", v), $s); + assert_eq!(format!("{:?}", S), $s); + });* + }} +} + +pub fn main() { + check!(Option, 2, + None, "None", + Some(129), "Some(129)"); + check!(Option, 4, + None, "None", + Some(-20000), "Some(-20000)"); + check!(Either, 2, + Either::Left(132), "Left(132)", + Either::Right(-32), "Right(-32)"); + check!(Either, 4, + Either::Left(132), "Left(132)", + Either::Right(-20000), "Right(-20000)"); +} diff --git a/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs b/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs new file mode 100644 index 00000000000..b20173574cc --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +// aux-build:xcrate_struct_aliases.rs + +extern crate xcrate_struct_aliases; + +use xcrate_struct_aliases::{S, S2}; + +fn main() { + let s = S2 { + x: 1, + y: 2, + }; + match s { + S2 { + x: x, + y: y + } => { + assert_eq!(x, 1); + assert_eq!(y, 2); + } + } +} diff --git a/src/test/run-pass/structs-enums/struct-aliases.rs b/src/test/run-pass/structs-enums/struct-aliases.rs new file mode 100644 index 00000000000..610c512628c --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-aliases.rs @@ -0,0 +1,74 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +use std::mem; + +struct S { + x: isize, + y: isize, +} + +type S2 = S; + +struct S3 { + x: U, + y: V +} + +type S4 = S3; + +fn main() { + let s = S2 { + x: 1, + y: 2, + }; + match s { + S2 { + x: x, + y: y + } => { + assert_eq!(x, 1); + assert_eq!(y, 2); + } + } + // check that generics can be specified from the pattern + let s = S4 { + x: 4, + y: 'a' + }; + match s { + S4:: { + x: x, + y: y + } => { + assert_eq!(x, 4); + assert_eq!(y, 'a'); + assert_eq!(mem::size_of_val(&x), 1); + } + }; + // check that generics can be specified from the constructor + let s = S4:: { + x: 5, + y: 'b' + }; + match s { + S4 { + x: x, + y: y + } => { + assert_eq!(x, 5); + assert_eq!(y, 'b'); + assert_eq!(mem::size_of_val(&x), 2); + } + }; +} diff --git a/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs b/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs new file mode 100644 index 00000000000..cd746f986f1 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-destructuring-cross-crate.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:struct_destructuring_cross_crate.rs + + +extern crate struct_destructuring_cross_crate; + +pub fn main() { + let x = struct_destructuring_cross_crate::S { x: 1, y: 2 }; + let struct_destructuring_cross_crate::S { x: a, y: b } = x; + assert_eq!(a, 1); + assert_eq!(b, 2); +} diff --git a/src/test/run-pass/structs-enums/struct-field-shorthand.rs b/src/test/run-pass/structs-enums/struct-field-shorthand.rs new file mode 100644 index 00000000000..1f06cd889a4 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-field-shorthand.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + x: i32, + y: bool, + z: i32 +} + +struct Bar { + x: i32 +} + +pub fn main() { + let (x, y, z) = (1, true, 2); + let a = Foo { x, y: y, z }; + assert_eq!(a.x, x); + assert_eq!(a.y, y); + assert_eq!(a.z, z); + + let b = Bar { x, }; + assert_eq!(b.x, x); + + let c = Foo { z, y, x }; + assert_eq!(c.x, x); + assert_eq!(c.y, y); + assert_eq!(c.z, z); +} diff --git a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs new file mode 100644 index 00000000000..a970c1b0d78 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Foo { + Bar { + a: isize, + b: isize + }, + Baz { + c: f64, + d: f64 + } +} + +pub fn main() { + let _x = Foo::Bar { a: 2, b: 3 }; +} diff --git a/src/test/run-pass/structs-enums/struct-like-variant-match.rs b/src/test/run-pass/structs-enums/struct-like-variant-match.rs new file mode 100644 index 00000000000..93539b45e23 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-like-variant-match.rs @@ -0,0 +1,43 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +enum Foo { + Bar { + x: isize, + y: isize + }, + Baz { + x: f64, + y: f64 + } +} + +fn f(x: &Foo) { + match *x { + Foo::Baz { x: x, y: y } => { + assert_eq!(x, 1.0); + assert_eq!(y, 2.0); + } + Foo::Bar { y: y, x: x } => { + assert_eq!(x, 1); + assert_eq!(y, 2); + } + } +} + +pub fn main() { + let x = Foo::Bar { x: 1, y: 2 }; + f(&x); + let y = Foo::Baz { x: 1.0, y: 2.0 }; + f(&y); +} diff --git a/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs b/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs new file mode 100644 index 00000000000..fc28c837adf --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-lit-functional-no-fields.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug,PartialEq,Clone)] +struct Foo { + bar: T, + baz: T +} + +pub fn main() { + let foo = Foo { + bar: 0, + baz: 1 + }; + + let foo_ = foo.clone(); + let foo = Foo { ..foo }; + assert_eq!(foo, foo_); + + let foo = Foo { + bar: "one".to_string(), + baz: "two".to_string() + }; + + let foo_ = foo.clone(); + let foo = Foo { ..foo }; + assert_eq!(foo, foo_); +} diff --git a/src/test/run-pass/structs-enums/struct-literal-dtor.rs b/src/test/run-pass/structs-enums/struct-literal-dtor.rs new file mode 100644 index 00000000000..032fcecb490 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-literal-dtor.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +struct foo { + x: String, +} + +impl Drop for foo { + fn drop(&mut self) { + println!("{}", self.x); + } +} + +pub fn main() { + let _z = foo { + x: "Hello".to_string() + }; +} diff --git a/src/test/run-pass/structs-enums/struct-new-as-field-name.rs b/src/test/run-pass/structs-enums/struct-new-as-field-name.rs new file mode 100644 index 00000000000..8f2bcbcf620 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-new-as-field-name.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo { + new: isize, +} + +pub fn main() { + let foo = Foo{ new: 3 }; + assert_eq!(foo.new, 3); +} diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs new file mode 100644 index 00000000000..1e674cb8970 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct S { f0: String, f1: isize } + +pub fn main() { + let s = "Hello, world!".to_string(); + let s = S { + f0: s.to_string(), + ..S { + f0: s, + f1: 23 + } + }; + assert_eq!(s.f0, "Hello, world!"); +} diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs new file mode 100644 index 00000000000..c054f31beae --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs @@ -0,0 +1,25 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct S { + f0: String, + f1: String, +} + +pub fn main() { + let s = "Hello, world!".to_string(); + let s = S { + f1: s.to_string(), + f0: s + }; + assert_eq!(s.f0, "Hello, world!"); +} diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs new file mode 100644 index 00000000000..30f8a0dfe57 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-3.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Checks that functional-record-update order-of-eval is as expected +// even when no Drop-implementations are involved. + +use std::sync::atomic::{Ordering, AtomicUsize}; + +struct W { wrapped: u32 } +struct S { f0: W, _f1: i32 } + +pub fn main() { + const VAL: u32 = 0x89AB_CDEF; + let w = W { wrapped: VAL }; + let s = S { + f0: { event(0x01); W { wrapped: w.wrapped + 1 } }, + ..S { + f0: { event(0x02); w}, + _f1: 23 + } + }; + assert_eq!(s.f0.wrapped, VAL + 1); + let actual = event_log(); + let expect = 0x01_02; + assert!(expect == actual, + "expect: 0x{:x} actual: 0x{:x}", expect, actual); +} + +static LOG: AtomicUsize = AtomicUsize::new(0); + +fn event_log() -> usize { + LOG.load(Ordering::SeqCst) +} + +fn event(tag: u8) { + let old_log = LOG.load(Ordering::SeqCst); + let new_log = (old_log << 8) + tag as usize; + LOG.store(new_log, Ordering::SeqCst); +} diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs new file mode 100644 index 00000000000..8a436890f92 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-4.rs @@ -0,0 +1,44 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Checks that struct-literal expression order-of-eval is as expected +// even when no Drop-implementations are involved. + +use std::sync::atomic::{Ordering, AtomicUsize}; + +struct W { wrapped: u32 } +struct S { f0: W, _f1: i32 } + +pub fn main() { + const VAL: u32 = 0x89AB_CDEF; + let w = W { wrapped: VAL }; + let s = S { + _f1: { event(0x01); 23 }, + f0: { event(0x02); w }, + }; + assert_eq!(s.f0.wrapped, VAL); + let actual = event_log(); + let expect = 0x01_02; + assert!(expect == actual, + "expect: 0x{:x} actual: 0x{:x}", expect, actual); +} + +static LOG: AtomicUsize = AtomicUsize::new(0); + +fn event_log() -> usize { + LOG.load(Ordering::SeqCst) +} + +fn event(tag: u8) { + let old_log = LOG.load(Ordering::SeqCst); + let new_log = (old_log << 8) + tag as usize; + LOG.store(new_log, Ordering::SeqCst); +} diff --git a/src/test/run-pass/structs-enums/struct-partial-move-1.rs b/src/test/run-pass/structs-enums/struct-partial-move-1.rs new file mode 100644 index 00000000000..546bd699777 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-partial-move-1.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +pub struct Partial { x: T, y: T } + +#[derive(PartialEq, Debug)] +struct S { val: isize } +impl S { fn new(v: isize) -> S { S { val: v } } } +impl Drop for S { fn drop(&mut self) { } } + +pub fn f((b1, b2): (T, T), mut f: F) -> Partial where F: FnMut(T) -> T { + let p = Partial { x: b1, y: b2 }; + + // Move of `p` is legal even though we are also moving `p.y`; the + // `..p` moves all fields *except* `p.y` in this context. + Partial { y: f(p.y), ..p } +} + +pub fn main() { + let p = f((S::new(3), S::new(4)), |S { val: z }| S::new(z+1)); + assert_eq!(p, Partial { x: S::new(3), y: S::new(5) }); +} diff --git a/src/test/run-pass/structs-enums/struct-partial-move-2.rs b/src/test/run-pass/structs-enums/struct-partial-move-2.rs new file mode 100644 index 00000000000..c8a9527cc96 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-partial-move-2.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +pub struct Partial { x: T, y: T } + +#[derive(PartialEq, Debug)] +struct S { val: isize } +impl S { fn new(v: isize) -> S { S { val: v } } } +impl Drop for S { fn drop(&mut self) { } } + +pub type Two = (Partial, Partial); + +pub fn f((b1, b2): (T, T), (b3, b4): (T, T), mut f: F) -> Two where F: FnMut(T) -> T { + let p = Partial { x: b1, y: b2 }; + let q = Partial { x: b3, y: b4 }; + + // Move of `q` is legal even though we have already moved `q.y`; + // the `..q` moves all fields *except* `q.y` in this context. + // Likewise, the move of `p.x` is legal for similar reasons. + (Partial { x: f(q.y), ..p }, Partial { y: f(p.x), ..q }) +} + +pub fn main() { + let two = f((S::new(1), S::new(3)), + (S::new(5), S::new(7)), + |S { val: z }| S::new(z+1)); + assert_eq!(two, (Partial { x: S::new(8), y: S::new(3) }, + Partial { x: S::new(5), y: S::new(2) })); +} diff --git a/src/test/run-pass/structs-enums/struct-path-associated-type.rs b/src/test/run-pass/structs-enums/struct-path-associated-type.rs new file mode 100644 index 00000000000..868be134121 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-path-associated-type.rs @@ -0,0 +1,36 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct S { + a: T, + b: U, +} + +trait Tr { + type A; +} +impl Tr for u8 { + type A = S; +} + +fn f>>() { + let s = T::A { a: 0, b: 1 }; + match s { + T::A { a, b } => { + assert_eq!(a, 0); + assert_eq!(b, 1); + } + } +} + +fn main() { + f::(); +} diff --git a/src/test/run-pass/structs-enums/struct-path-self.rs b/src/test/run-pass/structs-enums/struct-path-self.rs new file mode 100644 index 00000000000..9163569f9c1 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-path-self.rs @@ -0,0 +1,55 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::Add; + +struct S { + a: T, + b: U, +} + +trait Tr { + fn f(&self) -> Self; +} + +impl, U: Default> Tr for S { + fn f(&self) -> Self { + let s = Self { a: Default::default(), b: Default::default() }; + match s { + Self { a, b } => Self { a: a + 1, b: b } + } + } +} + +impl> S { + fn g(&self) -> Self { + let s = Self { a: Default::default(), b: Default::default() }; + match s { + Self { a, b } => Self { a: a, b: b + 1 } + } + } +} + +impl S { + fn new() -> Self { + Self { a: 0, b: 1 } + } +} + +fn main() { + let s0 = S::new(); + let s1 = s0.f(); + assert_eq!(s1.a, 1); + assert_eq!(s1.b, 0); + let s2 = s0.g(); + assert_eq!(s2.a, 0); + assert_eq!(s2.b, 1); +} diff --git a/src/test/run-pass/structs-enums/struct-pattern-matching.rs b/src/test/run-pass/structs-enums/struct-pattern-matching.rs new file mode 100644 index 00000000000..c6f769706a6 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-pattern-matching.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_shorthand_field_patterns)] + +struct Foo { + x: isize, + y: isize, +} + +pub fn main() { + let a = Foo { x: 1, y: 2 }; + match a { + Foo { x: x, y: y } => println!("yes, {}, {}", x, y) + } + + match a { + Foo { .. } => () + } +} diff --git a/src/test/run-pass/structs-enums/struct-return.rs b/src/test/run-pass/structs-enums/struct-return.rs new file mode 100644 index 00000000000..a2b380c7e18 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-return.rs @@ -0,0 +1,73 @@ +// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-wasm32-bare no libc to test ffi with + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Quad { a: u64, b: u64, c: u64, d: u64 } + +#[repr(C)] +#[derive(Copy, Clone)] +pub struct Floats { a: f64, b: u8, c: f64 } + +mod rustrt { + use super::{Floats, Quad}; + + #[link(name = "rust_test_helpers", kind = "static")] + extern { + pub fn rust_dbg_abi_1(q: Quad) -> Quad; + pub fn rust_dbg_abi_2(f: Floats) -> Floats; + } +} + +fn test1() { + unsafe { + let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa, + b: 0xbbbb_bbbb_bbbb_bbbb, + c: 0xcccc_cccc_cccc_cccc, + d: 0xdddd_dddd_dddd_dddd }; + let qq = rustrt::rust_dbg_abi_1(q); + println!("a: {:x}", qq.a as usize); + println!("b: {:x}", qq.b as usize); + println!("c: {:x}", qq.c as usize); + println!("d: {:x}", qq.d as usize); + assert_eq!(qq.a, q.c + 1); + assert_eq!(qq.b, q.d - 1); + assert_eq!(qq.c, q.a + 1); + assert_eq!(qq.d, q.b - 1); + } +} + +#[cfg(target_pointer_width = "64")] +fn test2() { + unsafe { + let f = Floats { a: 1.234567890e-15_f64, + b: 0b_1010_1010, + c: 1.0987654321e-15_f64 }; + let ff = rustrt::rust_dbg_abi_2(f); + println!("a: {}", ff.a as f64); + println!("b: {}", ff.b as usize); + println!("c: {}", ff.c as f64); + assert_eq!(ff.a, f.c + 1.0f64); + assert_eq!(ff.b, 0xff); + assert_eq!(ff.c, f.a - 1.0f64); + } +} + +#[cfg(target_pointer_width = "32")] +fn test2() { +} + +pub fn main() { + test1(); + test2(); +} diff --git a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs new file mode 100644 index 00000000000..4b7854145f0 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +mod foo { + pub enum Foo { + Bar { a: isize } + } +} + +fn f(f: foo::Foo) { + match f { + foo::Foo::Bar { a: _a } => {} + } +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/struct_variant_xc.rs b/src/test/run-pass/structs-enums/struct_variant_xc.rs new file mode 100644 index 00000000000..82881f6b348 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct_variant_xc.rs @@ -0,0 +1,21 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:struct_variant_xc_aux.rs +// pretty-expanded FIXME #23616 + +extern crate struct_variant_xc_aux; + +use struct_variant_xc_aux::Enum::StructVariant; + +pub fn main() { + let _ = StructVariant { arg: 1 }; +} diff --git a/src/test/run-pass/structs-enums/struct_variant_xc_match.rs b/src/test/run-pass/structs-enums/struct_variant_xc_match.rs new file mode 100644 index 00000000000..55b3b1018e9 --- /dev/null +++ b/src/test/run-pass/structs-enums/struct_variant_xc_match.rs @@ -0,0 +1,24 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:struct_variant_xc_aux.rs + +extern crate struct_variant_xc_aux; + +use struct_variant_xc_aux::Enum::{StructVariant, Variant}; + +pub fn main() { + let arg = match (StructVariant { arg: 42 }) { + Variant(_) => unreachable!(), + StructVariant { arg } => arg + }; + assert_eq!(arg, 42); +} diff --git a/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs b/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs new file mode 100644 index 00000000000..a7f7841fac8 --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs @@ -0,0 +1,38 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +use std::mem; + +enum Tag { + Tag2(A) +} + +struct Rec { + c8: u8, + t: Tag +} + +fn mk_rec() -> Rec { + return Rec { c8:0, t:Tag::Tag2(0) }; +} + +fn is_u64_aligned(u: &Tag) -> bool { + let p: usize = unsafe { mem::transmute(u) }; + let u64_align = std::mem::min_align_of::(); + return (p & (u64_align - 1)) == 0; +} + +pub fn main() { + let x = mk_rec(); + assert!(is_u64_aligned(&x.t)); +} diff --git a/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs b/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs new file mode 100644 index 00000000000..cbba62d156b --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs @@ -0,0 +1,76 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] +#![allow(non_snake_case)] + +use std::mem; + +enum Tag { + VarA(A), + VarB(B), +} + +struct Rec { + chA: u8, + tA: Tag, + chB: u8, + tB: Tag, +} + +fn mk_rec(a: A, b: B) -> Rec { + Rec { chA:0, tA:Tag::VarA(a), chB:1, tB:Tag::VarB(b) } +} + +fn is_aligned(amnt: usize, u: &A) -> bool { + let p: usize = unsafe { mem::transmute(u) }; + return (p & (amnt-1)) == 0; +} + +fn variant_data_is_aligned(amnt: usize, u: &Tag) -> bool { + match u { + &Tag::VarA(ref a) => is_aligned(amnt, a), + &Tag::VarB(ref b) => is_aligned(amnt, b) + } +} + +pub fn main() { + let u64_align = std::mem::min_align_of::(); + let x = mk_rec(22u64, 23u64); + assert!(is_aligned(u64_align, &x.tA)); + assert!(variant_data_is_aligned(u64_align, &x.tA)); + assert!(is_aligned(u64_align, &x.tB)); + assert!(variant_data_is_aligned(u64_align, &x.tB)); + + let x = mk_rec(22u64, 23u32); + assert!(is_aligned(u64_align, &x.tA)); + assert!(variant_data_is_aligned(u64_align, &x.tA)); + assert!(is_aligned(u64_align, &x.tB)); + assert!(variant_data_is_aligned(4, &x.tB)); + + let x = mk_rec(22u32, 23u64); + assert!(is_aligned(u64_align, &x.tA)); + assert!(variant_data_is_aligned(4, &x.tA)); + assert!(is_aligned(u64_align, &x.tB)); + assert!(variant_data_is_aligned(u64_align, &x.tB)); + + let x = mk_rec(22u32, 23u32); + assert!(is_aligned(4, &x.tA)); + assert!(variant_data_is_aligned(4, &x.tA)); + assert!(is_aligned(4, &x.tB)); + assert!(variant_data_is_aligned(4, &x.tB)); + + let x = mk_rec(22f64, 23f64); + assert!(is_aligned(u64_align, &x.tA)); + assert!(variant_data_is_aligned(u64_align, &x.tA)); + assert!(is_aligned(u64_align, &x.tB)); + assert!(variant_data_is_aligned(u64_align, &x.tB)); +} diff --git a/src/test/run-pass/structs-enums/tag-align-shape.rs b/src/test/run-pass/structs-enums/tag-align-shape.rs new file mode 100644 index 00000000000..1aff17f77d4 --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-align-shape.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#[derive(Debug)] +enum a_tag { + a_tag_var(u64) +} + +#[derive(Debug)] +struct t_rec { + c8: u8, + t: a_tag +} + +pub fn main() { + let x = t_rec {c8: 22, t: a_tag::a_tag_var(44)}; + let y = format!("{:?}", x); + println!("y = {:?}", y); + assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string()); +} diff --git a/src/test/run-pass/structs-enums/tag-align-u64.rs b/src/test/run-pass/structs-enums/tag-align-u64.rs new file mode 100644 index 00000000000..9f6349a23ad --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-align-u64.rs @@ -0,0 +1,38 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(deprecated)] + +use std::mem; + +enum Tag { + TagInner(u64) +} + +struct Rec { + c8: u8, + t: Tag +} + +fn mk_rec() -> Rec { + return Rec { c8:0, t:Tag::TagInner(0) }; +} + +fn is_u64_aligned(u: &Tag) -> bool { + let p: usize = unsafe { mem::transmute(u) }; + let u64_align = std::mem::min_align_of::(); + return (p & (u64_align - 1)) == 0; +} + +pub fn main() { + let x = mk_rec(); + assert!(is_u64_aligned(&x.t)); +} diff --git a/src/test/run-pass/structs-enums/tag-disr-val-shape.rs b/src/test/run-pass/structs-enums/tag-disr-val-shape.rs new file mode 100644 index 00000000000..bfc3213a040 --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-disr-val-shape.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#[derive(Debug)] +enum color { + red = 0xff0000, + green = 0x00ff00, + blue = 0x0000ff, + black = 0x000000, + white = 0xFFFFFF, +} + +pub fn main() { + let act = format!("{:?}", color::red); + println!("{}", act); + assert_eq!("red".to_string(), act); + assert_eq!("green".to_string(), format!("{:?}", color::green)); + assert_eq!("white".to_string(), format!("{:?}", color::white)); +} diff --git a/src/test/run-pass/structs-enums/tag-exports.rs b/src/test/run-pass/structs-enums/tag-exports.rs new file mode 100644 index 00000000000..d0eea7bdcd2 --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-exports.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +use alder::*; + +mod alder { + pub enum burnside { couch, davis } + pub enum everett { flanders, glisan, hoyt } + pub enum irving { johnson, kearney, lovejoy } + pub enum marshall { northrup, overton } +} + +pub fn main() { + let _pettygrove: burnside = burnside::couch; + let _quimby: everett = everett::flanders; + let _raleigh: irving = irving::johnson; + let _savier: marshall; +} diff --git a/src/test/run-pass/structs-enums/tag-in-block.rs b/src/test/run-pass/structs-enums/tag-in-block.rs new file mode 100644 index 00000000000..db9b2c3b60c --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-in-block.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + +// pretty-expanded FIXME #23616 + +fn foo() { + fn zed(_z: bar) { } + enum bar { nil, } + fn baz() { zed(bar::nil); } +} + +pub fn main() { } diff --git a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs new file mode 100644 index 00000000000..085d0bc1fdc --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum color { + red = 1, + blue = 2, +} + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/tag-variant-disr-val.rs b/src/test/run-pass/structs-enums/tag-variant-disr-val.rs new file mode 100644 index 00000000000..9f82faad158 --- /dev/null +++ b/src/test/run-pass/structs-enums/tag-variant-disr-val.rs @@ -0,0 +1,76 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use color::{red, green, blue, black, white, imaginary, purple, orange}; + +#[derive(Copy, Clone)] +enum color { + red = 0xff0000, + green = 0x00ff00, + blue = 0x0000ff, + black = 0x000000, + white = 0xFFFFFF, + imaginary = -1, + purple = 1 << 1, + orange = 8 >> 1 +} + +impl PartialEq for color { + fn eq(&self, other: &color) -> bool { + ((*self) as usize) == ((*other) as usize) + } + fn ne(&self, other: &color) -> bool { !(*self).eq(other) } +} + +pub fn main() { + test_color(red, 0xff0000, "red".to_string()); + test_color(green, 0x00ff00, "green".to_string()); + test_color(blue, 0x0000ff, "blue".to_string()); + test_color(black, 0x000000, "black".to_string()); + test_color(white, 0xFFFFFF, "white".to_string()); + test_color(imaginary, -1, "imaginary".to_string()); + test_color(purple, 2, "purple".to_string()); + test_color(orange, 4, "orange".to_string()); +} + +fn test_color(color: color, val: isize, name: String) { + //assert_eq!(unsafe::transmute(color), val); + assert_eq!(color as isize, val); + assert_eq!(get_color_alt(color), name); + assert_eq!(get_color_if(color), name); +} + +fn get_color_alt(color: color) -> String { + match color { + red => {"red".to_string()} + green => {"green".to_string()} + blue => {"blue".to_string()} + black => {"black".to_string()} + white => {"white".to_string()} + imaginary => {"imaginary".to_string()} + purple => {"purple".to_string()} + orange => {"orange".to_string()} + } +} + +fn get_color_if(color: color) -> String { + if color == red {"red".to_string()} + else if color == green {"green".to_string()} + else if color == blue {"blue".to_string()} + else if color == black {"black".to_string()} + else if color == white {"white".to_string()} + else if color == imaginary {"imaginary".to_string()} + else if color == purple {"purple".to_string()} + else if color == orange {"orange".to_string()} + else {"unknown".to_string()} +} diff --git a/src/test/run-pass/structs-enums/tag.rs b/src/test/run-pass/structs-enums/tag.rs new file mode 100644 index 00000000000..bd28320ffb6 --- /dev/null +++ b/src/test/run-pass/structs-enums/tag.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +enum colour { red(isize, isize), green, } + +impl PartialEq for colour { + fn eq(&self, other: &colour) -> bool { + match *self { + colour::red(a0, b0) => { + match (*other) { + colour::red(a1, b1) => a0 == a1 && b0 == b1, + colour::green => false, + } + } + colour::green => { + match (*other) { + colour::red(..) => false, + colour::green => true + } + } + } + } + fn ne(&self, other: &colour) -> bool { !(*self).eq(other) } +} + +fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); } + +pub fn main() { f(); } diff --git a/src/test/run-pass/structs-enums/tuple-struct-construct.rs b/src/test/run-pass/structs-enums/tuple-struct-construct.rs new file mode 100644 index 00000000000..58bed9d6b93 --- /dev/null +++ b/src/test/run-pass/structs-enums/tuple-struct-construct.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(Debug)] +struct Foo(isize, isize); + +pub fn main() { + let x = Foo(1, 2); + println!("{:?}", x); +} diff --git a/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs b/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs new file mode 100644 index 00000000000..a4b5e41fdf5 --- /dev/null +++ b/src/test/run-pass/structs-enums/tuple-struct-constructor-pointer.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#[derive(PartialEq, Debug)] +struct Foo(isize); +#[derive(PartialEq, Debug)] +struct Bar(isize, isize); + +pub fn main() { + let f: fn(isize) -> Foo = Foo; + let g: fn(isize, isize) -> Bar = Bar; + assert_eq!(f(42), Foo(42)); + assert_eq!(g(4, 7), Bar(4, 7)); +} diff --git a/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs b/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs new file mode 100644 index 00000000000..cf2940e796f --- /dev/null +++ b/src/test/run-pass/structs-enums/tuple-struct-destructuring.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo(isize, isize); + +pub fn main() { + let x = Foo(1, 2); + let Foo(y, z) = x; + println!("{} {}", y, z); + assert_eq!(y, 1); + assert_eq!(z, 2); +} diff --git a/src/test/run-pass/structs-enums/tuple-struct-matching.rs b/src/test/run-pass/structs-enums/tuple-struct-matching.rs new file mode 100644 index 00000000000..95ade509c0e --- /dev/null +++ b/src/test/run-pass/structs-enums/tuple-struct-matching.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo(isize, isize); + +pub fn main() { + let x = Foo(1, 2); + match x { + Foo(a, b) => { + assert_eq!(a, 1); + assert_eq!(b, 2); + println!("{} {}", a, b); + } + } +} diff --git a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs new file mode 100644 index 00000000000..d77d9c7e163 --- /dev/null +++ b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Foo(isize, isize, isize); + +pub fn main() { +} diff --git a/src/test/run-pass/structs-enums/uninstantiable-struct.rs b/src/test/run-pass/structs-enums/uninstantiable-struct.rs new file mode 100644 index 00000000000..8706333c743 --- /dev/null +++ b/src/test/run-pass/structs-enums/uninstantiable-struct.rs @@ -0,0 +1,14 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub struct Z(&'static Z); + +pub fn main() {} diff --git a/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs b/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs new file mode 100644 index 00000000000..1e1605b7be6 --- /dev/null +++ b/src/test/run-pass/structs-enums/unit-like-struct-drop-run.rs @@ -0,0 +1,36 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +// Make sure the destructor is run for unit-like structs. + + +#![feature(alloc)] + +use std::thread; + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) { + panic!("This panic should happen."); + } +} + +pub fn main() { + let x = thread::spawn(move|| { + let _b = Foo; + }).join(); + + let s = x.unwrap_err().downcast::<&'static str>().unwrap(); + assert_eq!(&**s, "This panic should happen."); +} diff --git a/src/test/run-pass/structs-enums/unit-like-struct.rs b/src/test/run-pass/structs-enums/unit-like-struct.rs new file mode 100644 index 00000000000..1a2a4fbbf5f --- /dev/null +++ b/src/test/run-pass/structs-enums/unit-like-struct.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo; + +pub fn main() { + let x: Foo = Foo; + match x { + Foo => { println!("hi"); } + } +} diff --git a/src/test/run-pass/structs-enums/variant-structs-trivial.rs b/src/test/run-pass/structs-enums/variant-structs-trivial.rs new file mode 100644 index 00000000000..9cef1c83476 --- /dev/null +++ b/src/test/run-pass/structs-enums/variant-structs-trivial.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +enum Foo { + Bar { x: isize }, + Baz { y: isize } +} + +pub fn main() { } diff --git a/src/test/run-pass/thinlto/all-crates.rs b/src/test/run-pass/thinlto/all-crates.rs new file mode 100644 index 00000000000..c10b5cc96d6 --- /dev/null +++ b/src/test/run-pass/thinlto/all-crates.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags: -Clto=thin +// no-prefer-dynamic + +fn main() { + println!("hello!"); +} diff --git a/src/test/run-pass/thinlto/auxiliary/dylib.rs b/src/test/run-pass/thinlto/auxiliary/dylib.rs new file mode 100644 index 00000000000..cdb3f49cae8 --- /dev/null +++ b/src/test/run-pass/thinlto/auxiliary/dylib.rs @@ -0,0 +1,16 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// compile-flags: -Z thinlto -C codegen-units=8 + +#[inline] +pub fn foo(b: u8) { + b.to_string(); +} diff --git a/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs b/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs new file mode 100644 index 00000000000..eff7802a245 --- /dev/null +++ b/src/test/run-pass/thinlto/auxiliary/msvc-imp-present.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic +// compile-flags: -Z thinlto -C codegen-units=8 -C prefer-dynamic + +#![crate_type = "rlib"] +#![crate_type = "dylib"] + +pub static A: u32 = 43; + +pub mod a { + pub static A: u32 = 43; +} diff --git a/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs b/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs new file mode 100644 index 00000000000..ccbb0e7a718 --- /dev/null +++ b/src/test/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs @@ -0,0 +1,17 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// no-prefer-dynamic + +#![crate_type = "rlib"] + +pub fn bar() -> u32 { + 3 +} diff --git a/src/test/run-pass/thinlto/dylib-works.rs b/src/test/run-pass/thinlto/dylib-works.rs new file mode 100644 index 00000000000..fc8c0db2e26 --- /dev/null +++ b/src/test/run-pass/thinlto/dylib-works.rs @@ -0,0 +1,19 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:dylib.rs + +extern crate dylib; + +fn main() { + dylib::foo(1); +} diff --git a/src/test/run-pass/thinlto/msvc-imp-present.rs b/src/test/run-pass/thinlto/msvc-imp-present.rs new file mode 100644 index 00000000000..47fc00c79a7 --- /dev/null +++ b/src/test/run-pass/thinlto/msvc-imp-present.rs @@ -0,0 +1,32 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:msvc-imp-present.rs +// compile-flags: -Z thinlto -C codegen-units=8 +// no-prefer-dynamic + +// On MSVC we have a "hack" where we emit symbols that look like `_imp_$name` +// for all exported statics. This is done because we apply `dllimport` to all +// imported constants and this allows everything to actually link correctly. +// +// The ThinLTO passes aggressively remove symbols if they can, and this test +// asserts that the ThinLTO passes don't remove these compiler-generated +// `_imp_*` symbols. The external library that we link in here is compiled with +// ThinLTO and multiple codegen units and has a few exported constants. Note +// that we also namely compile the library as both a dylib and an rlib, but we +// link the rlib to ensure that we assert those generated symbols exist. + +extern crate msvc_imp_present as bar; + +fn main() { + println!("{}", bar::A); +} diff --git a/src/test/run-pass/thinlto/thin-lto-inlines.rs b/src/test/run-pass/thinlto/thin-lto-inlines.rs new file mode 100644 index 00000000000..68b9ab76985 --- /dev/null +++ b/src/test/run-pass/thinlto/thin-lto-inlines.rs @@ -0,0 +1,40 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags: -Z thinlto -C codegen-units=8 -O +// ignore-emscripten can't inspect instructions on emscripten + +// We want to assert here that ThinLTO will inline across codegen units. There's +// not really a great way to do that in general so we sort of hack around it by +// praying two functions go into separate codegen units and then assuming that +// if inlining *doesn't* happen the first byte of the functions will differ. + +pub fn foo() -> u32 { + bar::bar() +} + +mod bar { + pub fn bar() -> u32 { + 3 + } +} + +fn main() { + println!("{} {}", foo(), bar::bar()); + + unsafe { + let foo = foo as usize as *const u8; + let bar = bar::bar as usize as *const u8; + + assert_eq!(*foo, *bar); + } +} diff --git a/src/test/run-pass/thinlto/thin-lto-inlines2.rs b/src/test/run-pass/thinlto/thin-lto-inlines2.rs new file mode 100644 index 00000000000..84809b09785 --- /dev/null +++ b/src/test/run-pass/thinlto/thin-lto-inlines2.rs @@ -0,0 +1,39 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags: -C codegen-units=8 -O -C lto=thin +// aux-build:thin-lto-inlines-aux.rs +// no-prefer-dynamic +// ignore-emscripten can't inspect instructions on emscripten + +// We want to assert here that ThinLTO will inline across codegen units. There's +// not really a great way to do that in general so we sort of hack around it by +// praying two functions go into separate codegen units and then assuming that +// if inlining *doesn't* happen the first byte of the functions will differ. + +extern crate thin_lto_inlines_aux as bar; + +pub fn foo() -> u32 { + bar::bar() +} + +fn main() { + println!("{} {}", foo(), bar::bar()); + + unsafe { + let foo = foo as usize as *const u8; + let bar = bar::bar as usize as *const u8; + + assert_eq!(*foo, *bar); + } +} + diff --git a/src/test/run-pass/thinlto/weak-works.rs b/src/test/run-pass/thinlto/weak-works.rs new file mode 100644 index 00000000000..51516ae87ab --- /dev/null +++ b/src/test/run-pass/thinlto/weak-works.rs @@ -0,0 +1,38 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// compile-flags: -C codegen-units=8 -Z thinlto +// ignore-windows + +#![feature(linkage)] + +pub mod foo { + #[linkage = "weak"] + #[no_mangle] + pub extern "C" fn FOO() -> i32 { + 0 + } +} + +mod bar { + extern "C" { + fn FOO() -> i32; + } + + pub fn bar() -> i32 { + unsafe { FOO() } + } +} + +fn main() { + bar::bar(); +} diff --git a/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs b/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs new file mode 100644 index 00000000000..e9457886be8 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs @@ -0,0 +1,20 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(cfg_target_thread_local, const_fn, thread_local)] +#![crate_type = "lib"] + +#[cfg(target_thread_local)] +use std::cell::Cell; + +#[no_mangle] +#[cfg(target_thread_local)] +#[thread_local] +pub static FOO: Cell = Cell::new(3); diff --git a/src/test/run-pass/threads-sendsync/comm.rs b/src/test/run-pass/threads-sendsync/comm.rs new file mode 100644 index 00000000000..7a8e27ca20b --- /dev/null +++ b/src/test/run-pass/threads-sendsync/comm.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +pub fn main() { + let (tx, rx) = channel(); + let t = thread::spawn(move|| { child(&tx) }); + let y = rx.recv().unwrap(); + println!("received"); + println!("{}", y); + assert_eq!(y, 10); + t.join(); +} + +fn child(c: &Sender) { + println!("sending"); + c.send(10).unwrap(); + println!("value sent"); +} diff --git a/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs b/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs new file mode 100644 index 00000000000..00a7acfa94f --- /dev/null +++ b/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs @@ -0,0 +1,43 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::thread; +use std::sync::Mutex; + +fn par_for(iter: I, f: F) + where I: Iterator, + I::Item: Send, + F: Fn(I::Item) + Sync +{ + for item in iter { + f(item) + } +} + +fn sum(x: &[i32]) { + let sum_lengths = Mutex::new(0); + par_for(x.windows(4), |x| { + *sum_lengths.lock().unwrap() += x.len() + }); + + assert_eq!(*sum_lengths.lock().unwrap(), (x.len() - 3) * 4); +} + +fn main() { + let mut elements = [0; 20]; + + // iterators over references into this stack frame + par_for(elements.iter_mut().enumerate(), |(i, x)| { + *x = i as i32 + }); + + sum(&elements) +} diff --git a/src/test/run-pass/threads-sendsync/send-resource.rs b/src/test/run-pass/threads-sendsync/send-resource.rs new file mode 100644 index 00000000000..be671084c84 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/send-resource.rs @@ -0,0 +1,47 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::channel; + +struct test { + f: isize, +} + +impl Drop for test { + fn drop(&mut self) {} +} + +fn test(f: isize) -> test { + test { + f: f + } +} + +pub fn main() { + let (tx, rx) = channel(); + + let t = thread::spawn(move|| { + let (tx2, rx2) = channel(); + tx.send(tx2).unwrap(); + + let _r = rx2.recv().unwrap(); + }); + + rx.recv().unwrap().send(test(42)).unwrap(); + + t.join(); +} diff --git a/src/test/run-pass/threads-sendsync/send-type-inference.rs b/src/test/run-pass/threads-sendsync/send-type-inference.rs new file mode 100644 index 00000000000..e1aaf6d220e --- /dev/null +++ b/src/test/run-pass/threads-sendsync/send-type-inference.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::sync::mpsc::{channel, Sender}; + +// tests that ctrl's type gets inferred properly +struct Command { + key: K, + val: V +} + +fn cache_server(mut tx: Sender>>) { + let (tx1, _rx) = channel(); + tx.send(tx1); +} +pub fn main() { } diff --git a/src/test/run-pass/threads-sendsync/send_str_hashmap.rs b/src/test/run-pass/threads-sendsync/send_str_hashmap.rs new file mode 100644 index 00000000000..9c165a2b83d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/send_str_hashmap.rs @@ -0,0 +1,63 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::HashMap; +use std::borrow::Cow; + +use std::borrow::Cow::Borrowed as B; +use std::borrow::Cow::Owned as O; + +type SendStr = Cow<'static, str>; + +fn main() { + let mut map: HashMap = HashMap::new(); + assert!(map.insert(B("foo"), 42).is_none()); + assert!(map.insert(O("foo".to_string()), 42).is_some()); + assert!(map.insert(B("foo"), 42).is_some()); + assert!(map.insert(O("foo".to_string()), 42).is_some()); + + assert!(map.insert(B("foo"), 43).is_some()); + assert!(map.insert(O("foo".to_string()), 44).is_some()); + assert!(map.insert(B("foo"), 45).is_some()); + assert!(map.insert(O("foo".to_string()), 46).is_some()); + + let v = 46; + + assert_eq!(map.get(&O("foo".to_string())), Some(&v)); + assert_eq!(map.get(&B("foo")), Some(&v)); + + let (a, b, c, d) = (50, 51, 52, 53); + + assert!(map.insert(B("abc"), a).is_none()); + assert!(map.insert(O("bcd".to_string()), b).is_none()); + assert!(map.insert(B("cde"), c).is_none()); + assert!(map.insert(O("def".to_string()), d).is_none()); + + assert!(map.insert(B("abc"), a).is_some()); + assert!(map.insert(O("bcd".to_string()), b).is_some()); + assert!(map.insert(B("cde"), c).is_some()); + assert!(map.insert(O("def".to_string()), d).is_some()); + + assert!(map.insert(O("abc".to_string()), a).is_some()); + assert!(map.insert(B("bcd"), b).is_some()); + assert!(map.insert(O("cde".to_string()), c).is_some()); + assert!(map.insert(B("def"), d).is_some()); + + assert_eq!(map.get("abc"), Some(&a)); + assert_eq!(map.get("bcd"), Some(&b)); + assert_eq!(map.get("cde"), Some(&c)); + assert_eq!(map.get("def"), Some(&d)); + + assert_eq!(map.get(&B("abc")), Some(&a)); + assert_eq!(map.get(&B("bcd")), Some(&b)); + assert_eq!(map.get(&B("cde")), Some(&c)); + assert_eq!(map.get(&B("def")), Some(&d)); +} diff --git a/src/test/run-pass/threads-sendsync/send_str_treemap.rs b/src/test/run-pass/threads-sendsync/send_str_treemap.rs new file mode 100644 index 00000000000..94fa7d94a18 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/send_str_treemap.rs @@ -0,0 +1,68 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::BTreeMap; +use std::borrow::Cow; + +use std::borrow::Cow::{Owned as O, Borrowed as B}; + +type SendStr = Cow<'static, str>; + +fn main() { + let mut map: BTreeMap = BTreeMap::new(); + assert!(map.insert(B("foo"), 42).is_none()); + assert!(map.insert(O("foo".to_string()), 42).is_some()); + assert!(map.insert(B("foo"), 42).is_some()); + assert!(map.insert(O("foo".to_string()), 42).is_some()); + + assert!(map.insert(B("foo"), 43).is_some()); + assert!(map.insert(O("foo".to_string()), 44).is_some()); + assert!(map.insert(B("foo"), 45).is_some()); + assert!(map.insert(O("foo".to_string()), 46).is_some()); + + let v = 46; + + assert_eq!(map.get(&O("foo".to_string())), Some(&v)); + assert_eq!(map.get(&B("foo")), Some(&v)); + + let (a, b, c, d) = (50, 51, 52, 53); + + assert!(map.insert(B("abc"), a).is_none()); + assert!(map.insert(O("bcd".to_string()), b).is_none()); + assert!(map.insert(B("cde"), c).is_none()); + assert!(map.insert(O("def".to_string()), d).is_none()); + + assert!(map.insert(B("abc"), a).is_some()); + assert!(map.insert(O("bcd".to_string()), b).is_some()); + assert!(map.insert(B("cde"), c).is_some()); + assert!(map.insert(O("def".to_string()), d).is_some()); + + assert!(map.insert(O("abc".to_string()), a).is_some()); + assert!(map.insert(B("bcd"), b).is_some()); + assert!(map.insert(O("cde".to_string()), c).is_some()); + assert!(map.insert(B("def"), d).is_some()); + + assert_eq!(map.get(&B("abc")), Some(&a)); + assert_eq!(map.get(&B("bcd")), Some(&b)); + assert_eq!(map.get(&B("cde")), Some(&c)); + assert_eq!(map.get(&B("def")), Some(&d)); + + assert_eq!(map.get(&O("abc".to_string())), Some(&a)); + assert_eq!(map.get(&O("bcd".to_string())), Some(&b)); + assert_eq!(map.get(&O("cde".to_string())), Some(&c)); + assert_eq!(map.get(&O("def".to_string())), Some(&d)); + + assert!(map.remove(&B("foo")).is_some()); + assert_eq!(map.into_iter().map(|(k, v)| format!("{}{}", k, v)) + .collect::>() + .concat(), + "abc50bcd51cde52def53".to_string()); +} diff --git a/src/test/run-pass/threads-sendsync/sendable-class.rs b/src/test/run-pass/threads-sendsync/sendable-class.rs new file mode 100644 index 00000000000..2e82a278f3d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sendable-class.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Test that a class with only sendable fields can be sent + +// pretty-expanded FIXME #23616 + +use std::sync::mpsc::channel; + +struct foo { + i: isize, + j: char, +} + +fn foo(i:isize, j: char) -> foo { + foo { + i: i, + j: j + } +} + +pub fn main() { + let (tx, rx) = channel(); + tx.send(foo(42, 'c')); +} diff --git a/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs b/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs new file mode 100644 index 00000000000..55144a7d386 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sendfn-is-a-block.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +fn test(f: F) -> usize where F: FnOnce(usize) -> usize { + return f(22); +} + +pub fn main() { + let y = test(|x| 4 * x); + assert_eq!(y, 88); +} diff --git a/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs b/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs new file mode 100644 index 00000000000..24d54b8a0b6 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(box_syntax)] + +use std::thread; + +pub fn main() { test05(); } + +fn test05_start(f: F) { + f(22); +} + +fn test05() { + let three: Box<_> = box 3; + let fn_to_send = move|n:isize| { + println!("{}", *three + n); // will copy x into the closure + assert_eq!(*three, 3); + }; + thread::spawn(move|| { + test05_start(fn_to_send); + }).join().ok().unwrap(); +} diff --git a/src/test/run-pass/threads-sendsync/spawn-fn.rs b/src/test/run-pass/threads-sendsync/spawn-fn.rs new file mode 100644 index 00000000000..39fbba04361 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/spawn-fn.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +fn x(s: String, n: isize) { + println!("{}", s); + println!("{}", n); +} + +pub fn main() { + let t1 = thread::spawn(|| x("hello from first spawned fn".to_string(), 65) ); + let t2 = thread::spawn(|| x("hello from second spawned fn".to_string(), 66) ); + let t3 = thread::spawn(|| x("hello from third spawned fn".to_string(), 67) ); + let mut i = 30; + while i > 0 { + i = i - 1; + println!("parent sleeping"); + thread::yield_now(); + } + t1.join(); + t2.join(); + t3.join(); +} diff --git a/src/test/run-pass/threads-sendsync/spawn-types.rs b/src/test/run-pass/threads-sendsync/spawn-types.rs new file mode 100644 index 00000000000..f7abb984b68 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/spawn-types.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// ignore-emscripten no threads support + +/* + Make sure we can spawn tasks that take different types of + parameters. This is based on a test case for #520 provided by Rob + Arnold. + */ + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +type ctx = Sender; + +fn iotask(_tx: &ctx, ip: String) { + assert_eq!(ip, "localhost".to_string()); +} + +pub fn main() { + let (tx, _rx) = channel::(); + let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) ); + t.join().ok().unwrap(); +} diff --git a/src/test/run-pass/threads-sendsync/spawn.rs b/src/test/run-pass/threads-sendsync/spawn.rs new file mode 100644 index 00000000000..7aa459a895b --- /dev/null +++ b/src/test/run-pass/threads-sendsync/spawn.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +pub fn main() { + thread::spawn(move|| child(10)).join().ok().unwrap(); +} + +fn child(i: isize) { println!("{}", i); assert_eq!(i, 10); } diff --git a/src/test/run-pass/threads-sendsync/spawn2.rs b/src/test/run-pass/threads-sendsync/spawn2.rs new file mode 100644 index 00000000000..549360b851c --- /dev/null +++ b/src/test/run-pass/threads-sendsync/spawn2.rs @@ -0,0 +1,41 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +pub fn main() { + let t = thread::spawn(move|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); + t.join().ok().unwrap(); // forget Err value, since it doesn't implement Debug +} + +fn child(args: (isize, isize, isize, isize, isize, isize, isize, isize, isize)) { + let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args; + println!("{}", i1); + println!("{}", i2); + println!("{}", i3); + println!("{}", i4); + println!("{}", i5); + println!("{}", i6); + println!("{}", i7); + println!("{}", i8); + println!("{}", i9); + assert_eq!(i1, 10); + assert_eq!(i2, 20); + assert_eq!(i3, 30); + assert_eq!(i4, 40); + assert_eq!(i5, 50); + assert_eq!(i6, 60); + assert_eq!(i7, 70); + assert_eq!(i8, 80); + assert_eq!(i9, 90); +} diff --git a/src/test/run-pass/threads-sendsync/spawning-with-debug.rs b/src/test/run-pass/threads-sendsync/spawning-with-debug.rs new file mode 100644 index 00000000000..e582cff43ab --- /dev/null +++ b/src/test/run-pass/threads-sendsync/spawning-with-debug.rs @@ -0,0 +1,23 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-windows +// exec-env:RUST_LOG=debug +// ignore-emscripten no threads support + +// regression test for issue #10405, make sure we don't call println! too soon. + +use std::thread::Builder; + +pub fn main() { + let mut t = Builder::new(); + t.spawn(move|| ()); +} diff --git a/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs b/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs new file mode 100644 index 00000000000..e5658683a8e --- /dev/null +++ b/src/test/run-pass/threads-sendsync/std-sync-right-kind-impls.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +use std::sync; + +fn assert_both() {} + +fn main() { + assert_both::>(); + assert_both::(); + assert_both::>(); + assert_both::(); + assert_both::>(); + assert_both::>(); + assert_both::(); +} diff --git a/src/test/run-pass/threads-sendsync/sync-send-atomics.rs b/src/test/run-pass/threads-sendsync/sync-send-atomics.rs new file mode 100644 index 00000000000..53b19db5d48 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sync-send-atomics.rs @@ -0,0 +1,24 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// pretty-expanded FIXME #23616 + +use std::sync::atomic::*; + +trait SendSync: Send + Sync {} + +impl SendSync for AtomicBool {} +impl SendSync for AtomicIsize {} +impl SendSync for AtomicUsize {} +impl SendSync for AtomicPtr {} + +fn main() {} diff --git a/src/test/run-pass/threads-sendsync/sync-send-in-std.rs b/src/test/run-pass/threads-sendsync/sync-send-in-std.rs new file mode 100644 index 00000000000..93f1bc48b0d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sync-send-in-std.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// ignore-cloudabi networking not available +// ignore-wasm32-bare networking not available + +use std::net::ToSocketAddrs; + +fn is_sync(_: T) where T: Sync {} +fn is_send(_: T) where T: Send {} + +macro_rules! all_sync_send { + ($ctor:expr, $($iter:ident),+) => ({ + $( + let mut x = $ctor; + is_sync(x.$iter()); + let mut y = $ctor; + is_send(y.$iter()); + )+ + }) +} + +fn main() { + all_sync_send!("localhost:80".to_socket_addrs().unwrap(), next); +} diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs new file mode 100644 index 00000000000..b62f6c4cc6d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs @@ -0,0 +1,80 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(warnings)] +#![feature(drain, collections_bound, btree_range)] + +use std::collections::BinaryHeap; +use std::collections::{BTreeMap, BTreeSet}; +use std::collections::LinkedList; +use std::collections::VecDeque; +use std::collections::HashMap; +use std::collections::HashSet; + +use std::mem; +use std::ops::Bound::Included; + +fn is_sync(_: T) where T: Sync {} +fn is_send(_: T) where T: Send {} + +macro_rules! all_sync_send { + ($ctor:expr, $($iter:ident),+) => ({ + $( + let mut x = $ctor; + is_sync(x.$iter()); + let mut y = $ctor; + is_send(y.$iter()); + )+ + }) +} + +macro_rules! is_sync_send { + ($ctor:expr, $iter:ident($($param:expr),+)) => ({ + let mut x = $ctor; + is_sync(x.$iter($( $param ),+)); + let mut y = $ctor; + is_send(y.$iter($( $param ),+)); + }) +} + +fn main() { + // The iterator "generator" list should exhaust what corresponding + // implementations have where `Sync` and `Send` semantics apply. + all_sync_send!(BinaryHeap::::new(), iter, drain, into_iter); + + all_sync_send!(BTreeMap::::new(), iter, iter_mut, into_iter, keys, values); + is_sync_send!(BTreeMap::::new(), range((Included(&0), Included(&9)))); + is_sync_send!(BTreeMap::::new(), range_mut((Included(&0), Included(&9)))); + + all_sync_send!(BTreeSet::::new(), iter, into_iter); + is_sync_send!(BTreeSet::::new(), range((Included(&0), Included(&9)))); + is_sync_send!(BTreeSet::::new(), difference(&BTreeSet::::new())); + is_sync_send!(BTreeSet::::new(), symmetric_difference(&BTreeSet::::new())); + is_sync_send!(BTreeSet::::new(), intersection(&BTreeSet::::new())); + is_sync_send!(BTreeSet::::new(), union(&BTreeSet::::new())); + + all_sync_send!(HashMap::::new(), iter, iter_mut, drain, into_iter, keys, values); + all_sync_send!(HashSet::::new(), iter, drain, into_iter); + is_sync_send!(HashSet::::new(), difference(&HashSet::::new())); + is_sync_send!(HashSet::::new(), symmetric_difference(&HashSet::::new())); + is_sync_send!(HashSet::::new(), intersection(&HashSet::::new())); + is_sync_send!(HashSet::::new(), union(&HashSet::::new())); + + all_sync_send!(LinkedList::::new(), iter, iter_mut, into_iter); + + all_sync_send!(VecDeque::::new(), iter, iter_mut, into_iter); + is_sync_send!(VecDeque::::new(), drain(..)); + + all_sync_send!(Vec::::new(), into_iter); + is_sync_send!(Vec::::new(), drain(..)); + is_sync_send!(String::new(), drain(..)); +} diff --git a/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs new file mode 100644 index 00000000000..e95014d829d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs @@ -0,0 +1,117 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(warnings)] +#![feature(iter_empty)] +#![feature(iter_once)] +#![feature(str_escape)] + +use std::iter::{empty, once, repeat}; + +fn is_sync(_: T) where T: Sync {} +fn is_send(_: T) where T: Send {} + +macro_rules! all_sync_send { + ($ctor:expr, $iter:ident) => ({ + let mut x = $ctor; + is_sync(x.$iter()); + let mut y = $ctor; + is_send(y.$iter()); + }); + ($ctor:expr, $iter:ident($($param:expr),+)) => ({ + let mut x = $ctor; + is_sync(x.$iter($( $param ),+)); + let mut y = $ctor; + is_send(y.$iter($( $param ),+)); + }); + ($ctor:expr, $iter:ident, $($rest:tt)*) => ({ + all_sync_send!($ctor, $iter); + all_sync_send!($ctor, $($rest)*); + }); + ($ctor:expr, $iter:ident($($param:expr),+), $($rest:tt)*) => ({ + all_sync_send!($ctor, $iter($( $param ),+)); + all_sync_send!($ctor, $($rest)*); + }); +} + +macro_rules! all_sync_send_mutable_ref { + ($ctor:expr, $($iter:ident),+) => ({ + $( + let mut x = $ctor; + is_sync((&mut x).$iter()); + let mut y = $ctor; + is_send((&mut y).$iter()); + )+ + }) +} + +macro_rules! is_sync_send { + ($ctor:expr) => ({ + let x = $ctor; + is_sync(x); + let y = $ctor; + is_send(y); + }) +} + +fn main() { + // for char.rs + all_sync_send!("Я", escape_debug, escape_default, escape_unicode); + + // for iter.rs + all_sync_send_mutable_ref!([1], iter); + + // Bytes implements DoubleEndedIterator + all_sync_send!("a".bytes(), rev); + + let a = [1]; + let b = [2]; + all_sync_send!(a.iter(), + cloned, + cycle, + chain([2].iter()), + zip([2].iter()), + map(|_| 1), + filter(|_| true), + filter_map(|_| Some(1)), + enumerate, + peekable, + skip_while(|_| true), + take_while(|_| true), + skip(1), + take(1), + scan(1, |_, _| Some(1)), + flat_map(|_| b.iter()), + fuse, + inspect(|_| ())); + + is_sync_send!((1..).step_by(2)); + is_sync_send!((1..2).step_by(2)); + is_sync_send!((1..2)); + is_sync_send!((1..)); + is_sync_send!(repeat(1)); + is_sync_send!(empty::()); + is_sync_send!(once(1)); + + // for option.rs + // FIXME + + // for result.rs + // FIXME + + // for slice.rs + // FIXME + + // for str/mod.rs + // FIXME +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-0.rs b/src/test/run-pass/threads-sendsync/task-comm-0.rs new file mode 100644 index 00000000000..1626b23fdc2 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-0.rs @@ -0,0 +1,39 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +pub fn main() { test05(); } + +fn test05_start(tx : &Sender) { + tx.send(10).unwrap(); + println!("sent 10"); + tx.send(20).unwrap(); + println!("sent 20"); + tx.send(30).unwrap(); + println!("sent 30"); +} + +fn test05() { + let (tx, rx) = channel(); + let t = thread::spawn(move|| { test05_start(&tx) }); + let mut value: isize = rx.recv().unwrap(); + println!("{}", value); + value = rx.recv().unwrap(); + println!("{}", value); + value = rx.recv().unwrap(); + println!("{}", value); + assert_eq!(value, 30); + t.join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-1.rs b/src/test/run-pass/threads-sendsync/task-comm-1.rs new file mode 100644 index 00000000000..975789e8cd2 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-1.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +pub fn main() { test00(); } + +fn start() { println!("Started / Finished task."); } + +fn test00() { + thread::spawn(move|| start() ).join(); + println!("Completing."); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-10.rs b/src/test/run-pass/threads-sendsync/task-comm-10.rs new file mode 100644 index 00000000000..cbb22520093 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-10.rs @@ -0,0 +1,41 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +fn start(tx: &Sender>) { + let (tx2, rx) = channel(); + tx.send(tx2).unwrap(); + + let mut a; + let mut b; + a = rx.recv().unwrap(); + assert_eq!(a, "A".to_string()); + println!("{}", a); + b = rx.recv().unwrap(); + assert_eq!(b, "B".to_string()); + println!("{}", b); +} + +pub fn main() { + let (tx, rx) = channel(); + let child = thread::spawn(move|| { start(&tx) }); + + let mut c = rx.recv().unwrap(); + c.send("A".to_string()).unwrap(); + c.send("B".to_string()).unwrap(); + thread::yield_now(); + + child.join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-11.rs b/src/test/run-pass/threads-sendsync/task-comm-11.rs new file mode 100644 index 00000000000..28710116dc3 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-11.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 +// ignore-emscripten no threads support + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +fn start(tx: &Sender>) { + let (tx2, _rx) = channel(); + tx.send(tx2).unwrap(); +} + +pub fn main() { + let (tx, rx) = channel(); + let child = thread::spawn(move|| { + start(&tx) + }); + let _tx = rx.recv().unwrap(); + child.join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-12.rs b/src/test/run-pass/threads-sendsync/task-comm-12.rs new file mode 100644 index 00000000000..e6195bf011b --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-12.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +pub fn main() { test00(); } + +fn start(_task_number: isize) { println!("Started / Finished task."); } + +fn test00() { + let i: isize = 0; + let mut result = thread::spawn(move|| { + start(i) + }); + + // Sleep long enough for the thread to finish. + let mut i = 0_usize; + while i < 10000 { + thread::yield_now(); + i += 1; + } + + // Try joining threads that have already finished. + result.join(); + + println!("Joined task."); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-13.rs b/src/test/run-pass/threads-sendsync/task-comm-13.rs new file mode 100644 index 00000000000..2276fd8031f --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-13.rs @@ -0,0 +1,27 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +fn start(tx: &Sender, start: isize, number_of_messages: isize) { + let mut i: isize = 0; + while i< number_of_messages { tx.send(start + i).unwrap(); i += 1; } +} + +pub fn main() { + println!("Check that we don't deadlock."); + let (tx, rx) = channel(); + let _ = thread::spawn(move|| { start(&tx, 0, 10) }).join(); + println!("Joined task"); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-14.rs b/src/test/run-pass/threads-sendsync/task-comm-14.rs new file mode 100644 index 00000000000..f6a96a84eb6 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-14.rs @@ -0,0 +1,45 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +pub fn main() { + let (tx, rx) = channel(); + + // Spawn 10 threads each sending us back one isize. + let mut i = 10; + while (i > 0) { + println!("{}", i); + let tx = tx.clone(); + thread::spawn({let i = i; move|| { child(i, &tx) }}); + i = i - 1; + } + + // Spawned threads are likely killed before they get a chance to send + // anything back, so we deadlock here. + + i = 10; + while (i > 0) { + println!("{}", i); + rx.recv().unwrap(); + i = i - 1; + } + + println!("main thread exiting"); +} + +fn child(x: isize, tx: &Sender) { + println!("{}", x); + tx.send(x).unwrap(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-15.rs b/src/test/run-pass/threads-sendsync/task-comm-15.rs new file mode 100644 index 00000000000..0398b55720d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-15.rs @@ -0,0 +1,37 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support +// pretty-expanded FIXME #23616 + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +fn start(tx: &Sender, i0: isize) { + let mut i = i0; + while i > 0 { + tx.send(0).unwrap(); + i = i - 1; + } +} + +pub fn main() { + // Spawn a thread that sends us back messages. The parent thread + // is likely to terminate before the child completes, so from + // the child's point of view the receiver may die. We should + // drop messages on the floor in this case, and not crash! + let (tx, rx) = channel(); + let t = thread::spawn(move|| { + start(&tx, 10) + }); + rx.recv(); + t.join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-16.rs b/src/test/run-pass/threads-sendsync/task-comm-16.rs new file mode 100644 index 00000000000..d98766f9194 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-16.rs @@ -0,0 +1,119 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +use std::sync::mpsc::channel; +use std::cmp; + +// Tests of ports and channels on various types +fn test_rec() { + struct R {val0: isize, val1: u8, val2: char} + + let (tx, rx) = channel(); + let r0: R = R {val0: 0, val1: 1, val2: '2'}; + tx.send(r0).unwrap(); + let mut r1: R; + r1 = rx.recv().unwrap(); + assert_eq!(r1.val0, 0); + assert_eq!(r1.val1, 1); + assert_eq!(r1.val2, '2'); +} + +fn test_vec() { + let (tx, rx) = channel(); + let v0: Vec = vec![0, 1, 2]; + tx.send(v0).unwrap(); + let v1 = rx.recv().unwrap(); + assert_eq!(v1[0], 0); + assert_eq!(v1[1], 1); + assert_eq!(v1[2], 2); +} + +fn test_str() { + let (tx, rx) = channel(); + let s0 = "test".to_string(); + tx.send(s0).unwrap(); + let s1 = rx.recv().unwrap(); + assert_eq!(s1.as_bytes()[0], 't' as u8); + assert_eq!(s1.as_bytes()[1], 'e' as u8); + assert_eq!(s1.as_bytes()[2], 's' as u8); + assert_eq!(s1.as_bytes()[3], 't' as u8); +} + +#[derive(Debug)] +enum t { + tag1, + tag2(isize), + tag3(isize, u8, char) +} + +impl cmp::PartialEq for t { + fn eq(&self, other: &t) -> bool { + match *self { + t::tag1 => { + match (*other) { + t::tag1 => true, + _ => false + } + } + t::tag2(e0a) => { + match (*other) { + t::tag2(e0b) => e0a == e0b, + _ => false + } + } + t::tag3(e0a, e1a, e2a) => { + match (*other) { + t::tag3(e0b, e1b, e2b) => + e0a == e0b && e1a == e1b && e2a == e2b, + _ => false + } + } + } + } + fn ne(&self, other: &t) -> bool { !(*self).eq(other) } +} + +fn test_tag() { + let (tx, rx) = channel(); + tx.send(t::tag1).unwrap(); + tx.send(t::tag2(10)).unwrap(); + tx.send(t::tag3(10, 11, 'A')).unwrap(); + let mut t1: t; + t1 = rx.recv().unwrap(); + assert_eq!(t1, t::tag1); + t1 = rx.recv().unwrap(); + assert_eq!(t1, t::tag2(10)); + t1 = rx.recv().unwrap(); + assert_eq!(t1, t::tag3(10, 11, 'A')); +} + +fn test_chan() { + let (tx1, rx1) = channel(); + let (tx2, rx2) = channel(); + tx1.send(tx2).unwrap(); + let tx2 = rx1.recv().unwrap(); + // Does the transmitted channel still work? + + tx2.send(10).unwrap(); + let mut i: isize; + i = rx2.recv().unwrap(); + assert_eq!(i, 10); +} + +pub fn main() { + test_rec(); + test_vec(); + test_str(); + test_tag(); + test_chan(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-17.rs b/src/test/run-pass/threads-sendsync/task-comm-17.rs new file mode 100644 index 00000000000..53a233da820 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-17.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support +// pretty-expanded FIXME #23616 + +// Issue #922 + +// This test is specifically about spawning temporary closures. + +use std::thread; + +fn f() { +} + +pub fn main() { + thread::spawn(move|| f() ).join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-3.rs b/src/test/run-pass/threads-sendsync/task-comm-3.rs new file mode 100644 index 00000000000..d18ed1c567c --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-3.rs @@ -0,0 +1,72 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); } + +fn test00_start(ch: &Sender, message: isize, count: isize) { + println!("Starting test00_start"); + let mut i: isize = 0; + while i < count { + println!("Sending Message"); + ch.send(message + 0).unwrap(); + i = i + 1; + } + println!("Ending test00_start"); +} + +fn test00() { + let number_of_tasks: isize = 16; + let number_of_messages: isize = 4; + + println!("Creating tasks"); + + let (tx, rx) = channel(); + + let mut i: isize = 0; + + // Create and spawn threads... + let mut results = Vec::new(); + while i < number_of_tasks { + let tx = tx.clone(); + results.push(thread::spawn({ + let i = i; + move|| { + test00_start(&tx, i, number_of_messages) + } + })); + i = i + 1; + } + + // Read from spawned threads... + let mut sum = 0; + for _r in &results { + i = 0; + while i < number_of_messages { + let value = rx.recv().unwrap(); + sum += value; + i = i + 1; + } + } + + // Join spawned threads... + for r in results { r.join(); } + + println!("Completed: Final number is: "); + println!("{}", sum); + // assert (sum == (((number_of_threads * (number_of_threads - 1)) / 2) * + // number_of_messages)); + assert_eq!(sum, 480); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-4.rs b/src/test/run-pass/threads-sendsync/task-comm-4.rs new file mode 100644 index 00000000000..47cbf8ec98a --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-4.rs @@ -0,0 +1,54 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::sync::mpsc::channel; + +pub fn main() { test00(); } + +fn test00() { + let mut r: isize = 0; + let mut sum: isize = 0; + let (tx, rx) = channel(); + tx.send(1).unwrap(); + tx.send(2).unwrap(); + tx.send(3).unwrap(); + tx.send(4).unwrap(); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + tx.send(5).unwrap(); + tx.send(6).unwrap(); + tx.send(7).unwrap(); + tx.send(8).unwrap(); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + r = rx.recv().unwrap(); + sum += r; + println!("{}", r); + assert_eq!(sum, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-5.rs b/src/test/run-pass/threads-sendsync/task-comm-5.rs new file mode 100644 index 00000000000..29f5a5d3f27 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-5.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::sync::mpsc::channel; + +pub fn main() { test00(); } + +fn test00() { + let _r: isize = 0; + let mut sum: isize = 0; + let (tx, rx) = channel(); + let number_of_messages: isize = 1000; + let mut i: isize = 0; + while i < number_of_messages { tx.send(i + 0).unwrap(); i += 1; } + i = 0; + while i < number_of_messages { sum += rx.recv().unwrap(); i += 1; } + assert_eq!(sum, number_of_messages * (number_of_messages - 1) / 2); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-6.rs b/src/test/run-pass/threads-sendsync/task-comm-6.rs new file mode 100644 index 00000000000..83eb36728ef --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-6.rs @@ -0,0 +1,50 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::sync::mpsc::channel; + +pub fn main() { test00(); } + +fn test00() { + let mut r: isize = 0; + let mut sum: isize = 0; + let (tx, rx) = channel(); + let mut tx0 = tx.clone(); + let mut tx1 = tx.clone(); + let mut tx2 = tx.clone(); + let mut tx3 = tx.clone(); + let number_of_messages: isize = 1000; + let mut i: isize = 0; + while i < number_of_messages { + tx0.send(i + 0).unwrap(); + tx1.send(i + 0).unwrap(); + tx2.send(i + 0).unwrap(); + tx3.send(i + 0).unwrap(); + i += 1; + } + i = 0; + while i < number_of_messages { + r = rx.recv().unwrap(); + sum += r; + r = rx.recv().unwrap(); + sum += r; + r = rx.recv().unwrap(); + sum += r; + r = rx.recv().unwrap(); + sum += r; + i += 1; + } + assert_eq!(sum, 1998000); + // assert (sum == 4 * ((number_of_messages * + // (number_of_messages - 1)) / 2)); + +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-7.rs b/src/test/run-pass/threads-sendsync/task-comm-7.rs new file mode 100644 index 00000000000..6bf1bad07c1 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-7.rs @@ -0,0 +1,67 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +pub fn main() { test00(); } + +fn test00_start(c: &Sender, start: isize, + number_of_messages: isize) { + let mut i: isize = 0; + while i < number_of_messages { c.send(start + i).unwrap(); i += 1; } +} + +fn test00() { + let mut r: isize = 0; + let mut sum: isize = 0; + let (tx, rx) = channel(); + let number_of_messages: isize = 10; + + let tx2 = tx.clone(); + let t1 = thread::spawn(move|| { + test00_start(&tx2, number_of_messages * 0, number_of_messages); + }); + let tx2 = tx.clone(); + let t2 = thread::spawn(move|| { + test00_start(&tx2, number_of_messages * 1, number_of_messages); + }); + let tx2 = tx.clone(); + let t3 = thread::spawn(move|| { + test00_start(&tx2, number_of_messages * 2, number_of_messages); + }); + let tx2 = tx.clone(); + let t4 = thread::spawn(move|| { + test00_start(&tx2, number_of_messages * 3, number_of_messages); + }); + + let mut i: isize = 0; + while i < number_of_messages { + r = rx.recv().unwrap(); + sum += r; + r = rx.recv().unwrap(); + sum += r; + r = rx.recv().unwrap(); + sum += r; + r = rx.recv().unwrap(); + sum += r; + i += 1; + } + + assert_eq!(sum, number_of_messages * 4 * (number_of_messages * 4 - 1) / 2); + + t1.join(); + t2.join(); + t3.join(); + t4.join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-9.rs b/src/test/run-pass/threads-sendsync/task-comm-9.rs new file mode 100644 index 00000000000..f23a1594507 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-9.rs @@ -0,0 +1,44 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; +use std::sync::mpsc::{channel, Sender}; + +pub fn main() { test00(); } + +fn test00_start(c: &Sender, number_of_messages: isize) { + let mut i: isize = 0; + while i < number_of_messages { c.send(i + 0).unwrap(); i += 1; } +} + +fn test00() { + let r: isize = 0; + let mut sum: isize = 0; + let (tx, rx) = channel(); + let number_of_messages: isize = 10; + + let result = thread::spawn(move|| { + test00_start(&tx, number_of_messages); + }); + + let mut i: isize = 0; + while i < number_of_messages { + sum += rx.recv().unwrap(); + println!("{}", r); + i += 1; + } + + result.join(); + + assert_eq!(sum, number_of_messages * (number_of_messages - 1) / 2); +} diff --git a/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs b/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs new file mode 100644 index 00000000000..d13415a68ca --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-comm-chan-nil.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::sync::mpsc::channel; + +// rustboot can't transmit nils across channels because they don't have +// any size, but rustc currently can because they do have size. Whether +// or not this is desirable I don't know, but here's a regression test. +pub fn main() { + let (tx, rx) = channel(); + tx.send(()).unwrap(); + let n: () = rx.recv().unwrap(); + assert_eq!(n, ()); +} diff --git a/src/test/run-pass/threads-sendsync/task-life-0.rs b/src/test/run-pass/threads-sendsync/task-life-0.rs new file mode 100644 index 00000000000..8ec7c871c68 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-life-0.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support +// pretty-expanded FIXME #23616 + +use std::thread; + +pub fn main() { + thread::spawn(move|| child("Hello".to_string()) ).join(); +} + +fn child(_s: String) { + +} diff --git a/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs b/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs new file mode 100644 index 00000000000..65e2236f2e1 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(box_syntax)] + +use std::thread; +use std::sync::mpsc::channel; + +pub fn main() { + let (tx, rx) = channel::(); + + let x: Box = box 1; + let x_in_parent = &(*x) as *const isize as usize; + + let t = thread::spawn(move || { + let x_in_child = &(*x) as *const isize as usize; + tx.send(x_in_child).unwrap(); + }); + + let x_in_child = rx.recv().unwrap(); + assert_eq!(x_in_parent, x_in_child); + + t.join(); +} diff --git a/src/test/run-pass/threads-sendsync/task-stderr.rs b/src/test/run-pass/threads-sendsync/task-stderr.rs new file mode 100644 index 00000000000..e72809b68b0 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/task-stderr.rs @@ -0,0 +1,42 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(box_syntax, set_stdio)] + +use std::io::prelude::*; +use std::io; +use std::str; +use std::sync::{Arc, Mutex}; +use std::thread; + +struct Sink(Arc>>); +impl Write for Sink { + fn write(&mut self, data: &[u8]) -> io::Result { + Write::write(&mut *self.0.lock().unwrap(), data) + } + fn flush(&mut self) -> io::Result<()> { Ok(()) } +} + +fn main() { + let data = Arc::new(Mutex::new(Vec::new())); + let sink = Sink(data.clone()); + let res = thread::Builder::new().spawn(move|| -> () { + io::set_panic(Some(Box::new(sink))); + panic!("Hello, world!") + }).unwrap().join(); + assert!(res.is_err()); + + let output = data.lock().unwrap(); + let output = str::from_utf8(&output).unwrap(); + assert!(output.contains("Hello, world!")); +} diff --git a/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs b/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs new file mode 100644 index 00000000000..01c0235c55d --- /dev/null +++ b/src/test/run-pass/threads-sendsync/thread-local-extern-static.rs @@ -0,0 +1,37 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-windows +// aux-build:thread-local-extern-static.rs + +#![feature(cfg_target_thread_local, thread_local)] + +#[cfg(target_thread_local)] +extern crate thread_local_extern_static; + +#[cfg(target_thread_local)] +use std::cell::Cell; + +#[cfg(target_thread_local)] +extern { + #[thread_local] + static FOO: Cell; +} + +#[cfg(target_thread_local)] +fn main() { + unsafe { + assert_eq!(FOO.get(), 3); + } +} + +#[cfg(not(target_thread_local))] +fn main() {} diff --git a/src/test/run-pass/threads-sendsync/thread-local-syntax.rs b/src/test/run-pass/threads-sendsync/thread-local-syntax.rs new file mode 100644 index 00000000000..522a736ce5a --- /dev/null +++ b/src/test/run-pass/threads-sendsync/thread-local-syntax.rs @@ -0,0 +1,32 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![deny(missing_docs)] +//! this tests the syntax of `thread_local!` + +mod foo { + mod bar { + thread_local! { + // no docs + #[allow(unused)] + static FOO: i32 = 42; + /// docs + pub static BAR: String = String::from("bar"); + + // look at these restrictions!! + pub(crate) static BAZ: usize = 0; + pub(in foo) static QUUX: usize = 0; + } + thread_local!(static SPLOK: u32 = 0); + } +} + +fn main() {} diff --git a/src/test/run-pass/threads-sendsync/threads.rs b/src/test/run-pass/threads-sendsync/threads.rs new file mode 100644 index 00000000000..7be239e29fb --- /dev/null +++ b/src/test/run-pass/threads-sendsync/threads.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +use std::thread; + +pub fn main() { + let mut i = 10; + while i > 0 { + thread::spawn({let i = i; move|| child(i)}).join(); + i = i - 1; + } + println!("main thread exiting"); +} + +fn child(x: isize) { println!("{}", x); } diff --git a/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs b/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs new file mode 100644 index 00000000000..e60a2c8a011 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// no-prefer-dynamic +// ignore-emscripten no threads support + +static mut HIT: bool = false; + +struct Foo; + +impl Drop for Foo { + fn drop(&mut self) { + unsafe { HIT = true; } + } +} + +thread_local!(static FOO: Foo = Foo); + +fn main() { + std::thread::spawn(|| { + FOO.with(|_| {}); + }).join().unwrap(); + assert!(unsafe { HIT }); +} diff --git a/src/test/run-pass/threads-sendsync/tls-init-on-init.rs b/src/test/run-pass/threads-sendsync/tls-init-on-init.rs new file mode 100644 index 00000000000..5b6afe78482 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/tls-init-on-init.rs @@ -0,0 +1,54 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// ignore-emscripten no threads support + +#![feature(thread_local_try_with)] + +use std::thread; +use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; + +struct Foo { cnt: usize } + +thread_local!(static FOO: Foo = Foo::init()); + +static CNT: AtomicUsize = ATOMIC_USIZE_INIT; + +impl Foo { + fn init() -> Foo { + let cnt = CNT.fetch_add(1, Ordering::SeqCst); + if cnt == 0 { + FOO.with(|_| {}); + } + Foo { cnt: cnt } + } +} + +impl Drop for Foo { + fn drop(&mut self) { + if self.cnt == 1 { + FOO.with(|foo| assert_eq!(foo.cnt, 0)); + } else { + assert_eq!(self.cnt, 0); + if FOO.try_with(|_| ()).is_ok() { + panic!("should not be in valid state"); + } + } + } +} + +fn main() { + thread::spawn(|| { + FOO.with(|_| {}); + }).join().unwrap(); +} diff --git a/src/test/run-pass/threads-sendsync/tls-try-with.rs b/src/test/run-pass/threads-sendsync/tls-try-with.rs new file mode 100644 index 00000000000..f1fcef8e4b9 --- /dev/null +++ b/src/test/run-pass/threads-sendsync/tls-try-with.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(stable_features)] + +// ignore-emscripten no threads support + +#![feature(thread_local_try_with)] + +use std::thread; + +static mut DROP_RUN: bool = false; + +struct Foo; + +thread_local!(static FOO: Foo = Foo {}); + +impl Drop for Foo { + fn drop(&mut self) { + assert!(FOO.try_with(|_| panic!("`try_with` closure run")).is_err()); + unsafe { DROP_RUN = true; } + } +} + +fn main() { + thread::spawn(|| { + assert_eq!(FOO.try_with(|_| { + 132 + }).expect("`try_with` failed"), 132); + }).join().unwrap(); + assert!(unsafe { DROP_RUN }); +} diff --git a/src/test/run-pass/traits/anon-trait-static-method.rs b/src/test/run-pass/traits/anon-trait-static-method.rs new file mode 100644 index 00000000000..94779e7c5da --- /dev/null +++ b/src/test/run-pass/traits/anon-trait-static-method.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +struct Foo { + x: isize +} + +impl Foo { + pub fn new() -> Foo { + Foo { x: 3 } + } +} + +pub fn main() { + let x = Foo::new(); + println!("{}", x.x); +} diff --git a/src/test/run-pass/traits/anon_trait_static_method_exe.rs b/src/test/run-pass/traits/anon_trait_static_method_exe.rs new file mode 100644 index 00000000000..958c1094e4f --- /dev/null +++ b/src/test/run-pass/traits/anon_trait_static_method_exe.rs @@ -0,0 +1,22 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// aux-build:anon_trait_static_method_lib.rs + +extern crate anon_trait_static_method_lib; +use anon_trait_static_method_lib::Foo; + +pub fn main() { + let x = Foo::new(); + println!("{}", x.x); +} diff --git a/src/test/run-pass/traits/assignability-trait.rs b/src/test/run-pass/traits/assignability-trait.rs new file mode 100644 index 00000000000..f90c7b95dcf --- /dev/null +++ b/src/test/run-pass/traits/assignability-trait.rs @@ -0,0 +1,57 @@ +// Copyright 2012-4 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Tests that type assignability is used to search for instances when +// making method calls, but only if there aren't any matches without +// it. + +trait iterable { + fn iterate(&self, blk: F) -> bool where F: FnMut(&A) -> bool; +} + +impl<'a,A> iterable for &'a [A] { + fn iterate(&self, f: F) -> bool where F: FnMut(&A) -> bool { + self.iter().all(f) + } +} + +impl iterable for Vec { + fn iterate(&self, f: F) -> bool where F: FnMut(&A) -> bool { + self.iter().all(f) + } +} + +fn length>(x: T) -> usize { + let mut len = 0; + x.iterate(|_y| { + len += 1; + true + }); + return len; +} + +pub fn main() { + let x: Vec = vec![0,1,2,3]; + // Call a method + x.iterate(|y| { assert_eq!(x[*y as usize], *y); true }); + // Call a parameterized function + assert_eq!(length(x.clone()), x.len()); + // Call a parameterized function, with type arguments that require + // a borrow + assert_eq!(length::(&*x), x.len()); + + // Now try it with a type that *needs* to be borrowed + let z = [0,1,2,3]; + // Call a parameterized function + assert_eq!(length::(&z), z.len()); +} diff --git a/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs b/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs new file mode 100644 index 00000000000..0eabded7627 --- /dev/null +++ b/src/test/run-pass/traits/astconv-cycle-between-trait-and-type.rs @@ -0,0 +1,39 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to successfully compile a setup where a trait +// (`Trait1`) references a struct (`SomeType`) which in turn +// carries a predicate that references the trait (`u32 : Trait1`, +// substituted). + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Trait1 : Trait2> { + fn dumb(&self) { } +} + +trait Trait2 { + fn dumber(&self, _: A) { } +} + +struct SomeType + where A : Trait1 +{ + a: A +} + +impl Trait1 for u32 { } + +impl Trait2> for u32 { } + +fn main() { } diff --git a/src/test/run-pass/traits/augmented-assignments-trait.rs b/src/test/run-pass/traits/augmented-assignments-trait.rs new file mode 100644 index 00000000000..af308a6efed --- /dev/null +++ b/src/test/run-pass/traits/augmented-assignments-trait.rs @@ -0,0 +1,22 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::AddAssign; + +struct Int(i32); + +impl AddAssign for Int { + fn add_assign(&mut self, _: Int) { + unimplemented!() + } +} + +fn main() {} diff --git a/src/test/run-pass/traits/auto-traits.rs b/src/test/run-pass/traits/auto-traits.rs new file mode 100644 index 00000000000..79c2108ba83 --- /dev/null +++ b/src/test/run-pass/traits/auto-traits.rs @@ -0,0 +1,40 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(optin_builtin_traits)] + +auto trait Auto {} +unsafe auto trait AutoUnsafe {} + +impl !Auto for bool {} +impl !AutoUnsafe for bool {} + +struct AutoBool(bool); + +impl Auto for AutoBool {} +unsafe impl AutoUnsafe for AutoBool {} + +fn take_auto(_: T) {} +fn take_auto_unsafe(_: T) {} + +fn main() { + // Parse inside functions. + auto trait AutoInner {} + unsafe auto trait AutoUnsafeInner {} + + take_auto(0); + take_auto(AutoBool(true)); + take_auto_unsafe(0); + take_auto_unsafe(AutoBool(true)); + + /// Auto traits are allowed in trait object bounds. + let _: &(Send + Auto) = &0; +} diff --git a/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs b/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs new file mode 100644 index 00000000000..9d93d9689e7 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Foo { + pub x: isize +} + +impl Foo { + pub fn new() -> Foo { + Foo { x: 3 } + } +} diff --git a/src/test/run-pass/traits/auxiliary/go_trait.rs b/src/test/run-pass/traits/auxiliary/go_trait.rs new file mode 100644 index 00000000000..044bb606b40 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/go_trait.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +#![feature(specialization)] + +// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. + +pub trait Go { + fn go(&self, arg: isize); +} + +pub fn go(this: &G, arg: isize) { + this.go(arg) +} + +pub trait GoMut { + fn go_mut(&mut self, arg: isize); +} + +pub fn go_mut(this: &mut G, arg: isize) { + this.go_mut(arg) +} + +pub trait GoOnce { + fn go_once(self, arg: isize); +} + +pub fn go_once(this: G, arg: isize) { + this.go_once(arg) +} + +impl GoMut for G + where G : Go +{ + default fn go_mut(&mut self, arg: isize) { + go(&*self, arg) + } +} + +impl GoOnce for G + where G : GoMut +{ + default fn go_once(mut self, arg: isize) { + go_mut(&mut self, arg) + } +} diff --git a/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs new file mode 100644 index 00000000000..c1168a912dc --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs @@ -0,0 +1,50 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub struct Something { pub x: isize } + +pub trait A { + fn f(&self) -> isize; + fn g(&self) -> isize { 10 } + fn h(&self) -> isize { 11 } + fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() } +} + + +impl A for isize { + fn f(&self) -> isize { 10 } +} + +impl A for Something { + fn f(&self) -> isize { 10 } +} + +pub trait B { + fn thing(&self, x: T, y: U) -> (T, U) { (x, y) } + fn staticthing(_z: &Self, x: T, y: U) -> (T, U) { (x, y) } +} + +impl B for isize { } +impl B for bool { } + + + +pub trait TestEquality { + fn test_eq(&self, rhs: &Self) -> bool; + fn test_neq(&self, rhs: &Self) -> bool { + !self.test_eq(rhs) + } +} + +impl TestEquality for isize { + fn test_eq(&self, rhs: &isize) -> bool { + *self == *rhs + } +} diff --git a/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs new file mode 100644 index 00000000000..7443ef9c0f3 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs @@ -0,0 +1,27 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// aux-build:trait_default_method_xc_aux.rs + +extern crate trait_default_method_xc_aux as aux; +use aux::A; + +pub struct a_struct { pub x: isize } + +impl A for a_struct { + fn f(&self) -> isize { 10 } +} + +// This function will need to get inlined, and badness may result. +pub fn welp(x: A) -> A { + let a = a_struct { x: 0 }; + a.g(); + x +} diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs new file mode 100644 index 00000000000..af0128d9676 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait Foo { fn f(&self) -> isize; } +pub trait Bar { fn g(&self) -> isize; } +pub trait Baz { fn h(&self) -> isize; } + +pub struct A { pub x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } +impl Baz for A { fn h(&self) -> isize { 30 } } diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs new file mode 100644 index 00000000000..6be1f8c45f4 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait Foo { fn f(&self) -> isize; } +pub trait Bar { fn g(&self) -> isize; } +pub trait Baz { fn h(&self) -> isize; } + +pub trait Quux: Foo + Bar + Baz { } + +impl Quux for T { } diff --git a/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs new file mode 100644 index 00000000000..1bfada612eb --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs @@ -0,0 +1,48 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::cmp::PartialEq; +use std::ops::{Add, Sub, Mul}; + +pub trait MyNum : Add + Sub + Mul + PartialEq + Clone { +} + +#[derive(Clone, Debug)] +pub struct MyInt { + pub val: isize +} + +impl Add for MyInt { + type Output = MyInt; + + fn add(self, other: MyInt) -> MyInt { mi(self.val + other.val) } +} + +impl Sub for MyInt { + type Output = MyInt; + + fn sub(self, other: MyInt) -> MyInt { mi(self.val - other.val) } +} + +impl Mul for MyInt { + type Output = MyInt; + + fn mul(self, other: MyInt) -> MyInt { mi(self.val * other.val) } +} + +impl PartialEq for MyInt { + fn eq(&self, other: &MyInt) -> bool { self.val == other.val } + + fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } +} + +impl MyNum for MyInt {} + +fn mi(v: isize) -> MyInt { MyInt { val: v } } diff --git a/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs b/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs new file mode 100644 index 00000000000..585a756fd07 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_safety_lib.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Simple smoke test that unsafe traits can be compiled etc. + +pub unsafe trait Foo { + fn foo(&self) -> isize; +} + +unsafe impl Foo for isize { + fn foo(&self) -> isize { *self } +} diff --git a/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs b/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs new file mode 100644 index 00000000000..9eeb815c5de --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/trait_xc_call_aux.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + + +pub trait Foo { + fn f(&self) -> isize; +} + +pub struct A { + pub x: isize +} + +impl Foo for A { + fn f(&self) -> isize { 10 } +} diff --git a/src/test/run-pass/traits/auxiliary/traitimpl.rs b/src/test/run-pass/traits/auxiliary/traitimpl.rs new file mode 100644 index 00000000000..22e79cc6284 --- /dev/null +++ b/src/test/run-pass/traits/auxiliary/traitimpl.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// Test inherent trait impls work cross-crait. + +pub trait Bar<'a> : 'a {} + +impl<'a> Bar<'a> { + pub fn bar(&self) {} +} diff --git a/src/test/run-pass/traits/conservative_impl_trait.rs b/src/test/run-pass/traits/conservative_impl_trait.rs new file mode 100644 index 00000000000..b6abeb916a9 --- /dev/null +++ b/src/test/run-pass/traits/conservative_impl_trait.rs @@ -0,0 +1,18 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// #39665 + +fn batches(n: &u32) -> impl Iterator { + std::iter::once(n) +} + +fn main() {} diff --git a/src/test/run-pass/traits/cycle-trait-type-trait.rs b/src/test/run-pass/traits/cycle-trait-type-trait.rs new file mode 100644 index 00000000000..c1958398005 --- /dev/null +++ b/src/test/run-pass/traits/cycle-trait-type-trait.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a case where a supertrait references a type that references +// the original trait. This poses no problem at the moment. + +// pretty-expanded FIXME #23616 + +trait Chromosome: Get> { +} + +trait Get { + fn get(&self) -> A; +} + +struct Struct { c: C } + +impl Chromosome for i32 { } + +impl Get> for i32 { + fn get(&self) -> Struct { + Struct { c: *self } + } +} + +fn main() { } diff --git a/src/test/run-pass/traits/default-method-supertrait-vtable.rs b/src/test/run-pass/traits/default-method-supertrait-vtable.rs new file mode 100644 index 00000000000..57eb410c9ad --- /dev/null +++ b/src/test/run-pass/traits/default-method-supertrait-vtable.rs @@ -0,0 +1,38 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +// Tests that we can call a function bounded over a supertrait from +// a default method + +fn require_y(x: T) -> isize { x.y() } + +trait Y { + fn y(self) -> isize; +} + + +trait Z: Y + Sized { + fn x(self) -> isize { + require_y(self) + } +} + +impl Y for isize { + fn y(self) -> isize { self } +} + +impl Z for isize {} + +pub fn main() { + assert_eq!(12.x(), 12); +} diff --git a/src/test/run-pass/traits/dyn-trait.rs b/src/test/run-pass/traits/dyn-trait.rs new file mode 100644 index 00000000000..0ef6b9fd147 --- /dev/null +++ b/src/test/run-pass/traits/dyn-trait.rs @@ -0,0 +1,27 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-pretty `dyn ::foo` parses differently in the current edition + +use std::fmt::Display; + +static BYTE: u8 = 33; + +fn main() { + let x: &(dyn 'static + Display) = &BYTE; + let y: Box = Box::new(BYTE); + let _: &dyn (Display) = &BYTE; + let _: &dyn (::std::fmt::Display) = &BYTE; + let xstr = format!("{}", x); + let ystr = format!("{}", y); + assert_eq!(xstr, "33"); + assert_eq!(ystr, "33"); +} diff --git a/src/test/run-pass/traits/fmt-pointer-trait.rs b/src/test/run-pass/traits/fmt-pointer-trait.rs new file mode 100644 index 00000000000..66ec8fc44a4 --- /dev/null +++ b/src/test/run-pass/traits/fmt-pointer-trait.rs @@ -0,0 +1,34 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ptr; +use std::rc::Rc; +use std::sync::Arc; + +fn main() { + let p: *const u8 = ptr::null(); + let rc = Rc::new(1usize); + let arc = Arc::new(1usize); + let b = Box::new("hi"); + + let _ = format!("{:p}{:p}{:p}", + rc, arc, b); + + if cfg!(target_pointer_width = "32") { + assert_eq!(format!("{:#p}", p), + "0x00000000"); + } else { + assert_eq!(format!("{:#p}", p), + "0x0000000000000000"); + } + assert_eq!(format!("{:p}", p), + "0x0"); +} diff --git a/src/test/run-pass/traits/impl-implicit-trait.rs b/src/test/run-pass/traits/impl-implicit-trait.rs new file mode 100644 index 00000000000..76cfaf2c68e --- /dev/null +++ b/src/test/run-pass/traits/impl-implicit-trait.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +enum option_ { + none_, + some_(T), +} + +impl option_ { + pub fn foo(&self) -> bool { true } +} + +enum option__ { + none__, + some__(isize) +} + +impl option__ { + pub fn foo(&self) -> bool { true } +} + +pub fn main() { +} diff --git a/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs b/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs new file mode 100644 index 00000000000..505209ff3ae --- /dev/null +++ b/src/test/run-pass/traits/impl-inherent-prefer-over-trait.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo; + +trait Trait { + fn bar(&self); +} + +// Inherent impls should be preferred over trait ones. +impl Foo { + fn bar(&self) {} +} + +impl Trait { + fn baz(_: &Foo) {} +} + +impl Trait for Foo { + fn bar(&self) { panic!("wrong method called!") } +} + +fn main() { + Foo.bar(); + Foo::bar(&Foo); + ::bar(&Foo); + + // Should work even if Trait::baz doesn't exist. + // N.B: `::bar` would be ambiguous. + ::baz(&Foo); +} diff --git a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs new file mode 100644 index 00000000000..d53619d0c9d --- /dev/null +++ b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs @@ -0,0 +1,34 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that when we match a trait reference like `Foo: Foo<_#0t>`, +// we unify with `_#0t` with `A`. In this code, if we failed to do +// that, then you get an unconstrained type-variable in `call`. +// +// Also serves as a regression test for issue #26952, though the test +// was derived from another reported regression with the same cause. + +use std::marker::PhantomData; + +trait Trait { fn foo(&self); } + +struct Type { a: PhantomData } + +fn as_trait(t: &Type) -> &Trait { loop { } } + +fn want+?Sized>(t: &T) { } + +fn call(p: Type) { + let q = as_trait(&p); + want(q); // parameter A to `want` *would* be unconstrained +} + +fn main() { } diff --git a/src/test/run-pass/traits/inherent-trait-method-order.rs b/src/test/run-pass/traits/inherent-trait-method-order.rs new file mode 100644 index 00000000000..6b6dd5dcbbd --- /dev/null +++ b/src/test/run-pass/traits/inherent-trait-method-order.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +struct Foo; + +impl Foo { + #[allow(dead_code)] + fn foo(self) { + panic!("wrong method!") + } +} + +trait Trait { + fn foo(self); +} + +impl<'a,'b,'c> Trait for &'a &'b &'c Foo { + fn foo(self) { + // ok + } +} + +fn main() { + let x = &(&(&Foo)); + x.foo(); +} diff --git a/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs b/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs new file mode 100644 index 00000000000..55cdeff8c9b --- /dev/null +++ b/src/test/run-pass/traits/kindck-owned-trait-contains-1.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] +#![allow(non_camel_case_types)] + +#![feature(box_syntax)] + +trait repeat { fn get(&self) -> A; } + +impl repeat for Box { + fn get(&self) -> A { + (**self).clone() + } +} + +fn repeater(v: Box) -> Box+'static> { + box v as Box+'static> // No +} + +pub fn main() { + let x = 3; + let y = repeater(box x); + assert_eq!(x, y.get()); +} diff --git a/src/test/run-pass/traits/multiple-trait-bounds.rs b/src/test/run-pass/traits/multiple-trait-bounds.rs new file mode 100644 index 00000000000..b49d2449167 --- /dev/null +++ b/src/test/run-pass/traits/multiple-trait-bounds.rs @@ -0,0 +1,19 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn f(_: T) { +} + +pub fn main() { + f(3); +} diff --git a/src/test/run-pass/traits/object-one-type-two-traits.rs b/src/test/run-pass/traits/object-one-type-two-traits.rs new file mode 100644 index 00000000000..5a468e0d644 --- /dev/null +++ b/src/test/run-pass/traits/object-one-type-two-traits.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Testing creating two vtables with the same self type, but different +// traits. + +#![feature(box_syntax)] + +use std::any::Any; + +trait Wrap { + fn get(&self) -> isize; + fn wrap(self: Box) -> Box; +} + +impl Wrap for isize { + fn get(&self) -> isize { + *self + } + fn wrap(self: Box) -> Box { + self as Box + } +} + +fn is(x: &Any) -> bool { + x.is::() +} + +fn main() { + let x = box 22isize as Box; + println!("x={}", x.get()); + let y = x.wrap(); +} diff --git a/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs b/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs new file mode 100644 index 00000000000..d9a051ee02e --- /dev/null +++ b/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs @@ -0,0 +1,21 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(overlapping_marker_traits)] +#![feature(optin_builtin_traits)] + +// Overlapping negative impls for `MyStruct` are permitted: +struct MyStruct; +impl !Send for MyStruct {} +impl !Send for MyStruct {} + +fn main() { +} diff --git a/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs b/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs new file mode 100644 index 00000000000..3f165daf65c --- /dev/null +++ b/src/test/run-pass/traits/overlap-permitted-for-marker-traits.rs @@ -0,0 +1,37 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests for RFC 1268: we allow overlapping impls of marker traits, +// that is, traits without items. In this case, a type `T` is +// `MyMarker` if it is either `Debug` or `Display`. + +#![feature(overlapping_marker_traits)] +#![feature(optin_builtin_traits)] + +use std::fmt::{Debug, Display}; + +trait MyMarker {} + +impl MyMarker for T {} +impl MyMarker for T {} + +fn foo(t: T) -> T { + t +} + +fn main() { + // Debug && Display: + assert_eq!(1, foo(1)); + assert_eq!(2.0, foo(2.0)); + + // Debug && !Display: + assert_eq!(vec![1], foo(vec![1])); +} diff --git a/src/test/run-pass/traits/parameterized-trait-with-bounds.rs b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs new file mode 100644 index 00000000000..d98f8006609 --- /dev/null +++ b/src/test/run-pass/traits/parameterized-trait-with-bounds.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + + +trait A { fn get(self) -> T; } +trait B { fn get(self) -> (T,U); } +trait C<'a, U> { fn get(self) -> &'a U; } + +mod foo { + pub trait D<'a, T> { fn get(self) -> &'a T; } +} + +fn foo1(_: &(A + Send)) {} +fn foo2(_: Box + Send + Sync>) {} +fn foo3(_: Box + 'static>) {} +fn foo4<'a, T>(_: Box + 'static + Send>) {} +fn foo5<'a, T>(_: Box + 'static + Send>) {} + +pub fn main() {} diff --git a/src/test/run-pass/traits/supertrait-default-generics.rs b/src/test/run-pass/traits/supertrait-default-generics.rs new file mode 100644 index 00000000000..c3c37d6b9c0 --- /dev/null +++ b/src/test/run-pass/traits/supertrait-default-generics.rs @@ -0,0 +1,48 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// There is some other borrowck bug, so we make the stuff not mut. + + +use std::ops::Add; + +trait Positioned { + fn SetX(&mut self, _: S); + fn X(&self) -> S; +} + +trait Movable>: Positioned { + fn translate(&mut self, dx: S) { + let x = self.X() + dx; + self.SetX(x); + } +} + +struct Point { x: S, y: S } + +impl Positioned for Point { + fn SetX(&mut self, x: S) { + self.x = x; + } + fn X(&self) -> S { + self.x.clone() + } +} + +impl> Movable for Point {} + +pub fn main() { + let mut p = Point{ x: 1, y: 2}; + p.translate(3); + assert_eq!(p.X(), 4); +} diff --git a/src/test/run-pass/traits/syntax-trait-polarity.rs b/src/test/run-pass/traits/syntax-trait-polarity.rs new file mode 100644 index 00000000000..89b49b11f01 --- /dev/null +++ b/src/test/run-pass/traits/syntax-trait-polarity.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(optin_builtin_traits)] + +struct TestType; + +impl TestType {} + +trait TestTrait {} + +impl !Send for TestType {} + +struct TestType2(T); + +impl TestType2 {} + +impl !Send for TestType2 {} + +fn main() {} diff --git a/src/test/run-pass/traits/trait-bounds-basic.rs b/src/test/run-pass/traits/trait-bounds-basic.rs new file mode 100644 index 00000000000..1a2621f7679 --- /dev/null +++ b/src/test/run-pass/traits/trait-bounds-basic.rs @@ -0,0 +1,34 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unconditional_recursion)] + +// pretty-expanded FIXME #23616 + +trait Foo { +} + +fn b(_x: Box) { +} + +fn c(x: Box) { + e(x); +} + +fn d(x: Box) { + e(x); +} + +fn e(x: Box) { + e(x); +} + +pub fn main() { } diff --git a/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs b/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs new file mode 100644 index 00000000000..4ccb48915fc --- /dev/null +++ b/src/test/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that type parameter bounds on an implementation need not match the +// trait exactly, as long as the implementation doesn't demand *more* bounds +// than the trait. + +// pretty-expanded FIXME #23616 + +trait A { + fn foo(&self); +} + +impl A for isize { + fn foo(&self) {} // Ord implies Eq, so this is ok. +} + +fn main() {} diff --git a/src/test/run-pass/traits/trait-bounds-in-arc.rs b/src/test/run-pass/traits/trait-bounds-in-arc.rs new file mode 100644 index 00000000000..35210be3478 --- /dev/null +++ b/src/test/run-pass/traits/trait-bounds-in-arc.rs @@ -0,0 +1,118 @@ +// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that a heterogeneous list of existential types can be put inside an Arc +// and shared between threads as long as all types fulfill Send. + +// ignore-emscripten no threads support + +#![feature(box_syntax)] + +use std::sync::Arc; +use std::sync::mpsc::channel; +use std::thread; + +trait Pet { + fn name(&self, blk: Box); + fn num_legs(&self) -> usize; + fn of_good_pedigree(&self) -> bool; +} + +struct Catte { + num_whiskers: usize, + name: String, +} + +struct Dogge { + bark_decibels: usize, + tricks_known: usize, + name: String, +} + +struct Goldfyshe { + swim_speed: usize, + name: String, +} + +impl Pet for Catte { + fn name(&self, mut blk: Box) { blk(&self.name) } + fn num_legs(&self) -> usize { 4 } + fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } +} +impl Pet for Dogge { + fn name(&self, mut blk: Box) { blk(&self.name) } + fn num_legs(&self) -> usize { 4 } + fn of_good_pedigree(&self) -> bool { + self.bark_decibels < 70 || self.tricks_known > 20 + } +} +impl Pet for Goldfyshe { + fn name(&self, mut blk: Box) { blk(&self.name) } + fn num_legs(&self) -> usize { 0 } + fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } +} + +pub fn main() { + let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_string() }; + let dogge1 = Dogge { + bark_decibels: 100, + tricks_known: 42, + name: "alan_turing".to_string(), + }; + let dogge2 = Dogge { + bark_decibels: 55, + tricks_known: 11, + name: "albert_einstein".to_string(), + }; + let fishe = Goldfyshe { + swim_speed: 998, + name: "alec_guinness".to_string(), + }; + let arc = Arc::new(vec![box catte as Box, + box dogge1 as Box, + box fishe as Box, + box dogge2 as Box]); + let (tx1, rx1) = channel(); + let arc1 = arc.clone(); + let t1 = thread::spawn(move|| { check_legs(arc1); tx1.send(()); }); + let (tx2, rx2) = channel(); + let arc2 = arc.clone(); + let t2 = thread::spawn(move|| { check_names(arc2); tx2.send(()); }); + let (tx3, rx3) = channel(); + let arc3 = arc.clone(); + let t3 = thread::spawn(move|| { check_pedigree(arc3); tx3.send(()); }); + rx1.recv(); + rx2.recv(); + rx3.recv(); + t1.join(); + t2.join(); + t3.join(); +} + +fn check_legs(arc: Arc>>) { + let mut legs = 0; + for pet in arc.iter() { + legs += pet.num_legs(); + } + assert!(legs == 12); +} +fn check_names(arc: Arc>>) { + for pet in arc.iter() { + pet.name(Box::new(|name| { + assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); + })) + } +} +fn check_pedigree(arc: Arc>>) { + for pet in arc.iter() { + assert!(pet.of_good_pedigree()); + } +} diff --git a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs new file mode 100644 index 00000000000..1b32c51aa85 --- /dev/null +++ b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait U {} +trait T { fn get(self) -> X; } + +trait S2 { + fn m(x: Box+'static>) {} +} + +struct St { + f: Box+'static>, +} + +impl St { + fn blah() {} +} + +fn main() {} diff --git a/src/test/run-pass/traits/trait-bounds-recursion.rs b/src/test/run-pass/traits/trait-bounds-recursion.rs new file mode 100644 index 00000000000..3cdd7311332 --- /dev/null +++ b/src/test/run-pass/traits/trait-bounds-recursion.rs @@ -0,0 +1,30 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait I { fn i(&self) -> Self; } + +trait A { + fn id(x:T) -> T { x.i() } +} + +trait J { fn j(&self) -> T; } + +trait B> { + fn id(x:T) -> T { x.j() } +} + +trait C { + fn id>(x:T) -> T { x.j() } +} + +pub fn main() { } diff --git a/src/test/run-pass/traits/trait-bounds.rs b/src/test/run-pass/traits/trait-bounds.rs new file mode 100644 index 00000000000..3c433b58a3a --- /dev/null +++ b/src/test/run-pass/traits/trait-bounds.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_snake_case)] + +trait connection { + fn read(&self) -> isize; +} + +trait connection_factory { + fn create(&self) -> C; +} + +type my_connection = (); +type my_connection_factory = (); + +impl connection for () { + fn read(&self) -> isize { 43 } +} + +impl connection_factory for my_connection_factory { + fn create(&self) -> my_connection { () } +} + +pub fn main() { + let factory = (); + let connection = factory.create(); + let result = connection.read(); + assert_eq!(result, 43); +} diff --git a/src/test/run-pass/traits/trait-cache-issue-18209.rs b/src/test/run-pass/traits/trait-cache-issue-18209.rs new file mode 100644 index 00000000000..14452b009cf --- /dev/null +++ b/src/test/run-pass/traits/trait-cache-issue-18209.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the cache results from the default method do not pollute +// the cache for the later call in `load()`. +// +// See issue #18209. + +// pretty-expanded FIXME #23616 + +pub trait Foo { + fn load_from() -> Box; + fn load() -> Box { + Foo::load_from() + } +} + +pub fn load() -> Box { + Foo::load() +} + +fn main() { } diff --git a/src/test/run-pass/traits/trait-coercion-generic.rs b/src/test/run-pass/traits/trait-coercion-generic.rs new file mode 100644 index 00000000000..2b64bb005e9 --- /dev/null +++ b/src/test/run-pass/traits/trait-coercion-generic.rs @@ -0,0 +1,34 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Trait { + fn f(&self, x: T); +} + +#[derive(Copy, Clone)] +struct Struct { + x: isize, + y: isize, +} + +impl Trait<&'static str> for Struct { + fn f(&self, x: &'static str) { + println!("Hi, {}!", x); + } +} + +pub fn main() { + let a = Struct { x: 1, y: 2 }; + let b: Box> = Box::new(a); + b.f("Mary"); + let c: &Trait<&'static str> = &a; + c.f("Joe"); +} diff --git a/src/test/run-pass/traits/trait-coercion.rs b/src/test/run-pass/traits/trait-coercion.rs new file mode 100644 index 00000000000..18fc122439b --- /dev/null +++ b/src/test/run-pass/traits/trait-coercion.rs @@ -0,0 +1,43 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::io::{self, Write}; + +trait Trait { + fn f(&self); +} + +#[derive(Copy, Clone)] +struct Struct { + x: isize, + y: isize, +} + +impl Trait for Struct { + fn f(&self) { + println!("Hi!"); + } +} + +fn foo(mut a: Box) {} + +pub fn main() { + let a = Struct { x: 1, y: 2 }; + let b: Box = Box::new(a); + b.f(); + let c: &Trait = &a; + c.f(); + + let out = io::stdout(); + foo(Box::new(out)); +} diff --git a/src/test/run-pass/traits/trait-composition-trivial.rs b/src/test/run-pass/traits/trait-composition-trivial.rs new file mode 100644 index 00000000000..c491beda270 --- /dev/null +++ b/src/test/run-pass/traits/trait-composition-trivial.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Foo { + fn foo(&self); +} + +trait Bar : Foo { + fn bar(&self); +} + +pub fn main() {} diff --git a/src/test/run-pass/traits/trait-copy-guessing.rs b/src/test/run-pass/traits/trait-copy-guessing.rs new file mode 100644 index 00000000000..2d2ea50a1fd --- /dev/null +++ b/src/test/run-pass/traits/trait-copy-guessing.rs @@ -0,0 +1,47 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// "guessing" in trait selection can affect `copy_or_move`. Check that this +// is correctly handled. I am not sure what is the "correct" behaviour, +// but we should at least not ICE. + +use std::mem; + +struct U([u8; 1337]); + +struct S<'a,T:'a>(&'a T); +impl<'a, T> Clone for S<'a, T> { fn clone(&self) -> Self { S(self.0) } } +/// This impl triggers inference "guessing" - S<_>: Copy => _ = U +impl<'a> Copy for S<'a, Option> {} + +fn assert_impls_fnR>(_: &T){} + +fn main() { + let n = None; + let e = S(&n); + let f = || { + // S being copy is critical for this to work + drop(e); + mem::size_of_val(e.0) + }; + assert_impls_fn(&f); + assert_eq!(f(), 1337+1); + + assert_eq!((|| { + // S being Copy is not critical here, but + // we check it anyway. + let n = None; + let e = S(&n); + let ret = mem::size_of_val(e.0); + drop(e); + ret + })(), 1337+1); +} diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst.rs b/src/test/run-pass/traits/trait-default-method-bound-subst.rs new file mode 100644 index 00000000000..9a0e53340f6 --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-bound-subst.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait A { + fn g(&self, x: T, y: U) -> (T, U) { (x, y) } +} + +impl A for i32 { } +impl A for u32 { } + +fn f>(i: V, j: T, k: U) -> (T, U) { + i.g(j, k) +} + +pub fn main () { + assert_eq!(f(0, 1, 2), (1, 2)); + assert_eq!(f(0, 1, 2), (1, 2)); +} diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst2.rs b/src/test/run-pass/traits/trait-default-method-bound-subst2.rs new file mode 100644 index 00000000000..9139a26d295 --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-bound-subst2.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait A { + fn g(&self, x: T) -> T { x } +} + +impl A for isize { } + +fn f>(i: V, j: T) -> T { + i.g(j) +} + +pub fn main () { + assert_eq!(f(0, 2), 2); +} diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst3.rs b/src/test/run-pass/traits/trait-default-method-bound-subst3.rs new file mode 100644 index 00000000000..f7445372fbe --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-bound-subst3.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait A { + fn g(&self, x: T, y: T) -> (T, T) { (x, y) } +} + +impl A for isize { } + +fn f(i: V, j: T, k: T) -> (T, T) { + i.g(j, k) +} + +pub fn main () { + assert_eq!(f(0, 1, 2), (1, 2)); + assert_eq!(f(0, 1u8, 2u8), (1u8, 2u8)); +} diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst4.rs b/src/test/run-pass/traits/trait-default-method-bound-subst4.rs new file mode 100644 index 00000000000..70c440c7665 --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-bound-subst4.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait A { + fn g(&self, x: usize) -> usize { x } + fn h(&self, x: T) { } +} + +impl A for isize { } + +fn f>(i: V, j: usize) -> usize { + i.g(j) +} + +pub fn main () { + assert_eq!(f::(0, 2), 2); + assert_eq!(f::(0, 2), 2); +} diff --git a/src/test/run-pass/traits/trait-default-method-bound.rs b/src/test/run-pass/traits/trait-default-method-bound.rs new file mode 100644 index 00000000000..6291be02110 --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-bound.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait A { + fn g(&self) -> isize { 10 } +} + +impl A for isize { } + +fn f(i: T) { + assert_eq!(i.g(), 10); +} + +pub fn main () { + f(0); +} diff --git a/src/test/run-pass/traits/trait-default-method-xc-2.rs b/src/test/run-pass/traits/trait-default-method-xc-2.rs new file mode 100644 index 00000000000..c0e27fa8757 --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-xc-2.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:trait_default_method_xc_aux.rs +// aux-build:trait_default_method_xc_aux_2.rs + + + +extern crate trait_default_method_xc_aux as aux; +extern crate trait_default_method_xc_aux_2 as aux2; +use aux::A; +use aux2::{a_struct, welp}; + + +pub fn main () { + + let a = a_struct { x: 0 }; + let b = a_struct { x: 1 }; + + assert_eq!(0.g(), 10); + assert_eq!(a.g(), 10); + assert_eq!(a.h(), 11); + assert_eq!(b.g(), 10); + assert_eq!(b.h(), 11); + assert_eq!(A::lurr(&a, &b), 21); + + welp(&0); +} diff --git a/src/test/run-pass/traits/trait-default-method-xc.rs b/src/test/run-pass/traits/trait-default-method-xc.rs new file mode 100644 index 00000000000..426b3e2ad79 --- /dev/null +++ b/src/test/run-pass/traits/trait-default-method-xc.rs @@ -0,0 +1,90 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// aux-build:trait_default_method_xc_aux.rs + + +extern crate trait_default_method_xc_aux as aux; +use aux::{A, TestEquality, Something}; +use aux::B; + +fn f(i: T) { + assert_eq!(i.g(), 10); +} + +fn welp(i: isize, _x: &T) -> isize { + i.g() +} + +mod stuff { + pub struct thing { pub x: isize } +} + +impl A for stuff::thing { + fn f(&self) -> isize { 10 } +} + +fn g>(i: V, j: T, k: U) -> (T, U) { + i.thing(j, k) +} + +fn eq(lhs: &T, rhs: &T) -> bool { + lhs.test_eq(rhs) +} +fn neq(lhs: &T, rhs: &T) -> bool { + lhs.test_neq(rhs) +} + + +impl TestEquality for stuff::thing { + fn test_eq(&self, rhs: &stuff::thing) -> bool { + //self.x.test_eq(&rhs.x) + eq(&self.x, &rhs.x) + } +} + + +pub fn main() { + // Some tests of random things + f(0); + + assert_eq!(A::lurr(&0, &1), 21); + + let a = stuff::thing { x: 0 }; + let b = stuff::thing { x: 1 }; + let c = Something { x: 1 }; + + assert_eq!(0.g(), 10); + assert_eq!(a.g(), 10); + assert_eq!(a.h(), 11); + assert_eq!(c.h(), 11); + + assert_eq!(0.thing(3.14f64, 1), (3.14f64, 1)); + assert_eq!(B::staticthing(&0, 3.14f64, 1), (3.14f64, 1)); + assert_eq!(B::::staticthing::(&0, 3.14, 1), (3.14, 1)); + + assert_eq!(g(0, 3.14f64, 1), (3.14f64, 1)); + assert_eq!(g(false, 3.14f64, 1), (3.14, 1)); + + + // Trying out a real one + assert!(12.test_neq(&10)); + assert!(!10.test_neq(&10)); + assert!(a.test_neq(&b)); + assert!(!a.test_neq(&a)); + + assert!(neq(&12, &10)); + assert!(!neq(&10, &10)); + assert!(neq(&a, &b)); + assert!(!neq(&a, &a)); +} diff --git a/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs b/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs new file mode 100644 index 00000000000..753141bcf21 --- /dev/null +++ b/src/test/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we do not error out because of a (False) ambiguity +// between the builtin rules for Sized and the where clause. Issue +// #20959. + +// pretty-expanded FIXME #23616 + +fn foo(x: Option) + where Option : Sized +{ + let _y = x; +} + +fn main() { + foo(Some(22)); +} diff --git a/src/test/run-pass/traits/trait-generic.rs b/src/test/run-pass/traits/trait-generic.rs new file mode 100644 index 00000000000..a230ad03de8 --- /dev/null +++ b/src/test/run-pass/traits/trait-generic.rs @@ -0,0 +1,55 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + + +trait to_str { + fn to_string_(&self) -> String; +} +impl to_str for isize { + fn to_string_(&self) -> String { self.to_string() } +} +impl to_str for String { + fn to_string_(&self) -> String { self.clone() } +} +impl to_str for () { + fn to_string_(&self) -> String { "()".to_string() } +} + +trait map { + fn map(&self, f: F) -> Vec where F: FnMut(&T) -> U; +} +impl map for Vec { + fn map(&self, mut f: F) -> Vec where F: FnMut(&T) -> U { + let mut r = Vec::new(); + for i in self { + r.push(f(i)); + } + r + } +} + +fn foo>(x: T) -> Vec { + x.map(|_e| "hi".to_string() ) +} +fn bar>(x: T) -> Vec { + x.map(|_e| _e.to_string_() ) +} + +pub fn main() { + assert_eq!(foo(vec![1]), ["hi".to_string()]); + assert_eq!(bar:: >(vec![4, 5]), ["4".to_string(), "5".to_string()]); + assert_eq!(bar:: >(vec!["x".to_string(), "y".to_string()]), + ["x".to_string(), "y".to_string()]); + assert_eq!(bar::<(), Vec<()>>(vec![()]), ["()".to_string()]); +} diff --git a/src/test/run-pass/traits/trait-impl-2.rs b/src/test/run-pass/traits/trait-impl-2.rs new file mode 100644 index 00000000000..8fadb09377f --- /dev/null +++ b/src/test/run-pass/traits/trait-impl-2.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// pretty-expanded FIXME #23616 + +pub mod Foo { + pub trait Trait { + fn foo(&self); + } +} + +mod Bar { + impl<'a> ::Foo::Trait+'a { + fn bar(&self) { self.foo() } + } +} + +fn main() {} diff --git a/src/test/run-pass/traits/trait-impl.rs b/src/test/run-pass/traits/trait-impl.rs new file mode 100644 index 00000000000..1ba76676092 --- /dev/null +++ b/src/test/run-pass/traits/trait-impl.rs @@ -0,0 +1,51 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test calling methods on an impl for a bare trait. + +// aux-build:traitimpl.rs + +extern crate traitimpl; +use traitimpl::Bar; + +static mut COUNT: usize = 1; + +trait T { + fn t(&self) {} +} + +impl<'a> T+'a { + fn foo(&self) { + unsafe { COUNT *= 2; } + } + fn bar() { + unsafe { COUNT *= 3; } + } +} + +impl T for isize {} + +struct Foo; +impl<'a> Bar<'a> for Foo {} + +fn main() { + let x: &T = &42; + + x.foo(); + T::foo(x); + T::bar(); + + unsafe { assert_eq!(COUNT, 12); } + + // Cross-crait case + let x: &Bar = &Foo; + x.bar(); +} diff --git a/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs b/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs new file mode 100644 index 00000000000..273a3f48332 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-auto-xc-2.rs @@ -0,0 +1,33 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:trait_inheritance_auto_xc_2_aux.rs + + +extern crate trait_inheritance_auto_xc_2_aux as aux; + +// aux defines impls of Foo, Bar and Baz for A +use aux::{Foo, Bar, Baz, A}; + +// We want to extend all Foo, Bar, Bazes to Quuxes +pub trait Quux: Foo + Bar + Baz { } +impl Quux for T { } + +fn f(a: &T) { + assert_eq!(a.f(), 10); + assert_eq!(a.g(), 20); + assert_eq!(a.h(), 30); +} + +pub fn main() { + let a = &A { x: 3 }; + f(a); +} diff --git a/src/test/run-pass/traits/trait-inheritance-auto-xc.rs b/src/test/run-pass/traits/trait-inheritance-auto-xc.rs new file mode 100644 index 00000000000..d6b3d900a09 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-auto-xc.rs @@ -0,0 +1,34 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:trait_inheritance_auto_xc_aux.rs + + +extern crate trait_inheritance_auto_xc_aux as aux; + +use aux::{Foo, Bar, Baz, Quux}; + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } +impl Baz for A { fn h(&self) -> isize { 30 } } + +fn f(a: &T) { + assert_eq!(a.f(), 10); + assert_eq!(a.g(), 20); + assert_eq!(a.h(), 30); +} + +pub fn main() { + let a = &A { x: 3 }; + f(a); +} diff --git a/src/test/run-pass/traits/trait-inheritance-auto.rs b/src/test/run-pass/traits/trait-inheritance-auto.rs new file mode 100644 index 00000000000..698f8ac23dd --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-auto.rs @@ -0,0 +1,38 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Testing that this impl turns A into a Quux, because +// A is already a Foo Bar Baz + +impl Quux for T { } + +trait Foo { fn f(&self) -> isize; } +trait Bar { fn g(&self) -> isize; } +trait Baz { fn h(&self) -> isize; } + +trait Quux: Foo + Bar + Baz { } + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } +impl Baz for A { fn h(&self) -> isize { 30 } } + +fn f(a: &T) { + assert_eq!(a.f(), 10); + assert_eq!(a.g(), 20); + assert_eq!(a.h(), 30); +} + +pub fn main() { + let a = &A { x: 3 }; + f(a); +} diff --git a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs new file mode 100644 index 00000000000..566d59f460e --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { fn f(&self) -> isize; } +trait Bar : Foo { fn g(&self) -> isize; } + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } + +// Call a function on Foo, given a T: Bar +fn gg(a: &T) -> isize { + a.f() +} + +pub fn main() { + let a = &A { x: 3 }; + assert_eq!(gg(a), 10); +} diff --git a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs new file mode 100644 index 00000000000..a769da5e2cb --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { fn f(&self) -> isize; } +trait Bar : Foo { fn g(&self) -> isize; } +trait Baz : Bar { fn h(&self) -> isize; } + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } +impl Baz for A { fn h(&self) -> isize { 30 } } + +// Call a function on Foo, given a T: Baz, +// which is inherited via Bar +fn gg(a: &T) -> isize { + a.f() +} + +pub fn main() { + let a = &A { x: 3 }; + assert_eq!(gg(a), 10); +} diff --git a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs new file mode 100644 index 00000000000..00d74ca0781 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs @@ -0,0 +1,42 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Testing that we can cast to a subtrait and call subtrait +// methods. Not testing supertrait methods + + +trait Foo { + fn f(&self) -> isize; +} + +trait Bar : Foo { + fn g(&self) -> isize; +} + +struct A { + x: isize +} + +impl Foo for A { + fn f(&self) -> isize { 10 } +} + +impl Bar for A { + fn g(&self) -> isize { 20 } +} + +pub fn main() { + let a = &A { x: 3 }; + let afoo = a as &Foo; + let abar = a as &Bar; + assert_eq!(afoo.f(), 10); + assert_eq!(abar.g(), 20); +} diff --git a/src/test/run-pass/traits/trait-inheritance-cast.rs b/src/test/run-pass/traits/trait-inheritance-cast.rs new file mode 100644 index 00000000000..f2d1cb0cb3d --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-cast.rs @@ -0,0 +1,42 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Testing that supertrait methods can be called on subtrait object types + + +trait Foo { + fn f(&self) -> isize; +} + +trait Bar : Foo { + fn g(&self) -> isize; +} + +struct A { + x: isize +} + +impl Foo for A { + fn f(&self) -> isize { 10 } +} + +impl Bar for A { + fn g(&self) -> isize { 20 } +} + +pub fn main() { + let a = &A { x: 3 }; + let afoo = a as &Foo; + let abar = a as &Bar; + assert_eq!(afoo.f(), 10); + assert_eq!(abar.g(), 20); + assert_eq!(abar.f(), 10); +} diff --git a/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs b/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs new file mode 100644 index 00000000000..2d4756cf925 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:trait_xc_call_aux.rs + + +extern crate trait_xc_call_aux as aux; + +use aux::Foo; + +trait Bar : Foo { + fn g(&self) -> isize; +} + +impl Bar for aux::A { + fn g(&self) -> isize { self.f() } +} + +pub fn main() { + let a = &aux::A { x: 3 }; + assert_eq!(a.g(), 10); +} diff --git a/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs b/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs new file mode 100644 index 00000000000..3a57fc525b2 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { fn f(&self) -> isize; } +trait Bar : Foo { fn g(&self) -> isize; } + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } + +impl Bar for A { + // Testing that this impl can call the impl of Foo + fn g(&self) -> isize { self.f() } +} + +pub fn main() { + let a = &A { x: 3 }; + assert_eq!(a.g(), 10); +} diff --git a/src/test/run-pass/traits/trait-inheritance-diamond.rs b/src/test/run-pass/traits/trait-inheritance-diamond.rs new file mode 100644 index 00000000000..bf66d50d159 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-diamond.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// B and C both require A, so D does as well, twice, but that's just fine + + +trait A { fn a(&self) -> isize; } +trait B: A { fn b(&self) -> isize; } +trait C: A { fn c(&self) -> isize; } +trait D: B + C { fn d(&self) -> isize; } + +struct S { bogus: () } + +impl A for S { fn a(&self) -> isize { 10 } } +impl B for S { fn b(&self) -> isize { 20 } } +impl C for S { fn c(&self) -> isize { 30 } } +impl D for S { fn d(&self) -> isize { 40 } } + +fn f(x: &T) { + assert_eq!(x.a(), 10); + assert_eq!(x.b(), 20); + assert_eq!(x.c(), 30); + assert_eq!(x.d(), 40); +} + +pub fn main() { + let value = &S { bogus: () }; + f(value); +} diff --git a/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs b/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs new file mode 100644 index 00000000000..b9a9795c6c0 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs @@ -0,0 +1,32 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait A { fn a(&self) -> isize; } +trait B: A { fn b(&self) -> isize; } +trait C: A { fn c(&self) -> isize; } + +struct S { bogus: () } + +impl A for S { fn a(&self) -> isize { 10 } } +impl B for S { fn b(&self) -> isize { 20 } } +impl C for S { fn c(&self) -> isize { 30 } } + +// Both B and C inherit from A +fn f(x: &T) { + assert_eq!(x.a(), 10); + assert_eq!(x.b(), 20); + assert_eq!(x.c(), 30); +} + +pub fn main() { + f(&S { bogus: () }) +} diff --git a/src/test/run-pass/traits/trait-inheritance-multiple-params.rs b/src/test/run-pass/traits/trait-inheritance-multiple-params.rs new file mode 100644 index 00000000000..5e6aa85498c --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-multiple-params.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait A { fn a(&self) -> isize; } +trait B: A { fn b(&self) -> isize; } +trait C: A { fn c(&self) -> isize; } + +struct S { bogus: () } + +impl A for S { fn a(&self) -> isize { 10 } } +impl B for S { fn b(&self) -> isize { 20 } } +impl C for S { fn c(&self) -> isize { 30 } } + +// Multiple type params, multiple levels of inheritance +fn f(x: &X, y: &Y, z: &Z) { + assert_eq!(x.a(), 10); + assert_eq!(y.a(), 10); + assert_eq!(y.b(), 20); + assert_eq!(z.a(), 10); + assert_eq!(z.c(), 30); +} + +pub fn main() { + let s = &S { bogus: () }; + f(s, s, s); +} diff --git a/src/test/run-pass/traits/trait-inheritance-num.rs b/src/test/run-pass/traits/trait-inheritance-num.rs new file mode 100644 index 00000000000..9d4c9f431dd --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-num.rs @@ -0,0 +1,21 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait NumExt: PartialEq + PartialOrd {} + +pub trait FloatExt: NumExt {} + +fn greater_than_one(n: &T) -> bool { loop {} } +fn greater_than_one_float(n: &T) -> bool { loop {} } + +pub fn main() {} diff --git a/src/test/run-pass/traits/trait-inheritance-num0.rs b/src/test/run-pass/traits/trait-inheritance-num0.rs new file mode 100644 index 00000000000..0d57dee49a1 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-num0.rs @@ -0,0 +1,33 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Extending Num and using inherited static methods + +// pretty-expanded FIXME #23616 + +use std::cmp::PartialOrd; + +pub trait NumCast: Sized { + fn from(i: i32) -> Option; +} + +pub trait Num { + fn from_int(i: isize) -> Self; + fn gt(&self, other: &Self) -> bool; +} + +pub trait NumExt: NumCast + PartialOrd { } + +fn greater_than_one(n: &T) -> bool { + n.gt(&NumCast::from(1).unwrap()) +} + +pub fn main() {} diff --git a/src/test/run-pass/traits/trait-inheritance-num1.rs b/src/test/run-pass/traits/trait-inheritance-num1.rs new file mode 100644 index 00000000000..e2a4f4154f9 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-num1.rs @@ -0,0 +1,24 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait NumCast: Sized { + fn from(i: i32) -> Option; +} + +pub trait NumExt: NumCast + PartialOrd { } + +fn greater_than_one(n: &T) -> bool { + *n > NumCast::from(1).unwrap() +} + +pub fn main() {} diff --git a/src/test/run-pass/traits/trait-inheritance-num2.rs b/src/test/run-pass/traits/trait-inheritance-num2.rs new file mode 100644 index 00000000000..0b9e18c1d27 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-num2.rs @@ -0,0 +1,96 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A more complex example of numeric extensions + +pub trait TypeExt {} + +impl TypeExt for u8 {} +impl TypeExt for u16 {} +impl TypeExt for u32 {} +impl TypeExt for u64 {} +impl TypeExt for usize {} + +impl TypeExt for i8 {} +impl TypeExt for i16 {} +impl TypeExt for i32 {} +impl TypeExt for i64 {} +impl TypeExt for isize {} + +impl TypeExt for f32 {} +impl TypeExt for f64 {} + + +pub trait NumExt: TypeExt + PartialEq + PartialOrd {} + +impl NumExt for u8 {} +impl NumExt for u16 {} +impl NumExt for u32 {} +impl NumExt for u64 {} +impl NumExt for usize {} + +impl NumExt for i8 {} +impl NumExt for i16 {} +impl NumExt for i32 {} +impl NumExt for i64 {} +impl NumExt for isize {} + +impl NumExt for f32 {} +impl NumExt for f64 {} + + +pub trait UnSignedExt: NumExt {} + +impl UnSignedExt for u8 {} +impl UnSignedExt for u16 {} +impl UnSignedExt for u32 {} +impl UnSignedExt for u64 {} +impl UnSignedExt for usize {} + + +pub trait SignedExt: NumExt {} + +impl SignedExt for i8 {} +impl SignedExt for i16 {} +impl SignedExt for i32 {} +impl SignedExt for i64 {} +impl SignedExt for isize {} + +impl SignedExt for f32 {} +impl SignedExt for f64 {} + + +pub trait IntegerExt: NumExt {} + +impl IntegerExt for u8 {} +impl IntegerExt for u16 {} +impl IntegerExt for u32 {} +impl IntegerExt for u64 {} +impl IntegerExt for usize {} + +impl IntegerExt for i8 {} +impl IntegerExt for i16 {} +impl IntegerExt for i32 {} +impl IntegerExt for i64 {} +impl IntegerExt for isize {} + + +pub trait FloatExt: NumExt {} + +impl FloatExt for f32 {} +impl FloatExt for f64 {} + + +fn test_float_ext(n: T) { println!("{}", n < n) } + +pub fn main() { + test_float_ext(1f32); +} diff --git a/src/test/run-pass/traits/trait-inheritance-num3.rs b/src/test/run-pass/traits/trait-inheritance-num3.rs new file mode 100644 index 00000000000..c86b2127a6d --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-num3.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait NumCast: Sized { + fn from(i: i32) -> Option; +} + +pub trait NumExt: PartialEq + PartialOrd + NumCast {} + +impl NumExt for f32 {} +impl NumCast for f32 { + fn from(i: i32) -> Option { Some(i as f32) } +} + +fn num_eq_one(n: T) { + println!("{}", n == NumCast::from(1).unwrap()) +} + +pub fn main() { + num_eq_one(1f32); // you need to actually use the function to trigger the ICE +} diff --git a/src/test/run-pass/traits/trait-inheritance-num5.rs b/src/test/run-pass/traits/trait-inheritance-num5.rs new file mode 100644 index 00000000000..ff64f393341 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-num5.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +pub trait NumCast: Sized { + fn from(i: i32) -> Option; +} + +pub trait NumExt: PartialEq + NumCast {} + +impl NumExt for f32 {} +impl NumExt for isize {} + +impl NumCast for f32 { + fn from(i: i32) -> Option { Some(i as f32) } +} +impl NumCast for isize { + fn from(i: i32) -> Option { Some(i as isize) } +} + +fn num_eq_one() -> T { + NumCast::from(1).unwrap() +} + +pub fn main() { + num_eq_one::(); // you need to actually use the function to trigger the ICE +} diff --git a/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs b/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs new file mode 100644 index 00000000000..ff2f6b2d825 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cmp::PartialEq; + +trait MyNum : PartialEq { } + +#[derive(Debug)] +struct MyInt { val: isize } + +impl PartialEq for MyInt { + fn eq(&self, other: &MyInt) -> bool { self.val == other.val } + fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } +} + +impl MyNum for MyInt {} + +fn f(x: T, y: T) -> bool { + return x == y; +} + +fn mi(v: isize) -> MyInt { MyInt { val: v } } + +pub fn main() { + let (x, y, z) = (mi(3), mi(5), mi(3)); + assert!(x != y); + assert_eq!(x, z); +} diff --git a/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs b/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs new file mode 100644 index 00000000000..ff8009b1c78 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-overloading-xc-exe.rs @@ -0,0 +1,30 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:trait_inheritance_overloading_xc.rs + + +extern crate trait_inheritance_overloading_xc; +use trait_inheritance_overloading_xc::{MyNum, MyInt}; + +fn f(x: T, y: T) -> (T, T, T) { + return (x.clone() + y.clone(), x.clone() - y.clone(), x * y); +} + +fn mi(v: isize) -> MyInt { MyInt { val: v } } + +pub fn main() { + let (x, y) = (mi(3), mi(5)); + let (a, b, c) = f(x, y); + assert_eq!(a, mi(8)); + assert_eq!(b, mi(-2)); + assert_eq!(c, mi(15)); +} diff --git a/src/test/run-pass/traits/trait-inheritance-overloading.rs b/src/test/run-pass/traits/trait-inheritance-overloading.rs new file mode 100644 index 00000000000..5c15ff579e3 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-overloading.rs @@ -0,0 +1,57 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cmp::PartialEq; +use std::ops::{Add, Sub, Mul}; + +trait MyNum : Add + Sub + Mul + PartialEq + Clone { } + +#[derive(Clone, Debug)] +struct MyInt { val: isize } + +impl Add for MyInt { + type Output = MyInt; + + fn add(self, other: MyInt) -> MyInt { mi(self.val + other.val) } +} + +impl Sub for MyInt { + type Output = MyInt; + + fn sub(self, other: MyInt) -> MyInt { mi(self.val - other.val) } +} + +impl Mul for MyInt { + type Output = MyInt; + + fn mul(self, other: MyInt) -> MyInt { mi(self.val * other.val) } +} + +impl PartialEq for MyInt { + fn eq(&self, other: &MyInt) -> bool { self.val == other.val } + fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } +} + +impl MyNum for MyInt {} + +fn f(x: T, y: T) -> (T, T, T) { + return (x.clone() + y.clone(), x.clone() - y.clone(), x * y); +} + +fn mi(v: isize) -> MyInt { MyInt { val: v } } + +pub fn main() { + let (x, y) = (mi(3), mi(5)); + let (a, b, c) = f(x, y); + assert_eq!(a, mi(8)); + assert_eq!(b, mi(-2)); + assert_eq!(c, mi(15)); +} diff --git a/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs b/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs new file mode 100644 index 00000000000..4274b548429 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-self-in-supertype.rs @@ -0,0 +1,72 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test for issue #4183: use of Self in supertraits. + +pub static FUZZY_EPSILON: f64 = 0.1; + +pub trait FuzzyEq { + fn fuzzy_eq(&self, other: &Self) -> bool; + fn fuzzy_eq_eps(&self, other: &Self, epsilon: &Eps) -> bool; +} + +trait Float: Sized+FuzzyEq { + fn two_pi() -> Self; +} + +impl FuzzyEq for f32 { + fn fuzzy_eq(&self, other: &f32) -> bool { + self.fuzzy_eq_eps(other, &(FUZZY_EPSILON as f32)) + } + + fn fuzzy_eq_eps(&self, other: &f32, epsilon: &f32) -> bool { + (*self - *other).abs() < *epsilon + } +} + +impl Float for f32 { + fn two_pi() -> f32 { 6.28318530717958647692528676655900576_f32 } +} + +impl FuzzyEq for f64 { + fn fuzzy_eq(&self, other: &f64) -> bool { + self.fuzzy_eq_eps(other, &(FUZZY_EPSILON as f64)) + } + + fn fuzzy_eq_eps(&self, other: &f64, epsilon: &f64) -> bool { + (*self - *other).abs() < *epsilon + } +} + +impl Float for f64 { + fn two_pi() -> f64 { 6.28318530717958647692528676655900576_f64 } +} + +fn compare(f1: F) -> bool { + let f2 = Float::two_pi(); + f1.fuzzy_eq(&f2) +} + +pub fn main() { + assert!(compare::(6.28318530717958647692528676655900576)); + assert!(compare::(6.29)); + assert!(compare::(6.3)); + assert!(compare::(6.19)); + assert!(!compare::(7.28318530717958647692528676655900576)); + assert!(!compare::(6.18)); + + assert!(compare::(6.28318530717958647692528676655900576)); + assert!(compare::(6.29)); + assert!(compare::(6.3)); + assert!(compare::(6.19)); + assert!(!compare::(7.28318530717958647692528676655900576)); + assert!(!compare::(6.18)); +} diff --git a/src/test/run-pass/traits/trait-inheritance-self.rs b/src/test/run-pass/traits/trait-inheritance-self.rs new file mode 100644 index 00000000000..f66273dd901 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-self.rs @@ -0,0 +1,39 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + fn f(&self, x: &T); +} + +trait Bar : Sized + Foo { + fn g(&self); +} + +struct S { + x: isize +} + +impl Foo for S { + fn f(&self, x: &S) { + println!("{}", x.x); + } +} + +impl Bar for S { + fn g(&self) { + self.f(self); + } +} + +pub fn main() { + let s = S { x: 1 }; + s.g(); +} diff --git a/src/test/run-pass/traits/trait-inheritance-simple.rs b/src/test/run-pass/traits/trait-inheritance-simple.rs new file mode 100644 index 00000000000..379a98cdebe --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-simple.rs @@ -0,0 +1,33 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { fn f(&self) -> isize; } +trait Bar : Foo { fn g(&self) -> isize; } + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } + +fn ff(a: &T) -> isize { + a.f() +} + +fn gg(a: &T) -> isize { + a.g() +} + +pub fn main() { + let a = &A { x: 3 }; + assert_eq!(ff(a), 10); + assert_eq!(gg(a), 20); +} diff --git a/src/test/run-pass/traits/trait-inheritance-static.rs b/src/test/run-pass/traits/trait-inheritance-static.rs new file mode 100644 index 00000000000..561c0582ebc --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-static.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub trait MyNum { + fn from_int(_: isize) -> Self; +} + +pub trait NumExt: MyNum { } + +struct S { v: isize } + +impl MyNum for S { + fn from_int(i: isize) -> S { + S { + v: i + } + } +} + +impl NumExt for S { } + +fn greater_than_one() -> T { MyNum::from_int(1) } + +pub fn main() { + let v: S = greater_than_one(); + assert_eq!(v.v, 1); +} diff --git a/src/test/run-pass/traits/trait-inheritance-static2.rs b/src/test/run-pass/traits/trait-inheritance-static2.rs new file mode 100644 index 00000000000..b98b7a1e2d9 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-static2.rs @@ -0,0 +1,39 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +pub trait MyEq {} + +pub trait MyNum { + fn from_int(_: isize) -> Self; +} + +pub trait NumExt: MyEq + MyNum { } + +struct S { v: isize } + +impl MyEq for S { } + +impl MyNum for S { + fn from_int(i: isize) -> S { + S { + v: i + } + } +} + +impl NumExt for S { } + +fn greater_than_one() -> T { MyNum::from_int(1) } + +pub fn main() { + let v: S = greater_than_one(); + assert_eq!(v.v, 1); +} diff --git a/src/test/run-pass/traits/trait-inheritance-subst.rs b/src/test/run-pass/traits/trait-inheritance-subst.rs new file mode 100644 index 00000000000..02f417eb8fc --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-subst.rs @@ -0,0 +1,37 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub trait Add { + fn add(&self, rhs: &RHS) -> Result; +} + +trait MyNum : Sized + Add { } + +struct MyInt { val: isize } + +impl Add for MyInt { + fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) } +} + +impl MyNum for MyInt {} + +fn f(x: T, y: T) -> T { + return x.add(&y); +} + +fn mi(v: isize) -> MyInt { MyInt { val: v } } + +pub fn main() { + let (x, y) = (mi(3), mi(5)); + let z = f(x, y); + assert_eq!(z.val, 8) +} diff --git a/src/test/run-pass/traits/trait-inheritance-subst2.rs b/src/test/run-pass/traits/trait-inheritance-subst2.rs new file mode 100644 index 00000000000..3efe3e64edf --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-subst2.rs @@ -0,0 +1,47 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Panda { + fn chomp(&self, bamboo: &T) -> T; +} + +trait Add: Panda { + fn add(&self, rhs: &RHS) -> Result; +} + +trait MyNum : Sized + Add { } + +struct MyInt { val: isize } + +impl Panda for MyInt { + fn chomp(&self, bamboo: &MyInt) -> MyInt { + mi(self.val + bamboo.val) + } +} + +impl Add for MyInt { + fn add(&self, other: &MyInt) -> MyInt { self.chomp(other) } +} + +impl MyNum for MyInt {} + +fn f(x: T, y: T) -> T { + return x.add(&y).chomp(&y); +} + +fn mi(v: isize) -> MyInt { MyInt { val: v } } + +pub fn main() { + let (x, y) = (mi(3), mi(5)); + let z = f(x, y); + assert_eq!(z.val, 13); +} diff --git a/src/test/run-pass/traits/trait-inheritance-visibility.rs b/src/test/run-pass/traits/trait-inheritance-visibility.rs new file mode 100644 index 00000000000..ea3e88f2f9a --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance-visibility.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +mod traits { + pub trait Foo { fn f(&self) -> isize; } + + impl Foo for isize { fn f(&self) -> isize { 10 } } +} + +trait Quux: traits::Foo { } +impl Quux for T { } + +// Foo is not in scope but because Quux is we can still access +// Foo's methods on a Quux bound typaram +fn f(x: &T) { + assert_eq!(x.f(), 10); +} + +pub fn main() { + f(&0) +} diff --git a/src/test/run-pass/traits/trait-inheritance2.rs b/src/test/run-pass/traits/trait-inheritance2.rs new file mode 100644 index 00000000000..01088d65537 --- /dev/null +++ b/src/test/run-pass/traits/trait-inheritance2.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +trait Foo { fn f(&self) -> isize; } +trait Bar { fn g(&self) -> isize; } +trait Baz { fn h(&self) -> isize; } + +trait Quux: Foo + Bar + Baz { } + +struct A { x: isize } + +impl Foo for A { fn f(&self) -> isize { 10 } } +impl Bar for A { fn g(&self) -> isize { 20 } } +impl Baz for A { fn h(&self) -> isize { 30 } } +impl Quux for A {} + +fn f(a: &T) { + assert_eq!(a.f(), 10); + assert_eq!(a.g(), 20); + assert_eq!(a.h(), 30); +} + +pub fn main() { + let a = &A { x: 3 }; + f(a); +} diff --git a/src/test/run-pass/traits/trait-item-inside-macro.rs b/src/test/run-pass/traits/trait-item-inside-macro.rs new file mode 100644 index 00000000000..a61afbba55f --- /dev/null +++ b/src/test/run-pass/traits/trait-item-inside-macro.rs @@ -0,0 +1,40 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #34183 + +macro_rules! foo { + () => { + fn foo() { } + } +} + +macro_rules! bar { + () => { + fn bar(); + } +} + +trait Bleh { + foo!(); + bar!(); +} + +struct Test; + +impl Bleh for Test { + fn bar() {} +} + +fn main() { + Test::bar(); + Test::foo(); +} diff --git a/src/test/run-pass/traits/trait-object-auto-dedup.rs b/src/test/run-pass/traits/trait-object-auto-dedup.rs new file mode 100644 index 00000000000..c33482e8a71 --- /dev/null +++ b/src/test/run-pass/traits/trait-object-auto-dedup.rs @@ -0,0 +1,54 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that duplicate auto trait bounds in trait objects don't create new types. +#[allow(unused_assignments)] + +use std::marker::Send as SendAlias; + +// A dummy trait for the non-auto trait. +trait Trait {} + +// A dummy struct to implement Trait, Send, and . +struct Struct; + +impl Trait for Struct {} + +// These three functions should be equivalent. +fn takes_dyn_trait_send(_: Box) {} +fn takes_dyn_trait_send_send(_: Box) {} +fn takes_dyn_trait_send_sendalias(_: Box) {} + +impl dyn Trait + Send + Send { + fn do_nothing(&self) {} +} + +fn main() { + // 1. Moving into a variable with more Sends and back. + let mut dyn_trait_send = Box::new(Struct) as Box; + let dyn_trait_send_send: Box = dyn_trait_send; + dyn_trait_send = dyn_trait_send_send; + + // 2. Calling methods with different number of Sends. + let dyn_trait_send = Box::new(Struct) as Box; + takes_dyn_trait_send_send(dyn_trait_send); + + let dyn_trait_send_send = Box::new(Struct) as Box; + takes_dyn_trait_send(dyn_trait_send_send); + + // 3. Aliases to the trait are transparent. + let dyn_trait_send = Box::new(Struct) as Box; + takes_dyn_trait_send_sendalias(dyn_trait_send); + + // 4. Calling an impl that duplicates an auto trait. + let dyn_trait_send = Box::new(Struct) as Box; + dyn_trait_send.do_nothing(); +} diff --git a/src/test/run-pass/traits/trait-object-exclusion.rs b/src/test/run-pass/traits/trait-object-exclusion.rs new file mode 100644 index 00000000000..a48c7876967 --- /dev/null +++ b/src/test/run-pass/traits/trait-object-exclusion.rs @@ -0,0 +1,29 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Future: 'static { + // The requirement for Self: Sized must prevent instantiation of + // Future::forget in vtables, otherwise there's an infinite type + // recursion through as Future>::forget. + fn forget(self) where Self: Sized { + Box::new(Map(self)) as Box; + } +} + +struct Map(A); +impl Future for Map {} + +pub struct Promise; +impl Future for Promise {} + +fn main() { + Promise.forget(); +} diff --git a/src/test/run-pass/traits/trait-object-generics.rs b/src/test/run-pass/traits/trait-object-generics.rs new file mode 100644 index 00000000000..b76717a28ff --- /dev/null +++ b/src/test/run-pass/traits/trait-object-generics.rs @@ -0,0 +1,53 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// test for #8664 + +#![feature(box_syntax)] + +use std::marker; + +pub trait Trait2 { + fn doit(&self) -> A; +} + +pub struct Impl { + m1: marker::PhantomData<(A1,A2,A3)>, + /* + * With A2 we get the ICE: + * task failed at 'index out of bounds: the len is 1 but the index is 1', + * src/librustc/middle/subst.rs:58 + */ + t: Box+'static> +} + +impl Impl { + pub fn step(&self) { + self.t.doit(); + } +} + +// test for #8601 + +enum Type { Constant(T) } + +trait Trait { + fn method(&self, _: Type<(K,V)>) -> isize; +} + +impl Trait for () { + fn method(&self, _x: Type<(u8,V)>) -> isize { 0 } +} + +pub fn main() { + let a = box () as Box>; + assert_eq!(a.method(Type::Constant((1, 2))), 0); +} diff --git a/src/test/run-pass/traits/trait-object-lifetime-first.rs b/src/test/run-pass/traits/trait-object-lifetime-first.rs new file mode 100644 index 00000000000..20df809c4ff --- /dev/null +++ b/src/test/run-pass/traits/trait-object-lifetime-first.rs @@ -0,0 +1,23 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::fmt::Display; + +static BYTE: u8 = 33; + +fn main() { + let x: &('static + Display) = &BYTE; + let y: Box<'static + Display> = Box::new(BYTE); + let xstr = format!("{}", x); + let ystr = format!("{}", y); + assert_eq!(xstr, "33"); + assert_eq!(ystr, "33"); +} diff --git a/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs b/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs new file mode 100644 index 00000000000..ffe66606461 --- /dev/null +++ b/src/test/run-pass/traits/trait-object-with-lifetime-bound.rs @@ -0,0 +1,44 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Uncovered during work on new scoping rules for safe destructors +// as an important use case to support properly. + + +pub struct E<'a> { + pub f: &'a u8, +} +impl<'b> E<'b> { + pub fn m(&self) -> &'b u8 { self.f } +} + +pub struct P<'c> { + pub g: &'c u8, +} +pub trait M { + fn n(&self) -> u8; +} +impl<'d> M for P<'d> { + fn n(&self) -> u8 { *self.g } +} + +fn extension<'e>(x: &'e E<'e>) -> Box { + loop { + let p = P { g: x.m() }; + return Box::new(p) as Box; + } +} + +fn main() { + let w = E { f: &10 }; + let o = extension(&w); + assert_eq!(o.n(), 10); +} diff --git a/src/test/run-pass/traits/trait-region-pointer-simple.rs b/src/test/run-pass/traits/trait-region-pointer-simple.rs new file mode 100644 index 00000000000..8f021d5b25a --- /dev/null +++ b/src/test/run-pass/traits/trait-region-pointer-simple.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Foo { + fn f(&self) -> isize; +} + +struct A { + x: isize +} + +impl Foo for A { + fn f(&self) -> isize { + println!("Today's number is {}", self.x); + return self.x; + } +} + +pub fn main() { + let a = A { x: 3 }; + let b = (&a) as &Foo; + assert_eq!(b.f(), 3); +} diff --git a/src/test/run-pass/traits/trait-safety-ok-cc.rs b/src/test/run-pass/traits/trait-safety-ok-cc.rs new file mode 100644 index 00000000000..d1b3dfec45e --- /dev/null +++ b/src/test/run-pass/traits/trait-safety-ok-cc.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:trait_safety_lib.rs + +// Simple smoke test that unsafe traits can be compiled across crates. + + +extern crate trait_safety_lib as lib; + +use lib::Foo; + +struct Bar { x: isize } +unsafe impl Foo for Bar { + fn foo(&self) -> isize { self.x } +} + +fn take_foo(f: &F) -> isize { f.foo() } + +fn main() { + let x: isize = 22; + assert_eq!(22, take_foo(&x)); + + let x: Bar = Bar { x: 23 }; + assert_eq!(23, take_foo(&x)); +} diff --git a/src/test/run-pass/traits/trait-safety-ok.rs b/src/test/run-pass/traits/trait-safety-ok.rs new file mode 100644 index 00000000000..2787d56164a --- /dev/null +++ b/src/test/run-pass/traits/trait-safety-ok.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Simple smoke test that unsafe traits can be compiled etc. + + +unsafe trait Foo { + fn foo(&self) -> isize; +} + +unsafe impl Foo for isize { + fn foo(&self) -> isize { *self } +} + +fn take_foo(f: &F) -> isize { f.foo() } + +fn main() { + let x: isize = 22; + assert_eq!(22, take_foo(&x)); +} diff --git a/src/test/run-pass/traits/trait-static-method-overwriting.rs b/src/test/run-pass/traits/trait-static-method-overwriting.rs new file mode 100644 index 00000000000..25307e822ff --- /dev/null +++ b/src/test/run-pass/traits/trait-static-method-overwriting.rs @@ -0,0 +1,43 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +mod base { + pub trait HasNew { + fn new() -> Self; + } + + pub struct Foo { + dummy: (), + } + + impl ::base::HasNew for Foo { + fn new() -> Foo { + println!("Foo"); + Foo { dummy: () } + } + } + + pub struct Bar { + dummy: (), + } + + impl ::base::HasNew for Bar { + fn new() -> Bar { + println!("Bar"); + Bar { dummy: () } + } + } +} + +pub fn main() { + let _f: base::Foo = base::HasNew::new(); + let _b: base::Bar = base::HasNew::new(); +} diff --git a/src/test/run-pass/traits/trait-to-str.rs b/src/test/run-pass/traits/trait-to-str.rs new file mode 100644 index 00000000000..3fbb7aadde4 --- /dev/null +++ b/src/test/run-pass/traits/trait-to-str.rs @@ -0,0 +1,46 @@ +// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + + +trait to_str { + fn to_string_(&self) -> String; +} + +impl to_str for isize { + fn to_string_(&self) -> String { self.to_string() } +} + +impl to_str for Vec { + fn to_string_(&self) -> String { + format!("[{}]", + self.iter() + .map(|e| e.to_string_()) + .collect::>() + .join(", ")) + } +} + +pub fn main() { + assert_eq!(1.to_string_(), "1".to_string()); + assert_eq!((vec![2, 3, 4]).to_string_(), "[2, 3, 4]".to_string()); + + fn indirect(x: T) -> String { + format!("{}!", x.to_string_()) + } + assert_eq!(indirect(vec![10, 20]), "[10, 20]!".to_string()); + + fn indirect2(x: T) -> String { + indirect(x) + } + assert_eq!(indirect2(vec![1]), "[1]!".to_string()); +} diff --git a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs new file mode 100644 index 00000000000..3a732aabbf7 --- /dev/null +++ b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs @@ -0,0 +1,53 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that when there is a conditional (but blanket) impl and a +// where clause, we don't get confused in trait resolution. +// +// Issue #18453. + +// pretty-expanded FIXME #23616 + +use std::rc::Rc; + +pub trait Foo { + fn foo(&mut self, msg: M); +} + +pub trait Bar { + fn dummy(&self) -> M; +} + +impl> Foo for F { + fn foo(&mut self, msg: M) { + } +} + +pub struct Both { + inner: Rc<(M, F)>, +} + +impl> Clone for Both { + fn clone(&self) -> Both { + Both { inner: self.inner.clone() } + } +} + +fn repro1>(_both: Both) { +} + +fn repro2>(msg: M, foo: F) { + let both = Both { inner: Rc::new((msg, foo)) }; + repro1(both.clone()); // <--- This clone causes problem +} + +pub fn main() { +} diff --git a/src/test/run-pass/traits/trait-with-bounds-default.rs b/src/test/run-pass/traits/trait-with-bounds-default.rs new file mode 100644 index 00000000000..97fc58d4e54 --- /dev/null +++ b/src/test/run-pass/traits/trait-with-bounds-default.rs @@ -0,0 +1,42 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +pub trait Clone2 { + /// Returns a copy of the value. The contents of boxes + /// are copied to maintain uniqueness, while the contents of + /// managed pointers are not copied. + fn clone(&self) -> Self; +} + +trait Getter { + fn do_get(&self) -> T; + + fn do_get2(&self) -> (T, T) { + let x = self.do_get(); + (x.clone(), x.clone()) + } + +} + +impl Getter for isize { + fn do_get(&self) -> isize { *self } +} + +impl Getter for Option { + fn do_get(&self) -> T { self.as_ref().unwrap().clone() } +} + + +pub fn main() { + assert_eq!(3.do_get2(), (3, 3)); + assert_eq!(Some("hi".to_string()).do_get2(), ("hi".to_string(), "hi".to_string())); +} diff --git a/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs b/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs new file mode 100644 index 00000000000..2da40300818 --- /dev/null +++ b/src/test/run-pass/traits/traits-assoc-type-in-supertrait.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test case where an associated type is referenced from within the +// supertrait definition. Issue #20220. + + +use std::vec::IntoIter; + +pub trait Foo: Iterator::Key> { + type Key; +} + +impl Foo for IntoIter { + type Key = i32; +} + +fn sum_foo>(f: F) -> i32 { + f.fold(0, |a,b| a + b) +} + +fn main() { + let x = sum_foo(vec![11, 10, 1].into_iter()); + assert_eq!(x, 22); +} diff --git a/src/test/run-pass/traits/traits-conditional-dispatch.rs b/src/test/run-pass/traits/traits-conditional-dispatch.rs new file mode 100644 index 00000000000..e24249ec184 --- /dev/null +++ b/src/test/run-pass/traits/traits-conditional-dispatch.rs @@ -0,0 +1,45 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to resolve conditional dispatch. Here, the +// blanket impl for T:Copy coexists with an impl for Box, because +// Box does not impl Copy. + +#![feature(box_syntax)] + +trait Get { + fn get(&self) -> Self; +} + +trait MyCopy { fn copy(&self) -> Self; } +impl MyCopy for u16 { fn copy(&self) -> Self { *self } } +impl MyCopy for u32 { fn copy(&self) -> Self { *self } } +impl MyCopy for i32 { fn copy(&self) -> Self { *self } } +impl MyCopy for Option { fn copy(&self) -> Self { *self } } + +impl Get for T { + fn get(&self) -> T { self.copy() } +} + +impl Get for Box { + fn get(&self) -> Box { box get_it(&**self) } +} + +fn get_it(t: &T) -> T { + (*t).get() +} + +fn main() { + assert_eq!(get_it(&1_u32), 1_u32); + assert_eq!(get_it(&1_u16), 1_u16); + assert_eq!(get_it(&Some(1_u16)), Some(1_u16)); + assert_eq!(get_it(&Box::new(1)), Box::new(1)); +} diff --git a/src/test/run-pass/traits/traits-conditional-model-fn.rs b/src/test/run-pass/traits/traits-conditional-model-fn.rs new file mode 100644 index 00000000000..cc5ce571a4e --- /dev/null +++ b/src/test/run-pass/traits/traits-conditional-model-fn.rs @@ -0,0 +1,69 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A model for how the `Fn` traits could work. You can implement at +// most one of `Go`, `GoMut`, or `GoOnce`, and then the others follow +// automatically. + +// aux-build:go_trait.rs + + +extern crate go_trait; + +use go_trait::{Go, GoMut, GoOnce, go, go_mut, go_once}; + +use std::rc::Rc; +use std::cell::Cell; + +/////////////////////////////////////////////////////////////////////////// + +struct SomeGoableThing { + counter: Rc> +} + +impl Go for SomeGoableThing { + fn go(&self, arg: isize) { + self.counter.set(self.counter.get() + arg); + } +} + +/////////////////////////////////////////////////////////////////////////// + +struct SomeGoOnceableThing { + counter: Rc> +} + +impl GoOnce for SomeGoOnceableThing { + fn go_once(self, arg: isize) { + self.counter.set(self.counter.get() + arg); + } +} + +/////////////////////////////////////////////////////////////////////////// + +fn main() { + let counter = Rc::new(Cell::new(0)); + let mut x = SomeGoableThing { counter: counter.clone() }; + + go(&x, 10); + assert_eq!(counter.get(), 10); + + go_mut(&mut x, 100); + assert_eq!(counter.get(), 110); + + go_once(x, 1_000); + assert_eq!(counter.get(), 1_110); + + let x = SomeGoOnceableThing { counter: counter.clone() }; + + go_once(x, 10_000); + assert_eq!(counter.get(), 11_110); +} diff --git a/src/test/run-pass/traits/traits-default-method-macro.rs b/src/test/run-pass/traits/traits-default-method-macro.rs new file mode 100644 index 00000000000..12d057f207d --- /dev/null +++ b/src/test/run-pass/traits/traits-default-method-macro.rs @@ -0,0 +1,30 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait Foo { + fn bar(&self) -> String { + format!("test") + } +} + +enum Baz { + Quux +} + +impl Foo for Baz { +} + +pub fn main() { + let q = Baz::Quux; + assert_eq!(q.bar(), "test".to_string()); +} diff --git a/src/test/run-pass/traits/traits-default-method-mut.rs b/src/test/run-pass/traits/traits-default-method-mut.rs new file mode 100644 index 00000000000..7cfdae9e652 --- /dev/null +++ b/src/test/run-pass/traits/traits-default-method-mut.rs @@ -0,0 +1,20 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![allow(unused_variables)] + +trait Foo { + fn foo(&self, mut v: isize) { v = 1; } +} + +pub fn main() {} diff --git a/src/test/run-pass/traits/traits-default-method-self.rs b/src/test/run-pass/traits/traits-default-method-self.rs new file mode 100644 index 00000000000..e5cea5ca9a5 --- /dev/null +++ b/src/test/run-pass/traits/traits-default-method-self.rs @@ -0,0 +1,28 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait Cat { + fn meow(&self) -> bool; + fn scratch(&self) -> bool { self.purr() } + fn purr(&self) -> bool { true } +} + +impl Cat for isize { + fn meow(&self) -> bool { + self.scratch() + } +} + +pub fn main() { + assert!(5.meow()); +} diff --git a/src/test/run-pass/traits/traits-default-method-trivial.rs b/src/test/run-pass/traits/traits-default-method-trivial.rs new file mode 100644 index 00000000000..314fbcfb40e --- /dev/null +++ b/src/test/run-pass/traits/traits-default-method-trivial.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +trait Cat { + fn meow(&self) -> bool; + fn scratch(&self) -> bool; + fn purr(&self) -> bool { true } +} + +impl Cat for isize { + fn meow(&self) -> bool { + self.scratch() + } + fn scratch(&self) -> bool { + self.purr() + } +} + +pub fn main() { + assert!(5.meow()); +} diff --git a/src/test/run-pass/traits/traits-elaborate-type-region.rs b/src/test/run-pass/traits/traits-elaborate-type-region.rs new file mode 100644 index 00000000000..c2689794b2f --- /dev/null +++ b/src/test/run-pass/traits/traits-elaborate-type-region.rs @@ -0,0 +1,59 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(dead_code)] + +// Test that we elaborate `Type: 'region` constraints and infer various important things. + +trait Master<'a, T: ?Sized> { + fn foo() where T: 'a; +} + +// [U]: 'a => U: 'a +impl<'a, U> Master<'a, [U]> for () { + fn foo() where U: 'a { } +} + +// &'b U: 'a => 'b: 'a, U: 'a +impl<'a, 'b, U> Master<'a, &'b U> for () { + fn foo() where 'b: 'a, U: 'a { } +} + +// &'b [U]: 'a => 'b: 'a, U: 'a +impl<'a, 'b, U> Master<'a, &'b [U]> for () { + fn foo() where 'b: 'a, U: 'a { } +} + +// Foo<'b>: 'a => 'b: 'a +struct Foo<'a> { x: &'a () } +impl<'a, 'b> Master<'a, Foo<'b>> for () { + fn foo() where 'b: 'a { } +} + +// Bar<'b, T>: 'a => 'b: 'a, T: 'a +struct Bar<'a, T: 'a> { x: &'a T } +impl<'a, 'b, T> Master<'a, Bar<'b, T>> for () { + fn foo() where 'b: 'a, T: 'a { } +} + +// fn(T): 'a => T: 'a +impl<'a, T> Master<'a, fn(T)> for () { + fn foo() where T: 'a { } +} + +// fn() -> T: 'a => T: 'a +impl<'a, T> Master<'a, fn() -> T> for () { + fn foo() where T: 'a { } +} + +fn main() { + println!("Hello, world!"); +} diff --git a/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs b/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs new file mode 100644 index 00000000000..f33b5841d85 --- /dev/null +++ b/src/test/run-pass/traits/traits-impl-object-overlap-issue-23853.rs @@ -0,0 +1,28 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to compile the case where both a blanket impl +// and the object type itself supply the required trait obligation. +// In this case, the blanket impl for `Foo` applies to any type, +// including `Bar`, but the object type `Bar` also implicitly supplies +// this context. + +trait Foo { fn dummy(&self) { } } + +trait Bar: Foo { } + +impl Foo for T { } + +fn want_foo() { } + +fn main() { + want_foo::(); +} diff --git a/src/test/run-pass/traits/traits-issue-22019.rs b/src/test/run-pass/traits/traits-issue-22019.rs new file mode 100644 index 00000000000..a5da604aeb1 --- /dev/null +++ b/src/test/run-pass/traits/traits-issue-22019.rs @@ -0,0 +1,44 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test an issue where global caching was causing free regions from +// distinct scopes to be compared (`'g` and `'h`). The only important +// thing is that compilation succeeds here. + +// pretty-expanded FIXME #23616 + +#![allow(missing_copy_implementations)] +#![allow(unused_variables)] + +use std::borrow::ToOwned; + +pub struct CFGNode; + +pub type Node<'a> = &'a CFGNode; + +pub trait GraphWalk<'c, N> { + /// Returns all the nodes in this graph. + fn nodes(&'c self) where [N]:ToOwned>; +} + +impl<'g> GraphWalk<'g, Node<'g>> for u32 +{ + fn nodes(&'g self) where [Node<'g>]:ToOwned>> + { loop { } } +} + +impl<'h> GraphWalk<'h, Node<'h>> for u64 +{ + fn nodes(&'h self) where [Node<'h>]:ToOwned>> + { loop { } } +} + +fn main() { } diff --git a/src/test/run-pass/traits/traits-issue-22110.rs b/src/test/run-pass/traits/traits-issue-22110.rs new file mode 100644 index 00000000000..02a2589a4e8 --- /dev/null +++ b/src/test/run-pass/traits/traits-issue-22110.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test an issue where we reported ambiguity between the where-clause +// and the blanket impl. The only important thing is that compilation +// succeeds here. Issue #22110. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] + +trait Foo { + fn foo(&self, a: A); +} + +impl Foo for F { + fn foo(&self, _: A) { } +} + +fn baz Foo<(&'a A,)>>(_: F) { } + +fn components(t: fn(&A)) + where fn(&A) : for<'a> Foo<(&'a A,)>, +{ + baz(t) +} + +fn main() { +} diff --git a/src/test/run-pass/traits/traits-issue-22655.rs b/src/test/run-pass/traits/traits-issue-22655.rs new file mode 100644 index 00000000000..0e80d20ad45 --- /dev/null +++ b/src/test/run-pass/traits/traits-issue-22655.rs @@ -0,0 +1,32 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Regression test for issue #22655: This test should not lead to +// infinite recursion. + +// pretty-expanded FIXME #23616 + +unsafe impl Send for Unique { } + +pub struct Unique { + pointer: *const T, +} + +pub struct Node { + vals: V, + edges: Unique>, +} + +fn is_send() {} + +fn main() { + is_send::>(); +} diff --git a/src/test/run-pass/traits/traits-issue-23003.rs b/src/test/run-pass/traits/traits-issue-23003.rs new file mode 100644 index 00000000000..e77b038fc47 --- /dev/null +++ b/src/test/run-pass/traits/traits-issue-23003.rs @@ -0,0 +1,42 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test stack overflow triggered by evaluating the implications. To be +// WF, the type `Receipt` would require that `::Cancel` be WF. This normalizes to `Receipt` +// again, leading to an infinite cycle. Issue #23003. + +// pretty-expanded FIXME #23616 + +#![allow(dead_code)] +#![allow(unused_variables)] + +use std::marker::PhantomData; + +trait Async { + type Cancel; +} + +struct Receipt { + marker: PhantomData, +} + +struct Complete { + core: Option<()>, +} + +impl Async for Complete { + type Cancel = Receipt; +} + +fn foo(r: Receipt) { } + +fn main() { } diff --git a/src/test/run-pass/traits/traits-issue-26339.rs b/src/test/run-pass/traits/traits-issue-26339.rs new file mode 100644 index 00000000000..3176b5cb7f9 --- /dev/null +++ b/src/test/run-pass/traits/traits-issue-26339.rs @@ -0,0 +1,41 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the right implementation is called through a trait +// object when supertraits include multiple references to the +// same trait, with different type parameters. + +trait A: PartialEq + PartialEq { } + +struct Foo; +struct Bar; + +struct Aimpl; + +impl PartialEq for Aimpl { + fn eq(&self, _rhs: &Foo) -> bool { + true + } +} + +impl PartialEq for Aimpl { + fn eq(&self, _rhs: &Bar) -> bool { + false + } +} + +impl A for Aimpl { } + +fn main() { + let a = &Aimpl as &A; + + assert!(*a == Foo); +} diff --git a/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs b/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs new file mode 100644 index 00000000000..22404849be6 --- /dev/null +++ b/src/test/run-pass/traits/traits-multidispatch-infer-convert-target.rs @@ -0,0 +1,47 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can infer the Target based on the Self or vice versa. + + +use std::mem; + +trait Convert { + fn convert(&self) -> Target; +} + +impl Convert for i16 { + fn convert(&self) -> u32 { + *self as u32 + } +} + +impl Convert for u32 { + fn convert(&self) -> i16 { + *self as i16 + } +} + +fn test(_: T, _: U, t_size: usize, u_size: usize) +where T : Convert +{ + assert_eq!(mem::size_of::(), t_size); + assert_eq!(mem::size_of::(), u_size); +} + +fn main() { + use std::default::Default; + // T = i16, U = u32 + test(22_i16, Default::default(), 2, 4); + + // T = u32, U = i16 + test(22_u32, Default::default(), 4, 2); +} diff --git a/src/test/run-pass/traits/traits-negative-impls.rs b/src/test/run-pass/traits/traits-negative-impls.rs new file mode 100644 index 00000000000..96c86f147ce --- /dev/null +++ b/src/test/run-pass/traits/traits-negative-impls.rs @@ -0,0 +1,30 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(optin_builtin_traits)] + +use std::marker::Send; + +pub struct WaitToken; +impl !Send for WaitToken {} + +pub struct Test(T); +unsafe impl Send for Test {} + +pub fn spawn(_: F) -> () where F: FnOnce(), F: Send + 'static {} + +fn main() { + let wt = Test(WaitToken); + spawn(move || { + let x = wt; + println!("Hello, World!"); + }); +} diff --git a/src/test/run-pass/traits/traits-repeated-supertrait.rs b/src/test/run-pass/traits/traits-repeated-supertrait.rs new file mode 100644 index 00000000000..4e70669ec96 --- /dev/null +++ b/src/test/run-pass/traits/traits-repeated-supertrait.rs @@ -0,0 +1,58 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test a case of a trait which extends the same supertrait twice, but +// with difference type parameters. Test that we can invoke the +// various methods in various ways successfully. +// See also `compile-fail/trait-repeated-supertrait-ambig.rs`. + + +trait CompareTo { + fn same_as(&self, t: T) -> bool; +} + +trait CompareToInts : CompareTo + CompareTo { +} + +impl CompareTo for i64 { + fn same_as(&self, t: i64) -> bool { *self == t } +} + +impl CompareTo for i64 { + fn same_as(&self, t: u64) -> bool { *self == (t as i64) } +} + +impl CompareToInts for i64 { } + +fn with_obj(c: &CompareToInts) -> bool { + c.same_as(22_i64) && c.same_as(22_u64) +} + +fn with_trait(c: &C) -> bool { + c.same_as(22_i64) && c.same_as(22_u64) +} + +fn with_ufcs1(c: &C) -> bool { + CompareToInts::same_as(c, 22_i64) && CompareToInts::same_as(c, 22_u64) +} + +fn with_ufcs2(c: &C) -> bool { + CompareTo::same_as(c, 22_i64) && CompareTo::same_as(c, 22_u64) +} + +fn main() { + assert_eq!(22_i64.same_as(22_i64), true); + assert_eq!(22_i64.same_as(22_u64), true); + assert_eq!(with_trait(&22), true); + assert_eq!(with_obj(&22), true); + assert_eq!(with_ufcs1(&22), true); + assert_eq!(with_ufcs2(&22), true); +} diff --git a/src/test/run-pass/traits/ufcs-trait-object.rs b/src/test/run-pass/traits/ufcs-trait-object.rs new file mode 100644 index 00000000000..06d3c5e9329 --- /dev/null +++ b/src/test/run-pass/traits/ufcs-trait-object.rs @@ -0,0 +1,27 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that when you use ufcs form to invoke a trait method (on a +// trait object) everything works fine. + + +trait Foo { + fn test(&self) -> i32; +} + +impl Foo for i32 { + fn test(&self) -> i32 { *self } +} + +fn main() { + let a: &Foo = &22; + assert_eq!(Foo::test(a), 22); +} diff --git a/src/test/run-pass/traits/use-trait-before-def.rs b/src/test/run-pass/traits/use-trait-before-def.rs new file mode 100644 index 00000000000..4f107fb8242 --- /dev/null +++ b/src/test/run-pass/traits/use-trait-before-def.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Issue #1761 + +// pretty-expanded FIXME #23616 + +impl foo for isize { fn foo(&self) -> isize { 10 } } +trait foo { fn foo(&self) -> isize; } +pub fn main() {} diff --git a/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs b/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs new file mode 100644 index 00000000000..dc9798a2101 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +use std::ops::Add; + +#[inline] +pub fn has_closures() -> usize { + let x = 1; + let mut f = move || x; + let y = 1; + let g = || y; + f() + g() +} + +pub fn has_generic_closures + Copy>(x: T, y: T) -> T { + let mut f = move || x; + let g = || y; + f() + g() +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs new file mode 100644 index 00000000000..f317b835d10 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-all-traits.rs @@ -0,0 +1,31 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(lang_items)] + +fn a isize>(f: F) -> isize { + f(1, 2) +} + +fn b isize>(mut f: F) -> isize { + f(3, 4) +} + +fn c isize>(f: F) -> isize { + f(5, 6) +} + +fn main() { + let z: isize = 7; + assert_eq!(a(move |x: isize, y| x + y + z), 10); + assert_eq!(b(move |x: isize, y| x + y + z), 14); + assert_eq!(c(move |x: isize, y| x + y + z), 18); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs new file mode 100644 index 00000000000..eebd30a01f9 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that you can supply `&F` where `F: FnMut()`. + +#![feature(lang_items)] + +fn a i32>(mut f: F) -> i32 { + f() +} + +fn b(f: &mut FnMut() -> i32) -> i32 { + a(f) +} + +fn c i32>(f: &mut F) -> i32 { + a(f) +} + +fn main() { + let z: isize = 7; + + let x = b(&mut || 22); + assert_eq!(x, 22); + + let x = c(&mut || 22); + assert_eq!(x, 22); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs new file mode 100644 index 00000000000..52a10869610 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that you can supply `&F` where `F: Fn()`. + +#![feature(lang_items)] + +fn a i32>(f: F) -> i32 { + f() +} + +fn b(f: &Fn() -> i32) -> i32 { + a(f) +} + +fn c i32>(f: &F) -> i32 { + a(f) +} + +fn main() { + let z: isize = 7; + + let x = b(&|| 22); + assert_eq!(x, 22); + + let x = c(&|| 22); + assert_eq!(x, 22); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs new file mode 100644 index 00000000000..b0c40700bb3 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-boxed.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::ops::FnMut; + + fn make_adder(x: i32) -> Boxi32+'static> { + (box move |y: i32| -> i32 { x + y }) as + Boxi32+'static> +} + +pub fn main() { + let mut adder = make_adder(3); + let z = adder(2); + println!("{}", z); + assert_eq!(z, 5); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs new file mode 100644 index 00000000000..564986bbbca --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-by-ref.rs @@ -0,0 +1,34 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test by-ref capture of environment in unboxed closure types + +fn call_fn(f: F) { + f() +} + +fn call_fn_mut(mut f: F) { + f() +} + +fn call_fn_once(f: F) { + f() +} + +fn main() { + let mut x = 0_usize; + let y = 2_usize; + + call_fn(|| assert_eq!(x, 0)); + call_fn_mut(|| x += y); + call_fn_once(|| x += y); + assert_eq!(x, y * 2); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs new file mode 100644 index 00000000000..b178f0af909 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the call operator autoderefs when calling a bounded type parameter. + +use std::ops::FnMut; + +fn call_with_2(x: &fn(isize) -> isize) -> isize +{ + x(2) // look ma, no `*` +} + +fn subtract_22(x: isize) -> isize { x - 22 } + +pub fn main() { + let subtract_22: fn(isize) -> isize = subtract_22; + let z = call_with_2(&subtract_22); + assert_eq!(z, -20); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs new file mode 100644 index 00000000000..ef1187a3ffb --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the call operator autoderefs when calling a bounded type parameter. + +use std::ops::FnMut; + +fn call_with_2(x: &mut F) -> isize + where F : FnMut(isize) -> isize +{ + x(2) // look ma, no `*` +} + +pub fn main() { + let z = call_with_2(&mut |x| x - 22); + assert_eq!(z, -20); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs new file mode 100644 index 00000000000..1e2495926b9 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the call operator autoderefs when calling to an object type. + +use std::ops::FnMut; + +fn make_adder(x: isize) -> Boxisize + 'static> { + Box::new(move |y| { x + y }) +} + +pub fn main() { + let mut adder = make_adder(3); + let z = adder(2); + println!("{}", z); + assert_eq!(z, 5); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs new file mode 100644 index 00000000000..e40541a2754 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::FnMut; + +fn make_adder(x: isize) -> Boxisize + 'static> { + Box::new(move |y| { x + y }) +} + +pub fn main() { + let mut adder = make_adder(3); + let z = (*adder)(2); + println!("{}", z); + assert_eq!(z, 5); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs new file mode 100644 index 00000000000..dc6903db326 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs @@ -0,0 +1,37 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we mutate a counter on the stack only when we expect to. + +fn call(f: F) where F : FnOnce() { + f(); +} + +fn main() { + let y = vec![format!("Hello"), format!("World")]; + let mut counter = 22_u32; + + call(|| { + // Move `y`, but do not move `counter`, even though it is read + // by value (note that it is also mutated). + for item in y { + let v = counter; + counter += v; + } + }); + assert_eq!(counter, 88); + + call(move || { + // this mutates a moved copy, and hence doesn't affect original + counter += 1; + }); + assert_eq!(counter, 88); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs new file mode 100644 index 00000000000..620d935b3b8 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs @@ -0,0 +1,24 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// Test that unboxed closures work with cross-crate inlining +// Acts as a regression test for #16790, #18378 and #18543 + +// aux-build:unboxed-closures-cross-crate.rs + +extern crate unboxed_closures_cross_crate as ubcc; + +fn main() { + assert_eq!(ubcc::has_closures(), 2_usize); + assert_eq!(ubcc::has_generic_closures(2_usize, 3_usize), 5_usize); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs new file mode 100644 index 00000000000..1f84db7f720 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let mut unboxed = || {}; + unboxed(); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs new file mode 100644 index 00000000000..02edd01ac18 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs @@ -0,0 +1,125 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// A battery of tests to ensure destructors of unboxed closure environments +// run at the right times. + +static mut DROP_COUNT: usize = 0; + +fn drop_count() -> usize { + unsafe { + DROP_COUNT + } +} + +struct Droppable { + x: isize, +} + +impl Droppable { + fn new() -> Droppable { + Droppable { + x: 1 + } + } +} + +impl Drop for Droppable { + fn drop(&mut self) { + unsafe { + DROP_COUNT += 1 + } + } +} + +fn a isize>(f: F) -> isize { + f(1, 2) +} + +fn b isize>(mut f: F) -> isize { + f(3, 4) +} + +fn c isize>(f: F) -> isize { + f(5, 6) +} + +fn test_fn() { + { + a(move |a: isize, b| { a + b }); + } + assert_eq!(drop_count(), 0); + + { + let z = &Droppable::new(); + a(move |a: isize, b| { z; a + b }); + assert_eq!(drop_count(), 0); + } + assert_eq!(drop_count(), 1); + + { + let z = &Droppable::new(); + let zz = &Droppable::new(); + a(move |a: isize, b| { z; zz; a + b }); + assert_eq!(drop_count(), 1); + } + assert_eq!(drop_count(), 3); +} + +fn test_fn_mut() { + { + b(move |a: isize, b| { a + b }); + } + assert_eq!(drop_count(), 3); + + { + let z = &Droppable::new(); + b(move |a: isize, b| { z; a + b }); + assert_eq!(drop_count(), 3); + } + assert_eq!(drop_count(), 4); + + { + let z = &Droppable::new(); + let zz = &Droppable::new(); + b(move |a: isize, b| { z; zz; a + b }); + assert_eq!(drop_count(), 4); + } + assert_eq!(drop_count(), 6); +} + +fn test_fn_once() { + { + c(move |a: isize, b| { a + b }); + } + assert_eq!(drop_count(), 6); + + { + let z = Droppable::new(); + c(move |a: isize, b| { z; a + b }); + assert_eq!(drop_count(), 7); + } + assert_eq!(drop_count(), 7); + + { + let z = Droppable::new(); + let zz = Droppable::new(); + c(move |a: isize, b| { z; zz; a + b }); + assert_eq!(drop_count(), 9); + } + assert_eq!(drop_count(), 9); +} + +fn main() { + test_fn(); + test_fn_mut(); + test_fn_once(); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs new file mode 100644 index 00000000000..f6f83c33f15 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Checks that higher-ranked extern fn pointers implement the full range of Fn traits. + +fn square(x: &isize) -> isize { (*x) * (*x) } + +fn call_itisize>(f: &F, x: isize) -> isize { + (*f)(&x) +} + +fn call_it_boxed(f: &Fn(&isize) -> isize, x: isize) -> isize { + f(&x) +} + +fn call_it_mutisize>(f: &mut F, x: isize) -> isize { + (*f)(&x) +} + +fn call_it_onceisize>(f: F, x: isize) -> isize { + f(&x) +} + +fn main() { + let x = call_it(&square, 22); + let x1 = call_it_boxed(&square, 22); + let y = call_it_mut(&mut square, 22); + let z = call_it_once(square, 22); + assert_eq!(x, square(&22)); + assert_eq!(x1, square(&22)); + assert_eq!(y, square(&22)); + assert_eq!(z, square(&22)); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs new file mode 100644 index 00000000000..480a6daac81 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Checks that extern fn pointers implement the full range of Fn traits. + +use std::ops::{Fn,FnMut,FnOnce}; + +fn square(x: isize) -> isize { x * x } + +fn call_itisize>(f: &F, x: isize) -> isize { + f(x) +} + +fn call_it_mutisize>(f: &mut F, x: isize) -> isize { + f(x) +} + +fn call_it_onceisize>(f: F, x: isize) -> isize { + f(x) +} + +fn main() { + let x = call_it(&square, 22); + let y = call_it_mut(&mut square, 22); + let z = call_it_once(square, 22); + assert_eq!(x, square(22)); + assert_eq!(y, square(22)); + assert_eq!(z, square(22)); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs new file mode 100644 index 00000000000..5f2e05995cc --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs @@ -0,0 +1,54 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Checks that the Fn trait hierarchy rules permit +// any Fn trait to be used where Fn is implemented. + +#![feature(unboxed_closures, fn_traits)] + +use std::ops::{Fn,FnMut,FnOnce}; + +struct S; + +impl Fn<(i32,)> for S { + extern "rust-call" fn call(&self, (x,): (i32,)) -> i32 { + x * x + } +} + +impl FnMut<(i32,)> for S { + extern "rust-call" fn call_mut(&mut self, args: (i32,)) -> i32 { self.call(args) } +} + +impl FnOnce<(i32,)> for S { + type Output = i32; + extern "rust-call" fn call_once(self, args: (i32,)) -> i32 { self.call(args) } +} + +fn call_iti32>(f: &F, x: i32) -> i32 { + f(x) +} + +fn call_it_muti32>(f: &mut F, x: i32) -> i32 { + f(x) +} + +fn call_it_oncei32>(f: F, x: i32) -> i32 { + f(x) +} + +fn main() { + let x = call_it(&S, 22); + let y = call_it_mut(&mut S, 22); + let z = call_it_once(S, 22); + assert_eq!(x, y); + assert_eq!(y, z); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs new file mode 100644 index 00000000000..592994cae6e --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs @@ -0,0 +1,43 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Checks that the Fn trait hierarchy rules permit +// FnMut or FnOnce to be used where FnMut is implemented. + +#![feature(unboxed_closures, fn_traits)] + +struct S; + +impl FnMut<(i32,)> for S { + extern "rust-call" fn call_mut(&mut self, (x,): (i32,)) -> i32 { + x * x + } +} + +impl FnOnce<(i32,)> for S { + type Output = i32; + + extern "rust-call" fn call_once(mut self, args: (i32,)) -> i32 { self.call_mut(args) } +} + +fn call_it_muti32>(f: &mut F, x: i32) -> i32 { + f(x) +} + +fn call_it_oncei32>(f: F, x: i32) -> i32 { + f(x) +} + +fn main() { + let y = call_it_mut(&mut S, 22); + let z = call_it_once(S, 22); + assert_eq!(y, z); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs new file mode 100644 index 00000000000..9120b71c6d7 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-generic.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::FnMut; + +fn call_iti32>(y: i32, mut f: F) -> i32 { + f(2, y) +} + +pub fn main() { + let f = |x: i32, y: i32| -> i32 { x + y }; + let z = call_it(3, f); + println!("{}", z); + assert_eq!(z, 5); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs new file mode 100644 index 00000000000..b9219404b46 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer that the type of `x` is `isize` based +// on the expected type from the object. + +// pretty-expanded FIXME #23616 + +pub trait ToPrimitive { + fn to_int(&self) {} +} + +impl ToPrimitive for isize {} +impl ToPrimitive for i32 {} +impl ToPrimitive for usize {} + +fn doit(val: T, f: &F) + where F : Fn(T) +{ + f(val) +} + +pub fn main() { + doit(0, &|x /*: isize*/ | { x.to_int(); }); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs new file mode 100644 index 00000000000..08e41627a9b --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer that the type of `x` is `isize` based +// on the expected type from the object. + +// pretty-expanded FIXME #23616 + +pub trait ToPrimitive { + fn to_int(&self) {} +} + +impl ToPrimitive for isize {} +impl ToPrimitive for i32 {} +impl ToPrimitive for usize {} + +fn doit(val: T, f: &Fn(T)) { f(val) } + +pub fn main() { + doit(0, &|x /*: isize*/ | { x.to_int(); }); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs new file mode 100644 index 00000000000..06c704dfda1 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer that the type of `x` is `isize` based +// on the expected type from the object. + +// pretty-expanded FIXME #23616 + +pub trait ToPrimitive { + fn to_int(&self) {} +} + +impl ToPrimitive for isize {} +impl ToPrimitive for i32 {} +impl ToPrimitive for usize {} + +fn doit(val: T, f: &F) + where F : Fn(&T) +{ + f(&val) +} + +pub fn main() { + doit(0, &|x /*: isize*/ | { x.to_int(); }); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs new file mode 100644 index 00000000000..2d0fd046610 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(fn_traits)] + +fn main() { + let mut zero = || 0; + let x = zero.call_mut(()); + assert_eq!(x, 0); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs new file mode 100644 index 00000000000..3ddde9a16af --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs @@ -0,0 +1,29 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + { + // Here this must be inferred to FnMut so that it can mutate counter: + let mut tick1 = || counter += 1; + + // In turn, tick2 must be inferred to FnMut so that it can call tick1: + let mut tick2 = || { tick1(); tick1(); }; + + tick2(); + } + + assert_eq!(counter, 2); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs new file mode 100644 index 00000000000..48645efce67 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs @@ -0,0 +1,26 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer a suitable kind for this `move` +// closure that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + let v = { + let mut tick = move || { counter += 1; counter }; + tick(); + tick() + }; + + assert_eq!(counter, 0); + assert_eq!(v, 2); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs new file mode 100644 index 00000000000..80ca969c529 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs @@ -0,0 +1,25 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnMut`). + +fn main() { + let mut counter = 0; + + { + let mut tick = || counter += 1; + tick(); + tick(); + } + + assert_eq!(counter, 2); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs new file mode 100644 index 00000000000..ff8cd4a5eff --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer a suitable kind for this `move` +// closure that is just called (`FnOnce`). + +use std::mem; + +struct DropMe<'a>(&'a mut i32); + +impl<'a> Drop for DropMe<'a> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut counter = 0; + + { + let drop_me = DropMe(&mut counter); + let tick = move || mem::drop(drop_me); + tick(); + } + + assert_eq!(counter, 1); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs new file mode 100644 index 00000000000..698a389ef65 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs @@ -0,0 +1,35 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we are able to infer a suitable kind for this closure +// that is just called (`FnOnce`). + +use std::mem; + +struct DropMe<'a>(&'a mut i32); + +impl<'a> Drop for DropMe<'a> { + fn drop(&mut self) { + *self.0 += 1; + } +} + +fn main() { + let mut counter = 0; + + { + let drop_me = DropMe(&mut counter); + let tick = || mem::drop(drop_me); + tick(); + } + + assert_eq!(counter, 1); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs new file mode 100644 index 00000000000..362d53126c2 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that we can infer the "kind" of an unboxed closure based on +// the expected type. + +// Test by-ref capture of environment in unboxed closure types + +fn call_fn(f: F) { + f() +} + +fn call_fn_mut(mut f: F) { + f() +} + +fn call_fn_once(f: F) { + f() +} + +fn main() { + let mut x = 0_usize; + let y = 2_usize; + + call_fn(|| assert_eq!(x, 0)); + call_fn_mut(|| x += y); + call_fn_once(|| x += y); + assert_eq!(x, y * 2); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs new file mode 100644 index 00000000000..c150e8915c6 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs @@ -0,0 +1,55 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(fn_traits, unboxed_closures)] + +use std::marker::PhantomData; + +// Test that we are able to infer a suitable kind for a "recursive" +// closure. As far as I can tell, coding up a recursive closure +// requires the good ol' [Y Combinator]. +// +// [Y Combinator]: http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator + +struct YCombinator { + func: F, + marker: PhantomData<(A,R)>, +} + +impl YCombinator { + fn new(f: F) -> YCombinator { + YCombinator { func: f, marker: PhantomData } + } +} + +impl R, A) -> R> Fn<(A,)> for YCombinator { + extern "rust-call" fn call(&self, (arg,): (A,)) -> R { + (self.func)(self, arg) + } +} + +impl R, A) -> R> FnMut<(A,)> for YCombinator { + extern "rust-call" fn call_mut(&mut self, args: (A,)) -> R { self.call(args) } +} + +impl R, A) -> R> FnOnce<(A,)> for YCombinator { + type Output = R; + extern "rust-call" fn call_once(self, args: (A,)) -> R { self.call(args) } +} + +fn main() { + let factorial = |recur: &Fn(u32) -> u32, arg: u32| -> u32 { + if arg == 0 {1} else {arg * recur(arg-1)} + }; + let factorial: YCombinator<_,u32,u32> = YCombinator::new(factorial); + let r = factorial(10); + assert_eq!(3628800, r); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs new file mode 100644 index 00000000000..5bf634defda --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs @@ -0,0 +1,23 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that the type variable in the type(`Vec<_>`) of a closed over +// variable does not interfere with type inference. + +fn f(mut f: F) { + f(); +} + +fn main() { + let mut v: Vec<_> = vec![]; + f(|| v.push(0)); + assert_eq!(v, [0]); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs new file mode 100644 index 00000000000..e610e90fb97 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs @@ -0,0 +1,41 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(unboxed_closures, fn_traits)] + +struct S; + +impl FnMut<(i32,)> for S { + extern "rust-call" fn call_mut(&mut self, (x,): (i32,)) -> i32 { + x * x + } +} + +impl FnOnce<(i32,)> for S { + type Output = i32; + + extern "rust-call" fn call_once(mut self, args: (i32,)) -> i32 { self.call_mut(args) } +} + +fn call_iti32>(mut f: F, x: i32) -> i32 { + f(x) + 3 +} + +fn call_box(f: &mut FnMut(i32) -> i32, x: i32) -> i32 { + f(x) + 3 +} + +fn main() { + let x = call_it(S, 1); + let y = call_box(&mut S, 1); + assert_eq!(x, 4); + assert_eq!(y, 4); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs new file mode 100644 index 00000000000..6f15133eaee --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that unboxed closures in contexts with free type parameters +// monomorphize correctly (issue #16791) + +fn main(){ + fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> { + Box::new(move || t.clone()) + } + + let mut f = bar(42_u32); + assert_eq!(f(), 42); + + let mut f = bar("forty-two"); + assert_eq!(f(), "forty-two"); + + let x = 42_u32; + let mut f = bar(&x); + assert_eq!(f(), &x); + + #[derive(Clone, Copy, Debug, PartialEq)] + struct Foo(usize, &'static str); + + let x = Foo(42, "forty-two"); + let mut f = bar(x); + assert_eq!(f(), x); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs new file mode 100644 index 00000000000..ef3114ff394 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs @@ -0,0 +1,36 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused)] + +fn foo(f: F) + where F: FnOnce() +{ +} + +fn main() { + // Test that this closure is inferred to `FnOnce` + // because it moves from `y.as.0`: + let x = Some(vec![1, 2, 3]); + foo(|| { + match x { + Some(y) => { } + None => { } + } + }); + + // Test that this closure is inferred to `FnOnce` + // because it moves from `y.0`: + let y = (vec![1, 2, 3], 0); + foo(|| { + let x = y.0; + }); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs new file mode 100644 index 00000000000..3b1e4a1d554 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs @@ -0,0 +1,40 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![deny(unused_mut)] + +// Test that mutating a mutable upvar in a capture-by-value unboxed +// closure does not ice (issue #18238) and marks the upvar as used +// mutably so we do not get a spurious warning about it not needing to +// be declared mutable (issue #18336 and #18769) + +fn set(x: &mut usize) { *x = 42; } + +fn main() { + { + let mut x = 0_usize; + move || x += 1; + } + { + let mut x = 0_usize; + move || x += 1; + } + { + let mut x = 0_usize; + move || set(&mut x); + } + { + let mut x = 0_usize; + move || set(&mut x); + } +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs new file mode 100644 index 00000000000..b20377ec94f --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs @@ -0,0 +1,33 @@ +// Copyright 2015 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that in a by-ref once closure we move some variables even as +// we capture others by mutable reference. + +fn call(f: F) where F : FnOnce() { + f(); +} + +fn main() { + let mut x = vec![format!("Hello")]; + let y = vec![format!("World")]; + call(|| { + // Here: `x` must be captured with a mutable reference in + // order for us to append on it, and `y` must be captured by + // value. + for item in y { + x.push(item); + } + }); + assert_eq!(x.len(), 2); + assert_eq!(&*x[0], "Hello"); + assert_eq!(&*x[1], "World"); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs new file mode 100644 index 00000000000..f6997da7c07 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-prelude.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Tests that the re-exports of `FnOnce` et al from the prelude work. + +// pretty-expanded FIXME #23616 + +fn main() { + let task: Box isize> = Box::new(|x| x); + task(0); + + let mut task: Box isize> = Box::new(|x| x); + task(0); + + call(|x| x, 22); +} + +fn call isize>(f: F, x: isize) -> isize { + f(x) +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs new file mode 100644 index 00000000000..b7230ed5d82 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::ops::FnMut; + +pub fn main() { + let mut f = |x: isize, y: isize| -> isize { x + y }; + let z = f(1, 2); + assert_eq!(z, 3); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs new file mode 100644 index 00000000000..253a5354cdd --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Ensures that single-word environments work right in unboxed closures. +// These take a different path in codegen. + +fn a isize>(f: F) -> isize { + f(1, 2) +} + +fn b isize>(mut f: F) -> isize { + f(3, 4) +} + +fn c isize>(f: F) -> isize { + f(5, 6) +} + +fn main() { + let z = 10; + assert_eq!(a(move |x: isize, y| x + y + z), 13); + assert_eq!(b(move |x: isize, y| x + y + z), 17); + assert_eq!(c(move |x: isize, y| x + y + z), 21); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs new file mode 100644 index 00000000000..5526d372706 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let onetime = |x| x; + onetime(0); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs new file mode 100644 index 00000000000..16f123d62fc --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs @@ -0,0 +1,35 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test unboxed closure sugar used in object types. + +#![allow(dead_code)] + +struct Foo { + t: T, u: U +} + +trait Getter { + fn get(&self, arg: A) -> R; +} + +struct Identity; +impl Getter for Identity { + fn get(&self, arg: X) -> X { + arg + } +} + +fn main() { + let x: &Getter<(i32,), (i32,)> = &Identity; + let (y,) = x.get((22,)); + assert_eq!(y, 22); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs new file mode 100644 index 00000000000..dbf4a1c5f7e --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs @@ -0,0 +1,35 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// This code used to produce the following ICE: +// +// error: internal compiler error: get_unique_type_id_of_type() - +// unexpected type: closure, +// Closure(syntax::ast::DefId{krate: 0, node: 66}, +// ReScope(63)) +// +// This is a regression test for issue #17021. +// +// compile-flags: -g + +use std::ptr; + +pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T { + unsafe { *src = prod(ptr::read(src as *mut T as *const T)); } +} + +pub fn main() { + let mut a = 7; + let b = &mut a; + replace_map(b, |x: usize| x * 2); + assert_eq!(*b, 14); +} diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs new file mode 100644 index 00000000000..ae9124c9fc1 --- /dev/null +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs @@ -0,0 +1,17 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn main() { + let mut zero = || {}; + let () = zero(); +} diff --git a/src/test/run-pass/uniform-paths/basic-nested.rs b/src/test/run-pass/uniform-paths/basic-nested.rs new file mode 100644 index 00000000000..1aaa1e70726 --- /dev/null +++ b/src/test/run-pass/uniform-paths/basic-nested.rs @@ -0,0 +1,70 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// edition:2018 + +#![feature(decl_macro, uniform_paths)] + +// This test is similar to `basic.rs`, but nested in modules. + +mod foo { + // Test that ambiguity errors are not emitted between `self::test` and + // `::test`, assuming the latter (crate) is not in `extern_prelude`. + mod test { + pub struct Foo(pub ()); + } + pub use test::Foo; + + // Test that qualified paths can refer to both the external crate and local item. + mod std { + pub struct io(pub ()); + } + pub use ::std::io as std_io; + pub use self::std::io as local_io; +} + +// Test that we can refer to the external crate unqualified +// (when there isn't a local item with the same name). +use std::io; + +mod bar { + // Also test the unqualified external crate import in a nested module, + // to show that the above import doesn't resolve through a local `std` + // item, e.g. the automatically injected `extern crate std;`, which in + // the Rust 2018 should no longer be visible through `crate::std`. + pub use std::io; + + // Also test that items named `std` in other namespaces don't + // cause ambiguity errors for the import from `std` above. + pub fn std() {} + pub macro std() {} +} + + +fn main() { + foo::Foo(()); + foo::std_io::stdout(); + foo::local_io(()); + io::stdout(); + bar::io::stdout(); + bar::std(); + bar::std!(); + + { + // Test that having `io` in a module scope and a non-module + // scope is allowed, when both resolve to the same definition. + use std::io; + use io::stdout; + stdout(); + } +} diff --git a/src/test/run-pass/uniform-paths/basic.rs b/src/test/run-pass/uniform-paths/basic.rs new file mode 100644 index 00000000000..7d997fe493a --- /dev/null +++ b/src/test/run-pass/uniform-paths/basic.rs @@ -0,0 +1,44 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// edition:2018 + +#![feature(uniform_paths)] + +// Test that ambiguity errors are not emitted between `self::test` and +// `::test`, assuming the latter (crate) is not in `extern_prelude`. +mod test { + pub struct Foo(pub ()); +} +use test::Foo; + +// Test that qualified paths can refer to both the external crate and local item. +mod std { + pub struct io(pub ()); +} +use ::std::io as std_io; +use self::std::io as local_io; + +fn main() { + Foo(()); + std_io::stdout(); + local_io(()); + + { + // Test that having `std_io` in a module scope and a non-module + // scope is allowed, when both resolve to the same definition. + use ::std::io as std_io; + use std_io::stdout; + stdout(); + } +} diff --git a/src/test/run-pass/uniform-paths/macros-nested.rs b/src/test/run-pass/uniform-paths/macros-nested.rs new file mode 100644 index 00000000000..373734345fc --- /dev/null +++ b/src/test/run-pass/uniform-paths/macros-nested.rs @@ -0,0 +1,65 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// edition:2018 + +#![feature(uniform_paths)] + +// This test is similar to `macros.rs`, but nested in modules. + +mod foo { + // Test that ambiguity errors are not emitted between `self::test` and + // `::test`, assuming the latter (crate) is not in `extern_prelude`. + macro_rules! m1 { + () => { + mod test { + pub struct Foo(pub ()); + } + } + } + pub use test::Foo; + m1!(); + + // Test that qualified paths can refer to both the external crate and local item. + macro_rules! m2 { + () => { + mod std { + pub struct io(pub ()); + } + } + } + pub use ::std::io as std_io; + pub use self::std::io as local_io; + m2!(); +} + +// Test that we can refer to the external crate unqualified +// (when there isn't a local item with the same name). +use std::io; + +mod bar { + // Also test the unqualified external crate import in a nested module, + // to show that the above import doesn't resolve through a local `std` + // item, e.g. the automatically injected `extern crate std;`, which in + // the Rust 2018 should no longer be visible through `crate::std`. + pub use std::io; +} + + +fn main() { + foo::Foo(()); + foo::std_io::stdout(); + foo::local_io(()); + io::stdout(); + bar::io::stdout(); +} diff --git a/src/test/run-pass/uniform-paths/macros.rs b/src/test/run-pass/uniform-paths/macros.rs new file mode 100644 index 00000000000..20984eb13dd --- /dev/null +++ b/src/test/run-pass/uniform-paths/macros.rs @@ -0,0 +1,48 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// edition:2018 + +#![feature(uniform_paths)] + +// This test is similar to `basic.rs`, but with macros defining local items. + +// Test that ambiguity errors are not emitted between `self::test` and +// `::test`, assuming the latter (crate) is not in `extern_prelude`. +macro_rules! m1 { + () => { + mod test { + pub struct Foo(pub ()); + } + } +} +use test::Foo; +m1!(); + +// Test that qualified paths can refer to both the external crate and local item. +macro_rules! m2 { + () => { + mod std { + pub struct io(pub ()); + } + } +} +use ::std::io as std_io; +use self::std::io as local_io; +m2!(); + +fn main() { + Foo(()); + std_io::stdout(); + local_io(()); +} diff --git a/src/test/run-pass/uniform-paths/same-crate.rs b/src/test/run-pass/uniform-paths/same-crate.rs new file mode 100644 index 00000000000..bb15d6d53ac --- /dev/null +++ b/src/test/run-pass/uniform-paths/same-crate.rs @@ -0,0 +1,111 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// edition:2018 + +#![feature(uniform_paths)] + +pub const A: usize = 0; + +pub mod foo { + pub const B: usize = 1; + + pub mod bar { + pub const C: usize = 2; + + pub enum E { + V1(usize), + V2(String), + } + + pub fn test() -> String { + format!("{} {} {}", crate::A, crate::foo::B, C) + } + + pub fn test_use() -> String { + use crate::A; + use crate::foo::B; + + format!("{} {} {}", A, B, C) + } + + pub fn test_enum() -> String { + use E::*; + match E::V1(10) { + V1(i) => { format!("V1: {}", i) } + V2(s) => { format!("V2: {}", s) } + } + } + } + + pub fn test() -> String { + format!("{} {} {}", crate::A, B, bar::C) + } + + pub fn test_use() -> String { + use crate::A; + use bar::C; + + format!("{} {} {}", A, B, C) + } + + pub fn test_enum() -> String { + use bar::E::*; + match bar::E::V1(10) { + V1(i) => { format!("V1: {}", i) } + V2(s) => { format!("V2: {}", s) } + } + } +} + +pub fn test() -> String { + format!("{} {} {}", A, foo::B, foo::bar::C) +} + +pub fn test_use() -> String { + use foo::B; + use foo::bar::C; + + format!("{} {} {}", A, B, C) +} + +pub fn test_enum() -> String { + use foo::bar::E::*; + match foo::bar::E::V1(10) { + V1(i) => { format!("V1: {}", i) } + V2(s) => { format!("V2: {}", s) } + } +} + +fn main() { + let output = [ + test(), + foo::test(), + foo::bar::test(), + test_use(), + foo::test_use(), + foo::bar::test_use(), + test_enum(), + foo::test_enum(), + foo::bar::test_enum(), + ].join("\n"); + assert_eq!(output, "\ +0 1 2 +0 1 2 +0 1 2 +0 1 2 +0 1 2 +0 1 2 +V1: 10 +V1: 10 +V1: 10"); +} diff --git a/src/test/run-pass/union/auxiliary/union.rs b/src/test/run-pass/union/auxiliary/union.rs new file mode 100644 index 00000000000..2c4945622ab --- /dev/null +++ b/src/test/run-pass/union/auxiliary/union.rs @@ -0,0 +1,14 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub union U { + pub a: u8, + pub b: u16, +} diff --git a/src/test/run-pass/union/union-align.rs b/src/test/run-pass/union/union-align.rs new file mode 100644 index 00000000000..02f447c626f --- /dev/null +++ b/src/test/run-pass/union/union-align.rs @@ -0,0 +1,72 @@ +// Copyright 2017 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(untagged_unions)] + +use std::mem::{size_of, size_of_val, align_of, align_of_val}; + +#[repr(align(16))] +pub union U16 { + a: u8, + b: u32 +} + +fn main() { + assert_eq!(align_of::(), 16); + assert_eq!(size_of::(), 16); + let u = U16 { a: 10 }; + unsafe { + assert_eq!(align_of_val(&u.a), 1); + assert_eq!(size_of_val(&u.a), 1); + assert_eq!(u.a, 10); + } + + let u = U16 { b: 11 }; + unsafe { + assert_eq!(align_of_val(&u.b), 4); + assert_eq!(size_of_val(&u.b), 4); + assert_eq!(u.b, 11); + } + + hybrid::check_hybrid(); +} + +mod hybrid { + use std::mem::{size_of, align_of}; + + #[repr(align(16))] + struct S1 { + a: u16, + b: u8, + } + + #[repr(align(32))] + union U { + s: S1, + c: u16, + } + + #[repr(align(64))] + struct S2 { + d: u8, + u: U, + } + + pub fn check_hybrid() { + assert_eq!(align_of::(), 16); + assert_eq!(size_of::(), 16); + assert_eq!(align_of::(), 32); + assert_eq!(size_of::(), 32); + assert_eq!(align_of::(), 64); + assert_eq!(size_of::(), 64); + } +} diff --git a/src/test/run-pass/union/union-backcomp.rs b/src/test/run-pass/union/union-backcomp.rs new file mode 100644 index 00000000000..23d51d39c2e --- /dev/null +++ b/src/test/run-pass/union/union-backcomp.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! union { + () => (struct S;) +} + +union!(); + +fn union() {} + +fn main() { + union(); + + let union = 10; + + union; + + union as u8; + + union U { + a: u8, + } +} diff --git a/src/test/run-pass/union/union-basic.rs b/src/test/run-pass/union/union-basic.rs new file mode 100644 index 00000000000..bfbac1a6bf2 --- /dev/null +++ b/src/test/run-pass/union/union-basic.rs @@ -0,0 +1,68 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +// aux-build:union.rs + +extern crate union; +use std::mem::{size_of, align_of, zeroed}; + +union U { + a: u8, + b: u16 +} + +fn local() { + assert_eq!(size_of::(), 2); + assert_eq!(align_of::(), 2); + + let u = U { a: 10 }; + unsafe { + assert_eq!(u.a, 10); + let U { a } = u; + assert_eq!(a, 10); + } + + let mut w = U { b: 0 }; + unsafe { + assert_eq!(w.a, 0); + assert_eq!(w.b, 0); + w.a = 1; + assert_eq!(w.a, 1); + assert_eq!(w.b.to_le(), 1); + } +} + +fn xcrate() { + assert_eq!(size_of::(), 2); + assert_eq!(align_of::(), 2); + + let u = union::U { a: 10 }; + unsafe { + assert_eq!(u.a, 10); + let union::U { a } = u; + assert_eq!(a, 10); + } + + let mut w = union::U { b: 0 }; + unsafe { + assert_eq!(w.a, 0); + assert_eq!(w.b, 0); + w.a = 1; + assert_eq!(w.a, 1); + assert_eq!(w.b.to_le(), 1); + } +} + +fn main() { + local(); + xcrate(); +} diff --git a/src/test/run-pass/union/union-c-interop.rs b/src/test/run-pass/union/union-c-interop.rs new file mode 100644 index 00000000000..976ab845cd1 --- /dev/null +++ b/src/test/run-pass/union/union-c-interop.rs @@ -0,0 +1,47 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +// ignore-wasm32-bare no libc to test ffi with + +#[derive(Clone, Copy)] +#[repr(C)] +struct LARGE_INTEGER_U { + LowPart: u32, + HighPart: u32, +} + +#[derive(Clone, Copy)] +#[repr(C)] +union LARGE_INTEGER { + __unnamed__: LARGE_INTEGER_U, + u: LARGE_INTEGER_U, + QuadPart: u64, +} + +#[link(name = "rust_test_helpers", kind = "static")] +extern "C" { + fn increment_all_parts(_: LARGE_INTEGER) -> LARGE_INTEGER; +} + +fn main() { + unsafe { + let mut li = LARGE_INTEGER { QuadPart: 0 }; + let li_c = increment_all_parts(li); + li.__unnamed__.LowPart += 1; + li.__unnamed__.HighPart += 1; + li.u.LowPart += 1; + li.u.HighPart += 1; + li.QuadPart += 1; + assert_eq!(li.QuadPart, li_c.QuadPart); + } +} diff --git a/src/test/run-pass/union/union-const-codegen.rs b/src/test/run-pass/union/union-const-codegen.rs new file mode 100644 index 00000000000..aa583e6cead --- /dev/null +++ b/src/test/run-pass/union/union-const-codegen.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +union U { + a: u64, + b: u64, +} + +const C: U = U { b: 10 }; + +fn main() { + unsafe { + let a = C.a; + let b = C.b; + assert_eq!(a, 10); + assert_eq!(b, 10); + } +} diff --git a/src/test/run-pass/union/union-const-eval-field.rs b/src/test/run-pass/union/union-const-eval-field.rs new file mode 100644 index 00000000000..c8eda7545d9 --- /dev/null +++ b/src/test/run-pass/union/union-const-eval-field.rs @@ -0,0 +1,55 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(const_fn)] + +type Field1 = (i32, u32); +type Field2 = f32; +type Field3 = i64; + +union DummyUnion { + field1: Field1, + field2: Field2, + field3: Field3, +} + +const FLOAT1_AS_I32: i32 = 1065353216; +const UNION: DummyUnion = DummyUnion { field1: (FLOAT1_AS_I32, 0) }; + +const fn read_field1() -> Field1 { + const FIELD1: Field1 = unsafe { UNION.field1 }; + FIELD1 +} + +const fn read_field2() -> Field2 { + const FIELD2: Field2 = unsafe { UNION.field2 }; + FIELD2 +} + +const fn read_field3() -> Field3 { + const FIELD3: Field3 = unsafe { UNION.field3 }; + FIELD3 +} + +fn main() { + let foo = FLOAT1_AS_I32; + assert_eq!(read_field1().0, foo); + assert_eq!(read_field1().0, FLOAT1_AS_I32); + + let foo = 1.0; + assert_eq!(read_field2(), foo); + assert_eq!(read_field2(), 1.0); + + assert_eq!(read_field3(), unsafe { UNION.field3 }); + let foo = unsafe { UNION.field3 }; + assert_eq!(read_field3(), foo); +} diff --git a/src/test/run-pass/union/union-derive.rs b/src/test/run-pass/union/union-derive.rs new file mode 100644 index 00000000000..248595ee7ac --- /dev/null +++ b/src/test/run-pass/union/union-derive.rs @@ -0,0 +1,50 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unions_with_drop_fields)] + +// Some traits can be derived for unions. + +#![feature(untagged_unions)] + +#[derive( + Copy, + Clone, + Eq, +)] +union U { + a: u8, + b: u16, +} + +impl PartialEq for U { fn eq(&self, rhs: &Self) -> bool { true } } + +#[derive( + Clone, + Copy, + Eq +)] +union W { + a: T, +} + +impl PartialEq for W { fn eq(&self, rhs: &Self) -> bool { true } } + +fn main() { + let u = U { b: 0 }; + let u1 = u; + let u2 = u.clone(); + assert!(u1 == u2); + + let w = W { a: 0 }; + let w1 = w.clone(); + assert!(w == w1); +} diff --git a/src/test/run-pass/union/union-drop-assign.rs b/src/test/run-pass/union/union-drop-assign.rs new file mode 100644 index 00000000000..2884cf16b96 --- /dev/null +++ b/src/test/run-pass/union/union-drop-assign.rs @@ -0,0 +1,47 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unions_with_drop_fields)] + +// Drop works for union itself. + +#![feature(untagged_unions)] + +struct S; + +union U { + a: S +} + +impl Drop for S { + fn drop(&mut self) { + unsafe { CHECK += 10; } + } +} + +impl Drop for U { + fn drop(&mut self) { + unsafe { CHECK += 1; } + } +} + +static mut CHECK: u8 = 0; + +fn main() { + unsafe { + let mut u = U { a: S }; + assert_eq!(CHECK, 0); + u = U { a: S }; + assert_eq!(CHECK, 1); // union itself is assigned, union is dropped, field is not dropped + u.a = S; + assert_eq!(CHECK, 11); // union field is assigned, field is dropped + } +} diff --git a/src/test/run-pass/union/union-drop.rs b/src/test/run-pass/union/union-drop.rs new file mode 100644 index 00000000000..ba5c20b6dc3 --- /dev/null +++ b/src/test/run-pass/union/union-drop.rs @@ -0,0 +1,68 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unions_with_drop_fields)] + +// Drop works for union itself. + +#![feature(untagged_unions)] + +struct S; + +union U { + a: u8 +} + +union W { + a: S, +} + +union Y { + a: S, +} + +impl Drop for S { + fn drop(&mut self) { + unsafe { CHECK += 10; } + } +} + +impl Drop for U { + fn drop(&mut self) { + unsafe { CHECK += 1; } + } +} + +impl Drop for W { + fn drop(&mut self) { + unsafe { CHECK += 1; } + } +} + +static mut CHECK: u8 = 0; + +fn main() { + unsafe { + assert_eq!(CHECK, 0); + { + let u = U { a: 1 }; + } + assert_eq!(CHECK, 1); // 1, dtor of U is called + { + let w = W { a: S }; + } + assert_eq!(CHECK, 2); // 2, not 11, dtor of S is not called + { + let y = Y { a: S }; + } + assert_eq!(CHECK, 2); // 2, not 12, dtor of S is not called + } +} diff --git a/src/test/run-pass/union/union-generic.rs b/src/test/run-pass/union/union-generic.rs new file mode 100644 index 00000000000..dcea56c288f --- /dev/null +++ b/src/test/run-pass/union/union-generic.rs @@ -0,0 +1,46 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unions_with_drop_fields)] + +#![feature(untagged_unions)] + +union MaybeItem { + elem: T::Item, + none: (), +} + +union U { + a: A, + b: B, +} + +unsafe fn union_transmute(a: A) -> B { + U { a: a }.b +} + +fn main() { + unsafe { + let u = U::> { a: String::from("abcd") }; + + assert_eq!(u.b.len(), 4); + assert_eq!(u.b[0], b'a'); + + let b = union_transmute::<(u8, u8), u16>((1, 1)); + assert_eq!(b, (1 << 8) + 1); + + let v: Vec = vec![1, 2, 3]; + let mut i = v.iter(); + i.next(); + let mi = MaybeItem::> { elem: i.next().unwrap() }; + assert_eq!(*mi.elem, 2); + } +} diff --git a/src/test/run-pass/union/union-inherent-method.rs b/src/test/run-pass/union/union-inherent-method.rs new file mode 100644 index 00000000000..d9300b5b9f5 --- /dev/null +++ b/src/test/run-pass/union/union-inherent-method.rs @@ -0,0 +1,24 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +union U { + a: u8, +} + +impl U { + fn method(&self) -> u8 { unsafe { self.a } } +} + +fn main() { + let u = U { a: 10 }; + assert_eq!(u.method(), 10); +} diff --git a/src/test/run-pass/union/union-macro.rs b/src/test/run-pass/union/union-macro.rs new file mode 100644 index 00000000000..f4ffa2edbde --- /dev/null +++ b/src/test/run-pass/union/union-macro.rs @@ -0,0 +1,33 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +macro_rules! duplicate { + ($i: item) => { + mod m1 { + $i + } + mod m2 { + $i + } + } +} + +duplicate! { + pub union U { + pub a: u8 + } +} + +fn main() { + let u1 = m1::U { a: 0 }; + let u2 = m2::U { a: 0 }; +} diff --git a/src/test/run-pass/union/union-nodrop.rs b/src/test/run-pass/union/union-nodrop.rs new file mode 100644 index 00000000000..4f2456e43ba --- /dev/null +++ b/src/test/run-pass/union/union-nodrop.rs @@ -0,0 +1,71 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(core_intrinsics)] +#![feature(untagged_unions)] + +#![allow(unions_with_drop_fields)] +#![allow(dead_code)] + +use std::intrinsics::needs_drop; + +struct NeedDrop; + +impl Drop for NeedDrop { + fn drop(&mut self) {} +} + +// Constant expressios allow `NoDrop` to go out of scope, +// unlike a value of the interior type implementing `Drop`. +static X: () = (NoDrop { inner: NeedDrop }, ()).1; + +// A union that scrubs the drop glue from its inner type +union NoDrop {inner: T} + +// Copy currently can't be implemented on drop-containing unions, +// this may change later +// https://github.com/rust-lang/rust/pull/38934#issuecomment-271219289 + +// // We should be able to implement Copy for NoDrop +// impl Copy for NoDrop {} +// impl Clone for NoDrop {fn clone(&self) -> Self { *self }} + +// // We should be able to implement Copy for things using NoDrop +// #[derive(Copy, Clone)] +struct Foo { + x: NoDrop> +} + +struct Baz { + x: NoDrop>, + y: Box, +} + +union ActuallyDrop {inner: T} + +impl Drop for ActuallyDrop { + fn drop(&mut self) {} +} + +fn main() { + unsafe { + // NoDrop should not make needs_drop true + assert!(!needs_drop::()); + assert!(!needs_drop::>()); + assert!(!needs_drop::>>()); + // presence of other drop types should still work + assert!(needs_drop::()); + // drop impl on union itself should work + assert!(needs_drop::>()); + assert!(needs_drop::>>()); + } +} diff --git a/src/test/run-pass/union/union-overwrite.rs b/src/test/run-pass/union/union-overwrite.rs new file mode 100644 index 00000000000..b4d0850a504 --- /dev/null +++ b/src/test/run-pass/union/union-overwrite.rs @@ -0,0 +1,83 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unions_with_drop_fields)] + +#![feature(untagged_unions)] + +#[repr(C)] +struct Pair(T, U); +#[repr(C)] +struct Triple(T, T, T); + +#[repr(C)] +union U { + a: Pair, + b: B, +} + +#[repr(C)] +union W { + a: A, + b: B, +} + +#[cfg(target_endian = "little")] +unsafe fn check() { + let mut u = U:: { b: 0xDE_DE }; + u.a.0 = 0xBE; + assert_eq!(u.b, 0xDE_BE); + + let mut u = U:: { b: 0xDEAD_DEAD }; + u.a.0 = 0xBEEF; + assert_eq!(u.b, 0xDEAD_BEEF); + + let mut u = U:: { b: 0xDEADBEEF_DEADBEEF }; + u.a.0 = 0xBAADF00D; + assert_eq!(u.b, 0xDEADBEEF_BAADF00D); + + let mut w = W::, u8>, u32> { b: 0xDEAD_DEAD }; + w.a.0 = Triple(0, 0, 0); + assert_eq!(w.b, 0xDE00_0000); + + let mut w = W::>, u32> { b: 0xDEAD_DEAD }; + w.a.1 = Triple(0, 0, 0); + assert_eq!(w.b, 0x0000_00AD); +} + +#[cfg(target_endian = "big")] +unsafe fn check() { + let mut u = U:: { b: 0xDE_DE }; + u.a.0 = 0xBE; + assert_eq!(u.b, 0xBE_DE); + + let mut u = U:: { b: 0xDEAD_DEAD }; + u.a.0 = 0xBEEF; + assert_eq!(u.b, 0xBEEF_DEAD); + + let mut u = U:: { b: 0xDEADBEEF_DEADBEEF }; + u.a.0 = 0xBAADF00D; + assert_eq!(u.b, 0xBAADF00D_DEADBEEF); + + let mut w = W::, u8>, u32> { b: 0xDEAD_DEAD }; + w.a.0 = Triple(0, 0, 0); + assert_eq!(w.b, 0x0000_00AD); + + let mut w = W::>, u32> { b: 0xDEAD_DEAD }; + w.a.1 = Triple(0, 0, 0); + assert_eq!(w.b, 0xDE00_0000); +} + +fn main() { + unsafe { + check(); + } +} diff --git a/src/test/run-pass/union/union-packed.rs b/src/test/run-pass/union/union-packed.rs new file mode 100644 index 00000000000..c167a40507a --- /dev/null +++ b/src/test/run-pass/union/union-packed.rs @@ -0,0 +1,181 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_snake_case)] + +#![feature(untagged_unions)] +#![feature(repr_packed)] + +use std::mem::{size_of, size_of_val, align_of, align_of_val}; + +struct S { + a: u16, + b: [u8; 3], +} + +#[repr(packed)] +struct Sp1 { + a: u16, + b: [u8; 3], +} + +#[repr(packed(2))] +struct Sp2 { + a: u16, + b: [u8; 3], +} + +union U { + a: u16, + b: [u8; 3], +} + +#[repr(packed)] +union Up1 { + a: u16, + b: [u8; 3], +} + +#[repr(packed(2))] +union Up2 { + a: u16, + b: [u8; 3], +} + +#[repr(C, packed(4))] +union Up4c { + a: u16, + b: [u8; 3], +} + +const CS: S = S { a: 0, b: [0, 0, 0] }; +const CSP1: Sp1 = Sp1 { a: 0, b: [0, 0, 0] }; +const CSP2: Sp2 = Sp2 { a: 0, b: [0, 0, 0] }; +const CU: U = U { b: [0, 0, 0] }; +const CUP1: Up1 = Up1 { b: [0, 0, 0] }; +const CUP2: Up2 = Up2 { b: [0, 0, 0] }; +const CUP4C: Up4c = Up4c { b: [0, 0, 0] }; + +fn main() { + let s = S { a: 0, b: [0, 0, 0] }; + assert_eq!(size_of::(), 6); + assert_eq!(size_of_val(&s), 6); + assert_eq!(size_of_val(&CS), 6); + assert_eq!(align_of::(), 2); + assert_eq!(align_of_val(&s), 2); + assert_eq!(align_of_val(&CS), 2); + + let sp1 = Sp1 { a: 0, b: [0, 0, 0] }; + assert_eq!(size_of::(), 5); + assert_eq!(size_of_val(&sp1), 5); + assert_eq!(size_of_val(&CSP1), 5); + assert_eq!(align_of::(), 1); + assert_eq!(align_of_val(&sp1), 1); + assert_eq!(align_of_val(&CSP1), 1); + + let sp2 = Sp2 { a: 0, b: [0, 0, 0] }; + assert_eq!(size_of::(), 6); + assert_eq!(size_of_val(&sp2), 6); + assert_eq!(size_of_val(&CSP2), 6); + assert_eq!(align_of::(), 2); + assert_eq!(align_of_val(&sp2), 2); + assert_eq!(align_of_val(&CSP2), 2); + + let u = U { b: [0, 0, 0] }; + assert_eq!(size_of::(), 4); + assert_eq!(size_of_val(&u), 4); + assert_eq!(size_of_val(&CU), 4); + assert_eq!(align_of::(), 2); + assert_eq!(align_of_val(&u), 2); + assert_eq!(align_of_val(&CU), 2); + + let Up1 = Up1 { b: [0, 0, 0] }; + assert_eq!(size_of::(), 3); + assert_eq!(size_of_val(&Up1), 3); + assert_eq!(size_of_val(&CUP1), 3); + assert_eq!(align_of::(), 1); + assert_eq!(align_of_val(&Up1), 1); + assert_eq!(align_of_val(&CUP1), 1); + + let up2 = Up2 { b: [0, 0, 0] }; + assert_eq!(size_of::(), 4); + assert_eq!(size_of_val(&up2), 4); + assert_eq!(size_of_val(&CUP2), 4); + assert_eq!(align_of::(), 2); + assert_eq!(align_of_val(&up2), 2); + assert_eq!(align_of_val(&CUP2), 2); + + let up4c = Up4c { b: [0, 0, 0] }; + assert_eq!(size_of::(), 4); + assert_eq!(size_of_val(&up4c), 4); + assert_eq!(size_of_val(&CUP4C), 4); + assert_eq!(align_of::(), 2); + assert_eq!(align_of_val(&up4c), 2); + assert_eq!(align_of_val(&CUP4C), 2); + + hybrid::check_hybrid(); +} + +mod hybrid { + use std::mem::{size_of, align_of}; + + #[repr(packed)] + struct S1 { + a: u16, + b: u8, + } + + #[repr(packed)] + union U { + s: S1, + c: u16, + } + + #[repr(packed)] + struct S2 { + d: u8, + u: U, + } + + #[repr(C, packed(2))] + struct S1C { + a: u16, + b: u8, + } + + #[repr(C, packed(2))] + union UC { + s: S1, + c: u16, + } + + #[repr(C, packed(2))] + struct S2C { + d: u8, + u: UC, + } + + pub fn check_hybrid() { + assert_eq!(align_of::(), 1); + assert_eq!(size_of::(), 3); + assert_eq!(align_of::(), 1); + assert_eq!(size_of::(), 3); + assert_eq!(align_of::(), 1); + assert_eq!(size_of::(), 4); + + assert_eq!(align_of::(), 2); + assert_eq!(size_of::(), 4); + assert_eq!(align_of::(), 2); + assert_eq!(size_of::(), 4); + assert_eq!(align_of::(), 2); + assert_eq!(size_of::(), 6); + } +} diff --git a/src/test/run-pass/union/union-pat-refutability.rs b/src/test/run-pass/union/union-pat-refutability.rs new file mode 100644 index 00000000000..2c481160fda --- /dev/null +++ b/src/test/run-pass/union/union-pat-refutability.rs @@ -0,0 +1,63 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(illegal_floating_point_literal_pattern)] + +#[repr(u32)] +enum Tag { I, F } + +#[repr(C)] +union U { + i: i32, + f: f32, +} + +#[repr(C)] +struct Value { + tag: Tag, + u: U, +} + +fn is_zero(v: Value) -> bool { + unsafe { + match v { + Value { tag: Tag::I, u: U { i: 0 } } => true, + Value { tag: Tag::F, u: U { f: 0.0 } } => true, + _ => false, + } + } +} + +union W { + a: u8, + b: u8, +} + +fn refut(w: W) { + unsafe { + match w { + W { a: 10 } => { + panic!(); + } + W { b } => { + assert_eq!(b, 11); + } + } + } +} + +fn main() { + let v = Value { tag: Tag::I, u: U { i: 1 } }; + assert_eq!(is_zero(v), false); + + let w = W { a: 11 }; + refut(w); +} diff --git a/src/test/run-pass/union/union-trait-impl.rs b/src/test/run-pass/union/union-trait-impl.rs new file mode 100644 index 00000000000..6e732f24b25 --- /dev/null +++ b/src/test/run-pass/union/union-trait-impl.rs @@ -0,0 +1,27 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +use std::fmt; + +union U { + a: u8 +} + +impl fmt::Display for U { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + unsafe { write!(f, "Oh hai {}", self.a) } + } +} + +fn main() { + assert_eq!(U { a: 2 }.to_string(), "Oh hai 2"); +} diff --git a/src/test/run-pass/union/union-transmute.rs b/src/test/run-pass/union/union-transmute.rs new file mode 100644 index 00000000000..1fc20bef9e0 --- /dev/null +++ b/src/test/run-pass/union/union-transmute.rs @@ -0,0 +1,38 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +extern crate core; +use core::f32; + +union U { + a: (u8, u8), + b: u16, +} + +union W { + a: u32, + b: f32, +} + +fn main() { + unsafe { + let mut u = U { a: (1, 1) }; + assert_eq!(u.b, (1 << 8) + 1); + u.b = (2 << 8) + 2; + assert_eq!(u.a, (2, 2)); + + let mut w = W { a: 0b0_11111111_00000000000000000000000 }; + assert_eq!(w.b, f32::INFINITY); + w.b = f32::NEG_INFINITY; + assert_eq!(w.a, 0b1_11111111_00000000000000000000000); + } +} diff --git a/src/test/run-pass/union/union-with-drop-fields-lint.rs b/src/test/run-pass/union/union-with-drop-fields-lint.rs new file mode 100644 index 00000000000..5f1ac7b51ee --- /dev/null +++ b/src/test/run-pass/union/union-with-drop-fields-lint.rs @@ -0,0 +1,42 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(untagged_unions)] +#![allow(dead_code)] +#![allow(unions_with_drop_fields)] + +union U { + a: u8, // OK +} + +union W { + a: String, // OK + b: String, // OK +} + +struct S(String); + +// `S` doesn't implement `Drop` trait, but still has non-trivial destructor +union Y { + a: S, // OK +} + +// We don't know if `T` is trivially-destructable or not until trans +union J { + a: T, // OK +} + +union H { + a: T, // OK +} + +fn main() {} diff --git a/src/test/run-pass/unique/unique-assign-copy.rs b/src/test/run-pass/unique/unique-assign-copy.rs new file mode 100644 index 00000000000..e25de1025fa --- /dev/null +++ b/src/test/run-pass/unique/unique-assign-copy.rs @@ -0,0 +1,23 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut i: Box<_> = box 1; + // Should be a copy + let mut j; + j = i.clone(); + *i = 2; + *j = 3; + assert_eq!(*i, 2); + assert_eq!(*j, 3); +} diff --git a/src/test/run-pass/unique/unique-assign-drop.rs b/src/test/run-pass/unique/unique-assign-drop.rs new file mode 100644 index 00000000000..dd931480196 --- /dev/null +++ b/src/test/run-pass/unique/unique-assign-drop.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 1; + let mut j: Box<_> = box 2; + // Should drop the previous value of j + j = i; + assert_eq!(*j, 1); +} diff --git a/src/test/run-pass/unique/unique-assign-generic.rs b/src/test/run-pass/unique/unique-assign-generic.rs new file mode 100644 index 00000000000..ebbe6927261 --- /dev/null +++ b/src/test/run-pass/unique/unique-assign-generic.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f(t: T) -> T { + let t1 = t; + t1 +} + +pub fn main() { + let t = f::>(box 100); + assert_eq!(t, box 100); +} diff --git a/src/test/run-pass/unique/unique-assign.rs b/src/test/run-pass/unique/unique-assign.rs new file mode 100644 index 00000000000..206503f87ce --- /dev/null +++ b/src/test/run-pass/unique/unique-assign.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut i: Box<_>; + i = box 1; + assert_eq!(*i, 1); +} diff --git a/src/test/run-pass/unique/unique-autoderef-field.rs b/src/test/run-pass/unique/unique-autoderef-field.rs new file mode 100644 index 00000000000..449bf418651 --- /dev/null +++ b/src/test/run-pass/unique/unique-autoderef-field.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct J { j: isize } + +pub fn main() { + let i: Box<_> = box J { + j: 100 + }; + assert_eq!(i.j, 100); +} diff --git a/src/test/run-pass/unique/unique-autoderef-index.rs b/src/test/run-pass/unique/unique-autoderef-index.rs new file mode 100644 index 00000000000..de7c2f7826e --- /dev/null +++ b/src/test/run-pass/unique/unique-autoderef-index.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box vec![100]; + assert_eq!((*i)[0], 100); +} diff --git a/src/test/run-pass/unique/unique-cmp.rs b/src/test/run-pass/unique/unique-cmp.rs new file mode 100644 index 00000000000..b11b1a8cdbc --- /dev/null +++ b/src/test/run-pass/unique/unique-cmp.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 100; + assert_eq!(i, box 100); + assert!(i < box 101); + assert!(i <= box 100); + assert!(i > box 99); + assert!(i >= box 99); +} diff --git a/src/test/run-pass/unique/unique-containing-tag.rs b/src/test/run-pass/unique/unique-containing-tag.rs new file mode 100644 index 00000000000..d849c1d3298 --- /dev/null +++ b/src/test/run-pass/unique/unique-containing-tag.rs @@ -0,0 +1,36 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { + enum t { t1(isize), t2(isize), } + + let _x: Box<_> = box t::t1(10); + + /*alt *x { + t1(a) { + assert_eq!(a, 10); + } + _ { panic!(); } + }*/ + + /*alt x { + box t1(a) { + assert_eq!(a, 10); + } + _ { panic!(); } + }*/ +} diff --git a/src/test/run-pass/unique/unique-create.rs b/src/test/run-pass/unique/unique-create.rs new file mode 100644 index 00000000000..5c7488b1120 --- /dev/null +++ b/src/test/run-pass/unique/unique-create.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { + let _: Box<_> = box 100; +} + +fn vec() { + vec![0]; +} diff --git a/src/test/run-pass/unique/unique-decl-init-copy.rs b/src/test/run-pass/unique/unique-decl-init-copy.rs new file mode 100644 index 00000000000..1ec57a8b8b5 --- /dev/null +++ b/src/test/run-pass/unique/unique-decl-init-copy.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut i: Box<_> = box 1; + // Should be a copy + let mut j = i.clone(); + *i = 2; + *j = 3; + assert_eq!(*i, 2); + assert_eq!(*j, 3); +} diff --git a/src/test/run-pass/unique/unique-decl-init.rs b/src/test/run-pass/unique/unique-decl-init.rs new file mode 100644 index 00000000000..85190b5142f --- /dev/null +++ b/src/test/run-pass/unique/unique-decl-init.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 1; + let j = i; + assert_eq!(*j, 1); +} diff --git a/src/test/run-pass/unique/unique-decl-move.rs b/src/test/run-pass/unique/unique-decl-move.rs new file mode 100644 index 00000000000..8e08ae43bae --- /dev/null +++ b/src/test/run-pass/unique/unique-decl-move.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 100; + let j = i; + assert_eq!(*j, 100); +} diff --git a/src/test/run-pass/unique/unique-decl.rs b/src/test/run-pass/unique/unique-decl.rs new file mode 100644 index 00000000000..37b8b94b15a --- /dev/null +++ b/src/test/run-pass/unique/unique-decl.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + + +pub fn main() { + let _: Box; +} + +fn f(_i: Box) -> Box { + panic!(); +} diff --git a/src/test/run-pass/unique/unique-deref.rs b/src/test/run-pass/unique/unique-deref.rs new file mode 100644 index 00000000000..db2e5509c1a --- /dev/null +++ b/src/test/run-pass/unique/unique-deref.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 100; + assert_eq!(*i, 100); +} diff --git a/src/test/run-pass/unique/unique-destructure.rs b/src/test/run-pass/unique/unique-destructure.rs new file mode 100644 index 00000000000..782f151459e --- /dev/null +++ b/src/test/run-pass/unique/unique-destructure.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_patterns)] +#![feature(box_syntax)] + +struct Foo { a: isize, b: isize } + +pub fn main() { + let box Foo{a, b} = box Foo{a: 100, b: 200}; + assert_eq!(a + b, 300); +} diff --git a/src/test/run-pass/unique/unique-drop-complex.rs b/src/test/run-pass/unique/unique-drop-complex.rs new file mode 100644 index 00000000000..747b1662652 --- /dev/null +++ b/src/test/run-pass/unique/unique-drop-complex.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { + let _x: Box<_> = box vec![0,0,0,0,0]; +} diff --git a/src/test/run-pass/unique/unique-ffi-symbols.rs b/src/test/run-pass/unique/unique-ffi-symbols.rs new file mode 100644 index 00000000000..761b2ffe30b --- /dev/null +++ b/src/test/run-pass/unique/unique-ffi-symbols.rs @@ -0,0 +1,26 @@ +// Copyright 2016 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// We used to have a __rust_abi shim that resulted in duplicated symbols +// whenever the item path wasn't enough to disambiguate between them. +fn main() { + let a = { + extern fn good() -> i32 { return 0; } + good as extern fn() -> i32 + }; + let b = { + extern fn good() -> i32 { return 5; } + good as extern fn() -> i32 + }; + + assert!(a != b); + assert_eq!((a(), b()), (0, 5)); +} diff --git a/src/test/run-pass/unique/unique-fn-arg-move.rs b/src/test/run-pass/unique/unique-fn-arg-move.rs new file mode 100644 index 00000000000..703c2bee84d --- /dev/null +++ b/src/test/run-pass/unique/unique-fn-arg-move.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f(i: Box) { + assert_eq!(*i, 100); +} + +pub fn main() { + let i = box 100; + f(i); +} diff --git a/src/test/run-pass/unique/unique-fn-arg-mut.rs b/src/test/run-pass/unique/unique-fn-arg-mut.rs new file mode 100644 index 00000000000..b495fb30a9c --- /dev/null +++ b/src/test/run-pass/unique/unique-fn-arg-mut.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f(i: &mut Box) { + *i = box 200; +} + +pub fn main() { + let mut i = box 100; + f(&mut i); + assert_eq!(*i, 200); +} diff --git a/src/test/run-pass/unique/unique-fn-arg.rs b/src/test/run-pass/unique/unique-fn-arg.rs new file mode 100644 index 00000000000..ef10e17d9d2 --- /dev/null +++ b/src/test/run-pass/unique/unique-fn-arg.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f(i: Box) { + assert_eq!(*i, 100); +} + +pub fn main() { + f(box 100); + let i = box 100; + f(i); +} diff --git a/src/test/run-pass/unique/unique-fn-ret.rs b/src/test/run-pass/unique/unique-fn-ret.rs new file mode 100644 index 00000000000..b4757a4b4d6 --- /dev/null +++ b/src/test/run-pass/unique/unique-fn-ret.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +fn f() -> Box { + box 100 +} + +pub fn main() { + assert_eq!(f(), box 100); +} diff --git a/src/test/run-pass/unique/unique-generic-assign.rs b/src/test/run-pass/unique/unique-generic-assign.rs new file mode 100644 index 00000000000..571a5620cd8 --- /dev/null +++ b/src/test/run-pass/unique/unique-generic-assign.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #976 + + +// pretty-expanded FIXME #23616 + +fn f(x: Box) { + let _x2 = x; +} +pub fn main() { } diff --git a/src/test/run-pass/unique/unique-in-tag.rs b/src/test/run-pass/unique/unique-in-tag.rs new file mode 100644 index 00000000000..31fe43dae99 --- /dev/null +++ b/src/test/run-pass/unique/unique-in-tag.rs @@ -0,0 +1,31 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#![feature(box_syntax)] + +fn test1() { + enum bar { u(Box), w(isize), } + + let x = bar::u(box 10); + assert!(match x { + bar::u(a) => { + println!("{}", a); + *a + } + _ => { 66 } + } == 10); +} + +pub fn main() { + test1(); +} diff --git a/src/test/run-pass/unique/unique-in-vec-copy.rs b/src/test/run-pass/unique/unique-in-vec-copy.rs new file mode 100644 index 00000000000..62b183d62b4 --- /dev/null +++ b/src/test/run-pass/unique/unique-in-vec-copy.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut a: Vec> = vec![box 10]; + let b = a.clone(); + + assert_eq!(*a[0], 10); + assert_eq!(*b[0], 10); + + // This should only modify the value in a, not b + *a[0] = 20; + + assert_eq!(*a[0], 20); + assert_eq!(*b[0], 10); +} diff --git a/src/test/run-pass/unique/unique-in-vec.rs b/src/test/run-pass/unique/unique-in-vec.rs new file mode 100644 index 00000000000..681c0c190e4 --- /dev/null +++ b/src/test/run-pass/unique/unique-in-vec.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let vect : Vec> = vec![box 100]; + assert_eq!(vect[0], box 100); +} diff --git a/src/test/run-pass/unique/unique-init.rs b/src/test/run-pass/unique/unique-init.rs new file mode 100644 index 00000000000..9b7c2a99c99 --- /dev/null +++ b/src/test/run-pass/unique/unique-init.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub fn main() { + let _i: Box<_> = box 100; +} diff --git a/src/test/run-pass/unique/unique-kinds.rs b/src/test/run-pass/unique/unique-kinds.rs new file mode 100644 index 00000000000..33b014db37b --- /dev/null +++ b/src/test/run-pass/unique/unique-kinds.rs @@ -0,0 +1,75 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::cmp::PartialEq; +use std::fmt::Debug; + +fn sendable() { + + fn f(i: T, j: T) { + assert_eq!(i, j); + } + + fn g(i: T, j: T) { + assert!(i != j); + } + + let i: Box<_> = box 100; + let j: Box<_> = box 100; + f(i, j); + let i: Box<_> = box 100; + let j: Box<_> = box 101; + g(i, j); +} + +fn copyable() { + + fn f(i: T, j: T) { + assert_eq!(i, j); + } + + fn g(i: T, j: T) { + assert!(i != j); + } + + let i: Box<_> = box 100; + let j: Box<_> = box 100; + f(i, j); + let i: Box<_> = box 100; + let j: Box<_> = box 101; + g(i, j); +} + +fn noncopyable() { + + fn f(i: T, j: T) { + assert_eq!(i, j); + } + + fn g(i: T, j: T) { + assert!(i != j); + } + + let i: Box<_> = box 100; + let j: Box<_> = box 100; + f(i, j); + let i: Box<_> = box 100; + let j: Box<_> = box 101; + g(i, j); +} + +pub fn main() { + sendable(); + copyable(); + noncopyable(); +} diff --git a/src/test/run-pass/unique/unique-log.rs b/src/test/run-pass/unique/unique-log.rs new file mode 100644 index 00000000000..f8b5f5562fc --- /dev/null +++ b/src/test/run-pass/unique/unique-log.rs @@ -0,0 +1,17 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 100; + println!("{}", i); +} diff --git a/src/test/run-pass/unique/unique-match-discrim.rs b/src/test/run-pass/unique/unique-match-discrim.rs new file mode 100644 index 00000000000..43004e8673a --- /dev/null +++ b/src/test/run-pass/unique/unique-match-discrim.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #961 + +// pretty-expanded FIXME #23616 + +fn altsimple() { + match Box::new(true) { + _ => { } + } +} +pub fn main() { } diff --git a/src/test/run-pass/unique/unique-move-drop.rs b/src/test/run-pass/unique/unique-move-drop.rs new file mode 100644 index 00000000000..53f3c9b6c5c --- /dev/null +++ b/src/test/run-pass/unique/unique-move-drop.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![allow(unused_variables)] +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 100; + let j: Box<_> = box 200; + let j = i; + assert_eq!(*j, 100); +} diff --git a/src/test/run-pass/unique/unique-move-temp.rs b/src/test/run-pass/unique/unique-move-temp.rs new file mode 100644 index 00000000000..a68fe021d09 --- /dev/null +++ b/src/test/run-pass/unique/unique-move-temp.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut i: Box<_>; + i = box 100; + assert_eq!(*i, 100); +} diff --git a/src/test/run-pass/unique/unique-move.rs b/src/test/run-pass/unique/unique-move.rs new file mode 100644 index 00000000000..4dba48a5ea0 --- /dev/null +++ b/src/test/run-pass/unique/unique-move.rs @@ -0,0 +1,19 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let i: Box<_> = box 100; + let mut j; + j = i; + assert_eq!(*j, 100); +} diff --git a/src/test/run-pass/unique/unique-mutable.rs b/src/test/run-pass/unique/unique-mutable.rs new file mode 100644 index 00000000000..fcae9323c38 --- /dev/null +++ b/src/test/run-pass/unique/unique-mutable.rs @@ -0,0 +1,18 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +pub fn main() { + let mut i: Box<_> = box 0; + *i = 1; + assert_eq!(*i, 1); +} diff --git a/src/test/run-pass/unique/unique-object-move.rs b/src/test/run-pass/unique/unique-object-move.rs new file mode 100644 index 00000000000..d85b22f5dc9 --- /dev/null +++ b/src/test/run-pass/unique/unique-object-move.rs @@ -0,0 +1,29 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Issue #5192 + +// pretty-expanded FIXME #23616 + +#![feature(box_syntax)] + +pub trait EventLoop { fn foo(&self) {} } + +pub struct UvEventLoop { + uvio: isize +} + +impl EventLoop for UvEventLoop { } + +pub fn main() { + let loop_: Box = box UvEventLoop { uvio: 0 } as Box; + let _loop2_ = loop_; +} diff --git a/src/test/run-pass/unique/unique-pat-2.rs b/src/test/run-pass/unique/unique-pat-2.rs new file mode 100644 index 00000000000..3796be68369 --- /dev/null +++ b/src/test/run-pass/unique/unique-pat-2.rs @@ -0,0 +1,27 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] +#![allow(non_shorthand_field_patterns)] + +#![feature(box_patterns)] +#![feature(box_syntax)] + +struct Foo {a: isize, b: usize} + +enum bar { u(Box), w(isize), } + +pub fn main() { + assert!(match bar::u(box Foo{a: 10, b: 40}) { + bar::u(box Foo{a: a, b: b}) => { a + (b as isize) } + _ => { 66 } + } == 50); +} diff --git a/src/test/run-pass/unique/unique-pat-3.rs b/src/test/run-pass/unique/unique-pat-3.rs new file mode 100644 index 00000000000..2ed984c3a37 --- /dev/null +++ b/src/test/run-pass/unique/unique-pat-3.rs @@ -0,0 +1,26 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_camel_case_types)] + +#![feature(box_syntax)] + +enum bar { u(Box), w(isize), } + +pub fn main() { + assert!(match bar::u(box 10) { + bar::u(a) => { + println!("{}", a); + *a + } + _ => { 66 } + } == 10); +} diff --git a/src/test/run-pass/unique/unique-pat.rs b/src/test/run-pass/unique/unique-pat.rs new file mode 100644 index 00000000000..c83989def33 --- /dev/null +++ b/src/test/run-pass/unique/unique-pat.rs @@ -0,0 +1,25 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(box_patterns)] +#![feature(box_syntax)] + +fn simple() { + match box true { + box true => { } + _ => { panic!(); } + } +} + +pub fn main() { + simple(); +} diff --git a/src/test/run-pass/unique/unique-rec.rs b/src/test/run-pass/unique/unique-rec.rs new file mode 100644 index 00000000000..0169be9d139 --- /dev/null +++ b/src/test/run-pass/unique/unique-rec.rs @@ -0,0 +1,20 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +struct X { x: isize } + +pub fn main() { + let x: Box<_> = box X {x: 1}; + let bar = x; + assert_eq!(bar.x, 1); +} diff --git a/src/test/run-pass/unique/unique-send-2.rs b/src/test/run-pass/unique/unique-send-2.rs new file mode 100644 index 00000000000..285772b9541 --- /dev/null +++ b/src/test/run-pass/unique/unique-send-2.rs @@ -0,0 +1,44 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// ignore-emscripten no threads support + +#![feature(box_syntax)] + +use std::sync::mpsc::{channel, Sender}; +use std::thread; + +fn child(tx: &Sender>, i: usize) { + tx.send(box i).unwrap(); +} + +pub fn main() { + let (tx, rx) = channel(); + let n = 100; + let mut expected = 0; + let ts = (0..n).map(|i| { + expected += i; + let tx = tx.clone(); + thread::spawn(move|| { + child(&tx, i) + }) + }).collect::>(); + + let mut actual = 0; + for _ in 0..n { + let j = rx.recv().unwrap(); + actual += *j; + } + + assert_eq!(expected, actual); + + for t in ts { t.join(); } +} diff --git a/src/test/run-pass/unique/unique-send.rs b/src/test/run-pass/unique/unique-send.rs new file mode 100644 index 00000000000..d7382749861 --- /dev/null +++ b/src/test/run-pass/unique/unique-send.rs @@ -0,0 +1,21 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::sync::mpsc::channel; + +pub fn main() { + let (tx, rx) = channel::>(); + tx.send(box 100).unwrap(); + let v = rx.recv().unwrap(); + assert_eq!(v, box 100); +} diff --git a/src/test/run-pass/unique/unique-swap.rs b/src/test/run-pass/unique/unique-swap.rs new file mode 100644 index 00000000000..16090fa1b28 --- /dev/null +++ b/src/test/run-pass/unique/unique-swap.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![feature(box_syntax)] + +use std::mem::swap; + +pub fn main() { + let mut i: Box<_> = box 100; + let mut j: Box<_> = box 200; + swap(&mut i, &mut j); + assert_eq!(i, box 200); + assert_eq!(j, box 100); +} diff --git a/src/test/run-pass/unsized-locals/reference-unsized-locals.rs b/src/test/run-pass/unsized-locals/reference-unsized-locals.rs new file mode 100644 index 00000000000..8b96c30940f --- /dev/null +++ b/src/test/run-pass/unsized-locals/reference-unsized-locals.rs @@ -0,0 +1,19 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(unsized_locals)] + +fn main() { + let foo: Box<[u8]> = Box::new(*b"foo"); + let foo: [u8] = *foo; + assert_eq!(&foo, b"foo" as &[u8]); +} diff --git a/src/test/run-pass/unsized-locals/simple-unsized-locals.rs b/src/test/run-pass/unsized-locals/simple-unsized-locals.rs new file mode 100644 index 00000000000..9643afaee62 --- /dev/null +++ b/src/test/run-pass/unsized-locals/simple-unsized-locals.rs @@ -0,0 +1,18 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(unsized_locals)] + +fn main() { + let foo: Box<[u8]> = Box::new(*b"foo"); + let _foo: [u8] = *foo; +} diff --git a/src/test/run-pass/unsized-locals/unsized-exprs.rs b/src/test/run-pass/unsized-locals/unsized-exprs.rs new file mode 100644 index 00000000000..06919a07c75 --- /dev/null +++ b/src/test/run-pass/unsized-locals/unsized-exprs.rs @@ -0,0 +1,47 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(unsized_tuple_coercion, unsized_locals)] + +struct A(X); + +fn udrop(_x: T) {} +fn foo() -> Box<[u8]> { + Box::new(*b"foo") +} +fn tfoo() -> Box<(i32, [u8])> { + Box::new((42, *b"foo")) +} +fn afoo() -> Box> { + Box::new(A(*b"foo")) +} + +impl std::ops::Add for A<[u8]> { + type Output = (); + fn add(self, _rhs: i32) -> Self::Output {} +} + +fn main() { + udrop::<[u8]>(loop { + break *foo(); + }); + udrop::<[u8]>(if true { + *foo() + } else { + *foo() + }); + udrop::<[u8]>({*foo()}); + #[allow(unused_parens)] + udrop::<[u8]>((*foo())); + udrop::<[u8]>((*tfoo()).1); + *afoo() + 42; +} diff --git a/src/test/run-pass/unsized-locals/unsized-parameters.rs b/src/test/run-pass/unsized-locals/unsized-parameters.rs new file mode 100644 index 00000000000..82036c5797d --- /dev/null +++ b/src/test/run-pass/unsized-locals/unsized-parameters.rs @@ -0,0 +1,22 @@ +// Copyright 2018 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass + +#![feature(unsized_locals)] + +pub fn f0(_f: dyn FnOnce()) {} +pub fn f1(_s: str) {} +pub fn f2((_x, _y): (i32, [i32])) {} + +fn main() { + let foo = "foo".to_string().into_boxed_str(); + f1(*foo); +} diff --git a/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs b/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs new file mode 100644 index 00000000000..4549bd719c6 --- /dev/null +++ b/src/test/run-pass/where-clauses/auxiliary/where_clauses_xc.rs @@ -0,0 +1,29 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +pub trait Equal { + fn equal(&self, other: &Self) -> bool; + fn equals(&self, this: &T, that: &T, x: &U, y: &U) -> bool + where T: Eq, U: Eq; +} + +impl Equal for T where T: Eq { + fn equal(&self, other: &T) -> bool { + self == other + } + fn equals(&self, this: &U, other: &U, x: &X, y: &X) -> bool + where U: Eq, X: Eq { + this == other && x == y + } +} + +pub fn equal(x: &T, y: &T) -> bool where T: Eq { + x == y +} diff --git a/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs b/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs new file mode 100644 index 00000000000..752f8f2252e --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clause-bounds-inconsistency.rs @@ -0,0 +1,33 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Bound { + fn dummy(&self) { } +} + +trait Trait { + fn a(&self, _: T) where T: Bound; + fn b(&self, _: T) where T: Bound; + fn c(&self, _: T); + fn d(&self, _: T); +} + +impl Trait for bool { + fn a(&self, _: T) {} + //^~ This gets rejected but should be accepted + fn b(&self, _: T) where T: Bound {} + fn c(&self, _: T) {} + fn d(&self, _: T) where T: Bound {} +} + +fn main() {} diff --git a/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs b/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs new file mode 100644 index 00000000000..4d5a676943a --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs @@ -0,0 +1,28 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +// pretty-expanded FIXME #23616 + +trait TheTrait { fn dummy(&self) { } } + +impl TheTrait for &'static isize { } + +fn foo<'a,T>(_: &'a T) where &'a T : TheTrait { } + +fn bar(_: &'static T) where &'static T : TheTrait { } + +fn main() { + static x: isize = 1; + foo(&x); + bar(&x); +} diff --git a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs new file mode 100644 index 00000000000..3afccab07b7 --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs @@ -0,0 +1,32 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +trait Foo { fn dummy(&self, arg: T) { } } + +trait Bar { + fn method(&self) where A: Foo; +} + +struct S; +struct X; + +impl Foo for X {} + +impl Bar for i32 { + fn method(&self) where X: Foo { + } +} + +fn main() { + 1.method::(); +} diff --git a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs new file mode 100644 index 00000000000..445a090d601 --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs @@ -0,0 +1,20 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct A<'a, 'b> where 'a : 'b { x: &'a isize, y: &'b isize } + +fn main() { + let x = 1; + let y = 1; + let a = A { x: &x, y: &y }; +} diff --git a/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs b/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs new file mode 100644 index 00000000000..0343656061b --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clauses-cross-crate.rs @@ -0,0 +1,23 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// aux-build:where_clauses_xc.rs + +extern crate where_clauses_xc; + +use where_clauses_xc::{Equal, equal}; + +fn main() { + println!("{}", equal(&1, &2)); + println!("{}", equal(&1, &1)); + println!("{}", "hello".equal(&"hello")); + println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); +} diff --git a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs new file mode 100644 index 00000000000..22b1acb2a60 --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs @@ -0,0 +1,18 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +fn foo<'a, I>(mut it: I) where I: Iterator {} + +fn main() { + foo([1, 2].iter()); +} diff --git a/src/test/run-pass/where-clauses/where-clauses-method.rs b/src/test/run-pass/where-clauses/where-clauses-method.rs new file mode 100644 index 00000000000..c9930128bbe --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clauses-method.rs @@ -0,0 +1,30 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// Test that a where clause attached to a method allows us to add +// additional constraints to a parameter out of scope. + +struct Foo { + value: T +} + +impl Foo { + fn equals(&self, u: &Foo) -> bool where T : Eq { + self.value == u.value + } +} + +fn main() { + let x = Foo { value: 1 }; + let y = Foo { value: 2 }; + println!("{}", x.equals(&x)); + println!("{}", x.equals(&y)); +} diff --git a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs new file mode 100644 index 00000000000..c3cfbbda4ea --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs @@ -0,0 +1,26 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +// pretty-expanded FIXME #23616 + +struct Bencher; + +// ICE +fn warm_up<'a, F>(f: F) where F: Fn(&'a mut Bencher) { +} + +fn main() { + // ICE trigger + warm_up(|b: &mut Bencher| () ); + + // OK + warm_up(|b| () ); +} diff --git a/src/test/run-pass/where-clauses/where-clauses.rs b/src/test/run-pass/where-clauses/where-clauses.rs new file mode 100644 index 00000000000..8f1cf098c30 --- /dev/null +++ b/src/test/run-pass/where-clauses/where-clauses.rs @@ -0,0 +1,37 @@ +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +trait Equal { + fn equal(&self, other: &Self) -> bool; + fn equals(&self, this: &T, that: &T, x: &U, y: &U) -> bool + where T: Eq, U: Eq; +} + +impl Equal for T where T: Eq { + fn equal(&self, other: &T) -> bool { + self == other + } + fn equals(&self, this: &U, other: &U, x: &X, y: &X) -> bool + where U: Eq, X: Eq { + this == other && x == y + } +} + +fn equal(x: &T, y: &T) -> bool where T: Eq { + x == y +} + +fn main() { + println!("{}", equal(&1, &2)); + println!("{}", equal(&1, &1)); + println!("{}", "hello".equal(&"hello")); + println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); +} diff --git a/src/test/run-pass/zero-sized/zero-size-type-destructors.rs b/src/test/run-pass/zero-sized/zero-size-type-destructors.rs new file mode 100644 index 00000000000..02f8639e832 --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-size-type-destructors.rs @@ -0,0 +1,31 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(non_upper_case_globals)] + +static mut destructions : isize = 3; + +pub fn foo() { + struct Foo; + + impl Drop for Foo { + fn drop(&mut self) { + unsafe { destructions -= 1 }; + } + }; + + let _x = [Foo, Foo, Foo]; +} + +pub fn main() { + foo(); + assert_eq!(unsafe { destructions }, 0); +} diff --git a/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs b/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs new file mode 100644 index 00000000000..4ab329f166a --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs @@ -0,0 +1,29 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::BinaryHeap; +use std::iter::Iterator; + +fn main() { + const N: usize = 8; + + for len in 0..N { + let mut tester = BinaryHeap::with_capacity(len); + assert_eq!(tester.len(), 0); + assert!(tester.capacity() >= len); + for bit in 0..len { + tester.push(()); + } + assert_eq!(tester.len(), len); + assert_eq!(tester.iter().count(), len); + tester.clear(); + } +} diff --git a/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs b/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs new file mode 100644 index 00000000000..5e406152d93 --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs @@ -0,0 +1,33 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::cmp::{Ord, Ordering, PartialOrd}; +use std::collections::BTreeMap; +use std::iter::Iterator; + +#[derive(Eq, Hash, Debug, Ord, PartialEq, PartialOrd)] +struct Zst; + +fn main() { + const N: usize = 8; + + for len in 0..N { + let mut tester = BTreeMap::new(); + assert_eq!(tester.len(), 0); + for bit in 0..len { + tester.insert(Zst, ()); + } + assert_eq!(tester.len(), if len == 0 { 0 } else { 1 }); + assert_eq!(tester.iter().count(), if len == 0 { 0 } else { 1 }); + assert_eq!(tester.get(&Zst).is_some(), len > 0); + tester.clear(); + } +} diff --git a/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs b/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs new file mode 100644 index 00000000000..7b0b2f3c3c5 --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-sized-linkedlist-push.rs @@ -0,0 +1,39 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::LinkedList; +use std::iter::Iterator; + +fn main() { + const N: usize = 8; + + // Test that for all possible sequences of push_front / push_back, + // we end up with a LinkedList of the correct size + + for len in 0..N { + let mut tester = LinkedList::new(); + assert_eq!(tester.len(), 0); + assert_eq!(tester.front(), None); + for case in 0..(1 << len) { + assert_eq!(tester.len(), 0); + for bit in 0..len { + if case & (1 << bit) != 0 { + tester.push_front(()); + } else { + tester.push_back(()); + } + } + assert_eq!(tester.len(), len); + assert_eq!(tester.iter().count(), len); + tester.clear(); + } + } +} diff --git a/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs b/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs new file mode 100644 index 00000000000..2ea51779063 --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-sized-tuple-struct.rs @@ -0,0 +1,22 @@ +// Copyright 2012 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +#![allow(unused_assignments)] + +// Make sure that the constructor args are codegened for zero-sized tuple structs + +struct Foo(()); + +fn main() { + let mut a = 1; + Foo({ a = 2 }); + assert_eq!(a, 2); +} diff --git a/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs b/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs new file mode 100644 index 00000000000..2fc51f3409f --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-sized-vec-deque-push.rs @@ -0,0 +1,42 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::collections::VecDeque; +use std::iter::Iterator; + +fn main() { + const N: usize = 8; + + // Zero sized type + struct Zst; + + // Test that for all possible sequences of push_front / push_back, + // we end up with a deque of the correct size + + for len in 0..N { + let mut tester = VecDeque::with_capacity(len); + assert_eq!(tester.len(), 0); + assert!(tester.capacity() >= len); + for case in 0..(1 << len) { + assert_eq!(tester.len(), 0); + for bit in 0..len { + if case & (1 << bit) != 0 { + tester.push_front(Zst); + } else { + tester.push_back(Zst); + } + } + assert_eq!(tester.len(), len); + assert_eq!(tester.iter().count(), len); + tester.clear(); + } + } +} diff --git a/src/test/run-pass/zero-sized/zero-sized-vec-push.rs b/src/test/run-pass/zero-sized/zero-sized-vec-push.rs new file mode 100644 index 00000000000..dd8b717761b --- /dev/null +++ b/src/test/run-pass/zero-sized/zero-sized-vec-push.rs @@ -0,0 +1,29 @@ +// Copyright 2013 The Rust Project Developers. See the COPYRIGHT +// file at the top-level directory of this distribution and at +// http://rust-lang.org/COPYRIGHT. +// +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +// run-pass +use std::iter::Iterator; +use std::vec::Vec; + +fn main() { + const N: usize = 8; + + for len in 0..N { + let mut tester = Vec::with_capacity(len); + assert_eq!(tester.len(), 0); + assert!(tester.capacity() >= len); + for bit in 0..len { + tester.push(()); + } + assert_eq!(tester.len(), len); + assert_eq!(tester.iter().count(), len); + tester.clear(); + } +} diff --git a/src/test/ui/run-pass/allocator/auxiliary/custom-as-global.rs b/src/test/ui/run-pass/allocator/auxiliary/custom-as-global.rs deleted file mode 100644 index a3f05a01c5a..00000000000 --- a/src/test/ui/run-pass/allocator/auxiliary/custom-as-global.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] - -extern crate custom; - -use std::sync::atomic::{ATOMIC_USIZE_INIT, Ordering}; - -use custom::A; - -#[global_allocator] -static ALLOCATOR: A = A(ATOMIC_USIZE_INIT); - -pub fn get() -> usize { - ALLOCATOR.0.load(Ordering::SeqCst) -} diff --git a/src/test/ui/run-pass/allocator/auxiliary/custom.rs b/src/test/ui/run-pass/allocator/auxiliary/custom.rs deleted file mode 100644 index b17464e0419..00000000000 --- a/src/test/ui/run-pass/allocator/auxiliary/custom.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![feature(allocator_api)] -#![crate_type = "rlib"] - -use std::alloc::{GlobalAlloc, System, Layout}; -use std::sync::atomic::{AtomicUsize, Ordering}; - -pub struct A(pub AtomicUsize); - -unsafe impl GlobalAlloc for A { - unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - self.0.fetch_add(1, Ordering::SeqCst); - System.alloc(layout) - } - - unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { - self.0.fetch_add(1, Ordering::SeqCst); - System.dealloc(ptr, layout) - } -} diff --git a/src/test/ui/run-pass/allocator/auxiliary/helper.rs b/src/test/ui/run-pass/allocator/auxiliary/helper.rs deleted file mode 100644 index e75a432710d..00000000000 --- a/src/test/ui/run-pass/allocator/auxiliary/helper.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] - -use std::fmt; - -pub fn work_with(p: &fmt::Debug) { - drop(p); -} diff --git a/src/test/ui/run-pass/allocator/custom.rs b/src/test/ui/run-pass/allocator/custom.rs deleted file mode 100644 index 9617f7d4685..00000000000 --- a/src/test/ui/run-pass/allocator/custom.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:helper.rs -// no-prefer-dynamic - -#![feature(allocator_api)] - -extern crate helper; - -use std::alloc::{self, Global, Alloc, System, Layout}; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; - -static HITS: AtomicUsize = ATOMIC_USIZE_INIT; - -struct A; - -unsafe impl alloc::GlobalAlloc for A { - unsafe fn alloc(&self, layout: Layout) -> *mut u8 { - HITS.fetch_add(1, Ordering::SeqCst); - System.alloc(layout) - } - - unsafe fn dealloc(&self, ptr: *mut u8, layout: Layout) { - HITS.fetch_add(1, Ordering::SeqCst); - System.dealloc(ptr, layout) - } -} - -#[global_allocator] -static GLOBAL: A = A; - -fn main() { - println!("hello!"); - - let n = HITS.load(Ordering::SeqCst); - assert!(n > 0); - unsafe { - let layout = Layout::from_size_align(4, 2).unwrap(); - - let ptr = Global.alloc(layout.clone()).unwrap(); - helper::work_with(&ptr); - assert_eq!(HITS.load(Ordering::SeqCst), n + 1); - Global.dealloc(ptr, layout.clone()); - assert_eq!(HITS.load(Ordering::SeqCst), n + 2); - - let s = String::with_capacity(10); - helper::work_with(&s); - assert_eq!(HITS.load(Ordering::SeqCst), n + 3); - drop(s); - assert_eq!(HITS.load(Ordering::SeqCst), n + 4); - - let ptr = System.alloc(layout.clone()).unwrap(); - assert_eq!(HITS.load(Ordering::SeqCst), n + 4); - helper::work_with(&ptr); - System.dealloc(ptr, layout); - assert_eq!(HITS.load(Ordering::SeqCst), n + 4); - } -} diff --git a/src/test/ui/run-pass/allocator/xcrate-use.rs b/src/test/ui/run-pass/allocator/xcrate-use.rs deleted file mode 100644 index 8b9e1e329f7..00000000000 --- a/src/test/ui/run-pass/allocator/xcrate-use.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:custom.rs -// aux-build:helper.rs -// no-prefer-dynamic - -#![feature(allocator_api)] - -extern crate custom; -extern crate helper; - -use std::alloc::{Global, Alloc, System, Layout}; -use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT}; - -#[global_allocator] -static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT); - -fn main() { - unsafe { - let n = GLOBAL.0.load(Ordering::SeqCst); - let layout = Layout::from_size_align(4, 2).unwrap(); - - let ptr = Global.alloc(layout.clone()).unwrap(); - helper::work_with(&ptr); - assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 1); - Global.dealloc(ptr, layout.clone()); - assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2); - - let ptr = System.alloc(layout.clone()).unwrap(); - assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2); - helper::work_with(&ptr); - System.dealloc(ptr, layout); - assert_eq!(GLOBAL.0.load(Ordering::SeqCst), n + 2); - } -} diff --git a/src/test/ui/run-pass/allocator/xcrate-use2.rs b/src/test/ui/run-pass/allocator/xcrate-use2.rs deleted file mode 100644 index 2e52f28d311..00000000000 --- a/src/test/ui/run-pass/allocator/xcrate-use2.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:custom.rs -// aux-build:custom-as-global.rs -// aux-build:helper.rs -// no-prefer-dynamic - -#![feature(allocator_api)] - -extern crate custom; -extern crate custom_as_global; -extern crate helper; - -use std::alloc::{alloc, dealloc, GlobalAlloc, System, Layout}; -use std::sync::atomic::{Ordering, ATOMIC_USIZE_INIT}; - -static GLOBAL: custom::A = custom::A(ATOMIC_USIZE_INIT); - -fn main() { - unsafe { - let n = custom_as_global::get(); - let layout = Layout::from_size_align(4, 2).unwrap(); - - // Global allocator routes to the `custom_as_global` global - let ptr = alloc(layout.clone()); - helper::work_with(&ptr); - assert_eq!(custom_as_global::get(), n + 1); - dealloc(ptr, layout.clone()); - assert_eq!(custom_as_global::get(), n + 2); - - // Usage of the system allocator avoids all globals - let ptr = System.alloc(layout.clone()); - helper::work_with(&ptr); - assert_eq!(custom_as_global::get(), n + 2); - System.dealloc(ptr, layout.clone()); - assert_eq!(custom_as_global::get(), n + 2); - - // Usage of our personal allocator doesn't affect other instances - let ptr = GLOBAL.alloc(layout.clone()); - helper::work_with(&ptr); - assert_eq!(custom_as_global::get(), n + 2); - assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 1); - GLOBAL.dealloc(ptr, layout); - assert_eq!(custom_as_global::get(), n + 2); - assert_eq!(GLOBAL.0.load(Ordering::SeqCst), 2); - } -} - diff --git a/src/test/ui/run-pass/array-slice-vec/arr_cycle.rs b/src/test/ui/run-pass/array-slice-vec/arr_cycle.rs deleted file mode 100644 index 4029a270c8d..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/arr_cycle.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::cell::Cell; - -#[derive(Debug)] -struct B<'a> { - a: [Cell>>; 2] -} - -impl<'a> B<'a> { - fn new() -> B<'a> { - B { a: [Cell::new(None), Cell::new(None)] } - } -} - -fn f() { - let (b1, b2, b3); - b1 = B::new(); - b2 = B::new(); - b3 = B::new(); - b1.a[0].set(Some(&b2)); - b1.a[1].set(Some(&b3)); - b2.a[0].set(Some(&b2)); - b2.a[1].set(Some(&b3)); - b3.a[0].set(Some(&b1)); - b3.a[1].set(Some(&b2)); -} - -fn main() { - f(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/array_const_index-1.rs b/src/test/ui/run-pass/array-slice-vec/array_const_index-1.rs deleted file mode 100644 index c026a47c4f9..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/array_const_index-1.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(const_indexing)] - -fn main() { - const ARR: [i32; 6] = [42, 43, 44, 45, 46, 47]; - const IDX: usize = 3; - const VAL: i32 = ARR[IDX]; - const BLUB: [i32; (ARR[0] - 41) as usize] = [5]; -} diff --git a/src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-1.rs b/src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-1.rs deleted file mode 100644 index 5d6cc5f686e..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-1.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -// Test that we cleanup a fixed size Box<[D; k]> properly when D has a -// destructor. - -// ignore-emscripten no threads support - -use std::thread; -use std::sync::atomic::{AtomicUsize, Ordering}; - -static LOG: AtomicUsize = AtomicUsize::new(0); - -struct D(u8); - -impl Drop for D { - fn drop(&mut self) { - println!("Dropping {}", self.0); - let old = LOG.load(Ordering::SeqCst); - LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst); - } -} - -fn main() { - fn die() -> D { panic!("Oh no"); } - let g = thread::spawn(|| { - let _b1: Box<[D; 4]> = Box::new([D( 1), D( 2), D( 3), D( 4)]); - let _b2: Box<[D; 4]> = Box::new([D( 5), D( 6), D( 7), D( 8)]); - let _b3: Box<[D; 4]> = Box::new([D( 9), D(10), die(), D(12)]); - let _b4: Box<[D; 4]> = Box::new([D(13), D(14), D(15), D(16)]); - }); - assert!(g.join().is_err()); - - // When the panic occurs, we will be in the midst of constructing - // the input to `_b3`. Therefore, we drop the elements of the - // partially filled array first, before we get around to dropping - // the elements of `_b1` and _b2`. - - // Issue 23222: The order in which the elements actually get - // dropped is a little funky. See similar notes in nested-vec-3; - // in essence, I would not be surprised if we change the ordering - // given in `expect` in the future. - - let expect = 0x__A_9__5_6_7_8__1_2_3_4; - let actual = LOG.load(Ordering::SeqCst); - assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual); -} diff --git a/src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-2.rs b/src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-2.rs deleted file mode 100644 index d2dedc4602a..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/box-of-array-of-drop-2.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -// Test that we cleanup dynamic sized Box<[D]> properly when D has a -// destructor. - -// ignore-emscripten no threads support - -use std::thread; -use std::sync::atomic::{AtomicUsize, Ordering}; - -static LOG: AtomicUsize = AtomicUsize::new(0); - -struct D(u8); - -impl Drop for D { - fn drop(&mut self) { - println!("Dropping {}", self.0); - let old = LOG.load(Ordering::SeqCst); - LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst); - } -} - -fn main() { - fn die() -> D { panic!("Oh no"); } - let g = thread::spawn(|| { - let _b1: Box<[D; 4]> = Box::new([D( 1), D( 2), D( 3), D( 4)]); - let _b2: Box<[D; 4]> = Box::new([D( 5), D( 6), D( 7), D( 8)]); - let _b3: Box<[D; 4]> = Box::new([D( 9), D(10), die(), D(12)]); - let _b4: Box<[D; 4]> = Box::new([D(13), D(14), D(15), D(16)]); - }); - assert!(g.join().is_err()); - - // When the panic occurs, we will be in the midst of constructing - // the input to `_b3`. Therefore, we drop the elements of the - // partially filled array first, before we get around to dropping - // the elements of `_b1` and _b2`. - - // Issue 23222: The order in which the elements actually get - // dropped is a little funky. See similar notes in nested-vec-3; - // in essence, I would not be surprised if we change the ordering - // given in `expect` in the future. - - let expect = 0x__A_9__5_6_7_8__1_2_3_4; - let actual = LOG.load(Ordering::SeqCst); - assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual); -} diff --git a/src/test/ui/run-pass/array-slice-vec/cast-in-array-size.rs b/src/test/ui/run-pass/array-slice-vec/cast-in-array-size.rs deleted file mode 100644 index d78bc0b0072..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/cast-in-array-size.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -// issues #10618 and #16382 -// pretty-expanded FIXME #23616 - -const SIZE: isize = 25; - -fn main() { - let _a: [bool; 1 as usize]; - let _b: [isize; SIZE as usize] = [1; SIZE as usize]; - let _c: [bool; '\n' as usize] = [true; '\n' as usize]; - let _d: [bool; true as usize] = [true; true as usize]; -} diff --git a/src/test/ui/run-pass/array-slice-vec/check-static-mut-slices.rs b/src/test/ui/run-pass/array-slice-vec/check-static-mut-slices.rs deleted file mode 100644 index 3d2fc8195eb..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/check-static-mut-slices.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Checks that mutable static items can have mutable slices - - -static mut TEST: &'static mut [isize] = &mut [1]; -static mut EMPTY: &'static mut [isize] = &mut []; - -pub fn main() { - unsafe { - TEST[0] += 1; - assert_eq!(TEST[0], 2); - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/check-static-slice.rs b/src/test/ui/run-pass/array-slice-vec/check-static-slice.rs deleted file mode 100644 index 6627095c32b..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/check-static-slice.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Check that the various ways of getting to a reference to a vec (both sized -// and unsized) work properly. - - -const AA: [isize; 3] = [1, 2, 3]; -const AB: &'static [isize; 3] = &AA; -const AC: &'static [isize] = AB; -const AD: &'static [isize] = &AA; -const AE: &'static [isize; 3] = &[1, 2, 3]; -const AF: &'static [isize] = &[1, 2, 3]; - -static CA: isize = AA[0]; -static CB: isize = AB[1]; -static CC: isize = AC[2]; -static CD: isize = AD[0]; -static CE: isize = AE[1]; -static CF: isize = AF[2]; - -static AG: &'static isize = &AA[2]; - -fn main () { - let b: &[isize] = &[1, 2, 3]; - assert_eq!(AC, b); - assert_eq!(AD, b); - assert_eq!(AF, b); - assert_eq!(*AG, 3); - - assert_eq!(CA, 1); - assert_eq!(CB, 2); - assert_eq!(CC, 3); - assert_eq!(CD, 1); - assert_eq!(CE, 2); - assert_eq!(CF, 3); -} diff --git a/src/test/ui/run-pass/array-slice-vec/copy-out-of-array-1.rs b/src/test/ui/run-pass/array-slice-vec/copy-out-of-array-1.rs deleted file mode 100644 index 917683e4eeb..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/copy-out-of-array-1.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Ensure that we can copy out of a fixed-size array. -// -// (Compare with compile-fail/move-out-of-array-1.rs) - -#[derive(Copy, Clone)] -struct C { _x: u8 } - -fn main() { - fn d() -> C { C { _x: 0 } } - - let _d1 = foo([d(), d(), d(), d()], 1); - let _d3 = foo([d(), d(), d(), d()], 3); -} - -fn foo(a: [C; 4], i: usize) -> C { - a[i] -} diff --git a/src/test/ui/run-pass/array-slice-vec/destructure-array-1.rs b/src/test/ui/run-pass/array-slice-vec/destructure-array-1.rs deleted file mode 100644 index 17620f62be6..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/destructure-array-1.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Ensure that we can do a destructuring bind of a fixed-size array, -// even when the element type has a destructor. - -struct D { x: u8 } - -impl Drop for D { fn drop(&mut self) { } } - -fn main() { - fn d(x: u8) -> D { D { x: x } } - - let d1 = foo([d(1), d(2), d(3), d(4)], 1); - let d3 = foo([d(5), d(6), d(7), d(8)], 3); - assert_eq!(d1.x, 2); - assert_eq!(d3.x, 8); -} - -fn foo([a, b, c, d]: [D; 4], i: usize) -> D { - match i { - 0 => a, - 1 => b, - 2 => c, - 3 => d, - _ => panic!("unmatched"), - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/empty-mutable-vec.rs b/src/test/ui/run-pass/array-slice-vec/empty-mutable-vec.rs deleted file mode 100644 index 7411d574321..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/empty-mutable-vec.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -#![allow(unused_mut)] - - -pub fn main() { let mut _v: Vec = Vec::new(); } diff --git a/src/test/ui/run-pass/array-slice-vec/estr-slice.rs b/src/test/ui/run-pass/array-slice-vec/estr-slice.rs deleted file mode 100644 index 768229aafbf..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/estr-slice.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let x = "hello"; - let v = "hello"; - let y : &str = "there"; - - println!("{}", x); - println!("{}", y); - - assert_eq!(x.as_bytes()[0], 'h' as u8); - assert_eq!(x.as_bytes()[4], 'o' as u8); - - let z : &str = "thing"; - assert_eq!(v, x); - assert!(x != z); - - let a = "aaaa"; - let b = "bbbb"; - - let c = "cccc"; - let cc = "ccccc"; - - println!("{}", a); - - assert!(a < b); - assert!(a <= b); - assert!(a != b); - assert!(b >= a); - assert!(b > a); - - println!("{}", b); - - assert!(a < c); - assert!(a <= c); - assert!(a != c); - assert!(c >= a); - assert!(c > a); - - println!("{}", c); - - assert!(c < cc); - assert!(c <= cc); - assert!(c != cc); - assert!(cc >= c); - assert!(cc > c); - - println!("{}", cc); -} diff --git a/src/test/ui/run-pass/array-slice-vec/evec-slice.rs b/src/test/ui/run-pass/array-slice-vec/evec-slice.rs deleted file mode 100644 index 7f54801910b..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/evec-slice.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x : &[isize] = &[1,2,3,4,5]; - let mut z : &[isize] = &[1,2,3,4,5]; - z = x; - assert_eq!(z[0], 1); - assert_eq!(z[4], 5); - - let a : &[isize] = &[1,1,1,1,1]; - let b : &[isize] = &[2,2,2,2,2]; - let c : &[isize] = &[2,2,2,2,3]; - let cc : &[isize] = &[2,2,2,2,2,2]; - - println!("{:?}", a); - - assert!(a < b); - assert!(a <= b); - assert!(a != b); - assert!(b >= a); - assert!(b > a); - - println!("{:?}", b); - - assert!(b < c); - assert!(b <= c); - assert!(b != c); - assert!(c >= b); - assert!(c > b); - - assert!(a < c); - assert!(a <= c); - assert!(a != c); - assert!(c >= a); - assert!(c > a); - - println!("{:?}", c); - - assert!(a < cc); - assert!(a <= cc); - assert!(a != cc); - assert!(cc >= a); - assert!(cc > a); - - println!("{:?}", cc); -} diff --git a/src/test/ui/run-pass/array-slice-vec/fixed_length_copy.rs b/src/test/ui/run-pass/array-slice-vec/fixed_length_copy.rs deleted file mode 100644 index 09492e37e28..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/fixed_length_copy.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let arr = [1,2,3]; - let arr2 = arr; - assert_eq!(arr[1], 2); - assert_eq!(arr2[2], 3); -} diff --git a/src/test/ui/run-pass/array-slice-vec/huge-largest-array.rs b/src/test/ui/run-pass/array-slice-vec/huge-largest-array.rs deleted file mode 100644 index 27b4e68e771..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/huge-largest-array.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -use std::mem::size_of; - -#[cfg(target_pointer_width = "32")] -pub fn main() { - assert_eq!(size_of::<[u8; (1 << 31) - 1]>(), (1 << 31) - 1); -} - -#[cfg(target_pointer_width = "64")] -pub fn main() { - assert_eq!(size_of::<[u8; (1 << 47) - 1]>(), (1 << 47) - 1); -} diff --git a/src/test/ui/run-pass/array-slice-vec/ivec-pass-by-value.rs b/src/test/ui/run-pass/array-slice-vec/ivec-pass-by-value.rs deleted file mode 100644 index 2f3efef5636..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/ivec-pass-by-value.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn f(_a: Vec ) { } -pub fn main() { f(vec![1, 2, 3, 4, 5]); } diff --git a/src/test/ui/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs b/src/test/ui/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs deleted file mode 100644 index 49dc348952b..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/mutability-inherits-through-fixed-length-vec.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn test1() { - let mut ints = [0; 32]; - ints[0] += 1; - assert_eq!(ints[0], 1); -} - -fn test2() { - let mut ints = [0; 32]; - for i in &mut ints { *i += 22; } - for i in &ints { assert_eq!(*i, 22); } -} - -pub fn main() { - test1(); - test2(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/mutable-alias-vec.rs b/src/test/ui/run-pass/array-slice-vec/mutable-alias-vec.rs deleted file mode 100644 index dc2548ad53c..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/mutable-alias-vec.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn grow(v: &mut Vec ) { - v.push(1); -} - -pub fn main() { - let mut v: Vec = Vec::new(); - grow(&mut v); - grow(&mut v); - grow(&mut v); - let len = v.len(); - println!("{}", len); - assert_eq!(len, 3 as usize); -} diff --git a/src/test/ui/run-pass/array-slice-vec/nested-vec-1.rs b/src/test/ui/run-pass/array-slice-vec/nested-vec-1.rs deleted file mode 100644 index 62bcc5f7254..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/nested-vec-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that using the `vec!` macro nested within itself works - -fn main() { - let nested = vec![vec![1u32, 2u32, 3u32]]; - assert_eq!(nested[0][1], 2); -} diff --git a/src/test/ui/run-pass/array-slice-vec/nested-vec-2.rs b/src/test/ui/run-pass/array-slice-vec/nested-vec-2.rs deleted file mode 100644 index 4af2350cc36..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/nested-vec-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that using the `vec!` macro nested within itself works -// when the contents implement Drop - -struct D(u32); - -impl Drop for D { - fn drop(&mut self) { println!("Dropping {}", self.0); } -} - -fn main() { - let nested = vec![vec![D(1u32), D(2u32), D(3u32)]]; - assert_eq!(nested[0][1].0, 2); -} diff --git a/src/test/ui/run-pass/array-slice-vec/nested-vec-3.rs b/src/test/ui/run-pass/array-slice-vec/nested-vec-3.rs deleted file mode 100644 index dc3146a2b35..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/nested-vec-3.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -// ignore-emscripten no threads support - -// Test that using the `vec!` macro nested within itself works when -// the contents implement Drop and we hit a panic in the middle of -// construction. - -use std::thread; -use std::sync::atomic::{AtomicUsize, Ordering}; - -static LOG: AtomicUsize = AtomicUsize::new(0); - -struct D(u8); - -impl Drop for D { - fn drop(&mut self) { - println!("Dropping {}", self.0); - let old = LOG.load(Ordering::SeqCst); - LOG.compare_and_swap(old, old << 4 | self.0 as usize, Ordering::SeqCst); - } -} - -fn main() { - fn die() -> D { panic!("Oh no"); } - let g = thread::spawn(|| { - let _nested = vec![vec![D( 1), D( 2), D( 3), D( 4)], - vec![D( 5), D( 6), D( 7), D( 8)], - vec![D( 9), D(10), die(), D(12)], - vec![D(13), D(14), D(15), D(16)]]; - }); - assert!(g.join().is_err()); - - // When the panic occurs, we will be in the midst of constructing the - // second inner vector. Therefore, we drop the elements of the - // partially filled vector first, before we get around to dropping - // the elements of the filled vector. - - // Issue 23222: The order in which the elements actually get - // dropped is a little funky: as noted above, we'll drop the 9+10 - // first, but due to #23222, they get dropped in reverse - // order. Likewise, again due to #23222, we will drop the second - // filled vec before the first filled vec. - // - // If Issue 23222 is "fixed", then presumably the corrected - // expected order of events will be 0x__9_A__1_2_3_4__5_6_7_8; - // that is, we would still drop 9+10 first, since they belong to - // the more deeply nested expression when the panic occurs. - - let expect = 0x__A_9__5_6_7_8__1_2_3_4; - let actual = LOG.load(Ordering::SeqCst); - assert!(actual == expect, "expect: 0x{:x} actual: 0x{:x}", expect, actual); -} diff --git a/src/test/ui/run-pass/array-slice-vec/new-style-fixed-length-vec.rs b/src/test/ui/run-pass/array-slice-vec/new-style-fixed-length-vec.rs deleted file mode 100644 index 268fa5c4b59..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/new-style-fixed-length-vec.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -static FOO: [isize; 3] = [1, 2, 3]; - -pub fn main() { - println!("{} {} {}", FOO[0], FOO[1], FOO[2]); -} diff --git a/src/test/ui/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs b/src/test/ui/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs deleted file mode 100644 index 76302b92ed0..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/rcvr-borrowed-to-slice.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(non_camel_case_types)] - -trait sum { - fn sum_(self) -> isize; -} - -// Note: impl on a slice -impl<'a> sum for &'a [isize] { - fn sum_(self) -> isize { - self.iter().fold(0, |a, &b| a + b) - } -} - -fn call_sum(x: &[isize]) -> isize { x.sum_() } - -pub fn main() { - let x = vec![1, 2, 3]; - let y = call_sum(&x); - println!("y=={}", y); - assert_eq!(y, 6); - - let x = vec![1, 2, 3]; - let y = x.sum_(); - println!("y=={}", y); - assert_eq!(y, 6); - - let x = vec![1, 2, 3]; - let y = x.sum_(); - println!("y=={}", y); - assert_eq!(y, 6); -} diff --git a/src/test/ui/run-pass/array-slice-vec/repeated-vector-syntax.rs b/src/test/ui/run-pass/array-slice-vec/repeated-vector-syntax.rs deleted file mode 100644 index d706be4c336..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/repeated-vector-syntax.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = [ [true]; 512 ]; - let y = [ 0; 1 ]; - - print!("["); - for xi in &x[..] { - print!("{:?}, ", &xi[..]); - } - println!("]"); - println!("{:?}", &y[..]); -} diff --git a/src/test/ui/run-pass/array-slice-vec/show-boxed-slice.rs b/src/test/ui/run-pass/array-slice-vec/show-boxed-slice.rs deleted file mode 100644 index dda4ce9f227..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/show-boxed-slice.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(Debug)] -struct Foo(Box<[u8]>); - -pub fn main() { - println!("{:?}", Foo(Box::new([0, 1, 2]))); -} diff --git a/src/test/ui/run-pass/array-slice-vec/slice-2.rs b/src/test/ui/run-pass/array-slice-vec/slice-2.rs deleted file mode 100644 index 1f71ceac04f..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/slice-2.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test slicing expressions on slices and Vecs. - - -fn main() { - let x: &[isize] = &[1, 2, 3, 4, 5]; - let cmp: &[isize] = &[1, 2, 3, 4, 5]; - assert_eq!(&x[..], cmp); - let cmp: &[isize] = &[3, 4, 5]; - assert_eq!(&x[2..], cmp); - let cmp: &[isize] = &[1, 2, 3]; - assert_eq!(&x[..3], cmp); - let cmp: &[isize] = &[2, 3, 4]; - assert_eq!(&x[1..4], cmp); - - let x: Vec = vec![1, 2, 3, 4, 5]; - let cmp: &[isize] = &[1, 2, 3, 4, 5]; - assert_eq!(&x[..], cmp); - let cmp: &[isize] = &[3, 4, 5]; - assert_eq!(&x[2..], cmp); - let cmp: &[isize] = &[1, 2, 3]; - assert_eq!(&x[..3], cmp); - let cmp: &[isize] = &[2, 3, 4]; - assert_eq!(&x[1..4], cmp); - - let x: &mut [isize] = &mut [1, 2, 3, 4, 5]; - { - let cmp: &mut [isize] = &mut [1, 2, 3, 4, 5]; - assert_eq!(&mut x[..], cmp); - } - { - let cmp: &mut [isize] = &mut [3, 4, 5]; - assert_eq!(&mut x[2..], cmp); - } - { - let cmp: &mut [isize] = &mut [1, 2, 3]; - assert_eq!(&mut x[..3], cmp); - } - { - let cmp: &mut [isize] = &mut [2, 3, 4]; - assert_eq!(&mut x[1..4], cmp); - } - - let mut x: Vec = vec![1, 2, 3, 4, 5]; - { - let cmp: &mut [isize] = &mut [1, 2, 3, 4, 5]; - assert_eq!(&mut x[..], cmp); - } - { - let cmp: &mut [isize] = &mut [3, 4, 5]; - assert_eq!(&mut x[2..], cmp); - } - { - let cmp: &mut [isize] = &mut [1, 2, 3]; - assert_eq!(&mut x[..3], cmp); - } - { - let cmp: &mut [isize] = &mut [2, 3, 4]; - assert_eq!(&mut x[1..4], cmp); - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/slice-of-zero-size-elements.rs b/src/test/ui/run-pass/array-slice-vec/slice-of-zero-size-elements.rs deleted file mode 100644 index 671246f6a63..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/slice-of-zero-size-elements.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// compile-flags: -C debug-assertions - -#![feature(iter_to_slice)] - -use std::slice; - -fn foo(v: &[T]) -> Option<&[T]> { - let mut it = v.iter(); - for _ in 0..5 { - let _ = it.next(); - } - Some(it.as_slice()) -} - -fn foo_mut(v: &mut [T]) -> Option<&mut [T]> { - let mut it = v.iter_mut(); - for _ in 0..5 { - let _ = it.next(); - } - Some(it.into_slice()) -} - -pub fn main() { - // In a slice of zero-size elements the pointer is meaningless. - // Ensure iteration still works even if the pointer is at the end of the address space. - let slice: &[()] = unsafe { slice::from_raw_parts(-5isize as *const (), 10) }; - assert_eq!(slice.len(), 10); - assert_eq!(slice.iter().count(), 10); - - // .nth() on the iterator should also behave correctly - let mut it = slice.iter(); - assert!(it.nth(5).is_some()); - assert_eq!(it.count(), 4); - - // Converting Iter to a slice should never have a null pointer - assert!(foo(slice).is_some()); - - // Test mutable iterators as well - let slice: &mut [()] = unsafe { slice::from_raw_parts_mut(-5isize as *mut (), 10) }; - assert_eq!(slice.len(), 10); - assert_eq!(slice.iter_mut().count(), 10); - - { - let mut it = slice.iter_mut(); - assert!(it.nth(5).is_some()); - assert_eq!(it.count(), 4); - } - - assert!(foo_mut(slice).is_some()) -} diff --git a/src/test/ui/run-pass/array-slice-vec/slice-panic-1.rs b/src/test/ui/run-pass/array-slice-vec/slice-panic-1.rs deleted file mode 100644 index b9d816acaa2..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/slice-panic-1.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-emscripten no threads support - -// Test that if a slicing expr[..] fails, the correct cleanups happen. - - -use std::thread; - -struct Foo; - -static mut DTOR_COUNT: isize = 0; - -impl Drop for Foo { - fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } } -} - -fn foo() { - let x: &[_] = &[Foo, Foo]; - &x[3..4]; -} - -fn main() { - let _ = thread::spawn(move|| foo()).join(); - unsafe { assert_eq!(DTOR_COUNT, 2); } -} diff --git a/src/test/ui/run-pass/array-slice-vec/slice-panic-2.rs b/src/test/ui/run-pass/array-slice-vec/slice-panic-2.rs deleted file mode 100644 index 787d10b042f..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/slice-panic-2.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-emscripten no threads support - -// Test that if a slicing expr[..] fails, the correct cleanups happen. - - -use std::thread; - -struct Foo; - -static mut DTOR_COUNT: isize = 0; - -impl Drop for Foo { - fn drop(&mut self) { unsafe { DTOR_COUNT += 1; } } -} - -fn bar() -> usize { - panic!(); -} - -fn foo() { - let x: &[_] = &[Foo, Foo]; - &x[3..bar()]; -} - -fn main() { - let _ = thread::spawn(move|| foo()).join(); - unsafe { assert_eq!(DTOR_COUNT, 2); } -} diff --git a/src/test/ui/run-pass/array-slice-vec/slice.rs b/src/test/ui/run-pass/array-slice-vec/slice.rs deleted file mode 100644 index 6c43d883230..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/slice.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test slicing sugar. - -extern crate core; -use core::ops::{Index, IndexMut, Range, RangeTo, RangeFrom, RangeFull}; - -static mut COUNT: usize = 0; - -struct Foo; - -impl Index> for Foo { - type Output = Foo; - fn index(&self, index: Range) -> &Foo { - unsafe { COUNT += 1; } - self - } -} -impl Index> for Foo { - type Output = Foo; - fn index(&self, index: RangeTo) -> &Foo { - unsafe { COUNT += 1; } - self - } -} -impl Index> for Foo { - type Output = Foo; - fn index(&self, index: RangeFrom) -> &Foo { - unsafe { COUNT += 1; } - self - } -} -impl Index for Foo { - type Output = Foo; - fn index(&self, _index: RangeFull) -> &Foo { - unsafe { COUNT += 1; } - self - } -} - -impl IndexMut> for Foo { - fn index_mut(&mut self, index: Range) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} -impl IndexMut> for Foo { - fn index_mut(&mut self, index: RangeTo) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} -impl IndexMut> for Foo { - fn index_mut(&mut self, index: RangeFrom) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} -impl IndexMut for Foo { - fn index_mut(&mut self, _index: RangeFull) -> &mut Foo { - unsafe { COUNT += 1; } - self - } -} - - -fn main() { - let mut x = Foo; - &x[..]; - &x[Foo..]; - &x[..Foo]; - &x[Foo..Foo]; - &mut x[..]; - &mut x[Foo..]; - &mut x[..Foo]; - &mut x[Foo..Foo]; - unsafe { - assert_eq!(COUNT, 8); - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/slice_binary_search.rs b/src/test/ui/run-pass/array-slice-vec/slice_binary_search.rs deleted file mode 100644 index 081b06bea5c..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/slice_binary_search.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test binary_search_by_key lifetime. Issue #34683 - -#[derive(Debug)] -struct Assignment { - topic: String, - partition: i32, -} - -fn main() { - let xs = vec![ - Assignment { topic: "abc".into(), partition: 1 }, - Assignment { topic: "def".into(), partition: 2 }, - Assignment { topic: "ghi".into(), partition: 3 }, - ]; - - let key: &str = "def"; - let r = xs.binary_search_by_key(&key, |e| &e.topic); - assert_eq!(Ok(1), r.map(|i| i)); -} diff --git a/src/test/ui/run-pass/array-slice-vec/variance-vec-covariant.rs b/src/test/ui/run-pass/array-slice-vec/variance-vec-covariant.rs deleted file mode 100644 index 5cf52006f3c..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/variance-vec-covariant.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that vec is now covariant in its argument type. - -#![allow(dead_code)] - -fn foo<'a,'b>(v1: Vec<&'a i32>, v2: Vec<&'b i32>) -> i32 { - bar(v1, v2).cloned().unwrap_or(0) // only type checks if we can intersect 'a and 'b -} - -fn bar<'c>(v1: Vec<&'c i32>, v2: Vec<&'c i32>) -> Option<&'c i32> { - v1.get(0).cloned().or_else(|| v2.get(0).cloned()) -} - -fn main() { - let x = 22; - let y = 44; - assert_eq!(foo(vec![&x], vec![&y]), 22); - assert_eq!(foo(vec![&y], vec![&x]), 44); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-concat.rs b/src/test/ui/run-pass/array-slice-vec/vec-concat.rs deleted file mode 100644 index 7c734d8d6a2..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-concat.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::vec; - -pub fn main() { - let a: Vec = vec![1, 2, 3, 4, 5]; - let b: Vec = vec![6, 7, 8, 9, 0]; - let mut v: Vec = a; - v.extend_from_slice(&b); - println!("{}", v[9]); - assert_eq!(v[0], 1); - assert_eq!(v[7], 8); - assert_eq!(v[9], 0); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-dst.rs b/src/test/ui/run-pass/array-slice-vec/vec-dst.rs deleted file mode 100644 index 6421b69d22e..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-dst.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(box_syntax)] - -pub fn main() { - // Tests for indexing into box/& [T; n] - let x: [isize; 3] = [1, 2, 3]; - let mut x: Box<[isize; 3]> = box x; - assert_eq!(x[0], 1); - assert_eq!(x[1], 2); - assert_eq!(x[2], 3); - x[1] = 45; - assert_eq!(x[0], 1); - assert_eq!(x[1], 45); - assert_eq!(x[2], 3); - - let mut x: [isize; 3] = [1, 2, 3]; - let x: &mut [isize; 3] = &mut x; - assert_eq!(x[0], 1); - assert_eq!(x[1], 2); - assert_eq!(x[2], 3); - x[1] = 45; - assert_eq!(x[0], 1); - assert_eq!(x[1], 45); - assert_eq!(x[2], 3); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-fixed-length.rs b/src/test/ui/run-pass/array-slice-vec/vec-fixed-length.rs deleted file mode 100644 index a7b86794132..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-fixed-length.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -use std::mem::size_of; - -#[cfg(not(target_pointer_width = "64"))] -fn test_big_vec() {} - -#[cfg(target_pointer_width = "64")] -fn test_big_vec() -{ - assert_eq!(size_of::<[u8; (1 << 32)]>(), (1 << 32)); -} - -fn main() { - let x: [isize; 4] = [1, 2, 3, 4]; - assert_eq!(x[0], 1); - assert_eq!(x[1], 2); - assert_eq!(x[2], 3); - assert_eq!(x[3], 4); - - assert_eq!(size_of::<[u8; 4]>(), 4); - test_big_vec(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-growth.rs b/src/test/ui/run-pass/array-slice-vec/vec-growth.rs deleted file mode 100644 index e783a799c05..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-growth.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let mut v = vec![1]; - v.push(2); - v.push(3); - v.push(4); - v.push(5); - assert_eq!(v[0], 1); - assert_eq!(v[1], 2); - assert_eq!(v[2], 3); - assert_eq!(v[3], 4); - assert_eq!(v[4], 5); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-late-init.rs b/src/test/ui/run-pass/array-slice-vec/vec-late-init.rs deleted file mode 100644 index dc7241a0e05..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-late-init.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let mut later: Vec ; - if true { later = vec![1]; } else { later = vec![2]; } - println!("{}", later[0]); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-macro-no-std.rs b/src/test/ui/run-pass/array-slice-vec/vec-macro-no-std.rs deleted file mode 100644 index 509167413b6..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-macro-no-std.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-emscripten no no_std executables - -#![feature(lang_items, start, libc, alloc)] -#![no_std] - -extern crate std as other; - -extern crate libc; - -#[macro_use] -extern crate alloc; - -use alloc::vec::Vec; - -// Issue #16806 - -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - let x: Vec = vec![0, 1, 2]; - match x.last() { - Some(&2) => (), - _ => panic!(), - } - 0 -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-macro-repeat.rs b/src/test/ui/run-pass/array-slice-vec/vec-macro-repeat.rs deleted file mode 100644 index 36c8b7cffab..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-macro-repeat.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - assert_eq!(vec![1; 3], vec![1, 1, 1]); - assert_eq!(vec![1; 2], vec![1, 1]); - assert_eq!(vec![1; 1], vec![1]); - assert_eq!(vec![1; 0], vec![]); - - // from_elem syntax (see RFC 832) - let el = Box::new(1); - let n = 3; - assert_eq!(vec![el; n], vec![Box::new(1), Box::new(1), Box::new(1)]); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs b/src/test/ui/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs deleted file mode 100644 index 8ccf22e6288..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-macro-rvalue-scope.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn one() -> i32 { 1 } - -// Make sure the vec![...] macro doesn't introduce hidden rvalue -// scopes (such as blocks) around the element expressions. -pub fn main() { - assert_eq!(vec![&one(), &one(), &2], vec![&1, &1, &(one()+one())]); - assert_eq!(vec![&one(); 2], vec![&1, &one()]); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-macro-with-brackets.rs b/src/test/ui/run-pass/array-slice-vec/vec-macro-with-brackets.rs deleted file mode 100644 index b5d1459300a..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-macro-with-brackets.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -macro_rules! vec [ - ($($e:expr),*) => ({ - let mut _temp = ::std::vec::Vec::new(); - $(_temp.push($e);)* - _temp - }) -]; - -pub fn main() { - let my_vec = vec![1, 2, 3, 4, 5]; -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs b/src/test/ui/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs deleted file mode 100644 index 046d634b19d..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-macro-with-trailing-comma.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - assert_eq!(vec![1], vec![1,]); - assert_eq!(vec![1, 2, 3], vec![1, 2, 3,]); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-matching-autoslice.rs b/src/test/ui/run-pass/array-slice-vec/vec-matching-autoslice.rs deleted file mode 100644 index b5cefb48ce7..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-matching-autoslice.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 - -pub fn main() { - let x = [1, 2, 3]; - match x { - [2, _, _] => panic!(), - [1, a, b] => { - assert_eq!([a, b], [2, 3]); - } - [_, _, _] => panic!(), - } - - let y = ([(1, true), (2, false)], 0.5f64); - match y { - ([(1, a), (b, false)], _) => { - assert_eq!(a, true); - assert_eq!(b, 2); - } - ([_, _], 0.5) => panic!(), - ([_, _], _) => panic!(), - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-matching-fixed.rs b/src/test/ui/run-pass/array-slice-vec/vec-matching-fixed.rs deleted file mode 100644 index 7bfecdd2c7f..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-matching-fixed.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(slice_patterns)] - -fn a() { - let x = [1, 2, 3]; - match x { - [1, 2, 4] => unreachable!(), - [0, 2, 3, ..] => unreachable!(), - [0, .., 3] => unreachable!(), - [0, ..] => unreachable!(), - [1, 2, 3] => (), - [_, _, _] => unreachable!(), - } - match x { - [..] => (), - } - match x { - [_, _, _, ..] => (), - } - match x { - [a, b, c] => { - assert_eq!(1, a); - assert_eq!(2, b); - assert_eq!(3, c); - } - } -} - -pub fn main() { - a(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-matching-fold.rs b/src/test/ui/run-pass/array-slice-vec/vec-matching-fold.rs deleted file mode 100644 index b1aa7f1b70c..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-matching-fold.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(slice_patterns)] - -use std::fmt::Debug; - -fn foldl(values: &[T], - initial: U, - mut function: F) - -> U where - U: Clone+Debug, T:Debug, - F: FnMut(U, &T) -> U, -{ match values { - &[ref head, ref tail..] => - foldl(tail, function(initial, head), function), - &[] => { - // FIXME: call guards - let res = initial.clone(); res - } - } -} - -fn foldr(values: &[T], - initial: U, - mut function: F) - -> U where - U: Clone, - F: FnMut(&T, U) -> U, -{ - match values { - &[ref head.., ref tail] => - foldr(head, function(tail, initial), function), - &[] => { - // FIXME: call guards - let res = initial.clone(); res - } - } -} - -pub fn main() { - let x = &[1, 2, 3, 4, 5]; - - let product = foldl(x, 1, |a, b| a * *b); - assert_eq!(product, 120); - - let sum = foldr(x, 0, |a, b| *a + b); - assert_eq!(sum, 15); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs b/src/test/ui/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs deleted file mode 100644 index e727e56c0f8..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(slice_patterns)] - -pub fn main() { - let x = &[1, 2, 3, 4, 5]; - let x: &[isize] = &[1, 2, 3, 4, 5]; - if !x.is_empty() { - let el = match x { - &[1, ref tail..] => &tail[0], - _ => unreachable!() - }; - println!("{}", *el); - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-matching.rs b/src/test/ui/run-pass/array-slice-vec/vec-matching.rs deleted file mode 100644 index 8d1ef6f755a..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-matching.rs +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(slice_patterns)] - -fn a() { - let x = [1]; - match x { - [a] => { - assert_eq!(a, 1); - } - } -} - -fn b() { - let x = [1, 2, 3]; - match x { - [a, b, c..] => { - assert_eq!(a, 1); - assert_eq!(b, 2); - let expected: &[_] = &[3]; - assert_eq!(c, expected); - } - } - match x { - [a.., b, c] => { - let expected: &[_] = &[1]; - assert_eq!(a, expected); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - [a, b.., c] => { - assert_eq!(a, 1); - let expected: &[_] = &[2]; - assert_eq!(b, expected); - assert_eq!(c, 3); - } - } - match x { - [a, b, c] => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } -} - - -fn b_slice() { - let x : &[_] = &[1, 2, 3]; - match x { - &[a, b, ref c..] => { - assert_eq!(a, 1); - assert_eq!(b, 2); - let expected: &[_] = &[3]; - assert_eq!(c, expected); - } - _ => unreachable!() - } - match x { - &[ref a.., b, c] => { - let expected: &[_] = &[1]; - assert_eq!(a, expected); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - _ => unreachable!() - } - match x { - &[a, ref b.., c] => { - assert_eq!(a, 1); - let expected: &[_] = &[2]; - assert_eq!(b, expected); - assert_eq!(c, 3); - } - _ => unreachable!() - } - match x { - &[a, b, c] => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - _ => unreachable!() - } -} - -fn c() { - let x = [1]; - match x { - [2, ..] => panic!(), - [..] => () - } -} - -fn d() { - let x = [1, 2, 3]; - let branch = match x { - [1, 1, ..] => 0, - [1, 2, 3, ..] => 1, - [1, 2, ..] => 2, - _ => 3 - }; - assert_eq!(branch, 1); -} - -fn e() { - let x: &[isize] = &[1, 2, 3]; - let a = match *x { - [1, 2] => 0, - [..] => 1, - }; - - assert_eq!(a, 1); - - let b = match *x { - [2, ..] => 0, - [1, 2, ..] => 1, - [_] => 2, - [..] => 3 - }; - - assert_eq!(b, 1); - - - let c = match *x { - [_, _, _, _, ..] => 0, - [1, 2, ..] => 1, - [_] => 2, - [..] => 3 - }; - - assert_eq!(c, 1); -} - -fn f() { - let x = &[1, 2, 3, 4, 5]; - let [a, [b, [c, ..].., d].., e] = *x; - assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5)); - - let x: &[isize] = x; - let (a, b, c, d, e) = match *x { - [a, [b, [c, ..].., d].., e] => (a, b, c, d, e), - _ => unimplemented!() - }; - - assert_eq!((a, b, c, d, e), (1, 2, 3, 4, 5)); -} - -pub fn main() { - a(); - b(); - b_slice(); - c(); - d(); - e(); - f(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-push.rs b/src/test/ui/run-pass/array-slice-vec/vec-push.rs deleted file mode 100644 index 360568048c0..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-push.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { let mut v = vec![1, 2, 3]; v.push(1); } diff --git a/src/test/ui/run-pass/array-slice-vec/vec-repeat-with-cast.rs b/src/test/ui/run-pass/array-slice-vec/vec-repeat-with-cast.rs deleted file mode 100644 index 650de32fe61..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-repeat-with-cast.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -pub fn main() { let _a = [0; 1 as usize]; } diff --git a/src/test/ui/run-pass/array-slice-vec/vec-slice-drop.rs b/src/test/ui/run-pass/array-slice-vec/vec-slice-drop.rs deleted file mode 100644 index 189d5a38ae3..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-slice-drop.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -// Make sure that destructors get run on slice literals -struct foo<'a> { - x: &'a Cell, -} - -impl<'a> Drop for foo<'a> { - fn drop(&mut self) { - self.x.set(self.x.get() + 1); - } -} - -fn foo(x: &Cell) -> foo { - foo { - x: x - } -} - -pub fn main() { - let x = &Cell::new(0); - { - let l = &[foo(x)]; - assert_eq!(l[0].x.get(), 0); - } - assert_eq!(x.get(), 1); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-slice.rs b/src/test/ui/run-pass/array-slice-vec/vec-slice.rs deleted file mode 100644 index 8ad662f0c63..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-slice.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let v = vec![1,2,3,4,5]; - let v2 = &v[1..3]; - assert_eq!(v2[0], 2); - assert_eq!(v2[1], 3); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-tail-matching.rs b/src/test/ui/run-pass/array-slice-vec/vec-tail-matching.rs deleted file mode 100644 index 46a882a2ae1..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-tail-matching.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(slice_patterns)] - -struct Foo { - string: &'static str -} - -pub fn main() { - let x = [ - Foo { string: "foo" }, - Foo { string: "bar" }, - Foo { string: "baz" } - ]; - match x { - [ref first, ref tail..] => { - assert_eq!(first.string, "foo"); - assert_eq!(tail.len(), 2); - assert_eq!(tail[0].string, "bar"); - assert_eq!(tail[1].string, "baz"); - - match *(tail as &[_]) { - [Foo { .. }, _, Foo { .. }, ref _tail..] => { - unreachable!(); - } - [Foo { string: ref a }, Foo { string: ref b }] => { - assert_eq!("bar", &a[0..a.len()]); - assert_eq!("baz", &b[0..b.len()]); - } - _ => { - unreachable!(); - } - } - } - } -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec-to_str.rs b/src/test/ui/run-pass/array-slice-vec/vec-to_str.rs deleted file mode 100644 index 4facc0e6892..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec-to_str.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - assert_eq!(format!("{:?}", vec![0, 1]), "[0, 1]".to_string()); - - let foo = vec![3, 4]; - let bar: &[isize] = &[4, 5]; - - assert_eq!(format!("{:?}", foo), "[3, 4]"); - assert_eq!(format!("{:?}", bar), "[4, 5]"); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec.rs b/src/test/ui/run-pass/array-slice-vec/vec.rs deleted file mode 100644 index 34a8e125a5c..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let v: Vec = vec![10, 20]; - assert_eq!(v[0], 10); - assert_eq!(v[1], 20); - let mut x: usize = 0; - assert_eq!(v[x], 10); - assert_eq!(v[x + 1], 20); - x = x + 1; - assert_eq!(v[x], 20); - assert_eq!(v[x - 1], 10); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec_cycle.rs b/src/test/ui/run-pass/array-slice-vec/vec_cycle.rs deleted file mode 100644 index 3222b0e789d..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec_cycle.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::cell::Cell; - -#[derive(Debug)] -struct C<'a> { - v: Vec>>>, -} - -impl<'a> C<'a> { - fn new() -> C<'a> { - C { v: Vec::new() } - } -} - -fn f() { - let (mut c1, mut c2, mut c3); - c1 = C::new(); - c2 = C::new(); - c3 = C::new(); - - c1.v.push(Cell::new(None)); - c1.v.push(Cell::new(None)); - c2.v.push(Cell::new(None)); - c2.v.push(Cell::new(None)); - c3.v.push(Cell::new(None)); - c3.v.push(Cell::new(None)); - - c1.v[0].set(Some(&c2)); - c1.v[1].set(Some(&c3)); - c2.v[0].set(Some(&c2)); - c2.v[1].set(Some(&c3)); - c3.v[0].set(Some(&c1)); - c3.v[1].set(Some(&c2)); -} - -fn main() { - f(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vec_cycle_wrapped.rs b/src/test/ui/run-pass/array-slice-vec/vec_cycle_wrapped.rs deleted file mode 100644 index 355f9d3e40e..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vec_cycle_wrapped.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::cell::Cell; - -#[derive(Debug)] -struct Refs<'a> { - v: Vec>>>, -} - -#[derive(Debug)] -struct C<'a> { - refs: Refs<'a>, -} - -impl<'a> Refs<'a> { - fn new() -> Refs<'a> { - Refs { v: Vec::new() } - } -} - -impl<'a> C<'a> { - fn new() -> C<'a> { - C { refs: Refs::new() } - } -} - -fn f() { - let (mut c1, mut c2, mut c3); - c1 = C::new(); - c2 = C::new(); - c3 = C::new(); - - c1.refs.v.push(Cell::new(None)); - c1.refs.v.push(Cell::new(None)); - c2.refs.v.push(Cell::new(None)); - c2.refs.v.push(Cell::new(None)); - c3.refs.v.push(Cell::new(None)); - c3.refs.v.push(Cell::new(None)); - - c1.refs.v[0].set(Some(&c2)); - c1.refs.v[1].set(Some(&c3)); - c2.refs.v[0].set(Some(&c2)); - c2.refs.v[1].set(Some(&c3)); - c3.refs.v[0].set(Some(&c1)); - c3.refs.v[1].set(Some(&c2)); -} - -fn main() { - f(); -} diff --git a/src/test/ui/run-pass/array-slice-vec/vector-no-ann-2.rs b/src/test/ui/run-pass/array-slice-vec/vector-no-ann-2.rs deleted file mode 100644 index 0b09545c0aa..00000000000 --- a/src/test/ui/run-pass/array-slice-vec/vector-no-ann-2.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { let _quux: Box> = box Vec::new(); } diff --git a/src/test/ui/run-pass/associated-consts/associated-const-const-eval.rs b/src/test/ui/run-pass/associated-consts/associated-const-const-eval.rs deleted file mode 100644 index 3ef8e6c2478..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-const-eval.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - const NUM: usize; -} - -impl Foo for i32 { - const NUM: usize = 1; -} - -const FOO: usize = ::NUM; - -fn main() { - assert_eq!(1, FOO); - - match 1 { - ::NUM => {}, - _ => assert!(false) - } -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs b/src/test/ui/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs deleted file mode 100644 index c0f1d93c253..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-cross-crate-const-eval.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:associated-const-cc-lib.rs - - -extern crate associated_const_cc_lib as foolib; - -pub struct LocalFoo; - -impl foolib::Foo for LocalFoo { - const BAR: usize = 1; -} - -const FOO_1: usize = ::BAR; -const FOO_2: usize = ::BAR; -const FOO_3: usize = foolib::InherentBar::BAR; - -fn main() { - assert_eq!(0, FOO_1); - assert_eq!(1, FOO_2); - assert_eq!(3, FOO_3); - - match 0 { - ::BAR => {}, - ::BAR => assert!(false), - foolib::InherentBar::BAR => assert!(false), - _ => assert!(false) - } -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-cross-crate-defaults.rs b/src/test/ui/run-pass/associated-consts/associated-const-cross-crate-defaults.rs deleted file mode 100644 index 7d85c7021ab..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-cross-crate-defaults.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:associated-const-cc-lib.rs - - -extern crate associated_const_cc_lib as foolib; - -pub struct LocalFooUseDefault; - -impl foolib::FooDefault for LocalFooUseDefault {} - -pub struct LocalFooOverwriteDefault; - -impl foolib::FooDefault for LocalFooOverwriteDefault { - const BAR: usize = 4; -} - -fn main() { - assert_eq!(1, ::BAR); - assert_eq!(2, ::BAR); - assert_eq!(1, ::BAR); - assert_eq!(4, ::BAR); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-cross-crate.rs b/src/test/ui/run-pass/associated-consts/associated-const-cross-crate.rs deleted file mode 100644 index 0f1bde4b4db..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-cross-crate.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:associated-const-cc-lib.rs - - -extern crate associated_const_cc_lib as foolib; - -pub struct LocalFoo; - -impl foolib::Foo for LocalFoo { - const BAR: usize = 1; -} - -fn main() { - assert_eq!(0, ::BAR); - assert_eq!(1, ::BAR); - assert_eq!(3, foolib::InherentBar::BAR); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-in-global-const.rs b/src/test/ui/run-pass/associated-consts/associated-const-in-global-const.rs deleted file mode 100644 index 089bf07b9c7..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-in-global-const.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo; - -impl Foo { - const BAR: f32 = 1.5; -} - -const FOOBAR: f32 = ::BAR; - -fn main() { - assert_eq!(1.5f32, FOOBAR); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-inherent-impl.rs b/src/test/ui/run-pass/associated-consts/associated-const-inherent-impl.rs deleted file mode 100644 index 60b794015f9..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-inherent-impl.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo; - -impl Foo { - const ID: i32 = 1; -} - -fn main() { - assert_eq!(1, Foo::ID); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-marks-live-code.rs b/src/test/ui/run-pass/associated-consts/associated-const-marks-live-code.rs deleted file mode 100644 index de9edfc679e..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-marks-live-code.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![deny(dead_code)] - -const GLOBAL_BAR: u32 = 1; - -struct Foo; - -impl Foo { - const BAR: u32 = GLOBAL_BAR; -} - -pub fn main() { - let _: u32 = Foo::BAR; -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-match-patterns.rs b/src/test/ui/run-pass/associated-consts/associated-const-match-patterns.rs deleted file mode 100644 index 9fbce1cebf3..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-match-patterns.rs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:empty-struct.rs - - -extern crate empty_struct; -use empty_struct::XEmpty2 as XFoo; - -struct Foo; - -#[derive(PartialEq, Eq)] -enum Bar { - Var1, - Var2, -} - -// Use inherent and trait impls to test UFCS syntax. -impl Foo { - const MYBAR: Bar = Bar::Var2; -} - -trait HasBar { - const THEBAR: Bar; -} - -impl HasBar for Foo { - const THEBAR: Bar = Bar::Var1; -} - -impl HasBar for XFoo { - const THEBAR: Bar = Bar::Var1; -} - -fn main() { - // Inherent impl - assert!(match Bar::Var2 { - Foo::MYBAR => true, - _ => false, - }); - assert!(match Bar::Var2 { - ::MYBAR => true, - _ => false, - }); - // Trait impl - assert!(match Bar::Var1 { - Foo::THEBAR => true, - _ => false, - }); - assert!(match Bar::Var1 { - ::THEBAR => true, - _ => false, - }); - assert!(match Bar::Var1 { - ::THEBAR => true, - _ => false, - }); - assert!(match Bar::Var1 { - XFoo::THEBAR => true, - _ => false, - }); - assert!(match Bar::Var1 { - ::THEBAR => true, - _ => false, - }); - assert!(match Bar::Var1 { - ::THEBAR => true, - _ => false, - }); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-outer-ty-refs.rs b/src/test/ui/run-pass/associated-consts/associated-const-outer-ty-refs.rs deleted file mode 100644 index c62e073a6a7..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-outer-ty-refs.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Lattice { - const BOTTOM: Self; -} - -impl Lattice for Option { - const BOTTOM: Option = None; -} - -fn main(){} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-overwrite-default.rs b/src/test/ui/run-pass/associated-consts/associated-const-overwrite-default.rs deleted file mode 100644 index 0e225d7117e..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-overwrite-default.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - const ID: i32 = 2; -} - -impl Foo for i32 { - const ID: i32 = 1; -} - -fn main() { - assert_eq!(1, ::ID); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-public-impl.rs b/src/test/ui/run-pass/associated-consts/associated-const-public-impl.rs deleted file mode 100644 index 8c11ae69ded..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-public-impl.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod bar1 { - pub use self::bar2::Foo; - mod bar2 { - pub struct Foo; - - impl Foo { - pub const ID: i32 = 1; - } - } -} - -fn main() { - assert_eq!(1, bar1::Foo::ID); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-range-match-patterns.rs b/src/test/ui/run-pass/associated-consts/associated-const-range-match-patterns.rs deleted file mode 100644 index eeff2775323..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-range-match-patterns.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo; - -trait HasNum { - const NUM: isize; -} -impl HasNum for Foo { - const NUM: isize = 1; -} - -fn main() { - assert!(match 2 { - Foo::NUM ... 3 => true, - _ => false, - }); - assert!(match 0 { - -1 ... ::NUM => true, - _ => false, - }); - assert!(match 1 { - ::NUM ... ::NUM => true, - _ => false, - }); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-resolution-order.rs b/src/test/ui/run-pass/associated-consts/associated-const-resolution-order.rs deleted file mode 100644 index ed02644c6a1..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-resolution-order.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct MyType; - -impl MyType { - const IMPL_IS_INHERENT: bool = true; -} - -trait MyTrait { - const IMPL_IS_INHERENT: bool; - const IMPL_IS_ON_TRAIT: bool; -} - -impl MyTrait for MyType { - const IMPL_IS_INHERENT: bool = false; - const IMPL_IS_ON_TRAIT: bool = true; -} - -fn main() { - // Check that the inherent impl is used before the trait, but that the trait - // can still be accessed. - assert!(::IMPL_IS_INHERENT); - assert!(!::IMPL_IS_INHERENT); - assert!(::IMPL_IS_ON_TRAIT); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-self-type.rs b/src/test/ui/run-pass/associated-consts/associated-const-self-type.rs deleted file mode 100644 index 52d9574edde..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-self-type.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait MyInt { - const ONE: Self; -} - -impl MyInt for i32 { - const ONE: i32 = 1; -} - -fn main() { - assert_eq!(1, ::ONE); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-type-parameters.rs b/src/test/ui/run-pass/associated-consts/associated-const-type-parameters.rs deleted file mode 100644 index 37407b6bf9f..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-type-parameters.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - const X: i32; - fn get_x() -> i32 { - Self::X - } -} - -struct Abc; -impl Foo for Abc { - const X: i32 = 11; -} - -struct Def; -impl Foo for Def { - const X: i32 = 97; -} - -struct Proxy(T); - -impl Foo for Proxy { - const X: i32 = T::X; -} - -fn sub() -> i32 { - A::X - B::X -} - -trait Bar: Foo { - const Y: i32 = Self::X; -} - -fn main() { - assert_eq!(11, Abc::X); - assert_eq!(97, Def::X); - assert_eq!(11, Abc::get_x()); - assert_eq!(97, Def::get_x()); - assert_eq!(-86, sub::()); - assert_eq!(86, sub::()); - assert_eq!(-86, sub::, Def>()); - assert_eq!(-86, sub::>()); - assert_eq!(86, sub::, Proxy>()); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs b/src/test/ui/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs deleted file mode 100644 index 6269222fb8e..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-ufcs-infer-trait.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - const ID: i32; -} - -impl Foo for i32 { - const ID: i32 = 1; -} - -fn main() { - assert_eq!(1, ::ID); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-use-default.rs b/src/test/ui/run-pass/associated-consts/associated-const-use-default.rs deleted file mode 100644 index 623949b2418..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-use-default.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - const ID: i32 = 1; -} - -impl Foo for i32 {} - -fn main() { - assert_eq!(1, ::ID); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs b/src/test/ui/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs deleted file mode 100644 index 80848e5653f..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const-use-impl-of-same-trait.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// The main purpose of this test is to ensure that different impls of the same -// trait can refer to each other without setting off the static recursion check -// (as long as there's no actual recursion). - -trait Foo { - const BAR: u32; -} - -struct IsFoo1; - -impl Foo for IsFoo1 { - const BAR: u32 = 1; -} - -struct IsFoo2; - -impl Foo for IsFoo2 { - const BAR: u32 = ::BAR; -} - -fn main() { - assert_eq!(::BAR, ::BAR); -} diff --git a/src/test/ui/run-pass/associated-consts/associated-const.rs b/src/test/ui/run-pass/associated-consts/associated-const.rs deleted file mode 100644 index c20025c385a..00000000000 --- a/src/test/ui/run-pass/associated-consts/associated-const.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - const ID: i32; -} - -impl Foo for i32 { - const ID: i32 = 1; -} - -fn main() { - assert_eq!(1, ::ID); -} diff --git a/src/test/ui/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs b/src/test/ui/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs deleted file mode 100644 index e4cada40db3..00000000000 --- a/src/test/ui/run-pass/associated-consts/auxiliary/associated-const-cc-lib.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -#![crate_type="lib"] - -// These items are for testing that associated consts work cross-crate. -pub trait Foo { - const BAR: usize; -} - -pub struct FooNoDefault; - -impl Foo for FooNoDefault { - const BAR: usize = 0; -} - -// These test that defaults and default resolution work cross-crate. -pub trait FooDefault { - const BAR: usize = 1; -} - -pub struct FooOverwriteDefault; - -impl FooDefault for FooOverwriteDefault { - const BAR: usize = 2; -} - -pub struct FooUseDefault; - -impl FooDefault for FooUseDefault {} - -// Test inherent impls. -pub struct InherentBar; - -impl InherentBar { - pub const BAR: usize = 3; -} diff --git a/src/test/ui/run-pass/associated-consts/auxiliary/empty-struct.rs b/src/test/ui/run-pass/associated-consts/auxiliary/empty-struct.rs deleted file mode 100644 index 734e57a774d..00000000000 --- a/src/test/ui/run-pass/associated-consts/auxiliary/empty-struct.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct XEmpty1 {} -pub struct XEmpty2; -pub struct XEmpty7(); - -pub enum XE { - XEmpty3 {}, - XEmpty4, - XEmpty6(), -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-basic.rs b/src/test/ui/run-pass/associated-types/associated-types-basic.rs deleted file mode 100644 index 3628f9ce183..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-basic.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - type T; -} - -impl Foo for i32 { - type T = isize; -} - -fn main() { - let x: ::T = 22; - let y: isize = 44; - assert_eq!(x * 2, y); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-binding-in-trait.rs b/src/test/ui/run-pass/associated-types/associated-types-binding-in-trait.rs deleted file mode 100644 index 63ac60e62d9..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-binding-in-trait.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a case where the associated type binding (to `bool`, in this -// case) is derived from the trait definition. Issue #21636. - - -use std::vec; - -pub trait BitIter { - type Iter: Iterator; - fn bit_iter(self) -> ::Iter; -} - -impl BitIter for Vec { - type Iter = vec::IntoIter; - fn bit_iter(self) -> ::Iter { - self.into_iter() - } -} - -fn count(arg: T) -> usize - where T: BitIter -{ - let mut sum = 0; - for i in arg.bit_iter() { - if i { - sum += 1; - } - } - sum -} - -fn main() { - let v = vec![true, false, true]; - let c = count(v); - assert_eq!(c, 2); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-binding-in-where-clause.rs b/src/test/ui/run-pass/associated-types/associated-types-binding-in-where-clause.rs deleted file mode 100644 index 7b735520efb..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-binding-in-where-clause.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test equality constraints on associated types in a where clause. - -// pretty-expanded FIXME #23616 - -pub trait Foo { - type A; - fn boo(&self) -> ::A; -} - -#[derive(PartialEq)] -pub struct Bar; - -impl Foo for isize { - type A = usize; - fn boo(&self) -> usize { 42 } -} - -impl Foo for char { - type A = Bar; - fn boo(&self) -> Bar { Bar } -} - -fn foo_bar>(x: I) -> Bar { - x.boo() -} - -fn foo_uint>(x: I) -> usize { - x.boo() -} - -pub fn main() { - let a = 42; - foo_uint(a); - - let a = 'a'; - foo_bar(a); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-bound.rs b/src/test/ui/run-pass/associated-types/associated-types-bound.rs deleted file mode 100644 index 56ce378da65..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-bound.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test equality constrai32s on associated types in a where clause. - - -pub trait ToI32 { - fn to_i32(&self) -> i32; -} - -impl ToI32 for i32 { - fn to_i32(&self) -> i32 { *self } -} - -impl ToI32 for u32 { - fn to_i32(&self) -> i32 { *self as i32 } -} - -pub trait GetToI32 -{ - type R : ToI32; - - fn get(&self) -> ::R; -} - -impl GetToI32 for i32 { - type R = i32; - fn get(&self) -> i32 { *self } -} - -impl GetToI32 for u32 { - type R = u32; - fn get(&self) -> u32 { *self } -} - -fn foo(g: G) -> i32 - where G : GetToI32 -{ - ToI32::to_i32(&g.get()) -} - -pub fn main() { - assert_eq!(foo(22i32), 22); - assert_eq!(foo(22u32), 22); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-cc.rs b/src/test/ui/run-pass/associated-types/associated-types-cc.rs deleted file mode 100644 index a8c7caa9361..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-cc.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:associated-types-cc-lib.rs - -// Test that we are able to reference cross-crate traits that employ -// associated types. - -extern crate associated_types_cc_lib as bar; - -use bar::Bar; - -fn foo(b: B) -> ::T { - Bar::get(None::) -} - -fn main() { - println!("{}", foo(3)); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-conditional-dispatch.rs b/src/test/ui/run-pass/associated-types/associated-types-conditional-dispatch.rs deleted file mode 100644 index a795ee2c5ef..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-conditional-dispatch.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we evaluate projection predicates to winnow out -// candidates during trait selection and method resolution (#20296). -// If we don't properly winnow out candidates based on the output type -// `Target=[A]`, then the impl marked with `(*)` is seen to conflict -// with all the others. - -// pretty-expanded FIXME #23616 - -use std::marker::PhantomData; -use std::ops::Deref; - -pub trait MyEq { - fn eq(&self, u: &U) -> bool; -} - -impl MyEq<[B]> for [A] - where A : MyEq -{ - fn eq(&self, other: &[B]) -> bool { - self.len() == other.len() && - self.iter().zip(other).all(|(a, b)| MyEq::eq(a, b)) - } -} - -// (*) This impl conflicts with everything unless the `Target=[A]` -// constraint is considered. -impl<'a, A, B, Lhs> MyEq<[B; 0]> for Lhs - where A: MyEq, Lhs: Deref -{ - fn eq(&self, other: &[B; 0]) -> bool { - MyEq::eq(&**self, other) - } -} - -struct DerefWithHelper { - pub helper: H, - pub marker: PhantomData, -} - -trait Helper { - fn helper_borrow(&self) -> &T; -} - -impl Helper for Option { - fn helper_borrow(&self) -> &T { - self.as_ref().unwrap() - } -} - -impl> Deref for DerefWithHelper { - type Target = T; - - fn deref(&self) -> &T { - self.helper.helper_borrow() - } -} - -pub fn check(x: T, y: T) -> bool { - let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), - marker: PhantomData }; - d.eq(&y) -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-constant-type.rs b/src/test/ui/run-pass/associated-types/associated-types-constant-type.rs deleted file mode 100644 index 3581a6c4388..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-constant-type.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait SignedUnsigned { - type Opposite; - fn convert(self) -> Self::Opposite; -} - -impl SignedUnsigned for isize { - type Opposite = usize; - - fn convert(self) -> usize { - self as usize - } -} - -impl SignedUnsigned for usize { - type Opposite = isize; - - fn convert(self) -> isize { - self as isize - } -} - -fn get(x: isize) -> ::Opposite { - x.convert() -} - -fn main() { - let x = get(22); - assert_eq!(22, x); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-doubleendediterator-object.rs b/src/test/ui/run-pass/associated-types/associated-types-doubleendediterator-object.rs deleted file mode 100644 index 4b8ceda9b81..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-doubleendediterator-object.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn pairwise_sub(mut t: Box>) -> isize { - let mut result = 0; - loop { - let front = t.next(); - let back = t.next_back(); - match (front, back) { - (Some(f), Some(b)) => { result += b - f; } - _ => { return result; } - } - } -} - -fn main() { - let v = vec![1, 2, 3, 4, 5, 6]; - let r = pairwise_sub(Box::new(v.into_iter())); - assert_eq!(r, 9); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs deleted file mode 100644 index e6175dc34ec..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that we do not report ambiguities when equivalent predicates -// (modulo bound lifetime names) appears in the environment -// twice. Issue #21965. - -// pretty-expanded FIXME #23616 - -fn foo(t: T) -> i32 - where T : for<'a> Fn(&'a u8) -> i32, - T : for<'b> Fn(&'b u8) -> i32, -{ - t(&3) -} - -fn main() { -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs b/src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs deleted file mode 100644 index 6836d2860b5..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that we do not report ambiguities when the same predicate -// appears in the environment twice. Issue #21965. - -// pretty-expanded FIXME #23616 - -trait Foo { - type B; - - fn get() -> Self::B; -} - -fn foo() -> () - where T : Foo, T : Foo -{ - ::get() -} - -fn main() { -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-enum-field-named.rs b/src/test/ui/run-pass/associated-types/associated-types-enum-field-named.rs deleted file mode 100644 index d21195c3d3a..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-enum-field-named.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test associated types appearing in struct-like enum variants. - - -use self::VarValue::*; - -pub trait UnifyKey { - type Value; - fn to_index(&self) -> usize; -} - -pub enum VarValue { - Redirect { to: K }, - Root { value: K::Value, rank: usize }, -} - -fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { - match table[key.to_index()] { - VarValue::Redirect { to: ref k } => get(table, k), - VarValue::Root { value: ref v, rank: _ } => v, - } -} - -impl UnifyKey for usize { - type Value = Option; - fn to_index(&self) -> usize { *self } -} - -fn main() { - let table = vec![/* 0 */ Redirect { to: 1 }, - /* 1 */ Redirect { to: 3 }, - /* 2 */ Root { value: Some('x'), rank: 0 }, - /* 3 */ Redirect { to: 2 }]; - assert_eq!(get(&table, &0), &Some('x')); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-enum-field-numbered.rs b/src/test/ui/run-pass/associated-types/associated-types-enum-field-numbered.rs deleted file mode 100644 index 9a91a998201..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-enum-field-numbered.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test associated types appearing in tuple-like enum variants. - - -use self::VarValue::*; - -pub trait UnifyKey { - type Value; - fn to_index(&self) -> usize; -} - -pub enum VarValue { - Redirect(K), - Root(K::Value, usize), -} - -fn get<'a,K:UnifyKey>,V>(table: &'a Vec>, key: &K) -> &'a Option { - match table[key.to_index()] { - VarValue::Redirect(ref k) => get(table, k), - VarValue::Root(ref v, _) => v, - } -} - -impl UnifyKey for usize { - type Value = Option; - fn to_index(&self) -> usize { *self } -} - -fn main() { - let table = vec![/* 0 */ Redirect(1), - /* 1 */ Redirect(3), - /* 2 */ Root(Some('x'), 0), - /* 3 */ Redirect(2)]; - assert_eq!(get(&table, &0), &Some('x')); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-eq-obj.rs b/src/test/ui/run-pass/associated-types/associated-types-eq-obj.rs deleted file mode 100644 index 75fe2093da9..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-eq-obj.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test equality constraints on associated types inside of an object type - -// pretty-expanded FIXME #23616 - -pub trait Foo { - type A; - fn boo(&self) -> ::A; -} - -pub struct Bar; - -impl Foo for char { - type A = Bar; - fn boo(&self) -> Bar { Bar } -} - -fn baz(x: &Foo) -> Bar { - x.boo() -} - -pub fn main() { - let a = 'a'; - baz(&a); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-impl-redirect.rs b/src/test/ui/run-pass/associated-types/associated-types-impl-redirect.rs deleted file mode 100644 index aca76748925..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-impl-redirect.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test how resolving a projection interacts with inference. In this -// case, we were eagerly unifying the type variable for the iterator -// type with `I` from the where clause, ignoring the in-scope `impl` -// for `ByRef`. The right answer was to consider the result ambiguous -// until more type information was available. - -#![feature(lang_items)] -#![no_implicit_prelude] - -use std::marker::Sized; -use std::option::Option::{None, Some, self}; - -trait Iterator { - type Item; - - fn next(&mut self) -> Option; -} - -trait IteratorExt: Iterator + Sized { - fn by_ref(&mut self) -> ByRef { - ByRef(self) - } -} - -impl IteratorExt for I where I: Iterator {} - -struct ByRef<'a, I: 'a + Iterator>(&'a mut I); - -impl<'a, I: Iterator> Iterator for ByRef<'a, I> { - type Item = I::Item; - - fn next(&mut self) -> Option< ::Item > { - self.0.next() - } -} - -fn is_iterator_of>(_: &I) {} - -fn test>(mut it: I) { - is_iterator_of::(&it.by_ref()); -} - -fn test2, I2: Iterator>(mut it: I2) { - is_iterator_of::(&it) -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-in-bound-type-arg.rs b/src/test/ui/run-pass/associated-types/associated-types-in-bound-type-arg.rs deleted file mode 100644 index a80350a596e..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-in-bound-type-arg.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test the case where we resolve `C::Result` and the trait bound -// itself includes a `Self::Item` shorthand. -// -// Regression test for issue #33425. - -trait ParallelIterator { - type Item; - fn drive_unindexed(self, consumer: C) -> C::Result - where C: Consumer; -} - -pub trait Consumer { - type Result; -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-in-default-method.rs b/src/test/ui/run-pass/associated-types/associated-types-in-default-method.rs deleted file mode 100644 index 846dfcd2141..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-in-default-method.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Get { - type Value; - fn get(&self) -> &::Value; - fn grab(&self) -> &::Value { - self.get() - } -} - -struct Struct { - x: isize, -} - -impl Get for Struct { - type Value = isize; - fn get(&self) -> &isize { - &self.x - } -} - -fn main() { - let s = Struct { - x: 100, - }; - assert_eq!(*s.grab(), 100); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-in-fn.rs b/src/test/ui/run-pass/associated-types/associated-types-in-fn.rs deleted file mode 100644 index 555c74dd70a..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-in-fn.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Get { - type Value; - fn get(&self) -> &::Value; -} - -struct Struct { - x: isize, -} - -impl Get for Struct { - type Value = isize; - fn get(&self) -> &isize { - &self.x - } -} - -fn grab(x: &T) -> &::Value { - x.get() -} - -fn main() { - let s = Struct { - x: 100, - }; - assert_eq!(*grab(&s), 100); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-in-impl-generics.rs b/src/test/ui/run-pass/associated-types/associated-types-in-impl-generics.rs deleted file mode 100644 index d27c1dd296e..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-in-impl-generics.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Get { - type Value; - fn get(&self) -> &::Value; -} - -struct Struct { - x: isize, -} - -impl Get for Struct { - type Value = isize; - fn get(&self) -> &isize { - &self.x - } -} - -trait Grab { - type U; - fn grab(&self) -> &::U; -} - -impl Grab for T { - type U = ::Value; - fn grab(&self) -> &::Value { - self.get() - } -} - -fn main() { - let s = Struct { - x: 100, - }; - assert_eq!(*s.grab(), 100); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-in-inherent-method.rs b/src/test/ui/run-pass/associated-types/associated-types-in-inherent-method.rs deleted file mode 100644 index f68ab8cd610..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-in-inherent-method.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Get { - type Value; - fn get(&self) -> &::Value; -} - -struct Struct { - x: isize, -} - -impl Get for Struct { - type Value = isize; - fn get(&self) -> &isize { - &self.x - } -} - -impl Struct { - fn grab(x: &T) -> &::Value { - x.get() - } -} - -fn main() { - let s = Struct { - x: 100, - }; - assert_eq!(*Struct::grab(&s), 100); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-issue-20220.rs b/src/test/ui/run-pass/associated-types/associated-types-issue-20220.rs deleted file mode 100644 index e2a87382fba..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-issue-20220.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test references to `Self::Item` in the trait. Issue #20220. - - -use std::vec; - -trait IntoIteratorX { - type Item; - type IntoIter: Iterator; - - fn into_iter_x(self) -> Self::IntoIter; -} - -impl IntoIteratorX for Vec { - type Item = T; - type IntoIter = vec::IntoIter; - - fn into_iter_x(self) -> vec::IntoIter { - self.into_iter() - } -} - -fn main() { - let vec = vec![1, 2, 3]; - for (i, e) in vec.into_iter().enumerate() { - assert_eq!(i+1, e); - } -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-issue-20371.rs b/src/test/ui/run-pass/associated-types/associated-types-issue-20371.rs deleted file mode 100644 index 54f1d2e8126..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-issue-20371.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to have an impl that defines an associated type -// before the actual trait. - -// pretty-expanded FIXME #23616 - -impl X for f64 { type Y = isize; } -trait X { type Y; } -fn main() {} diff --git a/src/test/ui/run-pass/associated-types/associated-types-issue-21212.rs b/src/test/ui/run-pass/associated-types/associated-types-issue-21212.rs deleted file mode 100644 index 259661dc058..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-issue-21212.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #21212: an overflow occurred during trait -// checking where normalizing `Self::Input` led to normalizing the -// where clauses in the environment which in turn required normalizing -// `Self::Input`. - - -pub trait Parser { - type Input; - - fn parse(input: ::Input) { - panic!() - } -} - -impl

Parser for P { - type Input = (); -} - -fn main() { -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-iterator-binding.rs b/src/test/ui/run-pass/associated-types/associated-types-iterator-binding.rs deleted file mode 100644 index eab66a94129..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-iterator-binding.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn pairwise_sub>(mut t: T) -> isize { - let mut result = 0; - loop { - let front = t.next(); - let back = t.next_back(); - match (front, back) { - (Some(f), Some(b)) => { result += b - f; } - _ => { return result; } - } - } -} - -fn main() { - let v = vec![1, 2, 3, 4, 5, 6]; - let r = pairwise_sub(v.into_iter()); - assert_eq!(r, 9); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-method.rs b/src/test/ui/run-pass/associated-types/associated-types-method.rs deleted file mode 100644 index 73d075313ad..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-method.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that methods whose impl-trait-ref contains associated types -// are supported. - -trait Device { - type Resources; -} -struct Foo(D, R); - -trait Tr { - fn present(&self) {} -} - -impl Tr for Foo { - fn present(&self) {} -} - -struct Res; -struct Dev; -impl Device for Dev { - type Resources = Res; -} - -fn main() { - let foo = Foo(Dev, Res); - foo.present(); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-nested-projections.rs b/src/test/ui/run-pass/associated-types/associated-types-nested-projections.rs deleted file mode 100644 index a877a3cfa9d..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-nested-projections.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can resolve nested projection types. Issue #20666. - -// pretty-expanded FIXME #23616 - -use std::slice; - -trait Bound {} - -impl<'a> Bound for &'a i32 {} - -trait IntoIterator { - type Iter: Iterator; - - fn into_iter(self) -> Self::Iter; -} - -impl<'a, T> IntoIterator for &'a [T; 3] { - type Iter = slice::Iter<'a, T>; - - fn into_iter(self) -> slice::Iter<'a, T> { - self.iter() - } -} - -fn foo(x: X) where - X: IntoIterator, - <::Iter as Iterator>::Item: Bound, -{ -} - -fn bar(x: X) where - T: Bound, - I: Iterator, - X: IntoIterator, -{ - -} - -fn main() { - foo(&[0, 1, 2]); - bar(&[0, 1, 2]); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs b/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs deleted file mode 100644 index d989e08e808..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we normalize associated types that appear in a bound that -// contains a binding. Issue #21664. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -pub trait Integral { - type Opposite; -} - -impl Integral for i32 { - type Opposite = u32; -} - -impl Integral for u32 { - type Opposite = i32; -} - -pub trait FnLike { - type R; - - fn dummy(&self, a: A) -> Self::R { loop { } } -} - -fn foo() - where T : FnLike<::Opposite, R=bool> -{ - bar::(); -} - -fn bar() - where T : FnLike -{} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs b/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs deleted file mode 100644 index 3d3540bbf72..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we normalize associated types that appear in bounds; if -// we didn't, the call to `self.split2()` fails to type check. - -// pretty-expanded FIXME #23616 - -use std::marker::PhantomData; - -struct Splits<'a, T:'a, P>(PhantomData<(&'a T, P)>); -struct SplitsN(PhantomData); - -trait SliceExt2 { - type Item; - - fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> - where P: FnMut(&Self::Item) -> bool; - fn splitn2<'a, P>(&'a self, n: u32, pred: P) -> SplitsN> - where P: FnMut(&Self::Item) -> bool; -} - -impl SliceExt2 for [T] { - type Item = T; - - fn split2

(&self, pred: P) -> Splits where P: FnMut(&T) -> bool { - loop {} - } - - fn splitn2

(&self, n: u32, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { - SliceExt2::split2(self, pred); - loop {} - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds.rs b/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds.rs deleted file mode 100644 index 79d23c3999e..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-normalize-in-bounds.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we normalize associated types that appear in bounds; if -// we didn't, the call to `self.split2()` fails to type check. - -// pretty-expanded FIXME #23616 - -use std::marker::PhantomData; - -struct Splits<'a, T, P>(PhantomData<(&'a(),T,P)>); -struct SplitsN(PhantomData); - -trait SliceExt2 { - type Item; - - fn split2<'a, P>(&'a self, pred: P) -> Splits<'a, Self::Item, P> - where P: FnMut(&Self::Item) -> bool; - fn splitn2<'a, P>(&'a self, n: usize, pred: P) -> SplitsN> - where P: FnMut(&Self::Item) -> bool; -} - -impl SliceExt2 for [T] { - type Item = T; - - fn split2

(&self, pred: P) -> Splits where P: FnMut(&T) -> bool { - loop {} - } - - fn splitn2

(&self, n: usize, pred: P) -> SplitsN> where P: FnMut(&T) -> bool { - self.split2(pred); - loop {} - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-normalize-unifield-struct.rs b/src/test/ui/run-pass/associated-types/associated-types-normalize-unifield-struct.rs deleted file mode 100644 index 03d712b110d..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-normalize-unifield-struct.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #21010: Normalize associated types in -// various special paths in the `type_is_immediate` function. - -pub trait OffsetState: Sized {} -pub trait Offset { - type State: OffsetState; - fn dummy(&self) { } -} - -#[derive(Copy, Clone)] pub struct X; -impl Offset for X { type State = Y; } - -#[derive(Copy, Clone)] pub struct Y; -impl OffsetState for Y {} - -pub fn now() -> DateTime { from_utc(Y) } - -pub struct DateTime { pub offset: Off::State } -pub fn from_utc(offset: Off::State) -> DateTime { DateTime { offset: offset } } - -pub fn main() { - let _x = now(); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs b/src/test/ui/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs deleted file mode 100644 index f21bbddc4dd..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-project-from-type-param-via-bound-in-where.rs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Various uses of `T::Item` syntax where the bound that supplies -// `Item` originates in a where-clause, not the declaration of -// `T`. Issue #20300. - -use std::marker::{PhantomData}; -use std::sync::atomic::{AtomicUsize}; -use std::sync::atomic::Ordering::SeqCst; - -static COUNTER: AtomicUsize = AtomicUsize::new(0); - -// Preamble. -trait Trait { type Item; } -struct Struct; -impl Trait for Struct { - type Item = u32; -} - -// Where-clause attached on the method which declares `T`. -struct A; -impl A { - fn foo(_x: T::Item) where T: Trait { - COUNTER.fetch_add(1, SeqCst); - } -} - -// Where-clause attached on the method to a parameter from the struct. -struct B(PhantomData); -impl B { - fn foo(_x: T::Item) where T: Trait { - COUNTER.fetch_add(10, SeqCst); - } -} - -// Where-clause attached to free fn. -fn c(_: T::Item) where T : Trait { - COUNTER.fetch_add(100, SeqCst); -} - -// Where-clause attached to defaulted and non-defaulted trait method. -trait AnotherTrait { - fn method(&self, _: T::Item) where T: Trait; - fn default_method(&self, _: T::Item) where T: Trait { - COUNTER.fetch_add(1000, SeqCst); - } -} -struct D; -impl AnotherTrait for D { - fn method(&self, _: T::Item) where T: Trait { - COUNTER.fetch_add(10000, SeqCst); - } -} - -// Where-clause attached to trait and impl containing the method. -trait YetAnotherTrait - where T : Trait -{ - fn method(&self, _: T::Item); - fn default_method(&self, _: T::Item) { - COUNTER.fetch_add(100000, SeqCst); - } -} -struct E(PhantomData); -impl YetAnotherTrait for E - where T : Trait -{ - fn method(&self, _: T::Item) { - COUNTER.fetch_add(1000000, SeqCst); - } -} - -// Where-clause attached to inherent impl containing the method. -struct F(PhantomData); -impl F where T : Trait { - fn method(&self, _: T::Item) { - COUNTER.fetch_add(10000000, SeqCst); - } -} - -// Where-clause attached to struct. -#[allow(dead_code)] -struct G where T : Trait { - data: T::Item, - phantom: PhantomData, -} - -fn main() { - A::foo::(22); - B::::foo(22); - c::(22); - D.method::(22); - D.default_method::(22); - E(PhantomData::).method(22); - E(PhantomData::).default_method(22); - F(PhantomData::).method(22); - G:: { data: 22, phantom: PhantomData }; - assert_eq!(COUNTER.load(SeqCst), 11111111); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs b/src/test/ui/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs deleted file mode 100644 index 57c7f557ffa..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we correctly handle projection bounds appearing in the -// supertrait list (and in conjunction with overloaded operators). In -// this case, the `Result=Self` binding in the supertrait listing of -// `Int` was being ignored. - -trait Not { - type Result; - - fn not(self) -> Self::Result; -} - -trait Int: Not + Sized { - fn count_ones(self) -> usize; - fn count_zeros(self) -> usize { - // neither works - let x: Self = self.not(); - 0 - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs b/src/test/ui/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs deleted file mode 100644 index 964eb886236..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-projection-from-known-type-in-impl.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test where the impl self type uses a projection from a constant type. - - -trait Int -{ - type T; - - fn dummy(&self) { } -} - -trait NonZero -{ - fn non_zero(self) -> bool; -} - -impl Int for i32 { type T = i32; } -impl Int for i64 { type T = i64; } -impl Int for u32 { type T = u32; } -impl Int for u64 { type T = u64; } - -impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } -impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } -impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } -impl NonZero for ::T { fn non_zero(self) -> bool { self != 0 } } - -fn main () -{ - assert!(NonZero::non_zero(22_i32)); - assert!(NonZero::non_zero(22_i64)); - assert!(NonZero::non_zero(22_u32)); - assert!(NonZero::non_zero(22_u64)); - - assert!(!NonZero::non_zero(0_i32)); - assert!(!NonZero::non_zero(0_i64)); - assert!(!NonZero::non_zero(0_u32)); - assert!(!NonZero::non_zero(0_u64)); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-projection-in-object-type.rs b/src/test/ui/run-pass/associated-types/associated-types-projection-in-object-type.rs deleted file mode 100644 index 8b98325598c..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-projection-in-object-type.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Corrected regression test for #20831. The original did not compile. -// When fixed, it revealed another problem concerning projections that -// appear in associated type bindings in object types, which were not -// being properly flagged. - -// pretty-expanded FIXME #23616 - -use std::ops::{Shl, Shr}; -use std::cell::RefCell; - -pub trait Subscriber { - type Input; - - fn dummy(&self) { } -} - -pub trait Publisher<'a> { - type Output; - fn subscribe(&mut self, _: Box + 'a>); -} - -pub trait Processor<'a> : Subscriber + Publisher<'a> { } - -impl<'a, P> Processor<'a> for P where P : Subscriber + Publisher<'a> { } - -struct MyStruct<'a> { - sub: Box + 'a> -} - -impl<'a> Publisher<'a> for MyStruct<'a> { - type Output = u64; - fn subscribe(&mut self, t : Box + 'a>) { - self.sub = t; - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/associated-types/associated-types-projection-in-supertrait.rs b/src/test/ui/run-pass/associated-types/associated-types-projection-in-supertrait.rs deleted file mode 100644 index 001faef7f48..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-projection-in-supertrait.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are handle to correctly handle a projection type -// that appears in a supertrait bound. Issue #20559. - - -trait A -{ - type TA; - - fn dummy(&self) { } -} - -trait B -{ - fn foo (&self, t : TB) -> String; -} - -trait C : B<::TA> { } - -struct X; - -impl A for X -{ - type TA = i32; -} - -struct Y; - -impl C for Y { } - -// Both of these impls are required for successful compilation -impl B for Y -{ - fn foo (&self, t : i32) -> String - { - format!("First {}", t) - } -} - -fn main () -{ - let y = Y; - assert_eq!(y.foo(5), format!("First 5")); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-projection-in-where-clause.rs b/src/test/ui/run-pass/associated-types/associated-types-projection-in-where-clause.rs deleted file mode 100644 index c2379e0f078..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-projection-in-where-clause.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a where clause that uses a non-normalized projection type. - -// pretty-expanded FIXME #23616 - -trait Int -{ - type T; - - fn dummy(&self) { } -} - -trait NonZero -{ - fn non_zero(self) -> bool; -} - -fn foo,J>(t: I) -> bool - where ::T : NonZero - // ^~~~~~~~~~~~~ canonical form is just J -{ - bar::() -} - -fn bar() -> bool { true } - -fn main () -{ -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs b/src/test/ui/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs deleted file mode 100644 index f6951b48ae7..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-projection-to-unrelated-trait.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that we do not get an error when you use `::Value` in -// the trait definition if there is no default method and for every impl, -// `Self` does implement `Get`. -// -// See also compile-fail tests associated-types-no-suitable-supertrait -// and associated-types-no-suitable-supertrait-2, which show how small -// variants of the code below can fail. - -trait Get { - type Value; -} - -trait Other { - fn okay(&self, foo: U, bar: ::Value) - where Self: Get; -} - -impl Get for () { - type Value = f32; -} - -impl Get for f64 { - type Value = u32; -} - -impl Other for () { - fn okay(&self, _foo: U, _bar: ::Value) { } -} - -impl Other for f64 { - fn okay(&self, _foo: U, _bar: ::Value) { } -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs b/src/test/ui/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs deleted file mode 100644 index b3d5c353989..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-qualified-path-with-trait-with-type-parameters.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Foo { - type Bar; - fn get_bar() -> >::Bar; -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/associated-types-ref-from-struct.rs b/src/test/ui/run-pass/associated-types/associated-types-ref-from-struct.rs deleted file mode 100644 index e45766adc2c..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-ref-from-struct.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test associated type references in structure fields. - -// pretty-expanded FIXME #23616 - -trait Test { - type V; - - fn test(&self, value: &Self::V) -> bool; -} - -/////////////////////////////////////////////////////////////////////////// - -struct TesterPair { - tester: T, - value: T::V, -} - -impl TesterPair { - fn new(tester: T, value: T::V) -> TesterPair { - TesterPair { tester: tester, value: value } - } - - fn test(&self) -> bool { - self.tester.test(&self.value) - } -} - -/////////////////////////////////////////////////////////////////////////// - -struct EqU32(u32); -impl Test for EqU32 { - type V = u32; - - fn test(&self, value: &u32) -> bool { - self.0 == *value - } -} - -struct EqI32(i32); -impl Test for EqI32 { - type V = i32; - - fn test(&self, value: &i32) -> bool { - self.0 == *value - } -} - -fn main() { - let tester = TesterPair::new(EqU32(22), 23); - tester.test(); - - let tester = TesterPair::new(EqI32(22), 23); - tester.test(); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-ref-in-struct-literal.rs b/src/test/ui/run-pass/associated-types/associated-types-ref-in-struct-literal.rs deleted file mode 100644 index 02e1d74db47..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-ref-in-struct-literal.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test associated type references in a struct literal. Issue #20535. - - -pub trait Foo { - type Bar; - - fn dummy(&self) { } -} - -impl Foo for isize { - type Bar = isize; -} - -struct Thing { - a: F, - b: F::Bar, -} - -fn main() { - let thing = Thing{a: 1, b: 2}; - assert_eq!(thing.a + 1, thing.b); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs b/src/test/ui/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs deleted file mode 100644 index b4038a21828..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #20582. This test caused an ICE related to -// inconsistent region erasure in codegen. - -// pretty-expanded FIXME #23616 - -struct Foo<'a> { - buf: &'a[u8] -} - -impl<'a> Iterator for Foo<'a> { - type Item = &'a[u8]; - - fn next(&mut self) -> Option<::Item> { - Some(self.buf) - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-resolve-lifetime.rs b/src/test/ui/run-pass/associated-types/associated-types-resolve-lifetime.rs deleted file mode 100644 index b77f3fcd295..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-resolve-lifetime.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Get { - fn get(&self) -> T; -} - -trait Trait<'a> { - type T: 'static; - type U: Get<&'a isize>; - - fn dummy(&'a self) { } -} - -fn main() {} diff --git a/src/test/ui/run-pass/associated-types/associated-types-return.rs b/src/test/ui/run-pass/associated-types/associated-types-return.rs deleted file mode 100644 index 18b05987715..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-return.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test equality constraints on associated types in a where clause. - - -pub trait Foo { - type A; - fn boo(&self) -> ::A; -} - -#[derive(PartialEq, Debug)] -pub struct Bar; - -impl Foo for isize { - type A = usize; - fn boo(&self) -> usize { 42 } -} - -impl Foo for Bar { - type A = isize; - fn boo(&self) -> isize { 43 } -} - -impl Foo for char { - type A = Bar; - fn boo(&self) -> Bar { Bar } -} - -fn foo1>(x: I) -> Bar { - x.boo() -} - -fn foo2(x: I) -> ::A { - x.boo() -} - -pub fn main() { - let a = 42; - assert_eq!(foo2(a), 42); - - let a = Bar; - assert_eq!(foo2(a), 43); - - let a = 'a'; - foo1(a); - assert_eq!(foo2(a), Bar); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-simple.rs b/src/test/ui/run-pass/associated-types/associated-types-simple.rs deleted file mode 100644 index 8e9b2367fcd..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-simple.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Get { - type Value; - fn get(&self) -> &::Value; -} - -struct Struct { - x: isize, -} - -impl Get for Struct { - type Value = isize; - fn get(&self) -> &isize { - &self.x - } -} - -fn main() { - let s = Struct { - x: 100, - }; - assert_eq!(*s.get(), 100); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-stream.rs b/src/test/ui/run-pass/associated-types/associated-types-stream.rs deleted file mode 100644 index c486e346351..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-stream.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test references to the trait `Stream` in the bounds for associated -// types defined on `Stream`. Issue #20551. - - -trait Stream { - type Car; - type Cdr: Stream; - - fn car(&self) -> Self::Car; - fn cdr(self) -> Self::Cdr; -} - -impl Stream for () { - type Car = (); - type Cdr = (); - fn car(&self) -> () { () } - fn cdr(self) -> () { self } -} - -impl Stream for (T, U) - where T : Clone, U : Stream -{ - type Car = T; - type Cdr = U; - fn car(&self) -> T { self.0.clone() } - fn cdr(self) -> U { self.1 } -} - -fn main() { - let p = (22, (44, (66, ()))); - assert_eq!(p.car(), 22); - - let p = p.cdr(); - assert_eq!(p.car(), 44); - - let p = p.cdr(); - assert_eq!(p.car(), 66); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-struct-field-named.rs b/src/test/ui/run-pass/associated-types/associated-types-struct-field-named.rs deleted file mode 100644 index 384ec8ef44f..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-struct-field-named.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we correctly normalize the type of a struct field -// which has an associated type. - - -pub trait UnifyKey { - type Value; - - fn dummy(&self) { } -} - -pub struct Node { - pub key: K, - pub value: K::Value, -} - -fn foo>,V : Clone>(node: &Node) -> Option { - node.value.clone() -} - -impl UnifyKey for i32 { - type Value = Option; -} - -impl UnifyKey for u32 { - type Value = Option; -} - -pub fn main() { - let node: Node = Node { key: 1, value: Some(22) }; - assert_eq!(foo(&node), Some(22)); - - let node: Node = Node { key: 1, value: Some(22) }; - assert_eq!(foo(&node), Some(22)); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-struct-field-numbered.rs b/src/test/ui/run-pass/associated-types/associated-types-struct-field-numbered.rs deleted file mode 100644 index 54d0c8839a3..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-struct-field-numbered.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we correctly normalize the type of a struct field -// which has an associated type. - - -pub trait UnifyKey { - type Value; - - fn dummy(&self) { } -} - -pub struct Node(K, K::Value); - -fn foo>,V : Clone>(node: &Node) -> Option { - node.1.clone() -} - -impl UnifyKey for i32 { - type Value = Option; -} - -impl UnifyKey for u32 { - type Value = Option; -} - -pub fn main() { - let node: Node = Node(1, Some(22)); - assert_eq!(foo(&node), Some(22)); - - let node: Node = Node(1, Some(22)); - assert_eq!(foo(&node), Some(22)); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-sugar-path.rs b/src/test/ui/run-pass/associated-types/associated-types-sugar-path.rs deleted file mode 100644 index 3b148c5e106..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-sugar-path.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test paths to associated types using the type-parameter-only sugar. - -use std::ops::Deref; - -pub trait Foo { - type A; - fn boo(&self) -> Self::A; -} - -impl Foo for isize { - type A = usize; - fn boo(&self) -> usize { - 5 - } -} - -// Using a type via a function. -pub fn bar(a: T, x: T::A) -> T::A { - let _: T::A = a.boo(); - x -} - -// Using a type via an impl. -trait C { - fn f(); - fn g(&self) { } -} -struct B(X); -impl C for B { - fn f() { - let x: T::A = panic!(); - } -} - -pub fn main() { - let z: usize = bar(2, 4); -} diff --git a/src/test/ui/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs b/src/test/ui/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs deleted file mode 100644 index 5f24a44c14b..00000000000 --- a/src/test/ui/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test how resolving a projection interacts with inference. In this -// case, we were eagerly unifying the type variable for the iterator -// type with `I` from the where clause, ignoring the in-scope `impl` -// for `ByRef`. The right answer was to consider the result ambiguous -// until more type information was available. - -#![feature(lang_items)] -#![no_implicit_prelude] - -use std::marker::Sized; -use std::option::Option::{None, Some, self}; - -trait Iterator { - type Item; - - fn next(&mut self) -> Option; -} - -trait IteratorExt: Iterator + Sized { - fn by_ref(&mut self) -> ByRef { - ByRef(self) - } -} - -impl IteratorExt for I where I: Iterator {} - -struct ByRef<'a, I: 'a + Iterator>(&'a mut I); - -impl<'a, A, I> Iterator for ByRef<'a, I> where I: Iterator { - type Item = A; - - fn next(&mut self) -> Option< ::Item > { - self.0.next() - } -} - -fn is_iterator_of>(_: &I) {} - -fn test>(mut it: I) { - is_iterator_of::(&it.by_ref()); -} - -fn main() { } diff --git a/src/test/ui/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs b/src/test/ui/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs deleted file mode 100644 index 175e8730cbc..00000000000 --- a/src/test/ui/run-pass/associated-types/auxiliary/associated-types-cc-lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Helper for test issue-18048, which tests associated types in a -// cross-crate scenario. - -#![crate_type="lib"] - -pub trait Bar: Sized { - type T; - - fn get(x: Option) -> ::T; -} - -impl Bar for isize { - type T = usize; - - fn get(_: Option) -> usize { 22 } -} diff --git a/src/test/ui/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs b/src/test/ui/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs deleted file mode 100644 index d984531b8bb..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/auto-ref-bounded-ty-param.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - fn f(&self); -} - -struct Bar { - x: isize -} - -trait Baz { - fn g(&self); -} - -impl Foo for T { - fn f(&self) { - self.g(); - } -} - -impl Baz for Bar { - fn g(&self) { - println!("{}", self.x); - } -} - -pub fn main() { - let y = Bar { x: 42 }; - y.f(); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/auto-ref-sliceable.rs b/src/test/ui/run-pass/autoref-autoderef/auto-ref-sliceable.rs deleted file mode 100644 index 6e665b07656..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/auto-ref-sliceable.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait Pushable { - fn push_val(&mut self, t: T); -} - -impl Pushable for Vec { - fn push_val(&mut self, t: T) { - self.push(t); - } -} - -pub fn main() { - let mut v = vec![1]; - v.push_val(2); - v.push_val(3); - assert_eq!(v, [1, 2, 3]); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/auto-ref.rs b/src/test/ui/run-pass/autoref-autoderef/auto-ref.rs deleted file mode 100644 index afc79cce35e..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/auto-ref.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - x: isize, -} - -trait Stuff { - fn printme(&self); -} - -impl Stuff for Foo { - fn printme(&self) { - println!("{}", self.x); - } -} - -pub fn main() { - let x = Foo { x: 3 }; - x.printme(); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs deleted file mode 100644 index 0ce3ef7fd7b..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo { - x: isize, -} - -impl Foo { - pub fn f(&self) {} -} - -fn g(x: &mut Foo) { - x.f(); -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-on-trait.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-method-on-trait.rs deleted file mode 100644 index 8116a311eb4..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-on-trait.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -trait double { - fn double(self: Box) -> usize; -} - -impl double for usize { - fn double(self: Box) -> usize { *self * 2 } -} - -pub fn main() { - let x: Box<_> = box (box 3usize as Box); - assert_eq!(x.double(), 6); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-priority.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-method-priority.rs deleted file mode 100644 index 2b148395003..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-priority.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -trait double { - fn double(self) -> usize; -} - -impl double for usize { - fn double(self) -> usize { self } -} - -impl double for Box { - fn double(self) -> usize { *self * 2 } -} - -pub fn main() { - let x: Box<_> = box 3; - assert_eq!(x.double(), 6); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs deleted file mode 100644 index 14c57b07519..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice-but-not-thrice.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -trait double { - fn double(self: Box) -> usize; -} - -impl double for Box { - fn double(self: Box>) -> usize { **self * 2 } -} - -pub fn main() { - let x: Box>>>> = box box box box box 3; - assert_eq!(x.double(), 6); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice.rs deleted file mode 100644 index 5185d0ee749..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-method-twice.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -trait double { - fn double(self: Box) -> usize; -} - -impl double for usize { - fn double(self: Box) -> usize { *self * 2 } -} - -pub fn main() { - let x: Box> = box box 3; - assert_eq!(x.double(), 6); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-method.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-method.rs deleted file mode 100644 index 398ccde8894..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-method.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -trait double { - fn double(self: Box) -> usize; -} - -impl double for usize { - fn double(self: Box) -> usize { *self * 2 } -} - -pub fn main() { - let x: Box<_> = box 3; - assert_eq!(x.double(), 6); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoderef-privacy.rs b/src/test/ui/run-pass/autoref-autoderef/autoderef-privacy.rs deleted file mode 100644 index cfbc7744a4c..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoderef-privacy.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check we do not select a private method or field when computing autoderefs - -#![allow(unused)] - -#[derive(Default)] -pub struct Bar2 { i: i32 } -#[derive(Default)] -pub struct Baz2(i32); - -impl Bar2 { - fn f(&self) -> bool { true } -} - -mod foo { - #[derive(Default)] - pub struct Bar { i: ::Bar2 } - #[derive(Default)] - pub struct Baz(::Baz2); - - impl Bar { - fn f(&self) -> bool { false } - } - - impl ::std::ops::Deref for Bar { - type Target = ::Bar2; - fn deref(&self) -> &::Bar2 { &self.i } - } - - impl ::std::ops::Deref for Baz { - type Target = ::Baz2; - fn deref(&self) -> &::Baz2 { &self.0 } - } - - pub fn f(bar: &Bar, baz: &Baz) { - // Since the private fields and methods are visible here, there should be no autoderefs. - let _: &::Bar2 = &bar.i; - let _: &::Baz2 = &baz.0; - assert!(!bar.f()); - } -} - -fn main() { - let bar = foo::Bar::default(); - let baz = foo::Baz::default(); - foo::f(&bar, &baz); - - let _: i32 = bar.i; - let _: i32 = baz.0; - assert!(bar.f()); -} diff --git a/src/test/ui/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs b/src/test/ui/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs deleted file mode 100644 index e32738e8f15..00000000000 --- a/src/test/ui/run-pass/autoref-autoderef/autoref-intermediate-types-issue-3585.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -trait Foo { - fn foo(&self) -> String; -} - -impl Foo for Box { - fn foo(&self) -> String { - format!("box {}", (**self).foo()) - } -} - -impl Foo for usize { - fn foo(&self) -> String { - format!("{}", *self) - } -} - -pub fn main() { - let x: Box<_> = box 3; - assert_eq!(x.foo(), "box 3".to_string()); -} diff --git a/src/test/ui/run-pass/bench/issue-32062.rs b/src/test/ui/run-pass/bench/issue-32062.rs deleted file mode 100644 index c21399fd299..00000000000 --- a/src/test/ui/run-pass/bench/issue-32062.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -fn main() { - let _ = test(Some(0).into_iter()); -} - -trait Parser { - type Input: Iterator; - type Output; - fn parse(self, input: Self::Input) -> Result<(Self::Output, Self::Input), ()>; - fn chain

(self, p: P) -> Chain where Self: Sized { - Chain(self, p) - } -} - -struct Token(T::Item) where T: Iterator; - -impl Parser for Token where T: Iterator { - type Input = T; - type Output = T::Item; - fn parse(self, _input: Self::Input) -> Result<(Self::Output, Self::Input), ()> { - Err(()) - } -} - -struct Chain(L, R); - -impl Parser for Chain where L: Parser, R: Parser { - type Input = L::Input; - type Output = (L::Output, R::Output); - fn parse(self, _input: Self::Input) -> Result<(Self::Output, Self::Input), ()> { - Err(()) - } -} - -fn test(i: I) -> Result<((), I), ()> where I: Iterator { - Chain(Token(0), Token(1)) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .chain(Chain(Token(0), Token(1))) - .parse(i) - .map(|(_, i)| ((), i)) -} diff --git a/src/test/ui/run-pass/binding/allow_irrefutable_let_patterns.rs b/src/test/ui/run-pass/binding/allow_irrefutable_let_patterns.rs deleted file mode 100644 index 866784e517c..00000000000 --- a/src/test/ui/run-pass/binding/allow_irrefutable_let_patterns.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(irrefutable_let_patterns)] - -// must-compile-successfully-irrefutable_let_patterns_with_gate -#[allow(irrefutable_let_patterns)] -fn main() { - if let _ = 5 {} - - while let _ = 5 { - break; - } -} diff --git a/src/test/ui/run-pass/binding/bind-field-short-with-modifiers.rs b/src/test/ui/run-pass/binding/bind-field-short-with-modifiers.rs deleted file mode 100644 index 24f03774270..00000000000 --- a/src/test/ui/run-pass/binding/bind-field-short-with-modifiers.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -pub fn main() { - struct Foo { x: isize, y: isize } - let mut f = Foo { x: 10, y: 0 }; - match f { - Foo { ref mut x, .. } => *x = 11, - } - match f { - Foo { ref x, ref y } => { - assert_eq!(f.x, 11); - assert_eq!(f.y, 0); - } - } - match f { - Foo { mut x, y: ref mut y } => { - x = 12; - *y = 1; - } - } - assert_eq!(f.x, 11); - assert_eq!(f.y, 1); -} diff --git a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-2.rs b/src/test/ui/run-pass/binding/borrowed-ptr-pattern-2.rs deleted file mode 100644 index 6a23d159047..00000000000 --- a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn foo(s: &String) -> bool { - match &**s { - "kitty" => true, - _ => false - } -} - -pub fn main() { - assert!(foo(&"kitty".to_string())); - assert!(!foo(&"gata".to_string())); -} diff --git a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-3.rs b/src/test/ui/run-pass/binding/borrowed-ptr-pattern-3.rs deleted file mode 100644 index cb40b3a0099..00000000000 --- a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-3.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn foo<'r>(s: &'r usize) -> bool { - match s { - &3 => true, - _ => false - } -} - -pub fn main() { - assert!(foo(&3)); - assert!(!foo(&4)); -} diff --git a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-infallible.rs b/src/test/ui/run-pass/binding/borrowed-ptr-pattern-infallible.rs deleted file mode 100644 index 5f906903ed2..00000000000 --- a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-infallible.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let (&x, &y) = (&3, &'a'); - assert_eq!(x, 3); - assert_eq!(y, 'a'); -} diff --git a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-option.rs b/src/test/ui/run-pass/binding/borrowed-ptr-pattern-option.rs deleted file mode 100644 index 1372a7a0789..00000000000 --- a/src/test/ui/run-pass/binding/borrowed-ptr-pattern-option.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn select<'r>(x: &'r Option, y: &'r Option) -> &'r Option { - match (x, y) { - (&None, &None) => x, - (&Some(_), _) => x, - (&None, &Some(_)) => y - } -} - -pub fn main() { - let x = None; - let y = Some(3); - assert_eq!(select(&x, &y).unwrap(), 3); -} diff --git a/src/test/ui/run-pass/binding/borrowed-ptr-pattern.rs b/src/test/ui/run-pass/binding/borrowed-ptr-pattern.rs deleted file mode 100644 index f363bef36d6..00000000000 --- a/src/test/ui/run-pass/binding/borrowed-ptr-pattern.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn foo(x: &T) -> T{ - match x { - &ref a => (*a).clone() - } -} - -pub fn main() { - assert_eq!(foo(&3), 3); - assert_eq!(foo(&'a'), 'a'); -} diff --git a/src/test/ui/run-pass/binding/empty-types-in-patterns.rs b/src/test/ui/run-pass/binding/empty-types-in-patterns.rs deleted file mode 100644 index c230442eecc..00000000000 --- a/src/test/ui/run-pass/binding/empty-types-in-patterns.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(never_type)] -#![feature(exhaustive_patterns)] -#![feature(slice_patterns)] -#![allow(unreachable_patterns)] -#![allow(unreachable_code)] - -#[allow(dead_code)] -fn foo(z: !) { - let x: Result = Ok(z); - - let Ok(_y) = x; - let Err(_y) = x; - - let x = [z; 1]; - - match x {}; - match x { - [q] => q, - }; -} - -fn bar(nevers: &[!]) { - match nevers { - &[] => (), - }; - - match nevers { - &[] => (), - &[_] => (), - &[_, _, _, ..] => (), - }; -} - -fn main() { - let x: Result = Ok(123); - let Ok(y) = x; - - assert_eq!(123, y); - - match x { - Ok(y) => y, - }; - - match x { - Ok(y) => y, - Err(e) => match e {}, - }; - - let x: Result = Ok(123); - match x { - Ok(y) => y, - }; - - bar(&[]); -} - diff --git a/src/test/ui/run-pass/binding/exhaustive-bool-match-sanity.rs b/src/test/ui/run-pass/binding/exhaustive-bool-match-sanity.rs deleted file mode 100644 index 26e852eff23..00000000000 --- a/src/test/ui/run-pass/binding/exhaustive-bool-match-sanity.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #33540 -// We previously used to generate a 3-armed boolean `SwitchInt` in the -// MIR of the function `foo` below. #33583 changed rustc to -// generate an `If` terminator instead. This test is to just ensure -// sanity in that we generate an if-else chain giving the correct -// results. - -fn foo(x: bool, y: bool) -> u32 { - match (x, y) { - (false, _) => 0, - (_, false) => 1, - (true, true) => 2 - } -} - -fn main() { - assert_eq!(foo(false, true), 0); - assert_eq!(foo(false, false), 0); - assert_eq!(foo(true, false), 1); - assert_eq!(foo(true, true), 2); -} diff --git a/src/test/ui/run-pass/binding/expr-match-generic-unique1.rs b/src/test/ui/run-pass/binding/expr-match-generic-unique1.rs deleted file mode 100644 index 3325aa7b3df..00000000000 --- a/src/test/ui/run-pass/binding/expr-match-generic-unique1.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn test_generic(expected: Box, eq: F) where F: FnOnce(Box, Box) -> bool { - let actual: Box = match true { - true => { expected.clone() }, - _ => panic!("wat") - }; - assert!(eq(expected, actual)); -} - -fn test_box() { - fn compare_box(b1: Box, b2: Box) -> bool { - return *b1 == *b2; - } - test_generic::(box true, compare_box); -} - -pub fn main() { test_box(); } diff --git a/src/test/ui/run-pass/binding/expr-match-generic-unique2.rs b/src/test/ui/run-pass/binding/expr-match-generic-unique2.rs deleted file mode 100644 index 8daa33e6227..00000000000 --- a/src/test/ui/run-pass/binding/expr-match-generic-unique2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn test_generic(expected: T, eq: F) where F: FnOnce(T, T) -> bool { - let actual: T = match true { - true => expected.clone(), - _ => panic!("wat") - }; - assert!(eq(expected, actual)); -} - -fn test_vec() { - fn compare_box(v1: Box, v2: Box) -> bool { return v1 == v2; } - test_generic::, _>(box 1, compare_box); -} - -pub fn main() { test_vec(); } diff --git a/src/test/ui/run-pass/binding/expr-match-generic.rs b/src/test/ui/run-pass/binding/expr-match-generic.rs deleted file mode 100644 index 11c907b9b2d..00000000000 --- a/src/test/ui/run-pass/binding/expr-match-generic.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -type compare = extern "Rust" fn(T, T) -> bool; - -fn test_generic(expected: T, eq: compare) { - let actual: T = match true { true => { expected.clone() }, _ => panic!("wat") }; - assert!((eq(expected, actual))); -} - -fn test_bool() { - fn compare_bool(b1: bool, b2: bool) -> bool { return b1 == b2; } - test_generic::(true, compare_bool); -} - -#[derive(Clone)] -struct Pair { - a: isize, - b: isize, -} - -fn test_rec() { - fn compare_rec(t1: Pair, t2: Pair) -> bool { - t1.a == t2.a && t1.b == t2.b - } - test_generic::(Pair {a: 1, b: 2}, compare_rec); -} - -pub fn main() { test_bool(); test_rec(); } diff --git a/src/test/ui/run-pass/binding/expr-match-panic-all.rs b/src/test/ui/run-pass/binding/expr-match-panic-all.rs deleted file mode 100644 index f283fdddb6a..00000000000 --- a/src/test/ui/run-pass/binding/expr-match-panic-all.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -// When all branches of a match expression result in panic, the entire -// match expression results in panic. - -pub fn main() { - let _x = - match true { - true => { 10 } - false => { match true { true => { panic!() } false => { panic!() } } } - }; -} diff --git a/src/test/ui/run-pass/binding/expr-match-panic.rs b/src/test/ui/run-pass/binding/expr-match-panic.rs deleted file mode 100644 index c6f8ae7bca6..00000000000 --- a/src/test/ui/run-pass/binding/expr-match-panic.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn test_simple() { - let r = match true { true => { true } false => { panic!() } }; - assert_eq!(r, true); -} - -fn test_box() { - let r = match true { true => { vec![10] } false => { panic!() } }; - assert_eq!(r[0], 10); -} - -pub fn main() { test_simple(); test_box(); } diff --git a/src/test/ui/run-pass/binding/expr-match-unique.rs b/src/test/ui/run-pass/binding/expr-match-unique.rs deleted file mode 100644 index b67b9fa3dda..00000000000 --- a/src/test/ui/run-pass/binding/expr-match-unique.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -// Tests for match as expressions resulting in boxed types -fn test_box() { - let res: Box<_> = match true { true => { box 100 }, _ => panic!() }; - assert_eq!(*res, 100); -} - -pub fn main() { test_box(); } diff --git a/src/test/ui/run-pass/binding/expr-match.rs b/src/test/ui/run-pass/binding/expr-match.rs deleted file mode 100644 index 83d44e42b32..00000000000 --- a/src/test/ui/run-pass/binding/expr-match.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -// Tests for using match as an expression - -fn test_basic() { - let mut rs: bool = match true { true => { true } false => { false } }; - assert!((rs)); - rs = match false { true => { false } false => { true } }; - assert!((rs)); -} - -fn test_inferrence() { - let rs = match true { true => { true } false => { false } }; - assert!((rs)); -} - -fn test_alt_as_alt_head() { - // Yeah, this is kind of confusing ... - - let rs = - match match false { true => { true } false => { false } } { - true => { false } - false => { true } - }; - assert!((rs)); -} - -fn test_alt_as_block_result() { - let rs = - match false { - true => { false } - false => { match true { true => { true } false => { false } } } - }; - assert!((rs)); -} - -pub fn main() { - test_basic(); - test_inferrence(); - test_alt_as_alt_head(); - test_alt_as_block_result(); -} diff --git a/src/test/ui/run-pass/binding/fat-arrow-match.rs b/src/test/ui/run-pass/binding/fat-arrow-match.rs deleted file mode 100644 index c0e68f99ad0..00000000000 --- a/src/test/ui/run-pass/binding/fat-arrow-match.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum color { - red, - green, - blue -} - -pub fn main() { - println!("{}", match color::red { - color::red => { 1 } - color::green => { 2 } - color::blue => { 3 } - }); -} diff --git a/src/test/ui/run-pass/binding/fn-pattern-expected-type-2.rs b/src/test/ui/run-pass/binding/fn-pattern-expected-type-2.rs deleted file mode 100644 index 7926234161f..00000000000 --- a/src/test/ui/run-pass/binding/fn-pattern-expected-type-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let v : &[(isize,isize)] = &[ (1, 2), (3, 4), (5, 6) ]; - for &(x, y) in v { - println!("{}", y); - println!("{}", x); - } -} diff --git a/src/test/ui/run-pass/binding/fn-pattern-expected-type.rs b/src/test/ui/run-pass/binding/fn-pattern-expected-type.rs deleted file mode 100644 index a868267f371..00000000000 --- a/src/test/ui/run-pass/binding/fn-pattern-expected-type.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let f = |(x, y): (isize, isize)| { - assert_eq!(x, 1); - assert_eq!(y, 2); - }; - f((1, 2)); -} diff --git a/src/test/ui/run-pass/binding/func-arg-incomplete-pattern.rs b/src/test/ui/run-pass/binding/func-arg-incomplete-pattern.rs deleted file mode 100644 index d766feeb72c..00000000000 --- a/src/test/ui/run-pass/binding/func-arg-incomplete-pattern.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we do not leak when the arg pattern must drop part of the -// argument (in this case, the `y` field). - -#![feature(box_syntax)] - -struct Foo { - x: Box, - y: Box, -} - -fn foo(Foo {x, ..}: Foo) -> *const usize { - let addr: *const usize = &*x; - addr -} - -pub fn main() { - let obj: Box<_> = box 1; - let objptr: *const usize = &*obj; - let f = Foo {x: obj, y: box 2}; - let xptr = foo(f); - assert_eq!(objptr, xptr); -} diff --git a/src/test/ui/run-pass/binding/func-arg-ref-pattern.rs b/src/test/ui/run-pass/binding/func-arg-ref-pattern.rs deleted file mode 100644 index 7e87f14e2c5..00000000000 --- a/src/test/ui/run-pass/binding/func-arg-ref-pattern.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// exec-env:RUST_POISON_ON_FREE=1 - -// Test argument patterns where we create refs to the inside of -// boxes. Make sure that we don't free the box as we match the -// pattern. - -#![feature(box_patterns)] -#![feature(box_syntax)] - -fn getaddr(box ref x: Box) -> *const usize { - let addr: *const usize = &*x; - addr -} - -fn checkval(box ref x: Box) -> usize { - *x -} - -pub fn main() { - let obj: Box<_> = box 1; - let objptr: *const usize = &*obj; - let xptr = getaddr(obj); - assert_eq!(objptr, xptr); - - let obj = box 22; - assert_eq!(checkval(obj), 22); -} diff --git a/src/test/ui/run-pass/binding/func-arg-wild-pattern.rs b/src/test/ui/run-pass/binding/func-arg-wild-pattern.rs deleted file mode 100644 index 18a1909b51e..00000000000 --- a/src/test/ui/run-pass/binding/func-arg-wild-pattern.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can compile code that uses a `_` in function argument -// patterns. - - -fn foo((x, _): (isize, isize)) -> isize { - x -} - -pub fn main() { - assert_eq!(foo((22, 23)), 22); -} diff --git a/src/test/ui/run-pass/binding/if-let.rs b/src/test/ui/run-pass/binding/if-let.rs deleted file mode 100644 index 9147bf14cad..00000000000 --- a/src/test/ui/run-pass/binding/if-let.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = Some(3); - if let Some(y) = x { - assert_eq!(y, 3); - } else { - panic!("if-let panicked"); - } - let mut worked = false; - if let Some(_) = x { - worked = true; - } - assert!(worked); - let clause: usize; - if let None = Some("test") { - clause = 1; - } else if 4_usize > 5 { - clause = 2; - } else if let Ok(()) = Err::<(),&'static str>("test") { - clause = 3; - } else { - clause = 4; - } - assert_eq!(clause, 4_usize); - - if 3 > 4 { - panic!("bad math"); - } else if let 1 = 2 { - panic!("bad pattern match"); - } - - enum Foo { - One, - Two(usize), - Three(String, isize) - } - - let foo = Foo::Three("three".to_string(), 42); - if let Foo::One = foo { - panic!("bad pattern match"); - } else if let Foo::Two(_x) = foo { - panic!("bad pattern match"); - } else if let Foo::Three(s, _) = foo { - assert_eq!(s, "three"); - } else { - panic!("bad else"); - } - - if false { - panic!("wat"); - } else if let a@Foo::Two(_) = Foo::Two(42_usize) { - if let Foo::Two(b) = a { - assert_eq!(b, 42_usize); - } else { - panic!("panic in nested if-let"); - } - } -} diff --git a/src/test/ui/run-pass/binding/inconsistent-lifetime-mismatch.rs b/src/test/ui/run-pass/binding/inconsistent-lifetime-mismatch.rs deleted file mode 100644 index 9e9fc8b4249..00000000000 --- a/src/test/ui/run-pass/binding/inconsistent-lifetime-mismatch.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo(_: &[&str]) {} - -fn bad(a: &str, b: &str) { - foo(&[a, b]); -} - -fn good(a: &str, b: &str) { - foo(&[a, b]); -} - -fn main() {} diff --git a/src/test/ui/run-pass/binding/inferred-suffix-in-pattern-range.rs b/src/test/ui/run-pass/binding/inferred-suffix-in-pattern-range.rs deleted file mode 100644 index 3be0991aea6..00000000000 --- a/src/test/ui/run-pass/binding/inferred-suffix-in-pattern-range.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = 2; - let x_message = match x { - 0 ..= 1 => { "not many".to_string() } - _ => { "lots".to_string() } - }; - assert_eq!(x_message, "lots".to_string()); - - let y = 2; - let y_message = match y { - 0 ..= 1 => { "not many".to_string() } - _ => { "lots".to_string() } - }; - assert_eq!(y_message, "lots".to_string()); - - let z = 1u64; - let z_message = match z { - 0 ..= 1 => { "not many".to_string() } - _ => { "lots".to_string() } - }; - assert_eq!(z_message, "not many".to_string()); -} diff --git a/src/test/ui/run-pass/binding/irrefutable-slice-patterns.rs b/src/test/ui/run-pass/binding/irrefutable-slice-patterns.rs deleted file mode 100644 index 9cd62f9a901..00000000000 --- a/src/test/ui/run-pass/binding/irrefutable-slice-patterns.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #47096 - -#![feature(slice_patterns)] - -fn foo(s: &[i32]) -> &[i32] { - let &[ref xs..] = s; - xs -} - -fn main() { - let x = [1, 2, 3]; - let y = foo(&x); - assert_eq!(x, y); -} diff --git a/src/test/ui/run-pass/binding/let-assignability.rs b/src/test/ui/run-pass/binding/let-assignability.rs deleted file mode 100644 index 99fc172892c..00000000000 --- a/src/test/ui/run-pass/binding/let-assignability.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f() { - let a: Box<_> = box 1; - let b: &isize = &*a; - println!("{}", b); -} - -pub fn main() { - f(); -} diff --git a/src/test/ui/run-pass/binding/let-destruct-ref.rs b/src/test/ui/run-pass/binding/let-destruct-ref.rs deleted file mode 100644 index 1c1b1a39769..00000000000 --- a/src/test/ui/run-pass/binding/let-destruct-ref.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = 3_usize; - let ref y = x; - assert_eq!(x, *y); -} diff --git a/src/test/ui/run-pass/binding/let-var-hygiene.rs b/src/test/ui/run-pass/binding/let-var-hygiene.rs deleted file mode 100644 index d432dbe86b9..00000000000 --- a/src/test/ui/run-pass/binding/let-var-hygiene.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// shouldn't affect evaluation of $ex: - -macro_rules! bad_macro { - ($ex:expr) => ({let _x = 9; $ex}) -} - -pub fn main() { - let _x = 8; - assert_eq!(bad_macro!(_x),8) -} diff --git a/src/test/ui/run-pass/binding/match-arm-statics.rs b/src/test/ui/run-pass/binding/match-arm-statics.rs deleted file mode 100644 index c5111073ca8..00000000000 --- a/src/test/ui/run-pass/binding/match-arm-statics.rs +++ /dev/null @@ -1,175 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -g - -#[derive(PartialEq, Eq)] -struct NewBool(bool); - -#[derive(PartialEq, Eq)] -enum Direction { - North, - East, - South, - West -} - -#[derive(PartialEq, Eq)] -struct Foo { - bar: Option, - baz: NewBool -} - -#[derive(PartialEq, Eq)] -enum EnumWithStructVariants { - Variant1(bool), - Variant2 { - dir: Direction - } -} - -const TRUE_TRUE: (bool, bool) = (true, true); -const NONE: Option = None; -const EAST: Direction = Direction::East; -const NEW_FALSE: NewBool = NewBool(false); -const STATIC_FOO: Foo = Foo { bar: Some(Direction::South), baz: NEW_FALSE }; -const VARIANT2_NORTH: EnumWithStructVariants = EnumWithStructVariants::Variant2 { - dir: Direction::North }; - -pub mod glfw { - #[derive(Copy, Clone, PartialEq, Eq)] - pub struct InputState(usize); - - pub const RELEASE : InputState = InputState(0); - pub const PRESS : InputState = InputState(1); - pub const REPEAT : InputState = InputState(2); -} - -fn issue_6533() { - use glfw; - - fn action_to_str(state: glfw::InputState) -> &'static str { - use glfw::{RELEASE, PRESS, REPEAT}; - match state { - RELEASE => { "Released" } - PRESS => { "Pressed" } - REPEAT => { "Repeated" } - _ => { "Unknown" } - } - } - - assert_eq!(action_to_str(glfw::RELEASE), "Released"); - assert_eq!(action_to_str(glfw::PRESS), "Pressed"); - assert_eq!(action_to_str(glfw::REPEAT), "Repeated"); -} - -fn issue_13626() { - const VAL: [u8; 1] = [0]; - match [1] { - VAL => unreachable!(), - _ => () - } -} - -fn issue_14576() { - type Foo = (i32, i32); - const ON: Foo = (1, 1); - const OFF: Foo = (0, 0); - - match (1, 1) { - OFF => unreachable!(), - ON => (), - _ => unreachable!() - } - - #[derive(PartialEq, Eq)] - enum C { D = 3, E = 4 } - const F : C = C::D; - - assert_eq!(match C::D { F => 1, _ => 2, }, 1); - - // test gaps - #[derive(PartialEq, Eq)] - enum G { H = 3, I = 5 } - const K : G = G::I; - - assert_eq!(match G::I { K => 1, _ => 2, }, 1); -} - -fn issue_13731() { - #[derive(PartialEq, Eq)] - enum A { AA(()) } - const B: A = A::AA(()); - - match A::AA(()) { - B => () - } -} - -fn issue_15393() { - #![allow(dead_code)] - #[derive(PartialEq, Eq)] - struct Flags { - bits: usize - } - - const FOO: Flags = Flags { bits: 0x01 }; - const BAR: Flags = Flags { bits: 0x02 }; - match (Flags { bits: 0x02 }) { - FOO => unreachable!(), - BAR => (), - _ => unreachable!() - } -} - -fn main() { - assert_eq!(match (true, false) { - TRUE_TRUE => 1, - (false, false) => 2, - (false, true) => 3, - (true, false) => 4 - }, 4); - - assert_eq!(match Some(Some(Direction::North)) { - Some(NONE) => 1, - Some(Some(Direction::North)) => 2, - Some(Some(EAST)) => 3, - Some(Some(Direction::South)) => 4, - Some(Some(Direction::West)) => 5, - None => 6 - }, 2); - - assert_eq!(match (Foo { bar: Some(Direction::West), baz: NewBool(true) }) { - Foo { bar: None, baz: NewBool(true) } => 1, - Foo { bar: NONE, baz: NEW_FALSE } => 2, - STATIC_FOO => 3, - Foo { bar: _, baz: NEW_FALSE } => 4, - Foo { bar: Some(Direction::West), baz: NewBool(true) } => 5, - Foo { bar: Some(Direction::South), baz: NewBool(true) } => 6, - Foo { bar: Some(EAST), .. } => 7, - Foo { bar: Some(Direction::North), baz: NewBool(true) } => 8 - }, 5); - - assert_eq!(match (EnumWithStructVariants::Variant2 { dir: Direction::North }) { - EnumWithStructVariants::Variant1(true) => 1, - EnumWithStructVariants::Variant1(false) => 2, - EnumWithStructVariants::Variant2 { dir: Direction::West } => 3, - VARIANT2_NORTH => 4, - EnumWithStructVariants::Variant2 { dir: Direction::South } => 5, - EnumWithStructVariants::Variant2 { dir: Direction::East } => 6 - }, 4); - - issue_6533(); - issue_13626(); - issue_13731(); - issue_14576(); - issue_15393(); -} diff --git a/src/test/ui/run-pass/binding/match-beginning-vert.rs b/src/test/ui/run-pass/binding/match-beginning-vert.rs deleted file mode 100644 index 16954f85752..00000000000 --- a/src/test/ui/run-pass/binding/match-beginning-vert.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Foo { - A, - B, - C, - D, - E, -} -use Foo::*; - -fn main() { - for foo in &[A, B, C, D, E] { - match *foo { - | A => println!("A"), - | B | C if 1 < 2 => println!("BC!"), - | _ => {}, - } - } -} diff --git a/src/test/ui/run-pass/binding/match-borrowed_str.rs b/src/test/ui/run-pass/binding/match-borrowed_str.rs deleted file mode 100644 index 0871ff836cc..00000000000 --- a/src/test/ui/run-pass/binding/match-borrowed_str.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn f1(ref_string: &str) -> String { - match ref_string { - "a" => "found a".to_string(), - "b" => "found b".to_string(), - _ => "not found".to_string() - } -} - -fn f2(ref_string: &str) -> String { - match ref_string { - "a" => "found a".to_string(), - "b" => "found b".to_string(), - s => format!("not found ({})", s) - } -} - -fn g1(ref_1: &str, ref_2: &str) -> String { - match (ref_1, ref_2) { - ("a", "b") => "found a,b".to_string(), - ("b", "c") => "found b,c".to_string(), - _ => "not found".to_string() - } -} - -fn g2(ref_1: &str, ref_2: &str) -> String { - match (ref_1, ref_2) { - ("a", "b") => "found a,b".to_string(), - ("b", "c") => "found b,c".to_string(), - (s1, s2) => format!("not found ({}, {})", s1, s2) - } -} - -pub fn main() { - assert_eq!(f1("b"), "found b".to_string()); - assert_eq!(f1("c"), "not found".to_string()); - assert_eq!(f1("d"), "not found".to_string()); - assert_eq!(f2("b"), "found b".to_string()); - assert_eq!(f2("c"), "not found (c)".to_string()); - assert_eq!(f2("d"), "not found (d)".to_string()); - assert_eq!(g1("b", "c"), "found b,c".to_string()); - assert_eq!(g1("c", "d"), "not found".to_string()); - assert_eq!(g1("d", "e"), "not found".to_string()); - assert_eq!(g2("b", "c"), "found b,c".to_string()); - assert_eq!(g2("c", "d"), "not found (c, d)".to_string()); - assert_eq!(g2("d", "e"), "not found (d, e)".to_string()); -} diff --git a/src/test/ui/run-pass/binding/match-bot-2.rs b/src/test/ui/run-pass/binding/match-bot-2.rs deleted file mode 100644 index 8f9a8d2cfcc..00000000000 --- a/src/test/ui/run-pass/binding/match-bot-2.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// n.b. This was only ever failing with optimization disabled. - -fn a() -> isize { match return 1 { 2 => 3, _ => panic!() } } -pub fn main() { a(); } diff --git a/src/test/ui/run-pass/binding/match-bot.rs b/src/test/ui/run-pass/binding/match-bot.rs deleted file mode 100644 index d91d95b826a..00000000000 --- a/src/test/ui/run-pass/binding/match-bot.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let i: isize = - match Some::(3) { None:: => { panic!() } Some::(_) => { 5 } }; - println!("{}", i); -} diff --git a/src/test/ui/run-pass/binding/match-byte-array-patterns.rs b/src/test/ui/run-pass/binding/match-byte-array-patterns.rs deleted file mode 100644 index 728d4a241fe..00000000000 --- a/src/test/ui/run-pass/binding/match-byte-array-patterns.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn main() { - let buf = &[0u8; 4]; - match buf { - &[0, 1, 0, 0] => unimplemented!(), - b"true" => unimplemented!(), - _ => {} - } - - match buf { - b"true" => unimplemented!(), - &[0, 1, 0, 0] => unimplemented!(), - _ => {} - } - - match buf { - b"true" => unimplemented!(), - &[0, x, 0, 0] => assert_eq!(x, 0), - _ => unimplemented!(), - } - - let buf: &[u8] = buf; - - match buf { - &[0, 1, 0, 0] => unimplemented!(), - &[_] => unimplemented!(), - &[_, _, _, _, _, ..] => unimplemented!(), - b"true" => unimplemented!(), - _ => {} - } - - match buf { - b"true" => unimplemented!(), - &[0, 1, 0, 0] => unimplemented!(), - _ => {} - } - - match buf { - b"true" => unimplemented!(), - &[0, x, 0, 0] => assert_eq!(x, 0), - _ => unimplemented!(), - } -} diff --git a/src/test/ui/run-pass/binding/match-enum-struct-0.rs b/src/test/ui/run-pass/binding/match-enum-struct-0.rs deleted file mode 100644 index 9ddf3b421d5..00000000000 --- a/src/test/ui/run-pass/binding/match-enum-struct-0.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// regression test for issue #5625 - - -enum E { - Foo{f : isize}, - Bar -} - -pub fn main() { - let e = E::Bar; - match e { - E::Foo{f: _f} => panic!(), - _ => (), - } -} diff --git a/src/test/ui/run-pass/binding/match-enum-struct-1.rs b/src/test/ui/run-pass/binding/match-enum-struct-1.rs deleted file mode 100644 index 46d9c19bf84..00000000000 --- a/src/test/ui/run-pass/binding/match-enum-struct-1.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { - Foo{f : isize}, - Bar -} - -pub fn main() { - let e = E::Foo{f: 1}; - match e { - E::Foo{..} => (), - _ => panic!(), - } - match e { - E::Foo{f: _f} => (), - _ => panic!(), - } -} diff --git a/src/test/ui/run-pass/binding/match-implicit-copy-unique.rs b/src/test/ui/run-pass/binding/match-implicit-copy-unique.rs deleted file mode 100644 index 68edbea3471..00000000000 --- a/src/test/ui/run-pass/binding/match-implicit-copy-unique.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] -#![feature(box_syntax)] - -struct Pair { a: Box, b: Box } - -pub fn main() { - let mut x: Box<_> = box Pair {a: box 10, b: box 20}; - let x_internal = &mut *x; - match *x_internal { - Pair {a: ref mut a, b: ref mut _b} => { - assert_eq!(**a, 10); - *a = box 30; - assert_eq!(**a, 30); - } - } -} diff --git a/src/test/ui/run-pass/binding/match-in-macro.rs b/src/test/ui/run-pass/binding/match-in-macro.rs deleted file mode 100644 index 5c4c7c048ef..00000000000 --- a/src/test/ui/run-pass/binding/match-in-macro.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum Foo { - B { b1: isize, bb1: isize}, -} - -macro_rules! match_inside_expansion { - () => ( - match (Foo::B { b1:29 , bb1: 100}) { - Foo::B { b1:b2 , bb1:bb2 } => b2+bb2 - } - ) -} - -pub fn main() { - assert_eq!(match_inside_expansion!(),129); -} diff --git a/src/test/ui/run-pass/binding/match-join.rs b/src/test/ui/run-pass/binding/match-join.rs deleted file mode 100644 index 94ea8edd70f..00000000000 --- a/src/test/ui/run-pass/binding/match-join.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo(y: Option) { - let mut x: isize; - let mut rs: Vec = Vec::new(); - /* tests that x doesn't get put in the precondition for the - entire if expression */ - - if true { - } else { - match y { - None:: => x = 17, - _ => x = 42 - } - rs.push(x); - } - return; -} - -pub fn main() { println!("hello"); foo::(Some::(5)); } diff --git a/src/test/ui/run-pass/binding/match-larger-const.rs b/src/test/ui/run-pass/binding/match-larger-const.rs deleted file mode 100644 index f649ce0ee0e..00000000000 --- a/src/test/ui/run-pass/binding/match-larger-const.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Eq, PartialEq)] -pub struct Data([u8; 4]); - -const DATA: Data = Data([1, 2, 3, 4]); - -fn main() { - match DATA { - DATA => (), - _ => (), - } -} diff --git a/src/test/ui/run-pass/binding/match-naked-record-expr.rs b/src/test/ui/run-pass/binding/match-naked-record-expr.rs deleted file mode 100644 index f016ca8e43c..00000000000 --- a/src/test/ui/run-pass/binding/match-naked-record-expr.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct X { x: isize } - -pub fn main() { - let _x = match 0 { - _ => X { - x: 0 - }.x - }; -} diff --git a/src/test/ui/run-pass/binding/match-naked-record.rs b/src/test/ui/run-pass/binding/match-naked-record.rs deleted file mode 100644 index 550ace8b649..00000000000 --- a/src/test/ui/run-pass/binding/match-naked-record.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct X { x: isize } - -pub fn main() { - let _x = match 0 { - _ => X { - x: 0 - } - }; -} diff --git a/src/test/ui/run-pass/binding/match-path.rs b/src/test/ui/run-pass/binding/match-path.rs deleted file mode 100644 index 06d7095a924..00000000000 --- a/src/test/ui/run-pass/binding/match-path.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -// pretty-expanded FIXME #23616 - -mod m1 { - pub enum foo { foo1, foo2, } -} - -fn bar(x: m1::foo) { match x { m1::foo::foo1 => { } m1::foo::foo2 => { } } } - -pub fn main() { } diff --git a/src/test/ui/run-pass/binding/match-pattern-bindings.rs b/src/test/ui/run-pass/binding/match-pattern-bindings.rs deleted file mode 100644 index e6242a0ee58..00000000000 --- a/src/test/ui/run-pass/binding/match-pattern-bindings.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let value = Some(1); - assert_eq!(match value { - ref a @ Some(_) => a, - ref b @ None => b - }, &Some(1)); - assert_eq!(match value { - ref c @ Some(_) => c, - ref b @ None => b - }, &Some(1)); - assert_eq!(match "foobarbaz" { - b @ _ => b - }, "foobarbaz"); - let a @ _ = "foobarbaz"; - assert_eq!(a, "foobarbaz"); - let value = Some(true); - let ref a @ _ = value; - assert_eq!(a, &Some(true)); -} diff --git a/src/test/ui/run-pass/binding/match-pattern-lit.rs b/src/test/ui/run-pass/binding/match-pattern-lit.rs deleted file mode 100644 index 8e6129d60b5..00000000000 --- a/src/test/ui/run-pass/binding/match-pattern-lit.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn altlit(f: isize) -> isize { - match f { - 10 => { println!("case 10"); return 20; } - 11 => { println!("case 11"); return 22; } - _ => panic!("the impossible happened") - } -} - -pub fn main() { - assert_eq!(altlit(10), 20); - assert_eq!(altlit(11), 22); -} diff --git a/src/test/ui/run-pass/binding/match-pattern-no-type-params.rs b/src/test/ui/run-pass/binding/match-pattern-no-type-params.rs deleted file mode 100644 index 2486fa782e0..00000000000 --- a/src/test/ui/run-pass/binding/match-pattern-no-type-params.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum maybe { nothing, just(T), } - -fn foo(x: maybe) { - match x { - maybe::nothing => { println!("A"); } - maybe::just(_a) => { println!("B"); } - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/binding/match-pattern-simple.rs b/src/test/ui/run-pass/binding/match-pattern-simple.rs deleted file mode 100644 index d1525661269..00000000000 --- a/src/test/ui/run-pass/binding/match-pattern-simple.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -// pretty-expanded FIXME #23616 - -fn altsimple(f: isize) { match f { _x => () } } - -pub fn main() { } diff --git a/src/test/ui/run-pass/binding/match-phi.rs b/src/test/ui/run-pass/binding/match-phi.rs deleted file mode 100644 index 06a011c0fa2..00000000000 --- a/src/test/ui/run-pass/binding/match-phi.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_camel_case_types)] -#![allow(unused_variables)] - -enum thing { a, b, c, } - -fn foo(it: F) where F: FnOnce(isize) { it(10); } - -pub fn main() { - let mut x = true; - match thing::a { - thing::a => { x = true; foo(|_i| { } ) } - thing::b => { x = false; } - thing::c => { x = false; } - } -} diff --git a/src/test/ui/run-pass/binding/match-pipe-binding.rs b/src/test/ui/run-pass/binding/match-pipe-binding.rs deleted file mode 100644 index 577e5c97e42..00000000000 --- a/src/test/ui/run-pass/binding/match-pipe-binding.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z borrowck=compare - -fn test1() { - // from issue 6338 - match ((1, "a".to_string()), (2, "b".to_string())) { - ((1, a), (2, b)) | ((2, b), (1, a)) => { - assert_eq!(a, "a".to_string()); - assert_eq!(b, "b".to_string()); - }, - _ => panic!(), - } -} - -fn test2() { - match (1, 2, 3) { - (1, a, b) | (2, b, a) => { - assert_eq!(a, 2); - assert_eq!(b, 3); - }, - _ => panic!(), - } -} - -fn test3() { - match (1, 2, 3) { - (1, ref a, ref b) | (2, ref b, ref a) => { - assert_eq!(*a, 2); - assert_eq!(*b, 3); - }, - _ => panic!(), - } -} - -fn test4() { - match (1, 2, 3) { - (1, a, b) | (2, b, a) if a == 2 => { - assert_eq!(a, 2); - assert_eq!(b, 3); - }, - _ => panic!(), - } -} - -fn test5() { - match (1, 2, 3) { - (1, ref a, ref b) | (2, ref b, ref a) if *a == 2 => { - assert_eq!(*a, 2); - assert_eq!(*b, 3); - }, - _ => panic!(), - } -} - -pub fn main() { - test1(); - test2(); - test3(); - test4(); - test5(); -} diff --git a/src/test/ui/run-pass/binding/match-range-infer.rs b/src/test/ui/run-pass/binding/match-range-infer.rs deleted file mode 100644 index 7178d1837c7..00000000000 --- a/src/test/ui/run-pass/binding/match-range-infer.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that type inference for range patterns works correctly (is bi-directional). - -pub fn main() { - match 1 { - 1 ..= 3 => {} - _ => panic!("should match range") - } - match 1 { - 1 ..= 3u16 => {} - _ => panic!("should match range with inferred start type") - } - match 1 { - 1u16 ..= 3 => {} - _ => panic!("should match range with inferred end type") - } -} diff --git a/src/test/ui/run-pass/binding/match-range-static.rs b/src/test/ui/run-pass/binding/match-range-static.rs deleted file mode 100644 index 5be8db5fc86..00000000000 --- a/src/test/ui/run-pass/binding/match-range-static.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_upper_case_globals)] - -const s: isize = 1; -const e: isize = 42; - -pub fn main() { - match 7 { - s..=e => (), - _ => (), - } -} diff --git a/src/test/ui/run-pass/binding/match-range.rs b/src/test/ui/run-pass/binding/match-range.rs deleted file mode 100644 index a9687943e99..00000000000 --- a/src/test/ui/run-pass/binding/match-range.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 -#![feature(exclusive_range_pattern)] - -pub fn main() { - match 5_usize { - 1_usize..=5_usize => {} - _ => panic!("should match range"), - } - match 1_usize { - 1_usize..5_usize => {} - _ => panic!("should match range start"), - } - match 5_usize { - 6_usize..=7_usize => panic!("shouldn't match range"), - _ => {} - } - match 7_usize { - 6_usize..7_usize => panic!("shouldn't match range end"), - _ => {}, - } - match 5_usize { - 1_usize => panic!("should match non-first range"), - 2_usize..=6_usize => {} - _ => panic!("math is broken") - } - match 'c' { - 'a'..='z' => {} - _ => panic!("should support char ranges") - } - match -3 { - -7..=5 => {} - _ => panic!("should match signed range") - } - match 3.0f64 { - 1.0..=5.0 => {} - _ => panic!("should match float range") - } - match -1.5f64 { - -3.6..=3.6 => {} - _ => panic!("should match negative float range") - } - match 3.5 { - 0.0..3.5 => panic!("should not match the range end"), - _ => {}, - } - match 0.0 { - 0.0..3.5 => {}, - _ => panic!("should match the range start"), - } -} diff --git a/src/test/ui/run-pass/binding/match-reassign.rs b/src/test/ui/run-pass/binding/match-reassign.rs deleted file mode 100644 index 89b12976355..00000000000 --- a/src/test/ui/run-pass/binding/match-reassign.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #23698: The reassignment checker only cared -// about the last assignment in a match arm body - -// Use an extra function to make sure no extra assignments -// are introduced by macros in the match statement -fn check_eq(x: i32, y: i32) { - assert_eq!(x, y); -} - -#[allow(unused_assignments)] -fn main() { - let mut x = Box::new(1); - match x { - y => { - x = Box::new(2); - let _tmp = 1; // This assignment used to throw off the reassignment checker - check_eq(*y, 1); - } - } -} diff --git a/src/test/ui/run-pass/binding/match-ref-binding-in-guard-3256.rs b/src/test/ui/run-pass/binding/match-ref-binding-in-guard-3256.rs deleted file mode 100644 index 2da75d941b4..00000000000 --- a/src/test/ui/run-pass/binding/match-ref-binding-in-guard-3256.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::sync::Mutex; - -pub fn main() { - let x = Some(Mutex::new(true)); - match x { - Some(ref z) if *z.lock().unwrap() => { - assert!(*z.lock().unwrap()); - }, - _ => panic!() - } -} diff --git a/src/test/ui/run-pass/binding/match-ref-binding-mut-option.rs b/src/test/ui/run-pass/binding/match-ref-binding-mut-option.rs deleted file mode 100644 index a3d26024732..00000000000 --- a/src/test/ui/run-pass/binding/match-ref-binding-mut-option.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let mut v = Some(22); - match v { - None => {} - Some(ref mut p) => { *p += 1; } - } - assert_eq!(v, Some(23)); -} diff --git a/src/test/ui/run-pass/binding/match-ref-binding-mut.rs b/src/test/ui/run-pass/binding/match-ref-binding-mut.rs deleted file mode 100644 index c1f09502542..00000000000 --- a/src/test/ui/run-pass/binding/match-ref-binding-mut.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -struct Rec { - f: isize -} - -fn destructure(x: &mut Rec) { - match *x { - Rec {f: ref mut f} => *f += 1 - } -} - -pub fn main() { - let mut v = Rec {f: 22}; - destructure(&mut v); - assert_eq!(v.f, 23); -} diff --git a/src/test/ui/run-pass/binding/match-ref-binding.rs b/src/test/ui/run-pass/binding/match-ref-binding.rs deleted file mode 100644 index bc36b8102ce..00000000000 --- a/src/test/ui/run-pass/binding/match-ref-binding.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn destructure(x: Option) -> isize { - match x { - None => 0, - Some(ref v) => *v - } -} - -pub fn main() { - assert_eq!(destructure(Some(22)), 22); -} diff --git a/src/test/ui/run-pass/binding/match-ref-unsized.rs b/src/test/ui/run-pass/binding/match-ref-unsized.rs deleted file mode 100644 index 7ef19330015..00000000000 --- a/src/test/ui/run-pass/binding/match-ref-unsized.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Binding unsized expressions to ref patterns - -pub fn main() { - let ref a = *"abcdef"; - assert_eq!(a, "abcdef"); - - match *"12345" { - ref b => { assert_eq!(b, "12345") } - } -} diff --git a/src/test/ui/run-pass/binding/match-static-const-rename.rs b/src/test/ui/run-pass/binding/match-static-const-rename.rs deleted file mode 100644 index 0d75c81b1e6..00000000000 --- a/src/test/ui/run-pass/binding/match-static-const-rename.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #7526: lowercase static constants in patterns look like bindings - -// This is similar to compile-fail/match-static-const-lc, except it -// shows the expected usual workaround (choosing a different name for -// the static definition) and also demonstrates that one can work -// around this problem locally by renaming the constant in the `use` -// form to an uppercase identifier that placates the lint. - - -#![deny(non_upper_case_globals)] - -pub const A : isize = 97; - -fn f() { - let r = match (0,0) { - (0, A) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); - let r = match (0,97) { - (0, A) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 0); -} - -mod m { - #[allow(non_upper_case_globals)] - pub const aha : isize = 7; -} - -fn g() { - use self::m::aha as AHA; - let r = match (0,0) { - (0, AHA) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); - let r = match (0,7) { - (0, AHA) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 0); -} - -fn h() { - let r = match (0,0) { - (0, self::m::aha) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 1); - let r = match (0,7) { - (0, self::m::aha) => 0, - (x, y) => 1 + x + y, - }; - assert_eq!(r, 0); -} - -pub fn main () { - f(); - g(); - h(); -} diff --git a/src/test/ui/run-pass/binding/match-str.rs b/src/test/ui/run-pass/binding/match-str.rs deleted file mode 100644 index 0722a6f0b32..00000000000 --- a/src/test/ui/run-pass/binding/match-str.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #53 -#![allow(non_camel_case_types)] - - -pub fn main() { - match "test" { "not-test" => panic!(), "test" => (), _ => panic!() } - - enum t { tag1(String), tag2, } - - - match t::tag1("test".to_string()) { - t::tag2 => panic!(), - t::tag1(ref s) if "test" != &**s => panic!(), - t::tag1(ref s) if "test" == &**s => (), - _ => panic!() - } - - let x = match "a" { "a" => 1, "b" => 2, _ => panic!() }; - assert_eq!(x, 1); - - match "a" { "a" => { } "b" => { }, _ => panic!() } - -} diff --git a/src/test/ui/run-pass/binding/match-struct-0.rs b/src/test/ui/run-pass/binding/match-struct-0.rs deleted file mode 100644 index facfaae5405..00000000000 --- a/src/test/ui/run-pass/binding/match-struct-0.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo{ - f : isize, -} - -pub fn main() { - let f = Foo{f: 1}; - match f { - Foo{f: 0} => panic!(), - Foo{..} => (), - } - match f { - Foo{f: 0} => panic!(), - Foo{f: _f} => (), - } - match f { - Foo{f: 0} => panic!(), - _ => (), - } -} diff --git a/src/test/ui/run-pass/binding/match-tag.rs b/src/test/ui/run-pass/binding/match-tag.rs deleted file mode 100644 index aeeb7dd4bc9..00000000000 --- a/src/test/ui/run-pass/binding/match-tag.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - -enum color { - rgb(isize, isize, isize), - rgba(isize, isize, isize, isize), - hsl(isize, isize, isize), -} - -fn process(c: color) -> isize { - let mut x: isize; - match c { - color::rgb(r, _, _) => { x = r; } - color::rgba(_, _, _, a) => { x = a; } - color::hsl(_, s, _) => { x = s; } - } - return x; -} - -pub fn main() { - let gray: color = color::rgb(127, 127, 127); - let clear: color = color::rgba(50, 150, 250, 0); - let red: color = color::hsl(0, 255, 255); - assert_eq!(process(gray), 127); - assert_eq!(process(clear), 0); - assert_eq!(process(red), 255); -} diff --git a/src/test/ui/run-pass/binding/match-unique-bind.rs b/src/test/ui/run-pass/binding/match-unique-bind.rs deleted file mode 100644 index a543527586f..00000000000 --- a/src/test/ui/run-pass/binding/match-unique-bind.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_patterns)] -#![feature(box_syntax)] - -pub fn main() { - match box 100 { - box x => { - println!("{}", x); - assert_eq!(x, 100); - } - } -} diff --git a/src/test/ui/run-pass/binding/match-unsized.rs b/src/test/ui/run-pass/binding/match-unsized.rs deleted file mode 100644 index 2e2f0f0b7ea..00000000000 --- a/src/test/ui/run-pass/binding/match-unsized.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let data: &'static str = "Hello, World!"; - match data { - &ref xs => { - assert_eq!(data, xs); - } - } -} diff --git a/src/test/ui/run-pass/binding/match-value-binding-in-guard-3291.rs b/src/test/ui/run-pass/binding/match-value-binding-in-guard-3291.rs deleted file mode 100644 index a24a38af22f..00000000000 --- a/src/test/ui/run-pass/binding/match-value-binding-in-guard-3291.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -fn foo(x: Option>, b: bool) -> isize { - match x { - None => { 1 } - Some(ref x) if b => { *x.clone() } - Some(_) => { 0 } - } -} - -pub fn main() { - foo(Some(box 22), true); - foo(Some(box 22), false); - foo(None, true); - foo(None, false); -} diff --git a/src/test/ui/run-pass/binding/match-var-hygiene.rs b/src/test/ui/run-pass/binding/match-var-hygiene.rs deleted file mode 100644 index 5d4347559f7..00000000000 --- a/src/test/ui/run-pass/binding/match-var-hygiene.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// shouldn't affect evaluation of $ex. -macro_rules! bad_macro { ($ex:expr) => ( - {match 9 {_x => $ex}} -)} - -fn main() { - match 8 { - _x => assert_eq!(bad_macro!(_x),8) - } -} diff --git a/src/test/ui/run-pass/binding/match-vec-alternatives.rs b/src/test/ui/run-pass/binding/match-vec-alternatives.rs deleted file mode 100644 index 4c728924556..00000000000 --- a/src/test/ui/run-pass/binding/match-vec-alternatives.rs +++ /dev/null @@ -1,91 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn match_vecs<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { - match (l1, l2) { - (&[], &[]) => "both empty", - (&[], &[..]) | (&[..], &[]) => "one empty", - (&[..], &[..]) => "both non-empty" - } -} - -fn match_vecs_cons<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { - match (l1, l2) { - (&[], &[]) => "both empty", - (&[], &[_, ..]) | (&[_, ..], &[]) => "one empty", - (&[_, ..], &[_, ..]) => "both non-empty" - } -} - -fn match_vecs_snoc<'a, T>(l1: &'a [T], l2: &'a [T]) -> &'static str { - match (l1, l2) { - (&[], &[]) => "both empty", - (&[], &[.., _]) | (&[.., _], &[]) => "one empty", - (&[.., _], &[.., _]) => "both non-empty" - } -} - -fn match_nested_vecs_cons<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { - match (l1, l2) { - (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", - (Some(&[_, ..]), Ok(_)) | (Some(&[_, ..]), Err(())) => "Some(non-empty), any", - (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", - (None, Ok(&[_, _, ..])) => "None, Ok(at least two elements)", - _ => "other" - } -} - -fn match_nested_vecs_snoc<'a, T>(l1: Option<&'a [T]>, l2: Result<&'a [T], ()>) -> &'static str { - match (l1, l2) { - (Some(&[]), Ok(&[])) => "Some(empty), Ok(empty)", - (Some(&[.., _]), Ok(_)) | (Some(&[.., _]), Err(())) => "Some(non-empty), any", - (None, Ok(&[])) | (None, Err(())) | (None, Ok(&[_])) => "None, Ok(less than one element)", - (None, Ok(&[.., _, _])) => "None, Ok(at least two elements)", - _ => "other" - } -} - -fn main() { - assert_eq!(match_vecs(&[1, 2], &[2, 3]), "both non-empty"); - assert_eq!(match_vecs(&[], &[1, 2, 3, 4]), "one empty"); - assert_eq!(match_vecs::(&[], &[]), "both empty"); - assert_eq!(match_vecs(&[1, 2, 3], &[]), "one empty"); - - assert_eq!(match_vecs_cons(&[1, 2], &[2, 3]), "both non-empty"); - assert_eq!(match_vecs_cons(&[], &[1, 2, 3, 4]), "one empty"); - assert_eq!(match_vecs_cons::(&[], &[]), "both empty"); - assert_eq!(match_vecs_cons(&[1, 2, 3], &[]), "one empty"); - - assert_eq!(match_vecs_snoc(&[1, 2], &[2, 3]), "both non-empty"); - assert_eq!(match_vecs_snoc(&[], &[1, 2, 3, 4]), "one empty"); - assert_eq!(match_vecs_snoc::(&[], &[]), "both empty"); - assert_eq!(match_vecs_snoc(&[1, 2, 3], &[]), "one empty"); - - assert_eq!(match_nested_vecs_cons(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), - "None, Ok(at least two elements)"); - assert_eq!(match_nested_vecs_cons::(None, Err(())), "None, Ok(less than one element)"); - assert_eq!(match_nested_vecs_cons::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), - "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_cons(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), - "Some(non-empty), any"); - - assert_eq!(match_nested_vecs_snoc(None, Ok::<&[_], ()>(&[4_usize, 2_usize])), - "None, Ok(at least two elements)"); - assert_eq!(match_nested_vecs_snoc::(None, Err(())), "None, Ok(less than one element)"); - assert_eq!(match_nested_vecs_snoc::(Some::<&[_]>(&[]), Ok::<&[_], ()>(&[])), - "Some(empty), Ok(empty)"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[1]), Err(())), "Some(non-empty), any"); - assert_eq!(match_nested_vecs_snoc(Some::<&[_]>(&[(42, ())]), Ok::<&[_], ()>(&[(1, ())])), - "Some(non-empty), any"); -} diff --git a/src/test/ui/run-pass/binding/match-vec-rvalue.rs b/src/test/ui/run-pass/binding/match-vec-rvalue.rs deleted file mode 100644 index 308a4938b3a..00000000000 --- a/src/test/ui/run-pass/binding/match-vec-rvalue.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that matching rvalues with drops does not crash. - - - -pub fn main() { - match vec![1, 2, 3] { - x => { - assert_eq!(x.len(), 3); - assert_eq!(x[0], 1); - assert_eq!(x[1], 2); - assert_eq!(x[2], 3); - } - } -} diff --git a/src/test/ui/run-pass/binding/match-with-ret-arm.rs b/src/test/ui/run-pass/binding/match-with-ret-arm.rs deleted file mode 100644 index fe7aa288d52..00000000000 --- a/src/test/ui/run-pass/binding/match-with-ret-arm.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - // sometimes we have had trouble finding - // the right type for f, as we unified - // bot and u32 here - let f = match "1234".parse::().ok() { - None => return (), - Some(num) => num as u32 - }; - assert_eq!(f, 1234); - println!("{}", f) -} diff --git a/src/test/ui/run-pass/binding/multi-let.rs b/src/test/ui/run-pass/binding/multi-let.rs deleted file mode 100644 index 6ecd84d8c58..00000000000 --- a/src/test/ui/run-pass/binding/multi-let.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = 10; - let y = x; - assert_eq!(y, 10); -} diff --git a/src/test/ui/run-pass/binding/mut-in-ident-patterns.rs b/src/test/ui/run-pass/binding/mut-in-ident-patterns.rs deleted file mode 100644 index 1e28b77f2ce..00000000000 --- a/src/test/ui/run-pass/binding/mut-in-ident-patterns.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_shorthand_field_patterns)] - -trait Foo { - fn foo(&self, mut x: isize) -> isize { - let val = x; - x = 37 * x; - val + x - } -} - -struct X; -impl Foo for X {} - -pub fn main() { - let (a, mut b) = (23, 4); - assert_eq!(a, 23); - assert_eq!(b, 4); - b = a + b; - assert_eq!(b, 27); - - - assert_eq!(X.foo(2), 76); - - enum Bar { - Foo(isize), - Baz(f32, u8) - } - - let (x, mut y) = (32, Bar::Foo(21)); - - match x { - mut z @ 32 => { - assert_eq!(z, 32); - z = 34; - assert_eq!(z, 34); - } - _ => {} - } - - check_bar(&y); - y = Bar::Baz(10.0, 3); - check_bar(&y); - - fn check_bar(y: &Bar) { - match y { - &Bar::Foo(a) => { - assert_eq!(a, 21); - } - &Bar::Baz(a, b) => { - assert_eq!(a, 10.0); - assert_eq!(b, 3); - } - } - } - - fn foo1((x, mut y): (f64, isize), mut z: isize) -> isize { - y = 2 * 6; - z = y + (x as isize); - y - z - } - - struct A { - x: isize - } - let A { x: mut x } = A { x: 10 }; - assert_eq!(x, 10); - x = 30; - assert_eq!(x, 30); - - (|A { x: mut t }: A| { t = t+1; t })(A { x: 34 }); - -} diff --git a/src/test/ui/run-pass/binding/nested-exhaustive-match.rs b/src/test/ui/run-pass/binding/nested-exhaustive-match.rs deleted file mode 100644 index 8456e63d4c7..00000000000 --- a/src/test/ui/run-pass/binding/nested-exhaustive-match.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo { foo: bool, bar: Option, baz: isize } - -pub fn main() { - match (Foo{foo: true, bar: Some(10), baz: 20}) { - Foo{foo: true, bar: Some(_), ..} => {} - Foo{foo: false, bar: None, ..} => {} - Foo{foo: true, bar: None, ..} => {} - Foo{foo: false, bar: Some(_), ..} => {} - } -} diff --git a/src/test/ui/run-pass/binding/nested-matchs.rs b/src/test/ui/run-pass/binding/nested-matchs.rs deleted file mode 100644 index e1012f3b384..00000000000 --- a/src/test/ui/run-pass/binding/nested-matchs.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn baz() -> ! { panic!(); } - -fn foo() { - match Some::(5) { - Some::(_x) => { - let mut bar; - match None:: { None:: => { bar = 5; } _ => { baz(); } } - println!("{}", bar); - } - None:: => { println!("hello"); } - } -} - -pub fn main() { foo(); } diff --git a/src/test/ui/run-pass/binding/nested-pattern.rs b/src/test/ui/run-pass/binding/nested-pattern.rs deleted file mode 100644 index 5bf558a4871..00000000000 --- a/src/test/ui/run-pass/binding/nested-pattern.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// a bug was causing this to complain about leaked memory on exit - -enum t { foo(isize, usize), bar(isize, Option), } - -fn nested(o: t) { - match o { - t::bar(_i, Some::(_)) => { println!("wrong pattern matched"); panic!(); } - _ => { println!("succeeded"); } - } -} - -pub fn main() { nested(t::bar(1, None::)); } diff --git a/src/test/ui/run-pass/binding/nil-pattern.rs b/src/test/ui/run-pass/binding/nil-pattern.rs deleted file mode 100644 index 39b2f2da624..00000000000 --- a/src/test/ui/run-pass/binding/nil-pattern.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { let x = (); match x { () => { } } } diff --git a/src/test/ui/run-pass/binding/nullary-or-pattern.rs b/src/test/ui/run-pass/binding/nullary-or-pattern.rs deleted file mode 100644 index 892464dd1db..00000000000 --- a/src/test/ui/run-pass/binding/nullary-or-pattern.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum blah { a, b, } - -fn or_alt(q: blah) -> isize { - match q { blah::a | blah::b => { 42 } } -} - -pub fn main() { - assert_eq!(or_alt(blah::a), 42); - assert_eq!(or_alt(blah::b), 42); -} diff --git a/src/test/ui/run-pass/binding/optional_comma_in_match_arm.rs b/src/test/ui/run-pass/binding/optional_comma_in_match_arm.rs deleted file mode 100644 index 90ef3c2b7ea..00000000000 --- a/src/test/ui/run-pass/binding/optional_comma_in_match_arm.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37199 -#![allow(while_true)] - -fn main() { - let x = 1; - - match x { - 1 => loop { break; }, - 2 => while true { break; }, - 3 => if true { () }, - 4 => if true { () } else { () }, - 5 => match () { () => () }, - 6 => { () }, - 7 => unsafe { () }, - _ => (), - } - - match x { - 1 => loop { break; } - 2 => while true { break; } - 3 => if true { () } - 4 => if true { () } else { () } - 5 => match () { () => () } - 6 => { () } - 7 => unsafe { () } - _ => () - } - - let r: &i32 = &x; - - match r { - // Absence of comma should not cause confusion between a pattern - // and a bitwise and. - &1 => if true { () } else { () } - &2 => (), - _ =>() - } -} diff --git a/src/test/ui/run-pass/binding/or-pattern.rs b/src/test/ui/run-pass/binding/or-pattern.rs deleted file mode 100644 index a9b3e278652..00000000000 --- a/src/test/ui/run-pass/binding/or-pattern.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum blah { a(isize, isize, usize), b(isize, isize), c, } - -fn or_alt(q: blah) -> isize { - match q { blah::a(x, y, _) | blah::b(x, y) => { return x + y; } blah::c => { return 0; } } -} - -pub fn main() { - assert_eq!(or_alt(blah::c), 0); - assert_eq!(or_alt(blah::a(10, 100, 0)), 110); - assert_eq!(or_alt(blah::b(20, 200)), 220); -} diff --git a/src/test/ui/run-pass/binding/order-drop-with-match.rs b/src/test/ui/run-pass/binding/order-drop-with-match.rs deleted file mode 100644 index 7bb929325ad..00000000000 --- a/src/test/ui/run-pass/binding/order-drop-with-match.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test to make sure the destructors run in the right order. -// Each destructor sets it's tag in the corresponding entry -// in ORDER matching up to when it ran. -// Correct order is: matched, inner, outer - - -static mut ORDER: [usize; 3] = [0, 0, 0]; -static mut INDEX: usize = 0; - -struct A; -impl Drop for A { - fn drop(&mut self) { - unsafe { - ORDER[INDEX] = 1; - INDEX = INDEX + 1; - } - } -} - -struct B; -impl Drop for B { - fn drop(&mut self) { - unsafe { - ORDER[INDEX] = 2; - INDEX = INDEX + 1; - } - } -} - -struct C; -impl Drop for C { - fn drop(&mut self) { - unsafe { - ORDER[INDEX] = 3; - INDEX = INDEX + 1; - } - } -} - -fn main() { - { - let matched = A; - let _outer = C; - { - match matched { - _s => {} - } - let _inner = B; - } - } - unsafe { - let expected: &[_] = &[1, 2, 3]; - assert_eq!(expected, ORDER); - } -} diff --git a/src/test/ui/run-pass/binding/pat-ranges.rs b/src/test/ui/run-pass/binding/pat-ranges.rs deleted file mode 100644 index 44666eda3ca..00000000000 --- a/src/test/ui/run-pass/binding/pat-ranges.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Parsing of range patterns - -const NUM1: i32 = 10; - -mod m { - pub const NUM2: i32 = 16; -} - -fn main() { - if let NUM1 ... m::NUM2 = 10 {} else { panic!() } - if let ::NUM1 ... ::m::NUM2 = 11 {} else { panic!() } - if let -13 ... -10 = 12 { panic!() } else {} -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-1.rs b/src/test/ui/run-pass/binding/pat-tuple-1.rs deleted file mode 100644 index dc8a7ff7a07..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-1.rs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn tuple() { - let x = (1, 2, 3); - match x { - (a, b, ..) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - } - } - match x { - (.., b, c) => { - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - (a, .., c) => { - assert_eq!(a, 1); - assert_eq!(c, 3); - } - } - match x { - (a, b, c) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - (a, b, c, ..) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - (.., a, b, c) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } -} - -fn tuple_struct() { - struct S(u8, u8, u8); - - let x = S(1, 2, 3); - match x { - S(a, b, ..) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - } - } - match x { - S(.., b, c) => { - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - S(a, .., c) => { - assert_eq!(a, 1); - assert_eq!(c, 3); - } - } - match x { - S(a, b, c) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - S(a, b, c, ..) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } - match x { - S(.., a, b, c) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - } - } -} - -fn main() { - tuple(); - tuple_struct(); -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-2.rs b/src/test/ui/run-pass/binding/pat-tuple-2.rs deleted file mode 100644 index 0428e32c43b..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn tuple() { - let x = (1,); - match x { - (2, ..) => panic!(), - (..) => () - } -} - -fn tuple_struct() { - struct S(u8); - - let x = S(1); - match x { - S(2, ..) => panic!(), - S(..) => () - } -} - -fn main() { - tuple(); - tuple_struct(); -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-3.rs b/src/test/ui/run-pass/binding/pat-tuple-3.rs deleted file mode 100644 index 60b933e4ce4..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-3.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn tuple() { - let x = (1, 2, 3); - let branch = match x { - (1, 1, ..) => 0, - (1, 2, 3, ..) => 1, - (1, 2, ..) => 2, - _ => 3 - }; - assert_eq!(branch, 1); -} - -fn tuple_struct() { - struct S(u8, u8, u8); - - let x = S(1, 2, 3); - let branch = match x { - S(1, 1, ..) => 0, - S(1, 2, 3, ..) => 1, - S(1, 2, ..) => 2, - _ => 3 - }; - assert_eq!(branch, 1); -} - -fn main() { - tuple(); - tuple_struct(); -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-4.rs b/src/test/ui/run-pass/binding/pat-tuple-4.rs deleted file mode 100644 index cd19f2c67a1..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-4.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn tuple() { - let x = (1, 2, 3); - match x { - (1, 2, 4) => unreachable!(), - (0, 2, 3, ..) => unreachable!(), - (0, .., 3) => unreachable!(), - (0, ..) => unreachable!(), - (1, 2, 3) => (), - (_, _, _) => unreachable!(), - } - match x { - (..) => (), - } - match x { - (_, _, _, ..) => (), - } - match x { - (a, b, c) => { - assert_eq!(1, a); - assert_eq!(2, b); - assert_eq!(3, c); - } - } -} - -fn tuple_struct() { - struct S(u8, u8, u8); - - let x = S(1, 2, 3); - match x { - S(1, 2, 4) => unreachable!(), - S(0, 2, 3, ..) => unreachable!(), - S(0, .., 3) => unreachable!(), - S(0, ..) => unreachable!(), - S(1, 2, 3) => (), - S(_, _, _) => unreachable!(), - } - match x { - S(..) => (), - } - match x { - S(_, _, _, ..) => (), - } - match x { - S(a, b, c) => { - assert_eq!(1, a); - assert_eq!(2, b); - assert_eq!(3, c); - } - } -} - -fn main() { - tuple(); - tuple_struct(); -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-5.rs b/src/test/ui/run-pass/binding/pat-tuple-5.rs deleted file mode 100644 index 0ac4c24c4ee..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-5.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn tuple() { - struct S; - struct Z; - struct W; - let x = (S, Z, W); - match x { (S, ..) => {} } - match x { (.., W) => {} } - match x { (S, .., W) => {} } - match x { (.., Z, _) => {} } -} - -fn tuple_struct() { - struct SS(S, Z, W); - - struct S; - struct Z; - struct W; - let x = SS(S, Z, W); - match x { SS(S, ..) => {} } - match x { SS(.., W) => {} } - match x { SS(S, .., W) => {} } - match x { SS(.., Z, _) => {} } -} - -fn main() { - tuple(); - tuple_struct(); -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-6.rs b/src/test/ui/run-pass/binding/pat-tuple-6.rs deleted file mode 100644 index b3cd0e1b543..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-6.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn tuple() { - let x = (1, 2, 3, 4, 5); - match x { - (a, .., b, c) => { - assert_eq!(a, 1); - assert_eq!(b, 4); - assert_eq!(c, 5); - } - } - match x { - (a, b, c, .., d) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - assert_eq!(d, 5); - } - } -} - -fn tuple_struct() { - struct S(u8, u8, u8, u8, u8); - - let x = S(1, 2, 3, 4, 5); - match x { - S(a, .., b, c) => { - assert_eq!(a, 1); - assert_eq!(b, 4); - assert_eq!(c, 5); - } - } - match x { - S(a, b, c, .., d) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - assert_eq!(d, 5); - } - } -} - -fn main() { - tuple(); - tuple_struct(); -} diff --git a/src/test/ui/run-pass/binding/pat-tuple-7.rs b/src/test/ui/run-pass/binding/pat-tuple-7.rs deleted file mode 100644 index c32b52eac33..00000000000 --- a/src/test/ui/run-pass/binding/pat-tuple-7.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - match 0 { - (pat) => assert_eq!(pat, 0) - } -} diff --git a/src/test/ui/run-pass/binding/pattern-bound-var-in-for-each.rs b/src/test/ui/run-pass/binding/pattern-bound-var-in-for-each.rs deleted file mode 100644 index 2ee697fe2ff..00000000000 --- a/src/test/ui/run-pass/binding/pattern-bound-var-in-for-each.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that codegen_path checks whether a -// pattern-bound var is an upvar (when codegenning -// the for-each body) - - -fn foo(src: usize) { - - match Some(src) { - Some(src_id) => { - for _i in 0_usize..10_usize { - let yyy = src_id; - assert_eq!(yyy, 0_usize); - } - } - _ => { } - } -} - -pub fn main() { foo(0_usize); } diff --git a/src/test/ui/run-pass/binding/pattern-in-closure.rs b/src/test/ui/run-pass/binding/pattern-in-closure.rs deleted file mode 100644 index 9a5a420a80b..00000000000 --- a/src/test/ui/run-pass/binding/pattern-in-closure.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -struct Foo { - x: isize, - y: isize -} - -pub fn main() { - let f = |(x, _): (isize, isize)| println!("{}", x + 1); - let g = |Foo { x: x, y: _y }: Foo| println!("{}", x + 1); - f((2, 3)); - g(Foo { x: 1, y: 2 }); -} diff --git a/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs b/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs deleted file mode 100644 index d492edb1617..00000000000 --- a/src/test/ui/run-pass/binding/range-inclusive-pattern-precedence.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_patterns)] - -const VALUE: usize = 21; - -pub fn main() { - match &18 { - &(18..=18) => {} - _ => { unreachable!(); } - } - match &21 { - &(VALUE..=VALUE) => {} - _ => { unreachable!(); } - } - match Box::new(18) { - box (18..=18) => {} - _ => { unreachable!(); } - } - match Box::new(21) { - box (VALUE..=VALUE) => {} - _ => { unreachable!(); } - } -} diff --git a/src/test/ui/run-pass/binding/simple-generic-match.rs b/src/test/ui/run-pass/binding/simple-generic-match.rs deleted file mode 100644 index 13c16790e09..00000000000 --- a/src/test/ui/run-pass/binding/simple-generic-match.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum clam { a(T), } - -pub fn main() { let c = clam::a(2); match c { clam::a::(_) => { } } } diff --git a/src/test/ui/run-pass/binding/use-uninit-match.rs b/src/test/ui/run-pass/binding/use-uninit-match.rs deleted file mode 100644 index 1fc597b636e..00000000000 --- a/src/test/ui/run-pass/binding/use-uninit-match.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -fn foo(o: myoption) -> isize { - let mut x: isize = 5; - match o { - myoption::none:: => { } - myoption::some::(_t) => { x += 1; } - } - return x; -} - -enum myoption { none, some(T), } - -pub fn main() { println!("{}", 5); } diff --git a/src/test/ui/run-pass/binding/use-uninit-match2.rs b/src/test/ui/run-pass/binding/use-uninit-match2.rs deleted file mode 100644 index 8eb44fd76e1..00000000000 --- a/src/test/ui/run-pass/binding/use-uninit-match2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -fn foo(o: myoption) -> isize { - let mut x: isize; - match o { - myoption::none:: => { panic!(); } - myoption::some::(_t) => { x = 5; } - } - return x; -} - -enum myoption { none, some(T), } - -pub fn main() { println!("{}", 5); } diff --git a/src/test/ui/run-pass/binding/zero_sized_subslice_match.rs b/src/test/ui/run-pass/binding/zero_sized_subslice_match.rs deleted file mode 100644 index db71d97a19d..00000000000 --- a/src/test/ui/run-pass/binding/zero_sized_subslice_match.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn main() { - let x = [(), ()]; - - // The subslice used to go out of bounds for zero-sized array items, check that this doesn't - // happen anymore - match x { - [_, ref y..] => assert_eq!(&x[1] as *const (), &y[0] as *const ()) - } -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-assign-to-subfield.rs b/src/test/ui/run-pass/borrowck/borrowck-assign-to-subfield.rs deleted file mode 100644 index 248e34bde09..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-assign-to-subfield.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - struct A { - a: isize, - w: B, - } - struct B { - a: isize - } - let mut p = A { - a: 1, - w: B {a: 1}, - }; - - // even though `x` is not declared as a mutable field, - // `p` as a whole is mutable, so it can be modified. - p.a = 2; - - // this is true for an interior field too - p.w.a = 2; -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/ui/run-pass/borrowck/borrowck-assignment-to-static-mut.rs deleted file mode 100644 index fa79ac84c86..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-assignment-to-static-mut.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641) - -// revisions: ast mir -//[mir]compile-flags: -Z borrowck=mir - -static mut Y: u32 = 0; - -unsafe fn should_ok() { - Y = 1; -} - -fn main() {} diff --git a/src/test/ui/run-pass/borrowck/borrowck-binding-mutbl.rs b/src/test/ui/run-pass/borrowck/borrowck-binding-mutbl.rs deleted file mode 100644 index 86875a038da..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-binding-mutbl.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct F { f: Vec } - -fn impure(_v: &[isize]) { -} - -pub fn main() { - let mut x = F {f: vec![3]}; - - match x { - F {f: ref mut v} => { - impure(v); - } - } -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-borrow-from-expr-block.rs b/src/test/ui/run-pass/borrowck/borrowck-borrow-from-expr-block.rs deleted file mode 100644 index b85a9baf5a0..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-borrow-from-expr-block.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn borrow(x: &isize, f: F) where F: FnOnce(&isize) { - f(x) -} - -fn test1(x: &Box) { - borrow(&*(*x).clone(), |p| { - let x_a = &**x as *const isize; - assert!((x_a as usize) != (p as *const isize as usize)); - assert_eq!(unsafe{*x_a}, *p); - }) -} - -pub fn main() { - test1(&box 22); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs b/src/test/ui/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs deleted file mode 100644 index 72634651d95..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that freezing an `&mut` pointer while referent is -// frozen is legal. -// -// Example from src/librustc_borrowck/borrowck/README.md - -// pretty-expanded FIXME #23616 - -fn foo<'a>(mut t0: &'a mut isize, - mut t1: &'a mut isize) { - let p: &isize = &*t0; // Freezes `*t0` - let mut t2 = &t0; - let q: &isize = &**t2; // Freezes `*t0`, but that's ok... - let r: &isize = &*t0; // ...after all, could do same thing directly. -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-closures-two-imm.rs b/src/test/ui/run-pass/borrowck/borrowck-closures-two-imm.rs deleted file mode 100644 index 8c6d92c9962..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-closures-two-imm.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that two closures can simultaneously have immutable -// access to the variable, whether that immutable access be used -// for direct reads or for taking immutable ref. Also check -// that the main function can read the variable too while -// the closures are in scope. Issue #6801. - - -fn a() -> i32 { - let mut x = 3; - x += 1; - let c1 = || x * 4; - let c2 = || x * 5; - c1() * c2() * x -} - -fn get(x: &i32) -> i32 { - *x * 4 -} - -fn b() -> i32 { - let mut x = 3; - x += 1; - let c1 = || get(&x); - let c2 = || get(&x); - c1() * c2() * x -} - -fn c() -> i32 { - let mut x = 3; - x += 1; - let c1 = || x * 5; - let c2 = || get(&x); - c1() * c2() * x -} - -pub fn main() { - assert_eq!(a(), 1280); - assert_eq!(b(), 1024); - assert_eq!(c(), 1280); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-field-sensitivity.rs b/src/test/ui/run-pass/borrowck/borrowck-field-sensitivity.rs deleted file mode 100644 index a3d6f129f18..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-field-sensitivity.rs +++ /dev/null @@ -1,274 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -struct A { a: isize, b: Box } -struct B { a: Box, b: Box } - -fn move_after_copy() { - let x = A { a: 1, b: box 2 }; - drop(x.a); - drop(x.b); -} - -fn move_after_fu_copy() { - let x = A { a: 1, b: box 2 }; - let _y = A { b: box 3, .. x }; - drop(x.b); -} - -fn fu_move_after_copy() { - let x = A { a: 1, b: box 2 }; - drop(x.a); - let _y = A { a: 3, .. x }; -} - -fn fu_move_after_fu_copy() { - let x = A { a: 1, b: box 2 }; - let _y = A { b: box 3, .. x }; - let _z = A { a: 4, .. x }; -} - -fn copy_after_move() { - let x = A { a: 1, b: box 2 }; - drop(x.b); - drop(x.a); -} - -fn copy_after_fu_move() { - let x = A { a: 1, b: box 2 }; - let y = A { a: 3, .. x }; - drop(x.a); -} - -fn fu_copy_after_move() { - let x = A { a: 1, b: box 2 }; - drop(x.b); - let _y = A { b: box 3, .. x }; -} - -fn fu_copy_after_fu_move() { - let x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - let _z = A { b: box 3, .. x }; -} - -fn borrow_after_move() { - let x = A { a: 1, b: box 2 }; - drop(x.b); - let p = &x.a; - drop(*p); -} - -fn borrow_after_fu_move() { - let x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - let p = &x.a; - drop(*p); -} - -fn move_after_borrow() { - let x = A { a: 1, b: box 2 }; - let p = &x.a; - drop(x.b); - drop(*p); -} - -fn fu_move_after_borrow() { - let x = A { a: 1, b: box 2 }; - let p = &x.a; - let _y = A { a: 3, .. x }; - drop(*p); -} - -fn mut_borrow_after_mut_borrow() { - let mut x = A { a: 1, b: box 2 }; - let p = &mut x.a; - let q = &mut x.b; - drop(*p); - drop(**q); -} - -fn move_after_move() { - let x = B { a: box 1, b: box 2 }; - drop(x.a); - drop(x.b); -} - -fn move_after_fu_move() { - let x = B { a: box 1, b: box 2 }; - let y = B { a: box 3, .. x }; - drop(x.a); -} - -fn fu_move_after_move() { - let x = B { a: box 1, b: box 2 }; - drop(x.a); - let z = B { a: box 3, .. x }; - drop(z.b); -} - -fn fu_move_after_fu_move() { - let x = B { a: box 1, b: box 2 }; - let _y = B { b: box 3, .. x }; - let _z = B { a: box 4, .. x }; -} - -fn copy_after_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; - drop(x.b); - x = A { a: 3, b: box 4 }; - drop(*x.b); -} - -fn copy_after_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - x = A { a: 3, b: box 4 }; - drop(*x.b); -} - -fn copy_after_field_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; - drop(x.b); - x.b = box 3; - drop(*x.b); -} - -fn copy_after_field_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - x.b = box 3; - drop(*x.b); -} - -fn borrow_after_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; - drop(x.b); - x = A { a: 3, b: box 4 }; - let p = &x.b; - drop(**p); -} - -fn borrow_after_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - x = A { a: 3, b: box 4 }; - let p = &x.b; - drop(**p); -} - -fn borrow_after_field_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; - drop(x.b); - x.b = box 3; - let p = &x.b; - drop(**p); -} - -fn borrow_after_field_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - x.b = box 3; - let p = &x.b; - drop(**p); -} - -fn move_after_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = x.b; - x = A { a: 3, b: box 4 }; - drop(x.b); -} - -fn move_after_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - x = A { a: 3, b: box 4 }; - drop(x.b); -} - -fn move_after_field_assign_after_move() { - let mut x = A { a: 1, b: box 2 }; - drop(x.b); - x.b = box 3; - drop(x.b); -} - -fn move_after_field_assign_after_fu_move() { - let mut x = A { a: 1, b: box 2 }; - let _y = A { a: 3, .. x }; - x.b = box 3; - drop(x.b); -} - -fn copy_after_assign_after_uninit() { - let mut x: A; - x = A { a: 1, b: box 2 }; - drop(x.a); -} - -fn borrow_after_assign_after_uninit() { - let mut x: A; - x = A { a: 1, b: box 2 }; - let p = &x.a; - drop(*p); -} - -fn move_after_assign_after_uninit() { - let mut x: A; - x = A { a: 1, b: box 2 }; - drop(x.b); -} - -fn main() { - move_after_copy(); - move_after_fu_copy(); - fu_move_after_copy(); - fu_move_after_fu_copy(); - copy_after_move(); - copy_after_fu_move(); - fu_copy_after_move(); - fu_copy_after_fu_move(); - - borrow_after_move(); - borrow_after_fu_move(); - move_after_borrow(); - fu_move_after_borrow(); - mut_borrow_after_mut_borrow(); - - move_after_move(); - move_after_fu_move(); - fu_move_after_move(); - fu_move_after_fu_move(); - - copy_after_assign_after_move(); - copy_after_assign_after_fu_move(); - copy_after_field_assign_after_move(); - copy_after_field_assign_after_fu_move(); - - borrow_after_assign_after_move(); - borrow_after_assign_after_fu_move(); - borrow_after_field_assign_after_move(); - borrow_after_field_assign_after_fu_move(); - - move_after_assign_after_move(); - move_after_assign_after_fu_move(); - move_after_field_assign_after_move(); - move_after_field_assign_after_fu_move(); - - copy_after_assign_after_uninit(); - borrow_after_assign_after_uninit(); - move_after_assign_after_uninit(); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-fixed-length-vecs.rs b/src/test/ui/run-pass/borrowck/borrowck-fixed-length-vecs.rs deleted file mode 100644 index baefdf657ea..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-fixed-length-vecs.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = [22]; - let y = &x[0]; - assert_eq!(*y, 22); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-freeze-frozen-mut.rs b/src/test/ui/run-pass/borrowck/borrowck-freeze-frozen-mut.rs deleted file mode 100644 index 0ddb71d1d15..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-freeze-frozen-mut.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a `&mut` inside of an `&` is freezable. - - -struct MutSlice<'a, T:'a> { - data: &'a mut [T] -} - -fn get<'a, T>(ms: &'a MutSlice<'a, T>, index: usize) -> &'a T { - &ms.data[index] -} - -pub fn main() { - let mut data = [1, 2, 3]; - { - let slice = MutSlice { data: &mut data }; - slice.data[0] += 4; - let index0 = get(&slice, 0); - let index1 = get(&slice, 1); - let index2 = get(&slice, 2); - assert_eq!(*index0, 5); - assert_eq!(*index1, 2); - assert_eq!(*index2, 3); - } - assert_eq!(data[0], 5); - assert_eq!(data[1], 2); - assert_eq!(data[2], 3); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-lend-args.rs b/src/test/ui/run-pass/borrowck/borrowck-lend-args.rs deleted file mode 100644 index 4ec7e0a5898..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-lend-args.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -fn borrow(_v: &isize) {} - -fn borrow_from_arg_imm_ref(v: Box) { - borrow(&*v); -} - -fn borrow_from_arg_mut_ref(v: &mut Box) { - borrow(&**v); -} - -fn borrow_from_arg_copy(v: Box) { - borrow(&*v); -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs b/src/test/ui/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs deleted file mode 100644 index 3f81c2e5619..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unconditional_recursion)] - -// Check that we do not ICE when compiling this -// macro, which reuses the expression `$id` - - -#![feature(box_patterns)] -#![feature(box_syntax)] - -struct Foo { - a: isize -} - -pub enum Bar { - Bar1, Bar2(isize, Box), -} - -impl Foo { - fn elaborate_stm(&mut self, s: Box) -> Box { - macro_rules! declare { - ($id:expr, $rest:expr) => ({ - self.check_id($id); - box Bar::Bar2($id, $rest) - }) - } - match s { - box Bar::Bar2(id, rest) => declare!(id, self.elaborate_stm(rest)), - _ => panic!() - } - } - - fn check_id(&mut self, s: isize) { panic!() } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/borrowck/borrowck-move-by-capture-ok.rs b/src/test/ui/run-pass/borrowck/borrowck-move-by-capture-ok.rs deleted file mode 100644 index 180a6ad8f87..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-move-by-capture-ok.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let bar: Box<_> = box 3; - let h = || -> isize { *bar }; - assert_eq!(h(), 3); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs b/src/test/ui/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs deleted file mode 100644 index 4650ce8d2c4..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test case from #39963. - -#![feature(nll)] - -#[derive(Clone)] -struct Foo(Option>, Option>); - -fn test(f: &mut Foo) { - match *f { - Foo(Some(ref mut left), Some(ref mut right)) => match **left { - Foo(Some(ref mut left), Some(ref mut right)) => panic!(), - _ => panic!(), - }, - _ => panic!(), - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-mut-uniq.rs b/src/test/ui/run-pass/borrowck/borrowck-mut-uniq.rs deleted file mode 100644 index 87dd1f1de53..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-mut-uniq.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::mem::swap; - -#[derive(Debug)] -struct Ints {sum: Box, values: Vec } - -fn add_int(x: &mut Ints, v: isize) { - *x.sum += v; - let mut values = Vec::new(); - swap(&mut values, &mut x.values); - values.push(v); - swap(&mut values, &mut x.values); -} - -fn iter_ints(x: &Ints, mut f: F) -> bool where F: FnMut(&isize) -> bool { - let l = x.values.len(); - (0..l).all(|i| f(&x.values[i])) -} - -pub fn main() { - let mut ints: Box<_> = box Ints {sum: box 0, values: Vec::new()}; - add_int(&mut *ints, 22); - add_int(&mut *ints, 44); - - iter_ints(&*ints, |i| { - println!("isize = {:?}", *i); - true - }); - - println!("ints={:?}", ints); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs b/src/test/ui/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs deleted file mode 100644 index b616cf25382..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-mut-vec-as-imm-slice.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn want_slice(v: &[isize]) -> isize { - let mut sum = 0; - for i in v { sum += *i; } - sum -} - -fn has_mut_vec(v: Vec ) -> isize { - want_slice(&v) -} - -pub fn main() { - assert_eq!(has_mut_vec(vec![1, 2, 3]), 6); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-pat-enum.rs b/src/test/ui/run-pass/borrowck/borrowck-pat-enum.rs deleted file mode 100644 index 3b9c4aed03e..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-pat-enum.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37199 - -fn match_ref(v: Option) -> isize { - match v { - Some(ref i) => { - *i - } - None => {0} - } -} - -fn match_ref_unused(v: Option) { - match v { - Some(_) => {} - None => {} - } -} - -fn impure(_i: isize) { -} - -fn match_imm_reg(v: &Option) { - match *v { - Some(ref i) => {impure(*i)} // OK because immutable - None => {} - } -} - -fn match_mut_reg(v: &mut Option) { - match *v { - Some(ref i) => {impure(*i)} // OK, frozen - None => {} - } -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs b/src/test/ui/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs deleted file mode 100644 index 1ce7a00d423..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-pat-reassign-no-binding.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let mut x = None; - match x { - None => { - // It is ok to reassign x here, because there is in - // fact no outstanding loan of x! - x = Some(0); - } - Some(_) => { } - } - assert_eq!(x, Some(0)); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-rvalues-mutable.rs b/src/test/ui/run-pass/borrowck/borrowck-rvalues-mutable.rs deleted file mode 100644 index 936e5565eed..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-rvalues-mutable.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Counter { - value: usize -} - -impl Counter { - fn new(v: usize) -> Counter { - Counter {value: v} - } - - fn inc<'a>(&'a mut self) -> &'a mut Counter { - self.value += 1; - self - } - - fn get(&self) -> usize { - self.value - } - - fn get_and_inc(&mut self) -> usize { - let v = self.value; - self.value += 1; - v - } -} - -pub fn main() { - let v = Counter::new(22).get_and_inc(); - assert_eq!(v, 22); - - let v = Counter::new(22).inc().inc().get(); - assert_eq!(v, 24); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs b/src/test/ui/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs deleted file mode 100644 index dd832b9eee0..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-scope-of-deref-issue-4666.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that the scope of the pointer returned from `get()` is -// limited to the deref operation itself, and does not infect the -// block as a whole. - - -struct Box { - x: usize -} - -impl Box { - fn get(&self) -> &usize { - &self.x - } - fn set(&mut self, x: usize) { - self.x = x; - } -} - -fn fun1() { - // in the past, borrow checker behaved differently when - // init and decl of `v` were distinct - let v; - let mut a_box = Box {x: 0}; - a_box.set(22); - v = *a_box.get(); - a_box.set(v+1); - assert_eq!(23, *a_box.get()); -} - -fn fun2() { - let mut a_box = Box {x: 0}; - a_box.set(22); - let v = *a_box.get(); - a_box.set(v+1); - assert_eq!(23, *a_box.get()); -} - -pub fn main() { - fun1(); - fun2(); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs b/src/test/ui/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs deleted file mode 100644 index e7c1699f7b4..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-slice-pattern-element-loan.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -//compile-flags: -Z borrowck=mir - -#![feature(slice_patterns)] - -fn mut_head_tail<'a, A>(v: &'a mut [A]) -> Option<(&'a mut A, &'a mut [A])> { - match *v { - [ref mut head, ref mut tail..] => { - Some((head, tail)) - } - [] => None - } -} - -fn main() { - let mut v = [1,2,3,4]; - match mut_head_tail(&mut v) { - None => {}, - Some((h,t)) => { - *h = 1000; - t.reverse(); - } - } -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-static-item-in-fn.rs b/src/test/ui/run-pass/borrowck/borrowck-static-item-in-fn.rs deleted file mode 100644 index 809948d5423..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-static-item-in-fn.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #7740 - -// pretty-expanded FIXME #23616 - -pub fn main() { - static A: &'static char = &'A'; -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-trait-lifetime.rs b/src/test/ui/run-pass/borrowck/borrowck-trait-lifetime.rs deleted file mode 100644 index cf7a976628e..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-trait-lifetime.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test verifies that casting from the same lifetime on a value -// to the same lifetime on a trait succeeds. See issue #10766. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -use std::marker; - -fn main() { - trait T { fn foo(&self) {} } - - fn f<'a, V: T>(v: &'a V) -> &'a T { - v as &'a T - } -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-uniq-via-ref.rs b/src/test/ui/run-pass/borrowck/borrowck-uniq-via-ref.rs deleted file mode 100644 index f9b650e0e82..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-uniq-via-ref.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -struct Rec { - f: Box, -} - -struct Outer { - f: Inner -} - -struct Inner { - g: Innermost -} - -struct Innermost { - h: Box, -} - -fn borrow(_v: &isize) {} - -fn box_mut(v: &mut Box) { - borrow(&**v); // OK: &mut -> &imm -} - -fn box_mut_rec(v: &mut Rec) { - borrow(&*v.f); // OK: &mut -> &imm -} - -fn box_mut_recs(v: &mut Outer) { - borrow(&*v.f.g.h); // OK: &mut -> &imm -} - -fn box_imm(v: &Box) { - borrow(&**v); // OK -} - -fn box_imm_rec(v: &Rec) { - borrow(&*v.f); // OK -} - -fn box_imm_recs(v: &Outer) { - borrow(&*v.f.g.h); // OK -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-univariant-enum.rs b/src/test/ui/run-pass/borrowck/borrowck-univariant-enum.rs deleted file mode 100644 index 0a8d3075336..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-univariant-enum.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -#[derive(Copy, Clone)] -enum newtype { - newvar(isize) -} - -pub fn main() { - - // Test that borrowck treats enums with a single variant - // specially. - - let x = &Cell::new(5); - let y = &Cell::new(newtype::newvar(3)); - let z = match y.get() { - newtype::newvar(b) => { - x.set(x.get() + 1); - x.get() * b - } - }; - assert_eq!(z, 18); -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs b/src/test/ui/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs deleted file mode 100644 index aba46ad609f..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-unsafe-static-mutable-borrows.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// revisions: ast mir -//[mir]compile-flags: -Z borrowck=mir - -// Test file taken from issue 45129 (https://github.com/rust-lang/rust/issues/45129) - -struct Foo { x: [usize; 2] } - -static mut SFOO: Foo = Foo { x: [23, 32] }; - -impl Foo { - fn x(&mut self) -> &mut usize { &mut self.x[0] } -} - -fn main() { - unsafe { - let sfoo: *mut Foo = &mut SFOO; - let x = (*sfoo).x(); - (*sfoo).x[1] += 1; - *x += 1; - } -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-unused-mut-locals.rs b/src/test/ui/run-pass/borrowck/borrowck-unused-mut-locals.rs deleted file mode 100644 index 15eaf83b508..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-unused-mut-locals.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(nll)] -#![deny(unused_mut)] - -#[derive(Debug)] -struct A {} - -fn init_a() -> A { - A {} -} - -#[derive(Debug)] -struct B<'a> { - ed: &'a mut A, -} - -fn init_b<'a>(ed: &'a mut A) -> B<'a> { - B { ed } -} - -#[derive(Debug)] -struct C<'a> { - pd: &'a mut B<'a>, -} - -fn init_c<'a>(pd: &'a mut B<'a>) -> C<'a> { - C { pd } -} - -#[derive(Debug)] -struct D<'a> { - sd: &'a mut C<'a>, -} - -fn init_d<'a>(sd: &'a mut C<'a>) -> D<'a> { - D { sd } -} - -fn main() { - let mut a = init_a(); - let mut b = init_b(&mut a); - let mut c = init_c(&mut b); - - let d = init_d(&mut c); - - println!("{:?}", d) -} diff --git a/src/test/ui/run-pass/borrowck/borrowck-use-mut-borrow.rs b/src/test/ui/run-pass/borrowck/borrowck-use-mut-borrow.rs deleted file mode 100644 index 10809c1bb0b..00000000000 --- a/src/test/ui/run-pass/borrowck/borrowck-use-mut-borrow.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -struct A { a: isize, b: Box } - -fn field_copy_after_field_borrow() { - let mut x = A { a: 1, b: box 2 }; - let p = &mut x.b; - drop(x.a); - **p = 3; -} - -fn fu_field_copy_after_field_borrow() { - let mut x = A { a: 1, b: box 2 }; - let p = &mut x.b; - let y = A { b: box 3, .. x }; - drop(y); - **p = 4; -} - -fn field_deref_after_field_borrow() { - let mut x = A { a: 1, b: box 2 }; - let p = &mut x.a; - drop(*x.b); - *p = 3; -} - -fn field_move_after_field_borrow() { - let mut x = A { a: 1, b: box 2 }; - let p = &mut x.a; - drop(x.b); - *p = 3; -} - -fn fu_field_move_after_field_borrow() { - let mut x = A { a: 1, b: box 2 }; - let p = &mut x.a; - let y = A { a: 3, .. x }; - drop(y); - *p = 4; -} - -fn main() { - field_copy_after_field_borrow(); - fu_field_copy_after_field_borrow(); - field_deref_after_field_borrow(); - field_move_after_field_borrow(); - fu_field_move_after_field_borrow(); -} diff --git a/src/test/ui/run-pass/borrowck/two-phase-baseline.rs b/src/test/ui/run-pass/borrowck/two-phase-baseline.rs deleted file mode 100644 index 561a5b3c115..00000000000 --- a/src/test/ui/run-pass/borrowck/two-phase-baseline.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z borrowck=mir -Z two-phase-borrows - -// This is the "goto example" for why we want two phase borrows. - -fn main() { - let mut v = vec![0, 1, 2]; - v.push(v.len()); - assert_eq!(v, [0, 1, 2, 3]); -} diff --git a/src/test/ui/run-pass/borrowck/two-phase-bin-ops.rs b/src/test/ui/run-pass/borrowck/two-phase-bin-ops.rs deleted file mode 100644 index ce601bc9a3c..00000000000 --- a/src/test/ui/run-pass/borrowck/two-phase-bin-ops.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// revisions: lxl nll - -#![cfg_attr(nll, feature(nll))] - -use std::ops::{AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; -use std::ops::{BitAndAssign, BitOrAssign, BitXorAssign, ShlAssign, ShrAssign}; - -struct A(i32); - -macro_rules! trivial_binop { - ($Trait:ident, $m:ident) => { - impl $Trait for A { fn $m(&mut self, rhs: i32) { self.0 = rhs; } } - } -} - -trivial_binop!(AddAssign, add_assign); -trivial_binop!(SubAssign, sub_assign); -trivial_binop!(MulAssign, mul_assign); -trivial_binop!(DivAssign, div_assign); -trivial_binop!(RemAssign, rem_assign); -trivial_binop!(BitAndAssign, bitand_assign); -trivial_binop!(BitOrAssign, bitor_assign); -trivial_binop!(BitXorAssign, bitxor_assign); -trivial_binop!(ShlAssign, shl_assign); -trivial_binop!(ShrAssign, shr_assign); - -fn main() { - let mut a = A(10); - a += a.0; - a -= a.0; - a *= a.0; - a /= a.0; - a &= a.0; - a |= a.0; - a ^= a.0; - a <<= a.0; - a >>= a.0; -} diff --git a/src/test/ui/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs b/src/test/ui/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs deleted file mode 100644 index 6d06d0c7941..00000000000 --- a/src/test/ui/run-pass/borrowck/two-phase-control-flow-split-before-activation.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// revisions: lxl nll -//[lxl]compile-flags: -Z borrowck=mir -Z two-phase-borrows - -#![cfg_attr(nll, feature(nll))] - -fn main() { - let mut a = 0; - let mut b = 0; - let p = if maybe() { - &mut a - } else { - &mut b - }; - use_(p); -} - -fn maybe() -> bool { false } -fn use_(_: T) { } diff --git a/src/test/ui/run-pass/cfg/auxiliary/cfg_inner_static.rs b/src/test/ui/run-pass/cfg/auxiliary/cfg_inner_static.rs deleted file mode 100644 index b5b4390657b..00000000000 --- a/src/test/ui/run-pass/cfg/auxiliary/cfg_inner_static.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// this used to just ICE on compiling -pub fn foo() { - if cfg!(foo) { - static a: isize = 3; - a - } else { 3 }; -} diff --git a/src/test/ui/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs b/src/test/ui/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs deleted file mode 100644 index 0028b51f9d1..00000000000 --- a/src/test/ui/run-pass/cfg/auxiliary/crate-attributes-using-cfg_attr.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags: --cfg foo - -#![cfg_attr(foo, crate_type="lib")] - -pub fn foo() {} diff --git a/src/test/ui/run-pass/cfg/cfg-attr-cfg.rs b/src/test/ui/run-pass/cfg/cfg-attr-cfg.rs deleted file mode 100644 index 6e3d8f2e7f1..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-attr-cfg.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// main is conditionally compiled, but the conditional compilation -// is conditional too! - -// pretty-expanded FIXME #23616 - -#[cfg_attr(foo, cfg(bar))] -fn main() { } diff --git a/src/test/ui/run-pass/cfg/cfg-attr-crate.rs b/src/test/ui/run-pass/cfg/cfg-attr-crate.rs deleted file mode 100644 index d352e53f231..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-attr-crate.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// https://github.com/rust-lang/rust/issues/21833#issuecomment-72353044 - -// pretty-expanded FIXME #23616 - -#![cfg_attr(not_used, no_core)] - -fn main() { } diff --git a/src/test/ui/run-pass/cfg/cfg-family.rs b/src/test/ui/run-pass/cfg/cfg-family.rs deleted file mode 100644 index 0a1241cccb8..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-family.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -// ignore-cloudabi no target_family -// ignore-wasm32-bare no target_family - -#[cfg(windows)] -pub fn main() { -} - -#[cfg(unix)] -pub fn main() { -} diff --git a/src/test/ui/run-pass/cfg/cfg-in-crate-1.rs b/src/test/ui/run-pass/cfg/cfg-in-crate-1.rs deleted file mode 100644 index e66c8324f36..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-in-crate-1.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg bar -D warnings -#![cfg(bar)] - -fn main() {} diff --git a/src/test/ui/run-pass/cfg/cfg-macros-foo.rs b/src/test/ui/run-pass/cfg/cfg-macros-foo.rs deleted file mode 100644 index 6729d205410..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-macros-foo.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg foo - -// check that cfg correctly chooses between the macro impls (see also -// cfg-macros-notfoo.rs) - - -#[cfg(foo)] -#[macro_use] -mod foo { - macro_rules! bar { - () => { true } - } -} - -#[cfg(not(foo))] -#[macro_use] -mod foo { - macro_rules! bar { - () => { false } - } -} - -pub fn main() { - assert!(bar!()) -} diff --git a/src/test/ui/run-pass/cfg/cfg-macros-notfoo.rs b/src/test/ui/run-pass/cfg/cfg-macros-notfoo.rs deleted file mode 100644 index 2e9614cf8af..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-macros-notfoo.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: - -// check that cfg correctly chooses between the macro impls (see also -// cfg-macros-foo.rs) - - -#[cfg(foo)] -#[macro_use] -mod foo { - macro_rules! bar { - () => { true } - } -} - -#[cfg(not(foo))] -#[macro_use] -mod foo { - macro_rules! bar { - () => { false } - } -} - -pub fn main() { - assert!(!bar!()) -} diff --git a/src/test/ui/run-pass/cfg/cfg-match-arm.rs b/src/test/ui/run-pass/cfg/cfg-match-arm.rs deleted file mode 100644 index 8443d59e869..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-match-arm.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Foo { - Bar, - Baz, -} - -fn foo(f: Foo) { - match f { - Foo::Bar => {}, - #[cfg(not(asdfa))] - Foo::Baz => {}, - #[cfg(afsd)] - Basdfwe => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/cfg/cfg-target-family.rs b/src/test/ui/run-pass/cfg/cfg-target-family.rs deleted file mode 100644 index 3345df69d87..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-target-family.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no target_family -// ignore-wasm32-bare no target_family - -// pretty-expanded FIXME #23616 - -#[cfg(target_family = "windows")] -pub fn main() { -} - -#[cfg(target_family = "unix")] -pub fn main() { -} diff --git a/src/test/ui/run-pass/cfg/cfg-target-vendor.rs b/src/test/ui/run-pass/cfg/cfg-target-vendor.rs deleted file mode 100644 index 08daa67827b..00000000000 --- a/src/test/ui/run-pass/cfg/cfg-target-vendor.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(cfg_target_vendor)] - -#[cfg(target_vendor = "unknown")] -pub fn main() { -} - -#[cfg(not(target_vendor = "unknown"))] -pub fn main() { -} diff --git a/src/test/ui/run-pass/cfg/cfg_attr.rs b/src/test/ui/run-pass/cfg/cfg_attr.rs deleted file mode 100644 index e9f83e1112f..00000000000 --- a/src/test/ui/run-pass/cfg/cfg_attr.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--cfg set1 --cfg set2 -#![allow(dead_code)] -use std::fmt::Debug; - -struct NotDebugable; - -#[cfg_attr(set1, derive(Debug))] -struct Set1; - -#[cfg_attr(notset, derive(Debug))] -struct Notset(NotDebugable); - -#[cfg_attr(not(notset), derive(Debug))] -struct NotNotset; - -#[cfg_attr(not(set1), derive(Debug))] -struct NotSet1(NotDebugable); - -#[cfg_attr(all(set1, set2), derive(Debug))] -struct AllSet1Set2; - -#[cfg_attr(all(set1, notset), derive(Debug))] -struct AllSet1Notset(NotDebugable); - -#[cfg_attr(any(set1, notset), derive(Debug))] -struct AnySet1Notset; - -#[cfg_attr(any(notset, notset2), derive(Debug))] -struct AnyNotsetNotset2(NotDebugable); - -#[cfg_attr(all(not(notset), any(set1, notset)), derive(Debug))] -struct Complex; - -#[cfg_attr(any(notset, not(any(set1, notset))), derive(Debug))] -struct ComplexNot(NotDebugable); - -#[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Debug))] -struct KeyValue; - -fn is_show() {} - -fn main() { - is_show::(); - is_show::(); - is_show::(); - is_show::(); - is_show::(); - is_show::(); -} diff --git a/src/test/ui/run-pass/cfg/cfg_inner_static.rs b/src/test/ui/run-pass/cfg/cfg_inner_static.rs deleted file mode 100644 index e711132e16a..00000000000 --- a/src/test/ui/run-pass/cfg/cfg_inner_static.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cfg_inner_static.rs - -// pretty-expanded FIXME #23616 - -extern crate cfg_inner_static; - -pub fn main() { - cfg_inner_static::foo(); -} diff --git a/src/test/ui/run-pass/cfg/cfg_stmt_expr.rs b/src/test/ui/run-pass/cfg/cfg_stmt_expr.rs deleted file mode 100644 index 102ca22f0bd..00000000000 --- a/src/test/ui/run-pass/cfg/cfg_stmt_expr.rs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(non_snake_case)] -#![feature(stmt_expr_attributes)] - -fn main() { - let a = 413; - #[cfg(unset)] - let a = (); - assert_eq!(a, 413); - - let mut b = 612; - #[cfg(unset)] - { - b = 1111; - } - assert_eq!(b, 612); - - #[cfg(unset)] - undefined_fn(); - - #[cfg(unset)] - undefined_macro!(); - #[cfg(unset)] - undefined_macro![]; - #[cfg(unset)] - undefined_macro!{}; - - // pretty printer bug... - // #[cfg(unset)] - // undefined_macro!{} - - let () = (#[cfg(unset)] 341,); // Should this also work on parens? - let t = (1, #[cfg(unset)] 3, 4); - assert_eq!(t, (1, 4)); - - let f = |_: u32, _: u32| (); - f(2, 1, #[cfg(unset)] 6); - - let _: u32 = a.clone(#[cfg(unset)] undefined); - - let _: [(); 0] = [#[cfg(unset)] 126]; - let t = [#[cfg(unset)] 1, 2, 6]; - assert_eq!(t, [2, 6]); - - { - let r; - #[cfg(unset)] - (r = 5); - #[cfg(not(unset))] - (r = 10); - assert_eq!(r, 10); - } - - // check that macro expanded code works - - macro_rules! if_cfg { - ($cfg:meta $ib:block else $eb:block) => { - { - let r; - #[cfg($cfg)] - (r = $ib); - #[cfg(not($cfg))] - (r = $eb); - r - } - } - } - - let n = if_cfg!(unset { - 413 - } else { - 612 - }); - - assert_eq!((#[cfg(unset)] 1, #[cfg(not(unset))] 2), (2,)); - assert_eq!(n, 612); - - // check that lints work - - #[allow(non_snake_case)] - let FOOBAR = { - fn SYLADEX() {} - }; - - #[allow(non_snake_case)] - { - fn CRUXTRUDER() {} - } -} diff --git a/src/test/ui/run-pass/cfg/cfgs-on-items.rs b/src/test/ui/run-pass/cfg/cfgs-on-items.rs deleted file mode 100644 index d8011827f66..00000000000 --- a/src/test/ui/run-pass/cfg/cfgs-on-items.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg fooA --cfg fooB - -// fooA AND !bar - -#[cfg(all(fooA, not(bar)))] -fn foo1() -> isize { 1 } - -// !fooA AND !bar -#[cfg(all(not(fooA), not(bar)))] -fn foo2() -> isize { 2 } - -// fooC OR (fooB AND !bar) -#[cfg(any(fooC, all(fooB, not(bar))))] -fn foo2() -> isize { 3 } - -// fooA AND bar -#[cfg(all(fooA, bar))] -fn foo3() -> isize { 2 } - -// !(fooA AND bar) -#[cfg(not(all(fooA, bar)))] -fn foo3() -> isize { 3 } - -pub fn main() { - assert_eq!(1, foo1()); - assert_eq!(3, foo2()); - assert_eq!(3, foo3()); -} diff --git a/src/test/ui/run-pass/cfg/conditional-compile-arch.rs b/src/test/ui/run-pass/cfg/conditional-compile-arch.rs deleted file mode 100644 index 2eafd8f854d..00000000000 --- a/src/test/ui/run-pass/cfg/conditional-compile-arch.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[cfg(target_arch = "x86")] -pub fn main() { } - -#[cfg(target_arch = "x86_64")] -pub fn main() { } - -#[cfg(target_arch = "arm")] -pub fn main() { } - -#[cfg(target_arch = "aarch64")] -pub fn main() { } - -#[cfg(target_arch = "mips")] -pub fn main() { } - -#[cfg(target_arch = "mips64")] -pub fn main() { } - -#[cfg(target_arch = "powerpc")] -pub fn main() { } - -#[cfg(target_arch = "powerpc64")] -pub fn main() { } - -#[cfg(target_arch = "s390x")] -pub fn main() { } - -#[cfg(target_arch = "asmjs")] -pub fn main() { } - -#[cfg(target_arch = "wasm32")] -pub fn main() { } - -#[cfg(target_arch = "sparc64")] -pub fn main() { } diff --git a/src/test/ui/run-pass/cfg/conditional-compile.rs b/src/test/ui/run-pass/cfg/conditional-compile.rs deleted file mode 100644 index 20362462484..00000000000 --- a/src/test/ui/run-pass/cfg/conditional-compile.rs +++ /dev/null @@ -1,158 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] -#![allow(improper_ctypes)] - -// Crate use statements - -#[cfg(bogus)] -use flippity; - -#[cfg(bogus)] -static b: bool = false; - -static b: bool = true; - -mod rustrt { - #[cfg(bogus)] - extern { - // This symbol doesn't exist and would be a link error if this - // module was codegened - pub fn bogus(); - } - - extern {} -} - -#[cfg(bogus)] -type t = isize; - -type t = bool; - -#[cfg(bogus)] -enum tg { foo, } - -enum tg { bar, } - -#[cfg(bogus)] -struct r { - i: isize, -} - -#[cfg(bogus)] -fn r(i:isize) -> r { - r { - i: i - } -} - -struct r { - i: isize, -} - -fn r(i:isize) -> r { - r { - i: i - } -} - -#[cfg(bogus)] -mod m { - // This needs to parse but would fail in typeck. Since it's not in - // the current config it should not be typechecked. - pub fn bogus() { return 0; } -} - -mod m { - // Submodules have slightly different code paths than the top-level - // module, so let's make sure this jazz works here as well - #[cfg(bogus)] - pub fn f() { } - - pub fn f() { } -} - -// Since the bogus configuration isn't defined main will just be -// parsed, but nothing further will be done with it -#[cfg(bogus)] -pub fn main() { panic!() } - -pub fn main() { - // Exercise some of the configured items in ways that wouldn't be possible - // if they had the bogus definition - assert!((b)); - let _x: t = true; - let _y: tg = tg::bar; - - test_in_fn_ctxt(); -} - -fn test_in_fn_ctxt() { - #[cfg(bogus)] - fn f() { panic!() } - fn f() { } - f(); - - #[cfg(bogus)] - static i: isize = 0; - static i: isize = 1; - assert_eq!(i, 1); -} - -mod test_foreign_items { - pub mod rustrt { - extern { - #[cfg(bogus)] - pub fn write() -> String; - pub fn write() -> String; - } - } -} - -mod test_use_statements { - #[cfg(bogus)] - use flippity_foo; -} - -mod test_methods { - struct Foo { - bar: usize - } - - impl Fooable for Foo { - #[cfg(bogus)] - fn what(&self) { } - - fn what(&self) { } - - #[cfg(bogus)] - fn the(&self) { } - - fn the(&self) { } - } - - trait Fooable { - #[cfg(bogus)] - fn what(&self); - - fn what(&self); - - #[cfg(bogus)] - fn the(&self); - - fn the(&self); - } -} - -#[cfg(any())] -mod nonexistent_file; // Check that unconfigured non-inline modules are not loaded or parsed. diff --git a/src/test/ui/run-pass/cfg/crate-attributes-using-cfg_attr.rs b/src/test/ui/run-pass/cfg/crate-attributes-using-cfg_attr.rs deleted file mode 100644 index 0d817df7cdc..00000000000 --- a/src/test/ui/run-pass/cfg/crate-attributes-using-cfg_attr.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:crate-attributes-using-cfg_attr.rs - -extern crate crate_attributes_using_cfg_attr; - -pub fn main() {} diff --git a/src/test/ui/run-pass/coerce/coerce-expect-unsized.rs b/src/test/ui/run-pass/coerce/coerce-expect-unsized.rs deleted file mode 100644 index cb0fd0b7504..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-expect-unsized.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::cell::RefCell; -use std::fmt::Debug; -use std::rc::Rc; - -// Check that coercions apply at the pointer level and don't cause -// rvalue expressions to be unsized. See #20169 for more information. - -pub fn main() { - let _: Box<[isize]> = Box::new({ [1, 2, 3] }); - let _: Box<[isize]> = Box::new(if true { [1, 2, 3] } else { [1, 3, 4] }); - let _: Box<[isize]> = Box::new(match true { true => [1, 2, 3], false => [1, 3, 4] }); - let _: Box _> = Box::new({ |x| (x as u8) }); - let _: Box = Box::new(if true { false } else { true }); - let _: Box = Box::new(match true { true => 'a', false => 'b' }); - - let _: &[isize] = &{ [1, 2, 3] }; - let _: &[isize] = &if true { [1, 2, 3] } else { [1, 3, 4] }; - let _: &[isize] = &match true { true => [1, 2, 3], false => [1, 3, 4] }; - let _: &Fn(isize) -> _ = &{ |x| (x as u8) }; - let _: &Debug = &if true { false } else { true }; - let _: &Debug = &match true { true => 'a', false => 'b' }; - - let _: &str = &{ String::new() }; - let _: &str = &if true { String::from("...") } else { 5.to_string() }; - let _: &str = &match true { - true => format!("{}", false), - false => ["x", "y"].join("+") - }; - - let _: Box<[isize]> = Box::new([1, 2, 3]); - let _: Box _> = Box::new(|x| (x as u8)); - - let _: Rc> = Rc::new(RefCell::new([1, 2, 3])); - let _: Rc _>> = Rc::new(RefCell::new(|x| (x as u8))); - - let _: Vec _>> = vec![ - Box::new(|x| (x as u8)), - Box::new(|x| (x as i16 as u8)), - ]; -} diff --git a/src/test/ui/run-pass/coerce/coerce-overloaded-autoderef.rs b/src/test/ui/run-pass/coerce/coerce-overloaded-autoderef.rs deleted file mode 100644 index c6b9e61dae1..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-overloaded-autoderef.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::rc::Rc; - -// Examples from the "deref coercions" RFC, at rust-lang/rfcs#241. - -fn use_ref(_: &T) {} -fn use_mut(_: &mut T) {} - -fn use_rc(t: Rc) { - use_ref(&*t); // what you have to write today - use_ref(&t); // what you'd be able to write - use_ref(&&&&&&t); - use_ref(&mut &&&&&t); - use_ref(&&&mut &&&t); -} - -fn use_mut_box(mut t: &mut Box) { - use_mut(&mut *t); // what you have to write today - use_mut(t); // what you'd be able to write - use_mut(&mut &mut &mut t); - - use_ref(&*t); // what you have to write today - use_ref(t); // what you'd be able to write - use_ref(&&&&&&t); - use_ref(&mut &&&&&t); - use_ref(&&&mut &&&t); -} - -fn use_nested(t: &Box) { - use_ref(&**t); // what you have to write today - use_ref(t); // what you'd be able to write (note: recursive deref) - use_ref(&&&&&&t); - use_ref(&mut &&&&&t); - use_ref(&&&mut &&&t); -} - -fn use_slice(_: &[u8]) {} -fn use_slice_mut(_: &mut [u8]) {} - -fn use_vec(mut v: Vec) { - use_slice_mut(&mut v[..]); // what you have to write today - use_slice_mut(&mut v); // what you'd be able to write - use_slice_mut(&mut &mut &mut v); - - use_slice(&v[..]); // what you have to write today - use_slice(&v); // what you'd be able to write - use_slice(&&&&&&v); - use_slice(&mut &&&&&v); - use_slice(&&&mut &&&v); -} - -fn use_vec_ref(v: &Vec) { - use_slice(&v[..]); // what you have to write today - use_slice(v); // what you'd be able to write - use_slice(&&&&&&v); - use_slice(&mut &&&&&v); - use_slice(&&&mut &&&v); -} - -fn use_op_rhs(s: &mut String) { - *s += {&String::from(" ")}; -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs deleted file mode 100644 index be5e55afbc5..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn negate(x: &isize) -> isize { - -*x -} - -fn negate_mut(y: &mut isize) -> isize { - negate(y) -} - -fn negate_imm(y: &isize) -> isize { - negate(y) -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs deleted file mode 100644 index 0b76375fba1..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-ptr-rcvr.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct SpeechMaker { - speeches: usize -} - -impl SpeechMaker { - pub fn how_many(&self) -> usize { self.speeches } -} - -fn foo(speaker: &SpeechMaker) -> usize { - speaker.how_many() + 33 -} - -pub fn main() { - let lincoln = SpeechMaker {speeches: 22}; - assert_eq!(foo(&lincoln), 55); -} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs deleted file mode 100644 index f8849e6af86..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn sum(x: &[isize]) -> isize { - let mut sum = 0; - for y in x { sum += *y; } - return sum; -} - -fn sum_mut(y: &mut [isize]) -> isize { - sum(y) -} - -fn sum_imm(y: &[isize]) -> isize { - sum(y) -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs deleted file mode 100644 index 4faf6dadbef..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-imm-vec-rcvr.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn bar(v: &mut [usize]) -> Vec { - v.to_vec() -} - -fn bip(v: &[usize]) -> Vec { - v.to_vec() -} - -pub fn main() { - let mut the_vec = vec![1, 2, 3, 100]; - assert_eq!(the_vec.clone(), bar(&mut the_vec)); - assert_eq!(the_vec.clone(), bip(&the_vec)); -} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs deleted file mode 100644 index 7d851bb8bd2..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-arg.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct SpeechMaker { - speeches: usize -} - -fn talk(x: &mut SpeechMaker) { - x.speeches += 1; -} - -fn give_a_few_speeches(speaker: &mut SpeechMaker) { - - // Here speaker is reborrowed for each call, so we don't get errors - // about speaker being moved. - - talk(speaker); - talk(speaker); - talk(speaker); -} - -pub fn main() { - let mut lincoln = SpeechMaker {speeches: 22}; - give_a_few_speeches(&mut lincoln); -} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs deleted file mode 100644 index 42f710299ff..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-ptr-rcvr.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct SpeechMaker { - speeches: usize -} - -impl SpeechMaker { - pub fn talk(&mut self) { - self.speeches += 1; - } -} - -fn give_a_few_speeches(speaker: &mut SpeechMaker) { - - // Here speaker is reborrowed for each call, so we don't get errors - // about speaker being moved. - - speaker.talk(); - speaker.talk(); - speaker.talk(); -} - -pub fn main() { - let mut lincoln = SpeechMaker {speeches: 22}; - give_a_few_speeches(&mut lincoln); -} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs deleted file mode 100644 index 25a73c3d2d6..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-arg.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn reverse(v: &mut [usize]) { - v.reverse(); -} - -fn bar(v: &mut [usize]) { - reverse(v); - reverse(v); - reverse(v); -} - -pub fn main() { - let mut the_vec = vec![1, 2, 3, 100]; - bar(&mut the_vec); - assert_eq!(the_vec, [100, 3, 2, 1]); -} diff --git a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs b/src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs deleted file mode 100644 index 04b884620b6..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-reborrow-mut-vec-rcvr.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn bar(v: &mut [usize]) { - v.reverse(); - v.reverse(); - v.reverse(); -} - -pub fn main() { - let mut the_vec = vec![1, 2, 3, 100]; - bar(&mut the_vec); - assert_eq!(the_vec, [100, 3, 2, 1]); -} diff --git a/src/test/ui/run-pass/coerce/coerce-unify-return.rs b/src/test/ui/run-pass/coerce/coerce-unify-return.rs deleted file mode 100644 index 2b276f2cfe4..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-unify-return.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that coercions unify the expected return type of a polymorphic -// function call, instead of leaving the type variables as they were. - -// pretty-expanded FIXME #23616 - -struct Foo; -impl Foo { - fn foo(self, x: T) -> Option { Some(x) } -} - -pub fn main() { - let _: Option = Some(main); - let _: Option = Foo.foo(main); - - // The same two cases, with implicit type variables made explicit. - let _: Option = Some::<_>(main); - let _: Option = Foo.foo::<_>(main); -} diff --git a/src/test/ui/run-pass/coerce/coerce-unify.rs b/src/test/ui/run-pass/coerce/coerce-unify.rs deleted file mode 100644 index 575d672e092..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-unify.rs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that coercions can unify if-else, match arms and array elements. - -// Try to construct if-else chains, matches and arrays out of given expressions. -macro_rules! check { - ($last:expr $(, $rest:expr)+) => { - // Last expression comes first because of whacky ifs and matches. - let _ = $(if false { $rest })else+ else { $last }; - - let _ = match 0 { $(_ if false => $rest,)+ _ => $last }; - - let _ = [$($rest,)+ $last]; - } -} - -// Check all non-uniform cases of 2 and 3 expressions of 2 types. -macro_rules! check2 { - ($a:expr, $b:expr) => { - check!($a, $b); - check!($b, $a); - - check!($a, $a, $b); - check!($a, $b, $a); - check!($a, $b, $b); - - check!($b, $a, $a); - check!($b, $a, $b); - check!($b, $b, $a); - } -} - -// Check all non-uniform cases of 2 and 3 expressions of 3 types. -macro_rules! check3 { - ($a:expr, $b:expr, $c:expr) => { - // Delegate to check2 for cases where a type repeats. - check2!($a, $b); - check2!($b, $c); - check2!($a, $c); - - // Check the remaining cases, i.e. permutations of ($a, $b, $c). - check!($a, $b, $c); - check!($a, $c, $b); - check!($b, $a, $c); - check!($b, $c, $a); - check!($c, $a, $b); - check!($c, $b, $a); - } -} - -use std::mem::size_of; - -fn foo() {} -fn bar() {} - -pub fn main() { - check3!(foo, bar, foo as fn()); - check3!(size_of::, size_of::, size_of:: as fn() -> usize); - - let s = String::from("bar"); - check2!("foo", &s); - - let a = [1, 2, 3]; - let v = vec![1, 2, 3]; - check2!(&a[..], &v); - - // Make sure in-array coercion still works. - let _ = [("a", Default::default()), (Default::default(), "b"), (&s, &s)]; -} diff --git a/src/test/ui/run-pass/coerce/coerce-unsize-subtype.rs b/src/test/ui/run-pass/coerce/coerce-unsize-subtype.rs deleted file mode 100644 index ab571a8b40d..00000000000 --- a/src/test/ui/run-pass/coerce/coerce-unsize-subtype.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::rc::Rc; - -fn lub_short<'a, T>(_: &[&'a T], _: &[&'a T]) {} - -// The two arguments are a subtype of their LUB, after coercion. -fn long_and_short<'a, T>(xs: &[&'static T; 1], ys: &[&'a T; 1]) { - lub_short(xs, ys); -} - -// The argument coerces to a subtype of the return type. -fn long_to_short<'a, 'b, T>(xs: &'b [&'static T; 1]) -> &'b [&'a T] { - xs -} - -// Rc is covariant over T just like &T. -fn long_to_short_rc<'a, T>(xs: Rc<[&'static T; 1]>) -> Rc<[&'a T]> { - xs -} - -// LUB-coercion (if-else/match/array) coerces `xs: &'b [&'static T: N]` -// to a subtype of the LUB of `xs` and `ys` (i.e. `&'b [&'a T]`), -// regardless of the order they appear (in if-else/match/array). -fn long_and_short_lub1<'a, 'b, T>(xs: &'b [&'static T; 1], ys: &'b [&'a T]) { - let _order1 = [xs, ys]; - let _order2 = [ys, xs]; -} - -// LUB-coercion should also have the exact same effect when `&'b [&'a T; N]` -// needs to be coerced, i.e. the resulting type is not &'b [&'static T], but -// rather the `&'b [&'a T]` LUB. -fn long_and_short_lub2<'a, 'b, T>(xs: &'b [&'static T], ys: &'b [&'a T; 1]) { - let _order1 = [xs, ys]; - let _order2 = [ys, xs]; -} - -fn main() {} diff --git a/src/test/ui/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs b/src/test/ui/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs deleted file mode 100644 index d3d389c6a8b..00000000000 --- a/src/test/ui/run-pass/coherence/auxiliary/coherence_copy_like_lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "rlib"] -#![feature(fundamental)] - -pub trait MyCopy { } -impl MyCopy for i32 { } - -pub struct MyStruct(T); - -#[fundamental] -pub struct MyFundamentalStruct(T); diff --git a/src/test/ui/run-pass/coherence/auxiliary/coherence_lib.rs b/src/test/ui/run-pass/coherence/auxiliary/coherence_lib.rs deleted file mode 100644 index daa123849e4..00000000000 --- a/src/test/ui/run-pass/coherence/auxiliary/coherence_lib.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub trait Remote { - fn foo(&self) { } -} - -pub trait Remote1 { - fn foo(&self, t: T) { } -} - -pub trait Remote2 { - fn foo(&self, t: T, u: U) { } -} - -pub struct Pair(T,U); diff --git a/src/test/ui/run-pass/coherence/coherence-bigint-int.rs b/src/test/ui/run-pass/coherence/coherence-bigint-int.rs deleted file mode 100644 index 62736b1f368..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-bigint-int.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub struct BigInt; - -impl Remote1 for isize { } - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-bigint-vecint.rs b/src/test/ui/run-pass/coherence/coherence-bigint-vecint.rs deleted file mode 100644 index 372f38738e5..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-bigint-vecint.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub struct BigInt; - -impl Remote1 for Vec { } - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-blanket.rs b/src/test/ui/run-pass/coherence/coherence-blanket.rs deleted file mode 100644 index fa09b13bf67..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-blanket.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -pub trait Local { - fn foo(&self) { } -} - -impl Local for T { } - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-covered-type-parameter.rs b/src/test/ui/run-pass/coherence/coherence-covered-type-parameter.rs deleted file mode 100644 index 3ddeb58dddc..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-covered-type-parameter.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote; - -struct Foo(T); - -impl Remote for Foo { } - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-impl-in-fn.rs b/src/test/ui/run-pass/coherence/coherence-impl-in-fn.rs deleted file mode 100644 index de7cb7664b6..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-impl-in-fn.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -pub fn main() { - #[derive(Copy, Clone)] - enum x { foo } - impl ::std::cmp::PartialEq for x { - fn eq(&self, other: &x) -> bool { - (*self) as isize == (*other) as isize - } - fn ne(&self, other: &x) -> bool { !(*self).eq(other) } - } -} diff --git a/src/test/ui/run-pass/coherence/coherence-iterator-vec-any-elem.rs b/src/test/ui/run-pass/coherence/coherence-iterator-vec-any-elem.rs deleted file mode 100644 index d446f0dca9a..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-iterator-vec-any-elem.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -struct Foo(T); - -impl Remote1 for Foo { } - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-iterator-vec.rs b/src/test/ui/run-pass/coherence/coherence-iterator-vec.rs deleted file mode 100644 index 38ad5b8115a..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-iterator-vec.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:coherence_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate coherence_lib as lib; -use lib::Remote1; - -struct Foo(T); - -impl Remote1 for Foo { } - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-multidispatch-tuple.rs b/src/test/ui/run-pass/coherence/coherence-multidispatch-tuple.rs deleted file mode 100644 index ab04f946fa6..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-multidispatch-tuple.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::fmt::Debug; -use std::default::Default; - -// Test that an impl for homogeneous pairs does not conflict with a -// heterogeneous pair. - -trait MyTrait { - fn get(&self) -> usize; -} - -impl MyTrait for (T,T) { - fn get(&self) -> usize { 0 } -} - -impl MyTrait for (usize,isize) { - fn get(&self) -> usize { 0 } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/coherence/coherence-negative-impls-safe.rs b/src/test/ui/run-pass/coherence/coherence-negative-impls-safe.rs deleted file mode 100644 index 7984193862e..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-negative-impls-safe.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(optin_builtin_traits)] - -use std::marker::Send; - -struct TestType; - -impl !Send for TestType {} - -fn main() {} diff --git a/src/test/ui/run-pass/coherence/coherence-rfc447-constrained.rs b/src/test/ui/run-pass/coherence/coherence-rfc447-constrained.rs deleted file mode 100644 index 5db8188e1ff..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-rfc447-constrained.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that trait matching can handle impls whose types are only -// constrained by a projection. - -trait IsU32 {} -impl IsU32 for u32 {} - -trait Mirror { type Image: ?Sized; } -impl Mirror for T { type Image = T; } - -trait Bar {} -impl, L: Mirror> Bar for V - where U::Image: IsU32 {} - -trait Foo { fn name() -> &'static str; } -impl Foo for u64 { fn name() -> &'static str { "u64" } } -impl Foo for T { fn name() -> &'static str { "Bar" }} - -fn main() { - assert_eq!(::name(), "u64"); - assert_eq!(::name(), "Bar"); -} diff --git a/src/test/ui/run-pass/coherence/coherence-subtyping.rs b/src/test/ui/run-pass/coherence/coherence-subtyping.rs deleted file mode 100644 index 0dcd83f87b8..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-subtyping.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that two distinct impls which match subtypes of one another -// yield coherence errors (or not) depending on the variance. - -trait Contravariant { - fn foo(&self) { } -} - -impl Contravariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Contravariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -/////////////////////////////////////////////////////////////////////////// - -trait Covariant { - fn foo(&self) { } -} - -impl Covariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Covariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -/////////////////////////////////////////////////////////////////////////// - -trait Invariant { - fn foo(&self) { } -} - -impl Invariant for for<'a,'b> fn(&'a u8, &'b u8) -> &'a u8 { -} - -impl Invariant for for<'a> fn(&'a u8, &'a u8) -> &'a u8 { -} - -fn main() { } diff --git a/src/test/ui/run-pass/coherence/coherence-where-clause.rs b/src/test/ui/run-pass/coherence/coherence-where-clause.rs deleted file mode 100644 index 9691978466b..00000000000 --- a/src/test/ui/run-pass/coherence/coherence-where-clause.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt::Debug; -use std::default::Default; - -trait MyTrait { - fn get(&self) -> Self; -} - -impl MyTrait for T - where T : Default -{ - fn get(&self) -> T { - Default::default() - } -} - -#[derive(Clone, Copy, Debug, PartialEq)] -struct MyType { - dummy: usize -} - -impl MyTrait for MyType { - fn get(&self) -> MyType { (*self).clone() } -} - -fn test_eq(m: M, n: M) -where M : MyTrait + Debug + PartialEq -{ - assert_eq!(m.get(), n); -} - -pub fn main() { - test_eq(0_usize, 0_usize); - - let value = MyType { dummy: 256 + 22 }; - test_eq(value, value); -} diff --git a/src/test/ui/run-pass/coherence/coherence_copy_like.rs b/src/test/ui/run-pass/coherence/coherence_copy_like.rs deleted file mode 100644 index c6903d911f9..00000000000 --- a/src/test/ui/run-pass/coherence/coherence_copy_like.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to introduce a negative constraint that -// `MyType: !MyTrait` along with other "fundamental" wrappers. - -// aux-build:coherence_copy_like_lib.rs - -extern crate coherence_copy_like_lib as lib; - -struct MyType { x: i32 } - -trait MyTrait { } -impl MyTrait for T { } -impl MyTrait for MyType { } -impl<'a> MyTrait for &'a MyType { } -impl MyTrait for Box { } -impl<'a> MyTrait for &'a Box { } - -fn main() { } diff --git a/src/test/ui/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/ui/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs deleted file mode 100644 index 741ce351da3..00000000000 --- a/src/test/ui/run-pass/consts/auxiliary/anon-extern-mod-cross-crate-1.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="anonexternmod"] -#![feature(libc)] - -extern crate libc; - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_get_test_int() -> libc::intptr_t; -} diff --git a/src/test/ui/run-pass/consts/auxiliary/cci_borrow_lib.rs b/src/test/ui/run-pass/consts/auxiliary/cci_borrow_lib.rs deleted file mode 100644 index 9c90510a857..00000000000 --- a/src/test/ui/run-pass/consts/auxiliary/cci_borrow_lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo(x: &usize) -> usize { - *x -} diff --git a/src/test/ui/run-pass/consts/auxiliary/cci_const.rs b/src/test/ui/run-pass/consts/auxiliary/cci_const.rs deleted file mode 100644 index ee8290050f9..00000000000 --- a/src/test/ui/run-pass/consts/auxiliary/cci_const.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub extern fn bar() { -} - -pub const foopy: &'static str = "hi there"; -pub const uint_val: usize = 12; -pub const uint_expr: usize = (1 << uint_val) - 1; diff --git a/src/test/ui/run-pass/consts/auxiliary/cci_const_block.rs b/src/test/ui/run-pass/consts/auxiliary/cci_const_block.rs deleted file mode 100644 index 76fe9fe5aa4..00000000000 --- a/src/test/ui/run-pass/consts/auxiliary/cci_const_block.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub static BLOCK_FN_DEF: fn(usize) -> usize = { - fn foo(a: usize) -> usize { - a + 10 - } - foo -}; diff --git a/src/test/ui/run-pass/consts/auxiliary/const_fn_lib.rs b/src/test/ui/run-pass/consts/auxiliary/const_fn_lib.rs deleted file mode 100644 index 6985a6527c8..00000000000 --- a/src/test/ui/run-pass/consts/auxiliary/const_fn_lib.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Crate that exports a const fn. Used for testing cross-crate. - -#![crate_type="rlib"] -#![feature(min_const_fn)] - -pub const fn foo() -> usize { 22 } diff --git a/src/test/ui/run-pass/consts/const-adt-align-mismatch.rs b/src/test/ui/run-pass/consts/const-adt-align-mismatch.rs deleted file mode 100644 index 10875d5046c..00000000000 --- a/src/test/ui/run-pass/consts/const-adt-align-mismatch.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -use std::mem; - -#[derive(PartialEq, Debug)] -enum Foo { - A(u32), - Bar([u16; 4]), - C -} - -// NOTE(eddyb) Don't make this a const, needs to be a static -// so it is always instantiated as a LLVM constant value. -static FOO: Foo = Foo::C; - -fn main() { - assert_eq!(FOO, Foo::C); - assert_eq!(mem::size_of::(), 12); - assert_eq!(mem::min_align_of::(), 4); -} diff --git a/src/test/ui/run-pass/consts/const-autoderef.rs b/src/test/ui/run-pass/consts/const-autoderef.rs deleted file mode 100644 index 939f7d4441a..00000000000 --- a/src/test/ui/run-pass/consts/const-autoderef.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const A: [u8; 1] = ['h' as u8]; -const B: u8 = (&A)[0]; -const C: &'static &'static &'static &'static [u8; 1] = & & & &A; -const D: u8 = (&C)[0]; - -pub fn main() { - assert_eq!(B, A[0]); - assert_eq!(D, A[0]); -} diff --git a/src/test/ui/run-pass/consts/const-big-enum.rs b/src/test/ui/run-pass/consts/const-big-enum.rs deleted file mode 100644 index 1ad46fa4106..00000000000 --- a/src/test/ui/run-pass/consts/const-big-enum.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum Foo { - Bar(u32), - Baz, - Quux(u64, u16) -} - -static X: Foo = Foo::Baz; - -pub fn main() { - match X { - Foo::Baz => {} - _ => panic!() - } - match Y { - Foo::Bar(s) => assert_eq!(s, 2654435769), - _ => panic!() - } - match Z { - Foo::Quux(d,h) => { - assert_eq!(d, 0x123456789abcdef0); - assert_eq!(h, 0x1234); - } - _ => panic!() - } -} - -static Y: Foo = Foo::Bar(2654435769); -static Z: Foo = Foo::Quux(0x123456789abcdef0, 0x1234); diff --git a/src/test/ui/run-pass/consts/const-binops.rs b/src/test/ui/run-pass/consts/const-binops.rs deleted file mode 100644 index 2e90a458aee..00000000000 --- a/src/test/ui/run-pass/consts/const-binops.rs +++ /dev/null @@ -1,136 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ - let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) -} - -static A: isize = -4 + 3; -static A2: usize = 3 + 3; -static B: f64 = 3.0 + 2.7; - -static C: isize = 3 - 4; -static D: usize = 3 - 3; -static E: f64 = 3.0 - 2.7; - -static E2: isize = -3 * 3; -static F: usize = 3 * 3; -static G: f64 = 3.3 * 3.3; - -static H: isize = 3 / -1; -static I: usize = 3 / 3; -static J: f64 = 3.3 / 3.3; - -static N: bool = true && false; - -static O: bool = true || false; - -static P: isize = 3 & 1; -static Q: usize = 1 & 3; - -static R: isize = 3 | 1; -static S: usize = 1 | 3; - -static T: isize = 3 ^ 1; -static U: usize = 1 ^ 3; - -static V: isize = 1 << 3; - -// NOTE: better shr coverage -static W: isize = 1024 >> 4; -static X: usize = 1024 >> 4; - -static Y: bool = 1 == 1; -static Z: bool = 1.0f64 == 1.0; - -static AA: bool = 1 <= 2; -static AB: bool = -1 <= 2; -static AC: bool = 1.0f64 <= 2.0; - -static AD: bool = 1 < 2; -static AE: bool = -1 < 2; -static AF: bool = 1.0f64 < 2.0; - -static AG: bool = 1 != 2; -static AH: bool = -1 != 2; -static AI: bool = 1.0f64 != 2.0; - -static AJ: bool = 2 >= 1; -static AK: bool = 2 >= -2; -static AL: bool = 1.0f64 >= -2.0; - -static AM: bool = 2 > 1; -static AN: bool = 2 > -2; -static AO: bool = 1.0f64 > -2.0; - -pub fn main() { - assert_eq!(A, -1); - assert_eq!(A2, 6); - assert_approx_eq!(B, 5.7); - - assert_eq!(C, -1); - assert_eq!(D, 0); - assert_approx_eq!(E, 0.3); - - assert_eq!(E2, -9); - assert_eq!(F, 9); - assert_approx_eq!(G, 10.89); - - assert_eq!(H, -3); - assert_eq!(I, 1); - assert_approx_eq!(J, 1.0); - - assert_eq!(N, false); - - assert_eq!(O, true); - - assert_eq!(P, 1); - assert_eq!(Q, 1); - - assert_eq!(R, 3); - assert_eq!(S, 3); - - assert_eq!(T, 2); - assert_eq!(U, 2); - - assert_eq!(V, 8); - - assert_eq!(W, 64); - assert_eq!(X, 64); - - assert_eq!(Y, true); - assert_eq!(Z, true); - - assert_eq!(AA, true); - assert_eq!(AB, true); - assert_eq!(AC, true); - - assert_eq!(AD, true); - assert_eq!(AE, true); - assert_eq!(AF, true); - - assert_eq!(AG, true); - assert_eq!(AH, true); - assert_eq!(AI, true); - - assert_eq!(AJ, true); - assert_eq!(AK, true); - assert_eq!(AL, true); - - assert_eq!(AM, true); - assert_eq!(AN, true); - assert_eq!(AO, true); -} diff --git a/src/test/ui/run-pass/consts/const-bitshift-rhs-inference.rs b/src/test/ui/run-pass/consts/const-bitshift-rhs-inference.rs deleted file mode 100644 index 63b8af77326..00000000000 --- a/src/test/ui/run-pass/consts/const-bitshift-rhs-inference.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const RHS: u8 = 8; -const IRHS: i8 = 8; -const RHS16: u16 = 8; -const IRHS16: i16 = 8; -const RHS32: u32 = 8; -const IRHS32: i32 = 8; -const RHS64: u64 = 8; -const IRHS64: i64 = 8; -const RHSUS: usize = 8; -const IRHSIS: isize = 8; - -fn main() { - let _: [&'static str; 1 << RHS] = [""; 256]; - let _: [&'static str; 1 << IRHS] = [""; 256]; - let _: [&'static str; 1 << RHS16] = [""; 256]; - let _: [&'static str; 1 << IRHS16] = [""; 256]; - let _: [&'static str; 1 << RHS32] = [""; 256]; - let _: [&'static str; 1 << IRHS32] = [""; 256]; - let _: [&'static str; 1 << RHS64] = [""; 256]; - let _: [&'static str; 1 << IRHS64] = [""; 256]; - let _: [&'static str; 1 << RHSUS] = [""; 256]; - let _: [&'static str; 1 << IRHSIS] = [""; 256]; -} diff --git a/src/test/ui/run-pass/consts/const-block-cross-crate-fn.rs b/src/test/ui/run-pass/consts/const-block-cross-crate-fn.rs deleted file mode 100644 index c7d156fcf19..00000000000 --- a/src/test/ui/run-pass/consts/const-block-cross-crate-fn.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_const_block.rs - - -extern crate cci_const_block; - -pub fn main() { - assert_eq!(cci_const_block::BLOCK_FN_DEF(390), 400); -} diff --git a/src/test/ui/run-pass/consts/const-block-item-macro-codegen.rs b/src/test/ui/run-pass/consts/const-block-item-macro-codegen.rs deleted file mode 100644 index ab452e4fe46..00000000000 --- a/src/test/ui/run-pass/consts/const-block-item-macro-codegen.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// General test that function items in static blocks -// can be generated with a macro. - - -struct MyType { - desc: &'static str, - data: usize, - code: fn(usize, usize) -> usize -} - -impl MyType { - fn eval(&self, a: usize) -> usize { - (self.code)(self.data, a) - } -} - -macro_rules! codegen { - ($e:expr, $v:expr) => { - { - fn generated(a: usize, b: usize) -> usize { - a - ($e * b) - } - MyType { - desc: "test", - data: $v, - code: generated - } - } - } -} - -static GENERATED_CODE_1: MyType = codegen!(2, 100); -static GENERATED_CODE_2: MyType = codegen!(5, 1000); - -pub fn main() { - assert_eq!(GENERATED_CODE_1.eval(10), 80); - assert_eq!(GENERATED_CODE_2.eval(100), 500); -} diff --git a/src/test/ui/run-pass/consts/const-block-item.rs b/src/test/ui/run-pass/consts/const-block-item.rs deleted file mode 100644 index fe3483ae9f0..00000000000 --- a/src/test/ui/run-pass/consts/const-block-item.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod foo { - pub trait Value { - fn value(&self) -> usize; - } -} - -static BLOCK_USE: usize = { - use foo::Value; - 100 -}; - -static BLOCK_STRUCT_DEF: usize = { - struct Foo { - a: usize - } - Foo{ a: 300 }.a -}; - -static BLOCK_FN_DEF: fn(usize) -> usize = { - fn foo(a: usize) -> usize { - a + 10 - } - foo -}; - -static BLOCK_MACRO_RULES: usize = { - macro_rules! baz { - () => (412) - } - baz!() -}; - -pub fn main() { - assert_eq!(BLOCK_USE, 100); - assert_eq!(BLOCK_STRUCT_DEF, 300); - assert_eq!(BLOCK_FN_DEF(390), 400); - assert_eq!(BLOCK_MACRO_RULES, 412); -} diff --git a/src/test/ui/run-pass/consts/const-block.rs b/src/test/ui/run-pass/consts/const-block.rs deleted file mode 100644 index 1b9330a6ebf..00000000000 --- a/src/test/ui/run-pass/consts/const-block.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(dead_code)] -#![allow(unused_unsafe)] - -use std::marker::Sync; - -struct Foo { - a: usize, - b: *const () -} - -unsafe impl Sync for Foo {} - -fn foo(a: T) -> T { - a -} - -static BLOCK_INTEGRAL: usize = { 1 }; -static BLOCK_EXPLICIT_UNIT: () = { () }; -static BLOCK_IMPLICIT_UNIT: () = { }; -static BLOCK_FLOAT: f64 = { 1.0 }; -static BLOCK_ENUM: Option = { Some(100) }; -static BLOCK_STRUCT: Foo = { Foo { a: 12, b: 0 as *const () } }; -static BLOCK_UNSAFE: usize = unsafe { 1000 }; - -static BLOCK_FN_INFERRED: fn(usize) -> usize = { foo }; - -static BLOCK_FN: fn(usize) -> usize = { foo:: }; - -static BLOCK_ENUM_CONSTRUCTOR: fn(usize) -> Option = { Some }; - -pub fn main() { - assert_eq!(BLOCK_INTEGRAL, 1); - assert_eq!(BLOCK_EXPLICIT_UNIT, ()); - assert_eq!(BLOCK_IMPLICIT_UNIT, ()); - assert_eq!(BLOCK_FLOAT, 1.0_f64); - assert_eq!(BLOCK_STRUCT.a, 12); - assert_eq!(BLOCK_STRUCT.b, 0 as *const ()); - assert_eq!(BLOCK_ENUM, Some(100)); - assert_eq!(BLOCK_UNSAFE, 1000); - assert_eq!(BLOCK_FN_INFERRED(300), 300); - assert_eq!(BLOCK_FN(300), 300); - assert_eq!(BLOCK_ENUM_CONSTRUCTOR(200), Some(200)); -} diff --git a/src/test/ui/run-pass/consts/const-bound.rs b/src/test/ui/run-pass/consts/const-bound.rs deleted file mode 100644 index a4ac766a740..00000000000 --- a/src/test/ui/run-pass/consts/const-bound.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Make sure const bounds work on things, and test that a few types -// are const. - -// pretty-expanded FIXME #23616 - -fn foo(x: T) -> T { x } - -struct F { field: isize } - -pub fn main() { - /*foo(1); - foo("hi".to_string()); - foo(vec![1, 2, 3]); - foo(F{field: 42}); - foo((1, 2)); - foo(@1);*/ - foo(Box::new(1)); -} diff --git a/src/test/ui/run-pass/consts/const-byte-str-cast.rs b/src/test/ui/run-pass/consts/const-byte-str-cast.rs deleted file mode 100644 index 175d48e5c01..00000000000 --- a/src/test/ui/run-pass/consts/const-byte-str-cast.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[deny(warnings)] - -pub fn main() { - let _ = b"x" as &[u8]; - let _ = b"y" as &[u8; 1]; - let _ = b"z" as *const u8; - let _ = "ä" as *const str; -} diff --git a/src/test/ui/run-pass/consts/const-cast-ptr-int.rs b/src/test/ui/run-pass/consts/const-cast-ptr-int.rs deleted file mode 100644 index f12a73f0ea6..00000000000 --- a/src/test/ui/run-pass/consts/const-cast-ptr-int.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -use std::ptr; - -struct TestStruct { - x: *const u8 -} - -unsafe impl Sync for TestStruct {} - -static a: TestStruct = TestStruct{x: 0 as *const u8}; - -pub fn main() { - assert_eq!(a.x, ptr::null()); -} diff --git a/src/test/ui/run-pass/consts/const-cast.rs b/src/test/ui/run-pass/consts/const-cast.rs deleted file mode 100644 index 100034ccc30..00000000000 --- a/src/test/ui/run-pass/consts/const-cast.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -struct TestStruct { - x: *const u8, -} - -unsafe impl Sync for TestStruct {} - -extern fn foo() {} -const x: extern "C" fn() = foo; -static y: TestStruct = TestStruct { x: x as *const u8 }; - -pub fn main() { - assert_eq!(x as *const u8, y.x); -} diff --git a/src/test/ui/run-pass/consts/const-const.rs b/src/test/ui/run-pass/consts/const-const.rs deleted file mode 100644 index 160d10d3b11..00000000000 --- a/src/test/ui/run-pass/consts/const-const.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -const a: isize = 1; -const b: isize = a + 2; - -pub fn main() { - assert_eq!(b, 3); -} diff --git a/src/test/ui/run-pass/consts/const-contents.rs b/src/test/ui/run-pass/consts/const-contents.rs deleted file mode 100644 index 3d99af9ee66..00000000000 --- a/src/test/ui/run-pass/consts/const-contents.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #570 -#![allow(non_upper_case_globals)] - -static lsl : isize = 1 << 2; -static add : isize = 1 + 2; -static addf : f64 = 1.0 + 2.0; -static not : isize = !0; -static notb : bool = !true; -static neg : isize = -(1); - -pub fn main() { - assert_eq!(lsl, 4); - assert_eq!(add, 3); - assert_eq!(addf, 3.0); - assert_eq!(not, -1); - assert_eq!(notb, false); - assert_eq!(neg, -1); -} diff --git a/src/test/ui/run-pass/consts/const-cross-crate-const.rs b/src/test/ui/run-pass/consts/const-cross-crate-const.rs deleted file mode 100644 index 3e8eb9a422d..00000000000 --- a/src/test/ui/run-pass/consts/const-cross-crate-const.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_const.rs -#![allow(non_upper_case_globals)] - -extern crate cci_const; -static foo: &'static str = cci_const::foopy; -static a: usize = cci_const::uint_val; -static b: usize = cci_const::uint_expr + 5; - -pub fn main() { - assert_eq!(a, 12); - let foo2 = a; - assert_eq!(foo2, cci_const::uint_val); - assert_eq!(b, cci_const::uint_expr + 5); - assert_eq!(foo, cci_const::foopy); -} diff --git a/src/test/ui/run-pass/consts/const-cross-crate-extern.rs b/src/test/ui/run-pass/consts/const-cross-crate-extern.rs deleted file mode 100644 index 504b872782b..00000000000 --- a/src/test/ui/run-pass/consts/const-cross-crate-extern.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_const.rs -#![allow(non_upper_case_globals)] - -extern crate cci_const; -use cci_const::bar; -static foo: extern "C" fn() = bar; - -pub fn main() { - assert!(foo == bar); -} diff --git a/src/test/ui/run-pass/consts/const-deref.rs b/src/test/ui/run-pass/consts/const-deref.rs deleted file mode 100644 index 39515c8546a..00000000000 --- a/src/test/ui/run-pass/consts/const-deref.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const C: &'static isize = &1000; -static D: isize = *C; - -pub fn main() { - assert_eq!(D, 1000); -} diff --git a/src/test/ui/run-pass/consts/const-endianess.rs b/src/test/ui/run-pass/consts/const-endianess.rs deleted file mode 100644 index 4ac46955709..00000000000 --- a/src/test/ui/run-pass/consts/const-endianess.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(const_int_ops)] -#![feature(test)] - -extern crate test; -use test::black_box as b; - -const BE_U32: u32 = 55u32.to_be(); -const LE_U32: u32 = 55u32.to_le(); - - -fn main() { - assert_eq!(BE_U32, b(55u32).to_be()); - assert_eq!(LE_U32, b(55u32).to_le()); - - #[cfg(not(target_arch = "asmjs"))] - { - const BE_U128: u128 = 999999u128.to_be(); - const LE_I128: i128 = (-999999i128).to_le(); - assert_eq!(BE_U128, b(999999u128).to_be()); - assert_eq!(LE_I128, b(-999999i128).to_le()); - } -} diff --git a/src/test/ui/run-pass/consts/const-enum-byref-self.rs b/src/test/ui/run-pass/consts/const-enum-byref-self.rs deleted file mode 100644 index 9656bc54eb2..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-byref-self.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V, VV(isize) } -static C: E = E::V; - -impl E { - pub fn method(&self) { - match *self { - E::V => {} - E::VV(..) => panic!() - } - } -} - -pub fn main() { - C.method() -} diff --git a/src/test/ui/run-pass/consts/const-enum-byref.rs b/src/test/ui/run-pass/consts/const-enum-byref.rs deleted file mode 100644 index 1e418f66c13..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-byref.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V, VV(isize) } -static C: E = E::V; - -fn f(a: &E) { - match *a { - E::V => {} - E::VV(..) => panic!() - } -} - -pub fn main() { - f(&C) -} diff --git a/src/test/ui/run-pass/consts/const-enum-cast.rs b/src/test/ui/run-pass/consts/const-enum-cast.rs deleted file mode 100644 index 39602153c79..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-cast.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -enum A { A1, A2 } -enum B { B1=0, B2=2 } - -pub fn main () { - static c1: isize = A::A2 as isize; - static c2: isize = B::B2 as isize; - let a1 = A::A2 as isize; - let a2 = B::B2 as isize; - assert_eq!(c1, 1); - assert_eq!(c2, 2); - assert_eq!(a1, 1); - assert_eq!(a2, 2); -} diff --git a/src/test/ui/run-pass/consts/const-enum-ptr.rs b/src/test/ui/run-pass/consts/const-enum-ptr.rs deleted file mode 100644 index 78c784e4bb3..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-ptr.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V0, V1(isize) } -static C: &'static E = &E::V0; - -pub fn main() { - match *C { - E::V0 => (), - _ => panic!() - } -} diff --git a/src/test/ui/run-pass/consts/const-enum-struct.rs b/src/test/ui/run-pass/consts/const-enum-struct.rs deleted file mode 100644 index 4a4ad9d89e6..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-struct.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V16(u16), V32(u32) } -struct S { a: E, b: u16, c: u16 } -static C: S = S { a: E::V16(0xDEAD), b: 0x600D, c: 0xBAD }; - -pub fn main() { - let n = C.b; - assert!(n != 0xBAD); - assert_eq!(n, 0x600D); -} diff --git a/src/test/ui/run-pass/consts/const-enum-struct2.rs b/src/test/ui/run-pass/consts/const-enum-struct2.rs deleted file mode 100644 index c37b06f8337..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-struct2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V0, V16(u16) } -struct S { a: E, b: u16, c: u16 } -static C: S = S { a: E::V0, b: 0x600D, c: 0xBAD }; - -pub fn main() { - let n = C.b; - assert!(n != 0xBAD); - assert_eq!(n, 0x600D); -} diff --git a/src/test/ui/run-pass/consts/const-enum-structlike.rs b/src/test/ui/run-pass/consts/const-enum-structlike.rs deleted file mode 100644 index a6bac3c9e7d..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-structlike.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { - S0 { s: String }, - S1 { u: usize } -} - -static C: E = E::S1 { u: 23 }; - -pub fn main() { - match C { - E::S0 { .. } => panic!(), - E::S1 { u } => assert_eq!(u, 23) - } -} diff --git a/src/test/ui/run-pass/consts/const-enum-tuple.rs b/src/test/ui/run-pass/consts/const-enum-tuple.rs deleted file mode 100644 index 2f0dcdaf9b2..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-tuple.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V16(u16), V32(u32) } -static C: (E, u16, u16) = (E::V16(0xDEAD), 0x600D, 0xBAD); - -pub fn main() { - let (_, n, _) = C; - assert!(n != 0xBAD); - assert_eq!(n, 0x600D); -} diff --git a/src/test/ui/run-pass/consts/const-enum-tuple2.rs b/src/test/ui/run-pass/consts/const-enum-tuple2.rs deleted file mode 100644 index 1db56e0e6f2..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-tuple2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V0, V16(u16) } -static C: (E, u16, u16) = (E::V0, 0x600D, 0xBAD); - -pub fn main() { - let (_, n, _) = C; - assert!(n != 0xBAD); - assert_eq!(n, 0x600D); -} diff --git a/src/test/ui/run-pass/consts/const-enum-tuplestruct.rs b/src/test/ui/run-pass/consts/const-enum-tuplestruct.rs deleted file mode 100644 index f37ff4d9c99..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-tuplestruct.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V16(u16), V32(u32) } -struct S(E, u16, u16); -static C: S = S(E::V16(0xDEAD), 0x600D, 0xBAD); - -pub fn main() { - let S(_, n, _) = C; - assert!(n != 0xBAD); - assert_eq!(n, 0x600D); -} diff --git a/src/test/ui/run-pass/consts/const-enum-tuplestruct2.rs b/src/test/ui/run-pass/consts/const-enum-tuplestruct2.rs deleted file mode 100644 index 5d6a77dddb8..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-tuplestruct2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V0, V16(u16) } -struct S(E, u16, u16); -static C: S = S(E::V0, 0x600D, 0xBAD); - -pub fn main() { - let S(_, n, _) = C; - assert!(n != 0xBAD); - assert_eq!(n, 0x600D); -} diff --git a/src/test/ui/run-pass/consts/const-enum-vec-index.rs b/src/test/ui/run-pass/consts/const-enum-vec-index.rs deleted file mode 100644 index 067cc2bc75f..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-vec-index.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Copy, Clone)] -enum E { V1(isize), V0 } - -const C: &'static [E] = &[E::V0, E::V1(0xDEADBEE)]; -static C0: E = C[0]; -static C1: E = C[1]; -const D: &'static [E; 2] = &[E::V0, E::V1(0xDEAFBEE)]; -static D0: E = D[0]; -static D1: E = D[1]; - -pub fn main() { - match C0 { - E::V0 => (), - _ => panic!() - } - match C1 { - E::V1(n) => assert_eq!(n, 0xDEADBEE), - _ => panic!() - } - - match D0 { - E::V0 => (), - _ => panic!() - } - match D1 { - E::V1(n) => assert_eq!(n, 0xDEAFBEE), - _ => panic!() - } -} diff --git a/src/test/ui/run-pass/consts/const-enum-vec-ptr.rs b/src/test/ui/run-pass/consts/const-enum-vec-ptr.rs deleted file mode 100644 index a8a3dec5bdc..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-vec-ptr.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V1(isize), V0 } -static C: &'static [E] = &[E::V0, E::V1(0xDEADBEE), E::V0]; - -pub fn main() { - match C[1] { - E::V1(n) => assert_eq!(n, 0xDEADBEE), - _ => panic!() - } - match C[2] { - E::V0 => (), - _ => panic!() - } -} diff --git a/src/test/ui/run-pass/consts/const-enum-vector.rs b/src/test/ui/run-pass/consts/const-enum-vector.rs deleted file mode 100644 index e95742451b4..00000000000 --- a/src/test/ui/run-pass/consts/const-enum-vector.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { V1(isize), V0 } -static C: [E; 3] = [E::V0, E::V1(0xDEADBEE), E::V0]; - -pub fn main() { - match C[1] { - E::V1(n) => assert_eq!(n, 0xDEADBEE), - _ => panic!() - } - match C[2] { - E::V0 => (), - _ => panic!() - } -} diff --git a/src/test/ui/run-pass/consts/const-err.rs b/src/test/ui/run-pass/consts/const-err.rs deleted file mode 100644 index 2074ee3e908..00000000000 --- a/src/test/ui/run-pass/consts/const-err.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check for const_err regressions - -#![deny(const_err)] - -const X: *const u8 = b"" as _; -const Y: bool = 'A' == 'B'; -const Z: char = 'A'; -const W: bool = Z <= 'B'; - - -fn main() { - let _ = ((-1 as i8) << 8 - 1) as f32; - let _ = 0u8 as char; - let _ = true > false; - let _ = true >= false; - let _ = true < false; - let _ = true >= false; -} diff --git a/src/test/ui/run-pass/consts/const-expr-in-fixed-length-vec.rs b/src/test/ui/run-pass/consts/const-expr-in-fixed-length-vec.rs deleted file mode 100644 index c67946d6fa1..00000000000 --- a/src/test/ui/run-pass/consts/const-expr-in-fixed-length-vec.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that constant expressions can be used for declaring the -// type of a fixed length vector. - -// pretty-expanded FIXME #23616 - -pub fn main() { - - const FOO: usize = 2; - let _v: [isize; FOO*3]; - -} diff --git a/src/test/ui/run-pass/consts/const-expr-in-vec-repeat.rs b/src/test/ui/run-pass/consts/const-expr-in-vec-repeat.rs deleted file mode 100644 index 150d24b3106..00000000000 --- a/src/test/ui/run-pass/consts/const-expr-in-vec-repeat.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that constant expressions can be used in vec repeat syntax. - -// pretty-expanded FIXME #23616 - -pub fn main() { - - const FOO: usize = 2; - let _v = [0; FOO*3*2/2]; - -} diff --git a/src/test/ui/run-pass/consts/const-extern-function.rs b/src/test/ui/run-pass/consts/const-extern-function.rs deleted file mode 100644 index e7e11e74086..00000000000 --- a/src/test/ui/run-pass/consts/const-extern-function.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -extern fn foopy() {} - -static f: extern "C" fn() = foopy; -static s: S = S { f: foopy }; - -struct S { - f: extern "C" fn() -} - -pub fn main() { - assert!(foopy as extern "C" fn() == f); - assert!(f == s.f); -} diff --git a/src/test/ui/run-pass/consts/const-fields-and-indexing.rs b/src/test/ui/run-pass/consts/const-fields-and-indexing.rs deleted file mode 100644 index c0ba4404f00..00000000000 --- a/src/test/ui/run-pass/consts/const-fields-and-indexing.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -const x : [isize; 4] = [1,2,3,4]; -static p : isize = x[2]; -const y : &'static [isize] = &[1,2,3,4]; -static q : isize = y[2]; - -struct S {a: isize, b: isize} - -const s : S = S {a: 10, b: 20}; -static t : isize = s.b; - -struct K {a: isize, b: isize, c: D} -struct D { d: isize, e: isize } - -const k : K = K {a: 10, b: 20, c: D {d: 30, e: 40}}; -static m : isize = k.c.e; - -pub fn main() { - println!("{}", p); - println!("{}", q); - println!("{}", t); - assert_eq!(p, 3); - assert_eq!(q, 3); - assert_eq!(t, 20); -} diff --git a/src/test/ui/run-pass/consts/const-fn-const-eval.rs b/src/test/ui/run-pass/consts/const-fn-const-eval.rs deleted file mode 100644 index 897073cd623..00000000000 --- a/src/test/ui/run-pass/consts/const-fn-const-eval.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -const fn add(x: usize, y: usize) -> usize { - x + y -} - -const ARR: [i32; add(1, 2)] = [5, 6, 7]; - -pub fn main() {} diff --git a/src/test/ui/run-pass/consts/const-fn-feature-flags.rs b/src/test/ui/run-pass/consts/const-fn-feature-flags.rs deleted file mode 100644 index be529db3c08..00000000000 --- a/src/test/ui/run-pass/consts/const-fn-feature-flags.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test use of stabilized const fns in std formerly using individual feature gates. - -use std::cell::Cell; - -const CELL: Cell = Cell::new(42); - -fn main() { - let v = CELL.get(); - CELL.set(v+1); - - assert_eq!(CELL.get(), v); -} - diff --git a/src/test/ui/run-pass/consts/const-fn-method.rs b/src/test/ui/run-pass/consts/const-fn-method.rs deleted file mode 100644 index 3ecb4fffba1..00000000000 --- a/src/test/ui/run-pass/consts/const-fn-method.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -struct Foo { value: u32 } - -impl Foo { - const fn new() -> Foo { - Foo { value: 22 } - } -} - -const FOO: Foo = Foo::new(); - -pub fn main() { - assert_eq!(FOO.value, 22); - let _: [&'static str; Foo::new().value as usize] = ["hey"; 22]; -} diff --git a/src/test/ui/run-pass/consts/const-fn-nested.rs b/src/test/ui/run-pass/consts/const-fn-nested.rs deleted file mode 100644 index 41198a901c2..00000000000 --- a/src/test/ui/run-pass/consts/const-fn-nested.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a call whose argument is the result of another call. - -#![feature(min_const_fn)] - -const fn sub(x: u32, y: u32) -> u32 { - x - y -} - -const X: u32 = sub(sub(88, 44), 22); - -fn main() { - assert_eq!(X, 22); -} diff --git a/src/test/ui/run-pass/consts/const-fn-stability-calls.rs b/src/test/ui/run-pass/consts/const-fn-stability-calls.rs deleted file mode 100644 index b520ebab17c..00000000000 --- a/src/test/ui/run-pass/consts/const-fn-stability-calls.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test use of const fn from another crate without a feature gate. - -// aux-build:const_fn_lib.rs - -extern crate const_fn_lib; - -use const_fn_lib::foo; - -static FOO: usize = foo(); -const BAR: usize = foo(); - -macro_rules! constant { - ($n:ident: $t:ty = $v:expr) => { - const $n: $t = $v; - } -} - -constant! { - BAZ: usize = foo() -} - -fn main() { - let x: [usize; foo()] = [42; foo()]; -} diff --git a/src/test/ui/run-pass/consts/const-fn-val.rs b/src/test/ui/run-pass/consts/const-fn-val.rs deleted file mode 100644 index 4b6b529617f..00000000000 --- a/src/test/ui/run-pass/consts/const-fn-val.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] -#![allow(overflowing_literals)] - -fn foo() -> isize { - return 0xca7f000d; -} - -struct Bar where F: FnMut() -> isize { f: F } - -static mut b : Bar isize> = Bar { f: foo as fn() -> isize}; - -pub fn main() { - unsafe { assert_eq!((b.f)(), 0xca7f000d); } -} diff --git a/src/test/ui/run-pass/consts/const-fn.rs b/src/test/ui/run-pass/consts/const-fn.rs deleted file mode 100644 index 616429bf1df..00000000000 --- a/src/test/ui/run-pass/consts/const-fn.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// A very basic test of const fn functionality. - -#![feature(const_fn, const_indexing)] - -const fn add(x: u32, y: u32) -> u32 { - x + y -} - -const fn sub(x: u32, y: u32) -> u32 { - x - y -} - -const unsafe fn div(x: u32, y: u32) -> u32 { - x / y -} - -const fn generic(t: T) -> T { - t -} - -const fn generic_arr(t: [T; 1]) -> T { - t[0] -} - -const SUM: u32 = add(44, 22); -const DIFF: u32 = sub(44, 22); -const DIV: u32 = unsafe{div(44, 22)}; - -fn main() { - assert_eq!(SUM, 66); - assert!(SUM != 88); - - assert_eq!(DIFF, 22); - assert_eq!(DIV, 2); - - let _: [&'static str; sub(100, 99) as usize] = ["hi"]; - let _: [&'static str; generic(1)] = ["hi"]; - let _: [&'static str; generic_arr([1])] = ["hi"]; -} diff --git a/src/test/ui/run-pass/consts/const-index-feature-gate.rs b/src/test/ui/run-pass/consts/const-index-feature-gate.rs deleted file mode 100644 index 3e26ea9dcae..00000000000 --- a/src/test/ui/run-pass/consts/const-index-feature-gate.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const ARR: [usize; 1] = [2]; -const ARR2: [i32; ARR[0]] = [5, 6]; - -fn main() { -} diff --git a/src/test/ui/run-pass/consts/const-meth-pattern.rs b/src/test/ui/run-pass/consts/const-meth-pattern.rs deleted file mode 100644 index 1762c17e943..00000000000 --- a/src/test/ui/run-pass/consts/const-meth-pattern.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(min_const_fn)] - -struct A; - -impl A { - const fn banana() -> bool { - true - } -} - -const ABANANA: bool = A::banana(); - -fn main() { - match true { - ABANANA => {}, - _ => panic!("what?") - } -} diff --git a/src/test/ui/run-pass/consts/const-negation.rs b/src/test/ui/run-pass/consts/const-negation.rs deleted file mode 100644 index 048aa1f4e7a..00000000000 --- a/src/test/ui/run-pass/consts/const-negation.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -#[deny(const_err)] - -fn main() { - #[cfg(target_pointer_width = "32")] - const I: isize = -2147483648isize; - #[cfg(target_pointer_width = "64")] - const I: isize = -9223372036854775808isize; - assert_eq!(::std::i32::MIN as u64, 0xffffffff80000000); - assert_eq!(-2147483648isize as u64, 0xffffffff80000000); - assert_eq!(-2147483648i32 as u64, 0xffffffff80000000); - assert_eq!(::std::i64::MIN as u64, 0x8000000000000000); - #[cfg(target_pointer_width = "64")] - assert_eq!(-9223372036854775808isize as u64, 0x8000000000000000); - #[cfg(target_pointer_width = "32")] - assert_eq!(-9223372036854775808isize as u64, 0); - assert_eq!(-9223372036854775808i32 as u64, 0); - const J: usize = ::std::i32::MAX as usize; - const K: usize = -1i32 as u32 as usize; - const L: usize = ::std::i32::MIN as usize; - const M: usize = ::std::i64::MIN as usize; - match 5 { - J => {}, - K => {}, - L => {}, - M => {}, - _ => {} - } - match 5 { - I => {}, - _ => {} - } -} diff --git a/src/test/ui/run-pass/consts/const-negative.rs b/src/test/ui/run-pass/consts/const-negative.rs deleted file mode 100644 index 9b3c846deac..00000000000 --- a/src/test/ui/run-pass/consts/const-negative.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #358 -#![allow(non_upper_case_globals)] - -static toplevel_mod: isize = -1; - -pub fn main() { - assert_eq!(toplevel_mod, -1); -} diff --git a/src/test/ui/run-pass/consts/const-nullary-enum.rs b/src/test/ui/run-pass/consts/const-nullary-enum.rs deleted file mode 100644 index d1e359eab4e..00000000000 --- a/src/test/ui/run-pass/consts/const-nullary-enum.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum Foo { - Bar, - Baz, - Boo, -} - -static X: Foo = Foo::Bar; - -pub fn main() { - match X { - Foo::Bar => {} - Foo::Baz | Foo::Boo => panic!() - } - match Y { - Foo::Baz => {} - Foo::Bar | Foo::Boo => panic!() - } -} - -static Y: Foo = Foo::Baz; diff --git a/src/test/ui/run-pass/consts/const-nullary-univariant-enum.rs b/src/test/ui/run-pass/consts/const-nullary-univariant-enum.rs deleted file mode 100644 index aa255c4fdeb..00000000000 --- a/src/test/ui/run-pass/consts/const-nullary-univariant-enum.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(Copy, Clone)] -enum Foo { - Bar = 0xDEADBEE -} - -static X: Foo = Foo::Bar; - -pub fn main() { - assert_eq!((X as usize), 0xDEADBEE); - assert_eq!((Y as usize), 0xDEADBEE); -} - -static Y: Foo = Foo::Bar; diff --git a/src/test/ui/run-pass/consts/const-pattern-variant.rs b/src/test/ui/run-pass/consts/const-pattern-variant.rs deleted file mode 100644 index 95e0a5a62e3..00000000000 --- a/src/test/ui/run-pass/consts/const-pattern-variant.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -#[derive(PartialEq, Eq)] -enum Cake { - BlackForest, - Marmor, -} -use Cake::*; - -const BOO: (Cake, Cake) = (Marmor, BlackForest); -const FOO: Cake = BOO.1; - -const fn foo() -> Cake { - Marmor -} - -const WORKS: Cake = Marmor; - -const GOO: Cake = foo(); - -fn main() { - match BlackForest { - FOO => println!("hi"), - GOO => println!("meh"), - WORKS => println!("möp"), - _ => println!("bye"), - } -} diff --git a/src/test/ui/run-pass/consts/const-rec-and-tup.rs b/src/test/ui/run-pass/consts/const-rec-and-tup.rs deleted file mode 100644 index 15f74d23b6d..00000000000 --- a/src/test/ui/run-pass/consts/const-rec-and-tup.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] -#![allow(overflowing_literals)] - -struct Pair { a: f64, b: f64 } - -struct AnotherPair { x: (i64, i64), y: Pair } - -static x : (i32,i32) = (0xfeedf00dd,0xca11ab1e); -static y : AnotherPair = AnotherPair{ x: (0xf0f0f0f0_f0f0f0f0, - 0xabababab_abababab), - y: Pair { a: 3.14159265358979323846, - b: 2.7182818284590452354 }}; - -pub fn main() { - let (p, _) = y.x; - assert_eq!(p, - 1085102592571150096); - println!("{:#x}", p); -} diff --git a/src/test/ui/run-pass/consts/const-region-ptrs-noncopy.rs b/src/test/ui/run-pass/consts/const-region-ptrs-noncopy.rs deleted file mode 100644 index fdbebc47990..00000000000 --- a/src/test/ui/run-pass/consts/const-region-ptrs-noncopy.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -type Big = [u64; 8]; -struct Pair<'a> { a: isize, b: &'a Big } -const x: &'static Big = &([13, 14, 10, 13, 11, 14, 14, 15]); -const y: &'static Pair<'static> = &Pair {a: 15, b: x}; - -pub fn main() { - assert_eq!(x as *const Big, y.b as *const Big); -} diff --git a/src/test/ui/run-pass/consts/const-region-ptrs.rs b/src/test/ui/run-pass/consts/const-region-ptrs.rs deleted file mode 100644 index 00f987c745c..00000000000 --- a/src/test/ui/run-pass/consts/const-region-ptrs.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -struct Pair<'a> { a: isize, b: &'a isize } - -const x: &'static isize = &10; - -const y: &'static Pair<'static> = &Pair {a: 15, b: x}; - -pub fn main() { - println!("x = {}", *x); - println!("y = {{a: {}, b: {}}}", y.a, *(y.b)); - assert_eq!(*x, 10); - assert_eq!(*(y.b), 10); -} diff --git a/src/test/ui/run-pass/consts/const-repeated-values.rs b/src/test/ui/run-pass/consts/const-repeated-values.rs deleted file mode 100644 index 15a377c9c25..00000000000 --- a/src/test/ui/run-pass/consts/const-repeated-values.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const FOO: isize = 42; - -enum Bar { - Boo = *[&FOO; 4][3], -} - -fn main() { - assert_eq!(Bar::Boo as isize, 42); -} diff --git a/src/test/ui/run-pass/consts/const-size_of-align_of.rs b/src/test/ui/run-pass/consts/const-size_of-align_of.rs deleted file mode 100644 index 289c61ea9fa..00000000000 --- a/src/test/ui/run-pass/consts/const-size_of-align_of.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -use std::mem; - -// Get around the limitations of CTFE in today's Rust. -const fn choice_u64(c: bool, a: u64, b: u64) -> u64 { - (-(c as i64) as u64) & a | (-(!c as i64) as u64) & b -} - -const fn max_usize(a: usize, b: usize) -> usize { - choice_u64(a > b, a as u64, b as u64) as usize -} - -const fn align_to(size: usize, align: usize) -> usize { - (size + (align - 1)) & !(align - 1) -} - -const fn packed_union_size_of() -> usize { - max_usize(mem::size_of::(), mem::size_of::()) -} - -const fn union_align_of() -> usize { - max_usize(mem::align_of::(), mem::align_of::()) -} - -const fn union_size_of() -> usize { - align_to(packed_union_size_of::(), union_align_of::()) -} - -macro_rules! fake_union { - ($name:ident { $a:ty, $b:ty }) => ( - struct $name { - _align: ([$a; 0], [$b; 0]), - _bytes: [u8; union_size_of::<$a, $b>()] - } - ) -} - -// Check that we can (poorly) emulate unions by -// calling size_of and align_of at compile-time. -fake_union!(U { u16, [u8; 3] }); - -fn test(u: U) { - assert_eq!(mem::size_of_val(&u._bytes), 4); -} - -fn main() { - assert_eq!(mem::size_of::(), 4); - assert_eq!(mem::align_of::(), 2); -} diff --git a/src/test/ui/run-pass/consts/const-str-ptr.rs b/src/test/ui/run-pass/consts/const-str-ptr.rs deleted file mode 100644 index 59482811829..00000000000 --- a/src/test/ui/run-pass/consts/const-str-ptr.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::{str, string}; - -const A: [u8; 2] = ['h' as u8, 'i' as u8]; -const B: &'static [u8; 2] = &A; -const C: *const u8 = B as *const u8; - -pub fn main() { - unsafe { - let foo = &A as *const u8; - assert_eq!(foo, C); - assert_eq!(str::from_utf8_unchecked(&A), "hi"); - assert_eq!(*C, A[0]); - assert_eq!(*(&B[0] as *const u8), A[0]); - } -} diff --git a/src/test/ui/run-pass/consts/const-struct-offsets.rs b/src/test/ui/run-pass/consts/const-struct-offsets.rs deleted file mode 100644 index ec77b59e09d..00000000000 --- a/src/test/ui/run-pass/consts/const-struct-offsets.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_upper_case_globals)] - -enum Foo { - IntVal(i32), - Int64Val(i64) -} - -struct Bar { - i: i32, - v: Foo -} - -static bar: Bar = Bar { i: 0, v: Foo::IntVal(0) }; - -pub fn main() {} diff --git a/src/test/ui/run-pass/consts/const-struct.rs b/src/test/ui/run-pass/consts/const-struct.rs deleted file mode 100644 index 0554356ab8e..00000000000 --- a/src/test/ui/run-pass/consts/const-struct.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] - -use std::cmp; - -#[derive(Debug)] -struct foo { a: isize, b: isize, c: isize } - -impl cmp::PartialEq for foo { - fn eq(&self, other: &foo) -> bool { - (*self).a == (*other).a && - (*self).b == (*other).b && - (*self).c == (*other).c - } - fn ne(&self, other: &foo) -> bool { !(*self).eq(other) } -} - -const x : foo = foo { a:1, b:2, c: 3 }; -const y : foo = foo { b:2, c:3, a: 1 }; -const z : &'static foo = &foo { a: 10, b: 22, c: 12 }; -const w : foo = foo { a:5, ..x }; - -pub fn main() { - assert_eq!(x.b, 2); - assert_eq!(x, y); - assert_eq!(z.b, 22); - assert_eq!(w.a, 5); - assert_eq!(w.c, 3); - println!("{:#x}", x.b); - println!("{:#x}", z.c); -} diff --git a/src/test/ui/run-pass/consts/const-trait-to-trait.rs b/src/test/ui/run-pass/consts/const-trait-to-trait.rs deleted file mode 100644 index 6b7e4972536..00000000000 --- a/src/test/ui/run-pass/consts/const-trait-to-trait.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #24644 - block causes a &Trait -> &Trait coercion: -trait Trait {} - -struct Bar; -impl Trait for Bar {} - -fn main() { - let x: &[&Trait] = &[{ &Bar }]; -} - -// Issue #25748 - the cast causes an &Encoding -> &Encoding coercion: -pub struct UTF8Encoding; -pub const UTF_8: &'static UTF8Encoding = &UTF8Encoding; -pub trait Encoding {} -impl Encoding for UTF8Encoding {} -pub fn f() -> &'static Encoding { UTF_8 as &'static Encoding } - -// Root of the problem: &Trait -> &Trait coercions: -const FOO: &'static Trait = &Bar; -const BAR: &'static Trait = FOO; -fn foo() { let _x = BAR; } diff --git a/src/test/ui/run-pass/consts/const-tuple-struct.rs b/src/test/ui/run-pass/consts/const-tuple-struct.rs deleted file mode 100644 index bee1c83e3f9..00000000000 --- a/src/test/ui/run-pass/consts/const-tuple-struct.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Bar(isize, isize); - -static X: Bar = Bar(1, 2); - -pub fn main() { - match X { - Bar(x, y) => { - assert_eq!(x, 1); - assert_eq!(y, 2); - } - } -} diff --git a/src/test/ui/run-pass/consts/const-typeid-of.rs b/src/test/ui/run-pass/consts/const-typeid-of.rs deleted file mode 100644 index 153d6eccaab..00000000000 --- a/src/test/ui/run-pass/consts/const-typeid-of.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] -#![feature(const_type_id)] - -use std::any::TypeId; - -struct A; - -static ID_ISIZE: TypeId = TypeId::of::(); - -pub fn main() { - assert_eq!(ID_ISIZE, TypeId::of::()); - - // sanity test of TypeId - const T: (TypeId, TypeId, TypeId) = (TypeId::of::(), - TypeId::of::<&'static str>(), - TypeId::of::()); - let (d, e, f) = (TypeId::of::(), TypeId::of::<&'static str>(), - TypeId::of::()); - - assert!(T.0 != T.1); - assert!(T.0 != T.2); - assert!(T.1 != T.2); - - assert_eq!(T.0, d); - assert_eq!(T.1, e); - assert_eq!(T.2, f); - - // Check fn pointer against collisions - const F: (TypeId, TypeId) = (TypeId::of:: A) -> A>(), - TypeId::of:: A, A) -> A>()); - - assert!(F.0 != F.1); -} diff --git a/src/test/ui/run-pass/consts/const-unit-struct.rs b/src/test/ui/run-pass/consts/const-unit-struct.rs deleted file mode 100644 index 6dcf75b5331..00000000000 --- a/src/test/ui/run-pass/consts/const-unit-struct.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo; - -static X: Foo = Foo; - -pub fn main() { - match X { - Foo => {} - } -} diff --git a/src/test/ui/run-pass/consts/const-unsafe-fn.rs b/src/test/ui/run-pass/consts/const-unsafe-fn.rs deleted file mode 100644 index 6e05b0ac4d8..00000000000 --- a/src/test/ui/run-pass/consts/const-unsafe-fn.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A quick test of 'unsafe const fn' functionality - -#![feature(min_const_fn)] - -const unsafe fn dummy(v: u32) -> u32 { - !v -} - -struct Type; -impl Type { - const unsafe fn new() -> Type { - Type - } -} - -const VAL: u32 = unsafe { dummy(0xFFFF) }; -const TYPE_INST: Type = unsafe { Type::new() }; - -fn main() { - assert_eq!(VAL, 0xFFFF0000); -} diff --git a/src/test/ui/run-pass/consts/const-vec-of-fns.rs b/src/test/ui/run-pass/consts/const-vec-of-fns.rs deleted file mode 100644 index 79387b5195b..00000000000 --- a/src/test/ui/run-pass/consts/const-vec-of-fns.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_upper_case_globals)] - -/*! - * Try to double-check that static fns have the right size (with or - * without dummy env ptr, as appropriate) by iterating a size-2 array. - * If the static size differs from the runtime size, the second element - * should be read as a null or otherwise wrong pointer and crash. - */ - -fn f() { } -static bare_fns: &'static [fn()] = &[f, f]; -struct S(F); -static mut closures: &'static mut [S] = &mut [S(f as fn()), S(f as fn())]; - -pub fn main() { - unsafe { - for &bare_fn in bare_fns { bare_fn() } - for closure in &mut *closures { - let S(ref mut closure) = *closure; - (*closure)() - } - } -} diff --git a/src/test/ui/run-pass/consts/const-vec-syntax.rs b/src/test/ui/run-pass/consts/const-vec-syntax.rs deleted file mode 100644 index ef979ca398e..00000000000 --- a/src/test/ui/run-pass/consts/const-vec-syntax.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn f(_: &[isize]) {} - -pub fn main() { - let v = [ 1, 2, 3 ]; - f(&v); -} diff --git a/src/test/ui/run-pass/consts/const-vecs-and-slices.rs b/src/test/ui/run-pass/consts/const-vecs-and-slices.rs deleted file mode 100644 index 85d227b2d6e..00000000000 --- a/src/test/ui/run-pass/consts/const-vecs-and-slices.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -static x : [isize; 4] = [1,2,3,4]; -static y : &'static [isize] = &[1,2,3,4]; -static z : &'static [isize; 4] = &[1,2,3,4]; -static zz : &'static [isize] = &[1,2,3,4]; - -pub fn main() { - println!("{}", x[1]); - println!("{}", y[1]); - println!("{}", z[1]); - println!("{}", zz[1]); - assert_eq!(x[1], 2); - assert_eq!(x[3], 4); - assert_eq!(x[3], y[3]); - assert_eq!(z[1], 2); - assert_eq!(z[3], 4); - assert_eq!(z[3], y[3]); - assert_eq!(zz[1], 2); - assert_eq!(zz[3], 4); - assert_eq!(zz[3], y[3]); -} diff --git a/src/test/ui/run-pass/consts/const.rs b/src/test/ui/run-pass/consts/const.rs deleted file mode 100644 index 7fc5ecb5bd7..00000000000 --- a/src/test/ui/run-pass/consts/const.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -static i: isize = 10; - -pub fn main() { println!("{}", i); } diff --git a/src/test/ui/run-pass/consts/consts-in-patterns.rs b/src/test/ui/run-pass/consts/consts-in-patterns.rs deleted file mode 100644 index b96ad2f40a5..00000000000 --- a/src/test/ui/run-pass/consts/consts-in-patterns.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -const FOO: isize = 10; -const BAR: isize = 3; - -const fn foo() -> isize { 4 } -const BOO: isize = foo(); - -pub fn main() { - let x: isize = 3; - let y = match x { - FOO => 1, - BAR => 2, - BOO => 4, - _ => 3 - }; - assert_eq!(y, 2); -} diff --git a/src/test/ui/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs b/src/test/ui/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs deleted file mode 100644 index 52c3b073388..00000000000 --- a/src/test/ui/run-pass/cross-crate/anon-extern-mod-cross-crate-2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:anon-extern-mod-cross-crate-1.rs -// pretty-expanded FIXME #23616 -// ignore-wasm32-bare no libc to test ffi with - -extern crate anonexternmod; - -use anonexternmod::rust_get_test_int; - -pub fn main() { - unsafe { - rust_get_test_int(); - } -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs b/src/test/ui/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs deleted file mode 100644 index 741ce351da3..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/anon-extern-mod-cross-crate-1.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="anonexternmod"] -#![feature(libc)] - -extern crate libc; - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_get_test_int() -> libc::intptr_t; -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs deleted file mode 100644 index 9d93d9689e7..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/anon_trait_static_method_lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo { - pub x: isize -} - -impl Foo { - pub fn new() -> Foo { - Foo { x: 3 } - } -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs deleted file mode 100644 index 9c90510a857..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_borrow_lib.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo(x: &usize) -> usize { - *x -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_capture_clause.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_capture_clause.rs deleted file mode 100644 index b38e955231e..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_capture_clause.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::thread; -use std::sync::mpsc::{Receiver, channel}; - -pub fn foo(x: T) -> Receiver { - let (tx, rx) = channel(); - thread::spawn(move|| { - tx.send(x.clone()); - }); - rx -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_const.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_const.rs deleted file mode 100644 index ee8290050f9..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_const.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub extern fn bar() { -} - -pub const foopy: &'static str = "hi there"; -pub const uint_val: usize = 12; -pub const uint_expr: usize = (1 << uint_val) - 1; diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_impl_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_impl_lib.rs deleted file mode 100644 index d8921f4e09a..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_impl_lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="cci_impl_lib"] - -pub trait uint_helpers { - fn to(&self, v: usize, f: F) where F: FnMut(usize); -} - -impl uint_helpers for usize { - #[inline] - fn to(&self, v: usize, mut f: F) where F: FnMut(usize) { - let mut i = *self; - while i < v { - f(i); - i += 1; - } - } -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_iter_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_iter_lib.rs deleted file mode 100644 index 07d03b4c759..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_iter_lib.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="cci_iter_lib"] - -#[inline] -pub fn iter(v: &[T], mut f: F) where F: FnMut(&T) { - let mut i = 0; - let n = v.len(); - while i < n { - f(&v[i]); - i += 1; - } -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_nested_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_nested_lib.rs deleted file mode 100644 index 91de734ec3a..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_nested_lib.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(box_syntax)] - -use std::cell::RefCell; - -pub struct Entry { - key: A, - value: B -} - -pub struct alist { - eq_fn: extern "Rust" fn(A,A) -> bool, - data: Box>>>, -} - -pub fn alist_add(lst: &alist, k: A, v: B) { - let mut data = lst.data.borrow_mut(); - (*data).push(Entry{key:k, value:v}); -} - -pub fn alist_get( - lst: &alist, - k: A) - -> B { - let eq_fn = lst.eq_fn; - let data = lst.data.borrow(); - for entry in &(*data) { - if eq_fn(entry.key.clone(), k.clone()) { - return entry.value.clone(); - } - } - panic!(); -} - -#[inline] -pub fn new_int_alist() -> alist { - fn eq_int(a: isize, b: isize) -> bool { a == b } - return alist { - eq_fn: eq_int, - data: box RefCell::new(Vec::new()), - }; -} - -#[inline] -pub fn new_int_alist_2() -> alist { - #[inline] - fn eq_int(a: isize, b: isize) -> bool { a == b } - return alist { - eq_fn: eq_int, - data: box RefCell::new(Vec::new()), - }; -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs deleted file mode 100644 index 4c6f808c619..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/cci_no_inline_lib.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="cci_no_inline_lib"] - - -// same as cci_iter_lib, more-or-less, but not marked inline -pub fn iter(v: Vec , mut f: F) where F: FnMut(usize) { - let mut i = 0; - let n = v.len(); - while i < n { - f(v[i]); - i += 1; - } -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs b/src/test/ui/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs deleted file mode 100644 index f95be3f4a1d..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/moves_based_on_type_lib.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub struct S { - x: isize, -} - -impl Drop for S { - fn drop(&mut self) { - println!("goodbye"); - } -} - -pub fn f() { - let x = S { x: 1 }; - let y = x; - let _z = y; -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs b/src/test/ui/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs deleted file mode 100644 index be3414b7ad2..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/newtype_struct_xc.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub struct Au(pub isize); diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/pub_static_array.rs b/src/test/ui/run-pass/cross-crate/auxiliary/pub_static_array.rs deleted file mode 100644 index 7248d0e543b..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/pub_static_array.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub static ARRAY: [u8; 1] = [1]; diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/reexported_static_methods.rs b/src/test/ui/run-pass/cross-crate/auxiliary/reexported_static_methods.rs deleted file mode 100644 index cc4db1a9581..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/reexported_static_methods.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use sub_foo::Foo; -pub use self::Bar as Baz; -pub use sub_foo::Boz; -pub use sub_foo::Bort; - -pub trait Bar { - fn bar() -> Self; -} - -impl Bar for isize { - fn bar() -> isize { 84 } -} - -pub mod sub_foo { - pub trait Foo { - fn foo() -> Self; - } - - impl Foo for isize { - fn foo() -> isize { 42 } - } - - pub struct Boz { - unused_str: String - } - - impl Boz { - pub fn boz(i: isize) -> bool { - i > 0 - } - } - - pub enum Bort { - Bort1, - Bort2 - } - - impl Bort { - pub fn bort() -> String { - "bort()".to_string() - } - } -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs b/src/test/ui/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs deleted file mode 100644 index 66c0300e260..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate-trait-lifetime-param.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait FromBuf<'a> { - fn from_buf(_: &'a [u8]) -> Self; -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs b/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs deleted file mode 100644 index 5195839c067..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_address_insignificant.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() -> isize { - static a: isize = 3; - a -} - -pub fn bar() -> isize { - foo::() -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs b/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs deleted file mode 100644 index 6779438c672..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_associated_type_defaults.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(associated_type_defaults)] - -pub trait Foo { - type Out: Default + ToString = T; -} - -impl Foo for () { -} - -impl Foo for () { - type Out = bool; -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs b/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs deleted file mode 100644 index 48fb05f7779..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_generic_fn_nested_return.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Request { - pub id: String, - pub arg: String, -} - -pub fn decode() -> Result { - (|| { - Ok(Request { - id: "hi".to_owned(), - arg: match Err(()) { - Ok(v) => v, - Err(e) => return Err(e) - }, - }) - })() -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs b/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs deleted file mode 100644 index d0da80e31b9..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_static_addresses.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub static global: isize = 3; - -static global0: isize = 4; - -pub static global2: &'static isize = &global0; - -pub fn verify_same(a: &'static isize) { - let a = a as *const isize as usize; - let b = &global as *const isize as usize; - assert_eq!(a, b); -} - -pub fn verify_same2(a: &'static isize) { - let a = a as *const isize as usize; - let b = global2 as *const isize as usize; - assert_eq!(a, b); -} diff --git a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs b/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs deleted file mode 100644 index 7a69be2b06c..00000000000 --- a/src/test/ui/run-pass/cross-crate/auxiliary/xcrate_unit_struct.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -// used by the rpass test - -#[derive(Copy, Clone)] -pub struct Struct; - -#[derive(Copy, Clone)] -pub enum Unit { - UnitVariant, - Argument(Struct) -} - -#[derive(Copy, Clone)] -pub struct TupleStruct(pub usize, pub &'static str); - -// used by the cfail test - -#[derive(Copy, Clone)] -pub struct StructWithFields { - foo: isize, -} - -#[derive(Copy, Clone)] -pub enum EnumWithVariants { - EnumVariant, - EnumVariantArg(isize) -} diff --git a/src/test/ui/run-pass/cross-crate/cci_borrow.rs b/src/test/ui/run-pass/cross-crate/cci_borrow.rs deleted file mode 100644 index 6e822d7cb68..00000000000 --- a/src/test/ui/run-pass/cross-crate/cci_borrow.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_borrow_lib.rs - -#![feature(box_syntax)] - -extern crate cci_borrow_lib; -use cci_borrow_lib::foo; - -pub fn main() { - let p: Box<_> = box 22; - let r = foo(&*p); - println!("r={}", r); - assert_eq!(r, 22); -} diff --git a/src/test/ui/run-pass/cross-crate/cci_capture_clause.rs b/src/test/ui/run-pass/cross-crate/cci_capture_clause.rs deleted file mode 100644 index ea389d314b5..00000000000 --- a/src/test/ui/run-pass/cross-crate/cci_capture_clause.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_capture_clause.rs - -// This test makes sure we can do cross-crate inlining on functions -// that use capture clauses. - -// pretty-expanded FIXME #23616 -// ignore-emscripten no threads support - -extern crate cci_capture_clause; - -pub fn main() { - cci_capture_clause::foo(()).recv().unwrap(); -} diff --git a/src/test/ui/run-pass/cross-crate/cci_impl_exe.rs b/src/test/ui/run-pass/cross-crate/cci_impl_exe.rs deleted file mode 100644 index 18378ca63ed..00000000000 --- a/src/test/ui/run-pass/cross-crate/cci_impl_exe.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_impl_lib.rs - -extern crate cci_impl_lib; -use cci_impl_lib::uint_helpers; - -pub fn main() { - //let bt0 = sys::frame_address(); - //println!("%?", bt0); - - 3.to(10, |i| { - println!("{}", i); - - //let bt1 = sys::frame_address(); - //println!("%?", bt1); - //assert_eq!(bt0, bt1); - }) -} diff --git a/src/test/ui/run-pass/cross-crate/cci_iter_exe.rs b/src/test/ui/run-pass/cross-crate/cci_iter_exe.rs deleted file mode 100644 index 89c01bab3ca..00000000000 --- a/src/test/ui/run-pass/cross-crate/cci_iter_exe.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_iter_lib.rs - -extern crate cci_iter_lib; - -pub fn main() { - //let bt0 = sys::rusti::frame_address(1); - //println!("%?", bt0); - cci_iter_lib::iter(&[1, 2, 3], |i| { - println!("{}", *i); - //assert_eq!(bt0, sys::rusti::frame_address(2)); - }) -} diff --git a/src/test/ui/run-pass/cross-crate/cci_nested_exe.rs b/src/test/ui/run-pass/cross-crate/cci_nested_exe.rs deleted file mode 100644 index 3e88aad55f3..00000000000 --- a/src/test/ui/run-pass/cross-crate/cci_nested_exe.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_nested_lib.rs - - -extern crate cci_nested_lib; -use cci_nested_lib::*; - -pub fn main() { - let lst = new_int_alist(); - alist_add(&lst, 22, "hi".to_string()); - alist_add(&lst, 44, "ho".to_string()); - assert_eq!(alist_get(&lst, 22), "hi".to_string()); - assert_eq!(alist_get(&lst, 44), "ho".to_string()); - - let lst = new_int_alist_2(); - alist_add(&lst, 22, "hi".to_string()); - alist_add(&lst, 44, "ho".to_string()); - assert_eq!(alist_get(&lst, 22), "hi".to_string()); - assert_eq!(alist_get(&lst, 44), "ho".to_string()); -} diff --git a/src/test/ui/run-pass/cross-crate/cci_no_inline_exe.rs b/src/test/ui/run-pass/cross-crate/cci_no_inline_exe.rs deleted file mode 100644 index 79729494009..00000000000 --- a/src/test/ui/run-pass/cross-crate/cci_no_inline_exe.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_no_inline_lib.rs - -extern crate cci_no_inline_lib; -use cci_no_inline_lib::iter; - -pub fn main() { - // Check that a cross-crate call function not marked as inline - // does not, in fact, get inlined. Also, perhaps more - // importantly, checks that our scheme of using - // sys::frame_address() to determine if we are inlining is - // actually working. - //let bt0 = sys::frame_address(); - //println!("%?", bt0); - iter(vec![1, 2, 3], |i| { - println!("{}", i); - - //let bt1 = sys::frame_address(); - //println!("%?", bt1); - - //assert!(bt0 != bt1); - }) -} diff --git a/src/test/ui/run-pass/cross-crate/cross-crate-const-pat.rs b/src/test/ui/run-pass/cross-crate/cross-crate-const-pat.rs deleted file mode 100644 index 8040f60f947..00000000000 --- a/src/test/ui/run-pass/cross-crate/cross-crate-const-pat.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_const.rs - -// pretty-expanded FIXME #23616 - -extern crate cci_const; - -pub fn main() { - let x = cci_const::uint_val; - match x { - cci_const::uint_val => {} - _ => {} - } -} diff --git a/src/test/ui/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs b/src/test/ui/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs deleted file mode 100644 index e714e1d32ff..00000000000 --- a/src/test/ui/run-pass/cross-crate/cross-crate-newtype-struct-pat.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:newtype_struct_xc.rs - - -extern crate newtype_struct_xc; - -pub fn main() { - let x = newtype_struct_xc::Au(21); - match x { - newtype_struct_xc::Au(n) => assert_eq!(n, 21) - } -} diff --git a/src/test/ui/run-pass/cross-crate/moves-based-on-type-cross-crate.rs b/src/test/ui/run-pass/cross-crate/moves-based-on-type-cross-crate.rs deleted file mode 100644 index 8cc84c6c536..00000000000 --- a/src/test/ui/run-pass/cross-crate/moves-based-on-type-cross-crate.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:moves_based_on_type_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate moves_based_on_type_lib; -use moves_based_on_type_lib::f; - -pub fn main() { - f(); -} diff --git a/src/test/ui/run-pass/cross-crate/reexported-static-methods-cross-crate.rs b/src/test/ui/run-pass/cross-crate/reexported-static-methods-cross-crate.rs deleted file mode 100644 index 062e2572399..00000000000 --- a/src/test/ui/run-pass/cross-crate/reexported-static-methods-cross-crate.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:reexported_static_methods.rs - -extern crate reexported_static_methods; - -use reexported_static_methods::Foo; -use reexported_static_methods::Baz; -use reexported_static_methods::Boz; -use reexported_static_methods::Bort; - -pub fn main() { - assert_eq!(42_isize, Foo::foo()); - assert_eq!(84_isize, Baz::bar()); - assert!(Boz::boz(1)); - assert_eq!("bort()".to_string(), Bort::bort()); -} diff --git a/src/test/ui/run-pass/cross-crate/static-array-across-crate.rs b/src/test/ui/run-pass/cross-crate/static-array-across-crate.rs deleted file mode 100644 index c21be4ce47c..00000000000 --- a/src/test/ui/run-pass/cross-crate/static-array-across-crate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:pub_static_array.rs - -extern crate pub_static_array as array; - -use array::ARRAY; - -static X: &'static u8 = &ARRAY[0]; -static Y: &'static u8 = &(&ARRAY)[0]; -static Z: u8 = (&ARRAY)[0]; - -pub fn main() {} diff --git a/src/test/ui/run-pass/cross-crate/xcrate-address-insignificant.rs b/src/test/ui/run-pass/cross-crate/xcrate-address-insignificant.rs deleted file mode 100644 index 3ac2a0c8b45..00000000000 --- a/src/test/ui/run-pass/cross-crate/xcrate-address-insignificant.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate_address_insignificant.rs - - -extern crate xcrate_address_insignificant as foo; - -pub fn main() { - assert_eq!(foo::foo::(), foo::bar()); -} diff --git a/src/test/ui/run-pass/cross-crate/xcrate-associated-type-defaults.rs b/src/test/ui/run-pass/cross-crate/xcrate-associated-type-defaults.rs deleted file mode 100644 index 7015732daf6..00000000000 --- a/src/test/ui/run-pass/cross-crate/xcrate-associated-type-defaults.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate_associated_type_defaults.rs - -extern crate xcrate_associated_type_defaults; -use xcrate_associated_type_defaults::Foo; - -struct LocalDefault; -impl Foo for LocalDefault {} - -struct LocalOverride; -impl Foo for LocalOverride { - type Out = bool; -} - -fn main() { - assert_eq!( - <() as Foo>::Out::default().to_string(), - "0"); - assert_eq!( - <() as Foo>::Out::default().to_string(), - "false"); - - assert_eq!( - >::Out::default().to_string(), - "0"); - assert_eq!( - >::Out::default().to_string(), - "false"); -} diff --git a/src/test/ui/run-pass/cross-crate/xcrate-static-addresses.rs b/src/test/ui/run-pass/cross-crate/xcrate-static-addresses.rs deleted file mode 100644 index cb2a3563c7e..00000000000 --- a/src/test/ui/run-pass/cross-crate/xcrate-static-addresses.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate_static_addresses.rs - -// pretty-expanded FIXME #23616 - -extern crate xcrate_static_addresses; - -use xcrate_static_addresses as other; - -pub fn main() { - other::verify_same(&other::global); - other::verify_same2(other::global2); -} diff --git a/src/test/ui/run-pass/cross-crate/xcrate-trait-lifetime-param.rs b/src/test/ui/run-pass/cross-crate/xcrate-trait-lifetime-param.rs deleted file mode 100644 index 467ee2cedb9..00000000000 --- a/src/test/ui/run-pass/cross-crate/xcrate-trait-lifetime-param.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate-trait-lifetime-param.rs - -// pretty-expanded FIXME #23616 - -extern crate xcrate_trait_lifetime_param as other; - -struct Reader<'a> { - b : &'a [u8] -} - -impl <'a> other::FromBuf<'a> for Reader<'a> { - fn from_buf(b : &'a [u8]) -> Reader<'a> { - Reader { b : b } - } -} - -pub fn main () {} diff --git a/src/test/ui/run-pass/cross-crate/xcrate-unit-struct.rs b/src/test/ui/run-pass/cross-crate/xcrate-unit-struct.rs deleted file mode 100644 index 65ce4244f56..00000000000 --- a/src/test/ui/run-pass/cross-crate/xcrate-unit-struct.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate_unit_struct.rs -// pretty-expanded FIXME #23616 -#![allow(non_upper_case_globals)] - -extern crate xcrate_unit_struct; - -const s1: xcrate_unit_struct::Struct = xcrate_unit_struct::Struct; -static s2: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::UnitVariant; -static s3: xcrate_unit_struct::Unit = - xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct); -static s4: xcrate_unit_struct::Unit = xcrate_unit_struct::Unit::Argument(s1); -static s5: xcrate_unit_struct::TupleStruct = xcrate_unit_struct::TupleStruct(20, "foo"); - -fn f1(_: xcrate_unit_struct::Struct) {} -fn f2(_: xcrate_unit_struct::Unit) {} -fn f3(_: xcrate_unit_struct::TupleStruct) {} - -pub fn main() { - f1(xcrate_unit_struct::Struct); - f2(xcrate_unit_struct::Unit::UnitVariant); - f2(xcrate_unit_struct::Unit::Argument(xcrate_unit_struct::Struct)); - f3(xcrate_unit_struct::TupleStruct(10, "bar")); - - f1(s1); - f2(s2); - f2(s3); - f2(s4); - f3(s5); -} diff --git a/src/test/ui/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs b/src/test/ui/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs deleted file mode 100644 index 2ed392a3fbb..00000000000 --- a/src/test/ui/run-pass/cross-crate/xcrate_generic_fn_nested_return.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate_generic_fn_nested_return.rs - -extern crate xcrate_generic_fn_nested_return as test; - -pub fn main() { - assert!(test::decode::<()>().is_err()); -} diff --git a/src/test/ui/run-pass/ctfe/assoc-const.rs b/src/test/ui/run-pass/ctfe/assoc-const.rs deleted file mode 100644 index cead1743926..00000000000 --- a/src/test/ui/run-pass/ctfe/assoc-const.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Nat { - const VALUE: usize; -} - -struct Zero; -struct Succ(N); - -impl Nat for Zero { - const VALUE: usize = 0; -} - -impl Nat for Succ { - const VALUE: usize = N::VALUE + 1; -} - -fn main() { - let x: [i32; >>>>::VALUE] = [1, 2, 3, 4]; -} diff --git a/src/test/ui/run-pass/ctfe/bswap-const.rs b/src/test/ui/run-pass/ctfe/bswap-const.rs deleted file mode 100644 index 5fc7609bb68..00000000000 --- a/src/test/ui/run-pass/ctfe/bswap-const.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(core_intrinsics)] - -use std::intrinsics; - -const SWAPPED_U8: u8 = unsafe { intrinsics::bswap(0x12_u8) }; -const SWAPPED_U16: u16 = unsafe { intrinsics::bswap(0x12_34_u16) }; -const SWAPPED_I32: i32 = unsafe { intrinsics::bswap(0x12_34_56_78_i32) }; - -fn main() { - assert_eq!(SWAPPED_U8, 0x12); - assert_eq!(SWAPPED_U16, 0x34_12); - assert_eq!(SWAPPED_I32, 0x78_56_34_12); -} diff --git a/src/test/ui/run-pass/ctfe/chained-constants-stackoverflow.rs b/src/test/ui/run-pass/ctfe/chained-constants-stackoverflow.rs deleted file mode 100644 index 94e97d37424..00000000000 --- a/src/test/ui/run-pass/ctfe/chained-constants-stackoverflow.rs +++ /dev/null @@ -1,366 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/34997 - -pub const CST_1: u32 = 0; -pub const CST_2: u32 = CST_1+1; -pub const CST_3: u32 = CST_2+1; -pub const CST_4: u32 = CST_3+1; -pub const CST_5: u32 = CST_4+1; -pub const CST_6: u32 = CST_5+1; -pub const CST_7: u32 = CST_6+1; -pub const CST_8: u32 = CST_7+1; -pub const CST_9: u32 = CST_8+1; -pub const CST_10: u32 = CST_9+1; -pub const CST_11: u32 = CST_10+1; -pub const CST_12: u32 = CST_11+1; -pub const CST_13: u32 = CST_12+1; -pub const CST_14: u32 = CST_13+1; -pub const CST_15: u32 = CST_14+1; -pub const CST_16: u32 = CST_15+1; -pub const CST_17: u32 = CST_16+1; -pub const CST_18: u32 = CST_17+1; -pub const CST_19: u32 = CST_18+1; -pub const CST_20: u32 = CST_19+1; -pub const CST_21: u32 = CST_20+1; -pub const CST_22: u32 = CST_21+1; -pub const CST_23: u32 = CST_22+1; -pub const CST_24: u32 = CST_23+1; -pub const CST_25: u32 = CST_24+1; -pub const CST_26: u32 = CST_25+1; -pub const CST_27: u32 = CST_26+1; -pub const CST_28: u32 = CST_27+1; -pub const CST_29: u32 = CST_28+1; -pub const CST_30: u32 = CST_29+1; -pub const CST_31: u32 = CST_30+1; -pub const CST_32: u32 = CST_31+1; -pub const CST_33: u32 = CST_32+1; -pub const CST_34: u32 = CST_33+1; -pub const CST_35: u32 = CST_34+1; -pub const CST_36: u32 = CST_35+1; -pub const CST_37: u32 = CST_36+1; -pub const CST_38: u32 = CST_37+1; -pub const CST_39: u32 = CST_38+1; -pub const CST_40: u32 = CST_39+1; -pub const CST_41: u32 = CST_40+1; -pub const CST_42: u32 = CST_41+1; -pub const CST_43: u32 = CST_42+1; -pub const CST_44: u32 = CST_43+1; -pub const CST_45: u32 = CST_44+1; -pub const CST_46: u32 = CST_45+1; -pub const CST_47: u32 = CST_46+1; -pub const CST_48: u32 = CST_47+1; -pub const CST_49: u32 = CST_48+1; -pub const CST_50: u32 = CST_49+1; -pub const CST_51: u32 = CST_50+1; -pub const CST_52: u32 = CST_51+1; -pub const CST_53: u32 = CST_52+1; -pub const CST_54: u32 = CST_53+1; -pub const CST_55: u32 = CST_54+1; -pub const CST_56: u32 = CST_55+1; -pub const CST_57: u32 = CST_56+1; -pub const CST_58: u32 = CST_57+1; -pub const CST_59: u32 = CST_58+1; -pub const CST_60: u32 = CST_59+1; -pub const CST_61: u32 = CST_60+1; -pub const CST_62: u32 = CST_61+1; -pub const CST_63: u32 = CST_62+1; -pub const CST_64: u32 = CST_63+1; -pub const CST_65: u32 = CST_64+1; -pub const CST_66: u32 = CST_65+1; -pub const CST_67: u32 = CST_66+1; -pub const CST_68: u32 = CST_67+1; -pub const CST_69: u32 = CST_68+1; -pub const CST_70: u32 = CST_69+1; -pub const CST_71: u32 = CST_70+1; -pub const CST_72: u32 = CST_71+1; -pub const CST_73: u32 = CST_72+1; -pub const CST_74: u32 = CST_73+1; -pub const CST_75: u32 = CST_74+1; -pub const CST_76: u32 = CST_75+1; -pub const CST_77: u32 = CST_76+1; -pub const CST_78: u32 = CST_77+1; -pub const CST_79: u32 = CST_78+1; -pub const CST_80: u32 = CST_79+1; -pub const CST_81: u32 = CST_80+1; -pub const CST_82: u32 = CST_81+1; -pub const CST_83: u32 = CST_82+1; -pub const CST_84: u32 = CST_83+1; -pub const CST_85: u32 = CST_84+1; -pub const CST_86: u32 = CST_85+1; -pub const CST_87: u32 = CST_86+1; -pub const CST_88: u32 = CST_87+1; -pub const CST_89: u32 = CST_88+1; -pub const CST_90: u32 = CST_89+1; -pub const CST_91: u32 = CST_90+1; -pub const CST_92: u32 = CST_91+1; -pub const CST_93: u32 = CST_92+1; -pub const CST_94: u32 = CST_93+1; -pub const CST_95: u32 = CST_94+1; -pub const CST_96: u32 = CST_95+1; -pub const CST_97: u32 = CST_96+1; -pub const CST_98: u32 = CST_97+1; -pub const CST_99: u32 = CST_98+1; -pub const CST_100: u32 = CST_99+1; -pub const CST_101: u32 = CST_100+1; -pub const CST_102: u32 = CST_101+1; -pub const CST_103: u32 = CST_102+1; -pub const CST_104: u32 = CST_103+1; -pub const CST_105: u32 = CST_104+1; -pub const CST_106: u32 = CST_105+1; -pub const CST_107: u32 = CST_106+1; -pub const CST_108: u32 = CST_107+1; -pub const CST_109: u32 = CST_108+1; -pub const CST_110: u32 = CST_109+1; -pub const CST_111: u32 = CST_110+1; -pub const CST_112: u32 = CST_111+1; -pub const CST_113: u32 = CST_112+1; -pub const CST_114: u32 = CST_113+1; -pub const CST_115: u32 = CST_114+1; -pub const CST_116: u32 = CST_115+1; -pub const CST_117: u32 = CST_116+1; -pub const CST_118: u32 = CST_117+1; -pub const CST_119: u32 = CST_118+1; -pub const CST_120: u32 = CST_119+1; -pub const CST_121: u32 = CST_120+1; -pub const CST_122: u32 = CST_121+1; -pub const CST_123: u32 = CST_122+1; -pub const CST_124: u32 = CST_123+1; -pub const CST_125: u32 = CST_124+1; -pub const CST_126: u32 = CST_125+1; -pub const CST_127: u32 = CST_126+1; -pub const CST_128: u32 = CST_127+1; -pub const CST_129: u32 = CST_128+1; -pub const CST_130: u32 = CST_129+1; -pub const CST_131: u32 = CST_130+1; -pub const CST_132: u32 = CST_131+1; -pub const CST_133: u32 = CST_132+1; -pub const CST_134: u32 = CST_133+1; -pub const CST_135: u32 = CST_134+1; -pub const CST_136: u32 = CST_135+1; -pub const CST_137: u32 = CST_136+1; -pub const CST_138: u32 = CST_137+1; -pub const CST_139: u32 = CST_138+1; -pub const CST_140: u32 = CST_139+1; -pub const CST_141: u32 = CST_140+1; -pub const CST_142: u32 = CST_141+1; -pub const CST_143: u32 = CST_142+1; -pub const CST_144: u32 = CST_143+1; -pub const CST_145: u32 = CST_144+1; -pub const CST_146: u32 = CST_145+1; -pub const CST_147: u32 = CST_146+1; -pub const CST_148: u32 = CST_147+1; -pub const CST_149: u32 = CST_148+1; -pub const CST_150: u32 = CST_149+1; -pub const CST_151: u32 = CST_150+1; -pub const CST_152: u32 = CST_151+1; -pub const CST_153: u32 = CST_152+1; -pub const CST_154: u32 = CST_153+1; -pub const CST_155: u32 = CST_154+1; -pub const CST_156: u32 = CST_155+1; -pub const CST_157: u32 = CST_156+1; -pub const CST_158: u32 = CST_157+1; -pub const CST_159: u32 = CST_158+1; -pub const CST_160: u32 = CST_159+1; -pub const CST_161: u32 = CST_160+1; -pub const CST_162: u32 = CST_161+1; -pub const CST_163: u32 = CST_162+1; -pub const CST_164: u32 = CST_163+1; -pub const CST_165: u32 = CST_164+1; -pub const CST_166: u32 = CST_165+1; -pub const CST_167: u32 = CST_166+1; -pub const CST_168: u32 = CST_167+1; -pub const CST_169: u32 = CST_168+1; -pub const CST_170: u32 = CST_169+1; -pub const CST_171: u32 = CST_170+1; -pub const CST_172: u32 = CST_171+1; -pub const CST_173: u32 = CST_172+1; -pub const CST_174: u32 = CST_173+1; -pub const CST_175: u32 = CST_174+1; -pub const CST_176: u32 = CST_175+1; -pub const CST_177: u32 = CST_176+1; -pub const CST_178: u32 = CST_177+1; -pub const CST_179: u32 = CST_178+1; -pub const CST_180: u32 = CST_179+1; -pub const CST_181: u32 = CST_180+1; -pub const CST_182: u32 = CST_181+1; -pub const CST_183: u32 = CST_182+1; -pub const CST_184: u32 = CST_183+1; -pub const CST_185: u32 = CST_184+1; -pub const CST_186: u32 = CST_185+1; -pub const CST_187: u32 = CST_186+1; -pub const CST_188: u32 = CST_187+1; -pub const CST_189: u32 = CST_188+1; -pub const CST_190: u32 = CST_189+1; -pub const CST_191: u32 = CST_190+1; -pub const CST_192: u32 = CST_191+1; -pub const CST_193: u32 = CST_192+1; -pub const CST_194: u32 = CST_193+1; -pub const CST_195: u32 = CST_194+1; -pub const CST_196: u32 = CST_195+1; -pub const CST_197: u32 = CST_196+1; -pub const CST_198: u32 = CST_197+1; -pub const CST_199: u32 = CST_198+1; -pub const CST_200: u32 = CST_199+1; -pub const CST_201: u32 = CST_200+1; -pub const CST_202: u32 = CST_201+1; -pub const CST_203: u32 = CST_202+1; -pub const CST_204: u32 = CST_203+1; -pub const CST_205: u32 = CST_204+1; -pub const CST_206: u32 = CST_205+1; -pub const CST_207: u32 = CST_206+1; -pub const CST_208: u32 = CST_207+1; -pub const CST_209: u32 = CST_208+1; -pub const CST_210: u32 = CST_209+1; -pub const CST_211: u32 = CST_210+1; -pub const CST_212: u32 = CST_211+1; -pub const CST_213: u32 = CST_212+1; -pub const CST_214: u32 = CST_213+1; -pub const CST_215: u32 = CST_214+1; -pub const CST_216: u32 = CST_215+1; -pub const CST_217: u32 = CST_216+1; -pub const CST_218: u32 = CST_217+1; -pub const CST_219: u32 = CST_218+1; -pub const CST_220: u32 = CST_219+1; -pub const CST_221: u32 = CST_220+1; -pub const CST_222: u32 = CST_221+1; -pub const CST_223: u32 = CST_222+1; -pub const CST_224: u32 = CST_223+1; -pub const CST_225: u32 = CST_224+1; -pub const CST_226: u32 = CST_225+1; -pub const CST_227: u32 = CST_226+1; -pub const CST_228: u32 = CST_227+1; -pub const CST_229: u32 = CST_228+1; -pub const CST_230: u32 = CST_229+1; -pub const CST_231: u32 = CST_230+1; -pub const CST_232: u32 = CST_231+1; -pub const CST_233: u32 = CST_232+1; -pub const CST_234: u32 = CST_233+1; -pub const CST_235: u32 = CST_234+1; -pub const CST_236: u32 = CST_235+1; -pub const CST_237: u32 = CST_236+1; -pub const CST_238: u32 = CST_237+1; -pub const CST_239: u32 = CST_238+1; -pub const CST_240: u32 = CST_239+1; -pub const CST_241: u32 = CST_240+1; -pub const CST_242: u32 = CST_241+1; -pub const CST_243: u32 = CST_242+1; -pub const CST_244: u32 = CST_243+1; -pub const CST_245: u32 = CST_244+1; -pub const CST_246: u32 = CST_245+1; -pub const CST_247: u32 = CST_246+1; -pub const CST_248: u32 = CST_247+1; -pub const CST_249: u32 = CST_248+1; -pub const CST_250: u32 = CST_249+1; -pub const CST_251: u32 = CST_250+1; -pub const CST_252: u32 = CST_251+1; -pub const CST_253: u32 = CST_252+1; -pub const CST_254: u32 = CST_253+1; -pub const CST_255: u32 = CST_254+1; -pub const CST_256: u32 = CST_255+1; -pub const CST_257: u32 = CST_256+1; -pub const CST_258: u32 = CST_257+1; -pub const CST_259: u32 = CST_258+1; -pub const CST_260: u32 = CST_259+1; -pub const CST_261: u32 = CST_260+1; -pub const CST_262: u32 = CST_261+1; -pub const CST_263: u32 = CST_262+1; -pub const CST_264: u32 = CST_263+1; -pub const CST_265: u32 = CST_264+1; -pub const CST_266: u32 = CST_265+1; -pub const CST_267: u32 = CST_266+1; -pub const CST_268: u32 = CST_267+1; -pub const CST_269: u32 = CST_268+1; -pub const CST_270: u32 = CST_269+1; -pub const CST_271: u32 = CST_270+1; -pub const CST_272: u32 = CST_271+1; -pub const CST_273: u32 = CST_272+1; -pub const CST_274: u32 = CST_273+1; -pub const CST_275: u32 = CST_274+1; -pub const CST_276: u32 = CST_275+1; -pub const CST_277: u32 = CST_276+1; -pub const CST_278: u32 = CST_277+1; -pub const CST_279: u32 = CST_278+1; -pub const CST_280: u32 = CST_279+1; -pub const CST_281: u32 = CST_280+1; -pub const CST_282: u32 = CST_281+1; -pub const CST_283: u32 = CST_282+1; -pub const CST_284: u32 = CST_283+1; -pub const CST_285: u32 = CST_284+1; -pub const CST_286: u32 = CST_285+1; -pub const CST_287: u32 = CST_286+1; -pub const CST_288: u32 = CST_287+1; -pub const CST_289: u32 = CST_288+1; -pub const CST_290: u32 = CST_289+1; -pub const CST_291: u32 = CST_290+1; -pub const CST_292: u32 = CST_291+1; -pub const CST_293: u32 = CST_292+1; -pub const CST_294: u32 = CST_293+1; -pub const CST_295: u32 = CST_294+1; -pub const CST_296: u32 = CST_295+1; -pub const CST_297: u32 = CST_296+1; -pub const CST_298: u32 = CST_297+1; -pub const CST_299: u32 = CST_298+1; -pub const CST_300: u32 = CST_299+1; -pub const CST_301: u32 = CST_300+1; -pub const CST_302: u32 = CST_301+1; -pub const CST_303: u32 = CST_302+1; -pub const CST_304: u32 = CST_303+1; -pub const CST_305: u32 = CST_304+1; -pub const CST_306: u32 = CST_305+1; -pub const CST_307: u32 = CST_306+1; -pub const CST_308: u32 = CST_307+1; -pub const CST_309: u32 = CST_308+1; -pub const CST_310: u32 = CST_309+1; -pub const CST_311: u32 = CST_310+1; -pub const CST_312: u32 = CST_311+1; -pub const CST_313: u32 = CST_312+1; -pub const CST_314: u32 = CST_313+1; -pub const CST_315: u32 = CST_314+1; -pub const CST_316: u32 = CST_315+1; -pub const CST_317: u32 = CST_316+1; -pub const CST_318: u32 = CST_317+1; -pub const CST_319: u32 = CST_318+1; -pub const CST_320: u32 = CST_319+1; -pub const CST_321: u32 = CST_320+1; -pub const CST_322: u32 = CST_321+1; -pub const CST_323: u32 = CST_322+1; -pub const CST_324: u32 = CST_323+1; -pub const CST_325: u32 = CST_324+1; -pub const CST_326: u32 = CST_325+1; -pub const CST_327: u32 = CST_326+1; -pub const CST_328: u32 = CST_327+1; -pub const CST_329: u32 = CST_328+1; -pub const CST_330: u32 = CST_329+1; -pub const CST_331: u32 = CST_330+1; -pub const CST_332: u32 = CST_331+1; -pub const CST_333: u32 = CST_332+1; -pub const CST_334: u32 = CST_333+1; -pub const CST_335: u32 = CST_334+1; -pub const CST_336: u32 = CST_335+1; -pub const CST_337: u32 = CST_336+1; -pub const CST_338: u32 = CST_337+1; -pub const CST_339: u32 = CST_338+1; -pub const CST_340: u32 = CST_339+1; -pub const CST_341: u32 = CST_340+1; -pub const CST_342: u32 = CST_341+1; -pub const CST_343: u32 = CST_342+1; -pub const CST_344: u32 = CST_343+1; -pub const CST_345: u32 = CST_344+1; -pub const CST_346: u32 = CST_345+1; -pub const CST_347: u32 = CST_346+1; -pub const CST_348: u32 = CST_347+1; -pub const CST_349: u32 = CST_348+1; -pub const CST_350: u32 = CST_349+1; - -fn main() {} diff --git a/src/test/ui/run-pass/ctfe/const-block-non-item-statement-3.rs b/src/test/ui/run-pass/ctfe/const-block-non-item-statement-3.rs deleted file mode 100644 index 09590d5f197..00000000000 --- a/src/test/ui/run-pass/ctfe/const-block-non-item-statement-3.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(const_let)] - -type Array = [u32; { let x = 2; 5 }]; - -pub fn main() {} diff --git a/src/test/ui/run-pass/ctfe/const-block-non-item-statement.rs b/src/test/ui/run-pass/ctfe/const-block-non-item-statement.rs deleted file mode 100644 index 5490bd4d3ad..00000000000 --- a/src/test/ui/run-pass/ctfe/const-block-non-item-statement.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(const_let)] - -enum Foo { - Bar = { let x = 1; 3 } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/ctfe/const-fn-destructuring-arg.rs b/src/test/ui/run-pass/ctfe/const-fn-destructuring-arg.rs deleted file mode 100644 index 323232acc67..00000000000 --- a/src/test/ui/run-pass/ctfe/const-fn-destructuring-arg.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// test that certain things are disallowed in constant functions - -#![feature(const_fn, const_let)] - -// no destructuring -const fn i(( - a, - b - ): (u32, u32)) -> u32 { - a + b -} - -fn main() {} diff --git a/src/test/ui/run-pass/ctfe/deref_in_pattern.rs b/src/test/ui/run-pass/ctfe/deref_in_pattern.rs deleted file mode 100644 index 6f4cca624bf..00000000000 --- a/src/test/ui/run-pass/ctfe/deref_in_pattern.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/25574 - -const A: [u8; 4] = *b"fooo"; - -fn main() { - match *b"xxxx" { - A => {}, - _ => {} - } -} diff --git a/src/test/ui/run-pass/ctfe/ice-48279.rs b/src/test/ui/run-pass/ctfe/ice-48279.rs deleted file mode 100644 index 34b7b56f274..00000000000 --- a/src/test/ui/run-pass/ctfe/ice-48279.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/48279 - -#![feature(min_const_fn)] - -#[derive(PartialEq, Eq)] -pub struct NonZeroU32 { - value: u32 -} - -impl NonZeroU32 { - const unsafe fn new_unchecked(value: u32) -> Self { - NonZeroU32 { value } - } -} - -//pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32::new_unchecked(7) }; -pub const FOO_ATOM: NonZeroU32 = unsafe { NonZeroU32 { value: 7 } }; - -fn main() { - match None { - Some(FOO_ATOM) => {} - _ => {} - } -} diff --git a/src/test/ui/run-pass/ctfe/issue-37550.rs b/src/test/ui/run-pass/ctfe/issue-37550.rs deleted file mode 100644 index 21c4ec2c09e..00000000000 --- a/src/test/ui/run-pass/ctfe/issue-37550.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(const_fn, const_let)] - -const fn x() { - let t = true; - let x = || t; -} - -fn main() {} diff --git a/src/test/ui/run-pass/ctfe/issue-broken-mir.rs b/src/test/ui/run-pass/ctfe/issue-broken-mir.rs deleted file mode 100644 index 4810ef75c78..00000000000 --- a/src/test/ui/run-pass/ctfe/issue-broken-mir.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/27918 - -fn main() { - match b" " { - b"1234" => {}, - _ => {}, - } -} diff --git a/src/test/ui/run-pass/ctfe/locals-in-const-fn.rs b/src/test/ui/run-pass/ctfe/locals-in-const-fn.rs deleted file mode 100644 index d10465b9dcd..00000000000 --- a/src/test/ui/run-pass/ctfe/locals-in-const-fn.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/48821 - -#![feature(const_fn, const_let)] - -const fn foo(i: usize) -> usize { - let x = i; - x -} - -static FOO: usize = foo(42); - -const fn bar(mut i: usize) -> usize { - i += 8; - let x = &i; - *x -} - -static BAR: usize = bar(42); - -const fn boo(mut i: usize) -> usize { - { - let mut x = i; - x += 10; - i = x; - } - i -} - -static BOO: usize = boo(42); - -fn main() { - assert!(FOO == 42); - assert!(BAR == 50); - assert!(BOO == 52); -} diff --git a/src/test/ui/run-pass/ctfe/match-const-fn-structs.rs b/src/test/ui/run-pass/ctfe/match-const-fn-structs.rs deleted file mode 100644 index 6c829f142dd..00000000000 --- a/src/test/ui/run-pass/ctfe/match-const-fn-structs.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/46114 - -#![feature(min_const_fn)] - -#[derive(Eq, PartialEq)] -struct A { value: u32 } - -const fn new(value: u32) -> A { - A { value } -} - -const A_1: A = new(1); -const A_2: A = new(2); - -fn main() { - let a_str = match new(42) { - A_1 => "A 1", - A_2 => "A 2", - _ => "Unknown A", - }; -} diff --git a/src/test/ui/run-pass/ctfe/mozjs-error.rs b/src/test/ui/run-pass/ctfe/mozjs-error.rs deleted file mode 100644 index ea200ba738f..00000000000 --- a/src/test/ui/run-pass/ctfe/mozjs-error.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -struct CustomAutoRooterVFTable { - trace: unsafe extern "C" fn(this: *mut i32, trc: *mut u32), -} - -unsafe trait CustomAutoTraceable: Sized { - const vftable: CustomAutoRooterVFTable = CustomAutoRooterVFTable { - trace: Self::trace, - }; - - unsafe extern "C" fn trace(this: *mut i32, trc: *mut u32) { - let this = this as *const Self; - let this = this.as_ref().unwrap(); - Self::do_trace(this, trc); - } - - fn do_trace(&self, trc: *mut u32); -} - -unsafe impl CustomAutoTraceable for () { - fn do_trace(&self, _: *mut u32) { - // nop - } -} - -fn main() { - let _ = <()>::vftable; -} diff --git a/src/test/ui/run-pass/ctfe/non-scalar-cast.rs b/src/test/ui/run-pass/ctfe/non-scalar-cast.rs deleted file mode 100644 index 9711247b83e..00000000000 --- a/src/test/ui/run-pass/ctfe/non-scalar-cast.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/37448 - -fn main() { - struct A; - const FOO: &A = &(A as A); - let _x = FOO; -} diff --git a/src/test/ui/run-pass/ctfe/promotion.rs b/src/test/ui/run-pass/ctfe/promotion.rs deleted file mode 100644 index 5407529f065..00000000000 --- a/src/test/ui/run-pass/ctfe/promotion.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags: -O - -fn foo(_: &'static [&'static str]) {} -fn bar(_: &'static [&'static str; 3]) {} -fn baz_i32(_: &'static i32) {} -fn baz_u32(_: &'static u32) {} - -fn main() { - foo(&["a", "b", "c"]); - bar(&["d", "e", "f"]); - - // make sure that these do not cause trouble despite overflowing - baz_u32(&(0-1)); - baz_i32(&-std::i32::MIN); -} diff --git a/src/test/ui/run-pass/ctfe/references.rs b/src/test/ui/run-pass/ctfe/references.rs deleted file mode 100644 index 946ed246bb0..00000000000 --- a/src/test/ui/run-pass/ctfe/references.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const FOO: &[u8] = b"foo"; -const BAR: &[u8] = &[1, 2, 3]; - -const BOO: &i32 = &42; - -fn main() { - match &[1u8, 2, 3] as &[u8] { - FOO => panic!("a"), - BAR => println!("b"), - _ => panic!("c"), - } - - match b"foo" as &[u8] { - FOO => println!("a"), - BAR => panic!("b"), - _ => panic!("c"), - } - - match &43 { - &42 => panic!(), - BOO => panic!(), - _ => println!("d"), - } -} diff --git a/src/test/ui/run-pass/ctfe/repeat_match.rs b/src/test/ui/run-pass/ctfe/repeat_match.rs deleted file mode 100644 index 60a9a916bff..00000000000 --- a/src/test/ui/run-pass/ctfe/repeat_match.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/45044 - -const X: [u8; 1] = [0; 1]; - -fn main() { - match &X { - &X => println!("a"), - _ => println!("b"), - }; -} diff --git a/src/test/ui/run-pass/ctfe/return-in-const-fn.rs b/src/test/ui/run-pass/ctfe/return-in-const-fn.rs deleted file mode 100644 index e0020019523..00000000000 --- a/src/test/ui/run-pass/ctfe/return-in-const-fn.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/43754 - -#![feature(min_const_fn)] -const fn foo(x: usize) -> usize { - return x; -} -fn main() { - [0; foo(2)]; -} diff --git a/src/test/ui/run-pass/ctfe/signed_enum_discr.rs b/src/test/ui/run-pass/ctfe/signed_enum_discr.rs deleted file mode 100644 index 9dd2990ab8d..00000000000 --- a/src/test/ui/run-pass/ctfe/signed_enum_discr.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/49181 - -#[derive(Eq, PartialEq)] -#[repr(i8)] -pub enum A { - B = -1, - C = 1, -} - -pub const D: A = A::B; - -fn main() { - match A::C { - D => {}, - _ => {} - } -} diff --git a/src/test/ui/run-pass/ctfe/transmute-const.rs b/src/test/ui/run-pass/ctfe/transmute-const.rs deleted file mode 100644 index efd6df5f886..00000000000 --- a/src/test/ui/run-pass/ctfe/transmute-const.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(const_transmute)] - -use std::mem; - -#[repr(transparent)] -struct Foo(u32); - -const TRANSMUTED_U32: u32 = unsafe { mem::transmute(Foo(3)) }; - -fn main() { - assert_eq!(TRANSMUTED_U32, 3); -} diff --git a/src/test/ui/run-pass/ctfe/tuple-struct-constructors.rs b/src/test/ui/run-pass/ctfe/tuple-struct-constructors.rs deleted file mode 100644 index c7000d19813..00000000000 --- a/src/test/ui/run-pass/ctfe/tuple-struct-constructors.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// https://github.com/rust-lang/rust/issues/41898 - -use std::num::NonZeroU64; - -fn main() { - const FOO: NonZeroU64 = unsafe { NonZeroU64::new_unchecked(2) }; - if let FOO = FOO {} -} diff --git a/src/test/ui/run-pass/deriving/auxiliary/derive-no-std.rs b/src/test/ui/run-pass/deriving/auxiliary/derive-no-std.rs deleted file mode 100644 index f083e10bfdb..00000000000 --- a/src/test/ui/run-pass/deriving/auxiliary/derive-no-std.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![no_std] - -// Issue #16803 - -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, - Debug, Default, Copy)] -pub struct Foo { - pub x: u32, -} - -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, - Debug, Copy)] -pub enum Bar { - Qux, - Quux(u32), -} - -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, - Debug, Copy)] -pub enum Void {} -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, - Debug, Copy)] -pub struct Empty; -#[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, - Debug, Copy)] -pub struct AlsoEmpty {} - diff --git a/src/test/ui/run-pass/deriving/derive-no-std.rs b/src/test/ui/run-pass/deriving/derive-no-std.rs deleted file mode 100644 index 1122083eb80..00000000000 --- a/src/test/ui/run-pass/deriving/derive-no-std.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:derive-no-std.rs - -extern crate derive_no_std; -use derive_no_std::*; - -fn main() { - let f = Foo { x: 0 }; - assert_eq!(f.clone(), Foo::default()); - - assert!(Bar::Qux < Bar::Quux(42)); -} - diff --git a/src/test/ui/run-pass/deriving/derive-partialord-correctness.rs b/src/test/ui/run-pass/deriving/derive-partialord-correctness.rs deleted file mode 100644 index 4890b1bc76b..00000000000 --- a/src/test/ui/run-pass/deriving/derive-partialord-correctness.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Original issue: #49650 - -#[derive(PartialOrd, PartialEq)] -struct FloatWrapper(f64); - -fn main() { - assert!((0.0 / 0.0 >= 0.0) == (FloatWrapper(0.0 / 0.0) >= FloatWrapper(0.0))) -} diff --git a/src/test/ui/run-pass/deriving/deriving-associated-types.rs b/src/test/ui/run-pass/deriving/deriving-associated-types.rs deleted file mode 100644 index 46fb88e05c6..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-associated-types.rs +++ /dev/null @@ -1,209 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait DeclaredTrait { - type Type; -} - -impl DeclaredTrait for i32 { - type Type = i32; -} - -pub trait WhereTrait { - type Type; -} - -impl WhereTrait for i32 { - type Type = i32; -} - -// Make sure we don't add a bound that just shares a name with an associated -// type. -pub mod module { - pub type Type = i32; -} - -#[derive(PartialEq, Debug)] -struct PrivateStruct(T); - -#[derive(PartialEq, Debug)] -struct TupleStruct( - module::Type, - Option, - A, - PrivateStruct, - B, - B::Type, - Option, - ::Type, - Option<::Type>, - C, - C::Type, - Option, - ::Type, - Option<::Type>, - ::Type, -) where C: WhereTrait; - -#[derive(PartialEq, Debug)] -pub struct Struct where C: WhereTrait { - m1: module::Type, - m2: Option, - a1: A, - a2: PrivateStruct, - b: B, - b1: B::Type, - b2: Option, - b3: ::Type, - b4: Option<::Type>, - c: C, - c1: C::Type, - c2: Option, - c3: ::Type, - c4: Option<::Type>, - d: ::Type, -} - -#[derive(PartialEq, Debug)] -enum Enum where C: WhereTrait { - Unit, - Seq( - module::Type, - Option, - A, - PrivateStruct, - B, - B::Type, - Option, - ::Type, - Option<::Type>, - C, - C::Type, - Option, - ::Type, - Option<::Type>, - ::Type, - ), - Map { - m1: module::Type, - m2: Option, - a1: A, - a2: PrivateStruct, - b: B, - b1: B::Type, - b2: Option, - b3: ::Type, - b4: Option<::Type>, - c: C, - c1: C::Type, - c2: Option, - c3: ::Type, - c4: Option<::Type>, - d: ::Type, - }, -} - -fn main() { - let e: TupleStruct< - i32, - i32, - i32, - > = TupleStruct( - 0, - None, - 0, - PrivateStruct(0), - 0, - 0, - None, - 0, - None, - 0, - 0, - None, - 0, - None, - 0, - ); - assert_eq!(e, e); - - let e: Struct< - i32, - i32, - i32, - > = Struct { - m1: 0, - m2: None, - a1: 0, - a2: PrivateStruct(0), - b: 0, - b1: 0, - b2: None, - b3: 0, - b4: None, - c: 0, - c1: 0, - c2: None, - c3: 0, - c4: None, - d: 0, - }; - assert_eq!(e, e); - - let e = Enum::Unit::; - assert_eq!(e, e); - - let e: Enum< - i32, - i32, - i32, - > = Enum::Seq( - 0, - None, - 0, - PrivateStruct(0), - 0, - 0, - None, - 0, - None, - 0, - 0, - None, - 0, - None, - 0, - ); - assert_eq!(e, e); - - let e: Enum< - i32, - i32, - i32, - > = Enum::Map { - m1: 0, - m2: None, - a1: 0, - a2: PrivateStruct(0), - b: 0, - b1: 0, - b2: None, - b3: 0, - b4: None, - c: 0, - c1: 0, - c2: None, - c3: 0, - c4: None, - d: 0, - }; - assert_eq!(e, e); -} diff --git a/src/test/ui/run-pass/deriving/deriving-bounds.rs b/src/test/ui/run-pass/deriving/deriving-bounds.rs deleted file mode 100644 index 0e30de10e82..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-bounds.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Copy, Clone)] -struct Test; - -pub fn main() {} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-array.rs b/src/test/ui/run-pass/deriving/deriving-clone-array.rs deleted file mode 100644 index 2d3be810def..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-array.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// test for issue #30244 - -#[derive(Copy, Clone)] -struct Array { - arr: [[u8; 256]; 4] -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-enum.rs b/src/test/ui/run-pass/deriving/deriving-clone-enum.rs deleted file mode 100644 index cf924e0ff5e..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-enum.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -enum E { - A, - B(()), - C -} - -pub fn main() { - let _ = E::A.clone(); -} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-generic-enum.rs b/src/test/ui/run-pass/deriving/deriving-clone-generic-enum.rs deleted file mode 100644 index 2b1ace396a7..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-generic-enum.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -enum E { - A(T), - B(T,U), - C -} - -pub fn main() { - let _ = E::A::(1).clone(); -} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-generic-struct.rs b/src/test/ui/run-pass/deriving/deriving-clone-generic-struct.rs deleted file mode 100644 index dea50871a74..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-generic-struct.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -struct S { - foo: (), - bar: (), - baz: T, -} - -pub fn main() { - let _ = S { foo: (), bar: (), baz: 1 }.clone(); -} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-generic-tuple-struct.rs b/src/test/ui/run-pass/deriving/deriving-clone-generic-tuple-struct.rs deleted file mode 100644 index 01ef89f81c1..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-generic-tuple-struct.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -struct S(T, ()); - -pub fn main() { - let _ = S(1, ()).clone(); -} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-struct.rs b/src/test/ui/run-pass/deriving/deriving-clone-struct.rs deleted file mode 100644 index f82a41f8ba0..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-struct.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -struct S { - _int: isize, - _i8: i8, - _i16: i16, - _i32: i32, - _i64: i64, - - _uint: usize, - _u8: u8, - _u16: u16, - _u32: u32, - _u64: u64, - - _f32: f32, - _f64: f64, - - _bool: bool, - _char: char, - _nil: () -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/deriving/deriving-clone-tuple-struct.rs b/src/test/ui/run-pass/deriving/deriving-clone-tuple-struct.rs deleted file mode 100644 index 49c675de112..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-clone-tuple-struct.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -struct S((), ()); - -pub fn main() {} diff --git a/src/test/ui/run-pass/deriving/deriving-cmp-generic-enum.rs b/src/test/ui/run-pass/deriving/deriving-cmp-generic-enum.rs deleted file mode 100644 index 1a6582d9af2..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-cmp-generic-enum.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Eq, PartialOrd, Ord)] -enum E { - E0, - E1(T), - E2(T,T) -} - -pub fn main() { - let e0 = E::E0; - let e11 = E::E1(1); - let e12 = E::E1(2); - let e21 = E::E2(1, 1); - let e22 = E::E2(1, 2); - - // in order for both PartialOrd and Ord - let es = [e0, e11, e12, e21, e22]; - - for (i, e1) in es.iter().enumerate() { - for (j, e2) in es.iter().enumerate() { - let ord = i.cmp(&j); - - let eq = i == j; - let lt = i < j; - let le = i <= j; - let gt = i > j; - let ge = i >= j; - - // PartialEq - assert_eq!(*e1 == *e2, eq); - assert_eq!(*e1 != *e2, !eq); - - // PartialOrd - assert_eq!(*e1 < *e2, lt); - assert_eq!(*e1 > *e2, gt); - - assert_eq!(*e1 <= *e2, le); - assert_eq!(*e1 >= *e2, ge); - - // Ord - assert_eq!(e1.cmp(e2), ord); - } - } -} diff --git a/src/test/ui/run-pass/deriving/deriving-cmp-generic-struct-enum.rs b/src/test/ui/run-pass/deriving/deriving-cmp-generic-struct-enum.rs deleted file mode 100644 index 93bda7fbf25..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-cmp-generic-struct-enum.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Eq, PartialOrd, Ord)] -enum ES { - ES1 { x: T }, - ES2 { x: T, y: T } -} - - -pub fn main() { - let (es11, es12, es21, es22) = (ES::ES1 { - x: 1 - }, ES::ES1 { - x: 2 - }, ES::ES2 { - x: 1, - y: 1 - }, ES::ES2 { - x: 1, - y: 2 - }); - - // in order for both PartialOrd and Ord - let ess = [es11, es12, es21, es22]; - - for (i, es1) in ess.iter().enumerate() { - for (j, es2) in ess.iter().enumerate() { - let ord = i.cmp(&j); - - let eq = i == j; - let (lt, le) = (i < j, i <= j); - let (gt, ge) = (i > j, i >= j); - - // PartialEq - assert_eq!(*es1 == *es2, eq); - assert_eq!(*es1 != *es2, !eq); - - // PartialOrd - assert_eq!(*es1 < *es2, lt); - assert_eq!(*es1 > *es2, gt); - - assert_eq!(*es1 <= *es2, le); - assert_eq!(*es1 >= *es2, ge); - - // Ord - assert_eq!(es1.cmp(es2), ord); - } - } -} diff --git a/src/test/ui/run-pass/deriving/deriving-cmp-generic-struct.rs b/src/test/ui/run-pass/deriving/deriving-cmp-generic-struct.rs deleted file mode 100644 index f2e6fcd13fc..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-cmp-generic-struct.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Eq, PartialOrd, Ord)] -struct S { - x: T, - y: T -} - -pub fn main() { - let s1 = S {x: 1, y: 1}; - let s2 = S {x: 1, y: 2}; - - // in order for both PartialOrd and Ord - let ss = [s1, s2]; - - for (i, s1) in ss.iter().enumerate() { - for (j, s2) in ss.iter().enumerate() { - let ord = i.cmp(&j); - - let eq = i == j; - let lt = i < j; - let le = i <= j; - let gt = i > j; - let ge = i >= j; - - // PartialEq - assert_eq!(*s1 == *s2, eq); - assert_eq!(*s1 != *s2, !eq); - - // PartialOrd - assert_eq!(*s1 < *s2, lt); - assert_eq!(*s1 > *s2, gt); - - assert_eq!(*s1 <= *s2, le); - assert_eq!(*s1 >= *s2, ge); - - // Ord - assert_eq!(s1.cmp(s2), ord); - } - } -} diff --git a/src/test/ui/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs b/src/test/ui/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs deleted file mode 100644 index 04688ff352d..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-cmp-generic-tuple-struct.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Eq, PartialOrd, Ord)] -struct TS(T,T); - - -pub fn main() { - let ts1 = TS(1, 1); - let ts2 = TS(1, 2); - - // in order for both PartialOrd and Ord - let tss = [ts1, ts2]; - - for (i, ts1) in tss.iter().enumerate() { - for (j, ts2) in tss.iter().enumerate() { - let ord = i.cmp(&j); - - let eq = i == j; - let lt = i < j; - let le = i <= j; - let gt = i > j; - let ge = i >= j; - - // PartialEq - assert_eq!(*ts1 == *ts2, eq); - assert_eq!(*ts1 != *ts2, !eq); - - // PartialOrd - assert_eq!(*ts1 < *ts2, lt); - assert_eq!(*ts1 > *ts2, gt); - - assert_eq!(*ts1 <= *ts2, le); - assert_eq!(*ts1 >= *ts2, ge); - - // Ord - assert_eq!(ts1.cmp(ts2), ord); - } - } -} diff --git a/src/test/ui/run-pass/deriving/deriving-cmp-shortcircuit.rs b/src/test/ui/run-pass/deriving/deriving-cmp-shortcircuit.rs deleted file mode 100644 index e1f301922bd..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-cmp-shortcircuit.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that the derived impls for the comparison traits shortcircuit -// where possible, by having a type that panics when compared as the -// second element, so this passes iff the instances shortcircuit. - - -use std::cmp::Ordering; - -pub struct FailCmp; -impl PartialEq for FailCmp { - fn eq(&self, _: &FailCmp) -> bool { panic!("eq") } -} - -impl PartialOrd for FailCmp { - fn partial_cmp(&self, _: &FailCmp) -> Option { panic!("partial_cmp") } -} - -impl Eq for FailCmp {} - -impl Ord for FailCmp { - fn cmp(&self, _: &FailCmp) -> Ordering { panic!("cmp") } -} - -#[derive(PartialEq,PartialOrd,Eq,Ord)] -struct ShortCircuit { - x: isize, - y: FailCmp -} - -pub fn main() { - let a = ShortCircuit { x: 1, y: FailCmp }; - let b = ShortCircuit { x: 2, y: FailCmp }; - - assert!(a != b); - assert!(a < b); - assert_eq!(a.cmp(&b), ::std::cmp::Ordering::Less); -} diff --git a/src/test/ui/run-pass/deriving/deriving-copyclone.rs b/src/test/ui/run-pass/deriving/deriving-copyclone.rs deleted file mode 100644 index e9da90fe6ed..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-copyclone.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -//! Test that #[derive(Copy, Clone)] produces a shallow copy -//! even when a member violates RFC 1521 - -use std::sync::atomic::{AtomicBool, ATOMIC_BOOL_INIT, Ordering}; - -/// A struct that pretends to be Copy, but actually does something -/// in its Clone impl -#[derive(Copy)] -struct Liar; - -/// Static cooperating with the rogue Clone impl -static CLONED: AtomicBool = ATOMIC_BOOL_INIT; - -impl Clone for Liar { - fn clone(&self) -> Self { - // this makes Clone vs Copy observable - CLONED.store(true, Ordering::SeqCst); - - *self - } -} - -/// This struct is actually Copy... at least, it thinks it is! -#[derive(Copy, Clone)] -struct Innocent(Liar); - -impl Innocent { - fn new() -> Self { - Innocent(Liar) - } -} - -fn main() { - let _ = Innocent::new().clone(); - // if Innocent was byte-for-byte copied, CLONED will still be false - assert!(!CLONED.load(Ordering::SeqCst)); -} - diff --git a/src/test/ui/run-pass/deriving/deriving-default-box.rs b/src/test/ui/run-pass/deriving/deriving-default-box.rs deleted file mode 100644 index 55111a4231a..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-default-box.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::default::Default; - -#[derive(Default)] -struct A { - foo: Box<[bool]>, -} - -pub fn main() { - let a: A = Default::default(); - let b: Box<[_]> = Box::<[bool; 0]>::new([]); - assert_eq!(a.foo, b); -} diff --git a/src/test/ui/run-pass/deriving/deriving-enum-single-variant.rs b/src/test/ui/run-pass/deriving/deriving-enum-single-variant.rs deleted file mode 100644 index e304f481baa..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-enum-single-variant.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_camel_case_types)] - -pub type task_id = isize; - -#[derive(PartialEq)] -pub enum Task { - TaskHandle(task_id) -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/deriving/deriving-eq-ord-boxed-slice.rs b/src/test/ui/run-pass/deriving/deriving-eq-ord-boxed-slice.rs deleted file mode 100644 index 7997aa5a7ec..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-eq-ord-boxed-slice.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, PartialOrd, Eq, Ord, Debug)] -struct Foo(Box<[u8]>); - -pub fn main() { - let a = Foo(Box::new([0, 1, 2])); - let b = Foo(Box::new([0, 1, 2])); - assert_eq!(a, b); - println!("{}", a != b); - println!("{}", a < b); - println!("{}", a <= b); - println!("{}", a == b); - println!("{}", a > b); - println!("{}", a >= b); -} diff --git a/src/test/ui/run-pass/deriving/deriving-hash.rs b/src/test/ui/run-pass/deriving/deriving-hash.rs deleted file mode 100644 index aec8a7075a5..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-hash.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -#![allow(overflowing_literals)] - -use std::hash::{Hash, SipHasher, Hasher}; -use std::mem::size_of; - -#[derive(Hash)] -struct Person { - id: usize, - name: String, - phone: usize, -} - -// test for hygiene name collisions -#[derive(Hash)] struct __H__H; -#[derive(Hash)] enum Collision<__H> { __H { __H__H: __H } } - -#[derive(Hash)] -enum E { A=1, B } - -fn hash(t: &T) -> u64 { - let mut s = SipHasher::new_with_keys(0, 0); - t.hash(&mut s); - s.finish() -} - -struct FakeHasher<'a>(&'a mut Vec); -impl<'a> Hasher for FakeHasher<'a> { - fn finish(&self) -> u64 { - unimplemented!() - } - - fn write(&mut self, bytes: &[u8]) { - self.0.extend(bytes); - } -} - -fn fake_hash(v: &mut Vec, a: A) { - a.hash(&mut FakeHasher(v)); -} - -fn main() { - let person1 = Person { - id: 5, - name: "Janet".to_string(), - phone: 555_666_7777 - }; - let person2 = Person { - id: 5, - name: "Bob".to_string(), - phone: 555_666_7777 - }; - assert_eq!(hash(&person1), hash(&person1)); - assert!(hash(&person1) != hash(&person2)); - - // test #21714 - let mut va = vec![]; - let mut vb = vec![]; - fake_hash(&mut va, E::A); - fake_hash(&mut vb, E::B); - assert!(va != vb); - - // issue #39137: single variant enum hash should not hash discriminant - #[derive(Hash)] - enum SingleVariantEnum { - A(u8), - } - let mut v = vec![]; - fake_hash(&mut v, SingleVariantEnum::A(17)); - assert_eq!(vec![17], v); -} diff --git a/src/test/ui/run-pass/deriving/deriving-in-fn.rs b/src/test/ui/run-pass/deriving/deriving-in-fn.rs deleted file mode 100644 index 00100aa1be1..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-in-fn.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - #[derive(Debug)] - struct Foo { - foo: isize, - } - - let f = Foo { foo: 10 }; - format!("{:?}", f); -} diff --git a/src/test/ui/run-pass/deriving/deriving-in-macro.rs b/src/test/ui/run-pass/deriving/deriving-in-macro.rs deleted file mode 100644 index dc6fda84f1d..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-in-macro.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_camel_case_types)] - -macro_rules! define_vec { - () => ( - mod foo { - #[derive(PartialEq)] - pub struct bar; - } - ) -} - -define_vec![]; - -pub fn main() {} diff --git a/src/test/ui/run-pass/deriving/deriving-meta-multiple.rs b/src/test/ui/run-pass/deriving/deriving-meta-multiple.rs deleted file mode 100644 index 33f98a74b14..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-meta-multiple.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(deprecated)] - -use std::hash::{Hash, SipHasher}; - -// testing multiple separate deriving attributes -#[derive(PartialEq)] -#[derive(Clone)] -#[derive(Hash)] -struct Foo { - bar: usize, - baz: isize -} - -fn hash(_t: &T) {} - -pub fn main() { - let a = Foo {bar: 4, baz: -3}; - - a == a; // check for PartialEq impl w/o testing its correctness - a.clone(); // check for Clone impl w/o testing its correctness - hash(&a); // check for Hash impl w/o testing its correctness -} diff --git a/src/test/ui/run-pass/deriving/deriving-meta.rs b/src/test/ui/run-pass/deriving/deriving-meta.rs deleted file mode 100644 index 309cd5aed1d..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-meta.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(deprecated)] - -use std::hash::{Hash, SipHasher}; - -#[derive(PartialEq, Clone, Hash)] -struct Foo { - bar: usize, - baz: isize -} - -fn hash(_t: &T) {} - -pub fn main() { - let a = Foo {bar: 4, baz: -3}; - - a == a; // check for PartialEq impl w/o testing its correctness - a.clone(); // check for Clone impl w/o testing its correctness - hash(&a); // check for Hash impl w/o testing its correctness -} diff --git a/src/test/ui/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs b/src/test/ui/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs deleted file mode 100644 index 64ef03adcaf..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-self-lifetime-totalord-totaleq.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cmp::Ordering::{Less,Equal,Greater}; - -#[derive(PartialEq, Eq, PartialOrd, Ord)] -struct A<'a> { - x: &'a isize -} -pub fn main() { - let (a, b) = (A { x: &1 }, A { x: &2 }); - - assert_eq!(a.cmp(&a), Equal); - assert_eq!(b.cmp(&b), Equal); - - assert_eq!(a.cmp(&b), Less); - assert_eq!(b.cmp(&a), Greater); -} diff --git a/src/test/ui/run-pass/deriving/deriving-show-2.rs b/src/test/ui/run-pass/deriving/deriving-show-2.rs deleted file mode 100644 index 3a1f40239c8..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-show-2.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt; - -#[derive(Debug)] -enum A {} -#[derive(Debug)] -enum B { B1, B2, B3 } -#[derive(Debug)] -enum C { C1(isize), C2(B), C3(String) } -#[derive(Debug)] -enum D { D1{ a: isize } } -#[derive(Debug)] -struct E; -#[derive(Debug)] -struct F(isize); -#[derive(Debug)] -struct G(isize, isize); -#[derive(Debug)] -struct H { a: isize } -#[derive(Debug)] -struct I { a: isize, b: isize } -#[derive(Debug)] -struct J(Custom); - -struct Custom; -impl fmt::Debug for Custom { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "yay") - } -} - -trait ToDebug { - fn to_show(&self) -> String; -} - -impl ToDebug for T { - fn to_show(&self) -> String { - format!("{:?}", self) - } -} - -pub fn main() { - assert_eq!(B::B1.to_show(), "B1".to_string()); - assert_eq!(B::B2.to_show(), "B2".to_string()); - assert_eq!(C::C1(3).to_show(), "C1(3)".to_string()); - assert_eq!(C::C2(B::B2).to_show(), "C2(B2)".to_string()); - assert_eq!(D::D1{ a: 2 }.to_show(), "D1 { a: 2 }".to_string()); - assert_eq!(E.to_show(), "E".to_string()); - assert_eq!(F(3).to_show(), "F(3)".to_string()); - assert_eq!(G(3, 4).to_show(), "G(3, 4)".to_string()); - assert_eq!(I{ a: 2, b: 4 }.to_show(), "I { a: 2, b: 4 }".to_string()); - assert_eq!(J(Custom).to_show(), "J(yay)".to_string()); -} diff --git a/src/test/ui/run-pass/deriving/deriving-show.rs b/src/test/ui/run-pass/deriving/deriving-show.rs deleted file mode 100644 index f19b014067d..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-show.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct Unit; - -#[derive(Debug)] -struct Tuple(isize, usize); - -#[derive(Debug)] -struct Struct { x: isize, y: usize } - -#[derive(Debug)] -enum Enum { - Nullary, - Variant(isize, usize), - StructVariant { x: isize, y : usize } -} - -#[derive(Debug)] -struct Pointers(*const Send, *mut Sync); - -macro_rules! t { - ($x:expr, $expected:expr) => { - assert_eq!(format!("{:?}", $x), $expected.to_string()) - } -} - -pub fn main() { - t!(Unit, "Unit"); - t!(Tuple(1, 2), "Tuple(1, 2)"); - t!(Struct { x: 1, y: 2 }, "Struct { x: 1, y: 2 }"); - t!(Enum::Nullary, "Nullary"); - t!(Enum::Variant(1, 2), "Variant(1, 2)"); - t!(Enum::StructVariant { x: 1, y: 2 }, "StructVariant { x: 1, y: 2 }"); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-c-enum.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-c-enum.rs deleted file mode 100644 index 445545aaa0f..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-c-enum.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -enum Foo { - Bar, - Baz, - Boo -} - -pub fn main() { - let a = Foo::Bar; - let b = Foo::Bar; - assert_eq!(a, b); - assert!(!(a != b)); - assert!(a.eq(&b)); - assert!(!a.ne(&b)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-enum.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-enum.rs deleted file mode 100644 index 5b00f11a901..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-enum.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -enum Foo { - Bar(isize, isize), - Baz(f64, f64) -} - -pub fn main() { - let a = Foo::Bar(1, 2); - let b = Foo::Bar(1, 2); - assert_eq!(a, b); - assert!(!(a != b)); - assert!(a.eq(&b)); - assert!(!a.ne(&b)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-hash-enum.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-hash-enum.rs deleted file mode 100644 index fe2716396d8..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-hash-enum.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Hash)] -enum Foo { - Bar(isize, char), - Baz(char, isize) -} - -#[derive(Hash)] -enum A { - B, - C, - D, - E -} - -pub fn main(){} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-hash-struct.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-hash-struct.rs deleted file mode 100644 index 2178673cac8..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-hash-struct.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Hash)] -struct Foo { - x: isize, - y: isize, - z: isize -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-struct-empty.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-struct-empty.rs deleted file mode 100644 index 7753700db18..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-struct-empty.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Foo; - -pub fn main() { - assert_eq!(Foo, Foo); - assert!(!(Foo != Foo)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs deleted file mode 100644 index 67a1472e883..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -enum S { - X { x: isize, y: isize }, - Y -} - -pub fn main() { - let x = S::X { x: 1, y: 2 }; - assert_eq!(x, x); - assert!(!(x != x)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-struct-tuple.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-struct-tuple.rs deleted file mode 100644 index dd9d9b7707e..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-struct-tuple.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Foo(isize, isize, String); - -pub fn main() { - let a1 = Foo(5, 6, "abc".to_string()); - let a2 = Foo(5, 6, "abc".to_string()); - let b = Foo(5, 7, "def".to_string()); - - assert_eq!(a1, a1); - assert_eq!(a2, a1); - assert!(!(a1 == b)); - - assert!(a1 != b); - assert!(!(a1 != a1)); - assert!(!(a2 != a1)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-struct.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-struct.rs deleted file mode 100644 index 69bca7ce36d..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-struct.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Foo { - x: isize, - y: isize, - z: isize, -} - -pub fn main() { - let a = Foo { x: 1, y: 2, z: 3 }; - let b = Foo { x: 1, y: 2, z: 3 }; - assert_eq!(a, b); - assert!(!(a != b)); - assert!(a.eq(&b)); - assert!(!a.ne(&b)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-via-extension-type-params.rs b/src/test/ui/run-pass/deriving/deriving-via-extension-type-params.rs deleted file mode 100644 index 63d2b58804b..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-via-extension-type-params.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Hash, Debug)] -struct Foo { - x: isize, - y: T, - z: isize -} - -pub fn main() { - let a = Foo { x: 1, y: 2.0f64, z: 3 }; - let b = Foo { x: 1, y: 2.0f64, z: 3 }; - assert_eq!(a, b); - assert!(!(a != b)); - assert!(a.eq(&b)); - assert!(!a.ne(&b)); -} diff --git a/src/test/ui/run-pass/deriving/deriving-with-repr-packed.rs b/src/test/ui/run-pass/deriving/deriving-with-repr-packed.rs deleted file mode 100644 index fd84d6da29e..00000000000 --- a/src/test/ui/run-pass/deriving/deriving-with-repr-packed.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that derive on a packed struct does not call field -// methods with a misaligned field. - -use std::mem; - -#[derive(Copy, Clone)] -struct Aligned(usize); - -#[inline(never)] -fn check_align(ptr: *const Aligned) { - assert_eq!(ptr as usize % mem::align_of::(), - 0); -} - -impl PartialEq for Aligned { - fn eq(&self, other: &Self) -> bool { - check_align(self); - check_align(other); - self.0 == other.0 - } -} - -#[repr(packed)] -#[derive(Copy, Clone, PartialEq)] -struct Packed(Aligned, Aligned); - -#[derive(PartialEq)] -#[repr(C)] -struct Dealigned(u8, T); - -fn main() { - let d1 = Dealigned(0, Packed(Aligned(1), Aligned(2))); - let ck = d1 == d1; - assert!(ck); -} diff --git a/src/test/ui/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs b/src/test/ui/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs deleted file mode 100644 index d8912943441..00000000000 --- a/src/test/ui/run-pass/drop/auxiliary/dropck_eyepatch_extern_crate.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(dropck_eyepatch)] - -// The point of this test is to illustrate that the `#[may_dangle]` -// attribute specifically allows, in the context of a type -// implementing `Drop`, a generic parameter to be instantiated with a -// lifetime that does not strictly outlive the owning type itself, -// and that this attributes effects are preserved when importing -// the type from another crate. -// -// See also dropck-eyepatch.rs for more information about the general -// structure of the test. - -use std::cell::RefCell; - -pub trait Foo { fn foo(&self, _: &str); } - -pub struct Dt(pub &'static str, pub A); -pub struct Dr<'a, B:'a+Foo>(pub &'static str, pub &'a B); -pub struct Pt(pub &'static str, pub A, pub B); -pub struct Pr<'a, 'b, B:'a+'b+Foo>(pub &'static str, pub &'a B, pub &'b B); -pub struct St(pub &'static str, pub A); -pub struct Sr<'a, B:'a+Foo>(pub &'static str, pub &'a B); - -impl Drop for Dt { - fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } -} -impl<'a, B: Foo> Drop for Dr<'a, B> { - fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } -} -unsafe impl<#[may_dangle] A, B: Foo> Drop for Pt { - // (unsafe to access self.1 due to #[may_dangle] on A) - fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } -} -unsafe impl<#[may_dangle] 'a, 'b, B: Foo> Drop for Pr<'a, 'b, B> { - // (unsafe to access self.1 due to #[may_dangle] on 'a) - fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } -} - -impl Foo for RefCell { - fn foo(&self, s: &str) { - let s2 = format!("{}|{}", *self.borrow(), s); - *self.borrow_mut() = s2; - } -} - -impl<'a, T:Foo> Foo for &'a T { - fn foo(&self, s: &str) { - (*self).foo(s); - } -} diff --git a/src/test/ui/run-pass/drop/drop-on-empty-block-exit.rs b/src/test/ui/run-pass/drop/drop-on-empty-block-exit.rs deleted file mode 100644 index 9ddf399ed7a..00000000000 --- a/src/test/ui/run-pass/drop/drop-on-empty-block-exit.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_camel_case_types)] - -#![feature(box_syntax)] - -enum t { foo(Box), } - -pub fn main() { - let tt = t::foo(box 10); - match tt { t::foo(_z) => { } } -} diff --git a/src/test/ui/run-pass/drop/drop-on-ret.rs b/src/test/ui/run-pass/drop/drop-on-ret.rs deleted file mode 100644 index e56119df20e..00000000000 --- a/src/test/ui/run-pass/drop/drop-on-ret.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -// pretty-expanded FIXME #23616 - -fn f() -> isize { - if true { - let _s: String = "should not leak".to_string(); - return 1; - } - return 0; -} - -pub fn main() { f(); } diff --git a/src/test/ui/run-pass/drop/drop-struct-as-object.rs b/src/test/ui/run-pass/drop/drop-struct-as-object.rs deleted file mode 100644 index 97ec423643c..00000000000 --- a/src/test/ui/run-pass/drop/drop-struct-as-object.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Test that destructor on a struct runs successfully after the struct -// is boxed and converted to an object. - -#![feature(box_syntax)] - -static mut value: usize = 0; - -struct Cat { - name : usize, -} - -trait Dummy { - fn get(&self) -> usize; -} - -impl Dummy for Cat { - fn get(&self) -> usize { self.name } -} - -impl Drop for Cat { - fn drop(&mut self) { - unsafe { value = self.name; } - } -} - -pub fn main() { - { - let x = box Cat {name: 22}; - let nyan: Box = x as Box; - } - unsafe { - assert_eq!(value, 22); - } -} diff --git a/src/test/ui/run-pass/drop/drop-trait-enum.rs b/src/test/ui/run-pass/drop/drop-trait-enum.rs deleted file mode 100644 index 4d3cf2bd053..00000000000 --- a/src/test/ui/run-pass/drop/drop-trait-enum.rs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(box_syntax)] - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -#[derive(PartialEq, Debug)] -enum Message { - Dropped, - DestructorRan -} - -struct SendOnDrop { - sender: Sender -} - -impl Drop for SendOnDrop { - fn drop(&mut self) { - self.sender.send(Message::Dropped).unwrap(); - } -} - -enum Foo { - SimpleVariant(Sender), - NestedVariant(Box, SendOnDrop, Sender), - FailingVariant { on_drop: SendOnDrop } -} - -impl Drop for Foo { - fn drop(&mut self) { - match self { - &mut Foo::SimpleVariant(ref mut sender) => { - sender.send(Message::DestructorRan).unwrap(); - } - &mut Foo::NestedVariant(_, _, ref mut sender) => { - sender.send(Message::DestructorRan).unwrap(); - } - &mut Foo::FailingVariant { .. } => { - panic!("Failed"); - } - } - } -} - -pub fn main() { - let (sender, receiver) = channel(); - { - let v = Foo::SimpleVariant(sender); - } - assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); - assert_eq!(receiver.recv().ok(), None); - - let (sender, receiver) = channel(); - { - let v = Foo::NestedVariant(box 42, SendOnDrop { sender: sender.clone() }, sender); - } - assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); - assert_eq!(receiver.recv().unwrap(), Message::Dropped); - assert_eq!(receiver.recv().ok(), None); - - let (sender, receiver) = channel(); - let t = thread::spawn(move|| { - let v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; - }); - assert_eq!(receiver.recv().unwrap(), Message::Dropped); - assert_eq!(receiver.recv().ok(), None); - drop(t.join()); - - let (sender, receiver) = channel(); - let t = { - thread::spawn(move|| { - let mut v = Foo::NestedVariant(box 42, SendOnDrop { - sender: sender.clone() - }, sender.clone()); - v = Foo::NestedVariant(box 42, - SendOnDrop { sender: sender.clone() }, - sender.clone()); - v = Foo::SimpleVariant(sender.clone()); - v = Foo::FailingVariant { on_drop: SendOnDrop { sender: sender } }; - }) - }; - assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); - assert_eq!(receiver.recv().unwrap(), Message::Dropped); - assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); - assert_eq!(receiver.recv().unwrap(), Message::Dropped); - assert_eq!(receiver.recv().unwrap(), Message::DestructorRan); - assert_eq!(receiver.recv().unwrap(), Message::Dropped); - assert_eq!(receiver.recv().ok(), None); - drop(t.join()); -} diff --git a/src/test/ui/run-pass/drop/drop-trait-generic.rs b/src/test/ui/run-pass/drop/drop-trait-generic.rs deleted file mode 100644 index c09482a4540..00000000000 --- a/src/test/ui/run-pass/drop/drop-trait-generic.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S { - x: T -} - -impl ::std::ops::Drop for S { - fn drop(&mut self) { - println!("bye"); - } -} - -pub fn main() { - let _x = S { x: 1 }; -} diff --git a/src/test/ui/run-pass/drop/drop-trait.rs b/src/test/ui/run-pass/drop/drop-trait.rs deleted file mode 100644 index 2e867ac0fc0..00000000000 --- a/src/test/ui/run-pass/drop/drop-trait.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - x: isize -} - -impl Drop for Foo { - fn drop(&mut self) { - println!("bye"); - } -} - -pub fn main() { - let _x: Foo = Foo { x: 3 }; -} diff --git a/src/test/ui/run-pass/drop/drop-uninhabited-enum.rs b/src/test/ui/run-pass/drop/drop-uninhabited-enum.rs deleted file mode 100644 index 6fb0abd9643..00000000000 --- a/src/test/ui/run-pass/drop/drop-uninhabited-enum.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Foo { } - -impl Drop for Foo { - fn drop(&mut self) { } -} - -fn foo(x: Foo) { } - -fn main() { } diff --git a/src/test/ui/run-pass/drop/drop-with-type-ascription-1.rs b/src/test/ui/run-pass/drop/drop-with-type-ascription-1.rs deleted file mode 100644 index 2983508363b..00000000000 --- a/src/test/ui/run-pass/drop/drop-with-type-ascription-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let foo = "hello".to_string(); - let foo: Vec<&str> = foo.split_whitespace().collect(); - let invalid_string = &foo[0]; - assert_eq!(*invalid_string, "hello"); -} diff --git a/src/test/ui/run-pass/drop/drop-with-type-ascription-2.rs b/src/test/ui/run-pass/drop/drop-with-type-ascription-2.rs deleted file mode 100644 index a2ac470ff11..00000000000 --- a/src/test/ui/run-pass/drop/drop-with-type-ascription-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let args = vec!["foobie", "asdf::asdf"]; - let arr: Vec<&str> = args[1].split("::").collect(); - assert_eq!(arr[0], "asdf"); - assert_eq!(arr[0], "asdf"); -} diff --git a/src/test/ui/run-pass/drop/dropck-eyepatch-extern-crate.rs b/src/test/ui/run-pass/drop/dropck-eyepatch-extern-crate.rs deleted file mode 100644 index 42d54b7be37..00000000000 --- a/src/test/ui/run-pass/drop/dropck-eyepatch-extern-crate.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:dropck_eyepatch_extern_crate.rs - -extern crate dropck_eyepatch_extern_crate as other; - -use other::{Dt,Dr,Pt,Pr,St,Sr}; - -fn main() { - use std::cell::RefCell; - - struct CheckOnDrop(RefCell, &'static str); - impl Drop for CheckOnDrop { - fn drop(&mut self) { assert_eq!(*self.0.borrow(), self.1); } - } - - let c_long; - let (c, dt, dr, pt, pr, st, sr) - : (CheckOnDrop, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>); - c_long = CheckOnDrop(RefCell::new("c_long".to_string()), - "c_long|pr|pt|dr|dt"); - c = CheckOnDrop(RefCell::new("c".to_string()), - "c"); - - // No error: sufficiently long-lived state can be referenced in dtors - dt = Dt("dt", &c_long.0); - dr = Dr("dr", &c_long.0); - - // No error: Drop impl asserts .1 (A and &'a _) are not accessed - pt = Pt("pt", &c.0, &c_long.0); - pr = Pr("pr", &c.0, &c_long.0); - - // No error: St and Sr have no destructor. - st = St("st", &c.0); - sr = Sr("sr", &c.0); - - println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); - assert_eq!(*c_long.0.borrow(), "c_long"); - assert_eq!(*c.0.borrow(), "c"); -} diff --git a/src/test/ui/run-pass/drop/dropck-eyepatch-reorder.rs b/src/test/ui/run-pass/drop/dropck-eyepatch-reorder.rs deleted file mode 100644 index 6696044a02d..00000000000 --- a/src/test/ui/run-pass/drop/dropck-eyepatch-reorder.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(dropck_eyepatch)] - -// The point of this test is to test uses of `#[may_dangle]` attribute -// where the formal declaration order (in the impl generics) does not -// match the actual usage order (in the type instantiation). -// -// See also dropck-eyepatch.rs for more information about the general -// structure of the test. - -trait Foo { fn foo(&self, _: &str); } - -struct Dt(&'static str, A); -struct Dr<'a, B:'a+Foo>(&'static str, &'a B); -struct Pt(&'static str, A, B); -struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, &'a B, &'b B); -struct St(&'static str, A); -struct Sr<'a, B:'a+Foo>(&'static str, &'a B); - -impl Drop for Dt { - fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } -} -impl<'a, B: Foo> Drop for Dr<'a, B> { - fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } -} -unsafe impl Drop for Pt { - // (unsafe to access self.1 due to #[may_dangle] on A) - fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } -} -unsafe impl<'b, #[may_dangle] 'a, B: Foo> Drop for Pr<'a, 'b, B> { - // (unsafe to access self.1 due to #[may_dangle] on 'a) - fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } -} - -fn main() { - use std::cell::RefCell; - - impl Foo for RefCell { - fn foo(&self, s: &str) { - let s2 = format!("{}|{}", *self.borrow(), s); - *self.borrow_mut() = s2; - } - } - - impl<'a, T:Foo> Foo for &'a T { - fn foo(&self, s: &str) { - (*self).foo(s); - } - } - - struct CheckOnDrop(RefCell, &'static str); - impl Drop for CheckOnDrop { - fn drop(&mut self) { assert_eq!(*self.0.borrow(), self.1); } - } - - let c_long; - let (c, dt, dr, pt, pr, st, sr) - : (CheckOnDrop, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>); - c_long = CheckOnDrop(RefCell::new("c_long".to_string()), - "c_long|pr|pt|dr|dt"); - c = CheckOnDrop(RefCell::new("c".to_string()), - "c"); - - // No error: sufficiently long-lived state can be referenced in dtors - dt = Dt("dt", &c_long.0); - dr = Dr("dr", &c_long.0); - - // No error: Drop impl asserts .1 (A and &'a _) are not accessed - pt = Pt("pt", &c.0, &c_long.0); - pr = Pr("pr", &c.0, &c_long.0); - - // No error: St and Sr have no destructor. - st = St("st", &c.0); - sr = Sr("sr", &c.0); - - println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); - assert_eq!(*c_long.0.borrow(), "c_long"); - assert_eq!(*c.0.borrow(), "c"); -} diff --git a/src/test/ui/run-pass/drop/dropck-eyepatch.rs b/src/test/ui/run-pass/drop/dropck-eyepatch.rs deleted file mode 100644 index fb9af09a7ce..00000000000 --- a/src/test/ui/run-pass/drop/dropck-eyepatch.rs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(dropck_eyepatch)] - -// The point of this test is to illustrate that the `#[may_dangle]` -// attribute specifically allows, in the context of a type -// implementing `Drop`, a generic parameter to be instantiated with a -// lifetime that does not strictly outlive the owning type itself. -// -// Here we test that a model use of `#[may_dangle]` will compile and run. -// -// The illustration is made concrete by comparison with two variations -// on the type with `#[may_dangle]`: -// -// 1. an analogous type that does not implement `Drop` (and thus -// should exhibit maximal flexibility with respect to dropck), and -// -// 2. an analogous type that does not use `#[may_dangle]` (and thus -// should exhibit the standard limitations imposed by dropck. -// -// The types in this file follow a pattern, {D,P,S}{t,r}, where: -// -// - D means "I implement Drop" -// -// - P means "I implement Drop but guarantee my (first) parameter is -// pure, i.e. not accessed from the destructor"; no other parameters -// are pure. -// -// - S means "I do not implement Drop" -// -// - t suffix is used when the first generic is a type -// -// - r suffix is used when the first generic is a lifetime. - -trait Foo { fn foo(&self, _: &str); } - -struct Dt(&'static str, A); -struct Dr<'a, B:'a+Foo>(&'static str, &'a B); -struct Pt(&'static str, A, B); -struct Pr<'a, 'b, B:'a+'b+Foo>(&'static str, &'a B, &'b B); -struct St(&'static str, A); -struct Sr<'a, B:'a+Foo>(&'static str, &'a B); - -impl Drop for Dt { - fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } -} -impl<'a, B: Foo> Drop for Dr<'a, B> { - fn drop(&mut self) { println!("drop {}", self.0); self.1.foo(self.0); } -} -unsafe impl<#[may_dangle] A, B: Foo> Drop for Pt { - // (unsafe to access self.1 due to #[may_dangle] on A) - fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } -} -unsafe impl<#[may_dangle] 'a, 'b, B: Foo> Drop for Pr<'a, 'b, B> { - // (unsafe to access self.1 due to #[may_dangle] on 'a) - fn drop(&mut self) { println!("drop {}", self.0); self.2.foo(self.0); } -} - -fn main() { - use std::cell::RefCell; - - impl Foo for RefCell { - fn foo(&self, s: &str) { - let s2 = format!("{}|{}", *self.borrow(), s); - *self.borrow_mut() = s2; - } - } - - impl<'a, T:Foo> Foo for &'a T { - fn foo(&self, s: &str) { - (*self).foo(s); - } - } - - struct CheckOnDrop(RefCell, &'static str); - impl Drop for CheckOnDrop { - fn drop(&mut self) { assert_eq!(*self.0.borrow(), self.1); } - } - - let c_long; - let (c, dt, dr, pt, pr, st, sr) - : (CheckOnDrop, Dt<_>, Dr<_>, Pt<_, _>, Pr<_>, St<_>, Sr<_>); - c_long = CheckOnDrop(RefCell::new("c_long".to_string()), - "c_long|pr|pt|dr|dt"); - c = CheckOnDrop(RefCell::new("c".to_string()), - "c"); - - // No error: sufficiently long-lived state can be referenced in dtors - dt = Dt("dt", &c_long.0); - dr = Dr("dr", &c_long.0); - - // No error: Drop impl asserts .1 (A and &'a _) are not accessed - pt = Pt("pt", &c.0, &c_long.0); - pr = Pr("pr", &c.0, &c_long.0); - - // No error: St and Sr have no destructor. - st = St("st", &c.0); - sr = Sr("sr", &c.0); - - println!("{:?}", (dt.0, dr.0, pt.0, pr.0, st.0, sr.0)); - assert_eq!(*c_long.0.borrow(), "c_long"); - assert_eq!(*c.0.borrow(), "c"); -} diff --git a/src/test/ui/run-pass/drop/dropck_legal_cycles.rs b/src/test/ui/run-pass/drop/dropck_legal_cycles.rs deleted file mode 100644 index 2c88cfd5c8f..00000000000 --- a/src/test/ui/run-pass/drop/dropck_legal_cycles.rs +++ /dev/null @@ -1,1193 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test exercises cases where cyclic structure is legal, -// including when the cycles go through data-structures such -// as `Vec` or `TypedArena`. -// -// The intent is to cover as many such cases as possible, ensuring -// that if the compiler did not complain circa Rust 1.x (1.2 as of -// this writing), then it will continue to not complain in the future. -// -// Note that while some of the tests are only exercising using the -// given collection as a "backing store" for a set of nodes that hold -// the actual cycle (and thus the cycle does not go through the -// collection itself in such cases), in general we *do* want to make -// sure to have at least one example exercising a cycle that goes -// through the collection, for every collection type that supports -// this. - -// HIGH LEVEL DESCRIPTION OF THE TEST ARCHITECTURE -// ----------------------------------------------- -// -// We pick a data structure and want to make a cyclic construction -// from it. Each test of interest is labelled starting with "Cycle N: -// { ... }" where N is the test number and the "..."`is filled in with -// a graphviz-style description of the graph structure that the -// author believes is being made. So "{ a -> b, b -> (c,d), (c,d) -> e }" -// describes a line connected to a diamond: -// -// c -// / \ -// a - b e -// \ / -// d -// -// (Note that the above directed graph is actually acyclic.) -// -// The different graph structures are often composed of different data -// types. Some may be built atop `Vec`, others atop `HashMap`, etc. -// -// For each graph structure, we actually *confirm* that a cycle exists -// (as a safe-guard against a test author accidentally leaving it out) -// by traversing each graph and "proving" that a cycle exists within it. -// -// To do this, while trying to keep the code uniform (despite working -// with different underlying collection and smart-pointer types), we -// have a standard traversal API: -// -// 1. every node in the graph carries a `mark` (a u32, init'ed to 0). -// -// 2. every node provides a method to visit its children -// -// 3. a traversal attmepts to visit the nodes of the graph and prove that -// it sees the same node twice. It does this by setting the mark of each -// node to a fresh non-zero value, and if it sees the current mark, it -// "knows" that it must have found a cycle, and stops attempting further -// traversal. -// -// 4. each traversal is controlled by a bit-string that tells it which child -// it visit when it can take different paths. As a simple example, -// in a binary tree, 0 could mean "left" (and 1, "right"), so that -// "00010" means "left, left, left, right, left". (In general it will -// read as many bits as it needs to choose one child.) -// -// The graphs in this test are all meant to be very small, and thus -// short bitstrings of less than 64 bits should always suffice. -// -// (An earlier version of this test infrastructure simply had any -// given traversal visit all children it encountered, in a -// depth-first manner; one problem with this approach is that an -// acyclic graph can still have sharing, which would then be treated -// as a repeat mark and reported as a detected cycle.) -// -// The travseral code is a little more complicated because it has been -// programmed in a somewhat defensive manner. For example it also has -// a max threshold for the number of nodes it will visit, to guard -// against scenarios where the nodes are not correctly setting their -// mark when asked. There are various other methods not discussed here -// that are for aiding debugging the test when it runs, such as the -// `name` method that all nodes provide. -// -// So each test: -// -// 1. allocates the nodes in the graph, -// -// 2. sets up the links in the graph, -// -// 3. clones the "ContextData" -// -// 4. chooses a new current mark value for this test -// -// 5. initiates a traversal, potentially from multiple starting points -// (aka "roots"), with a given control-string (potentially a -// different string for each root). if it does start from a -// distinct root, then such a test should also increment the -// current mark value, so that this traversal is considered -// distinct from the prior one on this graph structure. -// -// Note that most of the tests work with the default control string -// of all-zeroes. -// -// 6. assert that the context confirms that it actually saw a cycle (since a traversal -// might have terminated, e.g. on a tree structure that contained no cycles). - -use std::cell::{Cell, RefCell}; -use std::cmp::Ordering; -use std::collections::BinaryHeap; -use std::collections::HashMap; -use std::collections::LinkedList; -use std::collections::VecDeque; -use std::collections::btree_map::BTreeMap; -use std::collections::btree_set::BTreeSet; -use std::hash::{Hash, Hasher}; -use std::rc::Rc; -use std::sync::{Arc, RwLock, Mutex}; - -const PRINT: bool = false; - -pub fn main() { - let c_orig = ContextData { - curr_depth: 0, - max_depth: 3, - visited: 0, - max_visits: 1000, - skipped: 0, - curr_mark: 0, - saw_prev_marked: false, - control_bits: 0, - }; - - // SANITY CHECK FOR TEST SUITE (thus unnumbered) - // Not a cycle: { v[0] -> (v[1], v[2]), v[1] -> v[3], v[2] -> v[3] }; - let v: Vec = vec![Named::new("s0"), - Named::new("s1"), - Named::new("s2"), - Named::new("s3")]; - v[0].next.set((Some(&v[1]), Some(&v[2]))); - v[1].next.set((Some(&v[3]), None)); - v[2].next.set((Some(&v[3]), None)); - v[3].next.set((None, None)); - - let mut c = c_orig.clone(); - c.curr_mark = 10; - assert!(!c.saw_prev_marked); - v[0].descend_into_self(&mut c); - assert!(!c.saw_prev_marked); // <-- different from below, b/c acyclic above - - if PRINT { println!(""); } - - // Cycle 1: { v[0] -> v[1], v[1] -> v[0] }; - // does not exercise `v` itself - let v: Vec = vec![Named::new("s0"), - Named::new("s1")]; - v[0].next.set(Some(&v[1])); - v[1].next.set(Some(&v[0])); - - let mut c = c_orig.clone(); - c.curr_mark = 10; - assert!(!c.saw_prev_marked); - v[0].descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 2: { v[0] -> v, v[1] -> v } - let v: V = Named::new("v"); - v.contents[0].set(Some(&v)); - v.contents[1].set(Some(&v)); - - let mut c = c_orig.clone(); - c.curr_mark = 20; - assert!(!c.saw_prev_marked); - v.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 3: { hk0 -> hv0, hv0 -> hk0, hk1 -> hv1, hv1 -> hk1 }; - // does not exercise `h` itself - - let mut h: HashMap = HashMap::new(); - h.insert(Named::new("hk0"), Named::new("hv0")); - h.insert(Named::new("hk1"), Named::new("hv1")); - for (key, val) in h.iter() { - val.next.set(Some(key)); - key.next.set(Some(val)); - } - - let mut c = c_orig.clone(); - c.curr_mark = 30; - for (key, _) in h.iter() { - c.curr_mark += 1; - c.saw_prev_marked = false; - key.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - } - - if PRINT { println!(""); } - - // Cycle 4: { h -> (hmk0,hmv0,hmk1,hmv1), {hmk0,hmv0,hmk1,hmv1} -> h } - - let mut h: HashMap = HashMap::new(); - h.insert(Named::new("hmk0"), Named::new("hmv0")); - h.insert(Named::new("hmk0"), Named::new("hmv0")); - for (key, val) in h.iter() { - val.contents.set(Some(&h)); - key.contents.set(Some(&h)); - } - - let mut c = c_orig.clone(); - c.max_depth = 2; - c.curr_mark = 40; - for (key, _) in h.iter() { - c.curr_mark += 1; - c.saw_prev_marked = false; - key.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - // break; - } - - if PRINT { println!(""); } - - // Cycle 5: { vd[0] -> vd[1], vd[1] -> vd[0] }; - // does not exercise vd itself - let mut vd: VecDeque = VecDeque::new(); - vd.push_back(Named::new("d0")); - vd.push_back(Named::new("d1")); - vd[0].next.set(Some(&vd[1])); - vd[1].next.set(Some(&vd[0])); - - let mut c = c_orig.clone(); - c.curr_mark = 50; - assert!(!c.saw_prev_marked); - vd[0].descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 6: { vd -> (vd0, vd1), {vd0, vd1} -> vd } - let mut vd: VecDeque = VecDeque::new(); - vd.push_back(Named::new("vd0")); - vd.push_back(Named::new("vd1")); - vd[0].contents.set(Some(&vd)); - vd[1].contents.set(Some(&vd)); - - let mut c = c_orig.clone(); - c.curr_mark = 60; - assert!(!c.saw_prev_marked); - vd[0].descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 7: { vm -> (vm0, vm1), {vm0, vm1} -> vm } - let mut vm: HashMap = HashMap::new(); - vm.insert(0, Named::new("vm0")); - vm.insert(1, Named::new("vm1")); - vm[&0].contents.set(Some(&vm)); - vm[&1].contents.set(Some(&vm)); - - let mut c = c_orig.clone(); - c.curr_mark = 70; - assert!(!c.saw_prev_marked); - vm[&0].descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 8: { ll -> (ll0, ll1), {ll0, ll1} -> ll } - let mut ll: LinkedList = LinkedList::new(); - ll.push_back(Named::new("ll0")); - ll.push_back(Named::new("ll1")); - for e in &ll { - e.contents.set(Some(&ll)); - } - - let mut c = c_orig.clone(); - c.curr_mark = 80; - for e in &ll { - c.curr_mark += 1; - c.saw_prev_marked = false; - e.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - // break; - } - - if PRINT { println!(""); } - - // Cycle 9: { bh -> (bh0, bh1), {bh0, bh1} -> bh } - let mut bh: BinaryHeap = BinaryHeap::new(); - bh.push(Named::new("bh0")); - bh.push(Named::new("bh1")); - for b in bh.iter() { - b.contents.set(Some(&bh)); - } - - let mut c = c_orig.clone(); - c.curr_mark = 90; - for b in &bh { - c.curr_mark += 1; - c.saw_prev_marked = false; - b.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - // break; - } - - if PRINT { println!(""); } - - // Cycle 10: { btm -> (btk0, btv1), {bt0, bt1} -> btm } - let mut btm: BTreeMap = BTreeMap::new(); - btm.insert(Named::new("btk0"), Named::new("btv0")); - btm.insert(Named::new("btk1"), Named::new("btv1")); - for (k, v) in btm.iter() { - k.contents.set(Some(&btm)); - v.contents.set(Some(&btm)); - } - - let mut c = c_orig.clone(); - c.curr_mark = 100; - for (k, _) in &btm { - c.curr_mark += 1; - c.saw_prev_marked = false; - k.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - // break; - } - - if PRINT { println!(""); } - - // Cycle 10: { bts -> (bts0, bts1), {bts0, bts1} -> btm } - let mut bts: BTreeSet = BTreeSet::new(); - bts.insert(Named::new("bts0")); - bts.insert(Named::new("bts1")); - for v in bts.iter() { - v.contents.set(Some(&bts)); - } - - let mut c = c_orig.clone(); - c.curr_mark = 100; - for b in &bts { - c.curr_mark += 1; - c.saw_prev_marked = false; - b.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - // break; - } - - if PRINT { println!(""); } - - // Cycle 11: { rc0 -> (rc1, rc2), rc1 -> (), rc2 -> rc0 } - let (rc0, rc1, rc2): (RCRC, RCRC, RCRC); - rc0 = RCRC::new("rcrc0"); - rc1 = RCRC::new("rcrc1"); - rc2 = RCRC::new("rcrc2"); - rc0.0.borrow_mut().children.0 = Some(&rc1); - rc0.0.borrow_mut().children.1 = Some(&rc2); - rc2.0.borrow_mut().children.0 = Some(&rc0); - - let mut c = c_orig.clone(); - c.control_bits = 0b1; - c.curr_mark = 110; - assert!(!c.saw_prev_marked); - rc0.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // We want to take the previous Rc case and generalize it to Arc. - // - // We can use refcells if we're single-threaded (as this test is). - // If one were to generalize these constructions to a - // multi-threaded context, then it might seem like we could choose - // between either a RwLock or a Mutex to hold the owned arcs on - // each node. - // - // Part of the point of this test is to actually confirm that the - // cycle exists by traversing it. We can do that just fine with an - // RwLock (since we can grab the child pointers in read-only - // mode), but we cannot lock a std::sync::Mutex to guard reading - // from each node via the same pattern, since once you hit the - // cycle, you'll be trying to acquiring the same lock twice. - // (We deal with this by exiting the traversal early if try_lock fails.) - - // Cycle 12: { arc0 -> (arc1, arc2), arc1 -> (), arc2 -> arc0 }, refcells - let (arc0, arc1, arc2): (ARCRC, ARCRC, ARCRC); - arc0 = ARCRC::new("arcrc0"); - arc1 = ARCRC::new("arcrc1"); - arc2 = ARCRC::new("arcrc2"); - arc0.0.borrow_mut().children.0 = Some(&arc1); - arc0.0.borrow_mut().children.1 = Some(&arc2); - arc2.0.borrow_mut().children.0 = Some(&arc0); - - let mut c = c_orig.clone(); - c.control_bits = 0b1; - c.curr_mark = 110; - assert!(!c.saw_prev_marked); - arc0.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 13: { arc0 -> (arc1, arc2), arc1 -> (), arc2 -> arc0 }, rwlocks - let (arc0, arc1, arc2): (ARCRW, ARCRW, ARCRW); - arc0 = ARCRW::new("arcrw0"); - arc1 = ARCRW::new("arcrw1"); - arc2 = ARCRW::new("arcrw2"); - arc0.0.write().unwrap().children.0 = Some(&arc1); - arc0.0.write().unwrap().children.1 = Some(&arc2); - arc2.0.write().unwrap().children.0 = Some(&arc0); - - let mut c = c_orig.clone(); - c.control_bits = 0b1; - c.curr_mark = 110; - assert!(!c.saw_prev_marked); - arc0.descend_into_self(&mut c); - assert!(c.saw_prev_marked); - - if PRINT { println!(""); } - - // Cycle 14: { arc0 -> (arc1, arc2), arc1 -> (), arc2 -> arc0 }, mutexs - let (arc0, arc1, arc2): (ARCM, ARCM, ARCM); - arc0 = ARCM::new("arcm0"); - arc1 = ARCM::new("arcm1"); - arc2 = ARCM::new("arcm2"); - arc0.1.lock().unwrap().children.0 = Some(&arc1); - arc0.1.lock().unwrap().children.1 = Some(&arc2); - arc2.1.lock().unwrap().children.0 = Some(&arc0); - - let mut c = c_orig.clone(); - c.control_bits = 0b1; - c.curr_mark = 110; - assert!(!c.saw_prev_marked); - arc0.descend_into_self(&mut c); - assert!(c.saw_prev_marked); -} - -trait Named { - fn new(_: &'static str) -> Self; - fn name(&self) -> &str; -} - -trait Marked { - fn mark(&self) -> M; - fn set_mark(&self, mark: M); -} - -struct S<'a> { - name: &'static str, - mark: Cell, - next: Cell>>, -} - -impl<'a> Named for S<'a> { - fn new(name: &'static str) -> S<'a> { - S { name: name, mark: Cell::new(0), next: Cell::new(None) } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for S<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -struct S2<'a> { - name: &'static str, - mark: Cell, - next: Cell<(Option<&'a S2<'a>>, Option<&'a S2<'a>>)>, -} - -impl<'a> Named for S2<'a> { - fn new(name: &'static str) -> S2<'a> { - S2 { name: name, mark: Cell::new(0), next: Cell::new((None, None)) } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for S2<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { - self.mark.set(mark); - } -} - -struct V<'a> { - name: &'static str, - mark: Cell, - contents: Vec>>>, -} - -impl<'a> Named for V<'a> { - fn new(name: &'static str) -> V<'a> { - V { name: name, - mark: Cell::new(0), - contents: vec![Cell::new(None), Cell::new(None)] - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for V<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -#[derive(Eq)] -struct H<'a> { - name: &'static str, - mark: Cell, - next: Cell>>, -} - -impl<'a> Named for H<'a> { - fn new(name: &'static str) -> H<'a> { - H { name: name, mark: Cell::new(0), next: Cell::new(None) } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for H<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -impl<'a> PartialEq for H<'a> { - fn eq(&self, rhs: &H<'a>) -> bool { - self.name == rhs.name - } -} - -impl<'a> Hash for H<'a> { - fn hash(&self, state: &mut H) { - self.name.hash(state) - } -} - -#[derive(Eq)] -struct HM<'a> { - name: &'static str, - mark: Cell, - contents: Cell, HM<'a>>>>, -} - -impl<'a> Named for HM<'a> { - fn new(name: &'static str) -> HM<'a> { - HM { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for HM<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -impl<'a> PartialEq for HM<'a> { - fn eq(&self, rhs: &HM<'a>) -> bool { - self.name == rhs.name - } -} - -impl<'a> Hash for HM<'a> { - fn hash(&self, state: &mut H) { - self.name.hash(state) - } -} - - -struct VD<'a> { - name: &'static str, - mark: Cell, - contents: Cell>>>, -} - -impl<'a> Named for VD<'a> { - fn new(name: &'static str) -> VD<'a> { - VD { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for VD<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -struct VM<'a> { - name: &'static str, - mark: Cell, - contents: Cell>>>, -} - -impl<'a> Named for VM<'a> { - fn new(name: &'static str) -> VM<'a> { - VM { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for VM<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -struct LL<'a> { - name: &'static str, - mark: Cell, - contents: Cell>>>, -} - -impl<'a> Named for LL<'a> { - fn new(name: &'static str) -> LL<'a> { - LL { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for LL<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -struct BH<'a> { - name: &'static str, - mark: Cell, - contents: Cell>>>, -} - -impl<'a> Named for BH<'a> { - fn new(name: &'static str) -> BH<'a> { - BH { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for BH<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -impl<'a> Eq for BH<'a> { } - -impl<'a> PartialEq for BH<'a> { - fn eq(&self, rhs: &BH<'a>) -> bool { - self.name == rhs.name - } -} - -impl<'a> PartialOrd for BH<'a> { - fn partial_cmp(&self, rhs: &BH<'a>) -> Option { - Some(self.cmp(rhs)) - } -} - -impl<'a> Ord for BH<'a> { - fn cmp(&self, rhs: &BH<'a>) -> Ordering { - self.name.cmp(rhs.name) - } -} - -struct BTM<'a> { - name: &'static str, - mark: Cell, - contents: Cell, BTM<'a>>>>, -} - -impl<'a> Named for BTM<'a> { - fn new(name: &'static str) -> BTM<'a> { - BTM { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for BTM<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -impl<'a> Eq for BTM<'a> { } - -impl<'a> PartialEq for BTM<'a> { - fn eq(&self, rhs: &BTM<'a>) -> bool { - self.name == rhs.name - } -} - -impl<'a> PartialOrd for BTM<'a> { - fn partial_cmp(&self, rhs: &BTM<'a>) -> Option { - Some(self.cmp(rhs)) - } -} - -impl<'a> Ord for BTM<'a> { - fn cmp(&self, rhs: &BTM<'a>) -> Ordering { - self.name.cmp(rhs.name) - } -} - -struct BTS<'a> { - name: &'static str, - mark: Cell, - contents: Cell>>>, -} - -impl<'a> Named for BTS<'a> { - fn new(name: &'static str) -> BTS<'a> { - BTS { name: name, - mark: Cell::new(0), - contents: Cell::new(None) - } - } - fn name(&self) -> &str { self.name } -} - -impl<'a> Marked for BTS<'a> { - fn mark(&self) -> u32 { self.mark.get() } - fn set_mark(&self, mark: u32) { self.mark.set(mark); } -} - -impl<'a> Eq for BTS<'a> { } - -impl<'a> PartialEq for BTS<'a> { - fn eq(&self, rhs: &BTS<'a>) -> bool { - self.name == rhs.name - } -} - -impl<'a> PartialOrd for BTS<'a> { - fn partial_cmp(&self, rhs: &BTS<'a>) -> Option { - Some(self.cmp(rhs)) - } -} - -impl<'a> Ord for BTS<'a> { - fn cmp(&self, rhs: &BTS<'a>) -> Ordering { - self.name.cmp(rhs.name) - } -} - -#[derive(Clone)] -struct RCRCData<'a> { - name: &'static str, - mark: Cell, - children: (Option<&'a RCRC<'a>>, Option<&'a RCRC<'a>>), -} -#[derive(Clone)] -struct RCRC<'a>(Rc>>); - -impl<'a> Named for RCRC<'a> { - fn new(name: &'static str) -> Self { - RCRC(Rc::new(RefCell::new(RCRCData { - name: name, mark: Cell::new(0), children: (None, None), }))) - } - fn name(&self) -> &str { self.0.borrow().name } -} - -impl<'a> Marked for RCRC<'a> { - fn mark(&self) -> u32 { self.0.borrow().mark.get() } - fn set_mark(&self, mark: u32) { self.0.borrow().mark.set(mark); } -} - -impl<'a> Children<'a> for RCRC<'a> { - fn count_children(&self) -> usize { 2 } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - let children = &self.0.borrow().children; - let child = match index { - 0 => if let Some(child) = children.0 { child } else { return; }, - 1 => if let Some(child) = children.1 { child } else { return; }, - _ => panic!("bad children"), - }; - // println!("S2 {} descending into child {} at index {}", self.name, child.name, index); - child.descend_into_self(context); - } -} -#[derive(Clone)] -struct ARCRCData<'a> { - name: &'static str, - mark: Cell, - children: (Option<&'a ARCRC<'a>>, Option<&'a ARCRC<'a>>), -} -#[derive(Clone)] -struct ARCRC<'a>(Arc>>); - -impl<'a> Named for ARCRC<'a> { - fn new(name: &'static str) -> Self { - ARCRC(Arc::new(RefCell::new(ARCRCData { - name: name, mark: Cell::new(0), children: (None, None), }))) - } - fn name(&self) -> &str { self.0.borrow().name } -} - -impl<'a> Marked for ARCRC<'a> { - fn mark(&self) -> u32 { self.0.borrow().mark.get() } - fn set_mark(&self, mark: u32) { self.0.borrow().mark.set(mark); } -} - -impl<'a> Children<'a> for ARCRC<'a> { - fn count_children(&self) -> usize { 2 } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - let children = &self.0.borrow().children; - match index { - 0 => if let Some(ref child) = children.0 { - child.descend_into_self(context); - }, - 1 => if let Some(ref child) = children.1 { - child.descend_into_self(context); - }, - _ => panic!("bad children!"), - } - } -} - -#[derive(Clone)] -struct ARCMData<'a> { - mark: Cell, - children: (Option<&'a ARCM<'a>>, Option<&'a ARCM<'a>>), -} - -#[derive(Clone)] -struct ARCM<'a>(&'static str, Arc>>); - -impl<'a> Named for ARCM<'a> { - fn new(name: &'static str) -> Self { - ARCM(name, Arc::new(Mutex::new(ARCMData { - mark: Cell::new(0), children: (None, None), }))) - } - fn name(&self) -> &str { self.0 } -} - -impl<'a> Marked for ARCM<'a> { - fn mark(&self) -> u32 { self.1.lock().unwrap().mark.get() } - fn set_mark(&self, mark: u32) { self.1.lock().unwrap().mark.set(mark); } -} - -impl<'a> Children<'a> for ARCM<'a> { - fn count_children(&self) -> usize { 2 } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - let ref children = if let Ok(data) = self.1.try_lock() { - data.children - } else { return; }; - match index { - 0 => if let Some(ref child) = children.0 { - child.descend_into_self(context); - }, - 1 => if let Some(ref child) = children.1 { - child.descend_into_self(context); - }, - _ => panic!("bad children!"), - } - } -} - -#[derive(Clone)] -struct ARCRWData<'a> { - name: &'static str, - mark: Cell, - children: (Option<&'a ARCRW<'a>>, Option<&'a ARCRW<'a>>), -} - -#[derive(Clone)] -struct ARCRW<'a>(Arc>>); - -impl<'a> Named for ARCRW<'a> { - fn new(name: &'static str) -> Self { - ARCRW(Arc::new(RwLock::new(ARCRWData { - name: name, mark: Cell::new(0), children: (None, None), }))) - } - fn name(&self) -> &str { self.0.read().unwrap().name } -} - -impl<'a> Marked for ARCRW<'a> { - fn mark(&self) -> u32 { self.0.read().unwrap().mark.get() } - fn set_mark(&self, mark: u32) { self.0.read().unwrap().mark.set(mark); } -} - -impl<'a> Children<'a> for ARCRW<'a> { - fn count_children(&self) -> usize { 2 } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - let children = &self.0.read().unwrap().children; - match index { - 0 => if let Some(ref child) = children.0 { - child.descend_into_self(context); - }, - 1 => if let Some(ref child) = children.1 { - child.descend_into_self(context); - }, - _ => panic!("bad children!"), - } - } -} - -trait Context { - fn next_index(&mut self, len: usize) -> usize; - fn should_act(&self) -> bool; - fn increase_visited(&mut self); - fn increase_skipped(&mut self); - fn increase_depth(&mut self); - fn decrease_depth(&mut self); -} - -trait PrePost { - fn pre(&mut self, _: &T); - fn post(&mut self, _: &T); - fn hit_limit(&mut self, _: &T); -} - -trait Children<'a> { - fn count_children(&self) -> usize; - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized; - - fn next_child(&self, context: &mut C) - where C: Context + PrePost, Self: Sized - { - let index = context.next_index(self.count_children()); - self.descend_one_child(context, index); - } - - fn descend_into_self(&self, context: &mut C) - where C: Context + PrePost, Self: Sized - { - context.pre(self); - if context.should_act() { - context.increase_visited(); - context.increase_depth(); - self.next_child(context); - context.decrease_depth(); - } else { - context.hit_limit(self); - context.increase_skipped(); - } - context.post(self); - } - - fn descend<'b, C>(&self, c: &Cell>, context: &mut C) - where C: Context + PrePost, Self: Sized - { - if let Some(r) = c.get() { - r.descend_into_self(context); - } - } -} - -impl<'a> Children<'a> for S<'a> { - fn count_children(&self) -> usize { 1 } - fn descend_one_child(&self, context: &mut C, _: usize) - where C: Context + PrePost, Self: Sized { - self.descend(&self.next, context); - } -} - -impl<'a> Children<'a> for S2<'a> { - fn count_children(&self) -> usize { 2 } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - let children = self.next.get(); - let child = match index { - 0 => if let Some(child) = children.0 { child } else { return; }, - 1 => if let Some(child) = children.1 { child } else { return; }, - _ => panic!("bad children"), - }; - // println!("S2 {} descending into child {} at index {}", self.name, child.name, index); - child.descend_into_self(context); - } -} - -impl<'a> Children<'a> for V<'a> { - fn count_children(&self) -> usize { self.contents.len() } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - if let Some(child) = self.contents[index].get() { - child.descend_into_self(context); - } - } -} - -impl<'a> Children<'a> for H<'a> { - fn count_children(&self) -> usize { 1 } - fn descend_one_child(&self, context: &mut C, _: usize) - where C: Context + PrePost, Self: Sized - { - self.descend(&self.next, context); - } -} - -impl<'a> Children<'a> for HM<'a> { - fn count_children(&self) -> usize { - if let Some(m) = self.contents.get() { 2 * m.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - if let Some(ref hm) = self.contents.get() { - for (k, v) in hm.iter().nth(index / 2) { - [k, v][index % 2].descend_into_self(context); - } - } - } -} - -impl<'a> Children<'a> for VD<'a> { - fn count_children(&self) -> usize { - if let Some(d) = self.contents.get() { d.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost, Self: Sized - { - if let Some(ref vd) = self.contents.get() { - for r in vd.iter().nth(index) { - r.descend_into_self(context); - } - } - } -} - -impl<'a> Children<'a> for VM<'a> { - fn count_children(&self) -> usize { - if let Some(m) = self.contents.get() { m.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost> - { - if let Some(ref vd) = self.contents.get() { - for (_idx, r) in vd.iter().nth(index) { - r.descend_into_self(context); - } - } - } -} - -impl<'a> Children<'a> for LL<'a> { - fn count_children(&self) -> usize { - if let Some(l) = self.contents.get() { l.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost> - { - if let Some(ref ll) = self.contents.get() { - for r in ll.iter().nth(index) { - r.descend_into_self(context); - } - } - } -} - -impl<'a> Children<'a> for BH<'a> { - fn count_children(&self) -> usize { - if let Some(h) = self.contents.get() { h.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost> - { - if let Some(ref bh) = self.contents.get() { - for r in bh.iter().nth(index) { - r.descend_into_self(context); - } - } - } -} - -impl<'a> Children<'a> for BTM<'a> { - fn count_children(&self) -> usize { - if let Some(m) = self.contents.get() { 2 * m.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost> - { - if let Some(ref bh) = self.contents.get() { - for (k, v) in bh.iter().nth(index / 2) { - [k, v][index % 2].descend_into_self(context); - } - } - } -} - -impl<'a> Children<'a> for BTS<'a> { - fn count_children(&self) -> usize { - if let Some(s) = self.contents.get() { s.iter().count() } else { 0 } - } - fn descend_one_child(&self, context: &mut C, index: usize) - where C: Context + PrePost> - { - if let Some(ref bh) = self.contents.get() { - for r in bh.iter().nth(index) { - r.descend_into_self(context); - } - } - } -} - -#[derive(Copy, Clone)] -struct ContextData { - curr_depth: usize, - max_depth: usize, - visited: usize, - max_visits: usize, - skipped: usize, - curr_mark: u32, - saw_prev_marked: bool, - control_bits: u64, -} - -impl Context for ContextData { - fn next_index(&mut self, len: usize) -> usize { - if len < 2 { return 0; } - let mut pow2 = len.next_power_of_two(); - let _pow2_orig = pow2; - let mut idx = 0; - let mut bits = self.control_bits; - while pow2 > 1 { - idx = (idx << 1) | (bits & 1) as usize; - bits = bits >> 1; - pow2 = pow2 >> 1; - } - idx = idx % len; - // println!("next_index({} [{:b}]) says {}, pre(bits): {:b} post(bits): {:b}", - // len, _pow2_orig, idx, self.control_bits, bits); - self.control_bits = bits; - return idx; - } - fn should_act(&self) -> bool { - self.curr_depth < self.max_depth && self.visited < self.max_visits - } - fn increase_visited(&mut self) { self.visited += 1; } - fn increase_skipped(&mut self) { self.skipped += 1; } - fn increase_depth(&mut self) { self.curr_depth += 1; } - fn decrease_depth(&mut self) { self.curr_depth -= 1; } -} - -impl> PrePost for ContextData { - fn pre(&mut self, t: &T) { - for _ in 0..self.curr_depth { - if PRINT { print!(" "); } - } - if PRINT { println!("prev {}", t.name()); } - if t.mark() == self.curr_mark { - for _ in 0..self.curr_depth { - if PRINT { print!(" "); } - } - if PRINT { println!("(probably previously marked)"); } - self.saw_prev_marked = true; - } - t.set_mark(self.curr_mark); - } - fn post(&mut self, t: &T) { - for _ in 0..self.curr_depth { - if PRINT { print!(" "); } - } - if PRINT { println!("post {}", t.name()); } - } - fn hit_limit(&mut self, t: &T) { - for _ in 0..self.curr_depth { - if PRINT { print!(" "); } - } - if PRINT { println!("LIMIT {}", t.name()); } - } -} diff --git a/src/test/ui/run-pass/drop/dynamic-drop.rs b/src/test/ui/run-pass/drop/dynamic-drop.rs deleted file mode 100644 index de10c9f2403..00000000000 --- a/src/test/ui/run-pass/drop/dynamic-drop.rs +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// revisions:lexical nll -#![cfg_attr(nll, feature(nll))] - -// ignore-wasm32-bare compiled with panic=abort by default - -#![feature(generators, generator_trait, untagged_unions)] -#![feature(slice_patterns)] - -use std::cell::{Cell, RefCell}; -use std::ops::Generator; -use std::panic; -use std::usize; - -struct InjectedFailure; - -struct Allocator { - data: RefCell>, - failing_op: usize, - cur_ops: Cell, -} - -impl panic::UnwindSafe for Allocator {} -impl panic::RefUnwindSafe for Allocator {} - -impl Drop for Allocator { - fn drop(&mut self) { - let data = self.data.borrow(); - if data.iter().any(|d| *d) { - panic!("missing free: {:?}", data); - } - } -} - -impl Allocator { - fn new(failing_op: usize) -> Self { - Allocator { - failing_op: failing_op, - cur_ops: Cell::new(0), - data: RefCell::new(vec![]) - } - } - fn alloc(&self) -> Ptr { - self.cur_ops.set(self.cur_ops.get() + 1); - - if self.cur_ops.get() == self.failing_op { - panic!(InjectedFailure); - } - - let mut data = self.data.borrow_mut(); - let addr = data.len(); - data.push(true); - Ptr(addr, self) - } -} - -struct Ptr<'a>(usize, &'a Allocator); -impl<'a> Drop for Ptr<'a> { - fn drop(&mut self) { - match self.1.data.borrow_mut()[self.0] { - false => { - panic!("double free at index {:?}", self.0) - } - ref mut d => *d = false - } - - self.1.cur_ops.set(self.1.cur_ops.get()+1); - - if self.1.cur_ops.get() == self.1.failing_op { - panic!(InjectedFailure); - } - } -} - -fn dynamic_init(a: &Allocator, c: bool) { - let _x; - if c { - _x = Some(a.alloc()); - } -} - -fn dynamic_drop(a: &Allocator, c: bool) { - let x = a.alloc(); - if c { - Some(x) - } else { - None - }; -} - -struct TwoPtrs<'a>(Ptr<'a>, Ptr<'a>); -fn struct_dynamic_drop(a: &Allocator, c0: bool, c1: bool, c: bool) { - for i in 0..2 { - let x; - let y; - if (c0 && i == 0) || (c1 && i == 1) { - x = (a.alloc(), a.alloc(), a.alloc()); - y = TwoPtrs(a.alloc(), a.alloc()); - if c { - drop(x.1); - drop(y.0); - } - } - } -} - -fn field_assignment(a: &Allocator, c0: bool) { - let mut x = (TwoPtrs(a.alloc(), a.alloc()), a.alloc()); - - x.1 = a.alloc(); - x.1 = a.alloc(); - - let f = (x.0).0; - if c0 { - (x.0).0 = f; - } -} - -fn assignment2(a: &Allocator, c0: bool, c1: bool) { - let mut _v = a.alloc(); - let mut _w = a.alloc(); - if c0 { - drop(_v); - } - _v = _w; - if c1 { - _w = a.alloc(); - } -} - -fn assignment1(a: &Allocator, c0: bool) { - let mut _v = a.alloc(); - let mut _w = a.alloc(); - if c0 { - drop(_v); - } - _v = _w; -} - -#[allow(unions_with_drop_fields)] -union Boxy { - a: T, - b: T, -} - -fn union1(a: &Allocator) { - unsafe { - let mut u = Boxy { a: a.alloc() }; - u.b = a.alloc(); - drop(u.a); - } -} - -fn array_simple(a: &Allocator) { - let _x = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; -} - -fn vec_simple(a: &Allocator) { - let _x = vec![a.alloc(), a.alloc(), a.alloc(), a.alloc()]; -} - -fn generator(a: &Allocator, run_count: usize) { - assert!(run_count < 4); - - let mut gen = || { - (a.alloc(), - yield a.alloc(), - a.alloc(), - yield a.alloc() - ); - }; - for _ in 0..run_count { - unsafe { gen.resume(); } - } -} - -fn mixed_drop_and_nondrop(a: &Allocator) { - // check that destructor panics handle drop - // and non-drop blocks in the same scope correctly. - // - // Surprisingly enough, this used to not work. - let (x, y, z); - x = a.alloc(); - y = 5; - z = a.alloc(); -} - -#[allow(unreachable_code)] -fn vec_unreachable(a: &Allocator) { - let _x = vec![a.alloc(), a.alloc(), a.alloc(), return]; -} - -fn slice_pattern_first(a: &Allocator) { - let[_x, ..] = [a.alloc(), a.alloc(), a.alloc()]; -} - -fn slice_pattern_middle(a: &Allocator) { - let[_, _x, _] = [a.alloc(), a.alloc(), a.alloc()]; -} - -fn slice_pattern_two(a: &Allocator) { - let[_x, _, _y, _] = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; -} - -fn slice_pattern_last(a: &Allocator) { - let[.., _y] = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; -} - -fn slice_pattern_one_of(a: &Allocator, i: usize) { - let array = [a.alloc(), a.alloc(), a.alloc(), a.alloc()]; - let _x = match i { - 0 => { let [a, ..] = array; a } - 1 => { let [_, a, ..] = array; a } - 2 => { let [_, _, a, _] = array; a } - 3 => { let [_, _, _, a] = array; a } - _ => panic!("unmatched"), - }; -} - -fn subslice_pattern_from_end(a: &Allocator, arg: bool) { - let a = [a.alloc(), a.alloc(), a.alloc()]; - if arg { - let[.., _x, _] = a; - } else { - let[_, _y..] = a; - } -} - -fn subslice_pattern_from_end_with_drop(a: &Allocator, arg: bool, arg2: bool) { - let a = [a.alloc(), a.alloc(), a.alloc(), a.alloc(), a.alloc()]; - if arg2 { - drop(a); - return; - } - - if arg { - let[.., _x, _] = a; - } else { - let[_, _y..] = a; - } -} - -fn slice_pattern_reassign(a: &Allocator) { - let mut ar = [a.alloc(), a.alloc()]; - let[_, _x] = ar; - ar = [a.alloc(), a.alloc()]; - let[.., _y] = ar; -} - -fn subslice_pattern_reassign(a: &Allocator) { - let mut ar = [a.alloc(), a.alloc(), a.alloc()]; - let[_, _, _x] = ar; - ar = [a.alloc(), a.alloc(), a.alloc()]; - let[_, _y..] = ar; -} - -fn run_test(mut f: F) - where F: FnMut(&Allocator) -{ - let first_alloc = Allocator::new(usize::MAX); - f(&first_alloc); - - for failing_op in 1..first_alloc.cur_ops.get()+1 { - let alloc = Allocator::new(failing_op); - let alloc = &alloc; - let f = panic::AssertUnwindSafe(&mut f); - let result = panic::catch_unwind(move || { - f.0(alloc); - }); - match result { - Ok(..) => panic!("test executed {} ops but now {}", - first_alloc.cur_ops.get(), alloc.cur_ops.get()), - Err(e) => { - if e.downcast_ref::().is_none() { - panic::resume_unwind(e); - } - } - } - } -} - -fn run_test_nopanic(mut f: F) - where F: FnMut(&Allocator) -{ - let first_alloc = Allocator::new(usize::MAX); - f(&first_alloc); -} - -fn main() { - run_test(|a| dynamic_init(a, false)); - run_test(|a| dynamic_init(a, true)); - run_test(|a| dynamic_drop(a, false)); - run_test(|a| dynamic_drop(a, true)); - - run_test(|a| assignment2(a, false, false)); - run_test(|a| assignment2(a, false, true)); - run_test(|a| assignment2(a, true, false)); - run_test(|a| assignment2(a, true, true)); - - run_test(|a| assignment1(a, false)); - run_test(|a| assignment1(a, true)); - - run_test(|a| array_simple(a)); - run_test(|a| vec_simple(a)); - run_test(|a| vec_unreachable(a)); - - run_test(|a| struct_dynamic_drop(a, false, false, false)); - run_test(|a| struct_dynamic_drop(a, false, false, true)); - run_test(|a| struct_dynamic_drop(a, false, true, false)); - run_test(|a| struct_dynamic_drop(a, false, true, true)); - run_test(|a| struct_dynamic_drop(a, true, false, false)); - run_test(|a| struct_dynamic_drop(a, true, false, true)); - run_test(|a| struct_dynamic_drop(a, true, true, false)); - run_test(|a| struct_dynamic_drop(a, true, true, true)); - - run_test(|a| field_assignment(a, false)); - run_test(|a| field_assignment(a, true)); - - run_test(|a| generator(a, 0)); - run_test(|a| generator(a, 1)); - run_test(|a| generator(a, 2)); - run_test(|a| generator(a, 3)); - - run_test(|a| mixed_drop_and_nondrop(a)); - - run_test(|a| slice_pattern_first(a)); - run_test(|a| slice_pattern_middle(a)); - run_test(|a| slice_pattern_two(a)); - run_test(|a| slice_pattern_last(a)); - run_test(|a| slice_pattern_one_of(a, 0)); - run_test(|a| slice_pattern_one_of(a, 1)); - run_test(|a| slice_pattern_one_of(a, 2)); - run_test(|a| slice_pattern_one_of(a, 3)); - - run_test(|a| subslice_pattern_from_end(a, true)); - run_test(|a| subslice_pattern_from_end(a, false)); - run_test(|a| subslice_pattern_from_end_with_drop(a, true, true)); - run_test(|a| subslice_pattern_from_end_with_drop(a, true, false)); - run_test(|a| subslice_pattern_from_end_with_drop(a, false, true)); - run_test(|a| subslice_pattern_from_end_with_drop(a, false, false)); - run_test(|a| slice_pattern_reassign(a)); - run_test(|a| subslice_pattern_reassign(a)); - - run_test_nopanic(|a| union1(a)); -} diff --git a/src/test/ui/run-pass/drop/no-drop-flag-size.rs b/src/test/ui/run-pass/drop/no-drop-flag-size.rs deleted file mode 100644 index abaaf7d701e..00000000000 --- a/src/test/ui/run-pass/drop/no-drop-flag-size.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem::size_of; - -struct Test { - a: T -} - -impl Drop for Test { - fn drop(&mut self) { } -} - -pub fn main() { - assert_eq!(size_of::(), size_of::>()); -} diff --git a/src/test/ui/run-pass/drop/nondrop-cycle.rs b/src/test/ui/run-pass/drop/nondrop-cycle.rs deleted file mode 100644 index 7e2bb38f5bd..00000000000 --- a/src/test/ui/run-pass/drop/nondrop-cycle.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::cell::Cell; - -struct C<'a> { - p: Cell>>, -} - -impl<'a> C<'a> { - fn new() -> C<'a> { C { p: Cell::new(None) } } -} - -fn f1() { - let (c1, c2) = (C::new(), C::new()); - c1.p.set(Some(&c2)); - c2.p.set(Some(&c1)); -} - -fn f2() { - let (c1, c2); - c1 = C::new(); - c2 = C::new(); - c1.p.set(Some(&c2)); - c2.p.set(Some(&c1)); -} - -fn main() { - f1(); - f2(); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-coerce-custom.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-coerce-custom.rs deleted file mode 100644 index affc569c63d..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-coerce-custom.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a very simple custom DST coercion. - -#![feature(unsize, coerce_unsized)] - -use std::ops::CoerceUnsized; -use std::marker::Unsize; - -struct Bar { - x: *const T, -} - -impl, U: ?Sized> CoerceUnsized> for Bar {} - -trait Baz { - fn get(&self) -> i32; -} - -impl Baz for i32 { - fn get(&self) -> i32 { - *self - } -} - -fn main() { - // Arrays. - let a: Bar<[i32; 3]> = Bar { x: &[1, 2, 3] }; - // This is the actual coercion. - let b: Bar<[i32]> = a; - - unsafe { - assert_eq!((*b.x)[0], 1); - assert_eq!((*b.x)[1], 2); - assert_eq!((*b.x)[2], 3); - } - - // Trait objects. - let a: Bar = Bar { x: &42 }; - let b: Bar = a; - unsafe { - assert_eq!((*b.x).get(), 42); - } -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-coerce-rc.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-coerce-rc.rs deleted file mode 100644 index fb7b2bc8bf7..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-coerce-rc.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -// Test a very simple custom DST coercion. - -#![feature(core, rc_weak)] - -use std::cell::RefCell; -use std::rc::{Rc, Weak}; - -trait Baz { - fn get(&self) -> i32; -} - -impl Baz for i32 { - fn get(&self) -> i32 { - *self - } -} - -fn main() { - let a: Rc<[i32; 3]> = Rc::new([1, 2, 3]); - let b: Rc<[i32]> = a; - assert_eq!(b[0], 1); - assert_eq!(b[1], 2); - assert_eq!(b[2], 3); - - let a: Rc = Rc::new(42); - let b: Rc = a.clone(); - assert_eq!(b.get(), 42); - - let c: Weak = Rc::downgrade(&a); - let d: Weak = c.clone(); - - let _c = b.clone(); - - let a: Rc> = Rc::new(RefCell::new(42)); - let b: Rc> = a.clone(); - assert_eq!(b.borrow().get(), 42); - // FIXME - let c: Weak> = Rc::downgrade(&a) as Weak<_>; -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-coercions.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-coercions.rs deleted file mode 100644 index 21170403d43..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-coercions.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test coercions involving DST and/or raw pointers - -// pretty-expanded FIXME #23616 - -struct S; -trait T { fn dummy(&self) { } } -impl T for S {} - -pub fn main() { - let x: &T = &S; - // Test we can convert from &-ptr to *-ptr of trait objects - let x: *const T = &S; - - // Test we can convert from &-ptr to *-ptr of struct pointer (not DST) - let x: *const S = &S; - - // As above, but mut - let x: &mut T = &mut S; - let x: *mut T = &mut S; - - let x: *mut S = &mut S; - - // Test we can change the mutability from mut to const. - let x: &T = &mut S; - let x: *const T = &mut S; -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-deref-mut.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-deref-mut.rs deleted file mode 100644 index a2c0a8c9beb..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-deref-mut.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a custom deref with a fat pointer return type does not ICE - - -use std::ops::{Deref, DerefMut}; - -pub struct Arr { - ptr: Box<[usize]> -} - -impl Deref for Arr { - type Target = [usize]; - - fn deref(&self) -> &[usize] { - panic!(); - } -} - -impl DerefMut for Arr { - fn deref_mut(&mut self) -> &mut [usize] { - &mut *self.ptr - } -} - -pub fn foo(arr: &mut Arr) { - let x: &mut [usize] = &mut **arr; - assert_eq!(x[0], 1); - assert_eq!(x[1], 2); - assert_eq!(x[2], 3); -} - -fn main() { - let mut a = Arr { ptr: Box::new([1, 2, 3]) }; - foo(&mut a); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-deref.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-deref.rs deleted file mode 100644 index db9ef399f0e..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-deref.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a custom deref with a fat pointer return type does not ICE - - -use std::ops::Deref; - -pub struct Arr { - ptr: Box<[usize]> -} - -impl Deref for Arr { - type Target = [usize]; - - fn deref(&self) -> &[usize] { - &*self.ptr - } -} - -pub fn foo(arr: &Arr) { - assert_eq!(arr.len(), 3); - let x: &[usize] = &**arr; - assert_eq!(x[0], 1); - assert_eq!(x[1], 2); - assert_eq!(x[2], 3); -} - -fn main() { - let a = Arr { ptr: Box::new([1, 2, 3]) }; - foo(&a); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-field-align.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-field-align.rs deleted file mode 100644 index 1537050593c..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-field-align.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - a: u16, - b: T -} - -trait Bar { - fn get(&self) -> usize; -} - -impl Bar for usize { - fn get(&self) -> usize { *self } -} - -struct Baz { - a: T -} - -struct HasDrop { - ptr: Box, - data: T -} - -fn main() { - // Test that zero-offset works properly - let b : Baz = Baz { a: 7 }; - assert_eq!(b.a.get(), 7); - let b : &Baz = &b; - assert_eq!(b.a.get(), 7); - - // Test that the field is aligned properly - let f : Foo = Foo { a: 0, b: 11 }; - assert_eq!(f.b.get(), 11); - let ptr1 : *const u8 = &f.b as *const _ as *const u8; - - let f : &Foo = &f; - let ptr2 : *const u8 = &f.b as *const _ as *const u8; - assert_eq!(f.b.get(), 11); - - // The pointers should be the same - assert_eq!(ptr1, ptr2); - - // Test that nested DSTs work properly - let f : Foo> = Foo { a: 0, b: Foo { a: 1, b: 17 }}; - assert_eq!(f.b.b.get(), 17); - let f : &Foo> = &f; - assert_eq!(f.b.b.get(), 17); - - // Test that get the pointer via destructuring works - - let f : Foo = Foo { a: 0, b: 11 }; - let f : &Foo = &f; - let &Foo { a: _, b: ref bar } = f; - assert_eq!(bar.get(), 11); - - // Make sure that drop flags don't screw things up - - let d : HasDrop> = HasDrop { - ptr: Box::new(0), - data: Baz { a: [1,2,3,4] } - }; - assert_eq!([1,2,3,4], d.data.a); - - let d : &HasDrop> = &d; - assert_eq!(&[1,2,3,4], &d.data.a); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-index.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-index.rs deleted file mode 100644 index 56323816b4c..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-index.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that overloaded index expressions with DST result types -// work and don't ICE. - -use std::ops::Index; -use std::fmt::Debug; - -struct S; - -impl Index for S { - type Output = str; - - fn index<'a>(&'a self, _: usize) -> &'a str { - "hello" - } -} - -struct T; - -impl Index for T { - type Output = Debug + 'static; - - fn index<'a>(&'a self, idx: usize) -> &'a (Debug + 'static) { - static X: usize = 42; - &X as &(Debug + 'static) - } -} - -fn main() { - assert_eq!(&S[0], "hello"); - &T[0]; - // let x = &x as &Debug; -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs deleted file mode 100644 index 031aa7c04e6..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-irrefutable-bind.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(unsized_tuple_coercion)] - -struct Test(T); - -fn main() { - let x = Test([1,2,3]); - let x : &Test<[i32]> = &x; - - let & ref _y = x; - - // Make sure binding to a fat pointer behind a reference - // still works - let slice = &[1,2,3]; - let x = Test(&slice); - let Test(&_slice) = x; - - - let x = (10, [1,2,3]); - let x : &(i32, [i32]) = &x; - - let & ref _y = x; - - let slice = &[1,2,3]; - let x = (10, &slice); - let (_, &_slice) = x; -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-raw.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-raw.rs deleted file mode 100644 index 96b19b9e4d9..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-raw.rs +++ /dev/null @@ -1,148 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test DST raw pointers - - -#![feature(unsized_tuple_coercion)] - -trait Trait { - fn foo(&self) -> isize; -} - -struct A { - f: isize -} -impl Trait for A { - fn foo(&self) -> isize { - self.f - } -} - -struct Foo { - f: T -} - -pub fn main() { - // raw trait object - let x = A { f: 42 }; - let z: *const Trait = &x; - let r = unsafe { - (&*z).foo() - }; - assert_eq!(r, 42); - - // raw DST struct - let p = Foo {f: A { f: 42 }}; - let o: *const Foo = &p; - let r = unsafe { - (&*o).f.foo() - }; - assert_eq!(r, 42); - - // raw DST tuple - let p = (A { f: 42 },); - let o: *const (Trait,) = &p; - let r = unsafe { - (&*o).0.foo() - }; - assert_eq!(r, 42); - - // raw slice - let a: *const [_] = &[1, 2, 3]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - // raw slice with explicit cast - let a = &[1, 2, 3] as *const [i32]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - // raw DST struct with slice - let c: *const Foo<[_]> = &Foo {f: [1, 2, 3]}; - unsafe { - let b = (&*c).f[0]; - assert_eq!(b, 1); - let len = (&*c).f.len(); - assert_eq!(len, 3); - } - - // raw DST tuple with slice - let c: *const ([_],) = &([1, 2, 3],); - unsafe { - let b = (&*c).0[0]; - assert_eq!(b, 1); - let len = (&*c).0.len(); - assert_eq!(len, 3); - } - - // all of the above with *mut - let mut x = A { f: 42 }; - let z: *mut Trait = &mut x; - let r = unsafe { - (&*z).foo() - }; - assert_eq!(r, 42); - - let mut p = Foo {f: A { f: 42 }}; - let o: *mut Foo = &mut p; - let r = unsafe { - (&*o).f.foo() - }; - assert_eq!(r, 42); - - let mut p = (A { f: 42 },); - let o: *mut (Trait,) = &mut p; - let r = unsafe { - (&*o).0.foo() - }; - assert_eq!(r, 42); - - let a: *mut [_] = &mut [1, 2, 3]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - let a = &mut [1, 2, 3] as *mut [i32]; - unsafe { - let b = (*a)[2]; - assert_eq!(b, 3); - let len = (*a).len(); - assert_eq!(len, 3); - } - - let c: *mut Foo<[_]> = &mut Foo {f: [1, 2, 3]}; - unsafe { - let b = (&*c).f[0]; - assert_eq!(b, 1); - let len = (&*c).f.len(); - assert_eq!(len, 3); - } - - let c: *mut ([_],) = &mut ([1, 2, 3],); - unsafe { - let b = (&*c).0[0]; - assert_eq!(b, 1); - let len = (&*c).0.len(); - assert_eq!(len, 3); - } -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-struct-sole.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-struct-sole.rs deleted file mode 100644 index 9959b5bf5bb..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-struct-sole.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// As dst-struct.rs, but the unsized field is the only field in the struct. - - -struct Fat { - ptr: T -} - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.ptr; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.ptr[1], 2); -} - -fn foo2(x: &Fat<[T]>) { - let y = &x.ptr; - let bar = Bar; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.ptr[1].to_bar(), bar); -} - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = Fat { ptr: [1, 2, 3] }; - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &Fat { ptr: [1, 2, 3] }; - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = Fat { ptr: [bar, bar, bar] }; - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &Fat { ptr: [bar, bar, bar] }; - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut Fat { ptr: [1, 2, 3] }; - f5.ptr[1] = 34; - assert_eq!(f5.ptr[0], 1); - assert_eq!(f5.ptr[1], 34); - assert_eq!(f5.ptr[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &Fat { ptr: [] }; - assert!(f5.ptr.is_empty()); - let f5: &Fat<[Bar]> = &Fat { ptr: [] }; - assert!(f5.ptr.is_empty()); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-struct.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-struct.rs deleted file mode 100644 index 1853c6a04d8..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-struct.rs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Fat { - f1: isize, - f2: &'static str, - ptr: T -} - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.ptr; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.ptr[1], 2); - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); -} - -fn foo2(x: &Fat<[T]>) { - let y = &x.ptr; - let bar = Bar; - assert_eq!(x.ptr.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.ptr[1].to_bar(), bar); - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); -} - -fn foo3(x: &Fat>) { - let y = &x.ptr.ptr; - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); - assert_eq!(x.ptr.f1, 8); - assert_eq!(x.ptr.f2, "deep str"); - assert_eq!(x.ptr.ptr.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.ptr.ptr[1], 2); -} - - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = Fat { f1: 5, f2: "some str", ptr: [bar, bar, bar] }; - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [bar, bar, bar] }; - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - f5.ptr[1] = 34; - assert_eq!(f5.ptr[0], 1); - assert_eq!(f5.ptr[1], 34); - assert_eq!(f5.ptr[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &Fat { f1: 5, f2: "some str", ptr: [] }; - assert!(f5.ptr.is_empty()); - let f5: &Fat<[Bar]> = &Fat { f1: 5, f2: "some str", ptr: [] }; - assert!(f5.ptr.is_empty()); - - // Deeply nested. - let f1 = Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} }; - foo3(&f1); - let f2 = &f1; - foo3(f2); - let f3: &Fat> = f2; - foo3(f3); - let f4: &Fat> = &f1; - foo3(f4); - let f5: &Fat> = - &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: [1, 2, 3]} }; - foo3(f5); - - // Box. - let f1 = Box::new([1, 2, 3]); - assert_eq!((*f1)[1], 2); - let f2: Box<[isize]> = f1; - assert_eq!((*f2)[1], 2); - - // Nested Box. - let f1 : Box> = box Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }; - foo(&*f1); - let f2 : Box> = f1; - foo(&*f2); - - let f3 : Box> = - Box::>::new(Fat { f1: 5, f2: "some str", ptr: [1, 2, 3] }); - foo(&*f3); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-trait-tuple.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-trait-tuple.rs deleted file mode 100644 index 4083f0e2b09..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-trait-tuple.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(type_alias_bounds)] - -#![allow(unused_features)] -#![feature(box_syntax)] -#![feature(unsized_tuple_coercion)] - -type Fat = (isize, &'static str, T); - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -#[derive(Copy, Clone, PartialEq, Eq)] -struct Bar1 { - f: isize -} - -trait ToBar { - fn to_bar(&self) -> Bar; - fn to_val(&self) -> isize; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } - fn to_val(&self) -> isize { - 0 - } -} -impl ToBar for Bar1 { - fn to_bar(&self) -> Bar { - Bar - } - fn to_val(&self) -> isize { - self.f - } -} - -// x is a fat pointer -fn foo(x: &Fat) { - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); - assert_eq!(x.2.to_bar(), Bar); - assert_eq!(x.2.to_val(), 42); - - let y = &x.2; - assert_eq!(y.to_bar(), Bar); - assert_eq!(y.to_val(), 42); -} - -fn bar(x: &ToBar) { - assert_eq!(x.to_bar(), Bar); - assert_eq!(x.to_val(), 42); -} - -fn baz(x: &Fat>) { - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); - assert_eq!((x.2).0, 8); - assert_eq!((x.2).1, "deep str"); - assert_eq!((x.2).2.to_bar(), Bar); - assert_eq!((x.2).2.to_val(), 42); - - let y = &(x.2).2; - assert_eq!(y.to_bar(), Bar); - assert_eq!(y.to_val(), 42); - -} - -pub fn main() { - let f1 = (5, "some str", Bar1 {f :42}); - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat = f2; - foo(f3); - let f4: &Fat = &f1; - foo(f4); - let f5: &Fat = &(5, "some str", Bar1 {f :42}); - foo(f5); - - // Zero size object. - let f6: &Fat = &(5, "some str", Bar); - assert_eq!(f6.2.to_bar(), Bar); - - // &* - // - let f7: Box = Box::new(Bar1 {f :42}); - bar(&*f7); - - // Deep nesting - let f1 = (5, "some str", (8, "deep str", Bar1 {f :42})); - baz(&f1); - let f2 = &f1; - baz(f2); - let f3: &Fat> = f2; - baz(f3); - let f4: &Fat> = &f1; - baz(f4); - let f5: &Fat> = &(5, "some str", (8, "deep str", Bar1 {f :42})); - baz(f5); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-trait.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-trait.rs deleted file mode 100644 index 3ce2cffbe09..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-trait.rs +++ /dev/null @@ -1,115 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Fat { - f1: isize, - f2: &'static str, - ptr: T -} - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -#[derive(Copy, Clone, PartialEq, Eq)] -struct Bar1 { - f: isize -} - -trait ToBar { - fn to_bar(&self) -> Bar; - fn to_val(&self) -> isize; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } - fn to_val(&self) -> isize { - 0 - } -} -impl ToBar for Bar1 { - fn to_bar(&self) -> Bar { - Bar - } - fn to_val(&self) -> isize { - self.f - } -} - -// x is a fat pointer -fn foo(x: &Fat) { - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); - assert_eq!(x.ptr.to_bar(), Bar); - assert_eq!(x.ptr.to_val(), 42); - - let y = &x.ptr; - assert_eq!(y.to_bar(), Bar); - assert_eq!(y.to_val(), 42); -} - -fn bar(x: &ToBar) { - assert_eq!(x.to_bar(), Bar); - assert_eq!(x.to_val(), 42); -} - -fn baz(x: &Fat>) { - assert_eq!(x.f1, 5); - assert_eq!(x.f2, "some str"); - assert_eq!(x.ptr.f1, 8); - assert_eq!(x.ptr.f2, "deep str"); - assert_eq!(x.ptr.ptr.to_bar(), Bar); - assert_eq!(x.ptr.ptr.to_val(), 42); - - let y = &x.ptr.ptr; - assert_eq!(y.to_bar(), Bar); - assert_eq!(y.to_val(), 42); - -} - -pub fn main() { - let f1 = Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat = f2; - foo(f3); - let f4: &Fat = &f1; - foo(f4); - let f5: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar1 {f :42} }; - foo(f5); - - // Zero size object. - let f6: &Fat = &Fat { f1: 5, f2: "some str", ptr: Bar }; - assert_eq!(f6.ptr.to_bar(), Bar); - - // &* - // - let f7: Box = Box::new(Bar1 {f :42}); - bar(&*f7); - - // Deep nesting - let f1 = - Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: Bar1 {f :42}} }; - baz(&f1); - let f2 = &f1; - baz(f2); - let f3: &Fat> = f2; - baz(f3); - let f4: &Fat> = &f1; - baz(f4); - let f5: &Fat> = - &Fat { f1: 5, f2: "some str", ptr: Fat { f1: 8, f2: "deep str", ptr: Bar1 {f :42}} }; - baz(f5); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-tuple-sole.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-tuple-sole.rs deleted file mode 100644 index 43a1bacec31..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-tuple-sole.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![allow(type_alias_bounds)] - -// As dst-tuple.rs, but the unsized field is the only field in the tuple. - - -#![feature(unsized_tuple_coercion)] - -type Fat = (T,); - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.0; - assert_eq!(x.0.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.0[1], 2); -} - -fn foo2(x: &Fat<[T]>) { - let y = &x.0; - let bar = Bar; - assert_eq!(x.0.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.0[1].to_bar(), bar); -} - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = ([1, 2, 3],); - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &([1, 2, 3],); - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = ([bar, bar, bar],); - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &([bar, bar, bar],); - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut ([1, 2, 3],); - f5.0[1] = 34; - assert_eq!(f5.0[0], 1); - assert_eq!(f5.0[1], 34); - assert_eq!(f5.0[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &([],); - assert!(f5.0.is_empty()); - let f5: &Fat<[Bar]> = &([],); - assert!(f5.0.is_empty()); -} diff --git a/src/test/ui/run-pass/dynamically-sized-types/dst-tuple.rs b/src/test/ui/run-pass/dynamically-sized-types/dst-tuple.rs deleted file mode 100644 index 753203d250d..00000000000 --- a/src/test/ui/run-pass/dynamically-sized-types/dst-tuple.rs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(type_alias_bounds)] - -#![feature(box_syntax)] -#![feature(unsized_tuple_coercion)] - -type Fat = (isize, &'static str, T); - -// x is a fat pointer -fn foo(x: &Fat<[isize]>) { - let y = &x.2; - assert_eq!(x.2.len(), 3); - assert_eq!(y[0], 1); - assert_eq!(x.2[1], 2); - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); -} - -fn foo2(x: &Fat<[T]>) { - let y = &x.2; - let bar = Bar; - assert_eq!(x.2.len(), 3); - assert_eq!(y[0].to_bar(), bar); - assert_eq!(x.2[1].to_bar(), bar); - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); -} - -fn foo3(x: &Fat>) { - let y = &(x.2).2; - assert_eq!(x.0, 5); - assert_eq!(x.1, "some str"); - assert_eq!((x.2).0, 8); - assert_eq!((x.2).1, "deep str"); - assert_eq!((x.2).2.len(), 3); - assert_eq!(y[0], 1); - assert_eq!((x.2).2[1], 2); -} - - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -struct Bar; - -trait ToBar { - fn to_bar(&self) -> Bar; -} - -impl ToBar for Bar { - fn to_bar(&self) -> Bar { - *self - } -} - -pub fn main() { - // With a vec of ints. - let f1 = (5, "some str", [1, 2, 3]); - foo(&f1); - let f2 = &f1; - foo(f2); - let f3: &Fat<[isize]> = f2; - foo(f3); - let f4: &Fat<[isize]> = &f1; - foo(f4); - let f5: &Fat<[isize]> = &(5, "some str", [1, 2, 3]); - foo(f5); - - // With a vec of Bars. - let bar = Bar; - let f1 = (5, "some str", [bar, bar, bar]); - foo2(&f1); - let f2 = &f1; - foo2(f2); - let f3: &Fat<[Bar]> = f2; - foo2(f3); - let f4: &Fat<[Bar]> = &f1; - foo2(f4); - let f5: &Fat<[Bar]> = &(5, "some str", [bar, bar, bar]); - foo2(f5); - - // Assignment. - let f5: &mut Fat<[isize]> = &mut (5, "some str", [1, 2, 3]); - f5.2[1] = 34; - assert_eq!(f5.2[0], 1); - assert_eq!(f5.2[1], 34); - assert_eq!(f5.2[2], 3); - - // Zero size vec. - let f5: &Fat<[isize]> = &(5, "some str", []); - assert!(f5.2.is_empty()); - let f5: &Fat<[Bar]> = &(5, "some str", []); - assert!(f5.2.is_empty()); - - // Deeply nested. - let f1 = (5, "some str", (8, "deep str", [1, 2, 3])); - foo3(&f1); - let f2 = &f1; - foo3(f2); - let f3: &Fat> = f2; - foo3(f3); - let f4: &Fat> = &f1; - foo3(f4); - let f5: &Fat> = &(5, "some str", (8, "deep str", [1, 2, 3])); - foo3(f5); - - // Box. - let f1 = Box::new([1, 2, 3]); - assert_eq!((*f1)[1], 2); - let f2: Box<[isize]> = f1; - assert_eq!((*f2)[1], 2); - - // Nested Box. - let f1 : Box> = box (5, "some str", [1, 2, 3]); - foo(&*f1); - let f2 : Box> = f1; - foo(&*f2); - - let f3 : Box> = - Box::>::new((5, "some str", [1, 2, 3])); - foo(&*f3); -} diff --git a/src/test/ui/run-pass/extern/auxiliary/extern-crosscrate-source.rs b/src/test/ui/run-pass/extern/auxiliary/extern-crosscrate-source.rs deleted file mode 100644 index 150dffeea88..00000000000 --- a/src/test/ui/run-pass/extern/auxiliary/extern-crosscrate-source.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="externcallback"] -#![crate_type = "lib"] -#![feature(libc)] - -extern crate libc; - -pub mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, - data: libc::uintptr_t) - -> libc::uintptr_t; - } -} - -pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t { - unsafe { - println!("n = {}", n); - rustrt::rust_dbg_call(cb, n) - } -} - -pub extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1 { - data - } else { - fact(data - 1) * data - } -} diff --git a/src/test/ui/run-pass/extern/auxiliary/extern-take-value.rs b/src/test/ui/run-pass/extern/auxiliary/extern-take-value.rs deleted file mode 100644 index 500c455136b..00000000000 --- a/src/test/ui/run-pass/extern/auxiliary/extern-take-value.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub extern fn f() -> i32 { 1 } -pub extern fn g() -> i32 { 2 } - -pub fn get_f() -> extern fn() -> i32 { f } -pub fn get_g() -> extern fn() -> i32 { g } diff --git a/src/test/ui/run-pass/extern/auxiliary/extern_calling_convention.rs b/src/test/ui/run-pass/extern/auxiliary/extern_calling_convention.rs deleted file mode 100644 index 55a4226c663..00000000000 --- a/src/test/ui/run-pass/extern/auxiliary/extern_calling_convention.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Make sure Rust generates the correct calling convention for extern -// functions. - -#[inline(never)] -#[cfg(target_arch = "x86_64")] -pub extern "win64" fn foo(a: isize, b: isize, c: isize, d: isize) { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - assert_eq!(d, 4); - - println!("a: {}, b: {}, c: {}, d: {}", - a, b, c, d) -} - -#[inline(never)] -#[cfg(not(target_arch = "x86_64"))] -pub extern fn foo(a: isize, b: isize, c: isize, d: isize) { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - assert_eq!(d, 4); - - println!("a: {}, b: {}, c: {}, d: {}", - a, b, c, d) -} diff --git a/src/test/ui/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs b/src/test/ui/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs deleted file mode 100644 index 0fb6adfcda1..00000000000 --- a/src/test/ui/run-pass/extern/auxiliary/extern_mod_ordering_lib.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub mod extern_mod_ordering_lib { - pub fn f() {} -} diff --git a/src/test/ui/run-pass/extern/auxiliary/fat_drop.rs b/src/test/ui/run-pass/extern/auxiliary/fat_drop.rs deleted file mode 100644 index 1f944b6ed32..00000000000 --- a/src/test/ui/run-pass/extern/auxiliary/fat_drop.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub static mut DROPPED: bool = false; - -pub struct S { - _unsized: [u8] -} - -impl Drop for S { - fn drop(&mut self) { - unsafe { - DROPPED = true; - } - } -} diff --git a/src/test/ui/run-pass/extern/extern-1.rs b/src/test/ui/run-pass/extern/extern-1.rs deleted file mode 100644 index c3168aaf869..00000000000 --- a/src/test/ui/run-pass/extern/extern-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern fn f() { -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/extern/extern-call-deep.rs b/src/test/ui/run-pass/extern/extern-call-deep.rs deleted file mode 100644 index 6e8d94becbd..00000000000 --- a/src/test/ui/run-pass/extern/extern-call-deep.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -extern crate libc; - -mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, - data: libc::uintptr_t) - -> libc::uintptr_t; - } -} - -extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1 { - data - } else { - count(data - 1) + 1 - } -} - -fn count(n: libc::uintptr_t) -> libc::uintptr_t { - unsafe { - println!("n = {}", n); - rustrt::rust_dbg_call(cb, n) - } -} - -pub fn main() { - let result = count(1000); - println!("result = {}", result); - assert_eq!(result, 1000); -} diff --git a/src/test/ui/run-pass/extern/extern-call-deep2.rs b/src/test/ui/run-pass/extern/extern-call-deep2.rs deleted file mode 100644 index e11e73a2b0f..00000000000 --- a/src/test/ui/run-pass/extern/extern-call-deep2.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(libc)] - -extern crate libc; -use std::thread; - -mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, - data: libc::uintptr_t) - -> libc::uintptr_t; - } -} - -extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1 { - data - } else { - count(data - 1) + 1 - } -} - -fn count(n: libc::uintptr_t) -> libc::uintptr_t { - unsafe { - println!("n = {}", n); - rustrt::rust_dbg_call(cb, n) - } -} - -pub fn main() { - // Make sure we're on a thread with small Rust stacks (main currently - // has a large stack) - thread::spawn(move|| { - let result = count(1000); - println!("result = {}", result); - assert_eq!(result, 1000); - }).join(); -} diff --git a/src/test/ui/run-pass/extern/extern-call-direct.rs b/src/test/ui/run-pass/extern/extern-call-direct.rs deleted file mode 100644 index 55300a44c1b..00000000000 --- a/src/test/ui/run-pass/extern/extern-call-direct.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test direct calls to extern fns. - - -extern fn f(x: usize) -> usize { x * 2 } - -pub fn main() { - let x = f(22); - assert_eq!(x, 44); -} diff --git a/src/test/ui/run-pass/extern/extern-call-indirect.rs b/src/test/ui/run-pass/extern/extern-call-indirect.rs deleted file mode 100644 index 1badb10364e..00000000000 --- a/src/test/ui/run-pass/extern/extern-call-indirect.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -extern crate libc; - -mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, - data: libc::uintptr_t) - -> libc::uintptr_t; - } -} - -extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1 { - data - } else { - fact(data - 1) * data - } -} - -fn fact(n: libc::uintptr_t) -> libc::uintptr_t { - unsafe { - println!("n = {}", n); - rustrt::rust_dbg_call(cb, n) - } -} - -pub fn main() { - let result = fact(10); - println!("result = {}", result); - assert_eq!(result, 3628800); -} diff --git a/src/test/ui/run-pass/extern/extern-call-scrub.rs b/src/test/ui/run-pass/extern/extern-call-scrub.rs deleted file mode 100644 index 1e564e66871..00000000000 --- a/src/test/ui/run-pass/extern/extern-call-scrub.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This time we're testing repeatedly going up and down both stacks to -// make sure the stack pointers are maintained properly in both -// directions - -// ignore-emscripten no threads support - -#![feature(libc)] - -extern crate libc; -use std::thread; - -mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t) -> libc::uintptr_t, - data: libc::uintptr_t) - -> libc::uintptr_t; - } -} - -extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1 { - data - } else { - count(data - 1) + count(data - 1) - } -} - -fn count(n: libc::uintptr_t) -> libc::uintptr_t { - unsafe { - println!("n = {}", n); - rustrt::rust_dbg_call(cb, n) - } -} - -pub fn main() { - // Make sure we're on a thread with small Rust stacks (main currently - // has a large stack) - thread::spawn(move|| { - let result = count(12); - println!("result = {}", result); - assert_eq!(result, 2048); - }).join(); -} diff --git a/src/test/ui/run-pass/extern/extern-calling-convention-test.rs b/src/test/ui/run-pass/extern/extern-calling-convention-test.rs deleted file mode 100644 index ed1657db759..00000000000 --- a/src/test/ui/run-pass/extern/extern-calling-convention-test.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:extern_calling_convention.rs - -// pretty-expanded FIXME #23616 - -extern crate extern_calling_convention; - -use extern_calling_convention::foo; - -pub fn main() { - foo(1, 2, 3, 4); -} diff --git a/src/test/ui/run-pass/extern/extern-compare-with-return-type.rs b/src/test/ui/run-pass/extern/extern-compare-with-return-type.rs deleted file mode 100644 index 451b87f575a..00000000000 --- a/src/test/ui/run-pass/extern/extern-compare-with-return-type.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that we can compare various kinds of extern fn signatures. -#![allow(non_camel_case_types)] - -extern fn voidret1() {} -extern fn voidret2() {} - -extern fn uintret() -> usize { 22 } - -extern fn uintvoidret(_x: usize) {} - -extern fn uintuintuintuintret(x: usize, y: usize, z: usize) -> usize { x+y+z } -type uintuintuintuintret = extern fn(usize,usize,usize) -> usize; - -pub fn main() { - assert!(voidret1 as extern fn() == voidret1 as extern fn()); - assert!(voidret1 as extern fn() != voidret2 as extern fn()); - - assert!(uintret as extern fn() -> usize == uintret as extern fn() -> usize); - - assert!(uintvoidret as extern fn(usize) == uintvoidret as extern fn(usize)); - - assert!(uintuintuintuintret as uintuintuintuintret == - uintuintuintuintret as uintuintuintuintret); -} diff --git a/src/test/ui/run-pass/extern/extern-crosscrate.rs b/src/test/ui/run-pass/extern/extern-crosscrate.rs deleted file mode 100644 index c6fccbe003c..00000000000 --- a/src/test/ui/run-pass/extern/extern-crosscrate.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:extern-crosscrate-source.rs -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -extern crate externcallback; -extern crate libc; - -fn fact(n: libc::uintptr_t) -> libc::uintptr_t { - unsafe { - println!("n = {}", n); - externcallback::rustrt::rust_dbg_call(externcallback::cb, n) - } -} - -pub fn main() { - let result = fact(10); - println!("result = {}", result); - assert_eq!(result, 3628800); -} diff --git a/src/test/ui/run-pass/extern/extern-foreign-crate.rs b/src/test/ui/run-pass/extern/extern-foreign-crate.rs deleted file mode 100644 index 615b07619c2..00000000000 --- a/src/test/ui/run-pass/extern/extern-foreign-crate.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern crate std as mystd; - -pub fn main() {} diff --git a/src/test/ui/run-pass/extern/extern-methods.rs b/src/test/ui/run-pass/extern/extern-methods.rs deleted file mode 100644 index 872391612ad..00000000000 --- a/src/test/ui/run-pass/extern/extern-methods.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-arm -// ignore-aarch64 - -trait A { - extern "fastcall" fn test1(i: i32); - extern fn test2(i: i32); -} - -struct S; -impl S { - extern "stdcall" fn test3(i: i32) { - assert_eq!(i, 3); - } -} - -impl A for S { - extern "fastcall" fn test1(i: i32) { - assert_eq!(i, 1); - } - extern fn test2(i: i32) { - assert_eq!(i, 2); - } -} - -fn main() { - ::test1(1); - ::test2(2); - S::test3(3); -} diff --git a/src/test/ui/run-pass/extern/extern-mod-abi.rs b/src/test/ui/run-pass/extern/extern-mod-abi.rs deleted file mode 100644 index fcff3ed251e..00000000000 --- a/src/test/ui/run-pass/extern/extern-mod-abi.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern "C" { - fn pow(x: f64, y: f64) -> f64; -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/extern/extern-mod-ordering-exe.rs b/src/test/ui/run-pass/extern/extern-mod-ordering-exe.rs deleted file mode 100644 index 42b8791f921..00000000000 --- a/src/test/ui/run-pass/extern/extern-mod-ordering-exe.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:extern_mod_ordering_lib.rs - -// pretty-expanded FIXME #23616 - -extern crate extern_mod_ordering_lib; - -use extern_mod_ordering_lib::extern_mod_ordering_lib as the_lib; - -pub fn main() { - the_lib::f(); -} diff --git a/src/test/ui/run-pass/extern/extern-pass-TwoU16s.rs b/src/test/ui/run-pass/extern/extern-pass-TwoU16s.rs deleted file mode 100644 index 042c27d0902..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-TwoU16s.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc for ffi testing - -// Test a foreign function that accepts and returns a struct -// by value. - -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct TwoU16s { - one: u16, two: u16 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_TwoU16s(v: TwoU16s) -> TwoU16s; -} - -pub fn main() { - unsafe { - let x = TwoU16s {one: 22, two: 23}; - let y = rust_dbg_extern_identity_TwoU16s(x); - assert_eq!(x, y); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-TwoU32s.rs b/src/test/ui/run-pass/extern/extern-pass-TwoU32s.rs deleted file mode 100644 index de1819a1fbd..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-TwoU32s.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc for ffi testing - -// Test a foreign function that accepts and returns a struct -// by value. - -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct TwoU32s { - one: u32, two: u32 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_TwoU32s(v: TwoU32s) -> TwoU32s; -} - -pub fn main() { - unsafe { - let x = TwoU32s {one: 22, two: 23}; - let y = rust_dbg_extern_identity_TwoU32s(x); - assert_eq!(x, y); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-TwoU64s.rs b/src/test/ui/run-pass/extern/extern-pass-TwoU64s.rs deleted file mode 100644 index 5e4b3823b14..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-TwoU64s.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc for ffi testing - -// Test a foreign function that accepts and returns a struct -// by value. - -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct TwoU64s { - one: u64, two: u64 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_TwoU64s(v: TwoU64s) -> TwoU64s; -} - -pub fn main() { - unsafe { - let x = TwoU64s {one: 22, two: 23}; - let y = rust_dbg_extern_identity_TwoU64s(x); - assert_eq!(x, y); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-TwoU8s.rs b/src/test/ui/run-pass/extern/extern-pass-TwoU8s.rs deleted file mode 100644 index affcf62af70..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-TwoU8s.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc for ffi testing - -// Test a foreign function that accepts and returns a struct -// by value. - -#[derive(Copy, Clone, PartialEq, Debug)] -pub struct TwoU8s { - one: u8, two: u8 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_TwoU8s(v: TwoU8s) -> TwoU8s; -} - -pub fn main() { - unsafe { - let x = TwoU8s {one: 22, two: 23}; - let y = rust_dbg_extern_identity_TwoU8s(x); - assert_eq!(x, y); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-char.rs b/src/test/ui/run-pass/extern/extern-pass-char.rs deleted file mode 100644 index 95999b8d983..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-char.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc for ffi testing - -// Test a function that takes/returns a u8. - - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_u8(v: u8) -> u8; -} - -pub fn main() { - unsafe { - assert_eq!(22, rust_dbg_extern_identity_u8(22)); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-double.rs b/src/test/ui/run-pass/extern/extern-pass-double.rs deleted file mode 100644 index ce94790c6d3..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-double.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc for ffi testing - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_double(v: f64) -> f64; -} - -pub fn main() { - unsafe { - assert_eq!(22.0_f64, rust_dbg_extern_identity_double(22.0_f64)); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-empty.rs b/src/test/ui/run-pass/extern/extern-pass-empty.rs deleted file mode 100644 index ff2e4e61a74..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-empty.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] // FIXME: this test is inherently not FFI-safe. - -// Test a foreign function that accepts empty struct. - -// pretty-expanded FIXME #23616 -// ignore-msvc -// ignore-emscripten emcc asserts on an empty struct as an argument - -#[repr(C)] -struct TwoU8s { - one: u8, - two: u8, -} - -#[repr(C)] -struct ManyInts { - arg1: i8, - arg2: i16, - arg3: i32, - arg4: i16, - arg5: i8, - arg6: TwoU8s, -} - -#[repr(C)] -struct Empty; - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - fn rust_dbg_extern_empty_struct(v1: ManyInts, e: Empty, v2: ManyInts); -} - -pub fn main() { - unsafe { - let x = ManyInts { - arg1: 2, - arg2: 3, - arg3: 4, - arg4: 5, - arg5: 6, - arg6: TwoU8s { one: 7, two: 8, } - }; - let y = ManyInts { - arg1: 1, - arg2: 2, - arg3: 3, - arg4: 4, - arg5: 5, - arg6: TwoU8s { one: 6, two: 7, } - }; - let empty = Empty; - rust_dbg_extern_empty_struct(x, empty, y); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-u32.rs b/src/test/ui/run-pass/extern/extern-pass-u32.rs deleted file mode 100644 index 9500ad391c7..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-u32.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc for ffi testing - -// Test a function that takes/returns a u32. - - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_u32(v: u32) -> u32; -} - -pub fn main() { - unsafe { - assert_eq!(22, rust_dbg_extern_identity_u32(22)); - } -} diff --git a/src/test/ui/run-pass/extern/extern-pass-u64.rs b/src/test/ui/run-pass/extern/extern-pass-u64.rs deleted file mode 100644 index bc4cf767087..00000000000 --- a/src/test/ui/run-pass/extern/extern-pass-u64.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc for ffi testing - -// Test a call to a function that takes/returns a u64. - - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_u64(v: u64) -> u64; -} - -pub fn main() { - unsafe { - assert_eq!(22, rust_dbg_extern_identity_u64(22)); - } -} diff --git a/src/test/ui/run-pass/extern/extern-prelude-core.rs b/src/test/ui/run-pass/extern/extern-prelude-core.rs deleted file mode 100644 index 67579fd9911..00000000000 --- a/src/test/ui/run-pass/extern/extern-prelude-core.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(extern_prelude, lang_items, start, alloc)] -#![no_std] - -extern crate std as other; - -mod foo { - pub fn test() { - let x = core::cmp::min(2, 3); - assert_eq!(x, 2); - } -} - -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - foo::test(); - 0 -} diff --git a/src/test/ui/run-pass/extern/extern-prelude-core.stderr b/src/test/ui/run-pass/extern/extern-prelude-core.stderr deleted file mode 100644 index f7699531857..00000000000 --- a/src/test/ui/run-pass/extern/extern-prelude-core.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/extern-prelude-core.rs:12:12 - | -LL | #![feature(extern_prelude, lang_items, start, alloc)] - | ^^^^^^^^^^^^^^ - | - = note: #[warn(stable_features)] on by default - diff --git a/src/test/ui/run-pass/extern/extern-prelude-no-speculative.rs b/src/test/ui/run-pass/extern/extern-prelude-no-speculative.rs deleted file mode 100644 index 8d4219ccf44..00000000000 --- a/src/test/ui/run-pass/extern/extern-prelude-no-speculative.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --extern LooksLikeExternCrate=/path/to/nowhere - -mod m { - pub struct LooksLikeExternCrate; -} - -fn main() { - // OK, speculative resolution for `unused_qualifications` doesn't try - // to resolve this as an extern crate and load that crate - let s = m::LooksLikeExternCrate {}; -} diff --git a/src/test/ui/run-pass/extern/extern-prelude-std.rs b/src/test/ui/run-pass/extern/extern-prelude-std.rs deleted file mode 100644 index 226635dcb7c..00000000000 --- a/src/test/ui/run-pass/extern/extern-prelude-std.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(extern_prelude)] - -mod foo { - pub fn test() { - let x = std::cmp::min(2, 3); - assert_eq!(x, 2); - } -} - -fn main() { - foo::test(); -} diff --git a/src/test/ui/run-pass/extern/extern-prelude-std.stderr b/src/test/ui/run-pass/extern/extern-prelude-std.stderr deleted file mode 100644 index 8c059b4ebeb..00000000000 --- a/src/test/ui/run-pass/extern/extern-prelude-std.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `extern_prelude` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/extern-prelude-std.rs:12:12 - | -LL | #![feature(extern_prelude)] - | ^^^^^^^^^^^^^^ - | - = note: #[warn(stable_features)] on by default - diff --git a/src/test/ui/run-pass/extern/extern-pub.rs b/src/test/ui/run-pass/extern/extern-pub.rs deleted file mode 100644 index dfe017d4c33..00000000000 --- a/src/test/ui/run-pass/extern/extern-pub.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern { - pub fn free(p: *const u8); -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/extern/extern-return-TwoU16s.rs b/src/test/ui/run-pass/extern/extern-return-TwoU16s.rs deleted file mode 100644 index 826b5083676..00000000000 --- a/src/test/ui/run-pass/extern/extern-return-TwoU16s.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc to test ffi with - -pub struct TwoU16s { - one: u16, two: u16 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_return_TwoU16s() -> TwoU16s; -} - -pub fn main() { - unsafe { - let y = rust_dbg_extern_return_TwoU16s(); - assert_eq!(y.one, 10); - assert_eq!(y.two, 20); - } -} diff --git a/src/test/ui/run-pass/extern/extern-return-TwoU32s.rs b/src/test/ui/run-pass/extern/extern-return-TwoU32s.rs deleted file mode 100644 index 15584f28d07..00000000000 --- a/src/test/ui/run-pass/extern/extern-return-TwoU32s.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc to test ffi with - -pub struct TwoU32s { - one: u32, two: u32 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_return_TwoU32s() -> TwoU32s; -} - -pub fn main() { - unsafe { - let y = rust_dbg_extern_return_TwoU32s(); - assert_eq!(y.one, 10); - assert_eq!(y.two, 20); - } -} diff --git a/src/test/ui/run-pass/extern/extern-return-TwoU64s.rs b/src/test/ui/run-pass/extern/extern-return-TwoU64s.rs deleted file mode 100644 index 94378522a1b..00000000000 --- a/src/test/ui/run-pass/extern/extern-return-TwoU64s.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc to test ffi with - -pub struct TwoU64s { - one: u64, two: u64 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_return_TwoU64s() -> TwoU64s; -} - -pub fn main() { - unsafe { - let y = rust_dbg_extern_return_TwoU64s(); - assert_eq!(y.one, 10); - assert_eq!(y.two, 20); - } -} diff --git a/src/test/ui/run-pass/extern/extern-return-TwoU8s.rs b/src/test/ui/run-pass/extern/extern-return-TwoU8s.rs deleted file mode 100644 index a66098c9774..00000000000 --- a/src/test/ui/run-pass/extern/extern-return-TwoU8s.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc to test ffi with - -pub struct TwoU8s { - one: u8, two: u8 -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_return_TwoU8s() -> TwoU8s; -} - -pub fn main() { - unsafe { - let y = rust_dbg_extern_return_TwoU8s(); - assert_eq!(y.one, 10); - assert_eq!(y.two, 20); - } -} diff --git a/src/test/ui/run-pass/extern/extern-rust.rs b/src/test/ui/run-pass/extern/extern-rust.rs deleted file mode 100644 index 8446d9c40c2..00000000000 --- a/src/test/ui/run-pass/extern/extern-rust.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[repr(C)] -pub struct Foo(u32); - -// ICE trigger, bad handling of differing types between rust and external ABIs -pub extern fn bar() -> Foo { - Foo(0) -} - -fn main() {} diff --git a/src/test/ui/run-pass/extern/extern-take-value.rs b/src/test/ui/run-pass/extern/extern-take-value.rs deleted file mode 100644 index 398a968ac18..00000000000 --- a/src/test/ui/run-pass/extern/extern-take-value.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:extern-take-value.rs - -extern crate extern_take_value; - -pub fn main() { - let a: extern "C" fn() -> i32 = extern_take_value::get_f(); - let b: extern "C" fn() -> i32 = extern_take_value::get_f(); - let c: extern "C" fn() -> i32 = extern_take_value::get_g(); - - assert!(a == b); - assert!(a != c); -} diff --git a/src/test/ui/run-pass/extern/extern-thiscall.rs b/src/test/ui/run-pass/extern/extern-thiscall.rs deleted file mode 100644 index 66aa261fecb..00000000000 --- a/src/test/ui/run-pass/extern/extern-thiscall.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-arm -// ignore-aarch64 - -#![feature(abi_thiscall)] - -trait A { - extern "thiscall" fn test1(i: i32); -} - -struct S; - -impl A for S { - extern "thiscall" fn test1(i: i32) { - assert_eq!(i, 1); - } -} - -extern "thiscall" fn test2(i: i32) { - assert_eq!(i, 2); -} - -fn main() { - ::test1(1); - test2(2); -} diff --git a/src/test/ui/run-pass/extern/extern-types-inherent-impl.rs b/src/test/ui/run-pass/extern/extern-types-inherent-impl.rs deleted file mode 100644 index efe55442e0b..00000000000 --- a/src/test/ui/run-pass/extern/extern-types-inherent-impl.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that inherent impls can be defined for extern types. - -#![feature(extern_types)] - -extern { - type A; -} - -impl A { - fn foo(&self) { } -} - -fn use_foo(x: &A) { - x.foo(); -} - -fn main() { } diff --git a/src/test/ui/run-pass/extern/extern-types-manual-sync-send.rs b/src/test/ui/run-pass/extern/extern-types-manual-sync-send.rs deleted file mode 100644 index 707516bd0de..00000000000 --- a/src/test/ui/run-pass/extern/extern-types-manual-sync-send.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that unsafe impl for Sync/Send can be provided for extern types. - -#![feature(extern_types)] - -extern { - type A; -} - -unsafe impl Sync for A { } -unsafe impl Send for A { } - -fn assert_sync() { } -fn assert_send() { } - -fn main() { - assert_sync::(); - assert_send::(); -} diff --git a/src/test/ui/run-pass/extern/extern-types-pointer-cast.rs b/src/test/ui/run-pass/extern/extern-types-pointer-cast.rs deleted file mode 100644 index 7905c7ba002..00000000000 --- a/src/test/ui/run-pass/extern/extern-types-pointer-cast.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that pointers to extern types can be cast from/to usize, -// despite being !Sized. - -#![feature(extern_types)] - -extern { - type A; -} - -struct Foo { - x: u8, - tail: A, -} - -struct Bar { - x: u8, - tail: T, -} - -#[cfg(target_pointer_width = "32")] -const MAGIC: usize = 0xdeadbeef; -#[cfg(target_pointer_width = "64")] -const MAGIC: usize = 0x12345678deadbeef; - -fn main() { - assert_eq!((MAGIC as *const A) as usize, MAGIC); - assert_eq!((MAGIC as *const Foo) as usize, MAGIC); - assert_eq!((MAGIC as *const Bar) as usize, MAGIC); - assert_eq!((MAGIC as *const Bar>) as usize, MAGIC); -} diff --git a/src/test/ui/run-pass/extern/extern-types-size_of_val.rs b/src/test/ui/run-pass/extern/extern-types-size_of_val.rs deleted file mode 100644 index 3f9e603f72e..00000000000 --- a/src/test/ui/run-pass/extern/extern-types-size_of_val.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(extern_types)] - -use std::mem::{size_of_val, align_of_val}; - -extern { - type A; -} - -fn main() { - let x: &A = unsafe { - &*(1usize as *const A) - }; - - assert_eq!(size_of_val(x), 0); - assert_eq!(align_of_val(x), 1); -} diff --git a/src/test/ui/run-pass/extern/extern-types-thin-pointer.rs b/src/test/ui/run-pass/extern/extern-types-thin-pointer.rs deleted file mode 100644 index 08fbadf3d2b..00000000000 --- a/src/test/ui/run-pass/extern/extern-types-thin-pointer.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that pointers and references to extern types are thin, ie they have the same size and -// alignment as a pointer to (). - -#![feature(extern_types)] - -use std::mem::{align_of, size_of}; - -extern { - type A; -} - -struct Foo { - x: u8, - tail: A, -} - -struct Bar { - x: u8, - tail: T, -} - -fn assert_thin() { - assert_eq!(size_of::<*const T>(), size_of::<*const ()>()); - assert_eq!(align_of::<*const T>(), align_of::<*const ()>()); - - assert_eq!(size_of::<*mut T>(), size_of::<*mut ()>()); - assert_eq!(align_of::<*mut T>(), align_of::<*mut ()>()); - - assert_eq!(size_of::<&T>(), size_of::<&()>()); - assert_eq!(align_of::<&T>(), align_of::<&()>()); - - assert_eq!(size_of::<&mut T>(), size_of::<&mut ()>()); - assert_eq!(align_of::<&mut T>(), align_of::<&mut ()>()); -} - -fn main() { - assert_thin::(); - assert_thin::(); - assert_thin::>(); - assert_thin::>>(); -} diff --git a/src/test/ui/run-pass/extern/extern-types-trait-impl.rs b/src/test/ui/run-pass/extern/extern-types-trait-impl.rs deleted file mode 100644 index b8eb4b6a98b..00000000000 --- a/src/test/ui/run-pass/extern/extern-types-trait-impl.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that traits can be implemented for extern types. - -#![feature(extern_types)] - -extern { - type A; -} - -trait Foo { - fn foo(&self) { } -} - -impl Foo for A { - fn foo(&self) { } -} - -fn assert_foo() { } - -fn use_foo(x: &Foo) { - x.foo(); -} - -fn main() { - assert_foo::(); -} diff --git a/src/test/ui/run-pass/extern/extern-vectorcall.rs b/src/test/ui/run-pass/extern/extern-vectorcall.rs deleted file mode 100644 index 00f453c7166..00000000000 --- a/src/test/ui/run-pass/extern/extern-vectorcall.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-arm -// ignore-aarch64 - -#![feature(abi_vectorcall)] - -trait A { - extern "vectorcall" fn test1(i: i32); -} - -struct S; - -impl A for S { - extern "vectorcall" fn test1(i: i32) { - assert_eq!(i, 1); - } -} - -extern "vectorcall" fn test2(i: i32) { - assert_eq!(i, 2); -} - -fn main() { - ::test1(1); - test2(2); -} diff --git a/src/test/ui/run-pass/extern/extern_fat_drop.rs b/src/test/ui/run-pass/extern/extern_fat_drop.rs deleted file mode 100644 index 0373abcda72..00000000000 --- a/src/test/ui/run-pass/extern/extern_fat_drop.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:fat_drop.rs - -extern crate fat_drop; - -fn main() { - unsafe { - let data: &mut [u8] = &mut [0]; - let s: &mut fat_drop::S = std::mem::transmute::<&mut [u8], _>(data); - std::ptr::drop_in_place(s); - assert!(fat_drop::DROPPED); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/auto-loop.rs b/src/test/ui/run-pass/for-loop-while/auto-loop.rs deleted file mode 100644 index 0bc046cbcb7..00000000000 --- a/src/test/ui/run-pass/for-loop-while/auto-loop.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let mut sum = 0; - let xs = vec![1, 2, 3, 4, 5]; - for x in &xs { - sum += *x; - } - assert_eq!(sum, 15); -} diff --git a/src/test/ui/run-pass/for-loop-while/break-value.rs b/src/test/ui/run-pass/for-loop-while/break-value.rs deleted file mode 100644 index c77e9a209dd..00000000000 --- a/src/test/ui/run-pass/for-loop-while/break-value.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn int_id(x: isize) -> isize { return x; } - -pub fn main() { loop { int_id(break); } } diff --git a/src/test/ui/run-pass/for-loop-while/break.rs b/src/test/ui/run-pass/for-loop-while/break.rs deleted file mode 100644 index cffec660104..00000000000 --- a/src/test/ui/run-pass/for-loop-while/break.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let mut i = 0; - while i < 20 { i += 1; if i == 10 { break; } } - assert_eq!(i, 10); - loop { i += 1; if i == 20 { break; } } - assert_eq!(i, 20); - let xs = [1, 2, 3, 4, 5, 6]; - for x in &xs { - if *x == 3 { break; } assert!((*x <= 3)); - } - i = 0; - while i < 10 { i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); } - i = 0; - loop { - i += 1; if i % 2 == 0 { continue; } assert!((i % 2 != 0)); - if i >= 10 { break; } - } - let ys = vec![1, 2, 3, 4, 5, 6]; - for x in &ys { - if *x % 2 == 0 { continue; } - assert!((*x % 2 != 0)); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/for-destruct.rs b/src/test/ui/run-pass/for-loop-while/for-destruct.rs deleted file mode 100644 index 97fa90530b6..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-destruct.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Pair { x: isize, y: isize } - -pub fn main() { - for elt in &(vec![Pair {x: 10, y: 20}, Pair {x: 30, y: 0}]) { - assert_eq!(elt.x + elt.y, 30); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-goofiness.rs b/src/test/ui/run-pass/for-loop-while/for-loop-goofiness.rs deleted file mode 100644 index ade51c4abbc..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-goofiness.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum BogusOption { - None, - Some(T), -} - -type Iterator = isize; - -pub fn main() { - let x = [ 3, 3, 3 ]; - for i in &x { - assert_eq!(*i, 3); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-has-unit-body.rs b/src/test/ui/run-pass/for-loop-while/for-loop-has-unit-body.rs deleted file mode 100644 index a94894a4798..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-has-unit-body.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - // Check that the tail statement in the body unifies with something - for _ in 0..3 { - unsafe { std::mem::uninitialized() } - } - - // Check that the tail statement in the body can be unit - for _ in 0..3 { - () - } -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-into-iterator.rs b/src/test/ui/run-pass/for-loop-while/for-loop-into-iterator.rs deleted file mode 100644 index ef116b9f3d7..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-into-iterator.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that for loops can do what RFC #235 claims - - -fn main() { - let mut v = vec![1]; - - for x in &v { - assert_eq!(x, &1); - } - - for x in &mut v { - assert_eq!(x, &mut 1); - } - - for x in v { - assert_eq!(x, 1); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs b/src/test/ui/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs deleted file mode 100644 index fb12a449a7a..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-lifetime-of-unbound-values.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test when destructors run in a for loop. The intention is -// that the value for each iteration is dropped *after* the loop -// body has executed. This is true even when the value is assigned -// to a `_` pattern (and hence ignored). - -use std::cell::Cell; - -struct Flag<'a>(&'a Cell); - -impl<'a> Drop for Flag<'a> { - fn drop(&mut self) { - self.0.set(false) - } -} - -fn main() { - let alive2 = Cell::new(true); - for _i in std::iter::once(Flag(&alive2)) { - // The Flag value should be alive in the for loop body - assert_eq!(alive2.get(), true); - } - // The Flag value should be dead outside of the loop - assert_eq!(alive2.get(), false); - - let alive = Cell::new(true); - for _ in std::iter::once(Flag(&alive)) { - // The Flag value should be alive in the for loop body even if it wasn't - // bound by the for loop - assert_eq!(alive.get(), true); - } - // The Flag value should be dead outside of the loop - assert_eq!(alive.get(), false); -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-macro.rs b/src/test/ui/run-pass/for-loop-while/for-loop-macro.rs deleted file mode 100644 index ac29efbb7c8..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-macro.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! var { - ( $name:ident ) => ( $name ); -} - -pub fn main() { - let x = [ 3, 3, 3 ]; - for var!(i) in &x { - assert_eq!(*i, 3); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-mut-ref-element.rs b/src/test/ui/run-pass/for-loop-while/for-loop-mut-ref-element.rs deleted file mode 100644 index e80f244bd26..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-mut-ref-element.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that for loops can bind elements as mutable references - -fn main() { - for ref mut _a in std::iter::once(true) {} -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-no-std.rs b/src/test/ui/run-pass/for-loop-while/for-loop-no-std.rs deleted file mode 100644 index dc03a500f8c..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-no-std.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(lang_items, start, alloc)] -#![no_std] - -extern crate std as other; - -#[macro_use] extern crate alloc; - -#[start] -fn start(_argc: isize, _argv: *const *const u8) -> isize { - for _ in [1,2,3].iter() { } - 0 -} diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-panic.rs b/src/test/ui/run-pass/for-loop-while/for-loop-panic.rs deleted file mode 100644 index 18c52237c2e..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-panic.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { let x: Vec = Vec::new(); for _ in &x { panic!("moop"); } } diff --git a/src/test/ui/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs b/src/test/ui/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs deleted file mode 100644 index 408900ea706..00000000000 --- a/src/test/ui/run-pass/for-loop-while/for-loop-unconstrained-element-type-i32-fallback.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the type of `sum` falls back to `i32` here, -// and that the for loop desugaring doesn't interfere with -// that. - -fn main() { - let mut sum = 0; - for i in Vec::new() { - sum += &i; - } -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-break.rs b/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-break.rs deleted file mode 100644 index 1668031cb89..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-break.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = [1; 100]; - let mut y = 0; - for i in &x[..] { - if y > 10 { - break; - } - y += *i; - } - assert_eq!(y, 11); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs b/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs deleted file mode 100644 index 15df3bed030..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap-break-restart.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::collections::HashMap; - -// This is a fancy one: it uses an external iterator established -// outside the loop, breaks, then _picks back up_ and continues -// iterating with it. - -pub fn main() { - let mut h = HashMap::new(); - let kvs = [(1, 10), (2, 20), (3, 30)]; - for &(k,v) in &kvs { - h.insert(k,v); - } - let mut x = 0; - let mut y = 0; - - let mut i = h.iter(); - - for (&k,&v) in i.by_ref() { - x += k; - y += v; - break; - } - - for (&k,&v) in i { - x += k; - y += v; - } - - assert_eq!(x, 6); - assert_eq!(y, 60); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs b/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs deleted file mode 100644 index 1364b4ca97c..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-hashmap.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::collections::HashMap; - -pub fn main() { - let mut h = HashMap::new(); - let kvs = [(1, 10), (2, 20), (3, 30)]; - for &(k,v) in &kvs { - h.insert(k,v); - } - let mut x = 0; - let mut y = 0; - for (&k,&v) in &h { - x += k; - y += v; - } - assert_eq!(x, 6); - assert_eq!(y, 60); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-loop.rs b/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-loop.rs deleted file mode 100644 index fe96bf1a3b7..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-loop.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = [1; 100]; - let mut y = 0; - for (n,i) in x.iter().enumerate() { - if n < 10 { - continue; - } - y += *i; - } - assert_eq!(y, 90); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-nested.rs b/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-nested.rs deleted file mode 100644 index 0465e321948..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators-nested.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = [1; 100]; - let y = [2; 100]; - let mut p = 0; - let mut q = 0; - for i in &x[..] { - for j in &y[..] { - p += *j; - } - q += *i + p; - } - assert_eq!(q, 1010100); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators.rs b/src/test/ui/run-pass/for-loop-while/foreach-external-iterators.rs deleted file mode 100644 index 906156c35f7..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-external-iterators.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = [1; 100]; - let mut y = 0; - for i in &x[..] { - y += *i - } - assert_eq!(y, 100); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-nested.rs b/src/test/ui/run-pass/for-loop-while/foreach-nested.rs deleted file mode 100644 index ca1da10a5df..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-nested.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn two(mut it: F) where F: FnMut(isize) { it(0); it(1); } - -pub fn main() { - let mut a: Vec = vec![-1, -1, -1, -1]; - let mut p: isize = 0; - two(|i| { - two(|j| { a[p as usize] = 10 * i + j; p += 1; }) - }); - assert_eq!(a[0], 0); - assert_eq!(a[1], 1); - assert_eq!(a[2], 10); - assert_eq!(a[3], 11); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-put-structured.rs b/src/test/ui/run-pass/for-loop-while/foreach-put-structured.rs deleted file mode 100644 index d8ccdd8959f..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-put-structured.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn pairs(mut it: F) where F: FnMut((isize, isize)) { - let mut i: isize = 0; - let mut j: isize = 0; - while i < 10 { it((i, j)); i += 1; j += i; } -} - -pub fn main() { - let mut i: isize = 10; - let mut j: isize = 0; - pairs(|p| { - let (_0, _1) = p; - println!("{}", _0); - println!("{}", _1); - assert_eq!(_0 + 10, i); - i += 1; - j = _1; - }); - assert_eq!(j, 45); -} diff --git a/src/test/ui/run-pass/for-loop-while/foreach-simple-outer-slot.rs b/src/test/ui/run-pass/for-loop-while/foreach-simple-outer-slot.rs deleted file mode 100644 index d00b7e9d0fc..00000000000 --- a/src/test/ui/run-pass/for-loop-while/foreach-simple-outer-slot.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let mut sum: isize = 0; - first_ten(|i| { println!("main"); println!("{}", i); sum = sum + i; }); - println!("sum"); - println!("{}", sum); - assert_eq!(sum, 45); -} - -fn first_ten(mut it: F) where F: FnMut(isize) { - let mut i: isize = 0; - while i < 10 { println!("first_ten"); it(i); i = i + 1; } -} diff --git a/src/test/ui/run-pass/for-loop-while/label_break_value.rs b/src/test/ui/run-pass/for-loop-while/label_break_value.rs deleted file mode 100644 index 831b23b03c3..00000000000 --- a/src/test/ui/run-pass/for-loop-while/label_break_value.rs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(label_break_value)] - -// Test control flow to follow label_break_value semantics -fn label_break(a: bool, b: bool) -> u32 { - let mut v = 0; - 'b: { - v = 1; - if a { - break 'b; - } - v = 2; - if b { - break 'b; - } - v = 3; - } - return v; -} - -// Test that values can be returned -fn break_value(a: bool, b: bool) -> u32 { - let result = 'block: { - if a { break 'block 1; } - if b { break 'block 2; } - 3 - }; - result -} - -// Test nesting of labeled blocks -// here we only check that it compiles -fn label_break_nested() { - 'b: { - println!("hi"); - if false { - break 'b; - } - 'c: { - if false { - break 'b; - } - break 'c; - } - println!("hello"); - if true { - break 'b; - } - } -} - -// Tests for mixing labeled blocks with loop constructs -// This function should be the identity function -fn label_break_mixed(v: u32) -> u32 { - let mut r = 0; - 'b: { - // Unlabeled break still works - // (only crossing boundaries is an error) - loop { - break; - } - if v == 0 { - break 'b; - } - // Labeled breaking an inner loop still works - 'c: loop { - if r == 1 { - break 'c; - } - r += 1; - } - assert_eq!(r, 1); - if v == 1 { - break 'b; - } - // Labeled breaking an outer loop still works - 'd: loop { - 'e: { - if v == r { - break 'b; - } - if r == 5 { - break 'd; - } - r += 1; - } - } - assert_eq!(r, 5); - assert!(v > r); - // Here we test return from inside a labeled block - return v; - } - r -} - -pub fn main() { - assert_eq!(label_break(true, false), 1); - assert_eq!(label_break(false, true), 2); - assert_eq!(label_break(false, false), 3); - - assert_eq!(break_value(true, false), 1); - assert_eq!(break_value(false, true), 2); - assert_eq!(break_value(false, false), 3); - - assert_eq!(label_break_mixed(0), 0); - assert_eq!(label_break_mixed(1), 1); - assert_eq!(label_break_mixed(2), 2); - assert_eq!(label_break_mixed(3), 3); - assert_eq!(label_break_mixed(4), 4); - assert_eq!(label_break_mixed(5), 5); - assert_eq!(label_break_mixed(6), 6); - - // FIXME: ensure that labeled blocks work if produced by macros and in match arms -} diff --git a/src/test/ui/run-pass/for-loop-while/labeled-break.rs b/src/test/ui/run-pass/for-loop-while/labeled-break.rs deleted file mode 100644 index d00b943313e..00000000000 --- a/src/test/ui/run-pass/for-loop-while/labeled-break.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - 'foo: loop { - loop { - break 'foo; - } - } - - 'bar: for _ in 0..100 { - loop { - break 'bar; - } - } - - 'foobar: while 1 + 1 == 2 { - loop { - break 'foobar; - } - } -} diff --git a/src/test/ui/run-pass/for-loop-while/linear-for-loop.rs b/src/test/ui/run-pass/for-loop-while/linear-for-loop.rs deleted file mode 100644 index e1a70822290..00000000000 --- a/src/test/ui/run-pass/for-loop-while/linear-for-loop.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let x = vec![1, 2, 3]; - let mut y = 0; - for i in &x { println!("{}", *i); y += *i; } - println!("{}", y); - assert_eq!(y, 6); - let s = "hello there".to_string(); - let mut i: isize = 0; - for c in s.bytes() { - if i == 0 { assert_eq!(c, 'h' as u8); } - if i == 1 { assert_eq!(c, 'e' as u8); } - if i == 2 { assert_eq!(c, 'l' as u8); } - if i == 3 { assert_eq!(c, 'l' as u8); } - if i == 4 { assert_eq!(c, 'o' as u8); } - // ... - - i += 1; - println!("{}", i); - println!("{}", c); - } - assert_eq!(i, 11); -} diff --git a/src/test/ui/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs b/src/test/ui/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs deleted file mode 100644 index fd0b234c7b3..00000000000 --- a/src/test/ui/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unreachable_code)] -#![allow(unused_variables)] - -fn test(_cond: bool) { - let v: isize; - v = 1; - loop { } // loop never terminates, so no error is reported - v = 2; -} - -pub fn main() { - // note: don't call test()... :) -} diff --git a/src/test/ui/run-pass/for-loop-while/liveness-loop-break.rs b/src/test/ui/run-pass/for-loop-while/liveness-loop-break.rs deleted file mode 100644 index 7323f9147fa..00000000000 --- a/src/test/ui/run-pass/for-loop-while/liveness-loop-break.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn test() { - let v; - loop { - v = 3; - break; - } - println!("{}", v); -} - -pub fn main() { - test(); -} diff --git a/src/test/ui/run-pass/for-loop-while/liveness-move-in-loop.rs b/src/test/ui/run-pass/for-loop-while/liveness-move-in-loop.rs deleted file mode 100644 index b5da1c1e221..00000000000 --- a/src/test/ui/run-pass/for-loop-while/liveness-move-in-loop.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -fn take(x: isize) -> isize {x} - -fn the_loop() { - let mut list = Vec::new(); - loop { - let x = 5; - if x > 3 { - list.push(take(x)); - } else { - break; - } - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/for-loop-while/loop-break-cont-1.rs b/src/test/ui/run-pass/for-loop-while/loop-break-cont-1.rs deleted file mode 100644 index f56b2b4ef4d..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-break-cont-1.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let _i = 0_usize; - loop { - break; - } - assert!(true); -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-break-cont.rs b/src/test/ui/run-pass/for-loop-while/loop-break-cont.rs deleted file mode 100644 index fb32132b493..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-break-cont.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let mut i = 0_usize; - loop { - println!("a"); - i += 1_usize; - if i == 10_usize { - break; - } - } - assert_eq!(i, 10_usize); - let mut is_even = false; - loop { - if i == 21_usize { - break; - } - println!("b"); - is_even = false; - i += 1_usize; - if i % 2_usize != 0_usize { - continue; - } - is_even = true; - } - assert!(!is_even); - loop { - println!("c"); - if i == 22_usize { - break; - } - is_even = false; - i += 1_usize; - if i % 2_usize != 0_usize { - continue; - } - is_even = true; - } - assert!(is_even); -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-break-value.rs b/src/test/ui/run-pass/for-loop-while/loop-break-value.rs deleted file mode 100644 index 9f23b4e93e6..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-break-value.rs +++ /dev/null @@ -1,147 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(never_type)] - -#[allow(unused)] -fn never_returns() { - loop { - break loop {}; - } -} - -pub fn main() { - let value = 'outer: loop { - if 1 == 1 { - break 13; - } else { - let _never: ! = loop { - break loop { - break 'outer panic!(); - } - }; - } - }; - assert_eq!(value, 13); - - let x = [1, 3u32, 5]; - let y = [17]; - let z = []; - let coerced: &[_] = loop { - match 2 { - 1 => break &x, - 2 => break &y, - 3 => break &z, - _ => (), - } - }; - assert_eq!(coerced, &[17u32]); - - let trait_unified = loop { - break if true { - break Default::default() - } else { - break [13, 14] - }; - }; - assert_eq!(trait_unified, [0, 0]); - - let trait_unified_2 = loop { - if false { - break [String::from("Hello")] - } else { - break Default::default() - }; - }; - assert_eq!(trait_unified_2, [""]); - - let trait_unified_3 = loop { - break if false { - break [String::from("Hello")] - } else { - ["Yes".into()] - }; - }; - assert_eq!(trait_unified_3, ["Yes"]); - - let regular_break = loop { - if true { - break; - } else { - break break Default::default(); - } - }; - assert_eq!(regular_break, ()); - - let regular_break_2 = loop { - if true { - break Default::default(); - } else { - break; - } - }; - assert_eq!(regular_break_2, ()); - - let regular_break_3 = loop { - break if true { - Default::default() - } else { - break; - } - }; - assert_eq!(regular_break_3, ()); - - let regular_break_4 = loop { - break (); - break; - }; - assert_eq!(regular_break_4, ()); - - let regular_break_5 = loop { - break; - break (); - }; - assert_eq!(regular_break_5, ()); - - let nested_break_value = 'outer2: loop { - let _a: u32 = 'inner: loop { - if true { - break 'outer2 "hello"; - } else { - break 'inner 17; - } - }; - panic!(); - }; - assert_eq!(nested_break_value, "hello"); - - let break_from_while_cond = loop { - 'inner_loop: while break 'inner_loop { - panic!(); - } - break 123; - }; - assert_eq!(break_from_while_cond, 123); - - let break_from_while_to_outer = 'outer_loop: loop { - while break 'outer_loop 567 { - panic!("from_inner"); - } - panic!("from outer"); - }; - assert_eq!(break_from_while_to_outer, 567); - - let rust = true; - let value = loop { - break rust; - }; - assert!(value); -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-diverges.rs b/src/test/ui/run-pass/for-loop-while/loop-diverges.rs deleted file mode 100644 index 86ff4c05438..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-diverges.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -/* Make sure a loop{} can be the tailexpr in the body -of a diverging function */ - -fn forever() -> ! { - loop{} -} - -pub fn main() { - if (1 == 2) { forever(); } -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-label-shadowing.rs b/src/test/ui/run-pass/for-loop-while/loop-label-shadowing.rs deleted file mode 100644 index 18cad7541aa..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-label-shadowing.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #12512. - -// pretty-expanded FIXME #23616 - -fn main() { - let mut foo = Vec::new(); - 'foo: for i in &[1, 2, 3] { - foo.push(*i); - } -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-labeled-break-value.rs b/src/test/ui/run-pass/for-loop-while/loop-labeled-break-value.rs deleted file mode 100644 index a8fe26abf9a..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-labeled-break-value.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - 'outer: loop { - let _: i32 = loop { break 'outer }; - } - 'outer2: loop { - let _: i32 = loop { loop { break 'outer2 } }; - } -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs b/src/test/ui/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs deleted file mode 100644 index 95bb8e8aa64..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-no-reinit-needed-post-bot.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct S; -// Ensure S is moved, not copied, on assignment. -impl Drop for S { fn drop(&mut self) { } } - -// user-defined function "returning" bottom (i.e. no return at all). -fn my_panic() -> ! { loop {} } - -pub fn step(f: bool) { - let mut g = S; - let mut i = 0; - loop - { - if i > 10 { break; } else { i += 1; } - - let _g = g; - - if f { - // re-initialize g, but only before restarting loop. - g = S; - continue; - } - - my_panic(); - - // we never get here, so we do not need to re-initialize g. - } -} - -pub fn main() { - step(true); -} diff --git a/src/test/ui/run-pass/for-loop-while/loop-scope.rs b/src/test/ui/run-pass/for-loop-while/loop-scope.rs deleted file mode 100644 index e8987b1a593..00000000000 --- a/src/test/ui/run-pass/for-loop-while/loop-scope.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = vec![10, 20, 30]; - let mut sum = 0; - for x in &x { sum += *x; } - assert_eq!(sum, 60); -} diff --git a/src/test/ui/run-pass/for-loop-while/while-cont.rs b/src/test/ui/run-pass/for-loop-while/while-cont.rs deleted file mode 100644 index 23d74f440ba..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-cont.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #825: Should recheck the loop condition after continuing -pub fn main() { - let mut i = 1; - while i > 0 { - assert!((i > 0)); - println!("{}", i); - i -= 1; - continue; - } -} diff --git a/src/test/ui/run-pass/for-loop-while/while-flow-graph.rs b/src/test/ui/run-pass/for-loop-while/while-flow-graph.rs deleted file mode 100644 index 9abdf45d18d..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-flow-graph.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -// pretty-expanded FIXME #23616 - -pub fn main() { let x: isize = 10; while x == 10 && x == 11 { let _y = 0xf00_usize; } } diff --git a/src/test/ui/run-pass/for-loop-while/while-label.rs b/src/test/ui/run-pass/for-loop-while/while-label.rs deleted file mode 100644 index da0cf295ba0..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-label.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let mut i = 100; - 'w: while 1 + 1 == 2 { - i -= 1; - if i == 95 { - break 'w; - panic!("Should have broken out of loop"); - } - } - assert_eq!(i, 95); -} diff --git a/src/test/ui/run-pass/for-loop-while/while-let.rs b/src/test/ui/run-pass/for-loop-while/while-let.rs deleted file mode 100644 index ea334df54c4..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-let.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::collections::BinaryHeap; - -fn make_pq() -> BinaryHeap { - BinaryHeap::from(vec![1,2,3]) -} - -pub fn main() { - let mut pq = make_pq(); - let mut sum = 0; - while let Some(x) = pq.pop() { - sum += x; - } - assert_eq!(sum, 6); - - pq = make_pq(); - sum = 0; - 'a: while let Some(x) = pq.pop() { - sum += x; - if x == 2 { - break 'a; - } - } - assert_eq!(sum, 5); - - pq = make_pq(); - sum = 0; - 'a2: while let Some(x) = pq.pop() { - if x == 3 { - continue 'a2; - } - sum += x; - } - assert_eq!(sum, 3); - - let mut pq1 = make_pq(); - sum = 0; - while let Some(x) = pq1.pop() { - let mut pq2 = make_pq(); - while let Some(y) = pq2.pop() { - sum += x * y; - } - } - assert_eq!(sum, 6 + 12 + 18); -} diff --git a/src/test/ui/run-pass/for-loop-while/while-loop-constraints-2.rs b/src/test/ui/run-pass/for-loop-while/while-loop-constraints-2.rs deleted file mode 100644 index 802f7be543a..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-loop-constraints-2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_variables)] - -pub fn main() { - let mut y: isize = 42; - let mut z: isize = 42; - let mut x: isize; - while z < 50 { - z += 1; - while false { x = y; y = z; } - println!("{}", y); - } - assert!((y == 42 && z == 50)); -} diff --git a/src/test/ui/run-pass/for-loop-while/while-prelude-drop.rs b/src/test/ui/run-pass/for-loop-while/while-prelude-drop.rs deleted file mode 100644 index 8c6c8994398..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-prelude-drop.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::string::String; - -#[derive(PartialEq)] -enum t { a, b(String), } - -fn make(i: isize) -> t { - if i > 10 { return t::a; } - let mut s = String::from("hello"); - // Ensure s is non-const. - - s.push_str("there"); - return t::b(s); -} - -pub fn main() { - let mut i = 0; - - - // The auto slot for the result of make(i) should not leak. - while make(i) != t::a { i += 1; } -} diff --git a/src/test/ui/run-pass/for-loop-while/while-with-break.rs b/src/test/ui/run-pass/for-loop-while/while-with-break.rs deleted file mode 100644 index 0981ce91f3c..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while-with-break.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let mut i: isize = 90; - while i < 100 { - println!("{}", i); - i = i + 1; - if i == 95 { - let _v: Vec = - vec![1, 2, 3, 4, 5]; // we check that it is freed by break - - println!("breaking"); - break; - } - } - assert_eq!(i, 95); -} diff --git a/src/test/ui/run-pass/for-loop-while/while.rs b/src/test/ui/run-pass/for-loop-while/while.rs deleted file mode 100644 index ba71ba1fd52..00000000000 --- a/src/test/ui/run-pass/for-loop-while/while.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let mut x: isize = 10; - let mut y: isize = 0; - while y < x { println!("{}", y); println!("hello"); y = y + 1; } - while x > 0 { - println!("goodbye"); - x = x - 1; - println!("{}", x); - } -} diff --git a/src/test/ui/run-pass/foreign/auxiliary/fn-abi.rs b/src/test/ui/run-pass/foreign/auxiliary/fn-abi.rs deleted file mode 100644 index 5d380ea6a5a..00000000000 --- a/src/test/ui/run-pass/foreign/auxiliary/fn-abi.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[no_mangle] -pub extern fn foo() {} diff --git a/src/test/ui/run-pass/foreign/auxiliary/foreign_lib.rs b/src/test/ui/run-pass/foreign/auxiliary/foreign_lib.rs deleted file mode 100644 index cef36274c62..00000000000 --- a/src/test/ui/run-pass/foreign/auxiliary/foreign_lib.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="foreign_lib"] - -#![feature(libc)] - -pub mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_get_test_int() -> libc::intptr_t; - } -} - -pub mod rustrt2 { - extern crate libc; - - extern { - pub fn rust_get_test_int() -> libc::intptr_t; - } -} - -pub mod rustrt3 { - // Different type, but same ABI (on all supported platforms). - // Ensures that we don't ICE or trigger LLVM asserts when - // importing the same symbol under different types. - // See https://github.com/rust-lang/rust/issues/32740. - extern { - pub fn rust_get_test_int() -> *const u8; - } -} - -pub fn local_uses() { - unsafe { - let x = rustrt::rust_get_test_int(); - assert_eq!(x, rustrt2::rust_get_test_int()); - assert_eq!(x as *const _, rustrt3::rust_get_test_int()); - } -} diff --git a/src/test/ui/run-pass/foreign/foreign-call-no-runtime.rs b/src/test/ui/run-pass/foreign/foreign-call-no-runtime.rs deleted file mode 100644 index 4837f78ce3b..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-call-no-runtime.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(libc)] - -extern crate libc; - -use std::mem; -use std::thread; - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - fn rust_dbg_call(cb: extern "C" fn(libc::uintptr_t), - data: libc::uintptr_t) -> libc::uintptr_t; -} - -pub fn main() { - unsafe { - thread::spawn(move|| { - let i: isize = 100; - rust_dbg_call(callback_isize, mem::transmute(&i)); - }).join().unwrap(); - - thread::spawn(move|| { - let i: i32 = 100; - rust_dbg_call(callback_i32, mem::transmute(&i)); - }).join().unwrap(); - - thread::spawn(move|| { - let i: i64 = 100; - rust_dbg_call(callback_i64, mem::transmute(&i)); - }).join().unwrap(); - } -} - -extern fn callback_isize(data: libc::uintptr_t) { - unsafe { - let data: *const isize = mem::transmute(data); - assert_eq!(*data, 100); - } -} - -extern fn callback_i64(data: libc::uintptr_t) { - unsafe { - let data: *const i64 = mem::transmute(data); - assert_eq!(*data, 100); - } -} - -extern fn callback_i32(data: libc::uintptr_t) { - unsafe { - let data: *const i32 = mem::transmute(data); - assert_eq!(*data, 100); - } -} diff --git a/src/test/ui/run-pass/foreign/foreign-dupe.rs b/src/test/ui/run-pass/foreign/foreign-dupe.rs deleted file mode 100644 index 296459c399f..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-dupe.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:foreign_lib.rs -// ignore-wasm32-bare no libc to test ffi with - -// Check that we can still call duplicated extern (imported) functions -// which were declared in another crate. See issues #32740 and #32783. - - -extern crate foreign_lib; - -pub fn main() { - unsafe { - let x = foreign_lib::rustrt::rust_get_test_int(); - assert_eq!(x, foreign_lib::rustrt2::rust_get_test_int()); - assert_eq!(x as *const _, foreign_lib::rustrt3::rust_get_test_int()); - } -} diff --git a/src/test/ui/run-pass/foreign/foreign-fn-linkname.rs b/src/test/ui/run-pass/foreign/foreign-fn-linkname.rs deleted file mode 100644 index 75876607603..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-fn-linkname.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -extern crate libc; -use std::ffi::CString; - -mod mlibc { - use libc::{c_char, size_t}; - - extern { - #[link_name = "strlen"] - pub fn my_strlen(str: *const c_char) -> size_t; - } -} - -fn strlen(str: String) -> usize { - // C string is terminated with a zero - let s = CString::new(str).unwrap(); - unsafe { - mlibc::my_strlen(s.as_ptr()) as usize - } -} - -pub fn main() { - let len = strlen("Rust".to_string()); - assert_eq!(len, 4); -} diff --git a/src/test/ui/run-pass/foreign/foreign-fn-with-byval.rs b/src/test/ui/run-pass/foreign/foreign-fn-with-byval.rs deleted file mode 100644 index 1c8d1bd2566..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-fn-with-byval.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc to test ffi with - -#[derive(Copy, Clone)] -pub struct S { - x: u64, - y: u64, - z: u64, -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn get_x(x: S) -> u64; - pub fn get_y(x: S) -> u64; - pub fn get_z(x: S) -> u64; -} - -#[inline(never)] -fn indirect_call(func: unsafe extern fn(s: S) -> u64, s: S) -> u64 { - unsafe { - func(s) - } -} - -fn main() { - let s = S { x: 1, y: 2, z: 3 }; - assert_eq!(s.x, indirect_call(get_x, s)); - assert_eq!(s.y, indirect_call(get_y, s)); - assert_eq!(s.z, indirect_call(get_z, s)); -} diff --git a/src/test/ui/run-pass/foreign/foreign-int-types.rs b/src/test/ui/run-pass/foreign/foreign-int-types.rs deleted file mode 100644 index d7bcf655990..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-int-types.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![forbid(improper_ctypes)] -#![allow(dead_code)] - -mod xx { - extern { - pub fn strlen(str: *const u8) -> usize; - pub fn foo(x: isize, y: usize); - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/foreign/foreign-mod-src/compiletest-ignore-dir b/src/test/ui/run-pass/foreign/foreign-mod-src/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/foreign/foreign-mod-src/inner.rs b/src/test/ui/run-pass/foreign/foreign-mod-src/inner.rs deleted file mode 100644 index 3c5f6ab8064..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-mod-src/inner.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let f = "Makefile"; - let s = rustrt.str_buf(f); - let buf = libc.malloc(1024); - let fd = libc.open(s, 0, 0); - libc.read(fd, buf, 1024); - libc.write(1, buf, 1024); - libc.close(fd); - libc.free(buf); -} diff --git a/src/test/ui/run-pass/foreign/foreign-mod-unused-const.rs b/src/test/ui/run-pass/foreign/foreign-mod-unused-const.rs deleted file mode 100644 index 61d537c692c..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-mod-unused-const.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod foo { - extern { - pub static errno: u32; - } -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/foreign/foreign-no-abi.rs b/src/test/ui/run-pass/foreign/foreign-no-abi.rs deleted file mode 100644 index 1d35f08a11f..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-no-abi.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ABI is cdecl by default - -// ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 - -#![feature(libc)] - -mod rustrt { - extern crate libc; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_get_test_int() -> libc::intptr_t; - } -} - -pub fn main() { - unsafe { - rustrt::rust_get_test_int(); - } -} diff --git a/src/test/ui/run-pass/foreign/foreign-src/compiletest-ignore-dir b/src/test/ui/run-pass/foreign/foreign-src/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/foreign/foreign-src/foreign.rs b/src/test/ui/run-pass/foreign/foreign-src/foreign.rs deleted file mode 100644 index 5cf8f5a22dd..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-src/foreign.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - libc.puts(rustrt.str_buf("hello, extern world 1")); - libc.puts(rustrt.str_buf("hello, extern world 2")); - libc.puts(rustrt.str_buf("hello, extern world 3")); -} diff --git a/src/test/ui/run-pass/foreign/foreign-truncated-arguments.rs b/src/test/ui/run-pass/foreign/foreign-truncated-arguments.rs deleted file mode 100644 index 5e7d4487382..00000000000 --- a/src/test/ui/run-pass/foreign/foreign-truncated-arguments.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -O -// Regression test for https://github.com/rust-lang/rust/issues/33868 - -#[repr(C)] -pub struct S { - a: u32, - b: f32, - c: u32 -} - -#[no_mangle] -#[inline(never)] -pub extern "C" fn test(s: S) -> u32 { - s.c -} - -fn main() { - assert_eq!(test(S{a: 0, b: 0.0, c: 42}), 42); -} diff --git a/src/test/ui/run-pass/foreign/foreign2.rs b/src/test/ui/run-pass/foreign/foreign2.rs deleted file mode 100644 index 307e6b182e7..00000000000 --- a/src/test/ui/run-pass/foreign/foreign2.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with -// pretty-expanded FIXME #23616 - -#![feature(libc)] - -extern crate libc; - -mod bar { - extern {} -} - -mod zed { - extern {} -} - -mod mlibc { - use libc::{c_int, c_void, size_t, ssize_t}; - - extern { - pub fn write(fd: c_int, buf: *const c_void, count: size_t) -> ssize_t; - } -} - -mod baz { - extern {} -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/functions-closures/auxiliary/fn-abi.rs b/src/test/ui/run-pass/functions-closures/auxiliary/fn-abi.rs deleted file mode 100644 index 5d380ea6a5a..00000000000 --- a/src/test/ui/run-pass/functions-closures/auxiliary/fn-abi.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[no_mangle] -pub extern fn foo() {} diff --git a/src/test/ui/run-pass/functions-closures/call-closure-from-overloaded-op.rs b/src/test/ui/run-pass/functions-closures/call-closure-from-overloaded-op.rs deleted file mode 100644 index d31420f338d..00000000000 --- a/src/test/ui/run-pass/functions-closures/call-closure-from-overloaded-op.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn foo() -> isize { 22 } - -pub fn main() { - let mut x: Vec isize> = Vec::new(); - x.push(foo); - assert_eq!((x[0])(), 22); -} diff --git a/src/test/ui/run-pass/functions-closures/capture-clauses-boxed-closures.rs b/src/test/ui/run-pass/functions-closures/capture-clauses-boxed-closures.rs deleted file mode 100644 index 21b71c9c380..00000000000 --- a/src/test/ui/run-pass/functions-closures/capture-clauses-boxed-closures.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn each(x: &[T], mut f: F) where F: FnMut(&T) { - for val in x { - f(val) - } -} - -fn main() { - let mut sum = 0_usize; - let elems = [ 1_usize, 2, 3, 4, 5 ]; - each(&elems, |val| sum += *val); - assert_eq!(sum, 15); -} diff --git a/src/test/ui/run-pass/functions-closures/capture-clauses-unboxed-closures.rs b/src/test/ui/run-pass/functions-closures/capture-clauses-unboxed-closures.rs deleted file mode 100644 index d18d8d37c02..00000000000 --- a/src/test/ui/run-pass/functions-closures/capture-clauses-unboxed-closures.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn each<'a,T,F:FnMut(&'a T)>(x: &'a [T], mut f: F) { - for val in x { - f(val) - } -} - -fn main() { - let mut sum = 0; - let elems = [ 1, 2, 3, 4, 5 ]; - each(&elems, |val: &usize| sum += *val); - assert_eq!(sum, 15); -} diff --git a/src/test/ui/run-pass/functions-closures/clone-closure.rs b/src/test/ui/run-pass/functions-closures/clone-closure.rs deleted file mode 100644 index 49350266a6e..00000000000 --- a/src/test/ui/run-pass/functions-closures/clone-closure.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that closures implement `Clone`. - -#[derive(Clone)] -struct S(i32); - -fn main() { - let mut a = S(5); - let mut hello = move || { - a.0 += 1; - println!("Hello {}", a.0); - a.0 - }; - - let mut hello2 = hello.clone(); - assert_eq!(6, hello2()); - assert_eq!(6, hello()); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-bounds-can-capture-chan.rs b/src/test/ui/run-pass/functions-closures/closure-bounds-can-capture-chan.rs deleted file mode 100644 index 7c1230d4e90..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-bounds-can-capture-chan.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::sync::mpsc::channel; - -fn foo(blk: F) { - blk(); -} - -pub fn main() { - let (tx, rx) = channel(); - foo(move || { - tx.send(()).unwrap(); - }); - rx.recv().unwrap(); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-expected-type/README.md b/src/test/ui/run-pass/functions-closures/closure-expected-type/README.md deleted file mode 100644 index fd493e1ff37..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-expected-type/README.md +++ /dev/null @@ -1,8 +0,0 @@ -Some tests targeted at how we deduce the types of closure arguments. -This process is a result of some heuristics aimed at combining the -*expected type* we have with the *actual types* that we get from -inputs. This investigation was kicked off by #38714, which revealed -some pretty deep flaws in the ad-hoc way that we were doing things -before. - -See also `src/test/compile-fail/closure-expected-type`. diff --git a/src/test/ui/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs b/src/test/ui/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs deleted file mode 100644 index a58b9ba567b..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn with_closure(_: F) - where F: FnOnce(Vec, A) -{ -} - -fn expect_free_supply_free<'x>(x: &'x u32) { - with_closure(|mut x: Vec<_>, y| { - // Shows that the call to `x.push()` is influencing type of `y`... - x.push(22_u32); - - // ...since we now know the type of `y` and can resolve the method call. - y.wrapping_add(1); - }); -} - -fn main() { } diff --git a/src/test/ui/run-pass/functions-closures/closure-expected-type/issue-38714.rs b/src/test/ui/run-pass/functions-closures/closure-expected-type/issue-38714.rs deleted file mode 100644 index 3304b2e2600..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-expected-type/issue-38714.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct UsizeRef<'a> { - a: &'a usize -} - -type RefTo = Box Fn(&'r Vec) -> UsizeRef<'r>>; - -fn ref_to<'a>(vec: &'a Vec) -> UsizeRef<'a> { - UsizeRef{ a: &vec[0]} -} - -fn main() { - // Regression test: this was causing ICEs; it should compile. - let a: RefTo = Box::new(|vec: &Vec| { - UsizeRef{ a: &vec[0] } - }); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs b/src/test/ui/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs deleted file mode 100644 index 30e81746db6..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-expected-type/supply-just-return-type.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn with_closure(f: F) -> Result - where F: FnOnce(&char) -> Result, -{ - f(&'a') -} - -fn main() { - // Test that supplying the `-> Result` manually here - // (which is needed to constrain `R`) still allows us to figure - // out that the type of `x` is `&'a char` where `'a` is bound in - // the closure (if we didn't, we'd get a type-error because - // `with_closure` requires a bound region). - // - // This pattern was found in the wild. - let z = with_closure(|x| -> Result { Ok(*x) }); - assert_eq!(z.unwrap(), 'a'); - - // It also works with `_`: - let z = with_closure(|x: _| -> Result { Ok(*x) }); - assert_eq!(z.unwrap(), 'a'); - - // It also works with `&_`: - let z = with_closure(|x: &_| -> Result { Ok(*x) }); - assert_eq!(z.unwrap(), 'a'); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-expected-type/supply-nothing.rs b/src/test/ui/run-pass/functions-closures/closure-expected-type/supply-nothing.rs deleted file mode 100644 index 9035bca50b9..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-expected-type/supply-nothing.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn with_closure(f: F) -> u32 - where F: FnOnce(&u32, &u32) -> u32 -{ - f(&22, &44) -} - -fn main() { - let z = with_closure(|x, y| x + y).wrapping_add(1); - assert_eq!(z, 22 + 44 + 1); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-immediate.rs b/src/test/ui/run-pass/functions-closures/closure-immediate.rs deleted file mode 100644 index 9a729532eff..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-immediate.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// After the work to reoptimize structs, it became possible for immediate logic to fail. -// This test verifies that it actually works. - -fn main() { - let c = |a: u8, b: u16, c: u8| { - assert_eq!(a, 1); - assert_eq!(b, 2); - assert_eq!(c, 3); - }; - c(1, 2, 3); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-inference.rs b/src/test/ui/run-pass/functions-closures/closure-inference.rs deleted file mode 100644 index e8554d27650..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-inference.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn foo(i: isize) -> isize { i + 1 } - -fn apply(f: F, v: A) -> A where F: FnOnce(A) -> A { f(v) } - -pub fn main() { - let f = {|i| foo(i)}; - assert_eq!(apply(f, 2), 3); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-inference2.rs b/src/test/ui/run-pass/functions-closures/closure-inference2.rs deleted file mode 100644 index 65da36e206b..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-inference2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a rather underspecified example: - - -pub fn main() { - let f = {|i| i}; - assert_eq!(f(2), 2); - assert_eq!(f(5), 5); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-reform.rs b/src/test/ui/run-pass/functions-closures/closure-reform.rs deleted file mode 100644 index 52e0e56026b..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-reform.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -/* Any copyright is dedicated to the Public Domain. - * http://creativecommons.org/publicdomain/zero/1.0/ */ - -fn call_it(f: F) - where F : FnOnce(String) -> String -{ - println!("{}", f("Fred".to_string())) -} - -fn call_a_thunk(f: F) where F: FnOnce() { - f(); -} - -fn call_this(f: F) where F: FnOnce(&str) + Send { - f("Hello!"); -} - -fn call_bare(f: fn(&str)) { - f("Hello world!") -} - -fn call_bare_again(f: extern "Rust" fn(&str)) { - f("Goodbye world!") -} - -pub fn main() { - // Procs - - let greeting = "Hello ".to_string(); - call_it(|s| { - format!("{}{}", greeting, s) - }); - - let greeting = "Goodbye ".to_string(); - call_it(|s| format!("{}{}", greeting, s)); - - let greeting = "How's life, ".to_string(); - call_it(|s: String| -> String { - format!("{}{}", greeting, s) - }); - - // Closures - - call_a_thunk(|| println!("Hello world!")); - - call_this(|s| println!("{}", s)); - - // External functions - - fn foo(s: &str) {} - call_bare(foo); - - call_bare_again(foo); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-returning-closure.rs b/src/test/ui/run-pass/functions-closures/closure-returning-closure.rs deleted file mode 100644 index 08e7ebe5588..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-returning-closure.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let f = |_||x, y| x+y; - assert_eq!(f(())(1, 2), 3); -} diff --git a/src/test/ui/run-pass/functions-closures/closure-to-fn-coercion.rs b/src/test/ui/run-pass/functions-closures/closure-to-fn-coercion.rs deleted file mode 100644 index 15a46f0eca5..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure-to-fn-coercion.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; - -const FOO: fn(u8) -> u8 = |v: u8| { v }; - -const BAR: [fn(&mut u32); 5] = [ - |_: &mut u32| {}, - |v: &mut u32| *v += 1, - |v: &mut u32| *v += 2, - |v: &mut u32| *v += 3, - |v: &mut u32| *v += 4, -]; -fn func_specific() -> (fn() -> u32) { - || return 42 -} - -fn generic(_: T) -> fn() -> usize { - || mem::size_of::() -} - -fn main() { - // Items - assert_eq!(func_specific()(), 42); - let foo: fn(u8) -> u8 = |v: u8| { v }; - assert_eq!(foo(31), 31); - // Constants - assert_eq!(FOO(31), 31); - let mut a: u32 = 0; - assert_eq!({ BAR[0](&mut a); a }, 0); - assert_eq!({ BAR[1](&mut a); a }, 1); - assert_eq!({ BAR[2](&mut a); a }, 3); - assert_eq!({ BAR[3](&mut a); a }, 6); - assert_eq!({ BAR[4](&mut a); a }, 10); - assert_eq!(generic(0i8)(), 1); -} diff --git a/src/test/ui/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs b/src/test/ui/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs deleted file mode 100644 index e2e2b325177..00000000000 --- a/src/test/ui/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensure that we deduce expected argument types when a `fn()` type is expected (#41755) - -fn foo(f: fn(Vec) -> usize) { } - -fn main() { - foo(|x| x.len()) -} diff --git a/src/test/ui/run-pass/functions-closures/copy-closure.rs b/src/test/ui/run-pass/functions-closures/copy-closure.rs deleted file mode 100644 index 73971431d58..00000000000 --- a/src/test/ui/run-pass/functions-closures/copy-closure.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that closures implement `Copy`. - -fn call T>(f: F) -> T { f() } - -fn main() { - let a = 5; - let hello = || { - println!("Hello {}", a); - a - }; - - assert_eq!(5, call(hello.clone())); - assert_eq!(5, call(hello)); - assert_eq!(5, call(hello)); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-abi.rs b/src/test/ui/run-pass/functions-closures/fn-abi.rs deleted file mode 100644 index 4e97dec2189..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-abi.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensure that declarations and types which use `extern fn` both have the same -// ABI (#9309). - -// pretty-expanded FIXME #23616 -// aux-build:fn-abi.rs - -extern crate fn_abi; - -extern { - fn foo(); -} - -pub fn main() { - // Will only type check if the type of _p and the decl of foo use the - // same ABI - let _p: unsafe extern fn() = foo; -} diff --git a/src/test/ui/run-pass/functions-closures/fn-bare-assign.rs b/src/test/ui/run-pass/functions-closures/fn-bare-assign.rs deleted file mode 100644 index 4bf83461ed2..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-bare-assign.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn f(i: isize, called: &mut bool) { - assert_eq!(i, 10); - *called = true; -} - -fn g(f: fn(isize, v: &mut bool), called: &mut bool) { - f(10, called); -} - -pub fn main() { - let mut called = false; - let h = f; - g(h, &mut called); - assert_eq!(called, true); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-bare-coerce-to-block.rs b/src/test/ui/run-pass/functions-closures/fn-bare-coerce-to-block.rs deleted file mode 100644 index 4aba898a768..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-bare-coerce-to-block.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn bare() {} - -fn likes_block(f: F) where F: FnOnce() { f() } - -pub fn main() { - likes_block(bare); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-bare-item.rs b/src/test/ui/run-pass/functions-closures/fn-bare-item.rs deleted file mode 100644 index 0a8241d6fce..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-bare-item.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn f() { - println!("This is a bare function"); -} - -pub fn main() { - f(); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-bare-size.rs b/src/test/ui/run-pass/functions-closures/fn-bare-size.rs deleted file mode 100644 index eff13b7521f..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-bare-size.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem; - -pub fn main() { - // Bare functions should just be a pointer - assert_eq!(mem::size_of::(), mem::size_of::()); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-bare-spawn.rs b/src/test/ui/run-pass/functions-closures/fn-bare-spawn.rs deleted file mode 100644 index 50dc51f82e6..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-bare-spawn.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is what the signature to spawn should look like with bare functions - - -fn spawn(val: T, f: fn(T)) { - f(val); -} - -fn f(i: isize) { - assert_eq!(i, 100); -} - -pub fn main() { - spawn(100, f); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-coerce-field.rs b/src/test/ui/run-pass/functions-closures/fn-coerce-field.rs deleted file mode 100644 index 5845af6b60d..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-coerce-field.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_camel_case_types)] - -struct r where F: FnOnce() { - field: F, -} - -pub fn main() { - fn f() {} - let _i: r = r {field: f as fn()}; -} diff --git a/src/test/ui/run-pass/functions-closures/fn-item-type-cast.rs b/src/test/ui/run-pass/functions-closures/fn-item-type-cast.rs deleted file mode 100644 index 0c032bd79fd..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-item-type-cast.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test explicit coercions from a fn item type to a fn pointer type. - - -fn foo(x: isize) -> isize { x * 2 } -fn bar(x: isize) -> isize { x * 4 } -type IntMap = fn(isize) -> isize; - -fn eq(x: T, y: T) { } - -static TEST: Option = Some(foo as IntMap); - -fn main() { - let f = foo as IntMap; - - let f = if true { foo as IntMap } else { bar as IntMap }; - assert_eq!(f(4), 8); - - eq(foo as IntMap, bar as IntMap); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-item-type-coerce.rs b/src/test/ui/run-pass/functions-closures/fn-item-type-coerce.rs deleted file mode 100644 index 3b0cd1ec1e5..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-item-type-coerce.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test implicit coercions from a fn item type to a fn pointer type. - -// pretty-expanded FIXME #23616 - -fn foo(x: isize) -> isize { x * 2 } -fn bar(x: isize) -> isize { x * 4 } -type IntMap = fn(isize) -> isize; - -fn eq(x: T, y: T) { } - -fn main() { - let f: IntMap = foo; - - eq::(foo, bar); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-item-type-zero-sized.rs b/src/test/ui/run-pass/functions-closures/fn-item-type-zero-sized.rs deleted file mode 100644 index 0e952fe2761..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-item-type-zero-sized.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that fn item types are zero-sized. - -use std::mem::{size_of, size_of_val}; - -fn main() { - assert_eq!(size_of_val(&main), 0); - - let (a, b) = (size_of::, size_of::); - assert_eq!(size_of_val(&a), 0); - assert_eq!(size_of_val(&b), 0); - assert_eq!((a(), b()), (1, 2)); -} diff --git a/src/test/ui/run-pass/functions-closures/fn-lval.rs b/src/test/ui/run-pass/functions-closures/fn-lval.rs deleted file mode 100644 index 806ae182256..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-lval.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -// pretty-expanded FIXME #23616 - -fn foo(_f: fn(isize) -> isize) { } - -fn id(x: isize) -> isize { return x; } - -pub fn main() { foo(id); } diff --git a/src/test/ui/run-pass/functions-closures/fn-type-infer.rs b/src/test/ui/run-pass/functions-closures/fn-type-infer.rs deleted file mode 100644 index 5eea37cdc8c..00000000000 --- a/src/test/ui/run-pass/functions-closures/fn-type-infer.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] - -pub fn main() { - // We should be able to type infer inside of ||s. - let _f = || { - let i = 10; - }; -} diff --git a/src/test/ui/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs b/src/test/ui/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs deleted file mode 100644 index 4277dcc149e..00000000000 --- a/src/test/ui/run-pass/functions-closures/implied-bounds-closure-arg-outlives.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to handle the relationships between free -// regions bound in a closure callback. - -#[derive(Copy, Clone)] -struct MyCx<'short, 'long: 'short> { - short: &'short u32, - long: &'long u32, -} - -impl<'short, 'long> MyCx<'short, 'long> { - fn short(self) -> &'short u32 { self.short } - fn long(self) -> &'long u32 { self.long } - fn set_short(&mut self, v: &'short u32) { self.short = v; } -} - -fn with(op: F) -> R -where - F: for<'short, 'long> FnOnce(MyCx<'short, 'long>) -> R, -{ - op(MyCx { - short: &22, - long: &22, - }) -} - -fn main() { - with(|mut cx| { - // For this to type-check, we need to be able to deduce that - // the lifetime of `l` can be `'short`, even though it has - // input from `'long`. - let l = if true { cx.long() } else { cx.short() }; - cx.set_short(l); - }); -} diff --git a/src/test/ui/run-pass/functions-closures/nullable-pointer-opt-closures.rs b/src/test/ui/run-pass/functions-closures/nullable-pointer-opt-closures.rs deleted file mode 100644 index 2122bb897a0..00000000000 --- a/src/test/ui/run-pass/functions-closures/nullable-pointer-opt-closures.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem; - -pub fn main() { - // By Ref Capture - let a = 10i32; - let b = Some(|| println!("{}", a)); - // When we capture by reference we can use any of the - // captures as the discriminant since they're all - // behind a pointer. - assert_eq!(mem::size_of_val(&b), mem::size_of::()); - - // By Value Capture - let a = Box::new(12i32); - let b = Some(move || println!("{}", a)); - // We captured `a` by value and since it's a `Box` we can use it - // as the discriminant. - assert_eq!(mem::size_of_val(&b), mem::size_of::>()); - - // By Value Capture - Transitive case - let a = "Hello".to_string(); // String -> Vec -> Unique -> NonZero - let b = Some(move || println!("{}", a)); - // We captured `a` by value and since down the chain it contains - // a `NonZero` field, we can use it as the discriminant. - assert_eq!(mem::size_of_val(&b), mem::size_of::()); - - // By Value - No Optimization - let a = 14i32; - let b = Some(move || println!("{}", a)); - // We captured `a` by value but we can't use it as the discriminant - // thus we end up with an extra field for the discriminant - assert_eq!(mem::size_of_val(&b), mem::size_of::<(i32, i32)>()); -} diff --git a/src/test/ui/run-pass/functions-closures/parallel-codegen-closures.rs b/src/test/ui/run-pass/functions-closures/parallel-codegen-closures.rs deleted file mode 100644 index 0b8604f66f9..00000000000 --- a/src/test/ui/run-pass/functions-closures/parallel-codegen-closures.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// Tests parallel codegen - this can fail if the symbol for the anonymous -// closure in `sum` pollutes the second codegen unit from the first. - -// ignore-bitrig -// compile-flags: -C codegen_units=2 - -#![feature(iter_arith)] - -mod a { - fn foo() { - let x = ["a", "bob", "c"]; - let len: usize = x.iter().map(|s| s.len()).sum(); - } -} - -mod b { - fn bar() { - let x = ["a", "bob", "c"]; - let len: usize = x.iter().map(|s| s.len()).sum(); - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/functions-closures/return-from-closure.rs b/src/test/ui/run-pass/functions-closures/return-from-closure.rs deleted file mode 100644 index c66bdb5fa8b..00000000000 --- a/src/test/ui/run-pass/functions-closures/return-from-closure.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] -// just to make sure that `return` is only returning from the closure, -// not the surrounding function. - -static mut calls: usize = 0; - -fn surrounding() { - let return_works = |n: isize| { - unsafe { calls += 1 } - - if n >= 0 { return; } - panic!() - }; - - return_works(10); - return_works(20); - - let return_works_proc = |n: isize| { - unsafe { calls += 1 } - - if n >= 0 { return; } - panic!() - }; - - return_works_proc(10); -} - -pub fn main() { - surrounding(); - - assert_eq!(unsafe {calls}, 3); -} diff --git a/src/test/ui/run-pass/generator/auxiliary/xcrate-reachable.rs b/src/test/ui/run-pass/generator/auxiliary/xcrate-reachable.rs deleted file mode 100644 index 91e43537cc2..00000000000 --- a/src/test/ui/run-pass/generator/auxiliary/xcrate-reachable.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(generators, generator_trait)] - -use std::ops::Generator; - -fn msg() -> u32 { - 0 -} - -pub fn foo() -> impl Generator { - || { - yield; - return msg(); - } -} diff --git a/src/test/ui/run-pass/generator/auxiliary/xcrate.rs b/src/test/ui/run-pass/generator/auxiliary/xcrate.rs deleted file mode 100644 index fcfe0b754b6..00000000000 --- a/src/test/ui/run-pass/generator/auxiliary/xcrate.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(generators, generator_trait)] - -use std::ops::Generator; - -pub fn foo() -> impl Generator { - || { - if false { - yield; - } - } -} - -pub fn bar(t: T) -> Box> { - Box::new(|| { - yield t; - }) -} diff --git a/src/test/ui/run-pass/generator/borrow-in-tail-expr.rs b/src/test/ui/run-pass/generator/borrow-in-tail-expr.rs deleted file mode 100644 index 3ac501d0117..00000000000 --- a/src/test/ui/run-pass/generator/borrow-in-tail-expr.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] - -fn main() { - let _a = || { - yield; - let a = String::new(); - a.len() - }; -} diff --git a/src/test/ui/run-pass/generator/conditional-drop.rs b/src/test/ui/run-pass/generator/conditional-drop.rs deleted file mode 100644 index ca8689ca842..00000000000 --- a/src/test/ui/run-pass/generator/conditional-drop.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::Generator; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; - -static A: AtomicUsize = ATOMIC_USIZE_INIT; - -struct B; - -impl Drop for B { - fn drop(&mut self) { - A.fetch_add(1, Ordering::SeqCst); - } -} - - -fn test() -> bool { true } -fn test2() -> bool { false } - -fn main() { - t1(); - t2(); -} - -fn t1() { - let mut a = || { - let b = B; - if test() { - drop(b); - } - yield; - }; - - let n = A.load(Ordering::SeqCst); - unsafe { a.resume() }; - assert_eq!(A.load(Ordering::SeqCst), n + 1); - unsafe { a.resume() }; - assert_eq!(A.load(Ordering::SeqCst), n + 1); -} - -fn t2() { - let mut a = || { - let b = B; - if test2() { - drop(b); - } - yield; - }; - - let n = A.load(Ordering::SeqCst); - unsafe { a.resume() }; - assert_eq!(A.load(Ordering::SeqCst), n); - unsafe { a.resume() }; - assert_eq!(A.load(Ordering::SeqCst), n + 1); -} diff --git a/src/test/ui/run-pass/generator/control-flow.rs b/src/test/ui/run-pass/generator/control-flow.rs deleted file mode 100644 index b1560b83cdc..00000000000 --- a/src/test/ui/run-pass/generator/control-flow.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::{GeneratorState, Generator}; - -fn finish(mut amt: usize, mut t: T) -> T::Return - where T: Generator -{ - loop { - match unsafe { t.resume() } { - GeneratorState::Yielded(()) => amt = amt.checked_sub(1).unwrap(), - GeneratorState::Complete(ret) => { - assert_eq!(amt, 0); - return ret - } - } - } - -} - -fn main() { - finish(1, || yield); - finish(8, || { - for _ in 0..8 { - yield; - } - }); - finish(1, || { - if true { - yield; - } else { - } - }); - finish(1, || { - if false { - } else { - yield; - } - }); - finish(2, || { - if { yield; false } { - yield; - panic!() - } - yield - }); -} diff --git a/src/test/ui/run-pass/generator/drop-env.rs b/src/test/ui/run-pass/generator/drop-env.rs deleted file mode 100644 index 9bdee027097..00000000000 --- a/src/test/ui/run-pass/generator/drop-env.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::Generator; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; - -static A: AtomicUsize = ATOMIC_USIZE_INIT; - -struct B; - -impl Drop for B { - fn drop(&mut self) { - A.fetch_add(1, Ordering::SeqCst); - } -} - -fn main() { - t1(); - t2(); - t3(); -} - -fn t1() { - let b = B; - let mut foo = || { - yield; - drop(b); - }; - - let n = A.load(Ordering::SeqCst); - drop(unsafe { foo.resume() }); - assert_eq!(A.load(Ordering::SeqCst), n); - drop(foo); - assert_eq!(A.load(Ordering::SeqCst), n + 1); -} - -fn t2() { - let b = B; - let mut foo = || { - yield b; - }; - - let n = A.load(Ordering::SeqCst); - drop(unsafe { foo.resume() }); - assert_eq!(A.load(Ordering::SeqCst), n + 1); - drop(foo); - assert_eq!(A.load(Ordering::SeqCst), n + 1); -} - -fn t3() { - let b = B; - let foo = || { - yield; - drop(b); - }; - - let n = A.load(Ordering::SeqCst); - assert_eq!(A.load(Ordering::SeqCst), n); - drop(foo); - assert_eq!(A.load(Ordering::SeqCst), n + 1); -} diff --git a/src/test/ui/run-pass/generator/issue-44197.rs b/src/test/ui/run-pass/generator/issue-44197.rs deleted file mode 100644 index 7ddc3c6e83c..00000000000 --- a/src/test/ui/run-pass/generator/issue-44197.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::{ Generator, GeneratorState }; - -fn foo(_: &str) -> String { - String::new() -} - -fn bar(baz: String) -> impl Generator { - move || { - yield foo(&baz); - } -} - -fn foo2(_: &str) -> Result { - Err(()) -} - -fn bar2(baz: String) -> impl Generator { - move || { - if let Ok(quux) = foo2(&baz) { - yield quux; - } - } -} - -fn main() { - unsafe { - assert_eq!(bar(String::new()).resume(), GeneratorState::Yielded(String::new())); - assert_eq!(bar2(String::new()).resume(), GeneratorState::Complete(())); - } -} diff --git a/src/test/ui/run-pass/generator/issue-52398.rs b/src/test/ui/run-pass/generator/issue-52398.rs deleted file mode 100644 index 9ed65a0eee0..00000000000 --- a/src/test/ui/run-pass/generator/issue-52398.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] - -use std::cell::RefCell; - -struct A; - -impl A { - fn test(&self, a: ()) {} -} - -fn main() { - // Test that the MIR local with type &A created for the auto-borrow adjustment - // is caught by typeck - move || { - A.test(yield); - }; - - // Test that the std::cell::Ref temporary returned from the `borrow` call - // is caught by typeck - let y = RefCell::new(true); - static move || { - yield *y.borrow(); - return "Done"; - }; -} diff --git a/src/test/ui/run-pass/generator/iterator-count.rs b/src/test/ui/run-pass/generator/iterator-count.rs deleted file mode 100644 index b9d877b6498..00000000000 --- a/src/test/ui/run-pass/generator/iterator-count.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::{GeneratorState, Generator}; - -struct W(T); - -// This impl isn't safe in general, but the generator used in this test is movable -// so it won't cause problems. -impl> Iterator for W { - type Item = T::Yield; - - fn next(&mut self) -> Option { - match unsafe { self.0.resume() } { - GeneratorState::Complete(..) => None, - GeneratorState::Yielded(v) => Some(v), - } - } -} - -fn test() -> impl Generator { - || { - for i in 1..6 { - yield i - } - } -} - -fn main() { - let end = 11; - - let closure_test = |start| { - move || { - for i in start..end { - yield i - } - } - }; - - assert!(W(test()).chain(W(closure_test(6))).eq(1..11)); -} diff --git a/src/test/ui/run-pass/generator/live-upvar-across-yield.rs b/src/test/ui/run-pass/generator/live-upvar-across-yield.rs deleted file mode 100644 index f560c521533..00000000000 --- a/src/test/ui/run-pass/generator/live-upvar-across-yield.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::Generator; - -fn main() { - let b = |_| 3; - let mut a = || { - b(yield); - }; - unsafe { a.resume() }; -} diff --git a/src/test/ui/run-pass/generator/match-bindings.rs b/src/test/ui/run-pass/generator/match-bindings.rs deleted file mode 100644 index 10d8bb8c9a7..00000000000 --- a/src/test/ui/run-pass/generator/match-bindings.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] - -enum Enum { - A(String), - B -} - -fn main() { - || { - loop { - if let true = true { - match Enum::A(String::new()) { - Enum::A(_var) => {} - Enum::B => {} - } - } - yield; - } - }; -} diff --git a/src/test/ui/run-pass/generator/nested_generators.rs b/src/test/ui/run-pass/generator/nested_generators.rs deleted file mode 100644 index e73f3f197db..00000000000 --- a/src/test/ui/run-pass/generator/nested_generators.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] -#![feature(generator_trait)] - -use std::ops::Generator; -use std::ops::GeneratorState; - -fn main() { - let _generator = || { - let mut sub_generator = || { - yield 2; - }; - - match unsafe { sub_generator.resume() } { - GeneratorState::Yielded(x) => { - yield x; - } - _ => panic!(), - }; - }; -} diff --git a/src/test/ui/run-pass/generator/panic-drops.rs b/src/test/ui/run-pass/generator/panic-drops.rs deleted file mode 100644 index 34efd43c505..00000000000 --- a/src/test/ui/run-pass/generator/panic-drops.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-wasm32-bare compiled as panic=abort by default - -#![feature(generators, generator_trait)] - -use std::ops::Generator; -use std::panic; -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; - -static A: AtomicUsize = ATOMIC_USIZE_INIT; - -struct B; - -impl Drop for B { - fn drop(&mut self) { - A.fetch_add(1, Ordering::SeqCst); - } -} - -fn bool_true() -> bool { - true -} - -fn main() { - let b = B; - let mut foo = || { - if bool_true() { - panic!(); - } - drop(b); - yield; - }; - - assert_eq!(A.load(Ordering::SeqCst), 0); - let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } - })); - assert!(res.is_err()); - assert_eq!(A.load(Ordering::SeqCst), 1); - - let mut foo = || { - if bool_true() { - panic!(); - } - drop(B); - yield; - }; - - assert_eq!(A.load(Ordering::SeqCst), 1); - let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } - })); - assert!(res.is_err()); - assert_eq!(A.load(Ordering::SeqCst), 1); -} diff --git a/src/test/ui/run-pass/generator/panic-safe.rs b/src/test/ui/run-pass/generator/panic-safe.rs deleted file mode 100644 index f1aa5de9689..00000000000 --- a/src/test/ui/run-pass/generator/panic-safe.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-wasm32-bare compiled with panic=abort by default - -#![feature(generators, generator_trait)] - -use std::ops::Generator; -use std::panic; - -fn main() { - let mut foo = || { - if true { - panic!(); - } - yield; - }; - - let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } - })); - assert!(res.is_err()); - - for _ in 0..10 { - let res = panic::catch_unwind(panic::AssertUnwindSafe(|| { - unsafe { foo.resume() } - })); - assert!(res.is_err()); - } -} diff --git a/src/test/ui/run-pass/generator/reborrow-mut-upvar.rs b/src/test/ui/run-pass/generator/reborrow-mut-upvar.rs deleted file mode 100644 index 582b5ad575b..00000000000 --- a/src/test/ui/run-pass/generator/reborrow-mut-upvar.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] - -fn _run(bar: &mut i32) { - || { - { - let _baz = &*bar; - yield; - } - - *bar = 2; - }; -} - -fn main() {} diff --git a/src/test/ui/run-pass/generator/resume-after-return.rs b/src/test/ui/run-pass/generator/resume-after-return.rs deleted file mode 100644 index 67c653f102d..00000000000 --- a/src/test/ui/run-pass/generator/resume-after-return.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-wasm32-bare compiled with panic=abort by default - -#![feature(generators, generator_trait)] - -use std::ops::{GeneratorState, Generator}; -use std::panic; - -fn main() { - let mut foo = || { - if true { - return - } - yield; - }; - - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } - - match panic::catch_unwind(move || unsafe { foo.resume() }) { - Ok(_) => panic!("generator successfully resumed"), - Err(_) => {} - } -} diff --git a/src/test/ui/run-pass/generator/smoke.rs b/src/test/ui/run-pass/generator/smoke.rs deleted file mode 100644 index 2651000e8b4..00000000000 --- a/src/test/ui/run-pass/generator/smoke.rs +++ /dev/null @@ -1,183 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-emscripten no threads support -// compile-flags: --test - -#![feature(generators, generator_trait)] - -use std::ops::{GeneratorState, Generator}; -use std::thread; - -#[test] -fn simple() { - let mut foo = || { - if false { - yield; - } - }; - - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } -} - -#[test] -fn return_capture() { - let a = String::from("foo"); - let mut foo = || { - if false { - yield; - } - a - }; - - match unsafe { foo.resume() } { - GeneratorState::Complete(ref s) if *s == "foo" => {} - s => panic!("bad state: {:?}", s), - } -} - -#[test] -fn simple_yield() { - let mut foo = || { - yield; - }; - - match unsafe { foo.resume() } { - GeneratorState::Yielded(()) => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } -} - -#[test] -fn yield_capture() { - let b = String::from("foo"); - let mut foo = || { - yield b; - }; - - match unsafe { foo.resume() } { - GeneratorState::Yielded(ref s) if *s == "foo" => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } -} - -#[test] -fn simple_yield_value() { - let mut foo = || { - yield String::from("bar"); - return String::from("foo") - }; - - match unsafe { foo.resume() } { - GeneratorState::Yielded(ref s) if *s == "bar" => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(ref s) if *s == "foo" => {} - s => panic!("bad state: {:?}", s), - } -} - -#[test] -fn return_after_yield() { - let a = String::from("foo"); - let mut foo = || { - yield; - return a - }; - - match unsafe { foo.resume() } { - GeneratorState::Yielded(()) => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(ref s) if *s == "foo" => {} - s => panic!("bad state: {:?}", s), - } -} - -#[test] -fn send_and_sync() { - assert_send_sync(|| { - yield - }); - assert_send_sync(|| { - yield String::from("foo"); - }); - assert_send_sync(|| { - yield; - return String::from("foo"); - }); - let a = 3; - assert_send_sync(|| { - yield a; - return - }); - let a = 3; - assert_send_sync(move || { - yield a; - return - }); - let a = String::from("a"); - assert_send_sync(|| { - yield ; - drop(a); - return - }); - let a = String::from("a"); - assert_send_sync(move || { - yield ; - drop(a); - return - }); - - fn assert_send_sync(_: T) {} -} - -#[test] -fn send_over_threads() { - let mut foo = || { yield }; - thread::spawn(move || { - match unsafe { foo.resume() } { - GeneratorState::Yielded(()) => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } - }).join().unwrap(); - - let a = String::from("a"); - let mut foo = || { yield a }; - thread::spawn(move || { - match unsafe { foo.resume() } { - GeneratorState::Yielded(ref s) if *s == "a" => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } - }).join().unwrap(); -} diff --git a/src/test/ui/run-pass/generator/static-generators.rs b/src/test/ui/run-pass/generator/static-generators.rs deleted file mode 100644 index 9c659b53a06..00000000000 --- a/src/test/ui/run-pass/generator/static-generators.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators, generator_trait)] - -use std::ops::{Generator, GeneratorState}; - -fn main() { - let mut generator = static || { - let a = true; - let b = &a; - yield; - assert_eq!(b as *const _, &a as *const _); - }; - unsafe { - assert_eq!(generator.resume(), GeneratorState::Yielded(())); - assert_eq!(generator.resume(), GeneratorState::Complete(())); - } -} diff --git a/src/test/ui/run-pass/generator/too-live-local-in-immovable-gen.rs b/src/test/ui/run-pass/generator/too-live-local-in-immovable-gen.rs deleted file mode 100644 index 81a5f571202..00000000000 --- a/src/test/ui/run-pass/generator/too-live-local-in-immovable-gen.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] - -fn main() { - unsafe { - static move || { - // Tests that the generator transformation finds out that `a` is not live - // during the yield expression. Type checking will also compute liveness - // and it should also find out that `a` is not live. - // The compiler will panic if the generator transformation finds that - // `a` is live and type checking finds it dead. - let a = { - yield (); - 4i32 - }; - &a; - }; - } -} diff --git a/src/test/ui/run-pass/generator/xcrate-reachable.rs b/src/test/ui/run-pass/generator/xcrate-reachable.rs deleted file mode 100644 index c14b3c3328a..00000000000 --- a/src/test/ui/run-pass/generator/xcrate-reachable.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:xcrate-reachable.rs - -#![feature(generator_trait)] - -extern crate xcrate_reachable as foo; - -use std::ops::Generator; - -fn main() { - unsafe { foo::foo().resume(); } -} diff --git a/src/test/ui/run-pass/generator/xcrate.rs b/src/test/ui/run-pass/generator/xcrate.rs deleted file mode 100644 index af4a84dd1db..00000000000 --- a/src/test/ui/run-pass/generator/xcrate.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:xcrate.rs - -#![feature(generators, generator_trait)] - -extern crate xcrate; - -use std::ops::{GeneratorState, Generator}; - -fn main() { - let mut foo = xcrate::foo(); - - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } - - let mut foo = xcrate::bar(3); - - match unsafe { foo.resume() } { - GeneratorState::Yielded(3) => {} - s => panic!("bad state: {:?}", s), - } - match unsafe { foo.resume() } { - GeneratorState::Complete(()) => {} - s => panic!("bad state: {:?}", s), - } -} diff --git a/src/test/ui/run-pass/generator/yield-in-args-rev.rs b/src/test/ui/run-pass/generator/yield-in-args-rev.rs deleted file mode 100644 index 3048b1225d3..00000000000 --- a/src/test/ui/run-pass/generator/yield-in-args-rev.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that a borrow that occurs after a yield in the same -// argument list is not treated as live across the yield by -// type-checking. - -#![feature(generators)] - -fn foo(_a: (), _b: &bool) {} - -fn bar() { - || { - let b = true; - foo(yield, &b); - }; -} - -fn main() { } diff --git a/src/test/ui/run-pass/generator/yield-in-box.rs b/src/test/ui/run-pass/generator/yield-in-box.rs deleted file mode 100644 index a5ba3a25e87..00000000000 --- a/src/test/ui/run-pass/generator/yield-in-box.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that box-statements with yields in them work. - -#![feature(generators, box_syntax)] - -fn main() { - let x = 0i32; - || { - let y = 2u32; - { - let _t = box (&x, yield 0, &y); - } - match box (&x, yield 0, &y) { - _t => {} - } - }; -} diff --git a/src/test/ui/run-pass/generator/yield-in-initializer.rs b/src/test/ui/run-pass/generator/yield-in-initializer.rs deleted file mode 100644 index 00045e6d3f6..00000000000 --- a/src/test/ui/run-pass/generator/yield-in-initializer.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(generators)] - -fn main() { - static || { - loop { - // Test that `opt` is not live across the yield, even when borrowed in a loop - // See https://github.com/rust-lang/rust/issues/52792 - let opt = { - yield; - true - }; - &opt; - } - }; -} diff --git a/src/test/ui/run-pass/generator/yield-subtype.rs b/src/test/ui/run-pass/generator/yield-subtype.rs deleted file mode 100644 index 62d3a59ab78..00000000000 --- a/src/test/ui/run-pass/generator/yield-subtype.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// revisions:lexical nll -//[nll]compile-flags: -Z disable-nll-user-type-assert -#![cfg_attr(nll, feature(nll))] - -#![feature(generators)] - -fn bar<'a>() { - let a: &'static str = "hi"; - let b: &'a str = a; - - || { - yield a; - yield b; - }; -} - -fn main() {} diff --git a/src/test/ui/run-pass/generics/auxiliary/default_type_params_xc.rs b/src/test/ui/run-pass/generics/auxiliary/default_type_params_xc.rs deleted file mode 100644 index fe852e5d8ea..00000000000 --- a/src/test/ui/run-pass/generics/auxiliary/default_type_params_xc.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Heap; - -pub struct FakeHeap; - -pub struct FakeVec { pub f: Option<(T,A)> } diff --git a/src/test/ui/run-pass/generics/generic-alias-unique.rs b/src/test/ui/run-pass/generics/generic-alias-unique.rs deleted file mode 100644 index a141ae049cc..00000000000 --- a/src/test/ui/run-pass/generics/generic-alias-unique.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn id(t: T) -> T { return t; } - -pub fn main() { - let expected: Box<_> = box 100; - let actual = id::>(expected.clone()); - println!("{}", *actual); - assert_eq!(*expected, *actual); -} diff --git a/src/test/ui/run-pass/generics/generic-default-type-params-cross-crate.rs b/src/test/ui/run-pass/generics/generic-default-type-params-cross-crate.rs deleted file mode 100644 index 762ea4c6760..00000000000 --- a/src/test/ui/run-pass/generics/generic-default-type-params-cross-crate.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:default_type_params_xc.rs - -// pretty-expanded FIXME #23616 - -extern crate default_type_params_xc; - -struct Vec(Option<(T,A)>); - -struct Foo; - -fn main() { - let _a = Vec::(None); - let _b = Vec::(None); - let _c = default_type_params_xc::FakeVec:: { f: None }; - let _d = default_type_params_xc::FakeVec:: { f: None }; -} diff --git a/src/test/ui/run-pass/generics/generic-default-type-params.rs b/src/test/ui/run-pass/generics/generic-default-type-params.rs deleted file mode 100644 index 6a5ae7b664f..00000000000 --- a/src/test/ui/run-pass/generics/generic-default-type-params.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - a: A -} - -impl Foo { - fn bar_int(&self) -> isize { - self.a - } -} - -impl Foo { - fn bar_char(&self) -> char { - self.a - } -} - -impl Foo { - fn bar(&self) { - let (i, c): (isize, char) = self.a; - assert_eq!(Foo { a: i }.bar_int(), i); - assert_eq!(Foo { a: c }.bar_char(), c); - } -} - -impl Foo { - fn baz(&self) -> A { - self.a.clone() - } -} - -fn default_foo(x: Foo) { - let (i, c): (isize, char) = x.a; - assert_eq!(i, 1); - assert_eq!(c, 'a'); - - x.bar(); - assert_eq!(x.baz(), (1, 'a')); -} - -#[derive(PartialEq, Debug)] -struct BazHelper(T); - -#[derive(PartialEq, Debug)] -// Ensure that we can use previous type parameters in defaults. -struct Baz, V = Option>(T, U, V); - -fn main() { - default_foo(Foo { a: (1, 'a') }); - - let x: Baz = Baz(true, BazHelper(false), Some(BazHelper(true))); - assert_eq!(x, Baz(true, BazHelper(false), Some(BazHelper(true)))); -} diff --git a/src/test/ui/run-pass/generics/generic-derived-type.rs b/src/test/ui/run-pass/generics/generic-derived-type.rs deleted file mode 100644 index 76f638ca75e..00000000000 --- a/src/test/ui/run-pass/generics/generic-derived-type.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn g(x: X) -> X { return x; } - -#[derive(Clone)] -struct Pair { - a: T, - b: T -} - -fn f(t: T) -> Pair { - let x: Pair = Pair {a: t.clone(), b: t}; - return g::>(x); -} - -pub fn main() { - let b = f::(10); - println!("{}" ,b.a); - println!("{}", b.b); - assert_eq!(b.a, 10); - assert_eq!(b.b, 10); -} diff --git a/src/test/ui/run-pass/generics/generic-exterior-unique.rs b/src/test/ui/run-pass/generics/generic-exterior-unique.rs deleted file mode 100644 index 960d578138f..00000000000 --- a/src/test/ui/run-pass/generics/generic-exterior-unique.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Recbox {x: Box} - -fn reclift(t: T) -> Recbox { return Recbox {x: box t}; } - -pub fn main() { - let foo: isize = 17; - let rbfoo: Recbox = reclift::(foo); - assert_eq!(*rbfoo.x, foo); -} diff --git a/src/test/ui/run-pass/generics/generic-extern-mangle.rs b/src/test/ui/run-pass/generics/generic-extern-mangle.rs deleted file mode 100644 index b935922a0cd..00000000000 --- a/src/test/ui/run-pass/generics/generic-extern-mangle.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Add; - -extern "C" fn foo(a: T, b: T) -> T::Output { a + b } - -fn main() { - assert_eq!(100u8, foo(0u8, 100u8)); - assert_eq!(100u16, foo(0u16, 100u16)); -} diff --git a/src/test/ui/run-pass/generics/generic-fn-infer.rs b/src/test/ui/run-pass/generics/generic-fn-infer.rs deleted file mode 100644 index 5db9228cc3c..00000000000 --- a/src/test/ui/run-pass/generics/generic-fn-infer.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -// Issue #45: infer type parameters in function applications - -fn id(x: T) -> T { return x; } - -pub fn main() { let x: isize = 42; let y: isize = id(x); assert_eq!(x, y); } diff --git a/src/test/ui/run-pass/generics/generic-fn-twice.rs b/src/test/ui/run-pass/generics/generic-fn-twice.rs deleted file mode 100644 index d385a153830..00000000000 --- a/src/test/ui/run-pass/generics/generic-fn-twice.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -// pretty-expanded FIXME #23616 - -mod foomod { - pub fn foo() { } -} - -pub fn main() { foomod::foo::(); foomod::foo::(); } diff --git a/src/test/ui/run-pass/generics/generic-fn-unique.rs b/src/test/ui/run-pass/generics/generic-fn-unique.rs deleted file mode 100644 index 0e0ffa63f61..00000000000 --- a/src/test/ui/run-pass/generics/generic-fn-unique.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f(x: Box) -> Box { return x; } - -pub fn main() { let x = f(box 3); println!("{}", *x); } diff --git a/src/test/ui/run-pass/generics/generic-fn.rs b/src/test/ui/run-pass/generics/generic-fn.rs deleted file mode 100644 index ae26ea1b155..00000000000 --- a/src/test/ui/run-pass/generics/generic-fn.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn id(x: T) -> T { return x; } - -#[derive(Copy, Clone)] -struct Triple {x: isize, y: isize, z: isize} - -pub fn main() { - let mut x = 62; - let mut y = 63; - let a = 'a'; - let mut b = 'b'; - let p: Triple = Triple {x: 65, y: 66, z: 67}; - let mut q: Triple = Triple {x: 68, y: 69, z: 70}; - y = id::(x); - println!("{}", y); - assert_eq!(x, y); - b = id::(a); - println!("{}", b); - assert_eq!(a, b); - q = id::(p); - x = p.z; - y = q.z; - println!("{}", y); - assert_eq!(x, y); -} diff --git a/src/test/ui/run-pass/generics/generic-ivec-leak.rs b/src/test/ui/run-pass/generics/generic-ivec-leak.rs deleted file mode 100644 index 555f5297dde..00000000000 --- a/src/test/ui/run-pass/generics/generic-ivec-leak.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -enum wrapper { wrapped(T), } - -pub fn main() { let _w = wrapper::wrapped(vec![1, 2, 3, 4, 5]); } diff --git a/src/test/ui/run-pass/generics/generic-newtype-struct.rs b/src/test/ui/run-pass/generics/generic-newtype-struct.rs deleted file mode 100644 index fc54a3bab54..00000000000 --- a/src/test/ui/run-pass/generics/generic-newtype-struct.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct S(T); - -pub fn main() { - let _s = S(2); -} diff --git a/src/test/ui/run-pass/generics/generic-object.rs b/src/test/ui/run-pass/generics/generic-object.rs deleted file mode 100644 index 4745b8d2cb8..00000000000 --- a/src/test/ui/run-pass/generics/generic-object.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -trait Foo { - fn get(&self) -> T; -} - -struct S { - x: isize -} - -impl Foo for S { - fn get(&self) -> isize { - self.x - } -} - -pub fn main() { - let x = box S { x: 1 }; - let y = x as Box>; - assert_eq!(y.get(), 1); -} diff --git a/src/test/ui/run-pass/generics/generic-recursive-tag.rs b/src/test/ui/run-pass/generics/generic-recursive-tag.rs deleted file mode 100644 index 3830177f0ad..00000000000 --- a/src/test/ui/run-pass/generics/generic-recursive-tag.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -enum list { cons(Box, Box>), nil, } - -pub fn main() { - let _a: list = - list::cons::(box 10, - box list::cons::(box 12, - box list::cons::(box 13, - box list::nil::))); -} diff --git a/src/test/ui/run-pass/generics/generic-static-methods.rs b/src/test/ui/run-pass/generics/generic-static-methods.rs deleted file mode 100644 index 2fe903866c2..00000000000 --- a/src/test/ui/run-pass/generics/generic-static-methods.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -trait vec_utils { - fn map_(x: &Self, f: F) -> Vec where F: FnMut(&T) -> U; -} - -impl vec_utils for Vec { - fn map_(x: &Vec , mut f: F) -> Vec where F: FnMut(&T) -> U { - let mut r = Vec::new(); - for elt in x { - r.push(f(elt)); - } - r - } -} - -pub fn main() { - assert_eq!(vec_utils::map_(&vec![1,2,3], |&x| x+1), [2,3,4]); -} diff --git a/src/test/ui/run-pass/generics/generic-tag-corruption.rs b/src/test/ui/run-pass/generics/generic-tag-corruption.rs deleted file mode 100644 index 6f02be5d106..00000000000 --- a/src/test/ui/run-pass/generics/generic-tag-corruption.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -// This used to cause memory corruption in stage 0. -// pretty-expanded FIXME #23616 - -enum thing { some(K), } - -pub fn main() { let _x = thing::some("hi".to_string()); } diff --git a/src/test/ui/run-pass/generics/generic-tag-local.rs b/src/test/ui/run-pass/generics/generic-tag-local.rs deleted file mode 100644 index a0429693fd9..00000000000 --- a/src/test/ui/run-pass/generics/generic-tag-local.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum clam { a(T), } - -pub fn main() { let _c = clam::a(3); } diff --git a/src/test/ui/run-pass/generics/generic-tag-match.rs b/src/test/ui/run-pass/generics/generic-tag-match.rs deleted file mode 100644 index 7f0bfe8ba31..00000000000 --- a/src/test/ui/run-pass/generics/generic-tag-match.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum foo { arm(T), } - -fn altfoo(f: foo) { - let mut hit = false; - match f { foo::arm::(_x) => { println!("in arm"); hit = true; } } - assert!((hit)); -} - -pub fn main() { altfoo::(foo::arm::(10)); } diff --git a/src/test/ui/run-pass/generics/generic-tag-values.rs b/src/test/ui/run-pass/generics/generic-tag-values.rs deleted file mode 100644 index 66a1268e2f8..00000000000 --- a/src/test/ui/run-pass/generics/generic-tag-values.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum noption { some(T), } - -struct Pair { x: isize, y: isize } - -pub fn main() { - let nop: noption = noption::some::(5); - match nop { noption::some::(n) => { println!("{}", n); assert_eq!(n, 5); } } - let nop2: noption = noption::some(Pair{x: 17, y: 42}); - match nop2 { - noption::some(t) => { - println!("{}", t.x); - println!("{}", t.y); - assert_eq!(t.x, 17); - assert_eq!(t.y, 42); - } - } -} diff --git a/src/test/ui/run-pass/generics/generic-tag.rs b/src/test/ui/run-pass/generics/generic-tag.rs deleted file mode 100644 index 54a006a163e..00000000000 --- a/src/test/ui/run-pass/generics/generic-tag.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] -#![feature(box_syntax)] - -enum option { some(Box), none, } - -pub fn main() { - let mut a: option = option::some::(box 10); - a = option::none::; -} diff --git a/src/test/ui/run-pass/generics/generic-temporary.rs b/src/test/ui/run-pass/generics/generic-temporary.rs deleted file mode 100644 index 32ff16710cf..00000000000 --- a/src/test/ui/run-pass/generics/generic-temporary.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn mk() -> isize { return 1; } - -fn chk(a: isize) { println!("{}", a); assert_eq!(a, 1); } - -fn apply(produce: fn() -> T, - consume: fn(T)) { - consume(produce()); -} - -pub fn main() { - let produce: fn() -> isize = mk; - let consume: fn(v: isize) = chk; - apply::(produce, consume); -} diff --git a/src/test/ui/run-pass/generics/generic-tup.rs b/src/test/ui/run-pass/generics/generic-tup.rs deleted file mode 100644 index 677e2f8349f..00000000000 --- a/src/test/ui/run-pass/generics/generic-tup.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn get_third(t: (T, T, T)) -> T { let (_, _, x) = t; return x; } - -pub fn main() { - println!("{}", get_third((1, 2, 3))); - assert_eq!(get_third((1, 2, 3)), 3); - assert_eq!(get_third((5u8, 6u8, 7u8)), 7u8); -} diff --git a/src/test/ui/run-pass/generics/generic-type-synonym.rs b/src/test/ui/run-pass/generics/generic-type-synonym.rs deleted file mode 100644 index 518480301b9..00000000000 --- a/src/test/ui/run-pass/generics/generic-type-synonym.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -// pretty-expanded FIXME #23616 - -struct Foo { - a: T -} - -type Bar = Foo; - -fn takebar(_b: Bar) { } - -pub fn main() { } diff --git a/src/test/ui/run-pass/generics/generic-type.rs b/src/test/ui/run-pass/generics/generic-type.rs deleted file mode 100644 index 4f83d437dc6..00000000000 --- a/src/test/ui/run-pass/generics/generic-type.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -struct Pair {x: T, y: T} - -pub fn main() { - let x: Pair = Pair {x: 10, y: 12}; - assert_eq!(x.x, 10); - assert_eq!(x.y, 12); -} diff --git a/src/test/ui/run-pass/generics/generic-unique.rs b/src/test/ui/run-pass/generics/generic-unique.rs deleted file mode 100644 index c21a0be3d39..00000000000 --- a/src/test/ui/run-pass/generics/generic-unique.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Triple { x: T, y: T, z: T } - -fn box_it(x: Triple) -> Box> { return box x; } - -pub fn main() { - let x: Box> = box_it::(Triple{x: 1, y: 2, z: 3}); - assert_eq!(x.y, 2); -} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs deleted file mode 100644 index 641912269a1..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we handle binder levels in object types correctly. -// Initially, the reference to `'tcx` in the object type -// `&Typer<'tcx>` was getting an incorrect binder level, yielding -// weird compilation ICEs and so forth. - -// pretty-expanded FIXME #23616 - -trait Typer<'tcx> { - fn method(&self, data: &'tcx isize) -> &'tcx isize { data } -} - -struct Tcx<'tcx> { - fields: &'tcx isize -} - -impl<'tcx> Typer<'tcx> for Tcx<'tcx> { -} - -fn g<'tcx>(typer: &Typer<'tcx>) { -} - -fn check_static_type<'x>(tcx: &Tcx<'x>) { - g(tcx) -} - -fn main() { } diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs deleted file mode 100644 index 19c7c8c489a..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Typer<'tcx> { - fn method(&self, data: &'tcx isize) -> &'tcx isize { data } - fn dummy(&self) { } -} - -fn g(_: F) where F: FnOnce(&Typer) {} - -fn h() { - g(|typer| typer.dummy()) -} - -fn main() { } diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs deleted file mode 100644 index bd61c42dd37..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait-object.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A basic test of using a higher-ranked trait bound. - - -trait FnLike { - fn call(&self, arg: A) -> R; -} - -type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b; - -struct Identity; - -impl<'a, T> FnLike<&'a T, &'a T> for Identity { - fn call(&self, arg: &'a T) -> &'a T { - arg - } -} - -fn call_repeatedly(f: &FnObject) { - let x = 3; - let y = f.call(&x); - assert_eq!(3, *y); -} - -fn main() { - call_repeatedly(&Identity); -} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs deleted file mode 100644 index 24ae5e1f343..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-fn-like-trait.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A basic test of using a higher-ranked trait bound. - - -trait FnLike { - fn call(&self, arg: A) -> R; -} - -struct Identity; - -impl<'a, T> FnLike<&'a T, &'a T> for Identity { - fn call(&self, arg: &'a T) -> &'a T { - arg - } -} - -fn call_repeatedly(f: F) - where F : for<'a> FnLike<&'a isize, &'a isize> -{ - let x = 3; - let y = f.call(&x); - assert_eq!(3, *y); -} - -fn main() { - call_repeatedly(Identity); -} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs deleted file mode 100644 index 3eafc5aabda..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-opt-in-copy.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we handle binder levels correctly when checking whether a -// type can implement `Copy`. In particular, we had a bug where we failed to -// liberate the late-bound regions from the impl, and thus wound up -// searching for an impl of `for<'tcx> Foo<&'tcx T>`. The impl that -// exists however is `impl Copy for Foo` and the current rules -// did not consider that a match (something I would like to revise in -// a later PR). - -#![allow(dead_code)] - -use std::marker::PhantomData; - -#[derive(Copy, Clone)] -struct Foo { x: T } - -type Ty<'tcx> = &'tcx TyS<'tcx>; - -enum TyS<'tcx> { - Boop(PhantomData<*mut &'tcx ()>) -} - -#[derive(Copy, Clone)] -enum Bar<'tcx> { - Baz(Foo>) -} - -fn main() { } diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-parse.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-parse.rs deleted file mode 100644 index cdc83b04788..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-parse.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can parse all the various places that a `for` keyword -// can appear representing universal quantification. - -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] -#![allow(dead_code)] - -trait Get { - fn get(&self, arg: A) -> R; -} - -// Parse HRTB with explicit `for` in a where-clause: - -fn foo00(t: T) - where T : for<'a> Get<&'a i32, &'a i32> -{ -} - -fn foo01 Get<&'a i32, &'a i32>>(t: T) -{ -} - -// Parse HRTB with explicit `for` in various sorts of types: - -fn foo10(t: Box Get>) { } -fn foo11(t: Box Fn(i32) -> i32>) { } - -fn foo20(t: for<'a> fn(i32) -> i32) { } -fn foo21(t: for<'a> unsafe fn(i32) -> i32) { } -fn foo22(t: for<'a> extern "C" fn(i32) -> i32) { } -fn foo23(t: for<'a> unsafe extern "C" fn(i32) -> i32) { } - -fn main() { -} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs deleted file mode 100644 index 32abdde39ab..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -// Test that `F : Fn(isize) -> isize + Send` is interpreted as two -// distinct bounds on `F`. - -fn foo1(f: F) - where F : FnOnce(isize) -> isize + Send -{ - bar(f); -} - -fn foo2(f: F) - where F : FnOnce(isize) -> isize + Send -{ - baz(f); -} - -fn bar(f: F) { } - -fn baz isize>(f: F) { } - -fn main() {} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs deleted file mode 100644 index 5d29115d35e..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -// Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) + -// 'static` and not `Fn(isize) -> (isize + 'static)`. The latter would -// cause a compilation error. Issue #18772. - -fn adder(y: isize) -> Box isize + 'static> { - Box::new(move |x| y + x) -} - -fn main() {} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs deleted file mode 100644 index 3f940cd4cd7..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A basic test of using a higher-ranked trait bound. - -// pretty-expanded FIXME #23616 - -trait FnLike { - fn call(&self, arg: A) -> R; -} - -type FnObject<'b> = for<'a> FnLike<&'a isize, &'a isize> + 'b; - -fn main() { -} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs deleted file mode 100644 index 5dc548fd341..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-paren-notation.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A basic test of using a higher-ranked trait bound. - -trait FnLike { - fn call(&self, arg: A) -> R; -} - -type FnObject<'b> = for<'a> FnLike<(&'a i32,), &'a i32> + 'b; - -struct Identity; - -impl<'a, T> FnLike<(&'a T,), &'a T> for Identity { - fn call(&self, (arg,): (&'a T,)) -> &'a T { - arg - } -} - -fn call_repeatedly(f: &FnObject) { - let x = 3; - let y = f.call((&x,)); - assert_eq!(3, *y); -} - -fn main() { - call_repeatedly(&Identity); -} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs deleted file mode 100644 index 2274fdc5684..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that `&PrinterSupport`, which is really short for `&'a -// PrinterSupport<'b>`, gets properly expanded when it appears in a -// closure type. This used to result in messed up De Bruijn indices. - -// pretty-expanded FIXME #23616 - -trait PrinterSupport<'ast> { - fn ast_map(&self) -> Option<&'ast usize> { None } -} - -struct NoAnn<'ast> { - f: Option<&'ast usize> -} - -impl<'ast> PrinterSupport<'ast> for NoAnn<'ast> { -} - -fn foo<'ast, G>(f: Option<&'ast usize>, g: G) where G: FnOnce(&PrinterSupport) { - let annotation = NoAnn { f: f }; - g(&annotation) -} - -fn main() {} diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs deleted file mode 100644 index f36533629cd..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test what happens when a HR obligation is applied to an impl with -// "outlives" bounds. Currently we're pretty conservative here; this -// will probably improve in time. - -trait Foo { - fn foo(&self, x: X) { } -} - -fn want_foo() - where T : for<'a> Foo<&'a isize> -{ -} - -/////////////////////////////////////////////////////////////////////////// -// Expressed as a where clause - -struct SomeStruct { - x: X -} - -impl<'a,X> Foo<&'a isize> for SomeStruct - where X : 'a -{ -} - -fn one() { - want_foo::>(); -} - -/////////////////////////////////////////////////////////////////////////// -// Expressed as shorthand - -struct AnotherStruct { - x: X -} - -impl<'a,X:'a> Foo<&'a isize> for AnotherStruct -{ -} - -fn two() { - want_foo::>(); -} - -fn main() { } diff --git a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs b/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs deleted file mode 100644 index 56af5df0105..00000000000 --- a/src/test/ui/run-pass/higher-rank-trait-bounds/hrtb-unboxed-closure-trait.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test HRTB used with the `Fn` trait. - -fn foo(f: F) { - let x = 22; - f(&x); -} - -fn main() { - foo(|x: &isize| println!("{}", *x)); -} diff --git a/src/test/ui/run-pass/hygiene/auxiliary/legacy_interaction.rs b/src/test/ui/run-pass/hygiene/auxiliary/legacy_interaction.rs deleted file mode 100644 index 75f81c56db2..00000000000 --- a/src/test/ui/run-pass/hygiene/auxiliary/legacy_interaction.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#[macro_export] -macro_rules! m { - () => { - fn f() {} // (2) - g(); // (1) - } -} diff --git a/src/test/ui/run-pass/hygiene/auxiliary/my_crate.rs b/src/test/ui/run-pass/hygiene/auxiliary/my_crate.rs deleted file mode 100644 index 10dbaa9e9ad..00000000000 --- a/src/test/ui/run-pass/hygiene/auxiliary/my_crate.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn f() {} diff --git a/src/test/ui/run-pass/hygiene/auxiliary/unhygienic_example.rs b/src/test/ui/run-pass/hygiene/auxiliary/unhygienic_example.rs deleted file mode 100644 index 589e8b579b7..00000000000 --- a/src/test/ui/run-pass/hygiene/auxiliary/unhygienic_example.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![crate_type = "lib"] - -extern crate my_crate; - -pub fn g() {} // (a) - -#[macro_export] -macro_rules! unhygienic_macro { - () => { - // (1) unhygienic: depends on `my_crate` in the crate root at the invocation site. - ::my_crate::f(); - - // (2) unhygienic: defines `f` at the invocation site (in addition to the above point). - use my_crate::f; - f(); - - g(); // (3) unhygienic: `g` needs to be in scope at use site. - - $crate::g(); // (4) hygienic: this always resolves to (a) - } -} - -#[allow(unused)] -fn test_unhygienic() { - unhygienic_macro!(); - f(); // `f` was defined at the use site -} diff --git a/src/test/ui/run-pass/hygiene/auxiliary/xcrate.rs b/src/test/ui/run-pass/hygiene/auxiliary/xcrate.rs deleted file mode 100644 index f469d87f423..00000000000 --- a/src/test/ui/run-pass/hygiene/auxiliary/xcrate.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(decl_macro)] -#![allow(unused)] - -pub use bar::test; - -extern crate std as foo; - -pub fn f() {} -use f as f2; - -mod bar { - pub fn g() {} - use baz::h; - - pub macro test() { - use std::mem; - use foo::cell; - ::f(); - ::f2(); - g(); - h(); - ::bar::h(); - } -} - -mod baz { - pub fn h() {} -} diff --git a/src/test/ui/run-pass/hygiene/hygiene-dodging-1.rs b/src/test/ui/run-pass/hygiene/hygiene-dodging-1.rs deleted file mode 100644 index bbb46d85d18..00000000000 --- a/src/test/ui/run-pass/hygiene/hygiene-dodging-1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod x { - pub fn g() -> usize {14} -} - -pub fn main(){ - // should *not* shadow the module x: - let x = 9; - // use it to avoid warnings: - x+3; - assert_eq!(x::g(),14); -} diff --git a/src/test/ui/run-pass/hygiene/hygiene.rs b/src/test/ui/run-pass/hygiene/hygiene.rs deleted file mode 100644 index c6b5f9c3974..00000000000 --- a/src/test/ui/run-pass/hygiene/hygiene.rs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused)] - -fn f() { - let x = 0; - macro_rules! foo { () => { - assert_eq!(x, 0); - } } - - let x = 1; - foo!(); -} - -fn g() { - let x = 0; - macro_rules! m { ($m1:ident, $m2:ident, $x:ident) => { - macro_rules! $m1 { () => { ($x, x) } } - let x = 1; - macro_rules! $m2 { () => { ($x, x) } } - } } - - let x = 2; - m!(m2, m3, x); - - let x = 3; - assert_eq!(m2!(), (2, 0)); - assert_eq!(m3!(), (2, 1)); - - let x = 4; - m!(m4, m5, x); - assert_eq!(m4!(), (4, 0)); - assert_eq!(m5!(), (4, 1)); -} - -mod foo { - macro_rules! m { - ($f:ident : |$x:ident| $e:expr) => { - pub fn $f() -> (i32, i32) { - let x = 0; - let $x = 1; - (x, $e) - } - } - } - - m!(f: |x| x + 10); -} - -fn interpolated_pattern() { - let x = 0; - macro_rules! m { - ($p:pat, $e:expr) => { - let $p = 1; - assert_eq!((x, $e), (0, 1)); - } - } - - m!(x, x); -} - -fn patterns_in_macro_generated_macros() { - let x = 0; - macro_rules! m { - ($a:expr, $b:expr) => { - assert_eq!(x, 0); - let x = $a; - macro_rules! n { - () => { - (x, $b) - } - } - } - } - - let x = 1; - m!(2, x); - - let x = 3; - assert_eq!(n!(), (2, 1)); -} - -fn match_hygiene() { - let x = 0; - - macro_rules! m { - ($p:pat, $e:expr) => { - for result in &[Ok(1), Err(1)] { - match *result { - $p => { assert_eq!(($e, x), (1, 0)); } - Err(x) => { assert_eq!(($e, x), (2, 1)); } - } - } - } - } - - let x = 2; - m!(Ok(x), x); -} - -fn label_hygiene() { - 'a: loop { - macro_rules! m { () => { break 'a; } } - m!(); - } -} - -fn main() { - f(); - g(); - assert_eq!(foo::f(), (0, 11)); - interpolated_pattern(); - patterns_in_macro_generated_macros(); - match_hygiene(); -} diff --git a/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.rs b/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.rs deleted file mode 100644 index d68809a1c6e..00000000000 --- a/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that labels injected by macros do not break hygiene. This -// checks cases where the macros invocations are under the rhs of a -// let statement. - -// Issue #24278: The label/lifetime shadowing checker from #24162 -// conservatively ignores hygiene, and thus issues warnings that are -// both true- and false-positives for this test. - -macro_rules! loop_x { - ($e: expr) => { - // $e shouldn't be able to interact with this 'x - 'x: loop { $e } - } -} - -macro_rules! while_true { - ($e: expr) => { - // $e shouldn't be able to interact with this 'x - 'x: while 1 + 1 == 2 { $e } - } -} - -macro_rules! run_once { - ($e: expr) => { - // ditto - 'x: for _ in 0..1 { $e } - } -} - -pub fn main() { - let mut i = 0; - - let j: isize = { - 'x: loop { - // this 'x should refer to the outer loop, lexically - loop_x!(break 'x); - i += 1; - } - i + 1 - }; - assert_eq!(j, 1); - - let k: isize = { - 'x: for _ in 0..1 { - // ditto - loop_x!(break 'x); - i += 1; - } - i + 1 - }; - assert_eq!(k, 1); - - let l: isize = { - 'x: for _ in 0..1 { - // ditto - while_true!(break 'x); - i += 1; - } - i + 1 - }; - assert_eq!(l, 1); - - let n: isize = { - 'x: for _ in 0..1 { - // ditto - run_once!(continue 'x); - i += 1; - } - i + 1 - }; - assert_eq!(n, 1); -} diff --git a/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr b/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr deleted file mode 100644 index d96b99746a7..00000000000 --- a/src/test/ui/run-pass/hygiene/hygienic-labels-in-let.stderr +++ /dev/null @@ -1,300 +0,0 @@ -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 - | -LL | 'x: loop { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -LL | // this 'x should refer to the outer loop, lexically -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:55:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:55:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 - | -LL | 'x: loop { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 - | -LL | 'x: loop { $e } - | ^^ - | | - | first declared here - | lifetime 'x already in scope -... -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 - | -LL | 'x: loop { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -LL | // ditto -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | while_true!(break 'x); - | ---------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | while_true!(break 'x); - | ---------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_true!(break 'x); - | ---------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | while_true!(break 'x); - | ---------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -LL | // ditto -LL | while_true!(break 'x); - | ---------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -LL | // ditto -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - diff --git a/src/test/ui/run-pass/hygiene/hygienic-labels.rs b/src/test/ui/run-pass/hygiene/hygienic-labels.rs deleted file mode 100644 index 723ffb30b7f..00000000000 --- a/src/test/ui/run-pass/hygiene/hygienic-labels.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that labels injected by macros do not break hygiene. - -// Issue #24278: The label/lifetime shadowing checker from #24162 -// conservatively ignores hygiene, and thus issues warnings that are -// both true- and false-positives for this test. - -macro_rules! loop_x { - ($e: expr) => { - // $e shouldn't be able to interact with this 'x - 'x: loop { $e } - } -} - -macro_rules! run_once { - ($e: expr) => { - // ditto - 'x: for _ in 0..1 { $e } - } -} - -macro_rules! while_x { - ($e: expr) => { - // ditto - 'x: while 1 + 1 == 2 { $e } - } -} - -pub fn main() { - 'x: for _ in 0..1 { - // this 'x should refer to the outer loop, lexically - loop_x!(break 'x); - panic!("break doesn't act hygienically inside for loop"); - } - - 'x: loop { - // ditto - loop_x!(break 'x); - panic!("break doesn't act hygienically inside infinite loop"); - } - - 'x: while 1 + 1 == 2 { - while_x!(break 'x); - panic!("break doesn't act hygienically inside infinite while loop"); - } - - 'x: for _ in 0..1 { - // ditto - run_once!(continue 'x); - panic!("continue doesn't act hygienically inside for loop"); - } -} diff --git a/src/test/ui/run-pass/hygiene/hygienic-labels.stderr b/src/test/ui/run-pass/hygiene/hygienic-labels.stderr deleted file mode 100644 index 45c0cacde9a..00000000000 --- a/src/test/ui/run-pass/hygiene/hygienic-labels.stderr +++ /dev/null @@ -1,299 +0,0 @@ -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 - | -LL | 'x: loop { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -LL | // this 'x should refer to the outer loop, lexically -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:46:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: loop { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:46:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: loop { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 - | -LL | 'x: loop { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 - | -LL | 'x: loop { $e } - | ^^ - | | - | first declared here - | lifetime 'x already in scope -... -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 - | -LL | 'x: loop { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -LL | // ditto -LL | loop_x!(break 'x); - | ------------------ in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | while_x!(break 'x); - | ------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | while_x!(break 'x); - | ------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | while_x!(break 'x); - | ------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 - | -LL | 'x: while 1 + 1 == 2 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -LL | while_x!(break 'x); - | ------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 - | -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 - | -LL | 'x: loop { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 - | -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 - | -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { - | ^^ lifetime 'x already in scope - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: loop { - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: loop { $e } - | -- first declared here -... -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: while 1 + 1 == 2 { - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: while 1 + 1 == 2 { $e } - | -- first declared here -... -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - -warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 - | -LL | 'x: for _ in 0..1 { $e } - | ^^ lifetime 'x already in scope -... -LL | 'x: for _ in 0..1 { - | -- first declared here -LL | // ditto -LL | run_once!(continue 'x); - | ----------------------- in this macro invocation - diff --git a/src/test/ui/run-pass/hygiene/issue-44128.rs b/src/test/ui/run-pass/hygiene/issue-44128.rs deleted file mode 100644 index 879cd851434..00000000000 --- a/src/test/ui/run-pass/hygiene/issue-44128.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(decl_macro)] - -pub macro create_struct($a:ident) { - struct $a; - impl Clone for $a { - fn clone(&self) -> Self { - $a - } - } -} - -fn main() { - create_struct!(Test); - Test.clone(); -} diff --git a/src/test/ui/run-pass/hygiene/issue-47311.rs b/src/test/ui/run-pass/hygiene/issue-47311.rs deleted file mode 100644 index 43c4fc747e7..00000000000 --- a/src/test/ui/run-pass/hygiene/issue-47311.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] -#![allow(unused)] - -macro m($S:ident, $x:ident) { - $S { $x: 0 } -} - -mod foo { - struct S { x: i32 } - - fn f() { ::m!(S, x); } -} - -fn main() {} diff --git a/src/test/ui/run-pass/hygiene/issue-47312.rs b/src/test/ui/run-pass/hygiene/issue-47312.rs deleted file mode 100644 index 68166912f5f..00000000000 --- a/src/test/ui/run-pass/hygiene/issue-47312.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] -#![allow(unused)] - -mod foo { - pub macro m($s:tt, $i:tt) { - $s.$i - } -} - -mod bar { - struct S(i32); - fn f() { - let s = S(0); - ::foo::m!(s, 0); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/hygiene/items.rs b/src/test/ui/run-pass/hygiene/items.rs deleted file mode 100644 index 1c215523892..00000000000 --- a/src/test/ui/run-pass/hygiene/items.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] - -pub macro m($foo:ident, $f:ident, $e:expr) { - mod foo { - pub fn f() -> u32 { 0 } - pub fn $f() -> u64 { 0 } - } - - mod $foo { - pub fn f() -> i32 { 0 } - pub fn $f() -> i64 { 0 } - } - - let _: u32 = foo::f(); - let _: u64 = foo::$f(); - let _: i32 = $foo::f(); - let _: i64 = $foo::$f(); - let _: i64 = $e; -} - -fn main() { - m!(foo, f, foo::f()); - let _: i64 = foo::f(); -} diff --git a/src/test/ui/run-pass/hygiene/legacy_interaction.rs b/src/test/ui/run-pass/hygiene/legacy_interaction.rs deleted file mode 100644 index d0845b5802b..00000000000 --- a/src/test/ui/run-pass/hygiene/legacy_interaction.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -// aux-build:legacy_interaction.rs - -#![feature(decl_macro)] -#[allow(unused)] - -extern crate legacy_interaction; -// ^ defines -// ```rust -// macro_rules! m { -// () => { -// fn f() // (1) -// g() // (2) -// } -// } -// ```rust - -mod def_site { - // Unless this macro opts out of hygiene, it should resolve the same wherever it is invoked. - pub macro m2() { - ::legacy_interaction::m!(); - f(); // This should resolve to (1) - fn g() {} // We want (2) resolve to this, not to (4) - } -} - -mod use_site { - fn test() { - fn f() -> bool { true } // (3) - fn g() -> bool { true } // (4) - - ::def_site::m2!(); - - let _: bool = f(); // This should resolve to (3) - let _: bool = g(); // This should resolve to (4) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/hygiene/lexical.rs b/src/test/ui/run-pass/hygiene/lexical.rs deleted file mode 100644 index 9dc116d3af7..00000000000 --- a/src/test/ui/run-pass/hygiene/lexical.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] - -mod bar { - mod baz { - pub fn f() {} - } - - pub macro m($f:ident) { - baz::f(); - let _: i32 = $f(); - { - fn $f() -> u32 { 0 } - let _: u32 = $f(); - } - } -} - -fn main() { - fn f() -> i32 { 0 } - bar::m!(f); -} diff --git a/src/test/ui/run-pass/hygiene/specialization.rs b/src/test/ui/run-pass/hygiene/specialization.rs deleted file mode 100644 index a1ab5b78ca0..00000000000 --- a/src/test/ui/run-pass/hygiene/specialization.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] - -trait Tr { - fn f(&self) -> &'static str { - "This shouldn't happen" - } -} - -pub macro m($t:ty) { - impl Tr for $t { - fn f(&self) -> &'static str { - "Run me" - } - } -} - -struct S; -m!(S); - -fn main() { - assert_eq!(S.f(), "Run me"); -} diff --git a/src/test/ui/run-pass/hygiene/trait_items.rs b/src/test/ui/run-pass/hygiene/trait_items.rs deleted file mode 100644 index 4007f5b5c8f..00000000000 --- a/src/test/ui/run-pass/hygiene/trait_items.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] - -macro m($T:ident, $f:ident) { - pub trait $T { - fn f(&self) -> u32 { 0 } - fn $f(&self) -> i32 { 0 } - } - impl $T for () {} - - let _: u32 = ().f(); - let _: i32 = ().$f(); -} - -fn main() { - m!(T, f); - let _: i32 = ().f(); -} diff --git a/src/test/ui/run-pass/hygiene/ty_params.rs b/src/test/ui/run-pass/hygiene/ty_params.rs deleted file mode 100644 index a057f2fc5ce..00000000000 --- a/src/test/ui/run-pass/hygiene/ty_params.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -#![feature(decl_macro)] - -macro m($T:ident) { - fn f(t: T, t2: $T) -> (T, $T) { - (t, t2) - } -} - -m!(T); - -fn main() {} diff --git a/src/test/ui/run-pass/hygiene/wrap_unhygienic_example.rs b/src/test/ui/run-pass/hygiene/wrap_unhygienic_example.rs deleted file mode 100644 index 9516bfe50b6..00000000000 --- a/src/test/ui/run-pass/hygiene/wrap_unhygienic_example.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -// aux-build:my_crate.rs -// aux-build:unhygienic_example.rs - -#![feature(decl_macro)] - -extern crate unhygienic_example; -extern crate my_crate; // (b) - -// Hygienic version of `unhygienic_macro`. -pub macro hygienic_macro() { - fn g() {} // (c) - ::unhygienic_example::unhygienic_macro!(); - // ^ Even though we invoke an unhygienic macro, `hygienic_macro` remains hygienic. - // In the above expansion: - // (1) `my_crate` always resolves to (b) regardless of invocation site. - // (2) The defined function `f` is only usable inside this macro definition. - // (3) `g` always resolves to (c) regardless of invocation site. - // (4) `$crate::g` remains hygienic and continues to resolve to (a). - - f(); -} - -#[allow(unused)] -fn test_hygienic_macro() { - hygienic_macro!(); - - fn f() {} // (d) no conflict - f(); // resolves to (d) -} - -fn main() {} diff --git a/src/test/ui/run-pass/hygiene/xcrate.rs b/src/test/ui/run-pass/hygiene/xcrate.rs deleted file mode 100644 index 3e330fe3862..00000000000 --- a/src/test/ui/run-pass/hygiene/xcrate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty pretty-printing is unhygienic - -// aux-build:xcrate.rs - -#![feature(decl_macro)] - -extern crate xcrate; - -fn main() { - xcrate::test!(); -} diff --git a/src/test/ui/run-pass/impl-trait/auto-trait-leak.rs b/src/test/ui/run-pass/impl-trait/auto-trait-leak.rs deleted file mode 100644 index fb252b01f85..00000000000 --- a/src/test/ui/run-pass/impl-trait/auto-trait-leak.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Fast path, main can see the concrete type returned. -fn before() -> impl FnMut(i32) { - let mut p = Box::new(0); - move |x| *p = x -} - -fn send(_: T) {} - -fn main() { - send(before()); - send(after()); -} - -// Deferred path, main has to wait until typeck finishes, -// to check if the return type of after is Send. -fn after() -> impl FnMut(i32) { - let mut p = Box::new(0); - move |x| *p = x -} diff --git a/src/test/ui/run-pass/impl-trait/auxiliary/xcrate.rs b/src/test/ui/run-pass/impl-trait/auxiliary/xcrate.rs deleted file mode 100644 index c57c1cfe74f..00000000000 --- a/src/test/ui/run-pass/impl-trait/auxiliary/xcrate.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// NOTE commented out due to issue #45994 -//pub fn fourway_add(a: i32) -> impl Fn(i32) -> impl Fn(i32) -> impl Fn(i32) -> i32 { -// move |b| move |c| move |d| a + b + c + d -//} - -fn some_internal_fn() -> u32 { - 1 -} - -fn other_internal_fn() -> u32 { - 1 -} - -// See #40839 -pub fn return_closure_accessing_internal_fn() -> impl Fn() -> u32 { - || { - some_internal_fn() + 1 - } -} - -pub fn return_internal_fn() -> impl Fn() -> u32 { - other_internal_fn -} diff --git a/src/test/ui/run-pass/impl-trait/bounds_regression.rs b/src/test/ui/run-pass/impl-trait/bounds_regression.rs deleted file mode 100644 index b6abfdebfa8..00000000000 --- a/src/test/ui/run-pass/impl-trait/bounds_regression.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub trait FakeGenerator { - type Yield; - type Return; -} - -pub trait FakeFuture { - type Output; -} - -pub fn future_from_generator< - T: FakeGenerator ->(x: T) -> impl FakeFuture { - GenFuture(x) -} - -struct GenFuture>(T); - -impl> FakeFuture for GenFuture { - type Output = T::Return; -} - -fn main() {} diff --git a/src/test/ui/run-pass/impl-trait/equality.rs b/src/test/ui/run-pass/impl-trait/equality.rs deleted file mode 100644 index 5026f10b6f8..00000000000 --- a/src/test/ui/run-pass/impl-trait/equality.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -trait Foo: std::fmt::Debug + Eq {} - -impl Foo for T {} - -fn hide(x: T) -> impl Foo { - x -} - -trait Leak: Sized { - fn leak(self) -> T; -} -impl Leak for U { - default fn leak(self) -> T { panic!("type mismatch") } -} -impl Leak for T { - fn leak(self) -> T { self } -} - -trait CheckIfSend: Sized { - type T: Default; - fn check(self) -> Self::T { Default::default() } -} -impl CheckIfSend for T { - default type T = (); -} -impl CheckIfSend for T { - type T = bool; -} - -fn lucky_seven() -> impl Fn(usize) -> u8 { - let a = [1, 2, 3, 4, 5, 6, 7]; - move |i| a[i] -} - -fn main() { - assert_eq!(hide(42), hide(42)); - - assert_eq!(std::mem::size_of_val(&hide([0_u8; 5])), 5); - assert_eq!(std::mem::size_of_val(&lucky_seven()), 7); - - assert_eq!(Leak::::leak(hide(5_i32)), 5_i32); - - assert_eq!(CheckIfSend::check(hide(0_i32)), false); -} diff --git a/src/test/ui/run-pass/impl-trait/example-calendar.rs b/src/test/ui/run-pass/impl-trait/example-calendar.rs deleted file mode 100644 index 6cf06d15621..00000000000 --- a/src/test/ui/run-pass/impl-trait/example-calendar.rs +++ /dev/null @@ -1,894 +0,0 @@ -// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// revisions: normal nll -//[nll] compile-flags:-Zborrowck=mir - -#![feature(fn_traits, - step_trait, - unboxed_closures, -)] - -//! Derived from: . -//! -//! Originally converted to Rust by [Daniel Keep](https://github.com/DanielKeep). - -use std::fmt::Write; -use std::mem; - -/// Date representation. -#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] -struct NaiveDate(i32, u32, u32); - -impl NaiveDate { - pub fn from_ymd(y: i32, m: u32, d: u32) -> NaiveDate { - assert!(1 <= m && m <= 12, "m = {:?}", m); - assert!(1 <= d && d <= NaiveDate(y, m, 1).days_in_month(), "d = {:?}", d); - NaiveDate(y, m, d) - } - - pub fn year(&self) -> i32 { - self.0 - } - - pub fn month(&self) -> u32 { - self.1 - } - - pub fn day(&self) -> u32 { - self.2 - } - - pub fn succ(&self) -> NaiveDate { - let (mut y, mut m, mut d, n) = ( - self.year(), self.month(), self.day()+1, self.days_in_month()); - if d > n { - d = 1; - m += 1; - } - if m > 12 { - m = 1; - y += 1; - } - NaiveDate::from_ymd(y, m, d) - } - - pub fn weekday(&self) -> Weekday { - use Weekday::*; - - // 0 = Sunday - let year = self.year(); - let dow_jan_1 = (year*365 + ((year-1) / 4) - ((year-1) / 100) + ((year-1) / 400)) % 7; - let dow = (dow_jan_1 + (self.day_of_year() as i32 - 1)) % 7; - [Sun, Mon, Tue, Wed, Thu, Fri, Sat][dow as usize] - } - - pub fn isoweekdate(&self) -> (i32, u32, Weekday) { - let first_dow_mon_0 = self.year_first_day_of_week().num_days_from_monday(); - - // Work out this date's DOtY and week number, not including year adjustment. - let doy_0 = self.day_of_year() - 1; - let mut week_mon_0: i32 = ((first_dow_mon_0 + doy_0) / 7) as i32; - - if self.first_week_in_prev_year() { - week_mon_0 -= 1; - } - - let weeks_in_year = self.last_week_number(); - - // Work out the final result. - // If the week is -1 or >= weeks_in_year, we will need to adjust the year. - let year = self.year(); - let wd = self.weekday(); - - if week_mon_0 < 0 { - (year - 1, NaiveDate::from_ymd(year - 1, 1, 1).last_week_number(), wd) - } else if week_mon_0 >= weeks_in_year as i32 { - (year + 1, (week_mon_0 + 1 - weeks_in_year as i32) as u32, wd) - } else { - (year, (week_mon_0 + 1) as u32, wd) - } - } - - fn first_week_in_prev_year(&self) -> bool { - let first_dow_mon_0 = self.year_first_day_of_week().num_days_from_monday(); - - // Any day in the year *before* the first Monday of that year - // is considered to be in the last week of the previous year, - // assuming the first week has *less* than four days in it. - // Adjust the week appropriately. - ((7 - first_dow_mon_0) % 7) < 4 - } - - fn year_first_day_of_week(&self) -> Weekday { - NaiveDate::from_ymd(self.year(), 1, 1).weekday() - } - - fn weeks_in_year(&self) -> u32 { - let days_in_last_week = self.year_first_day_of_week().num_days_from_monday() + 1; - if days_in_last_week >= 4 { 53 } else { 52 } - } - - fn last_week_number(&self) -> u32 { - let wiy = self.weeks_in_year(); - if self.first_week_in_prev_year() { wiy - 1 } else { wiy } - } - - fn day_of_year(&self) -> u32 { - (1..self.1).map(|m| NaiveDate::from_ymd(self.year(), m, 1).days_in_month()) - .fold(0, |a,b| a+b) + self.day() - } - - fn is_leap_year(&self) -> bool { - let year = self.year(); - if year % 4 != 0 { - return false - } else if year % 100 != 0 { - return true - } else if year % 400 != 0 { - return false - } else { - return true - } - } - - fn days_in_month(&self) -> u32 { - match self.month() { - /* Jan */ 1 => 31, - /* Feb */ 2 => if self.is_leap_year() { 29 } else { 28 }, - /* Mar */ 3 => 31, - /* Apr */ 4 => 30, - /* May */ 5 => 31, - /* Jun */ 6 => 30, - /* Jul */ 7 => 31, - /* Aug */ 8 => 31, - /* Sep */ 9 => 30, - /* Oct */ 10 => 31, - /* Nov */ 11 => 30, - /* Dec */ 12 => 31, - _ => unreachable!() - } - } -} - -impl<'a, 'b> std::ops::Add<&'b NaiveDate> for &'a NaiveDate { - type Output = NaiveDate; - - fn add(self, other: &'b NaiveDate) -> NaiveDate { - assert_eq!(*other, NaiveDate(0, 0, 1)); - self.succ() - } -} - -impl std::iter::Step for NaiveDate { - fn steps_between(_: &Self, _: &Self) -> Option { - unimplemented!() - } - - fn replace_one(&mut self) -> Self { - mem::replace(self, NaiveDate(0, 0, 1)) - } - - fn replace_zero(&mut self) -> Self { - mem::replace(self, NaiveDate(0, 0, 0)) - } - - fn add_one(&self) -> Self { - self.succ() - } - - fn sub_one(&self) -> Self { - unimplemented!() - } - - fn add_usize(&self, _: usize) -> Option { - unimplemented!() - } -} - -#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] -pub enum Weekday { - Mon, - Tue, - Wed, - Thu, - Fri, - Sat, - Sun, -} - -impl Weekday { - pub fn num_days_from_monday(&self) -> u32 { - use Weekday::*; - match *self { - Mon => 0, - Tue => 1, - Wed => 2, - Thu => 3, - Fri => 4, - Sat => 5, - Sun => 6, - } - } - - pub fn num_days_from_sunday(&self) -> u32 { - use Weekday::*; - match *self { - Sun => 0, - Mon => 1, - Tue => 2, - Wed => 3, - Thu => 4, - Fri => 5, - Sat => 6, - } - } -} - -/// GroupBy implementation. -struct GroupBy { - it: std::iter::Peekable, - f: F, -} - -impl Clone for GroupBy -where - It: Iterator + Clone, - It::Item: Clone, - F: Clone, -{ - fn clone(&self) -> Self { - GroupBy { - it: self.it.clone(), - f: self.f.clone(), - } - } -} - -impl<'a, G, It: 'a, F: 'a> Iterator for GroupBy -where It: Iterator + Clone, - It::Item: Clone, - F: Clone + FnMut(&It::Item) -> G, - G: Eq + Clone -{ - type Item = (G, InGroup, F, G>); - - fn next(&mut self) -> Option { - self.it.peek().map(&mut self.f).map(|key| { - let start = self.it.clone(); - while let Some(k) = self.it.peek().map(&mut self.f) { - if key != k { - break; - } - self.it.next(); - } - - (key.clone(), InGroup { - it: start, - f: self.f.clone(), - g: key - }) - }) - } -} - -#[derive(Copy, Clone)] -struct InGroup { - it: It, - f: F, - g: G -} - -impl G, G: Eq> Iterator for InGroup { - type Item = It::Item; - - fn next(&mut self) -> Option { - self.it.next().and_then(|x| { - if (self.f)(&x) == self.g { Some(x) } else { None } - }) - } -} - -trait IteratorExt: Iterator + Sized { - fn group_by(self, f: F) -> GroupBy - where F: Clone + FnMut(&Self::Item) -> G, - G: Eq - { - GroupBy { it: self.peekable(), f } - } - - fn join(mut self, sep: &str) -> String - where Self::Item: std::fmt::Display { - let mut s = String::new(); - if let Some(e) = self.next() { - write!(s, "{}", e); - for e in self { - s.push_str(sep); - write!(s, "{}", e); - } - } - s - } - - // HACK(eddyb) Only needed because `impl Trait` can't be - // used with trait methods: `.foo()` becomes `.__(foo)`. - fn __(self, f: F) -> R - where F: FnOnce(Self) -> R { - f(self) - } -} - -impl IteratorExt for It where It: Iterator {} - -/// -/// Generates an iterator that yields exactly n spaces. -/// -fn spaces(n: usize) -> std::iter::Take> { - std::iter::repeat(' ').take(n) -} - -fn test_spaces() { - assert_eq!(spaces(0).collect::(), ""); - assert_eq!(spaces(10).collect::(), " ") -} - -/// -/// Returns an iterator of dates in a given year. -/// -fn dates_in_year(year: i32) -> impl Iterator+Clone { - InGroup { - it: NaiveDate::from_ymd(year, 1, 1).., - f: |d: &NaiveDate| d.year(), - g: year - } -} - -fn test_dates_in_year() { - { - let mut dates = dates_in_year(2013); - assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 1))); - - // Check increment - assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 2))); - - // Check monthly rollover - for _ in 3..31 { - assert!(dates.next() != None); - } - - assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 1, 31))); - assert_eq!(dates.next(), Some(NaiveDate::from_ymd(2013, 2, 1))); - } - - { - // Check length of year - let mut dates = dates_in_year(2013); - for _ in 0..365 { - assert!(dates.next() != None); - } - assert_eq!(dates.next(), None); - } - - { - // Check length of leap year - let mut dates = dates_in_year(1984); - for _ in 0..366 { - assert!(dates.next() != None); - } - assert_eq!(dates.next(), None); - } -} - -/// -/// Convenience trait for verifying that a given type iterates over -/// `NaiveDate`s. -/// -trait DateIterator: Iterator + Clone {} -impl DateIterator for It where It: Iterator + Clone {} - -fn test_group_by() { - let input = [ - [1, 1], - [1, 1], - [1, 2], - [2, 2], - [2, 3], - [2, 3], - [3, 3] - ]; - - let by_x = input.iter().cloned().group_by(|a| a[0]); - let expected_1: &[&[[i32; 2]]] = &[ - &[[1, 1], [1, 1], [1, 2]], - &[[2, 2], [2, 3], [2, 3]], - &[[3, 3]] - ]; - for ((_, a), b) in by_x.zip(expected_1.iter().cloned()) { - assert_eq!(&a.collect::>()[..], b); - } - - let by_y = input.iter().cloned().group_by(|a| a[1]); - let expected_2: &[&[[i32; 2]]] = &[ - &[[1, 1], [1, 1]], - &[[1, 2], [2, 2]], - &[[2, 3], [2, 3], [3, 3]] - ]; - for ((_, a), b) in by_y.zip(expected_2.iter().cloned()) { - assert_eq!(&a.collect::>()[..], b); - } -} - -/// -/// Groups an iterator of dates by month. -/// -fn by_month(it: impl Iterator + Clone) - -> impl Iterator + Clone)> + Clone -{ - it.group_by(|d| d.month()) -} - -fn test_by_month() { - let mut months = dates_in_year(2013).__(by_month); - for (month, (_, mut date)) in (1..13).zip(&mut months) { - assert_eq!(date.nth(0).unwrap(), NaiveDate::from_ymd(2013, month, 1)); - } - assert!(months.next().is_none()); -} - -/// -/// Groups an iterator of dates by week. -/// -fn by_week(it: impl DateIterator) - -> impl Iterator + Clone -{ - // We go forward one day because `isoweekdate` considers the week to start on a Monday. - it.group_by(|d| d.succ().isoweekdate().1) -} - -fn test_isoweekdate() { - fn weeks_uniq(year: i32) -> Vec<((i32, u32), u32)> { - let mut weeks = dates_in_year(year).map(|d| d.isoweekdate()) - .map(|(y,w,_)| (y,w)); - let mut result = vec![]; - let mut accum = (weeks.next().unwrap(), 1); - for yw in weeks { - if accum.0 == yw { - accum.1 += 1; - } else { - result.push(accum); - accum = (yw, 1); - } - } - result.push(accum); - result - } - - let wu_1984 = weeks_uniq(1984); - assert_eq!(&wu_1984[..2], &[((1983, 52), 1), ((1984, 1), 7)]); - assert_eq!(&wu_1984[wu_1984.len()-2..], &[((1984, 52), 7), ((1985, 1), 1)]); - - let wu_2013 = weeks_uniq(2013); - assert_eq!(&wu_2013[..2], &[((2013, 1), 6), ((2013, 2), 7)]); - assert_eq!(&wu_2013[wu_2013.len()-2..], &[((2013, 52), 7), ((2014, 1), 2)]); - - let wu_2015 = weeks_uniq(2015); - assert_eq!(&wu_2015[..2], &[((2015, 1), 4), ((2015, 2), 7)]); - assert_eq!(&wu_2015[wu_2015.len()-2..], &[((2015, 52), 7), ((2015, 53), 4)]); -} - -fn test_by_week() { - let mut weeks = dates_in_year(2013).__(by_week); - assert_eq!( - &*weeks.next().unwrap().1.collect::>(), - &[ - NaiveDate::from_ymd(2013, 1, 1), - NaiveDate::from_ymd(2013, 1, 2), - NaiveDate::from_ymd(2013, 1, 3), - NaiveDate::from_ymd(2013, 1, 4), - NaiveDate::from_ymd(2013, 1, 5), - ] - ); - assert_eq!( - &*weeks.next().unwrap().1.collect::>(), - &[ - NaiveDate::from_ymd(2013, 1, 6), - NaiveDate::from_ymd(2013, 1, 7), - NaiveDate::from_ymd(2013, 1, 8), - NaiveDate::from_ymd(2013, 1, 9), - NaiveDate::from_ymd(2013, 1, 10), - NaiveDate::from_ymd(2013, 1, 11), - NaiveDate::from_ymd(2013, 1, 12), - ] - ); - assert_eq!(weeks.next().unwrap().1.nth(0).unwrap(), NaiveDate::from_ymd(2013, 1, 13)); -} - -/// The number of columns per day in the formatted output. -const COLS_PER_DAY: u32 = 3; - -/// The number of columns per week in the formatted output. -const COLS_PER_WEEK: u32 = 7 * COLS_PER_DAY; - -/// -/// Formats an iterator of weeks into an iterator of strings. -/// -fn format_weeks(it: impl Iterator) -> impl Iterator { - it.map(|week| { - let mut buf = String::with_capacity((COLS_PER_DAY * COLS_PER_WEEK + 2) as usize); - - // Format each day into its own cell and append to target string. - let mut last_day = 0; - let mut first = true; - for d in week { - last_day = d.weekday().num_days_from_sunday(); - - // Insert enough filler to align the first day with its respective day-of-week. - if first { - buf.extend(spaces((COLS_PER_DAY * last_day) as usize)); - first = false; - } - - write!(buf, " {:>2}", d.day()); - } - - // Insert more filler at the end to fill up the remainder of the week, - // if its a short week (e.g. at the end of the month). - buf.extend(spaces((COLS_PER_DAY * (6 - last_day)) as usize)); - buf - }) -} - -fn test_format_weeks() { - let jan_2013 = dates_in_year(2013) - .__(by_month).next() // pick January 2013 for testing purposes - // NOTE: This `map` is because `next` returns an `Option<_>`. - .map(|(_, month)| - month.__(by_week) - .map(|(_, weeks)| weeks) - .__(format_weeks) - .join("\n")); - - assert_eq!( - jan_2013.as_ref().map(|s| &**s), - Some(" 1 2 3 4 5\n\ - \x20 6 7 8 9 10 11 12\n\ - \x2013 14 15 16 17 18 19\n\ - \x2020 21 22 23 24 25 26\n\ - \x2027 28 29 30 31 ") - ); -} - -/// -/// Formats the name of a month, centered on COLS_PER_WEEK. -/// -fn month_title(month: u32) -> String { - const MONTH_NAMES: &'static [&'static str] = &[ - "January", "February", "March", "April", "May", "June", - "July", "August", "September", "October", "November", "December" - ]; - assert_eq!(MONTH_NAMES.len(), 12); - - // Determine how many spaces before and after the month name - // we need to center it over the formatted weeks in the month. - let name = MONTH_NAMES[(month - 1) as usize]; - assert!(name.len() < COLS_PER_WEEK as usize); - let before = (COLS_PER_WEEK as usize - name.len()) / 2; - let after = COLS_PER_WEEK as usize - name.len() - before; - - // NOTE: Being slightly more verbose to avoid extra allocations. - let mut result = String::with_capacity(COLS_PER_WEEK as usize); - result.extend(spaces(before)); - result.push_str(name); - result.extend(spaces(after)); - result -} - -fn test_month_title() { - assert_eq!(month_title(1).len(), COLS_PER_WEEK as usize); -} - -/// -/// Formats a month. -/// -fn format_month(it: impl DateIterator) -> impl Iterator { - let mut month_days = it.peekable(); - let title = month_title(month_days.peek().unwrap().month()); - - Some(title).into_iter() - .chain(month_days.__(by_week) - .map(|(_, week)| week) - .__(format_weeks)) -} - -fn test_format_month() { - let month_fmt = dates_in_year(2013) - .__(by_month).next() // Pick January as a test case - .map(|(_, days)| days.into_iter() - .__(format_month) - .join("\n")); - - assert_eq!( - month_fmt.as_ref().map(|s| &**s), - Some(" January \n\ - \x20 1 2 3 4 5\n\ - \x20 6 7 8 9 10 11 12\n\ - \x2013 14 15 16 17 18 19\n\ - \x2020 21 22 23 24 25 26\n\ - \x2027 28 29 30 31 ") - ); -} - - -/// -/// Formats an iterator of months. -/// -fn format_months(it: impl Iterator) - -> impl Iterator> -{ - it.map(format_month) -} - -/// -/// Takes an iterator of iterators of strings; the sub-iterators are consumed -/// in lock-step, with their elements joined together. -/// -trait PasteBlocks: Iterator + Sized -where Self::Item: Iterator { - fn paste_blocks(self, sep_width: usize) -> PasteBlocksIter { - PasteBlocksIter { - iters: self.collect(), - cache: vec![], - col_widths: None, - sep_width: sep_width, - } - } -} - -impl PasteBlocks for It where It: Iterator, It::Item: Iterator {} - -struct PasteBlocksIter -where StrIt: Iterator { - iters: Vec, - cache: Vec>, - col_widths: Option>, - sep_width: usize, -} - -impl Iterator for PasteBlocksIter -where StrIt: Iterator { - type Item = String; - - fn next(&mut self) -> Option { - self.cache.clear(); - - // `cache` is now the next line from each iterator. - self.cache.extend(self.iters.iter_mut().map(|it| it.next())); - - // If every line in `cache` is `None`, we have nothing further to do. - if self.cache.iter().all(|e| e.is_none()) { return None } - - // Get the column widths if we haven't already. - let col_widths = match self.col_widths { - Some(ref v) => &**v, - None => { - self.col_widths = Some(self.cache.iter() - .map(|ms| ms.as_ref().map(|s| s.len()).unwrap_or(0)) - .collect()); - &**self.col_widths.as_ref().unwrap() - } - }; - - // Fill in any `None`s with spaces. - let mut parts = col_widths.iter().cloned().zip(self.cache.iter_mut()) - .map(|(w,ms)| ms.take().unwrap_or_else(|| spaces(w).collect())); - - // Join them all together. - let first = parts.next().unwrap_or(String::new()); - let sep_width = self.sep_width; - Some(parts.fold(first, |mut accum, next| { - accum.extend(spaces(sep_width)); - accum.push_str(&next); - accum - })) - } -} - -fn test_paste_blocks() { - let row = dates_in_year(2013) - .__(by_month).map(|(_, days)| days) - .take(3) - .__(format_months) - .paste_blocks(1) - .join("\n"); - assert_eq!( - &*row, - " January February March \n\ - \x20 1 2 3 4 5 1 2 1 2\n\ - \x20 6 7 8 9 10 11 12 3 4 5 6 7 8 9 3 4 5 6 7 8 9\n\ - \x2013 14 15 16 17 18 19 10 11 12 13 14 15 16 10 11 12 13 14 15 16\n\ - \x2020 21 22 23 24 25 26 17 18 19 20 21 22 23 17 18 19 20 21 22 23\n\ - \x2027 28 29 30 31 24 25 26 27 28 24 25 26 27 28 29 30\n\ - \x20 31 " - ); -} - -/// -/// Produces an iterator that yields `n` elements at a time. -/// -trait Chunks: Iterator + Sized { - fn chunks(self, n: usize) -> ChunksIter { - assert!(n > 0); - ChunksIter { - it: self, - n: n, - } - } -} - -impl Chunks for It where It: Iterator {} - -struct ChunksIter -where It: Iterator { - it: It, - n: usize, -} - -// NOTE: `chunks` in Rust is more-or-less impossible without overhead of some kind. -// Aliasing rules mean you need to add dynamic borrow checking, and the design of -// `Iterator` means that you need to have the iterator's state kept in an allocation -// that is jointly owned by the iterator itself and the sub-iterator. -// As such, I've chosen to cop-out and just heap-allocate each chunk. - -impl Iterator for ChunksIter -where It: Iterator { - type Item = Vec; - - fn next(&mut self) -> Option> { - let first = match self.it.next() { - Some(e) => e, - None => return None - }; - - let mut result = Vec::with_capacity(self.n); - result.push(first); - - Some((&mut self.it).take(self.n-1) - .fold(result, |mut acc, next| { acc.push(next); acc })) - } -} - -fn test_chunks() { - let r = &[1, 2, 3, 4, 5, 6, 7]; - let c = r.iter().cloned().chunks(3).collect::>(); - assert_eq!(&*c, &[vec![1, 2, 3], vec![4, 5, 6], vec![7]]); -} - -/// -/// Formats a year. -/// -fn format_year(year: i32, months_per_row: usize) -> String { - const COL_SPACING: usize = 1; - - // Start by generating all dates for the given year. - dates_in_year(year) - - // Group them by month and throw away month number. - .__(by_month).map(|(_, days)| days) - - // Group the months into horizontal rows. - .chunks(months_per_row) - - // Format each row - .map(|r| r.into_iter() - // By formatting each month - .__(format_months) - - // Horizontally pasting each respective month's lines together. - .paste_blocks(COL_SPACING) - .join("\n") - ) - - // Insert a blank line between each row - .join("\n\n") -} - -fn test_format_year() { - const MONTHS_PER_ROW: usize = 3; - - macro_rules! assert_eq_cal { - ($lhs:expr, $rhs:expr) => { - if $lhs != $rhs { - println!("got:\n```\n{}\n```\n", $lhs.replace(" ", ".")); - println!("expected:\n```\n{}\n```", $rhs.replace(" ", ".")); - panic!("calendars didn't match!"); - } - } - } - - assert_eq_cal!(&format_year(1984, MONTHS_PER_ROW), "\ -\x20 January February March \n\ -\x20 1 2 3 4 5 6 7 1 2 3 4 1 2 3\n\ -\x20 8 9 10 11 12 13 14 5 6 7 8 9 10 11 4 5 6 7 8 9 10\n\ -\x2015 16 17 18 19 20 21 12 13 14 15 16 17 18 11 12 13 14 15 16 17\n\ -\x2022 23 24 25 26 27 28 19 20 21 22 23 24 25 18 19 20 21 22 23 24\n\ -\x2029 30 31 26 27 28 29 25 26 27 28 29 30 31\n\ -\n\ -\x20 April May June \n\ -\x20 1 2 3 4 5 6 7 1 2 3 4 5 1 2\n\ -\x20 8 9 10 11 12 13 14 6 7 8 9 10 11 12 3 4 5 6 7 8 9\n\ -\x2015 16 17 18 19 20 21 13 14 15 16 17 18 19 10 11 12 13 14 15 16\n\ -\x2022 23 24 25 26 27 28 20 21 22 23 24 25 26 17 18 19 20 21 22 23\n\ -\x2029 30 27 28 29 30 31 24 25 26 27 28 29 30\n\ -\n\ -\x20 July August September \n\ -\x20 1 2 3 4 5 6 7 1 2 3 4 1\n\ -\x20 8 9 10 11 12 13 14 5 6 7 8 9 10 11 2 3 4 5 6 7 8\n\ -\x2015 16 17 18 19 20 21 12 13 14 15 16 17 18 9 10 11 12 13 14 15\n\ -\x2022 23 24 25 26 27 28 19 20 21 22 23 24 25 16 17 18 19 20 21 22\n\ -\x2029 30 31 26 27 28 29 30 31 23 24 25 26 27 28 29\n\ -\x20 30 \n\ -\n\ -\x20 October November December \n\ -\x20 1 2 3 4 5 6 1 2 3 1\n\ -\x20 7 8 9 10 11 12 13 4 5 6 7 8 9 10 2 3 4 5 6 7 8\n\ -\x2014 15 16 17 18 19 20 11 12 13 14 15 16 17 9 10 11 12 13 14 15\n\ -\x2021 22 23 24 25 26 27 18 19 20 21 22 23 24 16 17 18 19 20 21 22\n\ -\x2028 29 30 31 25 26 27 28 29 30 23 24 25 26 27 28 29\n\ -\x20 30 31 "); - - assert_eq_cal!(&format_year(2015, MONTHS_PER_ROW), "\ -\x20 January February March \n\ -\x20 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5 6 7\n\ -\x20 4 5 6 7 8 9 10 8 9 10 11 12 13 14 8 9 10 11 12 13 14\n\ -\x2011 12 13 14 15 16 17 15 16 17 18 19 20 21 15 16 17 18 19 20 21\n\ -\x2018 19 20 21 22 23 24 22 23 24 25 26 27 28 22 23 24 25 26 27 28\n\ -\x2025 26 27 28 29 30 31 29 30 31 \n\ -\n\ -\x20 April May June \n\ -\x20 1 2 3 4 1 2 1 2 3 4 5 6\n\ -\x20 5 6 7 8 9 10 11 3 4 5 6 7 8 9 7 8 9 10 11 12 13\n\ -\x2012 13 14 15 16 17 18 10 11 12 13 14 15 16 14 15 16 17 18 19 20\n\ -\x2019 20 21 22 23 24 25 17 18 19 20 21 22 23 21 22 23 24 25 26 27\n\ -\x2026 27 28 29 30 24 25 26 27 28 29 30 28 29 30 \n\ -\x20 31 \n\ -\n\ -\x20 July August September \n\ -\x20 1 2 3 4 1 1 2 3 4 5\n\ -\x20 5 6 7 8 9 10 11 2 3 4 5 6 7 8 6 7 8 9 10 11 12\n\ -\x2012 13 14 15 16 17 18 9 10 11 12 13 14 15 13 14 15 16 17 18 19\n\ -\x2019 20 21 22 23 24 25 16 17 18 19 20 21 22 20 21 22 23 24 25 26\n\ -\x2026 27 28 29 30 31 23 24 25 26 27 28 29 27 28 29 30 \n\ -\x20 30 31 \n\ -\n\ -\x20 October November December \n\ -\x20 1 2 3 1 2 3 4 5 6 7 1 2 3 4 5\n\ -\x20 4 5 6 7 8 9 10 8 9 10 11 12 13 14 6 7 8 9 10 11 12\n\ -\x2011 12 13 14 15 16 17 15 16 17 18 19 20 21 13 14 15 16 17 18 19\n\ -\x2018 19 20 21 22 23 24 22 23 24 25 26 27 28 20 21 22 23 24 25 26\n\ -\x2025 26 27 28 29 30 31 29 30 27 28 29 30 31 "); -} - -fn main() { - // Run tests. - test_spaces(); - test_dates_in_year(); - test_group_by(); - test_by_month(); - test_isoweekdate(); - test_by_week(); - test_format_weeks(); - test_month_title(); - test_format_month(); - test_paste_blocks(); - test_chunks(); - test_format_year(); -} diff --git a/src/test/ui/run-pass/impl-trait/example-st.rs b/src/test/ui/run-pass/impl-trait/example-st.rs deleted file mode 100644 index 014af37ccf9..00000000000 --- a/src/test/ui/run-pass/impl-trait/example-st.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct State; -type Error = (); - -trait Bind { - type Output; - fn bind(self, f: F) -> Self::Output; -} - -fn bind(mut a: A, mut f: F) - -> impl FnMut(&mut State) -> Result -where F: FnMut(T) -> B, - A: FnMut(&mut State) -> Result, - B: FnMut(&mut State) -> Result -{ - move |state | { - let r = a(state)?; - f(r)(state) - } -} - -fn atom(x: T) -> impl FnMut(&mut State) -> Result { - let mut x = Some(x); - move |_| x.take().map_or(Err(()), Ok) -} - -fn main() { - assert_eq!(bind(atom(5), |x| atom(x > 4))(&mut State), Ok(true)); -} diff --git a/src/test/ui/run-pass/impl-trait/existential-minimal.rs b/src/test/ui/run-pass/impl-trait/existential-minimal.rs deleted file mode 100644 index bae4c685e7c..00000000000 --- a/src/test/ui/run-pass/impl-trait/existential-minimal.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() {} - -fn foo() -> impl std::fmt::Debug { "cake" } diff --git a/src/test/ui/run-pass/impl-trait/issue-42479.rs b/src/test/ui/run-pass/impl-trait/issue-42479.rs deleted file mode 100644 index 1da5cd36ca9..00000000000 --- a/src/test/ui/run-pass/impl-trait/issue-42479.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::iter::once; - -struct Foo { - x: i32, -} - -impl Foo { - fn inside(&self) -> impl Iterator { - once(&self.x) - } -} - -fn main() { - println!("hi"); -} diff --git a/src/test/ui/run-pass/impl-trait/issue-49376.rs b/src/test/ui/run-pass/impl-trait/issue-49376.rs deleted file mode 100644 index 10379dad37d..00000000000 --- a/src/test/ui/run-pass/impl-trait/issue-49376.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Tests for nested self-reference which caused a stack overflow. - -use std::fmt::Debug; -use std::ops::*; - -fn gen() -> impl PartialOrd + PartialEq + Debug { } - -struct Bar {} -trait Foo {} -impl Foo for Bar {} - -fn foo() -> impl Foo { - Bar {} -} - -fn test_impl_ops() -> impl Add + Sub + Mul + Div { 1 } -fn test_impl_assign_ops() -> impl AddAssign + SubAssign + MulAssign + DivAssign { 1 } - -fn main() {} diff --git a/src/test/ui/run-pass/impl-trait/lifetimes.rs b/src/test/ui/run-pass/impl-trait/lifetimes.rs deleted file mode 100644 index e5a98962ff3..00000000000 --- a/src/test/ui/run-pass/impl-trait/lifetimes.rs +++ /dev/null @@ -1,128 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(warnings)] - -use std::fmt::Debug; - -fn any_lifetime<'a>() -> &'a u32 { &5 } - -fn static_lifetime() -> &'static u32 { &5 } - -fn any_lifetime_as_static_impl_trait() -> impl Debug { - any_lifetime() -} - -fn lifetimes_as_static_impl_trait() -> impl Debug { - static_lifetime() -} - -fn no_params_or_lifetimes_is_static() -> impl Debug + 'static { - lifetimes_as_static_impl_trait() -} - -fn static_input_type_is_static(x: T) -> impl Debug + 'static { x } - -fn type_outlives_reference_lifetime<'a, T: Debug>(x: &'a T) -> impl Debug + 'a { x } -fn type_outlives_reference_lifetime_elided(x: &T) -> impl Debug + '_ { x } - -trait SingleRegionTrait<'a> {} -impl<'a> SingleRegionTrait<'a> for u32 {} -impl<'a> SingleRegionTrait<'a> for &'a u32 {} -struct SingleRegionStruct<'a>(&'a u32); - -fn simple_type_hrtb<'b>() -> impl for<'a> SingleRegionTrait<'a> { 5 } -// FIXME(cramertj) add test after #45992 lands to ensure lint is triggered -fn elision_single_region_trait(x: &u32) -> impl SingleRegionTrait { x } -fn elision_single_region_struct(x: SingleRegionStruct) -> impl Into { x } - -fn closure_hrtb() -> impl for<'a> Fn(&'a u32) { |_| () } -fn closure_hr_elided() -> impl Fn(&u32) { |_| () } -fn closure_hr_elided_return() -> impl Fn(&u32) -> &u32 { |x| x } -fn closure_pass_through_elided_return(x: impl Fn(&u32) -> &u32) -> impl Fn(&u32) -> &u32 { x } -fn closure_pass_through_reference_elided(x: &impl Fn(&u32) -> &u32) -> &impl Fn(&u32) -> &u32 { x } - -fn nested_lifetime<'a>(input: &'a str) - -> impl Iterator + 'a> + 'a -{ - input.lines().map(|line| { - line.split_whitespace().map(|cell| cell.parse().unwrap()) - }) -} - -fn pass_through_elision(x: &u32) -> impl Into<&u32> { x } -fn pass_through_elision_with_fn_ptr(x: &fn(&u32) -> &u32) -> impl Into<&fn(&u32) -> &u32> { x } - -fn pass_through_elision_with_fn_path &u32>( - x: &T -) -> &impl Fn(&u32) -> &u32 { x } - -fn foo(x: &impl Debug) -> &impl Debug { x } -fn foo_explicit_lifetime<'a>(x: &'a impl Debug) -> &'a impl Debug { x } -fn foo_explicit_arg(x: &T) -> &impl Debug { x } - -fn mixed_lifetimes<'a>() -> impl for<'b> Fn(&'b &'a u32) { |_| () } -fn mixed_as_static() -> impl Fn(&'static &'static u32) { mixed_lifetimes() } - -trait MultiRegionTrait<'a, 'b>: Debug {} - -#[derive(Debug)] -struct MultiRegionStruct<'a, 'b>(&'a u32, &'b u32); -impl<'a, 'b> MultiRegionTrait<'a, 'b> for MultiRegionStruct<'a, 'b> {} - -#[derive(Debug)] -struct NoRegionStruct; -impl<'a, 'b> MultiRegionTrait<'a, 'b> for NoRegionStruct {} - -fn finds_least_region<'a: 'b, 'b>(x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> { - MultiRegionStruct(x, y) -} - -fn finds_explicit_bound<'a: 'b, 'b> - (x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> + 'b -{ - MultiRegionStruct(x, y) -} - -fn finds_explicit_bound_even_without_least_region<'a, 'b> - (x: &'a u32, y: &'b u32) -> impl MultiRegionTrait<'a, 'b> + 'b -{ - NoRegionStruct -} - -/* FIXME: `impl Trait<'a> + 'b` should live as long as 'b, even if 'b outlives 'a -fn outlives_bounds_even_with_contained_regions<'a, 'b> - (x: &'a u32, y: &'b u32) -> impl Debug + 'b -{ - finds_explicit_bound_even_without_least_region(x, y) -} -*/ - -fn unnamed_lifetimes_arent_contained_in_impl_trait_and_will_unify<'a, 'b> - (x: &'a u32, y: &'b u32) -> impl Debug -{ - fn deref<'lt>(x: &'lt u32) -> impl Debug { *x } - - if true { deref(x) } else { deref(y) } -} - -fn can_add_region_bound_to_static_type<'a, 'b>(_: &'a u32) -> impl Debug + 'a { 5 } - -struct MyVec(Vec>); - -impl<'unnecessary_lifetime> MyVec { - fn iter_doesnt_capture_unnecessary_lifetime<'s>(&'s self) -> impl Iterator { - self.0.iter().flat_map(|inner_vec| inner_vec.iter()) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/impl-trait/nesting.rs b/src/test/ui/run-pass/impl-trait/nesting.rs deleted file mode 100644 index f721ace0afe..00000000000 --- a/src/test/ui/run-pass/impl-trait/nesting.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn foo(t: T) -> impl Into<[T; { const FOO: usize = 1; FOO }]> { - [t] -} - -fn bar() -> impl Into<[u8; { const FOO: usize = 1; FOO }]> { - [99] -} - -fn main() { - println!("{:?}", foo(42).into()); - println!("{:?}", bar().into()); -} diff --git a/src/test/ui/run-pass/impl-trait/universal_hrtb_anon.rs b/src/test/ui/run-pass/impl-trait/universal_hrtb_anon.rs deleted file mode 100644 index b78ec557d09..00000000000 --- a/src/test/ui/run-pass/impl-trait/universal_hrtb_anon.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn hrtb(f: impl Fn(&u32) -> u32) -> u32 { - f(&22) + f(&44) -} - -fn main() { - let sum = hrtb(|x| x * 2); - assert_eq!(sum, 22*2 + 44*2); -} diff --git a/src/test/ui/run-pass/impl-trait/universal_hrtb_named.rs b/src/test/ui/run-pass/impl-trait/universal_hrtb_named.rs deleted file mode 100644 index 0bec594346b..00000000000 --- a/src/test/ui/run-pass/impl-trait/universal_hrtb_named.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn hrtb(f: impl for<'a> Fn(&'a u32) -> &'a u32) -> u32 { - f(&22) + f(&44) -} - -fn main() { - let sum = hrtb(|x| x); - assert_eq!(sum, 22 + 44); -} diff --git a/src/test/ui/run-pass/impl-trait/universal_in_adt_in_parameters.rs b/src/test/ui/run-pass/impl-trait/universal_in_adt_in_parameters.rs deleted file mode 100644 index 95e6a3efdf0..00000000000 --- a/src/test/ui/run-pass/impl-trait/universal_in_adt_in_parameters.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::fmt::Display; - -fn check_display_eq(iter: &Vec) { - let mut collected = String::new(); - for it in iter { - let disp = format!("{} ", it); - collected.push_str(&disp); - } - assert_eq!("0 3 27 823 4891 1 0", collected.trim()); -} - -fn main() { - let i32_list_vec = vec![0i32, 3, 27, 823, 4891, 1, 0]; - let u32_list_vec = vec![0u32, 3, 27, 823, 4891, 1, 0]; - let str_list_vec = vec!["0", "3", "27", "823", "4891", "1", "0"]; - - check_display_eq(&i32_list_vec); - check_display_eq(&u32_list_vec); - check_display_eq(&str_list_vec); -} diff --git a/src/test/ui/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs b/src/test/ui/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs deleted file mode 100644 index b9c68c280f1..00000000000 --- a/src/test/ui/run-pass/impl-trait/universal_in_impl_trait_in_parameters.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::fmt::Display; - -fn check_display_eq(iter: impl IntoIterator) { - let mut collected = String::new(); - for it in iter { - let disp = format!("{} ", it); - collected.push_str(&disp); - } - assert_eq!("0 3 27 823 4891 1 0", collected.trim()); -} - -fn main() { - let i32_list = [0i32, 3, 27, 823, 4891, 1, 0]; - let i32_list_vec = vec![0i32, 3, 27, 823, 4891, 1, 0]; - let u32_list = [0u32, 3, 27, 823, 4891, 1, 0]; - let u32_list_vec = vec![0u32, 3, 27, 823, 4891, 1, 0]; - let u16_list = [0u16, 3, 27, 823, 4891, 1, 0]; - let str_list = ["0", "3", "27", "823", "4891", "1", "0"]; - let str_list_vec = vec!["0", "3", "27", "823", "4891", "1", "0"]; - - check_display_eq(&i32_list); - check_display_eq(i32_list_vec); - check_display_eq(&u32_list); - check_display_eq(u32_list_vec); - check_display_eq(&u16_list); - check_display_eq(&str_list); - check_display_eq(str_list_vec); -} diff --git a/src/test/ui/run-pass/impl-trait/universal_in_trait_defn_parameters.rs b/src/test/ui/run-pass/impl-trait/universal_in_trait_defn_parameters.rs deleted file mode 100644 index 6fb44147c1c..00000000000 --- a/src/test/ui/run-pass/impl-trait/universal_in_trait_defn_parameters.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::fmt::Debug; - -trait InTraitDefnParameters { - fn in_parameters(_: impl Debug) -> String; -} - -impl InTraitDefnParameters for () { - fn in_parameters(v: impl Debug) -> String { - format!("() + {:?}", v) - } -} - -fn main() { - let s = <() as InTraitDefnParameters>::in_parameters(22); - assert_eq!(s, "() + 22"); -} diff --git a/src/test/ui/run-pass/impl-trait/universal_multiple_bounds.rs b/src/test/ui/run-pass/impl-trait/universal_multiple_bounds.rs deleted file mode 100644 index 9b1c2b92446..00000000000 --- a/src/test/ui/run-pass/impl-trait/universal_multiple_bounds.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::fmt::Display; - -fn foo(f: impl Display + Clone) -> String { - let g = f.clone(); - format!("{} + {}", f, g) -} - -fn main() { - let sum = foo(format!("22")); - assert_eq!(sum, r"22 + 22"); -} diff --git a/src/test/ui/run-pass/impl-trait/xcrate.rs b/src/test/ui/run-pass/impl-trait/xcrate.rs deleted file mode 100644 index aa5d3298f69..00000000000 --- a/src/test/ui/run-pass/impl-trait/xcrate.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:xcrate.rs - -extern crate xcrate; - -fn main() { -// NOTE line below commeted out due to issue #45994 -// assert_eq!(xcrate::fourway_add(1)(2)(3)(4), 10); - xcrate::return_closure_accessing_internal_fn()(); -} diff --git a/src/test/ui/run-pass/impl-trait/xcrate_simple.rs b/src/test/ui/run-pass/impl-trait/xcrate_simple.rs deleted file mode 100644 index 8b7c8ada1c0..00000000000 --- a/src/test/ui/run-pass/impl-trait/xcrate_simple.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:xcrate.rs - -extern crate xcrate; - -fn main() { - xcrate::return_internal_fn()(); -} diff --git a/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs b/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs deleted file mode 100644 index b37533d2da7..00000000000 --- a/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "rlib"] -// no-prefer-dynamic - -// compile-flags: -g - -#[macro_use] -mod crate_with_invalid_spans_macros; - -pub fn exported_generic(x: T, y: u32) -> (T, u32) { - // Using the add1 macro will produce an invalid span, because the `y` passed - // to the macro will have a span from this file, but the rest of the code - // generated from the macro will have spans from the macro-defining file. - // The AST node for the (1 + y) expression generated by the macro will then - // take it's `lo` span bound from the `1` literal in the macro-defining file - // and it's `hi` bound from `y` in this file, which should be lower than the - // `lo` and even lower than the lower bound of the FileMap it is supposedly - // contained in because the FileMap for this file was allocated earlier than - // the FileMap of the macro-defining file. - return (x, add1!(y)); -} diff --git a/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs b/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs deleted file mode 100644 index 112315af844..00000000000 --- a/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/auxiliary/crate_with_invalid_spans_macros.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -macro_rules! add1 { - ($e:expr) => ({ - let a = 1 + $e; - let b = $e + 1; - a + b - 1 - }) -} diff --git a/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/main.rs b/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/main.rs deleted file mode 100644 index 990758d52ff..00000000000 --- a/src/test/ui/run-pass/imports/import-crate-with-invalid-spans/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:crate_with_invalid_spans.rs - -// pretty-expanded FIXME #23616 - -extern crate crate_with_invalid_spans; - -fn main() { - // The AST of `exported_generic` stored in crate_with_invalid_spans's - // metadata should contain an invalid span where span.lo() > span.hi(). - // Let's make sure the compiler doesn't crash when encountering this. - let _ = crate_with_invalid_spans::exported_generic(32u32, 7u32); -} diff --git a/src/test/ui/run-pass/imports/import-from.rs b/src/test/ui/run-pass/imports/import-from.rs deleted file mode 100644 index 5f498a48584..00000000000 --- a/src/test/ui/run-pass/imports/import-from.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use spam::{ham, eggs}; - -mod spam { - pub fn ham() { } - pub fn eggs() { } -} - -pub fn main() { ham(); eggs(); } diff --git a/src/test/ui/run-pass/imports/import-glob-0.rs b/src/test/ui/run-pass/imports/import-glob-0.rs deleted file mode 100644 index f72fb1f0b13..00000000000 --- a/src/test/ui/run-pass/imports/import-glob-0.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use module_of_many_things::*; -use dug::too::greedily::and::too::deep::*; - -mod module_of_many_things { - pub fn f1() { println!("f1"); } - pub fn f2() { println!("f2"); } - fn f3() { println!("f3"); } - pub fn f4() { println!("f4"); } -} - -mod dug { - pub mod too { - pub mod greedily { - pub mod and { - pub mod too { - pub mod deep { - pub fn nameless_fear() { println!("Boo!"); } - pub fn also_redstone() { println!("Whatever."); } - } - } - } - } - } -} - - -pub fn main() { f1(); f2(); f4(); nameless_fear(); also_redstone(); } diff --git a/src/test/ui/run-pass/imports/import-glob-1.rs b/src/test/ui/run-pass/imports/import-glob-1.rs deleted file mode 100644 index b1f40d74917..00000000000 --- a/src/test/ui/run-pass/imports/import-glob-1.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This should resolve fine. Prior to fix, the last import -// was being tried too early, and marked as unrsolved before -// the glob import had a chance to be resolved. - -mod bar { - pub use self::middle::*; - - mod middle { - pub use self::baz::Baz; - - mod baz { - pub enum Baz { - Baz1, - Baz2 - } - } - } -} - -mod foo { - use bar::Baz::{Baz1, Baz2}; -} - -fn main() {} diff --git a/src/test/ui/run-pass/imports/import-glob-crate.rs b/src/test/ui/run-pass/imports/import-glob-crate.rs deleted file mode 100644 index 4ec5e1bd945..00000000000 --- a/src/test/ui/run-pass/imports/import-glob-crate.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem::*; - -pub fn main() { - assert_eq!(size_of::(), 1); - let (mut x, mut y) = (1, 2); - swap(&mut x, &mut y); - assert_eq!(x, 2); - assert_eq!(y, 1); -} - -#[allow(unused)] -fn f() { - mod foo { pub use *; } - mod bar { pub use ::*; } - - foo::main(); - bar::main(); -} diff --git a/src/test/ui/run-pass/imports/import-in-block.rs b/src/test/ui/run-pass/imports/import-in-block.rs deleted file mode 100644 index 655bd31b4de..00000000000 --- a/src/test/ui/run-pass/imports/import-in-block.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - use std::mem::replace; - let mut x = 5; - replace(&mut x, 6); - { - use std::mem::*; - let mut y = 6; - swap(&mut x, &mut y); - } -} diff --git a/src/test/ui/run-pass/imports/import-prefix-macro.rs b/src/test/ui/run-pass/imports/import-prefix-macro.rs deleted file mode 100644 index ceb662c6e3d..00000000000 --- a/src/test/ui/run-pass/imports/import-prefix-macro.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -mod a { - pub mod b { - pub mod c { - pub struct S; - pub struct Z; - } - pub struct W; - } -} - -macro_rules! import { - (1 $p: path) => (use $p;); - (2 $p: path) => (use $p::{Z};); - (3 $p: path) => (use $p::*;); -} - -import! { 1 a::b::c::S } -import! { 2 a::b::c } -import! { 3 a::b } - -fn main() { - let s = S; - let z = Z; - let w = W; -} diff --git a/src/test/ui/run-pass/imports/import-rename.rs b/src/test/ui/run-pass/imports/import-rename.rs deleted file mode 100644 index 8d4757f0a47..00000000000 --- a/src/test/ui/run-pass/imports/import-rename.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use foo::{x, y as fooy}; -use Maybe::{Yes as MaybeYes}; - -pub enum Maybe { Yes, No } -mod foo { - use super::Maybe::{self as MaybeFoo}; - pub fn x(a: MaybeFoo) {} - pub fn y(a: i32) { println!("{}", a); } -} - -pub fn main() { x(MaybeYes); fooy(10); } diff --git a/src/test/ui/run-pass/imports/import-trailing-comma.rs b/src/test/ui/run-pass/imports/import-trailing-comma.rs deleted file mode 100644 index 6c3371b46c7..00000000000 --- a/src/test/ui/run-pass/imports/import-trailing-comma.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use foo::bar::{baz, quux,}; - -mod foo { - pub mod bar { - pub fn baz() { } - pub fn quux() { } - } -} - -pub fn main() { baz(); quux(); } diff --git a/src/test/ui/run-pass/imports/import.rs b/src/test/ui/run-pass/imports/import.rs deleted file mode 100644 index cb2152f5fac..00000000000 --- a/src/test/ui/run-pass/imports/import.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -mod foo { - pub fn x(y: isize) { println!("{}", y); } -} - -mod bar { - use foo::x; - use foo::x as z; - pub fn thing() { x(10); z(10); } -} - -pub fn main() { bar::thing(); } diff --git a/src/test/ui/run-pass/imports/import2.rs b/src/test/ui/run-pass/imports/import2.rs deleted file mode 100644 index aaf65fc1c8c..00000000000 --- a/src/test/ui/run-pass/imports/import2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use zed::bar; - -mod zed { - pub fn bar() { println!("bar"); } -} - -pub fn main() { bar(); } diff --git a/src/test/ui/run-pass/imports/import3.rs b/src/test/ui/run-pass/imports/import3.rs deleted file mode 100644 index 38e316f550b..00000000000 --- a/src/test/ui/run-pass/imports/import3.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_imports)] - -use baz::zed; -use baz::zed::bar; - -mod baz { - pub mod zed { - pub fn bar() { println!("bar2"); } - } -} - -pub fn main() { bar(); } diff --git a/src/test/ui/run-pass/imports/import4.rs b/src/test/ui/run-pass/imports/import4.rs deleted file mode 100644 index 057e1cb5e01..00000000000 --- a/src/test/ui/run-pass/imports/import4.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use zed::bar; - -mod zed { - pub fn bar() { println!("bar"); } -} - -pub fn main() { let _zed = 42; bar(); } diff --git a/src/test/ui/run-pass/imports/import5.rs b/src/test/ui/run-pass/imports/import5.rs deleted file mode 100644 index 614c8c435c9..00000000000 --- a/src/test/ui/run-pass/imports/import5.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use foo::bar; -mod foo { - pub use foo::zed::bar; - pub mod zed { - pub fn bar() { println!("foo"); } - } -} - -pub fn main() { bar(); } diff --git a/src/test/ui/run-pass/imports/import6.rs b/src/test/ui/run-pass/imports/import6.rs deleted file mode 100644 index d98d5b3b0e1..00000000000 --- a/src/test/ui/run-pass/imports/import6.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_imports)] - -use foo::zed; -use bar::baz; - -mod foo { - pub mod zed { - pub fn baz() { println!("baz"); } - } -} -mod bar { - pub use foo::zed::baz; -} -pub fn main() { baz(); } diff --git a/src/test/ui/run-pass/imports/import7.rs b/src/test/ui/run-pass/imports/import7.rs deleted file mode 100644 index 67e41824e0d..00000000000 --- a/src/test/ui/run-pass/imports/import7.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_imports)] - -use foo::zed; -use bar::baz; - -mod foo { - pub mod zed { - pub fn baz() { println!("baz"); } - } -} -mod bar { - pub use foo::zed::baz; - pub mod foo { - pub mod zed {} - } -} -pub fn main() { baz(); } diff --git a/src/test/ui/run-pass/imports/import8.rs b/src/test/ui/run-pass/imports/import8.rs deleted file mode 100644 index 71dd7acac5a..00000000000 --- a/src/test/ui/run-pass/imports/import8.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use foo::x; -use foo::x as z; - -mod foo { - pub fn x(y: isize) { println!("{}", y); } -} - -pub fn main() { x(10); z(10); } diff --git a/src/test/ui/run-pass/imports/imports.rs b/src/test/ui/run-pass/imports/imports.rs deleted file mode 100644 index 7ca7ea1fd8c..00000000000 --- a/src/test/ui/run-pass/imports/imports.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused)] - -// Like other items, private imports can be imported and used non-lexically in paths. -mod a { - use a as foo; - use self::foo::foo as bar; - - mod b { - use super::bar; - } -} - -mod foo { pub fn f() {} } -mod bar { pub fn f() {} } - -pub fn f() -> bool { true } - -// Items and explicit imports shadow globs. -fn g() { - use foo::*; - use bar::*; - fn f() -> bool { true } - let _: bool = f(); -} - -fn h() { - use foo::*; - use bar::*; - use f; - let _: bool = f(); -} - -// Here, there appears to be shadowing but isn't because of namespaces. -mod b { - use foo::*; // This imports `f` in the value namespace. - use super::b as f; // This imports `f` only in the type namespace, - fn test() { self::f(); } // so the glob isn't shadowed. -} - -// Here, there is shadowing in one namespace, but not the other. -mod c { - mod test { - pub fn f() {} - pub mod f {} - } - use self::test::*; // This glob-imports `f` in both namespaces. - mod f { pub fn f() {} } // This shadows the glob only in the value namespace. - - fn test() { - self::f(); // Check that the glob-imported value isn't shadowed. - self::f::f(); // Check that the glob-imported module is shadowed. - } -} - -// Unused names can be ambiguous. -mod d { - pub use foo::*; // This imports `f` in the value namespace. - pub use bar::*; // This also imports `f` in the value namespace. -} - -mod e { - pub use d::*; // n.b. Since `e::f` is not used, this is not considered to be a use of `d::f`. -} - -fn main() {} diff --git a/src/test/ui/run-pass/intrinsics/auxiliary/cci_intrinsic.rs b/src/test/ui/run-pass/intrinsics/auxiliary/cci_intrinsic.rs deleted file mode 100644 index b6e69d29f70..00000000000 --- a/src/test/ui/run-pass/intrinsics/auxiliary/cci_intrinsic.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(intrinsics)] - -pub mod rusti { - extern "rust-intrinsic" { - pub fn atomic_xchg(dst: *mut T, src: T) -> T; - } -} - -#[inline(always)] -pub fn atomic_xchg(dst: *mut isize, src: isize) -> isize { - unsafe { - rusti::atomic_xchg(dst, src) - } -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-alignment.rs b/src/test/ui/run-pass/intrinsics/intrinsic-alignment.rs deleted file mode 100644 index 0c1f7724ca8..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-alignment.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare seems not important to test here - -#![feature(intrinsics, main)] - -mod rusti { - extern "rust-intrinsic" { - pub fn pref_align_of() -> usize; - pub fn min_align_of() -> usize; - } -} - -#[cfg(any(target_os = "android", - target_os = "cloudabi", - target_os = "dragonfly", - target_os = "emscripten", - target_os = "freebsd", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "openbsd", - target_os = "solaris"))] -mod m { - #[main] - #[cfg(target_arch = "x86")] - pub fn main() { - unsafe { - assert_eq!(::rusti::pref_align_of::(), 8); - assert_eq!(::rusti::min_align_of::(), 4); - } - } - - #[main] - #[cfg(not(target_arch = "x86"))] - pub fn main() { - unsafe { - assert_eq!(::rusti::pref_align_of::(), 8); - assert_eq!(::rusti::min_align_of::(), 8); - } - } -} - -#[cfg(target_os = "bitrig")] -mod m { - #[main] - #[cfg(target_arch = "x86_64")] - pub fn main() { - unsafe { - assert_eq!(::rusti::pref_align_of::(), 8); - assert_eq!(::rusti::min_align_of::(), 8); - } - } -} - -#[cfg(target_os = "windows")] -mod m { - #[main] - #[cfg(target_arch = "x86")] - pub fn main() { - unsafe { - assert_eq!(::rusti::pref_align_of::(), 8); - assert_eq!(::rusti::min_align_of::(), 8); - } - } - - #[main] - #[cfg(target_arch = "x86_64")] - pub fn main() { - unsafe { - assert_eq!(::rusti::pref_align_of::(), 8); - assert_eq!(::rusti::min_align_of::(), 8); - } - } -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-assume.rs b/src/test/ui/run-pass/intrinsics/intrinsic-assume.rs deleted file mode 100644 index e428c0e50ab..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-assume.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] - -use std::intrinsics::assume; - -unsafe fn f(x: i32) -> i32 { - assume(x == 34); - match x { - 34 => 42, - _ => 30 - } -} - -fn main() { - let x = unsafe { f(34) }; - assert_eq!(x, 42); -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-atomics-cc.rs b/src/test/ui/run-pass/intrinsics/intrinsic-atomics-cc.rs deleted file mode 100644 index ce8b07c9075..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-atomics-cc.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_intrinsic.rs - - -extern crate cci_intrinsic; -use cci_intrinsic::atomic_xchg; - -pub fn main() { - let mut x = 1; - atomic_xchg(&mut x, 5); - assert_eq!(x, 5); -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-atomics.rs b/src/test/ui/run-pass/intrinsics/intrinsic-atomics.rs deleted file mode 100644 index d238a57a076..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-atomics.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn atomic_cxchg(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_acq(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchg_rel(dst: *mut T, old: T, src: T) -> (T, bool); - - pub fn atomic_cxchgweak(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_acq(dst: *mut T, old: T, src: T) -> (T, bool); - pub fn atomic_cxchgweak_rel(dst: *mut T, old: T, src: T) -> (T, bool); - - pub fn atomic_load(src: *const T) -> T; - pub fn atomic_load_acq(src: *const T) -> T; - - pub fn atomic_store(dst: *mut T, val: T); - pub fn atomic_store_rel(dst: *mut T, val: T); - - pub fn atomic_xchg(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_acq(dst: *mut T, src: T) -> T; - pub fn atomic_xchg_rel(dst: *mut T, src: T) -> T; - - pub fn atomic_xadd(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_acq(dst: *mut T, src: T) -> T; - pub fn atomic_xadd_rel(dst: *mut T, src: T) -> T; - - pub fn atomic_xsub(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_acq(dst: *mut T, src: T) -> T; - pub fn atomic_xsub_rel(dst: *mut T, src: T) -> T; - } -} - -pub fn main() { - unsafe { - let mut x: Box<_> = box 1; - - assert_eq!(rusti::atomic_load(&*x), 1); - *x = 5; - assert_eq!(rusti::atomic_load_acq(&*x), 5); - - rusti::atomic_store(&mut *x,3); - assert_eq!(*x, 3); - rusti::atomic_store_rel(&mut *x,1); - assert_eq!(*x, 1); - - assert_eq!(rusti::atomic_cxchg(&mut *x, 1, 2), (1, true)); - assert_eq!(*x, 2); - - assert_eq!(rusti::atomic_cxchg_acq(&mut *x, 1, 3), (2, false)); - assert_eq!(*x, 2); - - assert_eq!(rusti::atomic_cxchg_rel(&mut *x, 2, 1), (2, true)); - assert_eq!(*x, 1); - - assert_eq!(rusti::atomic_xchg(&mut *x, 0), 1); - assert_eq!(*x, 0); - - assert_eq!(rusti::atomic_xchg_acq(&mut *x, 1), 0); - assert_eq!(*x, 1); - - assert_eq!(rusti::atomic_xchg_rel(&mut *x, 0), 1); - assert_eq!(*x, 0); - - assert_eq!(rusti::atomic_xadd(&mut *x, 1), 0); - assert_eq!(rusti::atomic_xadd_acq(&mut *x, 1), 1); - assert_eq!(rusti::atomic_xadd_rel(&mut *x, 1), 2); - assert_eq!(*x, 3); - - assert_eq!(rusti::atomic_xsub(&mut *x, 1), 3); - assert_eq!(rusti::atomic_xsub_acq(&mut *x, 1), 2); - assert_eq!(rusti::atomic_xsub_rel(&mut *x, 1), 1); - assert_eq!(*x, 0); - - loop { - let res = rusti::atomic_cxchgweak(&mut *x, 0, 1); - assert_eq!(res.0, 0); - if res.1 { - break; - } - } - assert_eq!(*x, 1); - - loop { - let res = rusti::atomic_cxchgweak_acq(&mut *x, 1, 2); - assert_eq!(res.0, 1); - if res.1 { - break; - } - } - assert_eq!(*x, 2); - - loop { - let res = rusti::atomic_cxchgweak_rel(&mut *x, 2, 3); - assert_eq!(res.0, 2); - if res.1 { - break; - } - } - assert_eq!(*x, 3); - } -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-move-val-cleanups.rs b/src/test/ui/run-pass/intrinsics/intrinsic-move-val-cleanups.rs deleted file mode 100644 index 5b04daeb332..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-move-val-cleanups.rs +++ /dev/null @@ -1,198 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support -#![allow(stable_features)] - -// This test is checking that the move_val_init intrinsic is -// respecting cleanups for both of its argument expressions. -// -// In other words, if either DEST or SOURCE in -// -// `intrinsics::move_val_init(DEST, SOURCE) -// -// introduce temporaries that require cleanup, and SOURCE panics, then -// make sure the cleanups still occur. - -#![feature(core_intrinsics, sync_poison)] - -use std::cell::RefCell; -use std::intrinsics; -use std::sync::{Arc, LockResult, Mutex, MutexGuard}; -use std::thread; - -type LogEntry = (&'static str, i32); -type Guarded = RefCell>; -#[derive(Clone)] -struct Log(Arc>); -struct Acquired<'a>(MutexGuard<'a, Guarded>); -type LogState = (MutexWas, &'static [LogEntry]); - -#[derive(Copy, Clone, PartialEq, Eq, Debug)] -enum MutexWas { Poisoned, NotPoisoned } - -impl Log { - fn lock(&self) -> LockResult>>> { self.0.lock() } - fn acquire(&self) -> Acquired { Acquired(self.0.lock().unwrap()) } -} - -impl<'a> Acquired<'a> { - fn log(&self, s: &'static str, i: i32) { self.0.borrow_mut().push((s, i)); } -} - -const TEST1_EXPECT: LogState = (MutexWas::NotPoisoned, - &[("double-check non-poisoning path", 1) - ]); - -fn test1(log: Log) { - { - let acq = log.acquire(); - acq.log("double-check non-poisoning path", 1); - } - panic!("every test ends in a panic"); -} - -const TEST2_EXPECT: LogState = (MutexWas::Poisoned, - &[("double-check poisoning path", 1), - ("and multiple log entries", 2), - ]); -fn test2(log: Log) { - let acq = log.acquire(); - acq.log("double-check poisoning path", 1); - acq.log("and multiple log entries", 2); - panic!("every test ends in a panic"); -} - -struct LogOnDrop<'a>(&'a Acquired<'a>, &'static str, i32); -impl<'a> Drop for LogOnDrop<'a> { - fn drop(&mut self) { - self.0.log(self.1, self.2); - } -} - -const TEST3_EXPECT: LogState = (MutexWas::Poisoned, - &[("double-check destructors can log", 1), - ("drop d2", 2), - ("drop d1", 3), - ]); -fn test3(log: Log) { - let acq = log.acquire(); - acq.log("double-check destructors can log", 1); - let _d1 = LogOnDrop(&acq, "drop d1", 3); - let _d2 = LogOnDrop(&acq, "drop d2", 2); - panic!("every test ends in a panic"); -} - -// The *real* tests of panic-handling for move_val_init intrinsic -// start here. - -const TEST4_EXPECT: LogState = (MutexWas::Poisoned, - &[("neither arg panics", 1), - ("drop temp LOD", 2), - ("drop temp LOD", 3), - ("drop dest_b", 4), - ("drop dest_a", 5), - ]); -fn test4(log: Log) { - let acq = log.acquire(); - acq.log("neither arg panics", 1); - let mut dest_a = LogOnDrop(&acq, "a will be overwritten, not dropped", 0); - let mut dest_b = LogOnDrop(&acq, "b will be overwritten, not dropped", 0); - unsafe { - intrinsics::move_val_init({ LogOnDrop(&acq, "drop temp LOD", 2); &mut dest_a }, - LogOnDrop(&acq, "drop dest_a", 5)); - intrinsics::move_val_init(&mut dest_b, { LogOnDrop(&acq, "drop temp LOD", 3); - LogOnDrop(&acq, "drop dest_b", 4) }); - } - panic!("every test ends in a panic"); -} - - -// Check that move_val_init(PANIC, SOURCE_EXPR) never evaluates SOURCE_EXPR -const TEST5_EXPECT: LogState = (MutexWas::Poisoned, - &[("first arg panics", 1), - ("drop orig dest_a", 2), - ]); -fn test5(log: Log) { - let acq = log.acquire(); - acq.log("first arg panics", 1); - let mut _dest_a = LogOnDrop(&acq, "drop orig dest_a", 2); - unsafe { - intrinsics::move_val_init({ panic!("every test ends in a panic") }, - LogOnDrop(&acq, "we never get here", 0)); - } -} - -// Check that move_val_init(DEST_EXPR, PANIC) cleans up temps from DEST_EXPR. -const TEST6_EXPECT: LogState = (MutexWas::Poisoned, - &[("second arg panics", 1), - ("drop temp LOD", 2), - ("drop orig dest_a", 3), - ]); -fn test6(log: Log) { - let acq = log.acquire(); - acq.log("second arg panics", 1); - let mut dest_a = LogOnDrop(&acq, "drop orig dest_a", 3); - unsafe { - intrinsics::move_val_init({ LogOnDrop(&acq, "drop temp LOD", 2); &mut dest_a }, - { panic!("every test ends in a panic"); }); - } -} - -// Check that move_val_init(DEST_EXPR, COMPLEX_PANIC) cleans up temps from COMPLEX_PANIC. -const TEST7_EXPECT: LogState = (MutexWas::Poisoned, - &[("second arg panics", 1), - ("drop temp LOD", 2), - ("drop temp LOD", 3), - ("drop orig dest_a", 4), - ]); -fn test7(log: Log) { - let acq = log.acquire(); - acq.log("second arg panics", 1); - let mut dest_a = LogOnDrop(&acq, "drop orig dest_a", 4); - unsafe { - intrinsics::move_val_init({ LogOnDrop(&acq, "drop temp LOD", 2); &mut dest_a }, - { LogOnDrop(&acq, "drop temp LOD", 3); - panic!("every test ends in a panic"); }); - } -} - -const TEST_SUITE: &'static [(&'static str, fn (Log), LogState)] = - &[("test1", test1, TEST1_EXPECT), - ("test2", test2, TEST2_EXPECT), - ("test3", test3, TEST3_EXPECT), - ("test4", test4, TEST4_EXPECT), - ("test5", test5, TEST5_EXPECT), - ("test6", test6, TEST6_EXPECT), - ("test7", test7, TEST7_EXPECT), - ]; - -fn main() { - for &(name, test, expect) in TEST_SUITE { - let log = Log(Arc::new(Mutex::new(RefCell::new(Vec::new())))); - let ret = { let log = log.clone(); thread::spawn(move || test(log)).join() }; - assert!(ret.is_err(), "{} must end with panic", name); - { - let l = log.lock(); - match l { - Ok(acq) => { - assert_eq!((MutexWas::NotPoisoned, &acq.borrow()[..]), expect); - println!("{} (unpoisoned) log: {:?}", name, *acq); - } - Err(e) => { - let acq = e.into_inner(); - assert_eq!((MutexWas::Poisoned, &acq.borrow()[..]), expect); - println!("{} (poisoned) log: {:?}", name, *acq); - } - } - } - } -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-move-val.rs b/src/test/ui/run-pass/intrinsics/intrinsic-move-val.rs deleted file mode 100644 index dcc495e5923..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-move-val.rs +++ /dev/null @@ -1,92 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(box_syntax)] -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn init() -> T; - pub fn move_val_init(dst: *mut T, src: T); - } -} - -pub fn main() { - unsafe { - // sanity check - check_drops_state(0, None); - - let mut x: Box = box D(1); - assert_eq!(x.0, 1); - - // A normal overwrite, to demonstrate `check_drops_state`. - x = box D(2); - - // At this point, one destructor has run, because the - // overwrite of `x` drops its initial value. - check_drops_state(1, Some(1)); - - let mut y: Box = rusti::init(); - - // An initial binding does not overwrite anything. - check_drops_state(1, Some(1)); - - // Since `y` has been initialized via the `init` intrinsic, it - // would be unsound to directly overwrite its value via normal - // assignment. - // - // The code currently generated by the compiler is overly - // accepting, however, in that it will check if `y` is itself - // null and thus avoid the unsound action of attempting to - // free null. In other words, if we were to do a normal - // assignment like `y = box D(4);` here, it probably would not - // crash today. But the plan is that it may well crash in the - // future, (I believe). - - // `x` is moved here; the manner in which this is tracked by the - // compiler is hidden. - rusti::move_val_init(&mut y, x); - - // But what we *can* observe is how many times the destructor - // for `D` is invoked, and what the last value we saw was - // during such a destructor call. We do so after the end of - // this scope. - - assert_eq!(y.0, 2); - y.0 = 3; - assert_eq!(y.0, 3); - - check_drops_state(1, Some(1)); - } - - check_drops_state(2, Some(3)); -} - -static mut NUM_DROPS: i32 = 0; -static mut LAST_DROPPED: Option = None; - -fn check_drops_state(num_drops: i32, last_dropped: Option) { - unsafe { - assert_eq!(NUM_DROPS, num_drops); - assert_eq!(LAST_DROPPED, last_dropped); - } -} - -struct D(i32); -impl Drop for D { - fn drop(&mut self) { - unsafe { - NUM_DROPS += 1; - LAST_DROPPED = Some(self.0); - } - } -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-uninit.rs b/src/test/ui/run-pass/intrinsics/intrinsic-uninit.rs deleted file mode 100644 index 0f58bdbb9c5..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-uninit.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn uninit() -> T; - } -} -pub fn main() { - let _a : isize = unsafe {rusti::uninit()}; -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsic-unreachable.rs b/src/test/ui/run-pass/intrinsics/intrinsic-unreachable.rs deleted file mode 100644 index 586d0a352f9..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsic-unreachable.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] - -use std::intrinsics; - -// See also src/test/run-make/intrinsic-unreachable. - -unsafe fn f(x: usize) -> usize { - match x { - 17 => 23, - _ => intrinsics::unreachable(), - } -} - -fn main() { - assert_eq!(unsafe { f(17) }, 23); -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsics-integer.rs b/src/test/ui/run-pass/intrinsics/intrinsics-integer.rs deleted file mode 100644 index 97c1c93cfd4..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsics-integer.rs +++ /dev/null @@ -1,180 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no i128 support - -#![feature(intrinsics)] - -mod rusti { - extern "rust-intrinsic" { - pub fn ctpop(x: T) -> T; - pub fn ctlz(x: T) -> T; - pub fn ctlz_nonzero(x: T) -> T; - pub fn cttz(x: T) -> T; - pub fn cttz_nonzero(x: T) -> T; - pub fn bswap(x: T) -> T; - pub fn bitreverse(x: T) -> T; - } -} - -pub fn main() { - unsafe { - use rusti::*; - - assert_eq!(ctpop(0u8), 0); assert_eq!(ctpop(0i8), 0); - assert_eq!(ctpop(0u16), 0); assert_eq!(ctpop(0i16), 0); - assert_eq!(ctpop(0u32), 0); assert_eq!(ctpop(0i32), 0); - assert_eq!(ctpop(0u64), 0); assert_eq!(ctpop(0i64), 0); - assert_eq!(ctpop(0u128), 0); assert_eq!(ctpop(0i128), 0); - - assert_eq!(ctpop(1u8), 1); assert_eq!(ctpop(1i8), 1); - assert_eq!(ctpop(1u16), 1); assert_eq!(ctpop(1i16), 1); - assert_eq!(ctpop(1u32), 1); assert_eq!(ctpop(1i32), 1); - assert_eq!(ctpop(1u64), 1); assert_eq!(ctpop(1i64), 1); - assert_eq!(ctpop(1u128), 1); assert_eq!(ctpop(1i128), 1); - - assert_eq!(ctpop(10u8), 2); assert_eq!(ctpop(10i8), 2); - assert_eq!(ctpop(10u16), 2); assert_eq!(ctpop(10i16), 2); - assert_eq!(ctpop(10u32), 2); assert_eq!(ctpop(10i32), 2); - assert_eq!(ctpop(10u64), 2); assert_eq!(ctpop(10i64), 2); - assert_eq!(ctpop(10u128), 2); assert_eq!(ctpop(10i128), 2); - - assert_eq!(ctpop(100u8), 3); assert_eq!(ctpop(100i8), 3); - assert_eq!(ctpop(100u16), 3); assert_eq!(ctpop(100i16), 3); - assert_eq!(ctpop(100u32), 3); assert_eq!(ctpop(100i32), 3); - assert_eq!(ctpop(100u64), 3); assert_eq!(ctpop(100i64), 3); - assert_eq!(ctpop(100u128), 3); assert_eq!(ctpop(100i128), 3); - - assert_eq!(ctpop(-1i8 as u8), 8); assert_eq!(ctpop(-1i8), 8); - assert_eq!(ctpop(-1i16 as u16), 16); assert_eq!(ctpop(-1i16), 16); - assert_eq!(ctpop(-1i32 as u32), 32); assert_eq!(ctpop(-1i32), 32); - assert_eq!(ctpop(-1i64 as u64), 64); assert_eq!(ctpop(-1i64), 64); - assert_eq!(ctpop(-1i128 as u128), 128); assert_eq!(ctpop(-1i128), 128); - - assert_eq!(ctlz(0u8), 8); assert_eq!(ctlz(0i8), 8); - assert_eq!(ctlz(0u16), 16); assert_eq!(ctlz(0i16), 16); - assert_eq!(ctlz(0u32), 32); assert_eq!(ctlz(0i32), 32); - assert_eq!(ctlz(0u64), 64); assert_eq!(ctlz(0i64), 64); - assert_eq!(ctlz(0u128), 128); assert_eq!(ctlz(0i128), 128); - - assert_eq!(ctlz(1u8), 7); assert_eq!(ctlz(1i8), 7); - assert_eq!(ctlz(1u16), 15); assert_eq!(ctlz(1i16), 15); - assert_eq!(ctlz(1u32), 31); assert_eq!(ctlz(1i32), 31); - assert_eq!(ctlz(1u64), 63); assert_eq!(ctlz(1i64), 63); - assert_eq!(ctlz(1u128), 127); assert_eq!(ctlz(1i128), 127); - - assert_eq!(ctlz(10u8), 4); assert_eq!(ctlz(10i8), 4); - assert_eq!(ctlz(10u16), 12); assert_eq!(ctlz(10i16), 12); - assert_eq!(ctlz(10u32), 28); assert_eq!(ctlz(10i32), 28); - assert_eq!(ctlz(10u64), 60); assert_eq!(ctlz(10i64), 60); - assert_eq!(ctlz(10u128), 124); assert_eq!(ctlz(10i128), 124); - - assert_eq!(ctlz(100u8), 1); assert_eq!(ctlz(100i8), 1); - assert_eq!(ctlz(100u16), 9); assert_eq!(ctlz(100i16), 9); - assert_eq!(ctlz(100u32), 25); assert_eq!(ctlz(100i32), 25); - assert_eq!(ctlz(100u64), 57); assert_eq!(ctlz(100i64), 57); - assert_eq!(ctlz(100u128), 121); assert_eq!(ctlz(100i128), 121); - - assert_eq!(ctlz_nonzero(1u8), 7); assert_eq!(ctlz_nonzero(1i8), 7); - assert_eq!(ctlz_nonzero(1u16), 15); assert_eq!(ctlz_nonzero(1i16), 15); - assert_eq!(ctlz_nonzero(1u32), 31); assert_eq!(ctlz_nonzero(1i32), 31); - assert_eq!(ctlz_nonzero(1u64), 63); assert_eq!(ctlz_nonzero(1i64), 63); - assert_eq!(ctlz_nonzero(1u128), 127); assert_eq!(ctlz_nonzero(1i128), 127); - - assert_eq!(ctlz_nonzero(10u8), 4); assert_eq!(ctlz_nonzero(10i8), 4); - assert_eq!(ctlz_nonzero(10u16), 12); assert_eq!(ctlz_nonzero(10i16), 12); - assert_eq!(ctlz_nonzero(10u32), 28); assert_eq!(ctlz_nonzero(10i32), 28); - assert_eq!(ctlz_nonzero(10u64), 60); assert_eq!(ctlz_nonzero(10i64), 60); - assert_eq!(ctlz_nonzero(10u128), 124); assert_eq!(ctlz_nonzero(10i128), 124); - - assert_eq!(ctlz_nonzero(100u8), 1); assert_eq!(ctlz_nonzero(100i8), 1); - assert_eq!(ctlz_nonzero(100u16), 9); assert_eq!(ctlz_nonzero(100i16), 9); - assert_eq!(ctlz_nonzero(100u32), 25); assert_eq!(ctlz_nonzero(100i32), 25); - assert_eq!(ctlz_nonzero(100u64), 57); assert_eq!(ctlz_nonzero(100i64), 57); - assert_eq!(ctlz_nonzero(100u128), 121); assert_eq!(ctlz_nonzero(100i128), 121); - - assert_eq!(cttz(-1i8 as u8), 0); assert_eq!(cttz(-1i8), 0); - assert_eq!(cttz(-1i16 as u16), 0); assert_eq!(cttz(-1i16), 0); - assert_eq!(cttz(-1i32 as u32), 0); assert_eq!(cttz(-1i32), 0); - assert_eq!(cttz(-1i64 as u64), 0); assert_eq!(cttz(-1i64), 0); - assert_eq!(cttz(-1i128 as u128), 0); assert_eq!(cttz(-1i128), 0); - - assert_eq!(cttz(0u8), 8); assert_eq!(cttz(0i8), 8); - assert_eq!(cttz(0u16), 16); assert_eq!(cttz(0i16), 16); - assert_eq!(cttz(0u32), 32); assert_eq!(cttz(0i32), 32); - assert_eq!(cttz(0u64), 64); assert_eq!(cttz(0i64), 64); - assert_eq!(cttz(0u128), 128); assert_eq!(cttz(0i128), 128); - - assert_eq!(cttz(1u8), 0); assert_eq!(cttz(1i8), 0); - assert_eq!(cttz(1u16), 0); assert_eq!(cttz(1i16), 0); - assert_eq!(cttz(1u32), 0); assert_eq!(cttz(1i32), 0); - assert_eq!(cttz(1u64), 0); assert_eq!(cttz(1i64), 0); - assert_eq!(cttz(1u128), 0); assert_eq!(cttz(1i128), 0); - - assert_eq!(cttz(10u8), 1); assert_eq!(cttz(10i8), 1); - assert_eq!(cttz(10u16), 1); assert_eq!(cttz(10i16), 1); - assert_eq!(cttz(10u32), 1); assert_eq!(cttz(10i32), 1); - assert_eq!(cttz(10u64), 1); assert_eq!(cttz(10i64), 1); - assert_eq!(cttz(10u128), 1); assert_eq!(cttz(10i128), 1); - - assert_eq!(cttz(100u8), 2); assert_eq!(cttz(100i8), 2); - assert_eq!(cttz(100u16), 2); assert_eq!(cttz(100i16), 2); - assert_eq!(cttz(100u32), 2); assert_eq!(cttz(100i32), 2); - assert_eq!(cttz(100u64), 2); assert_eq!(cttz(100i64), 2); - assert_eq!(cttz(100u128), 2); assert_eq!(cttz(100i128), 2); - - assert_eq!(cttz_nonzero(-1i8 as u8), 0); assert_eq!(cttz_nonzero(-1i8), 0); - assert_eq!(cttz_nonzero(-1i16 as u16), 0); assert_eq!(cttz_nonzero(-1i16), 0); - assert_eq!(cttz_nonzero(-1i32 as u32), 0); assert_eq!(cttz_nonzero(-1i32), 0); - assert_eq!(cttz_nonzero(-1i64 as u64), 0); assert_eq!(cttz_nonzero(-1i64), 0); - assert_eq!(cttz_nonzero(-1i128 as u128), 0); assert_eq!(cttz_nonzero(-1i128), 0); - - assert_eq!(cttz_nonzero(1u8), 0); assert_eq!(cttz_nonzero(1i8), 0); - assert_eq!(cttz_nonzero(1u16), 0); assert_eq!(cttz_nonzero(1i16), 0); - assert_eq!(cttz_nonzero(1u32), 0); assert_eq!(cttz_nonzero(1i32), 0); - assert_eq!(cttz_nonzero(1u64), 0); assert_eq!(cttz_nonzero(1i64), 0); - assert_eq!(cttz_nonzero(1u128), 0); assert_eq!(cttz_nonzero(1i128), 0); - - assert_eq!(cttz_nonzero(10u8), 1); assert_eq!(cttz_nonzero(10i8), 1); - assert_eq!(cttz_nonzero(10u16), 1); assert_eq!(cttz_nonzero(10i16), 1); - assert_eq!(cttz_nonzero(10u32), 1); assert_eq!(cttz_nonzero(10i32), 1); - assert_eq!(cttz_nonzero(10u64), 1); assert_eq!(cttz_nonzero(10i64), 1); - assert_eq!(cttz_nonzero(10u128), 1); assert_eq!(cttz_nonzero(10i128), 1); - - assert_eq!(cttz_nonzero(100u8), 2); assert_eq!(cttz_nonzero(100i8), 2); - assert_eq!(cttz_nonzero(100u16), 2); assert_eq!(cttz_nonzero(100i16), 2); - assert_eq!(cttz_nonzero(100u32), 2); assert_eq!(cttz_nonzero(100i32), 2); - assert_eq!(cttz_nonzero(100u64), 2); assert_eq!(cttz_nonzero(100i64), 2); - assert_eq!(cttz_nonzero(100u128), 2); assert_eq!(cttz_nonzero(100i128), 2); - - assert_eq!(bswap(0x0Au8), 0x0A); // no-op - assert_eq!(bswap(0x0Ai8), 0x0A); // no-op - assert_eq!(bswap(0x0A0Bu16), 0x0B0A); - assert_eq!(bswap(0x0A0Bi16), 0x0B0A); - assert_eq!(bswap(0x0ABBCC0Du32), 0x0DCCBB0A); - assert_eq!(bswap(0x0ABBCC0Di32), 0x0DCCBB0A); - assert_eq!(bswap(0x0122334455667708u64), 0x0877665544332201); - assert_eq!(bswap(0x0122334455667708i64), 0x0877665544332201); - assert_eq!(bswap(0x0122334455667708u128), 0x08776655443322010000000000000000); - assert_eq!(bswap(0x0122334455667708i128), 0x08776655443322010000000000000000); - - assert_eq!(bitreverse(0x0Au8), 0x50); - assert_eq!(bitreverse(0x0Ai8), 0x50); - assert_eq!(bitreverse(0x0A0Cu16), 0x3050); - assert_eq!(bitreverse(0x0A0Ci16), 0x3050); - assert_eq!(bitreverse(0x0ABBCC0Eu32), 0x7033DD50); - assert_eq!(bitreverse(0x0ABBCC0Ei32), 0x7033DD50); - assert_eq!(bitreverse(0x0122334455667708u64), 0x10EE66AA22CC4480); - assert_eq!(bitreverse(0x0122334455667708i64), 0x10EE66AA22CC4480); - assert_eq!(bitreverse(0x0122334455667708u128), 0x10EE66AA22CC44800000000000000000); - assert_eq!(bitreverse(0x0122334455667708i128), 0x10EE66AA22CC44800000000000000000); - } -} diff --git a/src/test/ui/run-pass/intrinsics/intrinsics-math.rs b/src/test/ui/run-pass/intrinsics/intrinsics-math.rs deleted file mode 100644 index d08386beb9e..00000000000 --- a/src/test/ui/run-pass/intrinsics/intrinsics-math.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten fma not implemented in emscripten - -macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ - let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) -} - -pub fn main() { - use std::f32; - use std::f64; - - assert_approx_eq!(64f32.sqrt(), 8f32); - assert_approx_eq!(64f64.sqrt(), 8f64); - - assert_approx_eq!(25f32.powi(-2), 0.0016f32); - assert_approx_eq!(23.2f64.powi(2), 538.24f64); - - assert_approx_eq!(0f32.sin(), 0f32); - assert_approx_eq!((f64::consts::PI / 2f64).sin(), 1f64); - - assert_approx_eq!(0f32.cos(), 1f32); - assert_approx_eq!((f64::consts::PI * 2f64).cos(), 1f64); - - assert_approx_eq!(25f32.powf(-2f32), 0.0016f32); - assert_approx_eq!(400f64.powf(0.5f64), 20f64); - - assert_approx_eq!((1f32.exp() - f32::consts::E).abs(), 0f32); - assert_approx_eq!(1f64.exp(), f64::consts::E); - - assert_approx_eq!(10f32.exp2(), 1024f32); - assert_approx_eq!(50f64.exp2(), 1125899906842624f64); - - assert_approx_eq!((f32::consts::E.ln() - 1f32).abs(), 0f32); - assert_approx_eq!(1f64.ln(), 0f64); - - assert_approx_eq!(10f32.log10(), 1f32); - assert_approx_eq!(f64::consts::E.log10(), f64::consts::LOG10_E); - - assert_approx_eq!(8f32.log2(), 3f32); - assert_approx_eq!(f64::consts::E.log2(), f64::consts::LOG2_E); - - assert_approx_eq!(1.0f32.mul_add(2.0f32, 5.0f32), 7.0f32); - assert_approx_eq!(0.0f64.mul_add(-2.0f64, f64::consts::E), f64::consts::E); - - assert_approx_eq!((-1.0f32).abs(), 1.0f32); - assert_approx_eq!(34.2f64.abs(), 34.2f64); - - assert_approx_eq!(3.8f32.floor(), 3.0f32); - assert_approx_eq!((-1.1f64).floor(), -2.0f64); - - assert_approx_eq!((-2.3f32).ceil(), -2.0f32); - assert_approx_eq!(3.8f64.ceil(), 4.0f64); - - assert_approx_eq!(0.1f32.trunc(), 0.0f32); - assert_approx_eq!((-0.1f64).trunc(), 0.0f64); -} diff --git a/src/test/ui/run-pass/issues/.gitattributes b/src/test/ui/run-pass/issues/.gitattributes deleted file mode 100644 index 4517a4a2f1e..00000000000 --- a/src/test/ui/run-pass/issues/.gitattributes +++ /dev/null @@ -1 +0,0 @@ -issue-16278.rs -text diff --git a/src/test/ui/run-pass/issues/auxiliary/cgu_test.rs b/src/test/ui/run-pass/issues/auxiliary/cgu_test.rs deleted file mode 100644 index 7c88d3d37e3..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/cgu_test.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags: --crate-type=lib - -pub fn id(t: T) -> T { - t -} diff --git a/src/test/ui/run-pass/issues/auxiliary/cgu_test_a.rs b/src/test/ui/run-pass/issues/auxiliary/cgu_test_a.rs deleted file mode 100644 index 0f0d1cd87e1..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/cgu_test_a.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags: -Ccodegen-units=2 --crate-type=lib - -extern crate cgu_test; - -pub mod a { - pub fn a() { - ::cgu_test::id(0); - } -} -pub mod b { - pub fn a() { - ::cgu_test::id(0); - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/cgu_test_b.rs b/src/test/ui/run-pass/issues/auxiliary/cgu_test_b.rs deleted file mode 100644 index 0f0d1cd87e1..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/cgu_test_b.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags: -Ccodegen-units=2 --crate-type=lib - -extern crate cgu_test; - -pub mod a { - pub fn a() { - ::cgu_test::id(0); - } -} -pub mod b { - pub fn a() { - ::cgu_test::id(0); - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/i8.rs b/src/test/ui/run-pass/issues/auxiliary/i8.rs deleted file mode 100644 index 44e62b99a96..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/i8.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// A crate named after a built-in type. - -pub struct Test; diff --git a/src/test/ui/run-pass/issues/auxiliary/iss.rs b/src/test/ui/run-pass/issues/auxiliary/iss.rs deleted file mode 100644 index b231efa0fec..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/iss.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="issue6919_3"] - -// part of issue-6919.rs - -pub struct C where K: FnOnce() { - pub k: K, -} - -fn no_op() { } -pub const D : C = C { - k: no_op as fn() -}; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-10028.rs b/src/test/ui/run-pass/issues/auxiliary/issue-10028.rs deleted file mode 100644 index ed42ad6e875..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-10028.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct ZeroLengthThingWithDestructor; -impl Drop for ZeroLengthThingWithDestructor { - fn drop(&mut self) {} -} -impl ZeroLengthThingWithDestructor { - pub fn new() -> ZeroLengthThingWithDestructor { - ZeroLengthThingWithDestructor - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-11224.rs b/src/test/ui/run-pass/issues/auxiliary/issue-11224.rs deleted file mode 100644 index 15b72b37781..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-11224.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![deny(dead_code)] - -mod inner { - pub trait Trait { - fn f(&self) { f(); } - } - - impl Trait for isize {} - - fn f() {} -} - -pub fn foo() { - let a = &1isize as &inner::Trait; - a.f(); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-11225-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-11225-1.rs deleted file mode 100644 index e1ec15be927..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-11225-1.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -mod inner { - pub trait Trait { - fn f(&self) { f(); } - fn f_ufcs(&self) { f_ufcs(); } - } - - impl Trait for isize {} - - fn f() {} - fn f_ufcs() {} -} - -pub fn foo(t: T) { - t.f(); -} -pub fn foo_ufcs(t: T) { - T::f_ufcs(&t); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-11225-2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-11225-2.rs deleted file mode 100644 index 25110edda27..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-11225-2.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use inner::Trait; - -mod inner { - pub struct Foo; - pub trait Trait { - fn f(&self); - fn f_ufcs(&self); - } - - impl Trait for Foo { - fn f(&self) { } - fn f_ufcs(&self) { } - } -} - -pub trait Outer { - fn foo(&self, t: T) { t.f(); } - fn foo_ufcs(&self, t: T) { T::f(&t); } -} - -impl Outer for isize {} - -pub fn foo(t: T) { - t.foo(inner::Foo); -} -pub fn foo_ufcs(t: T) { - T::foo_ufcs(&t, inner::Foo) -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-11225-3.rs b/src/test/ui/run-pass/issues/auxiliary/issue-11225-3.rs deleted file mode 100644 index d48fb68ba0f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-11225-3.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait PrivateTrait { - fn private_trait_method(&self); - fn private_trait_method_ufcs(&self); -} - -struct PrivateStruct; - -impl PrivateStruct { - fn private_inherent_method(&self) { } - fn private_inherent_method_ufcs(&self) { } -} - -impl PrivateTrait for PrivateStruct { - fn private_trait_method(&self) { } - fn private_trait_method_ufcs(&self) { } -} - -#[inline] -pub fn public_inlinable_function() { - PrivateStruct.private_trait_method(); - PrivateStruct.private_inherent_method(); -} - -#[inline] -pub fn public_inlinable_function_ufcs() { - PrivateStruct::private_trait_method(&PrivateStruct); - PrivateStruct::private_inherent_method(&PrivateStruct); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-11508.rs b/src/test/ui/run-pass/issues/auxiliary/issue-11508.rs deleted file mode 100644 index c5dc3439f2f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-11508.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Closed01(pub F); - -pub trait Bar { fn new() -> Self; } - -impl Bar for Closed01 { - fn new() -> Closed01 { Closed01(Bar::new()) } -} -impl Bar for f32 { fn new() -> f32 { 1.0 } } - -pub fn random() -> T { Bar::new() } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-11529.rs b/src/test/ui/run-pass/issues/auxiliary/issue-11529.rs deleted file mode 100644 index 21ef99e3c3d..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-11529.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct A<'a>(pub &'a isize); diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib.rs b/src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib.rs deleted file mode 100644 index ea22258f67d..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "dylib"] diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib2.rs deleted file mode 100644 index fa5722ae6a3..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-12133-dylib2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "dylib"] - -extern crate issue_12133_rlib as a; -extern crate issue_12133_dylib as b; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-12133-rlib.rs b/src/test/ui/run-pass/issues/auxiliary/issue-12133-rlib.rs deleted file mode 100644 index 8e46acca124..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-12133-rlib.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-12660-aux.rs b/src/test/ui/run-pass/issues/auxiliary/issue-12660-aux.rs deleted file mode 100644 index 9f2bd5d0e93..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-12660-aux.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] -#![crate_name="issue12660aux"] - -pub use my_mod::{MyStruct, my_fn}; - -mod my_mod { - pub struct MyStruct; - - pub fn my_fn(my_struct: MyStruct) { - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-13620-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-13620-1.rs deleted file mode 100644 index e373421fabf..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-13620-1.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo { - pub foo: extern fn() -} - -extern fn the_foo() {} - -pub const FOO: Foo = Foo { - foo: the_foo -}; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-13620-2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-13620-2.rs deleted file mode 100644 index 554170bc130..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-13620-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate issue_13620_1 as crate1; - -pub static FOO2: crate1::Foo = crate1::FOO; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-13872-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-13872-1.rs deleted file mode 100644 index 941b67eb2da..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-13872-1.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub enum A { B } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-13872-2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-13872-2.rs deleted file mode 100644 index bb51417528a..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-13872-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate issue_13872_1 as foo; - -pub use foo::A::B; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-13872-3.rs b/src/test/ui/run-pass/issues/auxiliary/issue-13872-3.rs deleted file mode 100644 index e20618f1ec0..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-13872-3.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate issue_13872_2 as bar; - -use bar::B; - -pub fn foo() { - match B { - B => {} - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-14344-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-14344-1.rs deleted file mode 100644 index 78c03bac33f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-14344-1.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn foo() {} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-14344-2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-14344-2.rs deleted file mode 100644 index 9df35e50adb..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-14344-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate issue_14344_1; - -pub fn bar() {} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-14421.rs b/src/test/ui/run-pass/issues/auxiliary/issue-14421.rs deleted file mode 100644 index a48088609f9..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-14421.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] -#![deny(warnings)] -#![allow(dead_code)] - -pub use src::aliases::B; -pub use src::hidden_core::make; - -mod src { - pub mod aliases { - use super::hidden_core::A; - pub type B = A; - } - - pub mod hidden_core { - use super::aliases::B; - - pub struct A { t: T } - - pub fn make() -> B { A { t: 1.0 } } - - impl A { - pub fn foo(&mut self) { println!("called foo"); } - } - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-14422.rs b/src/test/ui/run-pass/issues/auxiliary/issue-14422.rs deleted file mode 100644 index 32af6d9255e..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-14422.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] -#![deny(warnings)] - -pub use src::aliases::B; -pub use src::hidden_core::make; - -mod src { - pub mod aliases { - use super::hidden_core::A; - pub type B = A; - } - - pub mod hidden_core { - use super::aliases::B; - - #[derive(Copy, Clone)] - pub struct A; - - pub fn make() -> B { A } - - impl A { - pub fn foo(&mut self) { println!("called foo"); } - } - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-15562.rs b/src/test/ui/run-pass/issues/auxiliary/issue-15562.rs deleted file mode 100644 index 76243d3bced..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-15562.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -extern { - pub fn transmute(); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-16643.rs b/src/test/ui/run-pass/issues/auxiliary/issue-16643.rs deleted file mode 100644 index b590160a0c2..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-16643.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub struct TreeBuilder { pub h: H } - -impl TreeBuilder { - pub fn process_token(&mut self) { - match self { - _ => for _y in self.by_ref() {} - } - } -} - -impl Iterator for TreeBuilder { - type Item = H; - - fn next(&mut self) -> Option { - None - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-17662.rs b/src/test/ui/run-pass/issues/auxiliary/issue-17662.rs deleted file mode 100644 index fb55a077005..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-17662.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub trait Foo<'a, T> { - fn foo(&'a self) -> T; -} - -pub fn foo<'a, T>(x: &'a Foo<'a, T>) -> T { - let x: &'a Foo = x; - // ^ the lifetime parameter of Foo is left to be inferred. - x.foo() - // ^ encoding this method call in metadata triggers an ICE. -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-17718-aux.rs b/src/test/ui/run-pass/issues/auxiliary/issue-17718-aux.rs deleted file mode 100644 index 2bc8b4b7ba0..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-17718-aux.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::sync::atomic; - -pub const C1: usize = 1; -pub const C2: atomic::AtomicUsize = atomic::AtomicUsize::new(0); -pub const C3: fn() = { fn foo() {} foo }; -pub const C4: usize = C1 * C1 + C1 / C1; -pub const C5: &'static usize = &C4; - -pub static S1: usize = 3; -pub static S2: atomic::AtomicUsize = atomic::AtomicUsize::new(0); - diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-18501.rs b/src/test/ui/run-pass/issues/auxiliary/issue-18501.rs deleted file mode 100644 index af3bc20378c..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-18501.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "rlib"] -struct Foo; - -trait Tr { - fn tr(&self); -} - -impl Tr for Foo { - fn tr(&self) {} -} - -fn take_method(f: fn(&T), t: &T) {} - -#[inline] -pub fn pass_method() { - take_method(Tr::tr, &Foo); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-18514.rs b/src/test/ui/run-pass/issues/auxiliary/issue-18514.rs deleted file mode 100644 index 2a5e07a3285..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-18514.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "rlib"] - -pub trait Tr { - fn tr(&self); -} - -pub struct St(pub Vec); - -impl Tr for St { - fn tr(&self) { - match self { - &St(ref v) => { - v.iter(); - } - } - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-18711.rs b/src/test/ui/run-pass/issues/auxiliary/issue-18711.rs deleted file mode 100644 index c247c0223fc..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-18711.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "rlib"] - -pub fn inner(f: F) -> F { - (move || f)() -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-18913-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-18913-1.rs deleted file mode 100644 index 4315e27797f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-18913-1.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![crate_name = "foo"] - -pub fn foo() -> i32 { 0 } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-18913-2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-18913-2.rs deleted file mode 100644 index dcdeaec48f5..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-18913-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] -#![crate_name = "foo"] - -pub fn foo() -> i32 { 1 } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-19340-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-19340-1.rs deleted file mode 100644 index fc61b78d8a7..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-19340-1.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub enum Homura { - Madoka { name: String }, -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-2380.rs b/src/test/ui/run-pass/issues/auxiliary/issue-2380.rs deleted file mode 100644 index b3e0f061485..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-2380.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="a"] -#![crate_type = "lib"] - -#![feature(box_syntax)] - -pub trait i -{ - fn dummy(&self, t: T) -> T { panic!() } -} - -pub fn f() -> Box+'static> { - impl i for () { } - - box () as Box+'static> -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-2414-a.rs b/src/test/ui/run-pass/issues/auxiliary/issue-2414-a.rs deleted file mode 100644 index 8c414193bd6..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-2414-a.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="a"] -#![crate_type = "lib"] - -type t1 = usize; - -trait foo { - fn foo(&self); -} - -impl foo for String { - fn foo(&self) {} -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-2414-b.rs b/src/test/ui/run-pass/issues/auxiliary/issue-2414-b.rs deleted file mode 100644 index b1c95bcb430..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-2414-b.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -#![crate_name="b"] -#![crate_type = "lib"] - -extern crate a; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-25185-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-25185-1.rs deleted file mode 100644 index b9da39cbbcb..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-25185-1.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - pub fn rust_dbg_extern_identity_u32(u: u32) -> u32; -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-25185-2.rs b/src/test/ui/run-pass/issues/auxiliary/issue-25185-2.rs deleted file mode 100644 index 00b5277d6c0..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-25185-2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate issue_25185_1; - -pub use issue_25185_1::rust_dbg_extern_identity_u32; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-2526.rs b/src/test/ui/run-pass/issues/auxiliary/issue-2526.rs deleted file mode 100644 index 3d777d01d50..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-2526.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="issue_2526"] -#![crate_type = "lib"] - -use std::marker; - -pub struct arc_destruct { - _data: isize, - _marker: marker::PhantomData -} - -impl Drop for arc_destruct { - fn drop(&mut self) {} -} - -fn arc_destruct(data: isize) -> arc_destruct { - arc_destruct { - _data: data, - _marker: marker::PhantomData - } -} - -fn arc(_data: T) -> arc_destruct { - arc_destruct(0) -} - -fn init() -> arc_destruct { - arc(context_res()) -} - -pub struct context_res { - ctx : isize, -} - -impl Drop for context_res { - fn drop(&mut self) {} -} - -fn context_res() -> context_res { - context_res { - ctx: 0 - } -} - -pub type context = arc_destruct; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-25467.rs b/src/test/ui/run-pass/issues/auxiliary/issue-25467.rs deleted file mode 100644 index e358cde1573..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-25467.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub trait Trait { - // the issue is sensitive to interning order - so use names - // unlikely to appear in libstd. - type Issue25467FooT; - type Issue25467BarT; -} - -pub type Object = Option>>; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-2631-a.rs b/src/test/ui/run-pass/issues/auxiliary/issue-2631-a.rs deleted file mode 100644 index 604a3e69a21..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-2631-a.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="req"] -#![crate_type = "lib"] - -use std::cell::RefCell; -use std::collections::HashMap; -use std::rc::Rc; - -pub type header_map = HashMap>>>>; - -// the unused ty param is necessary so this gets monomorphized -pub fn request(req: &header_map) { - let data = req[&"METHOD".to_string()].clone(); - let _x = data.borrow().clone()[0].clone(); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-29485.rs b/src/test/ui/run-pass/issues/auxiliary/issue-29485.rs deleted file mode 100644 index 825c4497021..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-29485.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="a"] -#![crate_type = "lib"] - -pub struct X(pub u8); - -impl Drop for X { - fn drop(&mut self) { - assert_eq!(self.0, 1) - } -} - -pub fn f(x: &mut X, g: fn()) { - x.0 = 1; - g(); - x.0 = 0; -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-3012-1.rs b/src/test/ui/run-pass/issues/auxiliary/issue-3012-1.rs deleted file mode 100644 index f34a97519e7..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-3012-1.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="socketlib"] -#![crate_type = "lib"] - -pub mod socket { - pub struct socket_handle { - sockfd: u32, - } - - impl Drop for socket_handle { - fn drop(&mut self) { - /* c::close(self.sockfd); */ - } - } - - pub fn socket_handle(x: u32) -> socket_handle { - socket_handle { - sockfd: x - } - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-36954.rs b/src/test/ui/run-pass/issues/auxiliary/issue-36954.rs deleted file mode 100644 index 5351a40916b..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-36954.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(min_const_fn)] -#![crate_type = "lib"] - -const fn foo(i: i32) -> i32 { - i -} - -pub const FOO: i32 = foo(1); diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-41394.rs b/src/test/ui/run-pass/issues/auxiliary/issue-41394.rs deleted file mode 100644 index f06b81279ac..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-41394.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -#[repr(u32)] -pub enum Foo { - Foo = Private::Variant as u32 -} - -#[repr(u8)] -enum Private { - Variant = 42 -} - -#[inline(always)] -pub fn foo() -> Foo { - Foo::Foo -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-4208-cc.rs b/src/test/ui/run-pass/issues/auxiliary/issue-4208-cc.rs deleted file mode 100644 index a7c1633784d..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-4208-cc.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="numeric"] -#![crate_type = "lib"] - -pub trait Trig { - fn sin(&self) -> T; -} - -pub fn sin, R>(theta: &T) -> R { theta.sin() } - -pub trait Angle: Trig {} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-4545.rs b/src/test/ui/run-pass/issues/auxiliary/issue-4545.rs deleted file mode 100644 index 29feeaa7d92..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-4545.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct S(Option); -pub fn mk() -> S { S(None) } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-48984-aux.rs b/src/test/ui/run-pass/issues/auxiliary/issue-48984-aux.rs deleted file mode 100644 index 6290279701e..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-48984-aux.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] -#![crate_name = "issue48984aux"] - -pub trait Foo { type Item; } - -pub trait Bar: Foo { } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-5518.rs b/src/test/ui/run-pass/issues/auxiliary/issue-5518.rs deleted file mode 100644 index cea227e050f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-5518.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait A<'a, T> { - fn f(&mut self) -> &'a mut T; - fn p() -> T; -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-5521.rs b/src/test/ui/run-pass/issues/auxiliary/issue-5521.rs deleted file mode 100644 index 82bd2b64204..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-5521.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -use std::collections::HashMap; - -pub type map = Box>; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-7178.rs b/src/test/ui/run-pass/issues/auxiliary/issue-7178.rs deleted file mode 100644 index 18b464bd924..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-7178.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo<'a, A:'a>(&'a A); - -impl<'a, A> Foo<'a, A> { - pub fn new(a: &'a A) -> Foo<'a, A> { - Foo(a) - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-7899.rs b/src/test/ui/run-pass/issues/auxiliary/issue-7899.rs deleted file mode 100644 index e197e84442b..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-7899.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct V2(pub T, pub T); diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-8044.rs b/src/test/ui/run-pass/issues/auxiliary/issue-8044.rs deleted file mode 100644 index 8f328699ae0..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-8044.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct BTree { - pub node: TreeItem, -} - -pub enum TreeItem { - TreeLeaf { value: V }, -} - -pub fn leaf(value: V) -> TreeItem { - TreeItem::TreeLeaf { value: value } -} - -fn main() { - BTree:: { node: leaf(1) }; -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-8259.rs b/src/test/ui/run-pass/issues/auxiliary/issue-8259.rs deleted file mode 100644 index 91167e8e32b..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-8259.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub enum Foo<'a> { - A, - B(&'a str), -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-9906.rs b/src/test/ui/run-pass/issues/auxiliary/issue-9906.rs deleted file mode 100644 index 5eb48985bf9..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-9906.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use other::FooBar; -pub use other::foo; - -mod other { - pub struct FooBar{value: isize} - impl FooBar{ - pub fn new(val: isize) -> FooBar { - FooBar{value: val} - } - } - - pub fn foo(){ - 1+1; - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue-9968.rs b/src/test/ui/run-pass/issues/auxiliary/issue-9968.rs deleted file mode 100644 index d04d761e112..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue-9968.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use internal::core::{Trait, Struct}; - -mod internal { - pub mod core { - pub struct Struct; - impl Struct { - pub fn init() -> Struct { - Struct - } - } - - pub trait Trait { - fn test(&self) { - private(); - } - } - - impl Trait for Struct {} - - fn private() { } - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue13507.rs b/src/test/ui/run-pass/issues/auxiliary/issue13507.rs deleted file mode 100644 index 87b01ed9900..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue13507.rs +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod testtypes { - use std::any::TypeId; - - pub fn type_ids() -> Vec { - vec![ - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::() - ] - } - - // Tests Bool - pub type FooBool = bool; - - // Tests Char - pub type FooChar = char; - - // Tests Int (does not test all variants of IntTy) - pub type FooInt = isize; - - // Tests Uint (does not test all variants of UintTy) - pub type FooUint = usize; - - // Tests Float (does not test all variants of FloatTy) - pub type FooFloat = f64; - - // Tests Str - pub type FooStr = str; - - // Tests Array - pub type FooArray = [u8; 1]; - - // Tests Slice - pub type FooSlice = [u8]; - - // Tests Box (of u8) - pub type FooBox = Box; - - // Tests RawPtr - pub type FooPtr = *const u8; - - // Tests Ref - pub type FooRef = &'static u8; - - // Tests FnPtr - pub type FooFnPtr = fn(u8) -> bool; - - // Tests Dynamic - pub trait FooTrait { - fn foo_method(&self) -> usize; - } - - // Tests struct - pub struct FooStruct { - pub pub_foo_field: usize, - foo_field: usize - } - - // Tests enum - pub enum FooEnum { - VarA(usize), - VarB(usize, usize) - } - - // Tests Tuple - pub type FooNil = (); - pub type FooTuple = (u8, i8, bool); - - // Skipping Param - - // Skipping Infer - - // Skipping Error -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue2170lib.rs b/src/test/ui/run-pass/issues/auxiliary/issue2170lib.rs deleted file mode 100644 index b311ee35674..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue2170lib.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -fn foo(_x: i32) { -} - -pub struct rsrc { - x: i32, -} - -impl Drop for rsrc { - fn drop(&mut self) { - foo(self.x); - } -} - -pub fn rsrc(x: i32) -> rsrc { - rsrc { - x: x - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue34796aux.rs b/src/test/ui/run-pass/issues/auxiliary/issue34796aux.rs deleted file mode 100644 index 9131b609c4c..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue34796aux.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] -pub trait Future { - type Item; - type Error; -} - -impl Future for u32 { - type Item = (); - type Error = Box<()>; -} - -fn foo() -> Box>> { - Box::new(0u32) -} - -pub fn bar(_s: F) - where F: Fn(A) -> B, -{ - foo(); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_10031_aux.rs b/src/test/ui/run-pass/issues/auxiliary/issue_10031_aux.rs deleted file mode 100644 index f0f1af2e3a3..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_10031_aux.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Wrap(pub A); diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_12612_1.rs b/src/test/ui/run-pass/issues/auxiliary/issue_12612_1.rs deleted file mode 100644 index a0234c1185a..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_12612_1.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod bar { - pub fn foo() {} -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_12612_2.rs b/src/test/ui/run-pass/issues/auxiliary/issue_12612_2.rs deleted file mode 100644 index b4ae4374b2e..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_12612_2.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn baz() {} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_19293.rs b/src/test/ui/run-pass/issues/auxiliary/issue_19293.rs deleted file mode 100644 index 12894ad72e1..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_19293.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo (pub isize); -pub enum MyEnum { - Foo(Foo), -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_20389.rs b/src/test/ui/run-pass/issues/auxiliary/issue_20389.rs deleted file mode 100644 index 4ce7e3079e3..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_20389.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait T { - type C; - fn dummy(&self) { } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_2316_a.rs b/src/test/ui/run-pass/issues/auxiliary/issue_2316_a.rs deleted file mode 100644 index 6bd1e7335ad..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_2316_a.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -enum cat { - tabby, calico, tortoiseshell -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_2316_b.rs b/src/test/ui/run-pass/issues/auxiliary/issue_2316_b.rs deleted file mode 100644 index 8a212f6e5a9..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_2316_b.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(unused_imports)] - -extern crate issue_2316_a; - -pub mod cloth { - use issue_2316_a::*; - - pub enum fabric { - gingham, flannel, calico - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_2472_b.rs b/src/test/ui/run-pass/issues/auxiliary/issue_2472_b.rs deleted file mode 100644 index 5f55476427f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_2472_b.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub struct S(pub ()); - -impl S { - pub fn foo(&self) { } -} - -pub trait T { - fn bar(&self); -} - -impl T for S { - fn bar(&self) { } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_2723_a.rs b/src/test/ui/run-pass/issues/auxiliary/issue_2723_a.rs deleted file mode 100644 index 44bea136a7c..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_2723_a.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub unsafe fn f(xs: Vec ) { - xs.iter().map(|_x| { unsafe fn q() { panic!(); } }).collect::>(); -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rc b/src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rc deleted file mode 100644 index 320e0ceed0f..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rc +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub mod issue_3136_a; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rs b/src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rs deleted file mode 100644 index 55de208cc90..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_3136_a.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -trait x { - fn use_x(&self); -} -struct y(()); -impl x for y { - fn use_x(&self) { - struct foo { //~ ERROR quux - i: () - } - fn new_foo(i: ()) -> foo { - foo { i: i } - } - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_38190.rs b/src/test/ui/run-pass/issues/auxiliary/issue_38190.rs deleted file mode 100644 index 7fc4390d6dc..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_38190.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[macro_export] -macro_rules! m { ([$i:item]) => {} } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_38226_aux.rs b/src/test/ui/run-pass/issues/auxiliary/issue_38226_aux.rs deleted file mode 100644 index d48a9733685..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_38226_aux.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="rlib"] - -#[inline(never)] -pub fn foo() { - let _: Box = Box::new(SomeTraitImpl); -} - -pub fn bar() { - SomeTraitImpl.bar(); -} - -mod submod { - pub trait SomeTrait { - fn bar(&self) { - panic!("NO") - } - } -} - -use self::submod::SomeTrait; - -pub struct SomeTraitImpl; -impl SomeTrait for SomeTraitImpl {} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_38715-modern.rs b/src/test/ui/run-pass/issues/auxiliary/issue_38715-modern.rs deleted file mode 100644 index 7f14b2c4659..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_38715-modern.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(duplicate_macro_exports)] - -#[macro_export] -macro_rules! foo_modern { ($i:ident) => {} } - -#[macro_export] -macro_rules! foo_modern { () => {} } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_38715.rs b/src/test/ui/run-pass/issues/auxiliary/issue_38715.rs deleted file mode 100644 index cf4fee0e515..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_38715.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![allow(duplicate_macro_exports)] - -#[macro_export] -macro_rules! foo { ($i:ident) => {} } - -#[macro_export] -macro_rules! foo { () => {} } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_3979_traits.rs b/src/test/ui/run-pass/issues/auxiliary/issue_3979_traits.rs deleted file mode 100644 index 46035731c30..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_3979_traits.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="issue_3979_traits"] - -#![crate_type = "lib"] - -pub trait Positioned { - fn SetX(&mut self, _: isize); - fn X(&self) -> isize; -} - -pub trait Movable: Positioned { - fn translate(&mut self, dx: isize) { - let x = self.X() + dx; - self.SetX(x); - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_39823.rs b/src/test/ui/run-pass/issues/auxiliary/issue_39823.rs deleted file mode 100644 index 5342601ac14..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_39823.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="rlib"] - -#[derive(Debug, PartialEq)] -pub struct RemoteC(pub u32); - -#[derive(Debug, PartialEq)] -pub struct RemoteG(pub T); diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_40469.rs b/src/test/ui/run-pass/issues/auxiliary/issue_40469.rs deleted file mode 100644 index 4970bba431a..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_40469.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -macro_rules! m { () => { $crate::main(); } } diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_41053.rs b/src/test/ui/run-pass/issues/auxiliary/issue_41053.rs deleted file mode 100644 index 68e92b10429..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_41053.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Test; diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_42007_s.rs b/src/test/ui/run-pass/issues/auxiliary/issue_42007_s.rs deleted file mode 100644 index 91ad9869ed8..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_42007_s.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[repr(u8)] -pub enum E { - B = 1 as u8, -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_8401.rs b/src/test/ui/run-pass/issues/auxiliary/issue_8401.rs deleted file mode 100644 index 40e01c1474a..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_8401.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// for this issue, this code must be built in a library - -use std::mem; - -trait A { - fn dummy(&self) { } -} -struct B; -impl A for B {} - -fn bar(_: &mut A, _: &T) {} - -fn foo(t: &T) { - let mut b = B; - bar(&mut b as &mut A, t) -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_9123.rs b/src/test/ui/run-pass/issues/auxiliary/issue_9123.rs deleted file mode 100644 index 8c2546e76cf..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_9123.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub trait X { - fn x() { - fn f() { } - f(); - } - fn dummy(&self) { } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_9155.rs b/src/test/ui/run-pass/issues/auxiliary/issue_9155.rs deleted file mode 100644 index 486eb8fd6f6..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_9155.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo(T); - -impl Foo { - pub fn new(t: T) -> Foo { - Foo(t) - } -} diff --git a/src/test/ui/run-pass/issues/auxiliary/issue_9188.rs b/src/test/ui/run-pass/issues/auxiliary/issue_9188.rs deleted file mode 100644 index 8ff85cc359d..00000000000 --- a/src/test/ui/run-pass/issues/auxiliary/issue_9188.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() -> &'static isize { - if false { - static a: isize = 4; - return &a; - } else { - static a: isize = 5; - return &a; - } -} - -pub fn bar() -> &'static isize { - foo::() -} diff --git a/src/test/ui/run-pass/issues/issue-10025.rs b/src/test/ui/run-pass/issues/issue-10025.rs deleted file mode 100644 index bd286bca938..00000000000 --- a/src/test/ui/run-pass/issues/issue-10025.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -unsafe extern fn foo() {} -unsafe extern "C" fn bar() {} - -fn main() { - let _a: unsafe extern fn() = foo; - let _a: unsafe extern "C" fn() = foo; -} diff --git a/src/test/ui/run-pass/issues/issue-10028.rs b/src/test/ui/run-pass/issues/issue-10028.rs deleted file mode 100644 index b89ecb0b9df..00000000000 --- a/src/test/ui/run-pass/issues/issue-10028.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-10028.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_10028 as issue10028; - -use issue10028::ZeroLengthThingWithDestructor; - -struct Foo { - zero_length_thing: ZeroLengthThingWithDestructor -} - -fn make_foo() -> Foo { - Foo { zero_length_thing: ZeroLengthThingWithDestructor::new() } -} - -fn main() { - let _f:Foo = make_foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-10031.rs b/src/test/ui/run-pass/issues/issue-10031.rs deleted file mode 100644 index 215760343f0..00000000000 --- a/src/test/ui/run-pass/issues/issue-10031.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_10031_aux.rs -// pretty-expanded FIXME #23616 - -extern crate issue_10031_aux; - -pub fn main() { - let _ = issue_10031_aux::Wrap(()); -} diff --git a/src/test/ui/run-pass/issues/issue-10228.rs b/src/test/ui/run-pass/issues/issue-10228.rs deleted file mode 100644 index 7ed8f5be936..00000000000 --- a/src/test/ui/run-pass/issues/issue-10228.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum StdioContainer { - CreatePipe(bool) -} - -struct Test<'a> { - args: &'a [String], - io: &'a [StdioContainer] -} - -pub fn main() { - let test = Test { - args: &[], - io: &[StdioContainer::CreatePipe(true)] - }; -} diff --git a/src/test/ui/run-pass/issues/issue-10392.rs b/src/test/ui/run-pass/issues/issue-10392.rs deleted file mode 100644 index 65c88f445c2..00000000000 --- a/src/test/ui/run-pass/issues/issue-10392.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct A { foo: isize } -struct B { a: isize, b: isize, c: isize } - -fn mka() -> A { panic!() } -fn mkb() -> B { panic!() } - -fn test() { - let A { foo, } = mka(); - let A { - foo, - } = mka(); - - let B { a, b, c, } = mkb(); - - match mka() { - A { foo: _foo, } => {} - } - - match Some(mka()) { - Some(A { foo: _foo, }) => {} - None => {} - } -} - -pub fn main() { - if false { test() } -} diff --git a/src/test/ui/run-pass/issues/issue-10396.rs b/src/test/ui/run-pass/issues/issue-10396.rs deleted file mode 100644 index f0b3b276fcf..00000000000 --- a/src/test/ui/run-pass/issues/issue-10396.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -enum Foo<'s> { - V(&'s str) -} - -fn f(arr: &[&Foo]) { - for &f in arr { - println!("{:?}", f); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-10436.rs b/src/test/ui/run-pass/issues/issue-10436.rs deleted file mode 100644 index f7f890d8188..00000000000 --- a/src/test/ui/run-pass/issues/issue-10436.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn works(x: T) -> Vec { vec![x] } - -fn also_works(x: T) -> Vec { vec![x] } - -fn main() { - let _: Vec = works(0); - let _: Vec = also_works(0); - let _ = works(0); - let _ = also_works(0); -} diff --git a/src/test/ui/run-pass/issues/issue-10456.rs b/src/test/ui/run-pass/issues/issue-10456.rs deleted file mode 100644 index 66b813f82a4..00000000000 --- a/src/test/ui/run-pass/issues/issue-10456.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub struct Foo; - -pub trait Bar { - fn bar(&self); -} - -pub trait Baz { - fn baz(&self) { } -} - -impl Bar for T { - fn bar(&self) {} -} - -impl Baz for Foo {} - -pub fn foo(t: Box) { - t.bar(); // ~Foo doesn't implement Baz - (*t).bar(); // ok b/c Foo implements Baz -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-10626.rs b/src/test/ui/run-pass/issues/issue-10626.rs deleted file mode 100644 index 75c2368d9da..00000000000 --- a/src/test/ui/run-pass/issues/issue-10626.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -// Make sure that if a process doesn't have its stdio/stderr descriptors set up -// that we don't die in a large ball of fire - -use std::env; -use std::process::{Command, Stdio}; - -pub fn main () { - let args: Vec = env::args().collect(); - if args.len() > 1 && args[1] == "child" { - for _ in 0..1000 { - println!("hello?"); - } - for _ in 0..1000 { - println!("hello?"); - } - return; - } - - let mut p = Command::new(&args[0]); - p.arg("child").stdout(Stdio::null()).stderr(Stdio::null()); - println!("{:?}", p.spawn().unwrap().wait()); -} diff --git a/src/test/ui/run-pass/issues/issue-10638.rs b/src/test/ui/run-pass/issues/issue-10638.rs deleted file mode 100644 index 8648a54159f..00000000000 --- a/src/test/ui/run-pass/issues/issue-10638.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - //// I am not a doc comment! - ////////////////// still not a doc comment - /////**** nope, me neither */ - /*** And neither am I! */ - 5; - /*****! certainly not I */ -} diff --git a/src/test/ui/run-pass/issues/issue-10682.rs b/src/test/ui/run-pass/issues/issue-10682.rs deleted file mode 100644 index e7c23b393f0..00000000000 --- a/src/test/ui/run-pass/issues/issue-10682.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #10682 -// Nested `proc` usage can't use outer owned data - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -fn work(_: Box) {} -fn foo(_: F) {} - -pub fn main() { - let a = box 1; - foo(move|| { foo(move|| { work(a) }) }) -} diff --git a/src/test/ui/run-pass/issues/issue-10683.rs b/src/test/ui/run-pass/issues/issue-10683.rs deleted file mode 100644 index f25072538ad..00000000000 --- a/src/test/ui/run-pass/issues/issue-10683.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -static NAME: &'static str = "hello world"; - -fn main() { - match &*NAME.to_ascii_lowercase() { - "foo" => {} - _ => {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-10718.rs b/src/test/ui/run-pass/issues/issue-10718.rs deleted file mode 100644 index 546c06d0451..00000000000 --- a/src/test/ui/run-pass/issues/issue-10718.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn f(p: F) { - p(); -} - -pub fn main() { - let p = || (); - f(p); -} diff --git a/src/test/ui/run-pass/issues/issue-10734.rs b/src/test/ui/run-pass/issues/issue-10734.rs deleted file mode 100644 index 6504cca474f..00000000000 --- a/src/test/ui/run-pass/issues/issue-10734.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -static mut drop_count: usize = 0; - -struct Foo { - dropped: bool -} - -impl Drop for Foo { - fn drop(&mut self) { - // Test to make sure we haven't dropped already - assert!(!self.dropped); - self.dropped = true; - // And record the fact that we dropped for verification later - unsafe { drop_count += 1; } - } -} - -pub fn main() { - // An `if true { expr }` statement should compile the same as `{ expr }`. - if true { - let _a = Foo{ dropped: false }; - } - // Check that we dropped already (as expected from a `{ expr }`). - unsafe { assert_eq!(drop_count, 1); } - - // An `if false {} else { expr }` statement should compile the same as `{ expr }`. - if false { - panic!(); - } else { - let _a = Foo{ dropped: false }; - } - // Check that we dropped already (as expected from a `{ expr }`). - unsafe { assert_eq!(drop_count, 2); } -} diff --git a/src/test/ui/run-pass/issues/issue-10763.rs b/src/test/ui/run-pass/issues/issue-10763.rs deleted file mode 100644 index 9f03cd34114..00000000000 --- a/src/test/ui/run-pass/issues/issue-10763.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern "Rust" fn foo() {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-10764.rs b/src/test/ui/run-pass/issues/issue-10764.rs deleted file mode 100644 index 0d912ed467a..00000000000 --- a/src/test/ui/run-pass/issues/issue-10764.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern "Rust" fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-10767.rs b/src/test/ui/run-pass/issues/issue-10767.rs deleted file mode 100644 index 58cb663a721..00000000000 --- a/src/test/ui/run-pass/issues/issue-10767.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { - fn f() { - }; - let _: Box = box (f as fn()); -} diff --git a/src/test/ui/run-pass/issues/issue-10802.rs b/src/test/ui/run-pass/issues/issue-10802.rs deleted file mode 100644 index 3967ee44583..00000000000 --- a/src/test/ui/run-pass/issues/issue-10802.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct DroppableStruct; -enum DroppableEnum { - DroppableVariant1, DroppableVariant2 -} - -static mut DROPPED: bool = false; - -impl Drop for DroppableStruct { - fn drop(&mut self) { - unsafe { DROPPED = true; } - } -} -impl Drop for DroppableEnum { - fn drop(&mut self) { - unsafe { DROPPED = true; } - } -} - -trait MyTrait { fn dummy(&self) { } } -impl MyTrait for Box {} -impl MyTrait for Box {} - -struct Whatever { w: Box } -impl Whatever { - fn new(w: Box) -> Whatever { - Whatever { w: w } - } -} - -fn main() { - { - let f: Box<_> = box DroppableStruct; - let _a = Whatever::new(box f as Box); - } - assert!(unsafe { DROPPED }); - unsafe { DROPPED = false; } - { - let f: Box<_> = box DroppableEnum::DroppableVariant1; - let _a = Whatever::new(box f as Box); - } - assert!(unsafe { DROPPED }); -} diff --git a/src/test/ui/run-pass/issues/issue-10806.rs b/src/test/ui/run-pass/issues/issue-10806.rs deleted file mode 100644 index 3cfbd703954..00000000000 --- a/src/test/ui/run-pass/issues/issue-10806.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -pub fn foo() -> isize { - 3 -} -pub fn bar() -> isize { - 4 -} - -pub mod baz { - use {foo, bar}; - pub fn quux() -> isize { - foo() + bar() - } -} - -pub mod grault { - use {foo}; - pub fn garply() -> isize { - foo() - } -} - -pub mod waldo { - use {}; - pub fn plugh() -> isize { - 0 - } -} - -pub fn main() { - let _x = baz::quux(); - let _y = grault::garply(); - let _z = waldo::plugh(); -} diff --git a/src/test/ui/run-pass/issues/issue-10853.rs b/src/test/ui/run-pass/issues/issue-10853.rs deleted file mode 100644 index 4a67d256f5d..00000000000 --- a/src/test/ui/run-pass/issues/issue-10853.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![deny(missing_docs)] -#![doc="module"] - -#[doc="struct"] -pub struct Foo; - -pub fn foo() { - #![doc="fn"] -} - -#[doc="main"] -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-10902.rs b/src/test/ui/run-pass/issues/issue-10902.rs deleted file mode 100644 index f27b4576d03..00000000000 --- a/src/test/ui/run-pass/issues/issue-10902.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub mod two_tuple { - pub trait T { fn dummy(&self) { } } - pub struct P<'a>(&'a (T + 'a), &'a (T + 'a)); - pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { - P(car, cdr) - } -} - -pub mod two_fields { - pub trait T { fn dummy(&self) { } } - pub struct P<'a> { car: &'a (T + 'a), cdr: &'a (T + 'a) } - pub fn f<'a>(car: &'a T, cdr: &'a T) -> P<'a> { - P{ car: car, cdr: cdr } - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-11047.rs b/src/test/ui/run-pass/issues/issue-11047.rs deleted file mode 100644 index 6ff9367aed5..00000000000 --- a/src/test/ui/run-pass/issues/issue-11047.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that static methods can be invoked on `type` aliases - -#![allow(unused_variables)] - -pub mod foo { - pub mod bar { - pub mod baz { - pub struct Qux; - - impl Qux { - pub fn new() {} - } - } - } -} - -fn main() { - - type Ham = foo::bar::baz::Qux; - let foo = foo::bar::baz::Qux::new(); // invoke directly - let bar = Ham::new(); // invoke via type alias - - type StringVec = Vec; - let sv = StringVec::new(); -} diff --git a/src/test/ui/run-pass/issues/issue-11085.rs b/src/test/ui/run-pass/issues/issue-11085.rs deleted file mode 100644 index 76a047e2a20..00000000000 --- a/src/test/ui/run-pass/issues/issue-11085.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg foo - -// pretty-expanded FIXME #23616 - -struct Foo { - #[cfg(fail)] - bar: baz, - foo: isize, -} - -struct Foo2 { - #[cfg(foo)] - foo: isize, -} - -enum Bar1 { - Bar1_1, - #[cfg(fail)] - Bar1_2(NotAType), -} - -enum Bar2 { - #[cfg(fail)] - Bar2_1(NotAType), -} - -enum Bar3 { - Bar3_1 { - #[cfg(fail)] - foo: isize, - bar: isize, - } -} - -pub fn main() { - let _f = Foo { foo: 3 }; - let _f = Foo2 { foo: 3 }; - - match Bar1::Bar1_1 { - Bar1::Bar1_1 => {} - } - - let _f = Bar3::Bar3_1 { bar: 3 }; -} diff --git a/src/test/ui/run-pass/issues/issue-1112.rs b/src/test/ui/run-pass/issues/issue-1112.rs deleted file mode 100644 index ee1711b1333..00000000000 --- a/src/test/ui/run-pass/issues/issue-1112.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #1112 -// Alignment of interior pointers to dynamic-size types - - -struct X { - a: T, - b: u8, - c: bool, - d: u8, - e: u16, - f: u8, - g: u8 -} - -pub fn main() { - let x: X = X { - a: 12345678, - b: 9, - c: true, - d: 10, - e: 11, - f: 12, - g: 13 - }; - bar(x); -} - -fn bar(x: X) { - assert_eq!(x.b, 9); - assert_eq!(x.c, true); - assert_eq!(x.d, 10); - assert_eq!(x.e, 11); - assert_eq!(x.f, 12); - assert_eq!(x.g, 13); -} diff --git a/src/test/ui/run-pass/issues/issue-11205.rs b/src/test/ui/run-pass/issues/issue-11205.rs deleted file mode 100644 index bb7d1768f04..00000000000 --- a/src/test/ui/run-pass/issues/issue-11205.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -trait Foo { fn dummy(&self) { } } -impl Foo for isize {} -fn foo(_: [&Foo; 2]) {} -fn foos(_: &[&Foo]) {} -fn foog(_: &[T], _: &[T]) {} - -fn bar(_: [Box; 2]) {} -fn bars(_: &[Box]) {} - -fn main() { - let x: [&Foo; 2] = [&1, &2]; - foo(x); - foo([&1, &2]); - - let r = &1; - let x: [&Foo; 2] = [r; 2]; - foo(x); - foo([&1; 2]); - - let x: &[&Foo] = &[&1, &2]; - foos(x); - foos(&[&1, &2]); - - let x: &[&Foo] = &[&1, &2]; - let r = &1; - foog(x, &[r]); - - let x: [Box; 2] = [Box::new(1), Box::new(2)]; - bar(x); - bar([Box::new(1), Box::new(2)]); - - let x: &[Box] = &[Box::new(1), Box::new(2)]; - bars(x); - bars(&[Box::new(1), Box::new(2)]); - - let x: &[Box] = &[Box::new(1), Box::new(2)]; - foog(x, &[Box::new(1)]); - - struct T<'a> { - t: [&'a (Foo+'a); 2] - } - let _n = T { - t: [&1, &2] - }; - let r = &1; - let _n = T { - t: [r; 2] - }; - let x: [&Foo; 2] = [&1, &2]; - let _n = T { - t: x - }; - - struct F<'b> { - t: &'b [&'b (Foo+'b)] - } - let _n = F { - t: &[&1, &2] - }; - let r = &1; - let r: [&Foo; 2] = [r; 2]; - let _n = F { - t: &r - }; - let x: [&Foo; 2] = [&1, &2]; - let _n = F { - t: &x - }; - - struct M<'a> { - t: &'a [Box] - } - let _n = M { - t: &[Box::new(1), Box::new(2)] - }; - let x: [Box; 2] = [Box::new(1), Box::new(2)]; - let _n = M { - t: &x - }; -} diff --git a/src/test/ui/run-pass/issues/issue-11224.rs b/src/test/ui/run-pass/issues/issue-11224.rs deleted file mode 100644 index 944983a2453..00000000000 --- a/src/test/ui/run-pass/issues/issue-11224.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-11224.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_11224 as unused; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-11225-1.rs b/src/test/ui/run-pass/issues/issue-11225-1.rs deleted file mode 100644 index 3c67d9cdd37..00000000000 --- a/src/test/ui/run-pass/issues/issue-11225-1.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-11225-1.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_11225_1 as foo; - -pub fn main() { - foo::foo(1); - foo::foo_ufcs(1); -} diff --git a/src/test/ui/run-pass/issues/issue-11225-2.rs b/src/test/ui/run-pass/issues/issue-11225-2.rs deleted file mode 100644 index 9e66e6e8672..00000000000 --- a/src/test/ui/run-pass/issues/issue-11225-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-11225-2.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_11225_2 as foo; - -pub fn main() { - foo::foo(1); - foo::foo_ufcs(1); -} diff --git a/src/test/ui/run-pass/issues/issue-11225-3.rs b/src/test/ui/run-pass/issues/issue-11225-3.rs deleted file mode 100644 index d6e9b1378a0..00000000000 --- a/src/test/ui/run-pass/issues/issue-11225-3.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-11225-3.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_11225_3; - -pub fn main() { - issue_11225_3::public_inlinable_function(); - issue_11225_3::public_inlinable_function_ufcs(); -} diff --git a/src/test/ui/run-pass/issues/issue-11267.rs b/src/test/ui/run-pass/issues/issue-11267.rs deleted file mode 100644 index 37bf64c17eb..00000000000 --- a/src/test/ui/run-pass/issues/issue-11267.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that unary structs can be mutably borrowed. - -struct Empty; - -trait T { - fn next(&mut self) -> Option; -} -impl T for Empty { - fn next(&mut self) -> Option { None } -} - -fn do_something_with(a : &mut T) { - println!("{:?}", a.next()) -} - -pub fn main() { - do_something_with(&mut Empty); -} diff --git a/src/test/ui/run-pass/issues/issue-11382.rs b/src/test/ui/run-pass/issues/issue-11382.rs deleted file mode 100644 index fc8f283fc8e..00000000000 --- a/src/test/ui/run-pass/issues/issue-11382.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - println!("{}", 1.2); -} diff --git a/src/test/ui/run-pass/issues/issue-11384.rs b/src/test/ui/run-pass/issues/issue-11384.rs deleted file mode 100644 index 5f11bf2841e..00000000000 --- a/src/test/ui/run-pass/issues/issue-11384.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Common { fn dummy(&self) { } } - -impl<'t, T> Common for (T, &'t T) {} - -impl<'t, T> Common for (&'t T, T) {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-11508.rs b/src/test/ui/run-pass/issues/issue-11508.rs deleted file mode 100644 index d5a1214ffa4..00000000000 --- a/src/test/ui/run-pass/issues/issue-11508.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-11508.rs - -extern crate issue_11508 as rand; - -use rand::{Closed01, random}; - -fn main() { - let Closed01(val) = random::>(); - println!("{}", val); -} diff --git a/src/test/ui/run-pass/issues/issue-11529.rs b/src/test/ui/run-pass/issues/issue-11529.rs deleted file mode 100644 index e046956297d..00000000000 --- a/src/test/ui/run-pass/issues/issue-11529.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-11529.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_11529 as a; - -fn main() { - let one = 1; - let _a = a::A(&one); -} diff --git a/src/test/ui/run-pass/issues/issue-11552.rs b/src/test/ui/run-pass/issues/issue-11552.rs deleted file mode 100644 index 38dc58a2f12..00000000000 --- a/src/test/ui/run-pass/issues/issue-11552.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_patterns)] -#![feature(box_syntax)] - -#[derive(Clone)] -enum Noun -{ - Atom(isize), - Cell(Box, Box) -} - -fn fas(n: &Noun) -> Noun -{ - match n { - &Noun::Cell(box Noun::Atom(2), box Noun::Cell(ref a, _)) => (**a).clone(), - _ => panic!("Invalid fas pattern") - } -} - -pub fn main() { - fas(&Noun::Cell(box Noun::Atom(2), box Noun::Cell(box Noun::Atom(2), box Noun::Atom(3)))); -} diff --git a/src/test/ui/run-pass/issues/issue-11577.rs b/src/test/ui/run-pass/issues/issue-11577.rs deleted file mode 100644 index 1fee0d40206..00000000000 --- a/src/test/ui/run-pass/issues/issue-11577.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Destructuring struct variants would ICE where regular structs wouldn't - -enum Foo { - VBar { num: isize } -} - -struct SBar { num: isize } - -pub fn main() { - let vbar = Foo::VBar { num: 1 }; - let Foo::VBar { num } = vbar; - assert_eq!(num, 1); - - let sbar = SBar { num: 2 }; - let SBar { num } = sbar; - assert_eq!(num, 2); -} diff --git a/src/test/ui/run-pass/issues/issue-11592.rs b/src/test/ui/run-pass/issues/issue-11592.rs deleted file mode 100644 index 1157f9b7e76..00000000000 --- a/src/test/ui/run-pass/issues/issue-11592.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -//! Ensure the private trait Bar isn't complained about. - -#![deny(missing_docs)] - -mod foo { - trait Bar { fn bar(&self) { } } - impl Bar for i8 { fn bar(&self) { } } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-11612.rs b/src/test/ui/run-pass/issues/issue-11612.rs deleted file mode 100644 index 763e538fb8f..00000000000 --- a/src/test/ui/run-pass/issues/issue-11612.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #11612 -// We weren't updating the auto adjustments with all the resolved -// type information after type check. - -// pretty-expanded FIXME #23616 - -trait A { fn dummy(&self) { } } - -struct B<'a, T:'a> { - f: &'a T -} - -impl<'a, T> A for B<'a, T> {} - -fn foo(_: &A) {} - -fn bar(b: &B) { - foo(b); // Coercion should work - foo(b as &A); // Explicit cast should work as well -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-11677.rs b/src/test/ui/run-pass/issues/issue-11677.rs deleted file mode 100644 index a4d4feb4f8a..00000000000 --- a/src/test/ui/run-pass/issues/issue-11677.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(dead_code)] - -// this code used to cause an ICE - -use std::marker; - -trait X { - fn dummy(&self) -> T { panic!() } -} - -struct S {f: Box+'static>, - g: Box+'static>} - -struct F; -impl X for F { -} - -fn main() { - S {f: Box::new(F), g: Box::new(F) }; -} diff --git a/src/test/ui/run-pass/issues/issue-11709.rs b/src/test/ui/run-pass/issues/issue-11709.rs deleted file mode 100644 index ffd6f1dfb55..00000000000 --- a/src/test/ui/run-pass/issues/issue-11709.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37199 - -// Don't panic on blocks without results -// There are several tests in this run-pass that raised -// when this bug was opened. The cases where the compiler -// panics before the fix have a comment. - -struct S {x:()} - -fn test(slot: &mut Option Box>>) -> () { - let a = slot.take(); - let _a = match a { - // `{let .. a(); }` would break - Some(mut a) => { let _a = a(); }, - None => (), - }; -} - -fn not(b: bool) -> bool { - if b { - !b - } else { - // `panic!(...)` would break - panic!("Break the compiler"); - } -} - -pub fn main() { - // {} would break - let _r = {}; - let mut slot = None; - // `{ test(...); }` would break - let _s : S = S{ x: { test(&mut slot); } }; - - let _b = not(true); -} diff --git a/src/test/ui/run-pass/issues/issue-11820.rs b/src/test/ui/run-pass/issues/issue-11820.rs deleted file mode 100644 index 4546529a902..00000000000 --- a/src/test/ui/run-pass/issues/issue-11820.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct NoClone; - -fn main() { - let rnc = &NoClone; - let rsnc = &Some(NoClone); - - let _: &NoClone = rnc.clone(); - let _: &Option = rsnc.clone(); -} diff --git a/src/test/ui/run-pass/issues/issue-11869.rs b/src/test/ui/run-pass/issues/issue-11869.rs deleted file mode 100644 index be20f7a0fec..00000000000 --- a/src/test/ui/run-pass/issues/issue-11869.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct A { - a: String -} - -fn borrow<'a>(binding: &'a A) -> &'a str { - match &*binding.a { - "in" => "in_", - "ref" => "ref_", - ident => ident - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-11940.rs b/src/test/ui/run-pass/issues/issue-11940.rs deleted file mode 100644 index 8f2dae938e0..00000000000 --- a/src/test/ui/run-pass/issues/issue-11940.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const TEST_STR: &'static str = "abcd"; - -fn main() { - let s = "abcd"; - match s { - TEST_STR => (), - _ => unreachable!() - } -} diff --git a/src/test/ui/run-pass/issues/issue-11958.rs b/src/test/ui/run-pass/issues/issue-11958.rs deleted file mode 100644 index 6702aa38fd9..00000000000 --- a/src/test/ui/run-pass/issues/issue-11958.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![forbid(warnings)] - -// We shouldn't need to rebind a moved upvar as mut if it's already -// marked as mut - -pub fn main() { - let mut x = 1; - let _thunk = Box::new(move|| { x = 2; }); -} diff --git a/src/test/ui/run-pass/issues/issue-12033.rs b/src/test/ui/run-pass/issues/issue-12033.rs deleted file mode 100644 index 214dfa5a446..00000000000 --- a/src/test/ui/run-pass/issues/issue-12033.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cell::RefCell; - -fn main() { - let x = RefCell::new(0); - if *x.borrow() == 0 {} else {} -} diff --git a/src/test/ui/run-pass/issues/issue-12133-1.rs b/src/test/ui/run-pass/issues/issue-12133-1.rs deleted file mode 100644 index 7f896f6a6df..00000000000 --- a/src/test/ui/run-pass/issues/issue-12133-1.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-12133-rlib.rs -// aux-build:issue-12133-dylib.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_12133_rlib as a; -extern crate issue_12133_dylib as b; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-12133-2.rs b/src/test/ui/run-pass/issues/issue-12133-2.rs deleted file mode 100644 index c2f12fda193..00000000000 --- a/src/test/ui/run-pass/issues/issue-12133-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-12133-rlib.rs -// aux-build:issue-12133-dylib.rs -// no-prefer-dynamic - -// pretty-expanded FIXME #23616 - -extern crate issue_12133_rlib as a; -extern crate issue_12133_dylib as b; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-12133-3.rs b/src/test/ui/run-pass/issues/issue-12133-3.rs deleted file mode 100644 index 51c39f8f9c7..00000000000 --- a/src/test/ui/run-pass/issues/issue-12133-3.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-12133-rlib.rs -// aux-build:issue-12133-dylib.rs -// aux-build:issue-12133-dylib2.rs -// ignore-cloudabi no dylib support -// ignore-emscripten no dylib support -// ignore-musl - -// pretty-expanded FIXME #23616 - -extern crate issue_12133_dylib2 as other; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-12285.rs b/src/test/ui/run-pass/issues/issue-12285.rs deleted file mode 100644 index 6391f13d936..00000000000 --- a/src/test/ui/run-pass/issues/issue-12285.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct S; - -fn main() { - match Some(&S) { - Some(&S) => {}, - _x => unreachable!() - } - match Some(&S) { - Some(&S) => {}, - None => unreachable!() - } -} diff --git a/src/test/ui/run-pass/issues/issue-1251.rs b/src/test/ui/run-pass/issues/issue-1251.rs deleted file mode 100644 index a7bc8718003..00000000000 --- a/src/test/ui/run-pass/issues/issue-1251.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -#![crate_id="rust_get_test_int"] - -mod rustrt { - extern crate libc; - - extern { - pub fn rust_get_test_int() -> libc::intptr_t; - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-1257.rs b/src/test/ui/run-pass/issues/issue-1257.rs deleted file mode 100644 index 8361151c24e..00000000000 --- a/src/test/ui/run-pass/issues/issue-1257.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main () { - let mut line = "".to_string(); - let mut i = 0; - while line != "exit".to_string() { - line = if i == 9 { "exit".to_string() } else { "notexit".to_string() }; - i += 1; - } -} diff --git a/src/test/ui/run-pass/issues/issue-12582.rs b/src/test/ui/run-pass/issues/issue-12582.rs deleted file mode 100644 index dd77e7287ca..00000000000 --- a/src/test/ui/run-pass/issues/issue-12582.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = 1; - let y = 2; - - assert_eq!(3, match (x, y) { - (1, 1) => 1, - (2, 2) => 2, - (1..=2, 2) => 3, - _ => 4, - }); - - // nested tuple - assert_eq!(3, match ((x, y),) { - ((1, 1),) => 1, - ((2, 2),) => 2, - ((1..=2, 2),) => 3, - _ => 4, - }); -} diff --git a/src/test/ui/run-pass/issues/issue-12612.rs b/src/test/ui/run-pass/issues/issue-12612.rs deleted file mode 100644 index dd9c9abaf65..00000000000 --- a/src/test/ui/run-pass/issues/issue-12612.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_12612_1.rs -// aux-build:issue_12612_2.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_12612_1 as foo; -extern crate issue_12612_2 as bar; - -mod test { - use bar::baz; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-12660.rs b/src/test/ui/run-pass/issues/issue-12660.rs deleted file mode 100644 index 2713543963e..00000000000 --- a/src/test/ui/run-pass/issues/issue-12660.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-12660-aux.rs - -// pretty-expanded FIXME #23616 - -extern crate issue12660aux; - -use issue12660aux::{my_fn, MyStruct}; - -#[allow(path_statements)] -fn main() { - my_fn(MyStruct); - MyStruct; -} diff --git a/src/test/ui/run-pass/issues/issue-12677.rs b/src/test/ui/run-pass/issues/issue-12677.rs deleted file mode 100644 index e4d29a59ba1..00000000000 --- a/src/test/ui/run-pass/issues/issue-12677.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let s = "Hello"; - let first = s.bytes(); - let second = first.clone(); - - assert_eq!(first.collect::>(), second.collect::>()) -} diff --git a/src/test/ui/run-pass/issues/issue-12699.rs b/src/test/ui/run-pass/issues/issue-12699.rs deleted file mode 100644 index eaaa2364f68..00000000000 --- a/src/test/ui/run-pass/issues/issue-12699.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare can't block the thread -#![allow(deprecated)] - -use std::thread; - -fn main() { - thread::sleep_ms(250); -} diff --git a/src/test/ui/run-pass/issues/issue-12729.rs b/src/test/ui/run-pass/issues/issue-12729.rs deleted file mode 100644 index f75090c4223..00000000000 --- a/src/test/ui/run-pass/issues/issue-12729.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub struct Foo; - -mod bar { - use Foo; - - impl Foo { - fn baz(&self) {} - } -} -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-12744.rs b/src/test/ui/run-pass/issues/issue-12744.rs deleted file mode 100644 index c0af7bdcbdf..00000000000 --- a/src/test/ui/run-pass/issues/issue-12744.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - fn test() -> Box { Box::new(1) } - println!("{:?}", test()) -} diff --git a/src/test/ui/run-pass/issues/issue-12860.rs b/src/test/ui/run-pass/issues/issue-12860.rs deleted file mode 100644 index fba1532e00f..00000000000 --- a/src/test/ui/run-pass/issues/issue-12860.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::HashSet; - -#[derive(Copy, Clone, PartialEq, Eq, Hash)] -struct XYZ { - x: isize, - y: isize, - z: isize -} - -fn main() { - let mut connected = HashSet::new(); - let mut border = HashSet::new(); - - let middle = XYZ{x: 0, y: 0, z: 0}; - border.insert(middle); - - while !border.is_empty() && connected.len() < 10000 { - let choice = *(border.iter().next().unwrap()); - border.remove(&choice); - connected.insert(choice); - - let cxp = XYZ{x: choice.x + 1, y: choice.y, z: choice.z}; - let cxm = XYZ{x: choice.x - 1, y: choice.y, z: choice.z}; - let cyp = XYZ{x: choice.x, y: choice.y + 1, z: choice.z}; - let cym = XYZ{x: choice.x, y: choice.y - 1, z: choice.z}; - let czp = XYZ{x: choice.x, y: choice.y, z: choice.z + 1}; - let czm = XYZ{x: choice.x, y: choice.y, z: choice.z - 1}; - - if !connected.contains(&cxp) { - border.insert(cxp); - } - if !connected.contains(&cxm){ - border.insert(cxm); - } - if !connected.contains(&cyp){ - border.insert(cyp); - } - if !connected.contains(&cym) { - border.insert(cym); - } - if !connected.contains(&czp){ - border.insert(czp); - } - if !connected.contains(&czm) { - border.insert(czm); - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-12909.rs b/src/test/ui/run-pass/issues/issue-12909.rs deleted file mode 100644 index d4db01a5e58..00000000000 --- a/src/test/ui/run-pass/issues/issue-12909.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::collections::HashMap; - -fn copy(&x: &T) -> T { - x -} - -fn main() { - let arr = [(1, 1), (2, 2), (3, 3)]; - - let v1: Vec<&_> = arr.iter().collect(); - let v2: Vec<_> = arr.iter().map(copy).collect(); - - let m1: HashMap<_, _> = arr.iter().map(copy).collect(); - let m2: HashMap = arr.iter().map(copy).collect(); - let m3: HashMap<_, usize> = arr.iter().map(copy).collect(); -} diff --git a/src/test/ui/run-pass/issues/issue-13027.rs b/src/test/ui/run-pass/issues/issue-13027.rs deleted file mode 100644 index 7caf1589aed..00000000000 --- a/src/test/ui/run-pass/issues/issue-13027.rs +++ /dev/null @@ -1,188 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Tests that match expression handles overlapped literal and range -// properly in the presence of guard function. - -fn val() -> usize { 1 } - -static CONST: usize = 1; - -pub fn main() { - lit_shadow_range(); - range_shadow_lit(); - range_shadow_range(); - multi_pats_shadow_lit(); - multi_pats_shadow_range(); - lit_shadow_multi_pats(); - range_shadow_multi_pats(); - misc(); -} - -fn lit_shadow_range() { - assert_eq!(2, match 1 { - 1 if false => 1, - 1..=2 => 2, - _ => 3 - }); - - let x = 0; - assert_eq!(2, match x+1 { - 0 => 0, - 1 if false => 1, - 1..=2 => 2, - _ => 3 - }); - - assert_eq!(2, match val() { - 1 if false => 1, - 1..=2 => 2, - _ => 3 - }); - - assert_eq!(2, match CONST { - 0 => 0, - 1 if false => 1, - 1..=2 => 2, - _ => 3 - }); - - // value is out of the range of second arm, should match wildcard pattern - assert_eq!(3, match 3 { - 1 if false => 1, - 1..=2 => 2, - _ => 3 - }); -} - -fn range_shadow_lit() { - assert_eq!(2, match 1 { - 1..=2 if false => 1, - 1 => 2, - _ => 3 - }); - - let x = 0; - assert_eq!(2, match x+1 { - 0 => 0, - 1..=2 if false => 1, - 1 => 2, - _ => 3 - }); - - assert_eq!(2, match val() { - 1..=2 if false => 1, - 1 => 2, - _ => 3 - }); - - assert_eq!(2, match CONST { - 0 => 0, - 1..=2 if false => 1, - 1 => 2, - _ => 3 - }); - - // ditto - assert_eq!(3, match 3 { - 1..=2 if false => 1, - 1 => 2, - _ => 3 - }); -} - -fn range_shadow_range() { - assert_eq!(2, match 1 { - 0..=2 if false => 1, - 1..=3 => 2, - _ => 3, - }); - - let x = 0; - assert_eq!(2, match x+1 { - 100 => 0, - 0..=2 if false => 1, - 1..=3 => 2, - _ => 3, - }); - - assert_eq!(2, match val() { - 0..=2 if false => 1, - 1..=3 => 2, - _ => 3, - }); - - assert_eq!(2, match CONST { - 100 => 0, - 0..=2 if false => 1, - 1..=3 => 2, - _ => 3, - }); - - // ditto - assert_eq!(3, match 5 { - 0..=2 if false => 1, - 1..=3 => 2, - _ => 3, - }); -} - -fn multi_pats_shadow_lit() { - assert_eq!(2, match 1 { - 100 => 0, - 0 | 1..=10 if false => 1, - 1 => 2, - _ => 3, - }); -} - -fn multi_pats_shadow_range() { - assert_eq!(2, match 1 { - 100 => 0, - 0 | 1..=10 if false => 1, - 1..=3 => 2, - _ => 3, - }); -} - -fn lit_shadow_multi_pats() { - assert_eq!(2, match 1 { - 100 => 0, - 1 if false => 1, - 0 | 1..=10 => 2, - _ => 3, - }); -} - -fn range_shadow_multi_pats() { - assert_eq!(2, match 1 { - 100 => 0, - 1..=3 if false => 1, - 0 | 1..=10 => 2, - _ => 3, - }); -} - -fn misc() { - enum Foo { - Bar(usize, bool) - } - // This test basically mimics how trace_macros! macro is implemented, - // which is a rare combination of vector patterns, multiple wild-card - // patterns and guard functions. - let r = match [Foo::Bar(0, false)] { - [Foo::Bar(_, pred)] if pred => 1, - [Foo::Bar(_, pred)] if !pred => 2, - _ => 0, - }; - assert_eq!(2, r); -} diff --git a/src/test/ui/run-pass/issues/issue-13105.rs b/src/test/ui/run-pass/issues/issue-13105.rs deleted file mode 100644 index 906f8ca5e7d..00000000000 --- a/src/test/ui/run-pass/issues/issue-13105.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Foo { - #[allow(anonymous_parameters)] - fn quux(u8) {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13167.rs b/src/test/ui/run-pass/issues/issue-13167.rs deleted file mode 100644 index ac0645cd403..00000000000 --- a/src/test/ui/run-pass/issues/issue-13167.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::slice; - -pub struct PhfMapEntries<'a, T: 'a> { - iter: slice::Iter<'a, (&'static str, T)>, -} - -impl<'a, T> Iterator for PhfMapEntries<'a, T> { - type Item = (&'static str, &'a T); - - fn next(&mut self) -> Option<(&'static str, &'a T)> { - self.iter.by_ref().map(|&(key, ref value)| (key, value)).next() - } - - fn size_hint(&self) -> (usize, Option) { - self.iter.size_hint() - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13204.rs b/src/test/ui/run-pass/issues/issue-13204.rs deleted file mode 100644 index 4aa2c49b428..00000000000 --- a/src/test/ui/run-pass/issues/issue-13204.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that when instantiating trait default methods, typeck handles -// lifetime parameters defined on the method bound correctly. - - -pub trait Foo { - fn bar<'a, I: Iterator>(&self, it: I) -> usize { - let mut xs = it.filter(|_| true); - xs.count() - } -} - -pub struct Baz; - -impl Foo for Baz { - // When instantiating `Foo::bar` for `Baz` here, typeck used to - // ICE due to the lifetime parameter of `bar`. -} - -fn main() { - let x = Baz; - let y = vec![(), (), ()]; - assert_eq!(x.bar(y.iter()), 3); -} diff --git a/src/test/ui/run-pass/issues/issue-13214.rs b/src/test/ui/run-pass/issues/issue-13214.rs deleted file mode 100644 index 634cbbb0417..00000000000 --- a/src/test/ui/run-pass/issues/issue-13214.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// defining static with struct that contains enum -// with &'static str variant used to cause ICE - -// pretty-expanded FIXME #23616 - -pub enum Foo { - Bar, - Baz(&'static str), -} - -pub static TEST: Test = Test { - foo: Foo::Bar, - c: 'a' -}; - -pub struct Test { - foo: Foo, - c: char, -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13259-windows-tcb-trash.rs b/src/test/ui/run-pass/issues/issue-13259-windows-tcb-trash.rs deleted file mode 100644 index de18e09532b..00000000000 --- a/src/test/ui/run-pass/issues/issue-13259-windows-tcb-trash.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(libc)] - -extern crate libc; - -#[cfg(windows)] -mod imp { - type LPVOID = *mut u8; - type DWORD = u32; - type LPWSTR = *mut u16; - - extern "system" { - fn FormatMessageW(flags: DWORD, - lpSrc: LPVOID, - msgId: DWORD, - langId: DWORD, - buf: LPWSTR, - nsize: DWORD, - args: *const u8) - -> DWORD; - } - - pub fn test() { - let mut buf: [u16; 50] = [0; 50]; - let ret = unsafe { - FormatMessageW(0x1000, 0 as *mut _, 1, 0x400, - buf.as_mut_ptr(), buf.len() as u32, 0 as *const _) - }; - // On some 32-bit Windowses (Win7-8 at least) this will panic with segmented - // stacks taking control of pvArbitrary - assert!(ret != 0); - } -} - -#[cfg(not(windows))] -mod imp { - pub fn test() { } -} - -fn main() { - imp::test() -} diff --git a/src/test/ui/run-pass/issues/issue-13264.rs b/src/test/ui/run-pass/issues/issue-13264.rs deleted file mode 100644 index db6b80ad225..00000000000 --- a/src/test/ui/run-pass/issues/issue-13264.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -use std::ops::Deref; - -struct Root { - jsref: JSRef -} - -impl Deref for Root { - type Target = JSRef; - - fn deref<'a>(&'a self) -> &'a JSRef { - &self.jsref - } -} - -#[derive(Copy, Clone)] -struct JSRef { - node: *const Node -} - -impl Deref for JSRef { - type Target = Node; - - fn deref<'a>(&'a self) -> &'a Node { - self.get() - } -} - -trait INode { - fn RemoveChild(&self); -} - -impl INode for JSRef { - fn RemoveChild(&self) { - self.get().RemoveChild(0) - } -} - -impl JSRef { - fn AddChild(&self) { - self.get().AddChild(0); - } - - fn get<'a>(&'a self) -> &'a Node { - unsafe { - &*self.node - } - } -} - -struct Node; - -impl Node { - fn RemoveChild(&self, _a: usize) { - } - - fn AddChild(&self, _a: usize) { - } -} - -fn main() { - let n = Node; - let jsref = JSRef { node: &n }; - let root = Root { jsref: jsref }; - - root.AddChild(); - jsref.AddChild(); - - root.RemoveChild(); - jsref.RemoveChild(); -} diff --git a/src/test/ui/run-pass/issues/issue-13304.rs b/src/test/ui/run-pass/issues/issue-13304.rs deleted file mode 100644 index 117cb0bbe16..00000000000 --- a/src/test/ui/run-pass/issues/issue-13304.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::env; -use std::io::prelude::*; -use std::io; -use std::process::{Command, Stdio}; -use std::str; - -fn main() { - let args: Vec = env::args().collect(); - if args.len() > 1 && args[1] == "child" { - child(); - } else { - parent(); - } -} - -fn parent() { - let args: Vec = env::args().collect(); - let mut p = Command::new(&args[0]).arg("child") - .stdout(Stdio::piped()) - .stdin(Stdio::piped()) - .spawn().unwrap(); - p.stdin.as_mut().unwrap().write_all(b"test1\ntest2\ntest3").unwrap(); - let out = p.wait_with_output().unwrap(); - assert!(out.status.success()); - let s = str::from_utf8(&out.stdout).unwrap(); - assert_eq!(s, "test1\ntest2\ntest3\n"); -} - -fn child() { - let mut stdin = io::stdin(); - for line in stdin.lock().lines() { - println!("{}", line.unwrap()); - } -} diff --git a/src/test/ui/run-pass/issues/issue-13323.rs b/src/test/ui/run-pass/issues/issue-13323.rs deleted file mode 100644 index b72abb8b7ac..00000000000 --- a/src/test/ui/run-pass/issues/issue-13323.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct StrWrap { - s: String -} - -impl StrWrap { - fn new(s: &str) -> StrWrap { - StrWrap { s: s.to_string() } - } - - fn get_s<'a>(&'a self) -> &'a str { - &self.s - } -} - -struct MyStruct { - s: StrWrap -} - -impl MyStruct { - fn new(s: &str) -> MyStruct { - MyStruct { s: StrWrap::new(s) } - } - - fn get_str_wrap<'a>(&'a self) -> &'a StrWrap { - &self.s - } -} - -trait Matcher { - fn matches(&self, actual: T) -> bool; -} - -fn assert_that>(actual: T, matcher: &U) { - assert!(matcher.matches(actual)); -} - -struct EqualTo { - expected: T -} - -impl Matcher for EqualTo { - fn matches(&self, actual: T) -> bool { - self.expected.eq(&actual) - } -} - -fn equal_to(expected: T) -> Box> { - box EqualTo { expected: expected } -} - -pub fn main() { - let my_struct = MyStruct::new("zomg"); - let s = my_struct.get_str_wrap(); - - assert_that(s.get_s(), &*equal_to("zomg")); -} diff --git a/src/test/ui/run-pass/issues/issue-13405.rs b/src/test/ui/run-pass/issues/issue-13405.rs deleted file mode 100644 index 3b9fdf84b5d..00000000000 --- a/src/test/ui/run-pass/issues/issue-13405.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo<'a> { - i: &'a bool, - j: Option<&'a isize>, -} - -impl<'a> Foo<'a> { - fn bar(&mut self, j: &isize) { - let child = Foo { - i: self.i, - j: Some(j) - }; - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13434.rs b/src/test/ui/run-pass/issues/issue-13434.rs deleted file mode 100644 index 94d22b818e3..00000000000 --- a/src/test/ui/run-pass/issues/issue-13434.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct MyStruct; - -trait Repro { - fn repro(self, s: MyStruct) -> String; -} - -impl Repro for F where F: FnOnce(MyStruct) -> String { - fn repro(self, s: MyStruct) -> String { - self(s) - } -} - -fn do_stuff(r: R) -> String { - r.repro(MyStruct) -} - -pub fn main() { - assert_eq!("MyStruct".to_string(), do_stuff(|s: MyStruct| format!("{:?}", s))); -} diff --git a/src/test/ui/run-pass/issues/issue-13494.rs b/src/test/ui/run-pass/issues/issue-13494.rs deleted file mode 100644 index 553f3a7fec9..00000000000 --- a/src/test/ui/run-pass/issues/issue-13494.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -// This test may not always fail, but it can be flaky if the race it used to -// expose is still present. - -#![feature(mpsc_select)] - -use std::sync::mpsc::{channel, Sender, Receiver}; -use std::thread; - -fn helper(rx: Receiver>) { - for tx in rx.iter() { - let _ = tx.send(()); - } -} - -fn main() { - let (tx, rx) = channel(); - let t = thread::spawn(move|| { helper(rx) }); - let (snd, rcv) = channel::(); - for _ in 1..100000 { - snd.send(1).unwrap(); - let (tx2, rx2) = channel(); - tx.send(tx2).unwrap(); - select! { - _ = rx2.recv() => (), - _ = rcv.recv() => () - } - } - drop(tx); - t.join(); -} diff --git a/src/test/ui/run-pass/issues/issue-13507-2.rs b/src/test/ui/run-pass/issues/issue-13507-2.rs deleted file mode 100644 index 894cd7ac011..00000000000 --- a/src/test/ui/run-pass/issues/issue-13507-2.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue13507.rs - -extern crate issue13507; -use issue13507::testtypes; - -use std::any::TypeId; - -pub fn type_ids() -> Vec { - use issue13507::testtypes::*; - vec![ - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::(), - TypeId::of::() - ] -} - -pub fn main() { - let othercrate = issue13507::testtypes::type_ids(); - let thiscrate = type_ids(); - assert_eq!(thiscrate, othercrate); -} diff --git a/src/test/ui/run-pass/issues/issue-13620.rs b/src/test/ui/run-pass/issues/issue-13620.rs deleted file mode 100644 index 624aeaef782..00000000000 --- a/src/test/ui/run-pass/issues/issue-13620.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-13620-1.rs -// aux-build:issue-13620-2.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_13620_2 as crate2; - -fn main() { - (crate2::FOO2.foo)(); -} diff --git a/src/test/ui/run-pass/issues/issue-13655.rs b/src/test/ui/run-pass/issues/issue-13655.rs deleted file mode 100644 index 9978819d7db..00000000000 --- a/src/test/ui/run-pass/issues/issue-13655.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(fn_traits, unboxed_closures)] -use std::ops::Fn; - -struct Foo(T); - -impl Fn<()> for Foo { - extern "rust-call" fn call(&self, _: ()) -> T { - match *self { - Foo(t) => t - } - } -} - -impl FnMut<()> for Foo { - extern "rust-call" fn call_mut(&mut self, _: ()) -> T { - self.call(()) - } -} - -impl FnOnce<()> for Foo { - type Output = T; - - extern "rust-call" fn call_once(self, _: ()) -> T { - self.call(()) - } -} - -fn main() { - let t: u8 = 1; - println!("{}", Foo(t)()); -} diff --git a/src/test/ui/run-pass/issues/issue-13665.rs b/src/test/ui/run-pass/issues/issue-13665.rs deleted file mode 100644 index 85e8ef57515..00000000000 --- a/src/test/ui/run-pass/issues/issue-13665.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo<'r>() { - let maybe_value_ref: Option<&'r u8> = None; - - let _ = maybe_value_ref.map(|& ref v| v); - let _ = maybe_value_ref.map(|& ref v| -> &'r u8 {v}); - let _ = maybe_value_ref.map(|& ref v: &'r u8| -> &'r u8 {v}); - let _ = maybe_value_ref.map(|& ref v: &'r u8| {v}); -} - -fn main() { - foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-13703.rs b/src/test/ui/run-pass/issues/issue-13703.rs deleted file mode 100644 index d0f8be64ef3..00000000000 --- a/src/test/ui/run-pass/issues/issue-13703.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub struct Foo<'a, 'b: 'a> { foo: &'a &'b isize } -pub fn foo<'a, 'b>(x: Foo<'a, 'b>, _o: Option<& & ()>) { let _y = x.foo; } -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13763.rs b/src/test/ui/run-pass/issues/issue-13763.rs deleted file mode 100644 index 0b27e2fab31..00000000000 --- a/src/test/ui/run-pass/issues/issue-13763.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod u8 { - pub const BITS: usize = 8; -} - -const NUM: usize = u8::BITS; - -struct MyStruct { nums: [usize; 8] } - -fn main() { - let _s = MyStruct { nums: [0; NUM] }; -} diff --git a/src/test/ui/run-pass/issues/issue-13775.rs b/src/test/ui/run-pass/issues/issue-13775.rs deleted file mode 100644 index ae499229917..00000000000 --- a/src/test/ui/run-pass/issues/issue-13775.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Foo { - #[allow(anonymous_parameters)] - fn bar(&self, isize) {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13808.rs b/src/test/ui/run-pass/issues/issue-13808.rs deleted file mode 100644 index 2d6b78c6b07..00000000000 --- a/src/test/ui/run-pass/issues/issue-13808.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo<'a> { - listener: Box, -} - -impl<'a> Foo<'a> { - fn new(listener: F) -> Foo<'a> where F: FnMut() + 'a { - Foo { listener: Box::new(listener) } - } -} - -fn main() { - let a = Foo::new(|| {}); -} diff --git a/src/test/ui/run-pass/issues/issue-13837.rs b/src/test/ui/run-pass/issues/issue-13837.rs deleted file mode 100644 index eaa17499850..00000000000 --- a/src/test/ui/run-pass/issues/issue-13837.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct TestStruct { - x: *const [isize; 2] -} - -unsafe impl Sync for TestStruct {} - -static TEST_VALUE : TestStruct = TestStruct{x: 0x1234 as *const [isize; 2]}; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-13867.rs b/src/test/ui/run-pass/issues/issue-13867.rs deleted file mode 100644 index 84d7e8a3bc4..00000000000 --- a/src/test/ui/run-pass/issues/issue-13867.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that codegen works correctly when there are multiple refutable -// patterns in match expression. - - -enum Foo { - FooUint(usize), - FooNullary, -} - -fn main() { - let r = match (Foo::FooNullary, 'a') { - (Foo::FooUint(..), 'a'..='z') => 1, - (Foo::FooNullary, 'x') => 2, - _ => 0 - }; - assert_eq!(r, 0); - - let r = match (Foo::FooUint(0), 'a') { - (Foo::FooUint(1), 'a'..='z') => 1, - (Foo::FooUint(..), 'x') => 2, - (Foo::FooNullary, 'a') => 3, - _ => 0 - }; - assert_eq!(r, 0); - - let r = match ('a', Foo::FooUint(0)) { - ('a'..='z', Foo::FooUint(1)) => 1, - ('x', Foo::FooUint(..)) => 2, - ('a', Foo::FooNullary) => 3, - _ => 0 - }; - assert_eq!(r, 0); - - let r = match ('a', 'a') { - ('a'..='z', 'b') => 1, - ('x', 'a'..='z') => 2, - _ => 0 - }; - assert_eq!(r, 0); - - let r = match ('a', 'a') { - ('a'..='z', 'b') => 1, - ('x', 'a'..='z') => 2, - ('a', 'a') => 3, - _ => 0 - }; - assert_eq!(r, 3); -} diff --git a/src/test/ui/run-pass/issues/issue-13872.rs b/src/test/ui/run-pass/issues/issue-13872.rs deleted file mode 100644 index e72eac8fbdd..00000000000 --- a/src/test/ui/run-pass/issues/issue-13872.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-13872-1.rs -// aux-build:issue-13872-2.rs -// aux-build:issue-13872-3.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_13872_3 as other; - -fn main() { - other::foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-13902.rs b/src/test/ui/run-pass/issues/issue-13902.rs deleted file mode 100644 index 87413be05e5..00000000000 --- a/src/test/ui/run-pass/issues/issue-13902.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -const JSVAL_TAG_CLEAR: u32 = 0xFFFFFF80; -const JSVAL_TYPE_INT32: u8 = 0x01; -const JSVAL_TYPE_UNDEFINED: u8 = 0x02; -#[repr(u32)] -enum ValueTag { - JSVAL_TAG_INT32 = JSVAL_TAG_CLEAR | (JSVAL_TYPE_INT32 as u32), - JSVAL_TAG_UNDEFINED = JSVAL_TAG_CLEAR | (JSVAL_TYPE_UNDEFINED as u32), -} - -fn main() { - let _ = ValueTag::JSVAL_TAG_INT32; -} diff --git a/src/test/ui/run-pass/issues/issue-14082.rs b/src/test/ui/run-pass/issues/issue-14082.rs deleted file mode 100644 index 01d3c9534f2..00000000000 --- a/src/test/ui/run-pass/issues/issue-14082.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unused_imports, dead_code)] - -use foo::Foo; - -mod foo { - pub use m::Foo; // this should shadow d::Foo -} - -mod m { - pub struct Foo; -} - -mod d { - pub struct Foo; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-14229.rs b/src/test/ui/run-pass/issues/issue-14229.rs deleted file mode 100644 index c09b2c79104..00000000000 --- a/src/test/ui/run-pass/issues/issue-14229.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo: Sized { - fn foo(self) {} -} - -trait Bar: Sized { - fn bar(self) {} -} - -struct S; - -impl<'l> Foo for &'l S {} - -impl Bar for T {} - -fn main() { - let s = S; - s.foo(); - (&s).bar(); - s.bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-14254.rs b/src/test/ui/run-pass/issues/issue-14254.rs deleted file mode 100644 index 4e03535f613..00000000000 --- a/src/test/ui/run-pass/issues/issue-14254.rs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Foo: Sized { - fn bar(&self); - fn baz(&self) { } - fn bah(_: Option) { } -} - -struct BarTy { - x : isize, - y : f64, -} - -impl BarTy { - fn a() {} - fn b(&self) {} -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl Foo for *const BarTy { - fn bar(&self) { - self.baz(); - BarTy::a(); - Foo::bah(None::<*const BarTy>); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl<'a> Foo for &'a BarTy { - fn bar(&self) { - self.baz(); - self.x; - self.y; - BarTy::a(); - Foo::bah(None::<&BarTy>); - self.b(); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl<'a> Foo for &'a mut BarTy { - fn bar(&self) { - self.baz(); - self.x; - self.y; - BarTy::a(); - Foo::bah(None::<&mut BarTy>); - self.b(); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl Foo for Box { - fn bar(&self) { - self.baz(); - Foo::bah(None::>); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl Foo for *const isize { - fn bar(&self) { - self.baz(); - Foo::bah(None::<*const isize>); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl<'a> Foo for &'a isize { - fn bar(&self) { - self.baz(); - Foo::bah(None::<&isize>); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl<'a> Foo for &'a mut isize { - fn bar(&self) { - self.baz(); - Foo::bah(None::<&mut isize>); - } -} - -// If these fail, it's necessary to update rustc_resolve and the cfail tests. -impl Foo for Box { - fn bar(&self) { - self.baz(); - Foo::bah(None::>); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-14308.rs b/src/test/ui/run-pass/issues/issue-14308.rs deleted file mode 100644 index dce2c4aecd6..00000000000 --- a/src/test/ui/run-pass/issues/issue-14308.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct A(isize); - -fn main() { - let x = match A(3) { - A(..) => 1 - }; - assert_eq!(x, 1); - let x = match A(4) { - A(1) => 1, - A(..) => 2 - }; - assert_eq!(x, 2); -} diff --git a/src/test/ui/run-pass/issues/issue-14330.rs b/src/test/ui/run-pass/issues/issue-14330.rs deleted file mode 100644 index d50dc64f437..00000000000 --- a/src/test/ui/run-pass/issues/issue-14330.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[macro_use] extern crate std as std2; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-14344.rs b/src/test/ui/run-pass/issues/issue-14344.rs deleted file mode 100644 index 842a5c1ad77..00000000000 --- a/src/test/ui/run-pass/issues/issue-14344.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-14344-1.rs -// aux-build:issue-14344-2.rs - -extern crate issue_14344_1; -extern crate issue_14344_2; - -fn main() { - issue_14344_1::foo(); - issue_14344_2::bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-14382.rs b/src/test/ui/run-pass/issues/issue-14382.rs deleted file mode 100644 index 7fdd5e2b0db..00000000000 --- a/src/test/ui/run-pass/issues/issue-14382.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct Matrix4(S); -trait POrd {} - -fn translate>(s: S) -> Matrix4 { Matrix4(s) } - -impl POrd for f32 {} -impl POrd for f64 {} - -fn main() { - let x = 1.0; - let m : Matrix4 = translate(x); - println!("m: {:?}", m); -} diff --git a/src/test/ui/run-pass/issues/issue-14393.rs b/src/test/ui/run-pass/issues/issue-14393.rs deleted file mode 100644 index 9dd3674f34f..00000000000 --- a/src/test/ui/run-pass/issues/issue-14393.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - match ("", 1_usize) { - (_, 42_usize) => (), - ("", _) => (), - _ => () - } -} diff --git a/src/test/ui/run-pass/issues/issue-14399.rs b/src/test/ui/run-pass/issues/issue-14399.rs deleted file mode 100644 index 76785212cd7..00000000000 --- a/src/test/ui/run-pass/issues/issue-14399.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #14399 -// We'd previously ICE if we had a method call whose return -// value was coerced to a trait object. (v.clone() returns Box -// which is coerced to Box). - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -#[derive(Clone)] -struct B1; - -trait A { fn foo(&self) {} } -impl A for B1 {} - -fn main() { - let v: Box<_> = box B1; - let _c: Box = v.clone(); -} diff --git a/src/test/ui/run-pass/issues/issue-14421.rs b/src/test/ui/run-pass/issues/issue-14421.rs deleted file mode 100644 index 8920134bcbb..00000000000 --- a/src/test/ui/run-pass/issues/issue-14421.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// aux-build:issue-14421.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_14421 as bug_lib; - -use bug_lib::B; -use bug_lib::make; - -pub fn main() { - let mut an_A: B = make(); - an_A.foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-14422.rs b/src/test/ui/run-pass/issues/issue-14422.rs deleted file mode 100644 index dd1d74779d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-14422.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// aux-build:issue-14422.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_14422 as bug_lib; - -use bug_lib::B; -use bug_lib::make; - -pub fn main() { - let mut an_A: B = make(); - an_A.foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-14456.rs b/src/test/ui/run-pass/issues/issue-14456.rs deleted file mode 100644 index 27eb0ebcbfe..00000000000 --- a/src/test/ui/run-pass/issues/issue-14456.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::env; -use std::io::prelude::*; -use std::io; -use std::process::{Command, Stdio}; - -fn main() { - let args: Vec = env::args().collect(); - if args.len() > 1 && args[1] == "child" { - return child() - } - - test(); -} - -fn child() { - writeln!(&mut io::stdout(), "foo").unwrap(); - writeln!(&mut io::stderr(), "bar").unwrap(); - let mut stdin = io::stdin(); - let mut s = String::new(); - stdin.lock().read_line(&mut s).unwrap(); - assert_eq!(s.len(), 0); -} - -fn test() { - let args: Vec = env::args().collect(); - let mut p = Command::new(&args[0]).arg("child") - .stdin(Stdio::piped()) - .stdout(Stdio::piped()) - .stderr(Stdio::piped()) - .spawn().unwrap(); - assert!(p.wait().unwrap().success()); -} diff --git a/src/test/ui/run-pass/issues/issue-1451.rs b/src/test/ui/run-pass/issues/issue-1451.rs deleted file mode 100644 index fb344c3b4b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-1451.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_snake_case)] -#![allow(unused_variables)] - -struct T { f: extern "Rust" fn() } -struct S { f: extern "Rust" fn() } - -fn fooS(t: S) { -} - -fn fooT(t: T) { -} - -fn bar() { -} - -pub fn main() { - let x: extern "Rust" fn() = bar; - fooS(S {f: x}); - fooS(S {f: bar}); - - let x: extern "Rust" fn() = bar; - fooT(T {f: x}); - fooT(T {f: bar}); -} diff --git a/src/test/ui/run-pass/issues/issue-14589.rs b/src/test/ui/run-pass/issues/issue-14589.rs deleted file mode 100644 index 78f47237ed6..00000000000 --- a/src/test/ui/run-pass/issues/issue-14589.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// All 3 expressions should work in that the argument gets -// coerced to a trait object - -// pretty-expanded FIXME #23616 - -fn main() { - send::>(Box::new(Output(0))); - Test::>::foo(Box::new(Output(0))); - Test::>::new().send(Box::new(Output(0))); -} - -fn send(_: T) {} - -struct Test { marker: std::marker::PhantomData } -impl Test { - fn new() -> Test { Test { marker: ::std::marker::PhantomData } } - fn foo(_: T) {} - fn send(&self, _: T) {} -} - -trait Foo { fn dummy(&self) { }} -struct Output(isize); -impl Foo for Output {} diff --git a/src/test/ui/run-pass/issues/issue-1460.rs b/src/test/ui/run-pass/issues/issue-1460.rs deleted file mode 100644 index 85a87327355..00000000000 --- a/src/test/ui/run-pass/issues/issue-1460.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -pub fn main() { - {|i: u32| if 1 == i { }}; -} diff --git a/src/test/ui/run-pass/issues/issue-14821.rs b/src/test/ui/run-pass/issues/issue-14821.rs deleted file mode 100644 index c01ffb7d6b1..00000000000 --- a/src/test/ui/run-pass/issues/issue-14821.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait SomeTrait {} -struct Meow; -impl SomeTrait for Meow {} - -struct Foo<'a> { - x: &'a SomeTrait, - y: &'a SomeTrait, -} - -impl<'a> Foo<'a> { - pub fn new<'b>(x: &'b SomeTrait, y: &'b SomeTrait) -> Foo<'b> { Foo { x: x, y: y } } -} - -fn main() { - let r = Meow; - let s = Meow; - let q = Foo::new(&r as &SomeTrait, &s as &SomeTrait); -} diff --git a/src/test/ui/run-pass/issues/issue-14837.rs b/src/test/ui/run-pass/issues/issue-14837.rs deleted file mode 100644 index 9945c6e4407..00000000000 --- a/src/test/ui/run-pass/issues/issue-14837.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[deny(dead_code)] -pub enum Foo { - Bar { - baz: isize - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-14865.rs b/src/test/ui/run-pass/issues/issue-14865.rs deleted file mode 100644 index 4e278c66886..00000000000 --- a/src/test/ui/run-pass/issues/issue-14865.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum X { - Foo(usize), - Bar(bool) -} - -fn main() { - let x = match X::Foo(42) { - X::Foo(..) => 1, - _ if true => 0, - X::Bar(..) => panic!("Oh dear") - }; - assert_eq!(x, 1); - - let x = match X::Foo(42) { - _ if true => 0, - X::Foo(..) => 1, - X::Bar(..) => panic!("Oh dear") - }; - assert_eq!(x, 0); -} diff --git a/src/test/ui/run-pass/issues/issue-14875.rs b/src/test/ui/run-pass/issues/issue-14875.rs deleted file mode 100644 index f983218dc8b..00000000000 --- a/src/test/ui/run-pass/issues/issue-14875.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare always compiled as panic=abort right now - -// Check that values are not leaked when a dtor panics (#14875) - -use std::panic::{self, UnwindSafe}; - -struct SetInnerOnDrop<'a>(&'a mut bool); - -impl<'a> UnwindSafe for SetInnerOnDrop<'a> {} - -impl<'a> Drop for SetInnerOnDrop<'a> { - fn drop(&mut self) { - *self.0 = true; - } -} - -struct PanicOnDrop; -impl Drop for PanicOnDrop { - fn drop(&mut self) { - panic!("test panic"); - } -} - -fn main() { - let mut set_on_drop = false; - { - let set_inner_on_drop = SetInnerOnDrop(&mut set_on_drop); - let _ = panic::catch_unwind(|| { - let _set_inner_on_drop = set_inner_on_drop; - let _panic_on_drop = PanicOnDrop; - }); - } - assert!(set_on_drop); -} diff --git a/src/test/ui/run-pass/issues/issue-14901.rs b/src/test/ui/run-pass/issues/issue-14901.rs deleted file mode 100644 index 7612c5bc855..00000000000 --- a/src/test/ui/run-pass/issues/issue-14901.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Reader {} - -enum Wrapper<'a> { - WrapReader(&'a (Reader + 'a)) -} - -trait Wrap<'a> { - fn wrap(self) -> Wrapper<'a>; -} - -impl<'a, R: Reader> Wrap<'a> for &'a mut R { - fn wrap(self) -> Wrapper<'a> { - Wrapper::WrapReader(self as &'a mut Reader) - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-14919.rs b/src/test/ui/run-pass/issues/issue-14919.rs deleted file mode 100644 index a9768661256..00000000000 --- a/src/test/ui/run-pass/issues/issue-14919.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Matcher { - fn next_match(&mut self) -> Option<(usize, usize)>; -} - -struct CharPredMatcher<'a, 'b> { - str: &'a str, - pred: Box bool + 'b>, -} - -impl<'a, 'b> Matcher for CharPredMatcher<'a, 'b> { - fn next_match(&mut self) -> Option<(usize, usize)> { - None - } -} - -trait IntoMatcher<'a, T> { - fn into_matcher(self, _: &'a str) -> T; -} - -impl<'a, 'b, F> IntoMatcher<'a, CharPredMatcher<'a, 'b>> for F where F: FnMut(char) -> bool + 'b { - fn into_matcher(self, s: &'a str) -> CharPredMatcher<'a, 'b> { - CharPredMatcher { - str: s, - pred: Box::new(self), - } - } -} - -struct MatchIndices { - matcher: M -} - -impl Iterator for MatchIndices { - type Item = (usize, usize); - - fn next(&mut self) -> Option<(usize, usize)> { - self.matcher.next_match() - } -} - -fn match_indices<'a, M, T: IntoMatcher<'a, M>>(s: &'a str, from: T) -> MatchIndices { - let string_matcher = from.into_matcher(s); - MatchIndices { matcher: string_matcher } -} - -fn main() { - let s = "abcbdef"; - match_indices(s, |c: char| c == 'b') - .collect::>(); -} diff --git a/src/test/ui/run-pass/issues/issue-14933.rs b/src/test/ui/run-pass/issues/issue-14933.rs deleted file mode 100644 index 30365bb3e4f..00000000000 --- a/src/test/ui/run-pass/issues/issue-14933.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub type BigRat = T; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-14936.rs b/src/test/ui/run-pass/issues/issue-14936.rs deleted file mode 100644 index 3786b0408ad..00000000000 --- a/src/test/ui/run-pass/issues/issue-14936.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(asm)] - -type History = Vec<&'static str>; - -fn wrap(x:A, which: &'static str, history: &mut History) -> A { - history.push(which); - x -} - -macro_rules! demo { - ( $output_constraint:tt ) => { - { - let mut x: isize = 0; - let y: isize = 1; - - let mut history: History = vec![]; - unsafe { - asm!("mov ($1), $0" - : $output_constraint (*wrap(&mut x, "out", &mut history)) - : "r"(&wrap(y, "in", &mut history)) - :: "volatile"); - } - assert_eq!((x,y), (1,1)); - let b: &[_] = &["out", "in"]; - assert_eq!(history, b); - } - } -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -fn main() { - fn out_write_only_expr_then_in_expr() { - demo!("=r") - } - - fn out_read_write_expr_then_in_expr() { - demo!("+r") - } - - out_write_only_expr_then_in_expr(); - out_read_write_expr_then_in_expr(); -} - -#[cfg(all(not(target_arch = "x86"), not(target_arch = "x86_64")))] -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-14940.rs b/src/test/ui/run-pass/issues/issue-14940.rs deleted file mode 100644 index 494b790b5bd..00000000000 --- a/src/test/ui/run-pass/issues/issue-14940.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::env; -use std::process::Command; -use std::io::{self, Write}; - -fn main() { - let mut args = env::args(); - if args.len() > 1 { - let mut out = io::stdout(); - out.write(&['a' as u8; 128 * 1024]).unwrap(); - } else { - let out = Command::new(&args.next().unwrap()).arg("child").output(); - let out = out.unwrap(); - assert!(out.status.success()); - } -} diff --git a/src/test/ui/run-pass/issues/issue-14958.rs b/src/test/ui/run-pass/issues/issue-14958.rs deleted file mode 100644 index 90716488fab..00000000000 --- a/src/test/ui/run-pass/issues/issue-14958.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(fn_traits, unboxed_closures)] - -trait Foo { fn dummy(&self) { }} - -struct Bar; - -impl<'a> std::ops::Fn<(&'a (Foo+'a),)> for Bar { - extern "rust-call" fn call(&self, _: (&'a Foo,)) {} -} - -impl<'a> std::ops::FnMut<(&'a (Foo+'a),)> for Bar { - extern "rust-call" fn call_mut(&mut self, a: (&'a Foo,)) { self.call(a) } -} - -impl<'a> std::ops::FnOnce<(&'a (Foo+'a),)> for Bar { - type Output = (); - extern "rust-call" fn call_once(self, a: (&'a Foo,)) { self.call(a) } -} - -struct Baz; - -impl Foo for Baz {} - -fn main() { - let bar = Bar; - let baz = &Baz; - bar(baz); -} diff --git a/src/test/ui/run-pass/issues/issue-14959.rs b/src/test/ui/run-pass/issues/issue-14959.rs deleted file mode 100644 index fc245fb4244..00000000000 --- a/src/test/ui/run-pass/issues/issue-14959.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(fn_traits, unboxed_closures)] - -use std::ops::Fn; - -trait Response { fn dummy(&self) { } } -trait Request { fn dummy(&self) { } } -trait Ingot { - fn enter(&mut self, _: &mut R, _: &mut S, a: &mut Alloy) -> Status; -} - -#[allow(dead_code)] -struct HelloWorld; - -struct SendFile; -struct Alloy; -enum Status { - Continue -} - -impl Alloy { - fn find(&self) -> Option { - None - } -} - -impl<'b> Fn<(&'b mut (Response+'b),)> for SendFile { - extern "rust-call" fn call(&self, (_res,): (&'b mut (Response+'b),)) {} -} - -impl<'b> FnMut<(&'b mut (Response+'b),)> for SendFile { - extern "rust-call" fn call_mut(&mut self, (_res,): (&'b mut (Response+'b),)) { - self.call((_res,)) - } -} - -impl<'b> FnOnce<(&'b mut (Response+'b),)> for SendFile { - type Output = (); - - extern "rust-call" fn call_once(self, (_res,): (&'b mut (Response+'b),)) { - self.call((_res,)) - } -} - -impl Ingot for HelloWorld { - fn enter(&mut self, _req: &mut Rq, res: &mut Rs, alloy: &mut Alloy) -> Status { - let send_file = alloy.find::().unwrap(); - send_file(res); - Status::Continue - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-15043.rs b/src/test/ui/run-pass/issues/issue-15043.rs deleted file mode 100644 index 3ba4966a13e..00000000000 --- a/src/test/ui/run-pass/issues/issue-15043.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(warnings)] - -struct S(T); - -static s1: S>=S(S(0)); -static s2: S=S(0); - -fn main() { - let foo: S>=S(S(0)); - let foo: S=S(0); -} diff --git a/src/test/ui/run-pass/issues/issue-15063.rs b/src/test/ui/run-pass/issues/issue-15063.rs deleted file mode 100644 index 863dde1fc5e..00000000000 --- a/src/test/ui/run-pass/issues/issue-15063.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Two { A, B} -impl Drop for Two { - fn drop(&mut self) { - println!("Dropping!"); - } -} -fn main() { - let k = Two::A; -} diff --git a/src/test/ui/run-pass/issues/issue-15080.rs b/src/test/ui/run-pass/issues/issue-15080.rs deleted file mode 100644 index ee8356b99e0..00000000000 --- a/src/test/ui/run-pass/issues/issue-15080.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn main() { - let mut x: &[_] = &[1, 2, 3, 4]; - - let mut result = vec![]; - loop { - x = match *x { - [1, n, 3, ref rest..] => { - result.push(n); - rest - } - [n, ref rest..] => { - result.push(n); - rest - } - [] => - break - } - } - assert_eq!(result, [2, 4]); -} diff --git a/src/test/ui/run-pass/issues/issue-15104.rs b/src/test/ui/run-pass/issues/issue-15104.rs deleted file mode 100644 index 0cb1d69d186..00000000000 --- a/src/test/ui/run-pass/issues/issue-15104.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn main() { - assert_eq!(count_members(&[1, 2, 3, 4]), 4); -} - -fn count_members(v: &[usize]) -> usize { - match *v { - [] => 0, - [_] => 1, - [_, ref xs..] => 1 + count_members(xs) - } -} diff --git a/src/test/ui/run-pass/issues/issue-15108.rs b/src/test/ui/run-pass/issues/issue-15108.rs deleted file mode 100644 index 7288ff23cb4..00000000000 --- a/src/test/ui/run-pass/issues/issue-15108.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-15129.rs b/src/test/ui/run-pass/issues/issue-15129.rs deleted file mode 100644 index b0ee797752a..00000000000 --- a/src/test/ui/run-pass/issues/issue-15129.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub enum T { - T1(()), - T2(()) -} - -pub enum V { - V1(isize), - V2(bool) -} - -fn foo(x: (T, V)) -> String { - match x { - (T::T1(()), V::V1(i)) => format!("T1(()), V1({})", i), - (T::T2(()), V::V2(b)) => format!("T2(()), V2({})", b), - _ => String::new() - } -} - - -fn main() { - assert_eq!(foo((T::T1(()), V::V1(99))), "T1(()), V1(99)".to_string()); - assert_eq!(foo((T::T2(()), V::V2(true))), "T2(()), V2(true)".to_string()); -} diff --git a/src/test/ui/run-pass/issues/issue-15155.rs b/src/test/ui/run-pass/issues/issue-15155.rs deleted file mode 100644 index 3abed1f5637..00000000000 --- a/src/test/ui/run-pass/issues/issue-15155.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait TraitWithSend: Send {} -trait IndirectTraitWithSend: TraitWithSend {} - -// Check struct instantiation (Box will only have Send if TraitWithSend has Send) -#[allow(dead_code)] -struct Blah { x: Box } -impl TraitWithSend for Blah {} - -// Struct instantiation 2-levels deep -#[allow(dead_code)] -struct IndirectBlah { x: Box } -impl TraitWithSend for IndirectBlah {} -impl IndirectTraitWithSend for IndirectBlah {} - -fn test_trait() { println!("got here!") } - -fn main() { - test_trait::(); - test_trait::(); -} diff --git a/src/test/ui/run-pass/issues/issue-15189.rs b/src/test/ui/run-pass/issues/issue-15189.rs deleted file mode 100644 index 6c6a4404da9..00000000000 --- a/src/test/ui/run-pass/issues/issue-15189.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! third { - ($e:expr) => ({let x = 2; $e[x]}) -} - -fn main() { - let x = vec![10_usize,11_usize,12_usize,13_usize]; - let t = third!(x); - assert_eq!(t,12_usize); -} diff --git a/src/test/ui/run-pass/issues/issue-15221.rs b/src/test/ui/run-pass/issues/issue-15221.rs deleted file mode 100644 index 25e163e3958..00000000000 --- a/src/test/ui/run-pass/issues/issue-15221.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -macro_rules! inner { - ($e:pat ) => ($e) -} - -macro_rules! outer { - ($e:pat ) => (inner!($e)) -} - -fn main() { - let outer!(g1) = 13; - g1; -} diff --git a/src/test/ui/run-pass/issues/issue-15261.rs b/src/test/ui/run-pass/issues/issue-15261.rs deleted file mode 100644 index b715a388d10..00000000000 --- a/src/test/ui/run-pass/issues/issue-15261.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// pretty-expanded FIXME #23616 - -static mut n_mut: usize = 0; - -static n: &'static usize = unsafe{ &n_mut }; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-15444.rs b/src/test/ui/run-pass/issues/issue-15444.rs deleted file mode 100644 index 826ca40d63d..00000000000 --- a/src/test/ui/run-pass/issues/issue-15444.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait MyTrait { - fn foo(&self); -} - -impl MyTrait for fn(A, B) -> C { - fn foo(&self) {} -} - -fn bar(t: &T) { - t.foo() -} - -fn thing(a: isize, b: isize) -> isize { - a + b -} - -fn main() { - let thing: fn(isize, isize) -> isize = thing; // coerce to fn type - bar(&thing); -} diff --git a/src/test/ui/run-pass/issues/issue-15487.rs b/src/test/ui/run-pass/issues/issue-15487.rs deleted file mode 100644 index de4de14ca33..00000000000 --- a/src/test/ui/run-pass/issues/issue-15487.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-windows -// ignore-wasm32-bare no libs to link - -#![feature(link_args)] - -#[link_args="-lc -lm"] -#[link_args=" -lc"] -#[link_args="-lc "] -extern {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-15523-big.rs b/src/test/ui/run-pass/issues/issue-15523-big.rs deleted file mode 100644 index 41a52283aac..00000000000 --- a/src/test/ui/run-pass/issues/issue-15523-big.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 15523: derive(PartialOrd) should use the provided -// discriminant values for the derived ordering. -// -// This test is checking corner cases that arise when you have -// 64-bit values in the variants. - -#[derive(PartialEq, PartialOrd)] -#[repr(u64)] -enum Eu64 { - Pos2 = 2, - PosMax = !0, - Pos1 = 1, -} - -#[derive(PartialEq, PartialOrd)] -#[repr(i64)] -enum Ei64 { - Pos2 = 2, - Neg1 = -1, - NegMin = 1 << 63, - PosMax = !(1 << 63), - Pos1 = 1, -} - -fn main() { - assert!(Eu64::Pos2 > Eu64::Pos1); - assert!(Eu64::Pos2 < Eu64::PosMax); - assert!(Eu64::Pos1 < Eu64::PosMax); - - - assert!(Ei64::Pos2 > Ei64::Pos1); - assert!(Ei64::Pos2 > Ei64::Neg1); - assert!(Ei64::Pos1 > Ei64::Neg1); - assert!(Ei64::Pos2 > Ei64::NegMin); - assert!(Ei64::Pos1 > Ei64::NegMin); - assert!(Ei64::Pos2 < Ei64::PosMax); - assert!(Ei64::Pos1 < Ei64::PosMax); -} diff --git a/src/test/ui/run-pass/issues/issue-15523.rs b/src/test/ui/run-pass/issues/issue-15523.rs deleted file mode 100644 index a8fc2153c66..00000000000 --- a/src/test/ui/run-pass/issues/issue-15523.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 15523: derive(PartialOrd) should use the provided -// discriminant values for the derived ordering. -// -// This is checking the basic functionality. - -#[derive(PartialEq, PartialOrd)] -enum E1 { - Pos2 = 2, - Neg1 = -1, - Pos1 = 1, -} - -#[derive(PartialEq, PartialOrd)] -#[repr(u8)] -enum E2 { - Pos2 = 2, - PosMax = !0 as u8, - Pos1 = 1, -} - -#[derive(PartialEq, PartialOrd)] -#[repr(i8)] -enum E3 { - Pos2 = 2, - Neg1 = -1_i8, - Pos1 = 1, -} - -fn main() { - assert!(E1::Pos2 > E1::Pos1); - assert!(E1::Pos1 > E1::Neg1); - assert!(E1::Pos2 > E1::Neg1); - - assert!(E2::Pos2 > E2::Pos1); - assert!(E2::Pos1 < E2::PosMax); - assert!(E2::Pos2 < E2::PosMax); - - assert!(E3::Pos2 > E3::Pos1); - assert!(E3::Pos1 > E3::Neg1); - assert!(E3::Pos2 > E3::Neg1); -} diff --git a/src/test/ui/run-pass/issues/issue-15562.rs b/src/test/ui/run-pass/issues/issue-15562.rs deleted file mode 100644 index a3e3f528ff5..00000000000 --- a/src/test/ui/run-pass/issues/issue-15562.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-15562.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_15562 as i; - -pub fn main() { - unsafe { - transmute(); - i::transmute(); - } -} - -// We declare this so we don't run into unresolved symbol errors -// The above extern is NOT `extern "rust-intrinsic"` and thus -// means it'll try to find a corresponding symbol to link to. -#[no_mangle] -pub extern fn transmute() {} diff --git a/src/test/ui/run-pass/issues/issue-15571.rs b/src/test/ui/run-pass/issues/issue-15571.rs deleted file mode 100644 index 41414b13a19..00000000000 --- a/src/test/ui/run-pass/issues/issue-15571.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn match_on_local() { - let mut foo: Option> = Some(box 5); - match foo { - None => {}, - Some(x) => { - foo = Some(x); - } - } - println!("'{}'", foo.unwrap()); -} - -fn match_on_arg(mut foo: Option>) { - match foo { - None => {} - Some(x) => { - foo = Some(x); - } - } - println!("'{}'", foo.unwrap()); -} - -fn match_on_binding() { - match Some(Box::new(7)) { - mut foo => { - match foo { - None => {}, - Some(x) => { - foo = Some(x); - } - } - println!("'{}'", foo.unwrap()); - } - } -} - -fn match_on_upvar() { - let mut foo: Option> = Some(box 8); - let f = move|| { - match foo { - None => {}, - Some(x) => { - foo = Some(x); - } - } - println!("'{}'", foo.unwrap()); - }; - f(); -} - -fn main() { - match_on_local(); - match_on_arg(Some(box 6)); - match_on_binding(); - match_on_upvar(); -} diff --git a/src/test/ui/run-pass/issues/issue-15673.rs b/src/test/ui/run-pass/issues/issue-15673.rs deleted file mode 100644 index c706606cf6a..00000000000 --- a/src/test/ui/run-pass/issues/issue-15673.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(iter_arith)] - -fn main() { - let x: [u64; 3] = [1, 2, 3]; - assert_eq!(6, (0..3).map(|i| x[i]).sum::()); -} diff --git a/src/test/ui/run-pass/issues/issue-15689-1.rs b/src/test/ui/run-pass/issues/issue-15689-1.rs deleted file mode 100644 index 02bf687e74f..00000000000 --- a/src/test/ui/run-pass/issues/issue-15689-1.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(PartialEq, Debug)] -enum Test<'a> { - Slice(&'a isize) -} - -fn main() { - assert_eq!(Test::Slice(&1), Test::Slice(&1)) -} diff --git a/src/test/ui/run-pass/issues/issue-15689-2.rs b/src/test/ui/run-pass/issues/issue-15689-2.rs deleted file mode 100644 index 7b4d1e3e3e2..00000000000 --- a/src/test/ui/run-pass/issues/issue-15689-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Clone)] -enum Test<'a> { - Slice(&'a isize) -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-15730.rs b/src/test/ui/run-pass/issues/issue-15730.rs deleted file mode 100644 index c2f5f9f2e60..00000000000 --- a/src/test/ui/run-pass/issues/issue-15730.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let mut array = [1, 2, 3]; - let pie_slice = &array[1..2]; -} diff --git a/src/test/ui/run-pass/issues/issue-15734.rs b/src/test/ui/run-pass/issues/issue-15734.rs deleted file mode 100644 index 6b386ed0f8d..00000000000 --- a/src/test/ui/run-pass/issues/issue-15734.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// If `Index` used an associated type for its output, this test would -// work more smoothly. - -use std::ops::Index; - -struct Mat { data: Vec, cols: usize, } - -impl Mat { - fn new(data: Vec, cols: usize) -> Mat { - Mat { data: data, cols: cols } - } - fn row<'a>(&'a self, row: usize) -> Row<&'a Mat> { - Row { mat: self, row: row, } - } -} - -impl Index<(usize, usize)> for Mat { - type Output = T; - - fn index<'a>(&'a self, (row, col): (usize, usize)) -> &'a T { - &self.data[row * self.cols + col] - } -} - -impl<'a, T> Index<(usize, usize)> for &'a Mat { - type Output = T; - - fn index<'b>(&'b self, index: (usize, usize)) -> &'b T { - (*self).index(index) - } -} - -struct Row { mat: M, row: usize, } - -impl> Index for Row { - type Output = T; - - fn index<'a>(&'a self, col: usize) -> &'a T { - &self.mat[(self.row, col)] - } -} - -fn main() { - let m = Mat::new(vec![1, 2, 3, 4, 5, 6], 3); - let r = m.row(1); - - assert_eq!(r.index(2), &6); - assert_eq!(r[2], 6); - assert_eq!(r[2], 6); - assert_eq!(6, r[2]); - - let e = r[2]; - assert_eq!(e, 6); - - let e: usize = r[2]; - assert_eq!(e, 6); -} diff --git a/src/test/ui/run-pass/issues/issue-15735.rs b/src/test/ui/run-pass/issues/issue-15735.rs deleted file mode 100644 index 9e95b173e89..00000000000 --- a/src/test/ui/run-pass/issues/issue-15735.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct A<'a> { - a: &'a i32, - b: &'a i32, -} - -impl <'a> A<'a> { - fn foo<'b>(&'b self) { - A { - a: self.a, - b: self.b, - }; - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-15763.rs b/src/test/ui/run-pass/issues/issue-15763.rs deleted file mode 100644 index f241efa74d3..00000000000 --- a/src/test/ui/run-pass/issues/issue-15763.rs +++ /dev/null @@ -1,98 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -#[derive(PartialEq, Debug)] -struct Bar { - x: isize -} -impl Drop for Bar { - fn drop(&mut self) { - assert_eq!(self.x, 22); - } -} - -#[derive(PartialEq, Debug)] -struct Foo { - x: Bar, - a: isize -} - -fn foo() -> Result { - return Ok(Foo { - x: Bar { x: 22 }, - a: return Err(32) - }); -} - -fn baz() -> Result { - Ok(Foo { - x: Bar { x: 22 }, - a: return Err(32) - }) -} - -// explicit immediate return -fn aa() -> isize { - return 3; -} - -// implicit immediate return -fn bb() -> isize { - 3 -} - -// implicit outptr return -fn cc() -> Result { - Ok(3) -} - -// explicit outptr return -fn dd() -> Result { - return Ok(3); -} - -trait A { - fn aaa(&self) -> isize { - 3 - } - fn bbb(&self) -> isize { - return 3; - } - fn ccc(&self) -> Result { - Ok(3) - } - fn ddd(&self) -> Result { - return Ok(3); - } -} - -impl A for isize {} - -fn main() { - assert_eq!(foo(), Err(32)); - assert_eq!(baz(), Err(32)); - - assert_eq!(aa(), 3); - assert_eq!(bb(), 3); - assert_eq!(cc().unwrap(), 3); - assert_eq!(dd().unwrap(), 3); - - let i = box 32isize as Box; - assert_eq!(i.aaa(), 3); - let i = box 32isize as Box; - assert_eq!(i.bbb(), 3); - let i = box 32isize as Box; - assert_eq!(i.ccc().unwrap(), 3); - let i = box 32isize as Box; - assert_eq!(i.ddd().unwrap(), 3); -} diff --git a/src/test/ui/run-pass/issues/issue-15774.rs b/src/test/ui/run-pass/issues/issue-15774.rs deleted file mode 100644 index 3e4845886e0..00000000000 --- a/src/test/ui/run-pass/issues/issue-15774.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![deny(warnings)] -#![allow(unused_imports)] - -pub enum Foo { A } -mod bar { - pub fn normal(x: ::Foo) { - use Foo::A; - match x { - A => {} - } - } - pub fn wrong(x: ::Foo) { - match x { - ::Foo::A => {} - } - } -} - -pub fn main() { - bar::normal(Foo::A); - bar::wrong(Foo::A); -} diff --git a/src/test/ui/run-pass/issues/issue-15793.rs b/src/test/ui/run-pass/issues/issue-15793.rs deleted file mode 100644 index 97f4c0095ec..00000000000 --- a/src/test/ui/run-pass/issues/issue-15793.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum NestedEnum { - First, - Second, - Third -} -enum Enum { - Variant1(bool), - Variant2(NestedEnum) -} - -#[inline(never)] -fn foo(x: Enum) -> isize { - match x { - Enum::Variant1(true) => 1, - Enum::Variant1(false) => 2, - Enum::Variant2(NestedEnum::Second) => 3, - Enum::Variant2(NestedEnum::Third) => 4, - Enum::Variant2(NestedEnum::First) => 5 - } -} - -fn main() { - assert_eq!(foo(Enum::Variant2(NestedEnum::Third)), 4); -} diff --git a/src/test/ui/run-pass/issues/issue-15858.rs b/src/test/ui/run-pass/issues/issue-15858.rs deleted file mode 100644 index f0b4db7d6bd..00000000000 --- a/src/test/ui/run-pass/issues/issue-15858.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -static mut DROP_RAN: bool = false; - -trait Bar { - fn do_something(&mut self); -} - -struct BarImpl; - -impl Bar for BarImpl { - fn do_something(&mut self) {} -} - - -struct Foo(B); - -impl Drop for Foo { - fn drop(&mut self) { - unsafe { - DROP_RAN = true; - } - } -} - - -fn main() { - { - let _x: Foo = Foo(BarImpl); - } - unsafe { - assert_eq!(DROP_RAN, true); - } -} diff --git a/src/test/ui/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs b/src/test/ui/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs deleted file mode 100644 index 2b39b80d10f..00000000000 --- a/src/test/ui/run-pass/issues/issue-15881-model-lexer-dotdotdot.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 - -// regression test for the model lexer handling the DOTDOTDOT syntax (#15877) - - -pub fn main() { - match 5_usize { - 1_usize...5_usize => {} - _ => panic!("should match range"), - } - match 5_usize { - 6_usize...7_usize => panic!("shouldn't match range"), - _ => {} - } - match 5_usize { - 1_usize => panic!("should match non-first range"), - 2_usize...6_usize => {} - _ => panic!("math is broken") - } - match 'c' { - 'a'...'z' => {} - _ => panic!("should support char ranges") - } - match -3_isize { - -7...5 => {} - _ => panic!("should match signed range") - } - match 3.0f64 { - 1.0...5.0 => {} - _ => panic!("should match float range") - } - match -1.5f64 { - -3.6...3.6 => {} - _ => panic!("should match negative float range") - } -} diff --git a/src/test/ui/run-pass/issues/issue-16151.rs b/src/test/ui/run-pass/issues/issue-16151.rs deleted file mode 100644 index 440037ff119..00000000000 --- a/src/test/ui/run-pass/issues/issue-16151.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem; - -static mut DROP_COUNT: usize = 0; - -struct Fragment; - -impl Drop for Fragment { - fn drop(&mut self) { - unsafe { - DROP_COUNT += 1; - } - } -} - -fn main() { - { - let mut fragments = vec![Fragment, Fragment, Fragment]; - let _new_fragments: Vec = mem::replace(&mut fragments, vec![]) - .into_iter() - .skip_while(|_fragment| { - true - }).collect(); - } - unsafe { - assert_eq!(DROP_COUNT, 3); - } -} diff --git a/src/test/ui/run-pass/issues/issue-16256.rs b/src/test/ui/run-pass/issues/issue-16256.rs deleted file mode 100644 index 20a5bbadcf5..00000000000 --- a/src/test/ui/run-pass/issues/issue-16256.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let mut buf = Vec::new(); - |c: u8| buf.push(c); -} diff --git a/src/test/ui/run-pass/issues/issue-16272.rs b/src/test/ui/run-pass/issues/issue-16272.rs deleted file mode 100644 index dd515ea1558..00000000000 --- a/src/test/ui/run-pass/issues/issue-16272.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::process::Command; -use std::env; - -fn main() { - let len = env::args().len(); - - if len == 1 { - test(); - } else { - assert_eq!(len, 3); - } -} - -fn test() { - let status = Command::new(&env::current_exe().unwrap()) - .arg("foo").arg("") - .status().unwrap(); - assert!(status.success()); -} diff --git a/src/test/ui/run-pass/issues/issue-16278.rs b/src/test/ui/run-pass/issues/issue-16278.rs deleted file mode 100644 index c3b6c5a38ba..00000000000 --- a/src/test/ui/run-pass/issues/issue-16278.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-tidy-cr - -// this file has some special \r\n endings (use xxd to see them) - -fn main() {assert_eq!(b"", b"\ - "); -assert_eq!(b"\n", b" -"); -} - diff --git a/src/test/ui/run-pass/issues/issue-16441.rs b/src/test/ui/run-pass/issues/issue-16441.rs deleted file mode 100644 index 5a0ea2adc63..00000000000 --- a/src/test/ui/run-pass/issues/issue-16441.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Empty; - -// This used to cause an ICE -extern "C" fn ice(_a: Empty) {} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-16452.rs b/src/test/ui/run-pass/issues/issue-16452.rs deleted file mode 100644 index 2b78582b577..00000000000 --- a/src/test/ui/run-pass/issues/issue-16452.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - if true { return } - match () { - () => { static MAGIC: usize = 0; } - } -} diff --git a/src/test/ui/run-pass/issues/issue-16492.rs b/src/test/ui/run-pass/issues/issue-16492.rs deleted file mode 100644 index 7c2f4d99e6a..00000000000 --- a/src/test/ui/run-pass/issues/issue-16492.rs +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -use std::rc::Rc; -use std::cell::Cell; - -struct Field { - number: usize, - state: Rc> -} - -impl Field { - fn new(number: usize, state: Rc>) -> Field { - Field { - number: number, - state: state - } - } -} - -impl Drop for Field { - fn drop(&mut self) { - println!("Dropping field {}", self.number); - assert_eq!(self.state.get(), self.number); - self.state.set(self.state.get()+1); - } -} - -struct NoDropImpl { - _one: Field, - _two: Field, - _three: Field -} - -struct HasDropImpl { - _one: Field, - _two: Field, - _three: Field -} - -impl Drop for HasDropImpl { - fn drop(&mut self) { - println!("HasDropImpl.drop()"); - assert_eq!(self._one.state.get(), 0); - self._one.state.set(1); - } -} - -pub fn main() { - let state = Rc::new(Cell::new(1)); - let noImpl = NoDropImpl { - _one: Field::new(1, state.clone()), - _two: Field::new(2, state.clone()), - _three: Field::new(3, state.clone()) - }; - drop(noImpl); - assert_eq!(state.get(), 4); - - state.set(0); - let hasImpl = HasDropImpl { - _one: Field::new(1, state.clone()), - _two: Field::new(2, state.clone()), - _three: Field::new(3, state.clone()) - }; - drop(hasImpl); - assert_eq!(state.get(), 4); -} diff --git a/src/test/ui/run-pass/issues/issue-16530.rs b/src/test/ui/run-pass/issues/issue-16530.rs deleted file mode 100644 index f32057e5e44..00000000000 --- a/src/test/ui/run-pass/issues/issue-16530.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -use std::hash::{SipHasher, Hasher, Hash}; - -#[derive(Hash)] -struct Empty; - -pub fn main() { - let mut s1 = SipHasher::new_with_keys(0, 0); - Empty.hash(&mut s1); - let mut s2 = SipHasher::new_with_keys(0, 0); - Empty.hash(&mut s2); - assert_eq!(s1.finish(), s2.finish()); -} diff --git a/src/test/ui/run-pass/issues/issue-16560.rs b/src/test/ui/run-pass/issues/issue-16560.rs deleted file mode 100644 index 50009f4f6ea..00000000000 --- a/src/test/ui/run-pass/issues/issue-16560.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::mem; - -fn main() { - let y = 0u8; - let closure = move |x: u8| y + x; - - // Check that both closures are capturing by value - assert_eq!(1, mem::size_of_val(&closure)); - - thread::spawn(move|| { - let ok = closure; - }).join().ok().unwrap(); -} diff --git a/src/test/ui/run-pass/issues/issue-16596.rs b/src/test/ui/run-pass/issues/issue-16596.rs deleted file mode 100644 index cdbc3daf4ab..00000000000 --- a/src/test/ui/run-pass/issues/issue-16596.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait MatrixRow { fn dummy(&self) { }} - -struct Mat; - -impl<'a> MatrixRow for &'a Mat {} - -struct Rows { - mat: M, -} - -impl<'a> Iterator for Rows<&'a Mat> { - type Item = (); - - fn next(&mut self) -> Option<()> { - unimplemented!() - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-16597-empty.rs b/src/test/ui/run-pass/issues/issue-16597-empty.rs deleted file mode 100644 index c68e2634831..00000000000 --- a/src/test/ui/run-pass/issues/issue-16597-empty.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--test - -// This verifies that the test generation doesn't crash when we have -// no tests - for more information, see PR #16892. diff --git a/src/test/ui/run-pass/issues/issue-16597.rs b/src/test/ui/run-pass/issues/issue-16597.rs deleted file mode 100644 index 6b437eb65aa..00000000000 --- a/src/test/ui/run-pass/issues/issue-16597.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--test - -mod tests { - use super::*; - - #[test] - pub fn test(){} -} diff --git a/src/test/ui/run-pass/issues/issue-1660.rs b/src/test/ui/run-pass/issues/issue-1660.rs deleted file mode 100644 index 61b380bf695..00000000000 --- a/src/test/ui/run-pass/issues/issue-1660.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// pretty-expanded FIXME #23616 - -pub fn main() { - static _x: isize = 1<<2; -} diff --git a/src/test/ui/run-pass/issues/issue-16602-1.rs b/src/test/ui/run-pass/issues/issue-16602-1.rs deleted file mode 100644 index e351832a8c2..00000000000 --- a/src/test/ui/run-pass/issues/issue-16602-1.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let mut t = [1; 2]; - t = [t[1] * 2, t[0] * 2]; - assert_eq!(&t[..], &[2, 2]); -} diff --git a/src/test/ui/run-pass/issues/issue-16602-2.rs b/src/test/ui/run-pass/issues/issue-16602-2.rs deleted file mode 100644 index 197059202e0..00000000000 --- a/src/test/ui/run-pass/issues/issue-16602-2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct A { - pub x: u32, - pub y: u32, -} - -fn main() { - let mut a = A { x: 1, y: 1 }; - a = A { x: a.y * 2, y: a.x * 2 }; - assert_eq!(a.x, 2); - assert_eq!(a.y, 2); -} diff --git a/src/test/ui/run-pass/issues/issue-16602-3.rs b/src/test/ui/run-pass/issues/issue-16602-3.rs deleted file mode 100644 index 5346851f0f2..00000000000 --- a/src/test/ui/run-pass/issues/issue-16602-3.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -enum Foo { - Bar(u32, u32), - Baz(&'static u32, &'static u32) -} - -static NUM: u32 = 100; - -fn main () { - let mut b = Foo::Baz(&NUM, &NUM); - b = Foo::Bar(f(&b), g(&b)); -} - -static FNUM: u32 = 1; - -fn f (b: &Foo) -> u32 { - FNUM -} - -static GNUM: u32 = 2; - -fn g (b: &Foo) -> u32 { - GNUM -} diff --git a/src/test/ui/run-pass/issues/issue-16643.rs b/src/test/ui/run-pass/issues/issue-16643.rs deleted file mode 100644 index 7bfb5444d05..00000000000 --- a/src/test/ui/run-pass/issues/issue-16643.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-16643.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_16643 as i; - -pub fn main() { - i::TreeBuilder { h: 3 }.process_token(); -} diff --git a/src/test/ui/run-pass/issues/issue-16648.rs b/src/test/ui/run-pass/issues/issue-16648.rs deleted file mode 100644 index cd0fca9ad62..00000000000 --- a/src/test/ui/run-pass/issues/issue-16648.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let x: (isize, &[isize]) = (2, &[1, 2]); - assert_eq!(match x { - (0, &[_, _]) => 0, - (1, _) => 1, - (2, &[_, _]) => 2, - (2, _) => 3, - _ => 4 - }, 2); -} diff --git a/src/test/ui/run-pass/issues/issue-16668.rs b/src/test/ui/run-pass/issues/issue-16668.rs deleted file mode 100644 index 08f696cfcf4..00000000000 --- a/src/test/ui/run-pass/issues/issue-16668.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Parser<'a, I, O> { - parse: Box Result + 'a> -} - -impl<'a, I: 'a, O: 'a> Parser<'a, I, O> { - fn compose(mut self, mut rhs: Parser<'a, O, K>) -> Parser<'a, I, K> { - Parser { - parse: Box::new(move |x: I| { - match (self.parse)(x) { - Ok(r) => (rhs.parse)(r), - Err(e) => Err(e) - } - }) - } - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-16671.rs b/src/test/ui/run-pass/issues/issue-16671.rs deleted file mode 100644 index 5ff2bc97ae2..00000000000 --- a/src/test/ui/run-pass/issues/issue-16671.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -//compile-flags: -Z borrowck=compare -Z emit-end-regions - -#![deny(warnings)] - -fn foo(_f: F) { } - -fn main() { - let mut var = Vec::new(); - foo(move|| { - var.push(1); - }); -} diff --git a/src/test/ui/run-pass/issues/issue-16739.rs b/src/test/ui/run-pass/issues/issue-16739.rs deleted file mode 100644 index 8404e387659..00000000000 --- a/src/test/ui/run-pass/issues/issue-16739.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] -#![feature(unboxed_closures, fn_traits)] - -// Test that unboxing shim for calling rust-call ABI methods through a -// trait box works and does not cause an ICE. - -struct Foo { foo: u32 } - -impl FnMut<()> for Foo { - extern "rust-call" fn call_mut(&mut self, _: ()) -> u32 { self.foo } -} - -impl FnOnce<()> for Foo { - type Output = u32; - extern "rust-call" fn call_once(mut self, _: ()) -> u32 { self.call_mut(()) } -} - -///////////////////////////////////////////////////////////////////////// - -impl FnMut<(u32,)> for Foo { - extern "rust-call" fn call_mut(&mut self, (x,): (u32,)) -> u32 { self.foo + x } -} - -impl FnOnce<(u32,)> for Foo { - type Output = u32; - extern "rust-call" fn call_once(mut self, args: (u32,)) -> u32 { self.call_mut(args) } -} - -///////////////////////////////////////////////////////////////////////// - -impl FnMut<(u32,u32)> for Foo { - extern "rust-call" fn call_mut(&mut self, (x, y): (u32, u32)) -> u32 { self.foo + x + y } -} - -impl FnOnce<(u32,u32)> for Foo { - type Output = u32; - extern "rust-call" fn call_once(mut self, args: (u32,u32)) -> u32 { self.call_mut(args) } -} - -fn main() { - let mut f = box Foo { foo: 42 } as Box u32>; - assert_eq!(f.call_mut(()), 42); - - let mut f = box Foo { foo: 40 } as Box u32>; - assert_eq!(f.call_mut((2,)), 42); - - let mut f = box Foo { foo: 40 } as Box u32>; - assert_eq!(f.call_mut((1, 1)), 42); -} diff --git a/src/test/ui/run-pass/issues/issue-16745.rs b/src/test/ui/run-pass/issues/issue-16745.rs deleted file mode 100644 index 4603c0c2c56..00000000000 --- a/src/test/ui/run-pass/issues/issue-16745.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - const X: u8 = 0; - let out: u8 = match 0u8 { - X => 99, - b'\t' => 1, - 1u8 => 2, - _ => 3, - }; - assert_eq!(out, 99); -} diff --git a/src/test/ui/run-pass/issues/issue-16774.rs b/src/test/ui/run-pass/issues/issue-16774.rs deleted file mode 100644 index dbaa6c30f45..00000000000 --- a/src/test/ui/run-pass/issues/issue-16774.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] -#![feature(box_patterns)] - -use std::ops::{Deref, DerefMut}; - -struct X(Box); - -static mut DESTRUCTOR_RAN: bool = false; - -impl Drop for X { - fn drop(&mut self) { - unsafe { - assert!(!DESTRUCTOR_RAN); - DESTRUCTOR_RAN = true; - } - } -} - -impl Deref for X { - type Target = isize; - - fn deref(&self) -> &isize { - let &X(box ref x) = self; - x - } -} - -impl DerefMut for X { - fn deref_mut(&mut self) -> &mut isize { - let &mut X(box ref mut x) = self; - x - } -} - -fn main() { - { - let mut test = X(box 5); - { - let mut change = || { *test = 10 }; - change(); - } - assert_eq!(*test, 10); - } - assert!(unsafe { DESTRUCTOR_RAN }); -} diff --git a/src/test/ui/run-pass/issues/issue-16783.rs b/src/test/ui/run-pass/issues/issue-16783.rs deleted file mode 100644 index bafeb9716c5..00000000000 --- a/src/test/ui/run-pass/issues/issue-16783.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let x = [1, 2, 3]; - let y = x; -} diff --git a/src/test/ui/run-pass/issues/issue-16819.rs b/src/test/ui/run-pass/issues/issue-16819.rs deleted file mode 100644 index 498abc1c733..00000000000 --- a/src/test/ui/run-pass/issues/issue-16819.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// `#[cfg]` on struct field permits empty unusable struct - -struct S { - #[cfg(untrue)] - a: int, -} - -fn main() { - let s = S {}; -} diff --git a/src/test/ui/run-pass/issues/issue-16922.rs b/src/test/ui/run-pass/issues/issue-16922.rs deleted file mode 100644 index 8eb066e6f00..00000000000 --- a/src/test/ui/run-pass/issues/issue-16922.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::any::Any; - -fn foo(_: &u8) { -} - -fn main() { - let _ = &foo as &Any; -} diff --git a/src/test/ui/run-pass/issues/issue-1696.rs b/src/test/ui/run-pass/issues/issue-1696.rs deleted file mode 100644 index d205bed7226..00000000000 --- a/src/test/ui/run-pass/issues/issue-1696.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::HashMap; - -pub fn main() { - let mut m = HashMap::new(); - m.insert(b"foo".to_vec(), b"bar".to_vec()); - println!("{:?}", m); -} diff --git a/src/test/ui/run-pass/issues/issue-1701.rs b/src/test/ui/run-pass/issues/issue-1701.rs deleted file mode 100644 index 433fd4c1af3..00000000000 --- a/src/test/ui/run-pass/issues/issue-1701.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -enum pattern { tabby, tortoiseshell, calico } -enum breed { beagle, rottweiler, pug } -type name = String; -enum ear_kind { lop, upright } -enum animal { cat(pattern), dog(breed), rabbit(name, ear_kind), tiger } - -fn noise(a: animal) -> Option { - match a { - animal::cat(..) => { Some("meow".to_string()) } - animal::dog(..) => { Some("woof".to_string()) } - animal::rabbit(..) => { None } - animal::tiger => { Some("roar".to_string()) } - } -} - -pub fn main() { - assert_eq!(noise(animal::cat(pattern::tabby)), Some("meow".to_string())); - assert_eq!(noise(animal::dog(breed::pug)), Some("woof".to_string())); - assert_eq!(noise(animal::rabbit("Hilbert".to_string(), ear_kind::upright)), None); - assert_eq!(noise(animal::tiger), Some("roar".to_string())); -} diff --git a/src/test/ui/run-pass/issues/issue-17068.rs b/src/test/ui/run-pass/issues/issue-17068.rs deleted file mode 100644 index ece2284d3c5..00000000000 --- a/src/test/ui/run-pass/issues/issue-17068.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that regionck creates the right region links in the pattern -// binding of a for loop - -fn foo<'a>(v: &'a [usize]) -> &'a usize { - for &ref x in v { return x; } - unreachable!() -} - -fn main() { - assert_eq!(foo(&[0]), &0); -} diff --git a/src/test/ui/run-pass/issues/issue-17074.rs b/src/test/ui/run-pass/issues/issue-17074.rs deleted file mode 100644 index 063cf7b0a03..00000000000 --- a/src/test/ui/run-pass/issues/issue-17074.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -static X2: u64 = !0 as u16 as u64; -static Y2: u64 = !0 as u32 as u64; -const X: u64 = !0 as u16 as u64; -const Y: u64 = !0 as u32 as u64; - -fn main() { - assert_eq!(match 1 { - X => unreachable!(), - Y => unreachable!(), - _ => 1 - }, 1); -} diff --git a/src/test/ui/run-pass/issues/issue-17121.rs b/src/test/ui/run-pass/issues/issue-17121.rs deleted file mode 100644 index 8da01966959..00000000000 --- a/src/test/ui/run-pass/issues/issue-17121.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -// ignore-cloudabi no std::fs - -use std::fs::File; -use std::io::{self, BufReader, Read}; - -struct Lexer -{ - reader: BufReader, -} - -impl Lexer -{ - pub fn new_from_reader(r: R) -> Lexer - { - Lexer{reader: BufReader::new(r)} - } - - pub fn new_from_file(p: &str) -> io::Result> - { - Ok(Lexer::new_from_reader(File::open(p)?)) - } - - pub fn new_from_str<'a>(s: &'a str) -> Lexer<&'a [u8]> - { - Lexer::new_from_reader(s.as_bytes()) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-17170.rs b/src/test/ui/run-pass/issues/issue-17170.rs deleted file mode 100644 index f876f1e1463..00000000000 --- a/src/test/ui/run-pass/issues/issue-17170.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(repr_simd)] - -#[repr(simd)] -struct T(f64, f64, f64); - -static X: T = T(0.0, 0.0, 0.0); - -fn main() { - let _ = X; -} diff --git a/src/test/ui/run-pass/issues/issue-17216.rs b/src/test/ui/run-pass/issues/issue-17216.rs deleted file mode 100644 index dc2848cc190..00000000000 --- a/src/test/ui/run-pass/issues/issue-17216.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Leak<'a> { - dropped: &'a mut bool -} - -impl<'a> Drop for Leak<'a> { - fn drop(&mut self) { - *self.dropped = true; - } -} - -fn main() { - let mut dropped = false; - { - let leak = Leak { dropped: &mut dropped }; - for ((), leaked) in Some(((), leak)).into_iter() {} - } - - assert!(dropped); -} diff --git a/src/test/ui/run-pass/issues/issue-17233.rs b/src/test/ui/run-pass/issues/issue-17233.rs deleted file mode 100644 index 15571d563b2..00000000000 --- a/src/test/ui/run-pass/issues/issue-17233.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const X1: &'static [u8] = &[b'1']; -const X2: &'static [u8] = b"1"; -const X3: &'static [u8; 1] = &[b'1']; -const X4: &'static [u8; 1] = b"1"; - -static Y1: u8 = X1[0]; -static Y2: u8 = X2[0]; -static Y3: u8 = X3[0]; -static Y4: u8 = X4[0]; - -fn main() { - assert_eq!(Y1, Y2); - assert_eq!(Y1, Y3); - assert_eq!(Y1, Y4); -} diff --git a/src/test/ui/run-pass/issues/issue-17302.rs b/src/test/ui/run-pass/issues/issue-17302.rs deleted file mode 100644 index 708257de0b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-17302.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -static mut DROPPED: [bool; 2] = [false, false]; - -struct A(usize); -struct Foo { _a: A, _b: isize } - -impl Drop for A { - fn drop(&mut self) { - let A(i) = *self; - unsafe { DROPPED[i] = true; } - } -} - -fn main() { - { - Foo { - _a: A(0), - ..Foo { _a: A(1), _b: 2 } - }; - } - unsafe { - assert!(DROPPED[0]); - assert!(DROPPED[1]); - } -} diff --git a/src/test/ui/run-pass/issues/issue-17322.rs b/src/test/ui/run-pass/issues/issue-17322.rs deleted file mode 100644 index dc17f02ab62..00000000000 --- a/src/test/ui/run-pass/issues/issue-17322.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -use std::io::{self, Write}; - -fn f(wr: &mut Write) { - wr.write_all(b"hello").ok().expect("failed"); -} - -fn main() { - let mut wr = box io::stdout() as Box; - f(&mut wr); -} diff --git a/src/test/ui/run-pass/issues/issue-17336.rs b/src/test/ui/run-pass/issues/issue-17336.rs deleted file mode 100644 index aea2b67a92f..00000000000 --- a/src/test/ui/run-pass/issues/issue-17336.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[allow(dead_code)] -fn check(a: &str) { - let x = a as *const str; - x == x; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-17351.rs b/src/test/ui/run-pass/issues/issue-17351.rs deleted file mode 100644 index 69c015ae3e8..00000000000 --- a/src/test/ui/run-pass/issues/issue-17351.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Str { fn foo(&self) {} } -impl Str for str {} -impl<'a, S: ?Sized> Str for &'a S where S: Str {} - -fn main() { - let _: &Str = &"x"; -} diff --git a/src/test/ui/run-pass/issues/issue-17361.rs b/src/test/ui/run-pass/issues/issue-17361.rs deleted file mode 100644 index 9e478a39b82..00000000000 --- a/src/test/ui/run-pass/issues/issue-17361.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that astconv doesn't forget about mutability of &mut str - -// pretty-expanded FIXME #23616 - -fn main() { - fn foo(_: &mut T) {} - let _f: fn(&mut str) = foo; -} diff --git a/src/test/ui/run-pass/issues/issue-17450.rs b/src/test/ui/run-pass/issues/issue-17450.rs deleted file mode 100644 index 67a44951ae0..00000000000 --- a/src/test/ui/run-pass/issues/issue-17450.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code, warnings)] - -static mut x: isize = 3; -static mut y: isize = unsafe { x }; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-17503.rs b/src/test/ui/run-pass/issues/issue-17503.rs deleted file mode 100644 index 909098e3982..00000000000 --- a/src/test/ui/run-pass/issues/issue-17503.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let s: &[isize] = &[0, 1, 2, 3, 4]; - let ss: &&[isize] = &s; - let sss: &&&[isize] = &ss; - - println!("{:?}", &s[..3]); - println!("{:?}", &ss[3..]); - println!("{:?}", &sss[2..4]); -} diff --git a/src/test/ui/run-pass/issues/issue-17662.rs b/src/test/ui/run-pass/issues/issue-17662.rs deleted file mode 100644 index 10ee3ce1741..00000000000 --- a/src/test/ui/run-pass/issues/issue-17662.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-17662.rs - - -extern crate issue_17662 as i; - -use std::marker; - -struct Bar<'a> { m: marker::PhantomData<&'a ()> } - -impl<'a> i::Foo<'a, usize> for Bar<'a> { - fn foo(&self) -> usize { 5 } -} - -pub fn main() { - assert_eq!(i::foo(&Bar { m: marker::PhantomData }), 5); -} diff --git a/src/test/ui/run-pass/issues/issue-17718-borrow-interior.rs b/src/test/ui/run-pass/issues/issue-17718-borrow-interior.rs deleted file mode 100644 index 505aefdd1c7..00000000000 --- a/src/test/ui/run-pass/issues/issue-17718-borrow-interior.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S { a: usize } - -static A: S = S { a: 3 }; -static B: &'static usize = &A.a; -static C: &'static usize = &(A.a); - -static D: [usize; 1] = [1]; -static E: usize = D[0]; -static F: &'static usize = &D[0]; - -fn main() { - assert_eq!(*B, A.a); - assert_eq!(*B, A.a); - - assert_eq!(E, D[0]); - assert_eq!(*F, D[0]); -} diff --git a/src/test/ui/run-pass/issues/issue-17718-const-destructors.rs b/src/test/ui/run-pass/issues/issue-17718-const-destructors.rs deleted file mode 100644 index 6f8fbbd9f78..00000000000 --- a/src/test/ui/run-pass/issues/issue-17718-const-destructors.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct A; -impl Drop for A { - fn drop(&mut self) {} -} - -const FOO: A = A; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-17718-parse-const.rs b/src/test/ui/run-pass/issues/issue-17718-parse-const.rs deleted file mode 100644 index e9925252540..00000000000 --- a/src/test/ui/run-pass/issues/issue-17718-parse-const.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const FOO: usize = 3; - -fn main() { - assert_eq!(FOO, 3); -} diff --git a/src/test/ui/run-pass/issues/issue-17718-static-unsafe-interior.rs b/src/test/ui/run-pass/issues/issue-17718-static-unsafe-interior.rs deleted file mode 100644 index 2ac6a901358..00000000000 --- a/src/test/ui/run-pass/issues/issue-17718-static-unsafe-interior.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::marker; -use std::cell::UnsafeCell; - -struct MyUnsafePack(UnsafeCell); - -unsafe impl Sync for MyUnsafePack {} - -struct MyUnsafe { - value: MyUnsafePack -} - -impl MyUnsafe { - fn forbidden(&self) {} -} - -unsafe impl Sync for MyUnsafe {} - -enum UnsafeEnum { - VariantSafe, - VariantUnsafe(UnsafeCell) -} - -unsafe impl Sync for UnsafeEnum {} - -static STATIC1: UnsafeEnum = UnsafeEnum::VariantSafe; - -static STATIC2: MyUnsafePack = MyUnsafePack(UnsafeCell::new(1)); -const CONST: MyUnsafePack = MyUnsafePack(UnsafeCell::new(1)); -static STATIC3: MyUnsafe = MyUnsafe{value: CONST}; - -static STATIC4: &'static MyUnsafePack = &STATIC2; - -struct Wrap { - value: T -} - -unsafe impl Sync for Wrap {} - -static UNSAFE: MyUnsafePack = MyUnsafePack(UnsafeCell::new(2)); -static WRAPPED_UNSAFE: Wrap<&'static MyUnsafePack> = Wrap { value: &UNSAFE }; - -fn main() { - let a = &STATIC1; - - STATIC3.forbidden() -} diff --git a/src/test/ui/run-pass/issues/issue-17718.rs b/src/test/ui/run-pass/issues/issue-17718.rs deleted file mode 100644 index c332d0b586d..00000000000 --- a/src/test/ui/run-pass/issues/issue-17718.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-17718-aux.rs - -extern crate issue_17718_aux as other; - -use std::sync::atomic::{AtomicUsize, Ordering}; - -const C1: usize = 1; -const C2: AtomicUsize = AtomicUsize::new(0); -const C3: fn() = foo; -const C4: usize = C1 * C1 + C1 / C1; -const C5: &'static usize = &C4; -const C6: usize = { - const C: usize = 3; - C -}; - -static S1: usize = 3; -static S2: AtomicUsize = AtomicUsize::new(0); - -mod test { - static A: usize = 4; - static B: &'static usize = &A; - static C: &'static usize = &(A); -} - -fn foo() {} - -fn main() { - assert_eq!(C1, 1); - assert_eq!(C3(), ()); - assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0); - assert_eq!(C2.fetch_add(1, Ordering::SeqCst), 0); - assert_eq!(C4, 2); - assert_eq!(*C5, 2); - assert_eq!(C6, 3); - assert_eq!(S1, 3); - assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 0); - assert_eq!(S2.fetch_add(1, Ordering::SeqCst), 1); - - match 1 { - C1 => {} - _ => unreachable!(), - } - - let _a = C1; - let _a = C2; - let _a = C3; - let _a = C4; - let _a = C5; - let _a = C6; - let _a = S1; - - assert_eq!(other::C1, 1); - assert_eq!(other::C3(), ()); - assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0); - assert_eq!(other::C2.fetch_add(1, Ordering::SeqCst), 0); - assert_eq!(other::C4, 2); - assert_eq!(*other::C5, 2); - assert_eq!(other::S1, 3); - assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 0); - assert_eq!(other::S2.fetch_add(1, Ordering::SeqCst), 1); - - let _a = other::C1; - let _a = other::C2; - let _a = other::C3; - let _a = other::C4; - let _a = other::C5; - - match 1 { - other::C1 => {} - _ => unreachable!(), - } -} diff --git a/src/test/ui/run-pass/issues/issue-17732.rs b/src/test/ui/run-pass/issues/issue-17732.rs deleted file mode 100644 index e69d8fabe86..00000000000 --- a/src/test/ui/run-pass/issues/issue-17732.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Person { - type string; - fn dummy(&self) { } -} - -struct Someone(std::marker::PhantomData

); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-17734.rs b/src/test/ui/run-pass/issues/issue-17734.rs deleted file mode 100644 index e52337667c8..00000000000 --- a/src/test/ui/run-pass/issues/issue-17734.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that generating drop glue for Box doesn't ICE - - -fn f(s: Box) -> Box { - s -} - -fn main() { - // There is currently no safe way to construct a `Box`, so improvise - let box_arr: Box<[u8]> = Box::new(['h' as u8, 'e' as u8, 'l' as u8, 'l' as u8, 'o' as u8]); - let box_str: Box = unsafe { std::mem::transmute(box_arr) }; - assert_eq!(&*box_str, "hello"); - f(box_str); -} diff --git a/src/test/ui/run-pass/issues/issue-17746.rs b/src/test/ui/run-pass/issues/issue-17746.rs deleted file mode 100644 index 7e88068419e..00000000000 --- a/src/test/ui/run-pass/issues/issue-17746.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #17746 - -fn main() {} - -struct A; - -impl A { - fn b(&mut self) { - self.a() - } -} - -trait Foo { - fn dummy(&self) {} -} -trait Bar { - fn a(&self); -} - -impl Foo for A {} -impl Bar for T where T: Foo { - fn a(&self) {} -} diff --git a/src/test/ui/run-pass/issues/issue-17756.rs b/src/test/ui/run-pass/issues/issue-17756.rs deleted file mode 100644 index 8c3f6b93588..00000000000 --- a/src/test/ui/run-pass/issues/issue-17756.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -const count : usize = 2 as usize; -fn main() { - let larger : [usize; count*2]; -} diff --git a/src/test/ui/run-pass/issues/issue-17771.rs b/src/test/ui/run-pass/issues/issue-17771.rs deleted file mode 100644 index ccea8846b08..00000000000 --- a/src/test/ui/run-pass/issues/issue-17771.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Aaa { fn dummy(&self) { } } - -impl<'a> Aaa for &'a mut (Aaa + 'a) {} - -struct Bar<'a> { - writer: &'a mut (Aaa + 'a), -} - -fn baz(_: &mut Aaa) { -} - -fn foo<'a>(mut bar: Bar<'a>) { - baz(&mut bar.writer); -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-17816.rs b/src/test/ui/run-pass/issues/issue-17816.rs deleted file mode 100644 index 0f96035b274..00000000000 --- a/src/test/ui/run-pass/issues/issue-17816.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::marker::PhantomData; - -fn main() { - struct Symbol<'a, F: Fn(Vec<&'a str>) -> &'a str> { function: F, marker: PhantomData<&'a ()> } - let f = |x: Vec<&str>| -> &str { "foobar" }; - let sym = Symbol { function: f, marker: PhantomData }; - (sym.function)(vec![]); -} diff --git a/src/test/ui/run-pass/issues/issue-17877.rs b/src/test/ui/run-pass/issues/issue-17877.rs deleted file mode 100644 index 4dee51c4289..00000000000 --- a/src/test/ui/run-pass/issues/issue-17877.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn main() { - assert_eq!(match [0u8; 1024] { - _ => 42_usize, - }, 42_usize); - - assert_eq!(match [0u8; 1024] { - [1, _..] => 0_usize, - [0, _..] => 1_usize, - _ => 2_usize - }, 1_usize); -} diff --git a/src/test/ui/run-pass/issues/issue-17897.rs b/src/test/ui/run-pass/issues/issue-17897.rs deleted file mode 100644 index e543606c9c9..00000000000 --- a/src/test/ui/run-pass/issues/issue-17897.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn action(mut cb: Box usize>) -> usize { - cb(1) -} - -pub fn main() { - println!("num: {}", action(Box::new(move |u| u))); -} diff --git a/src/test/ui/run-pass/issues/issue-17904.rs b/src/test/ui/run-pass/issues/issue-17904.rs deleted file mode 100644 index 2a86611a196..00000000000 --- a/src/test/ui/run-pass/issues/issue-17904.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can parse where clauses on various forms of tuple -// structs. - -// pretty-expanded FIXME #23616 - -struct Bar(T) where T: Copy; -struct Bleh(T, U) where T: Copy, U: Sized; -struct Baz where T: Copy { - field: T -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18060.rs b/src/test/ui/run-pass/issues/issue-18060.rs deleted file mode 100644 index 2714de4b59f..00000000000 --- a/src/test/ui/run-pass/issues/issue-18060.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #18060: match arms were matching in the wrong order. - -fn main() { - assert_eq!(2, match (1, 3) { (0, 2..=5) => 1, (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); - assert_eq!(2, match (1, 3) { (1, 3) => 2, (_, 2..=5) => 3, (_, _) => 4 }); - assert_eq!(2, match (1, 7) { (0, 2..=5) => 1, (1, 7) => 2, (_, 2..=5) => 3, (_, _) => 4 }); -} diff --git a/src/test/ui/run-pass/issues/issue-18075.rs b/src/test/ui/run-pass/issues/issue-18075.rs deleted file mode 100644 index edf923fbaf2..00000000000 --- a/src/test/ui/run-pass/issues/issue-18075.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// exec-env:RUST_LOG=rustc::middle=debug - -fn main() { - let b = 1isize; - println!("{}", b); -} diff --git a/src/test/ui/run-pass/issues/issue-18083.rs b/src/test/ui/run-pass/issues/issue-18083.rs deleted file mode 100644 index 152cba82222..00000000000 --- a/src/test/ui/run-pass/issues/issue-18083.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// These crossed imports should resolve fine, and not block on -// each other and be reported as unresolved. - -mod a { - use b::{B}; - pub use self::inner::A; - - mod inner { - pub struct A; - } -} - -mod b { - use a::{A}; - pub use self::inner::B; - - mod inner { - pub struct B; - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18088.rs b/src/test/ui/run-pass/issues/issue-18088.rs deleted file mode 100644 index cff5ba70128..00000000000 --- a/src/test/ui/run-pass/issues/issue-18088.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub trait Indexable: std::ops::Index { - fn index2(&self, i: usize) -> &T { - &self[i] - } -} -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18110.rs b/src/test/ui/run-pass/issues/issue-18110.rs deleted file mode 100644 index d6733050216..00000000000 --- a/src/test/ui/run-pass/issues/issue-18110.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - ({return},); -} diff --git a/src/test/ui/run-pass/issues/issue-18173.rs b/src/test/ui/run-pass/issues/issue-18173.rs deleted file mode 100644 index eb29de18ac9..00000000000 --- a/src/test/ui/run-pass/issues/issue-18173.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - type T; -} - -// should be able to use a trait with an associated type without specifying it as an argument -trait Bar { - fn bar(foo: &F); -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-18188.rs b/src/test/ui/run-pass/issues/issue-18188.rs deleted file mode 100644 index 60d8edc9d59..00000000000 --- a/src/test/ui/run-pass/issues/issue-18188.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait Promisable: Send + Sync {} -impl Promisable for T {} - -pub fn propagate<'a, T, E, F, G>(mut action: F) - -> Box) -> Result + 'a> - where - T: Promisable + Clone + 'a, - E: Promisable + Clone + 'a, - F: FnMut(&T) -> Result + Send + 'a, - G: FnMut(Result) -> Result + 'a { - Box::new(move |result: Result| { - match result { - Ok(ref t) => action(t), - Err(ref e) => Err(e.clone()), - } - }) -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-1821.rs b/src/test/ui/run-pass/issues/issue-1821.rs deleted file mode 100644 index 27c225a1916..00000000000 --- a/src/test/ui/run-pass/issues/issue-1821.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Issue #1821 - Don't recurse trying to typecheck this - - -// pretty-expanded FIXME #23616 - -enum t { - foo(Vec) -} -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18232.rs b/src/test/ui/run-pass/issues/issue-18232.rs deleted file mode 100644 index 61b7306e9df..00000000000 --- a/src/test/ui/run-pass/issues/issue-18232.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Cursor<'a>(::std::marker::PhantomData<&'a ()>); - -trait CursorNavigator { - fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; -} - -struct SimpleNavigator; - -impl CursorNavigator for SimpleNavigator { - fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool { - false - } -} - -fn main() { - let mut c = Cursor(::std::marker::PhantomData); - let n = SimpleNavigator; - n.init_cursor(&mut c); -} diff --git a/src/test/ui/run-pass/issues/issue-18352.rs b/src/test/ui/run-pass/issues/issue-18352.rs deleted file mode 100644 index 802e918e954..00000000000 --- a/src/test/ui/run-pass/issues/issue-18352.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -const X: &'static str = "12345"; - -fn test(s: String) -> bool { - match &*s { - X => true, - _ => false - } -} - -fn main() { - assert!(test("12345".to_string())); -} diff --git a/src/test/ui/run-pass/issues/issue-18353.rs b/src/test/ui/run-pass/issues/issue-18353.rs deleted file mode 100644 index 279ee89a492..00000000000 --- a/src/test/ui/run-pass/issues/issue-18353.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that wrapping an unsized struct in an enum which gets optimised does -// not ICE. - -// pretty-expanded FIXME #23616 - -struct Str { - f: [u8] -} - -fn main() { - let str: Option<&Str> = None; - str.is_some(); -} diff --git a/src/test/ui/run-pass/issues/issue-18412.rs b/src/test/ui/run-pass/issues/issue-18412.rs deleted file mode 100644 index 3d1a66877ed..00000000000 --- a/src/test/ui/run-pass/issues/issue-18412.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that non-static methods can be assigned to local variables as -// function pointers. - - -trait Foo { - fn foo(&self) -> usize; -} - -struct A(usize); - -impl A { - fn bar(&self) -> usize { self.0 } -} - -impl Foo for A { - fn foo(&self) -> usize { self.bar() } -} - -fn main() { - let f = A::bar; - let g = Foo::foo; - let a = A(42); - - assert_eq!(f(&a), g(&a)); -} diff --git a/src/test/ui/run-pass/issues/issue-18425.rs b/src/test/ui/run-pass/issues/issue-18425.rs deleted file mode 100644 index 615dc8b4f3c..00000000000 --- a/src/test/ui/run-pass/issues/issue-18425.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that codegen doesn't ICE when codegenning an array repeat -// expression with a count of 1 and a non-Copy element type. - -// pretty-expanded FIXME #23616 - -fn main() { - let _ = [Box::new(1_usize); 1]; -} diff --git a/src/test/ui/run-pass/issues/issue-18446.rs b/src/test/ui/run-pass/issues/issue-18446.rs deleted file mode 100644 index 0758ceb0954..00000000000 --- a/src/test/ui/run-pass/issues/issue-18446.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that methods in trait impls should override default methods. - -trait T { - fn foo(&self) -> i32 { 0 } -} - -impl<'a> T + 'a { - fn foo(&self) -> i32 { 1 } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18464.rs b/src/test/ui/run-pass/issues/issue-18464.rs deleted file mode 100644 index 64536e993c5..00000000000 --- a/src/test/ui/run-pass/issues/issue-18464.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(dead_code)] - -const LOW_RANGE: char = '0'; -const HIGH_RANGE: char = '9'; - -fn main() { - match '5' { - LOW_RANGE..=HIGH_RANGE => (), - _ => () - }; -} diff --git a/src/test/ui/run-pass/issues/issue-18501.rs b/src/test/ui/run-pass/issues/issue-18501.rs deleted file mode 100644 index 2a82b1ab81d..00000000000 --- a/src/test/ui/run-pass/issues/issue-18501.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we don't ICE when inlining a function from another -// crate that uses a trait method as a value due to incorrectly -// translating the def ID of the trait during AST decoding. - -// aux-build:issue-18501.rs -// pretty-expanded FIXME #23616 - -extern crate issue_18501 as issue; - -fn main() { - issue::pass_method(); -} diff --git a/src/test/ui/run-pass/issues/issue-18514.rs b/src/test/ui/run-pass/issues/issue-18514.rs deleted file mode 100644 index 6a59b74bd06..00000000000 --- a/src/test/ui/run-pass/issues/issue-18514.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we don't ICE when codegenning a generic impl method from -// an extern crate that contains a match expression on a local -// variable place where one of the match case bodies contains an -// expression that autoderefs through an overloaded generic deref -// impl. - -// aux-build:issue-18514.rs - -extern crate issue_18514 as ice; -use ice::{Tr, St}; - -fn main() { - let st: St<()> = St(vec![]); - st.tr(); -} diff --git a/src/test/ui/run-pass/issues/issue-18539.rs b/src/test/ui/run-pass/issues/issue-18539.rs deleted file mode 100644 index a3211845d58..00000000000 --- a/src/test/ui/run-pass/issues/issue-18539.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that coercing bare fn's that return a zero sized type to -// a closure doesn't cause an LLVM ERROR - -// pretty-expanded FIXME #23616 - -struct Foo; - -fn uint_to_foo(_: usize) -> Foo { - Foo -} - -#[allow(unused_must_use)] -fn main() { - (0..10).map(uint_to_foo); -} diff --git a/src/test/ui/run-pass/issues/issue-18652.rs b/src/test/ui/run-pass/issues/issue-18652.rs deleted file mode 100644 index 2c027dada87..00000000000 --- a/src/test/ui/run-pass/issues/issue-18652.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests multiple free variables being passed by value into an unboxed -// once closure as an optimization by codegen. This used to hit an -// incorrect assert. - -fn main() { - let x = 2u8; - let y = 3u8; - assert_eq!((move || x + y)(), 5); -} diff --git a/src/test/ui/run-pass/issues/issue-18655.rs b/src/test/ui/run-pass/issues/issue-18655.rs deleted file mode 100644 index 94638539f6e..00000000000 --- a/src/test/ui/run-pass/issues/issue-18655.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Factory { - type Product; - fn create(&self) -> ::Product; -} - -impl Factory for f64 { - type Product = f64; - fn create(&self) -> f64 { *self * *self } -} - -impl Factory for (A, B) { - type Product = (::Product, ::Product); - fn create(&self) -> (::Product, ::Product) { - let (ref a, ref b) = *self; - (a.create(), b.create()) - } -} - -fn main() { - assert_eq!((16., 25.), (4., 5.).create()); -} diff --git a/src/test/ui/run-pass/issues/issue-1866.rs b/src/test/ui/run-pass/issues/issue-1866.rs deleted file mode 100644 index cf4a0ddea98..00000000000 --- a/src/test/ui/run-pass/issues/issue-1866.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -mod a { - pub type rust_task = usize; - pub mod rustrt { - use super::rust_task; - extern { - pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; - } - } -} - -mod b { - pub type rust_task = bool; - pub mod rustrt { - use super::rust_task; - extern { - pub fn rust_task_is_unwinding(rt: *const rust_task) -> bool; - } - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-18661.rs b/src/test/ui/run-pass/issues/issue-18661.rs deleted file mode 100644 index 0b20cd45cf2..00000000000 --- a/src/test/ui/run-pass/issues/issue-18661.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that param substitutions from the correct environment are -// used when codegenning unboxed closure calls. - -// pretty-expanded FIXME #23616 - -pub fn inside(c: F) { - c(); -} - -// Use different number of type parameters and closure type to trigger -// an obvious ICE when param environments are mixed up -pub fn outside() { - inside(|| {}); -} - -fn main() { - outside::<(),()>(); -} diff --git a/src/test/ui/run-pass/issues/issue-18685.rs b/src/test/ui/run-pass/issues/issue-18685.rs deleted file mode 100644 index 98f59ed2ccd..00000000000 --- a/src/test/ui/run-pass/issues/issue-18685.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the self param space is not used in a conflicting -// manner by unboxed closures within a default method on a trait - -// pretty-expanded FIXME #23616 - -trait Tr { - fn foo(&self); - - fn bar(&self) { - (|| { self.foo() })() - } -} - -impl Tr for () { - fn foo(&self) {} -} - -fn main() { - ().bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-18711.rs b/src/test/ui/run-pass/issues/issue-18711.rs deleted file mode 100644 index 3c3b914e67a..00000000000 --- a/src/test/ui/run-pass/issues/issue-18711.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we don't panic on a RefCell borrow conflict in certain -// code paths involving unboxed closures. - -// pretty-expanded FIXME #23616 - -// aux-build:issue-18711.rs -extern crate issue_18711 as issue; - -fn main() { - (|| issue::inner(()))(); -} diff --git a/src/test/ui/run-pass/issues/issue-18738.rs b/src/test/ui/run-pass/issues/issue-18738.rs deleted file mode 100644 index f586552dcb3..00000000000 --- a/src/test/ui/run-pass/issues/issue-18738.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Eq, PartialEq, PartialOrd, Ord)] -enum Test<'a> { - Int(&'a isize), - Slice(&'a [u8]), -} - -#[derive(Eq, PartialEq, PartialOrd, Ord)] -struct Version { - vendor_info: &'static str -} - -#[derive(Eq, PartialEq, PartialOrd, Ord)] -struct Foo(&'static str); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18767.rs b/src/test/ui/run-pass/issues/issue-18767.rs deleted file mode 100644 index 3577850be2f..00000000000 --- a/src/test/ui/run-pass/issues/issue-18767.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that regionck uses the right memcat for patterns in for loops -// and doesn't ICE. - - -fn main() { - for &&x in Some(&0_usize).iter() { - assert_eq!(x, 0) - } -} diff --git a/src/test/ui/run-pass/issues/issue-18804/auxiliary/lib.rs b/src/test/ui/run-pass/issues/issue-18804/auxiliary/lib.rs deleted file mode 100644 index 06d454b2c89..00000000000 --- a/src/test/ui/run-pass/issues/issue-18804/auxiliary/lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "rlib"] -#![feature(linkage)] - -pub fn foo() -> *const() { - extern { - #[linkage = "extern_weak"] - static FOO: *const(); - } - unsafe { FOO } -} diff --git a/src/test/ui/run-pass/issues/issue-18804/main.rs b/src/test/ui/run-pass/issues/issue-18804/main.rs deleted file mode 100644 index a3a5337077c..00000000000 --- a/src/test/ui/run-pass/issues/issue-18804/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test for issue #18804, #[linkage] does not propagate thorugh generic -// functions. Failure results in a linker error. - -// ignore-asmjs no weak symbol support -// ignore-emscripten no weak symbol support - -// aux-build:lib.rs - -extern crate lib; - -fn main() { - lib::foo::(); -} diff --git a/src/test/ui/run-pass/issues/issue-18809.rs b/src/test/ui/run-pass/issues/issue-18809.rs deleted file mode 100644 index 1895b3bdfe4..00000000000 --- a/src/test/ui/run-pass/issues/issue-18809.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Tup { - type T0; - type T1; -} - -impl Tup for isize { - type T0 = f32; - type T1 = (); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18845.rs b/src/test/ui/run-pass/issues/issue-18845.rs deleted file mode 100644 index 1510c774b28..00000000000 --- a/src/test/ui/run-pass/issues/issue-18845.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This used to generate invalid IR in that even if we took the -// `false` branch we'd still try to free the Box from the other -// arm. This was due to treating `*Box::new(9)` as an rvalue datum -// instead of as a place. - -fn test(foo: bool) -> u8 { - match foo { - true => *Box::new(9), - false => 0 - } -} - -fn main() { - assert_eq!(9, test(true)); -} diff --git a/src/test/ui/run-pass/issues/issue-18859.rs b/src/test/ui/run-pass/issues/issue-18859.rs deleted file mode 100644 index 4c98cb2d02d..00000000000 --- a/src/test/ui/run-pass/issues/issue-18859.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod foo { - pub mod bar { - pub mod baz { - pub fn name() -> &'static str { - module_path!() - } - } - } -} - -fn main() { - assert_eq!(module_path!(), "issue_18859"); - assert_eq!(foo::bar::baz::name(), "issue_18859::foo::bar::baz"); -} diff --git a/src/test/ui/run-pass/issues/issue-18906.rs b/src/test/ui/run-pass/issues/issue-18906.rs deleted file mode 100644 index 08a39350c57..00000000000 --- a/src/test/ui/run-pass/issues/issue-18906.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait Borrow { - fn borrow(&self) -> &Borrowed; -} - -impl Borrow for T { - fn borrow(&self) -> &T { self } -} - -trait Foo { - fn foo(&self, other: &Self); -} - -fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { - q.foo(k.borrow()) -} - -struct MyTree(K); - -impl MyTree { - // This caused a failure in #18906 - fn bar(k: &K, q: &Q) where K: Borrow, Q: Foo { - q.foo(k.borrow()) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-18913.rs b/src/test/ui/run-pass/issues/issue-18913.rs deleted file mode 100644 index 57882648405..00000000000 --- a/src/test/ui/run-pass/issues/issue-18913.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-18913-1.rs -// aux-build:issue-18913-2.rs - -extern crate foo; - -fn main() { - assert_eq!(foo::foo(), 1); -} diff --git a/src/test/ui/run-pass/issues/issue-18937-1.rs b/src/test/ui/run-pass/issues/issue-18937-1.rs deleted file mode 100644 index bf6a33d69cc..00000000000 --- a/src/test/ui/run-pass/issues/issue-18937-1.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to type-check this example. In particular, -// knowing that `T: 'a` allows us to deduce that `[U]: 'a` (because -// when `T=[U]` it implies that `U: 'a`). -// -// Regr. test for live code we found in the wild when fixing #18937. - -pub trait Leak { - fn leak<'a>(self) -> &'a T where T: 'a; -} - -impl Leak<[U]> for Vec { - fn leak<'a>(mut self) -> &'a [U] where [U]: 'a { - let r: *mut [U] = &mut self[..]; - std::mem::forget(self); - unsafe { &mut *r } - } -} -fn main() { - println!("Hello, world!"); -} diff --git a/src/test/ui/run-pass/issues/issue-18988.rs b/src/test/ui/run-pass/issues/issue-18988.rs deleted file mode 100644 index 422a0f7d7d6..00000000000 --- a/src/test/ui/run-pass/issues/issue-18988.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Foo : Send { } - -pub struct MyFoo { - children: Vec>, -} - -impl Foo for MyFoo { } - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-19001.rs b/src/test/ui/run-pass/issues/issue-19001.rs deleted file mode 100644 index 4407cbf501e..00000000000 --- a/src/test/ui/run-pass/issues/issue-19001.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that we handle recursive arrays correctly in `type_of` - -struct Loopy { - ptr: *mut [Loopy; 1] -} - -fn main() { - let _t = Loopy { ptr: 0 as *mut _ }; -} diff --git a/src/test/ui/run-pass/issues/issue-19037.rs b/src/test/ui/run-pass/issues/issue-19037.rs deleted file mode 100644 index eb3c265617b..00000000000 --- a/src/test/ui/run-pass/issues/issue-19037.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Str([u8]); - -#[derive(Clone)] -struct CharSplits<'a, Sep> { - string: &'a Str, - sep: Sep, - allow_trailing_empty: bool, - only_ascii: bool, - finished: bool, -} - -fn clone(s: &Str) -> &Str { - Clone::clone(&s) -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19081.rs b/src/test/ui/run-pass/issues/issue-19081.rs deleted file mode 100644 index 56ceaaf9884..00000000000 --- a/src/test/ui/run-pass/issues/issue-19081.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Hasher { - type State; - - fn hash::State - >>(&self, value: &T) -> u64; -} - -pub trait Hash { - fn hash(&self, state: &mut S); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19097.rs b/src/test/ui/run-pass/issues/issue-19097.rs deleted file mode 100644 index d3415c34791..00000000000 --- a/src/test/ui/run-pass/issues/issue-19097.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// regression test for #19097 - -struct Foo(T); - -impl<'a, T> Foo<&'a T> { - fn foo(&self) {} -} -impl<'a, T> Foo<&'a mut T> { - fn foo(&self) {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19098.rs b/src/test/ui/run-pass/issues/issue-19098.rs deleted file mode 100644 index 5b114659ae9..00000000000 --- a/src/test/ui/run-pass/issues/issue-19098.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Handler { - fn handle(&self, _: &mut String); -} - -impl Handler for F where F: for<'a, 'b> Fn(&'a mut String) { - fn handle(&self, st: &mut String) { - self(st) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19102.rs b/src/test/ui/run-pass/issues/issue-19102.rs deleted file mode 100644 index eecc9db486e..00000000000 --- a/src/test/ui/run-pass/issues/issue-19102.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(unused_qualifications)] - -use self::A::B; - -#[derive(PartialEq)] -pub enum A { - B, -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19127.rs b/src/test/ui/run-pass/issues/issue-19127.rs deleted file mode 100644 index 3290b179864..00000000000 --- a/src/test/ui/run-pass/issues/issue-19127.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo T>(f: F) {} -fn id<'a>(input: &'a u8) -> &'a u8 { input } - -fn main() { - foo(id); -} diff --git a/src/test/ui/run-pass/issues/issue-19129-1.rs b/src/test/ui/run-pass/issues/issue-19129-1.rs deleted file mode 100644 index cdb23e627c9..00000000000 --- a/src/test/ui/run-pass/issues/issue-19129-1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Trait { - type Output; - - fn method() -> >::Output; -} - -impl Trait for () { - type Output = (); - - fn method() {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19129-2.rs b/src/test/ui/run-pass/issues/issue-19129-2.rs deleted file mode 100644 index 4999ee1287c..00000000000 --- a/src/test/ui/run-pass/issues/issue-19129-2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Trait { - type Output; - - fn method(&self, i: Input) -> bool { false } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19135.rs b/src/test/ui/run-pass/issues/issue-19135.rs deleted file mode 100644 index 8a5fdc3b775..00000000000 --- a/src/test/ui/run-pass/issues/issue-19135.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::marker::PhantomData; - -#[derive(Debug)] -struct LifetimeStruct<'a>(PhantomData<&'a ()>); - -fn main() { - takes_hrtb_closure(|lts| println!("{:?}", lts)); -} - -fn takes_hrtb_closureFnMut(LifetimeStruct<'a>)>(mut f: F) { - f(LifetimeStruct(PhantomData)); -} diff --git a/src/test/ui/run-pass/issues/issue-19244.rs b/src/test/ui/run-pass/issues/issue-19244.rs deleted file mode 100644 index 93cb0b9dd1f..00000000000 --- a/src/test/ui/run-pass/issues/issue-19244.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct MyStruct { field: usize } -struct Nested { nested: MyStruct } -struct Mix2 { nested: ((usize,),) } - -const STRUCT: MyStruct = MyStruct { field: 42 }; -const TUP: (usize,) = (43,); -const NESTED_S: Nested = Nested { nested: MyStruct { field: 5 } }; -const NESTED_T: ((usize,),) = ((4,),); -const MIX_1: ((Nested,),) = ((Nested { nested: MyStruct { field: 3 } },),); -const MIX_2: Mix2 = Mix2 { nested: ((2,),) }; -const INSTANT_1: usize = (MyStruct { field: 1 }).field; -const INSTANT_2: usize = (0,).0; - -fn main() { - let a = [0; STRUCT.field]; - let b = [0; TUP.0]; - let c = [0; NESTED_S.nested.field]; - let d = [0; (NESTED_T.0).0]; - let e = [0; (MIX_1.0).0.nested.field]; - let f = [0; (MIX_2.nested.0).0]; - let g = [0; INSTANT_1]; - let h = [0; INSTANT_2]; - - assert_eq!(a.len(), 42); - assert_eq!(b.len(), 43); - assert_eq!(c.len(), 5); - assert_eq!(d.len(), 4); - assert_eq!(e.len(), 3); - assert_eq!(f.len(), 2); - assert_eq!(g.len(), 1); - assert_eq!(h.len(), 0); -} diff --git a/src/test/ui/run-pass/issues/issue-19293.rs b/src/test/ui/run-pass/issues/issue-19293.rs deleted file mode 100644 index 5bb336eba91..00000000000 --- a/src/test/ui/run-pass/issues/issue-19293.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_19293.rs -// pretty-expanded FIXME #23616 - -extern crate issue_19293; -use issue_19293::{Foo, MyEnum}; - -fn main() { - MyEnum::Foo(Foo(5)); -} diff --git a/src/test/ui/run-pass/issues/issue-19340-1.rs b/src/test/ui/run-pass/issues/issue-19340-1.rs deleted file mode 100644 index 53531fcad87..00000000000 --- a/src/test/ui/run-pass/issues/issue-19340-1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-19340-1.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_19340_1 as lib; - -use lib::Homura; - -fn main() { - let homura = Homura::Madoka { name: "Kaname".to_string() }; - - match homura { - Homura::Madoka { name } => (), - }; -} diff --git a/src/test/ui/run-pass/issues/issue-19340-2.rs b/src/test/ui/run-pass/issues/issue-19340-2.rs deleted file mode 100644 index a1b68e87626..00000000000 --- a/src/test/ui/run-pass/issues/issue-19340-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Homura { - Madoka { - name: String, - age: u32, - }, -} - -fn main() { - let homura = Homura::Madoka { - name: "Akemi".to_string(), - age: 14, - }; - - match homura { - Homura::Madoka { - name, - age, - } => (), - }; -} diff --git a/src/test/ui/run-pass/issues/issue-19358.rs b/src/test/ui/run-pass/issues/issue-19358.rs deleted file mode 100644 index f58254496ff..00000000000 --- a/src/test/ui/run-pass/issues/issue-19358.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Trait { fn dummy(&self) { } } - -#[derive(Debug)] -struct Foo { - foo: T, -} - -#[derive(Debug)] -struct Bar where T: Trait { - bar: T, -} - -impl Trait for isize {} - -fn main() { - let a = Foo { foo: 12 }; - let b = Bar { bar: 12 }; - println!("{:?} {:?}", a, b); -} diff --git a/src/test/ui/run-pass/issues/issue-19367.rs b/src/test/ui/run-pass/issues/issue-19367.rs deleted file mode 100644 index dfcc0926d80..00000000000 --- a/src/test/ui/run-pass/issues/issue-19367.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S { - o: Option -} - -// Make sure we don't reuse the same alloca when matching -// on field of struct or tuple which we reassign in the match body. - -fn main() { - let mut a = (0, Some("right".to_string())); - let b = match a.1 { - Some(v) => { - a.1 = Some("wrong".to_string()); - v - } - None => String::new() - }; - println!("{}", b); - assert_eq!(b, "right"); - - - let mut s = S{ o: Some("right".to_string()) }; - let b = match s.o { - Some(v) => { - s.o = Some("wrong".to_string()); - v - } - None => String::new(), - }; - println!("{}", b); - assert_eq!(b, "right"); -} diff --git a/src/test/ui/run-pass/issues/issue-19398.rs b/src/test/ui/run-pass/issues/issue-19398.rs deleted file mode 100644 index dd2a796dba3..00000000000 --- a/src/test/ui/run-pass/issues/issue-19398.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait T { - unsafe extern "Rust" fn foo(&self); -} - -impl T for () { - unsafe extern "Rust" fn foo(&self) {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19404.rs b/src/test/ui/run-pass/issues/issue-19404.rs deleted file mode 100644 index 3a5ce65aef8..00000000000 --- a/src/test/ui/run-pass/issues/issue-19404.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::any::TypeId; -use std::rc::Rc; - -type Fp = Rc; - -struct Engine; - -trait Component: 'static {} -impl Component for Engine {} - -trait Env { - fn get_component_type_id(&self, type_id: TypeId) -> Option>; -} - -impl<'a> Env+'a { - fn get_component(&self) -> Option> { - let x = self.get_component_type_id(TypeId::of::()); - None - } -} - -trait Figment { - fn init(&mut self, env: &Env); -} - -struct MyFigment; - -impl Figment for MyFigment { - fn init(&mut self, env: &Env) { - let engine = env.get_component::(); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19479.rs b/src/test/ui/run-pass/issues/issue-19479.rs deleted file mode 100644 index 6326dfd8fe0..00000000000 --- a/src/test/ui/run-pass/issues/issue-19479.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Base { - fn dummy(&self) { } -} -trait AssocA { - type X: Base; - fn dummy(&self) { } -} -trait AssocB { - type Y: Base; - fn dummy(&self) { } -} -impl AssocB for T { - type Y = ::X; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19499.rs b/src/test/ui/run-pass/issues/issue-19499.rs deleted file mode 100644 index 5fb209b2dfe..00000000000 --- a/src/test/ui/run-pass/issues/issue-19499.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #19499. Due to incorrect caching of trait -// results for closures with upvars whose types were not fully -// computed, this rather bizarre little program (along with many more -// reasonable examples) let to ambiguity errors about not being able -// to infer sufficient type information. - -// pretty-expanded FIXME #23616 - -fn main() { - let n = 0; - let it = Some(1_usize).into_iter().inspect(|_| {n;}); -} diff --git a/src/test/ui/run-pass/issues/issue-19631.rs b/src/test/ui/run-pass/issues/issue-19631.rs deleted file mode 100644 index 12804983ee4..00000000000 --- a/src/test/ui/run-pass/issues/issue-19631.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait PoolManager { - type C; - fn dummy(&self) { } -} - -struct InnerPool { - manager: M, -} - -impl InnerPool where M: PoolManager {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19632.rs b/src/test/ui/run-pass/issues/issue-19632.rs deleted file mode 100644 index 801d5947f92..00000000000 --- a/src/test/ui/run-pass/issues/issue-19632.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait PoolManager { - type C; - fn dummy(&self) { } -} - -struct InnerPool { - manager: M, -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-1974.rs b/src/test/ui/run-pass/issues/issue-1974.rs deleted file mode 100644 index 016afcdd54d..00000000000 --- a/src/test/ui/run-pass/issues/issue-1974.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 1974 -// Don't double free the condition allocation -// pretty-expanded FIXME #23616 - -pub fn main() { - let s = "hej".to_string(); - while s != "".to_string() { - return; - } -} diff --git a/src/test/ui/run-pass/issues/issue-19811-escape-unicode.rs b/src/test/ui/run-pass/issues/issue-19811-escape-unicode.rs deleted file mode 100644 index 5b021f6ee54..00000000000 --- a/src/test/ui/run-pass/issues/issue-19811-escape-unicode.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let mut escaped = String::from(""); - for c in '\u{10401}'.escape_unicode() { - escaped.push(c); - } - assert_eq!("\\u{10401}", escaped); -} diff --git a/src/test/ui/run-pass/issues/issue-19850.rs b/src/test/ui/run-pass/issues/issue-19850.rs deleted file mode 100644 index fa837f57ede..00000000000 --- a/src/test/ui/run-pass/issues/issue-19850.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that `::Output` and `Self::Output` are accepted as type annotations in let -// bindings - -// pretty-expanded FIXME #23616 - -trait Int { - fn one() -> Self; - fn leading_zeros(self) -> usize; -} - -trait Foo { - type T : Int; - - fn test(&self) { - let r: ::T = Int::one(); - let r: Self::T = Int::one(); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-19982.rs b/src/test/ui/run-pass/issues/issue-19982.rs deleted file mode 100644 index 380cb3cac22..00000000000 --- a/src/test/ui/run-pass/issues/issue-19982.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(fn_traits, unboxed_closures)] - -#[allow(dead_code)] -struct Foo; - -impl<'a> Fn<(&'a (),)> for Foo { - extern "rust-call" fn call(&self, (_,): (&(),)) {} -} - -impl<'a> FnMut<(&'a (),)> for Foo { - extern "rust-call" fn call_mut(&mut self, (_,): (&(),)) {} -} - -impl<'a> FnOnce<(&'a (),)> for Foo { - type Output = (); - - extern "rust-call" fn call_once(self, (_,): (&(),)) {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20009.rs b/src/test/ui/run-pass/issues/issue-20009.rs deleted file mode 100644 index 604395b3dc7..00000000000 --- a/src/test/ui/run-pass/issues/issue-20009.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that associated types are `Sized` - -// pretty-expanded FIXME #23616 - -trait Trait { - type Output; - - fn is_sized(&self) -> Self::Output; - fn wasnt_sized(&self) -> Self::Output { loop {} } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20055-box-trait.rs b/src/test/ui/run-pass/issues/issue-20055-box-trait.rs deleted file mode 100644 index bd9da3a69c2..00000000000 --- a/src/test/ui/run-pass/issues/issue-20055-box-trait.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// See Issues #20055 and #21695. - -// We are checking here that the temporaries `Box<[i8, k]>`, for `k` -// in 1, 2, 3, 4, that are induced by the match expression are -// properly handled, in that only *one* will be initialized by -// whichever arm is run, and subsequently dropped at the end of the -// statement surrounding the `match`. - -trait Boo { - fn dummy(&self) { } -} - -impl Boo for [i8; 1] { } -impl Boo for [i8; 2] { } -impl Boo for [i8; 3] { } -impl Boo for [i8; 4] { } - -pub fn foo(box_1: fn () -> Box<[i8; 1]>, - box_2: fn () -> Box<[i8; 2]>, - box_3: fn () -> Box<[i8; 3]>, - box_4: fn () -> Box<[i8; 4]>, - ) { - println!("Hello World 1"); - let _: Box = match 3 { - 1 => box_1(), - 2 => box_2(), - 3 => box_3(), - _ => box_4(), - }; - println!("Hello World 2"); -} - -pub fn main() { - fn box_1() -> Box<[i8; 1]> { Box::new( [1; 1] ) } - fn box_2() -> Box<[i8; 2]> { Box::new( [1; 2] ) } - fn box_3() -> Box<[i8; 3]> { Box::new( [1; 3] ) } - fn box_4() -> Box<[i8; 4]> { Box::new( [1; 4] ) } - - foo(box_1, box_2, box_3, box_4); -} diff --git a/src/test/ui/run-pass/issues/issue-20055-box-unsized-array.rs b/src/test/ui/run-pass/issues/issue-20055-box-unsized-array.rs deleted file mode 100644 index 6af9741dc9b..00000000000 --- a/src/test/ui/run-pass/issues/issue-20055-box-unsized-array.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #2005: Check that boxed fixed-size arrays are properly -// accounted for (namely, only deallocated if they were actually -// created) when they appear as temporaries in unused arms of a match -// expression. - -pub fn foo(box_1: fn () -> Box<[i8; 1]>, - box_2: fn () -> Box<[i8; 20]>, - box_3: fn () -> Box<[i8; 300]>, - box_4: fn () -> Box<[i8; 4000]>, - ) { - println!("Hello World 1"); - let _: Box<[i8]> = match 3 { - 1 => box_1(), - 2 => box_2(), - 3 => box_3(), - _ => box_4(), - }; - println!("Hello World 2"); -} - -pub fn main() { - fn box_1() -> Box<[i8; 1]> { Box::new( [1] ) } - fn box_2() -> Box<[i8; 20]> { Box::new( [1; 20] ) } - fn box_3() -> Box<[i8; 300]> { Box::new( [1; 300] ) } - fn box_4() -> Box<[i8; 4000]> { Box::new( [1; 4000] ) } - - foo(box_1, box_2, box_3, box_4); -} diff --git a/src/test/ui/run-pass/issues/issue-20091.rs b/src/test/ui/run-pass/issues/issue-20091.rs deleted file mode 100644 index 46d11b9d9b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-20091.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// ignore-cloudabi no processes -// ignore-emscripten no processes - -#![feature(os)] - -#[cfg(unix)] -fn main() { - use std::process::Command; - use std::env; - use std::os::unix::prelude::*; - use std::ffi::OsStr; - - if env::args().len() == 1 { - assert!(Command::new(&env::current_exe().unwrap()) - .arg(::from_bytes(b"\xff")) - .status().unwrap().success()) - } -} - -#[cfg(windows)] -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20174.rs b/src/test/ui/run-pass/issues/issue-20174.rs deleted file mode 100644 index 57e7193363e..00000000000 --- a/src/test/ui/run-pass/issues/issue-20174.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct GradFn usize>(F); - -fn main() { - let GradFn(x_squared) : GradFn<_> = GradFn(|| -> usize { 2 }); - let _ = x_squared(); -} diff --git a/src/test/ui/run-pass/issues/issue-20186.rs b/src/test/ui/run-pass/issues/issue-20186.rs deleted file mode 100644 index 0f42d8b1caa..00000000000 --- a/src/test/ui/run-pass/issues/issue-20186.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo; - -impl Foo { - fn putc(&self, b: u8) { } - - fn puts(&self, s: &str) { - for byte in s.bytes() { - self.putc(byte) - } - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20313.rs b/src/test/ui/run-pass/issues/issue-20313.rs deleted file mode 100644 index 9e6561369b8..00000000000 --- a/src/test/ui/run-pass/issues/issue-20313.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(link_llvm_intrinsics)] - -extern { - #[link_name = "llvm.sqrt.f32"] - fn sqrt(x: f32) -> f32; -} - -fn main(){ -} diff --git a/src/test/ui/run-pass/issues/issue-20343.rs b/src/test/ui/run-pass/issues/issue-20343.rs deleted file mode 100644 index 62506e1c49d..00000000000 --- a/src/test/ui/run-pass/issues/issue-20343.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for Issue #20343. - -// pretty-expanded FIXME #23616 - -#![deny(dead_code)] - -struct B { b: u32 } -struct C; -struct D; - -trait T { fn dummy(&self, a: A) { } } -impl T for () {} - -impl B { - // test for unused code in arguments - fn foo(B { b }: B) -> u32 { b } - - // test for unused code in return type - fn bar() -> C { unsafe { ::std::mem::transmute(()) } } - - // test for unused code in generics - fn baz>() {} -} - -pub fn main() { - let b = B { b: 3 }; - B::foo(b); - B::bar(); - B::baz::<()>(); -} diff --git a/src/test/ui/run-pass/issues/issue-20389.rs b/src/test/ui/run-pass/issues/issue-20389.rs deleted file mode 100644 index 21cd3a55268..00000000000 --- a/src/test/ui/run-pass/issues/issue-20389.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_20389.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_20389; - -struct Foo; - -impl issue_20389::T for Foo { - type C = (); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20396.rs b/src/test/ui/run-pass/issues/issue-20396.rs deleted file mode 100644 index 6f0ce7ca2d4..00000000000 --- a/src/test/ui/run-pass/issues/issue-20396.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -trait Foo { - fn noop(&self, _: T); -} - -enum Bar { Bla(T) } - -struct Baz<'a> { - inner: for<'b> Foo> + 'a, -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20414.rs b/src/test/ui/run-pass/issues/issue-20414.rs deleted file mode 100644 index 2e2449933c0..00000000000 --- a/src/test/ui/run-pass/issues/issue-20414.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Trait { - fn method(self) -> isize; -} - -struct Wrapper { - field: T -} - -impl<'a, T> Trait for &'a Wrapper where &'a T: Trait { - fn method(self) -> isize { - let r: &'a T = &self.field; - Trait::method(r); // these should both work - r.method() - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20427.rs b/src/test/ui/run-pass/issues/issue-20427.rs deleted file mode 100644 index b03c489e252..00000000000 --- a/src/test/ui/run-pass/issues/issue-20427.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] -#![allow(non_camel_case_types)] - -// aux-build:i8.rs -// ignore-pretty issue #37201 - -extern crate i8; -use std::string as i16; -static i32: i32 = 0; -const i64: i64 = 0; -fn u8(f32: f32) {} -fn f(f64: f64) {} -enum u32 {} -struct u64; -trait bool {} - -mod char { - extern crate i8; - static i32_: i32 = 0; - const i64_: i64 = 0; - fn u8_(f32: f32) {} - fn f_(f64: f64_) {} - type u16_ = u16; - enum u32_ {} - struct u64_; - trait bool_ {} - mod char_ {} - - mod str { - use super::i8 as i8; - use super::i32_ as i32; - use super::i64_ as i64; - use super::u8_ as u8; - use super::f_ as f64; - use super::u16_ as u16; - use super::u32_ as u32; - use super::u64_ as u64; - use super::bool_ as bool; - use super::{bool_ as str}; - use super::char_ as char; - } -} - -trait isize_ { - type isize; -} - -fn usize<'usize>(usize: &'usize usize) -> &'usize usize { usize } - -mod reuse { - use std::mem::size_of; - - type u8 = u64; - use std::string::String as i16; - - pub fn check() { - assert_eq!(size_of::(), 8); - assert_eq!(size_of::<::u64>(), 0); - assert_eq!(size_of::(), 3 * size_of::<*const ()>()); - assert_eq!(size_of::(), 0); - } -} - -mod guard { - pub fn check() { - use std::u8; // bring module u8 in scope - fn f() -> u8 { // OK, resolves to primitive u8, not to std::u8 - u8::max_value() // OK, resolves to associated function ::max_value, - // not to non-existent std::u8::max_value - } - assert_eq!(f(), u8::MAX); // OK, resolves to std::u8::MAX - } -} - -fn main() { - let bool = true; - let _ = match bool { - str @ true => if str { i32 as i64 } else { i64 }, - false => i64, - }; - - reuse::check::(); - guard::check(); -} diff --git a/src/test/ui/run-pass/issues/issue-20454.rs b/src/test/ui/run-pass/issues/issue-20454.rs deleted file mode 100644 index 41cc94909a0..00000000000 --- a/src/test/ui/run-pass/issues/issue-20454.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::thread; - -fn _foo() { - thread::spawn(move || { // no need for -> () - loop { - println!("hello"); - } - }).join(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20544.rs b/src/test/ui/run-pass/issues/issue-20544.rs deleted file mode 100644 index 1a6e647e625..00000000000 --- a/src/test/ui/run-pass/issues/issue-20544.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(unboxed_closures)] -#![feature(fn_traits)] - -struct Fun(F); - -impl FnOnce<(T,)> for Fun where F: Fn(T) -> T { - type Output = T; - - extern "rust-call" fn call_once(self, (t,): (T,)) -> T { - (self.0)(t) - } -} - -fn main() { - let fun = Fun(|i: isize| i * 2); - println!("{}", fun(3)); -} diff --git a/src/test/ui/run-pass/issues/issue-20575.rs b/src/test/ui/run-pass/issues/issue-20575.rs deleted file mode 100644 index 35551185807..00000000000 --- a/src/test/ui/run-pass/issues/issue-20575.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that overloaded calls work with zero arity closures - -// pretty-expanded FIXME #23616 - -fn main() { - let functions: [Box Option<()>>; 1] = [Box::new(|| None)]; - - let _: Option> = functions.iter().map(|f| (*f)()).collect(); -} diff --git a/src/test/ui/run-pass/issues/issue-20616.rs b/src/test/ui/run-pass/issues/issue-20616.rs deleted file mode 100644 index c28d2123669..00000000000 --- a/src/test/ui/run-pass/issues/issue-20616.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -type MyType<'a, T> = &'a T; - -// combine lifetime bounds and type arguments in usual way -type TypeA<'a> = MyType<'a, ()>; - -// ensure token `>>` works fine -type TypeB = Box>; -type TypeB_ = Box>; - -// trailing comma when combine lifetime bounds and type arguments -type TypeC<'a> = MyType<'a, (),>; - -// normal lifetime bounds -type TypeD = TypeA<'static>; - -// trailing comma on lifetime bounds -type TypeE = TypeA<'static,>; - -// normal type argument -type TypeF = Box; - -// type argument with trailing comma -type TypeG = Box; - -// trailing comma on lifetime defs -type TypeH<'a,> = &'a (); - -// trailing comma on type argument -type TypeI = T; - -static STATIC: () = (); - -fn main() { - - // ensure token `>=` works fine - let _: TypeA<'static>= &STATIC; - let _: TypeA<'static,>= &STATIC; - - // ensure token `>>=` works fine - let _: Box>= Box::new(&STATIC); - let _: Box>= Box::new(&STATIC); -} diff --git a/src/test/ui/run-pass/issues/issue-2063-resource.rs b/src/test/ui/run-pass/issues/issue-2063-resource.rs deleted file mode 100644 index 12e9b481dc1..00000000000 --- a/src/test/ui/run-pass/issues/issue-2063-resource.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// test that autoderef of a type like this does not -// cause compiler to loop. Note that no instances -// of such a type could ever be constructed. - -struct S { - x: X, - to_str: (), -} - -struct X(Box); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2063.rs b/src/test/ui/run-pass/issues/issue-2063.rs deleted file mode 100644 index 853c8bc6ec2..00000000000 --- a/src/test/ui/run-pass/issues/issue-2063.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// test that autoderef of a type like this does not -// cause compiler to loop. Note that no instances -// of such a type could ever be constructed. - -struct T(Box); - -trait ToStr2 { - fn my_to_string(&self) -> String; -} - -impl ToStr2 for T { - fn my_to_string(&self) -> String { "t".to_string() } -} - -#[allow(dead_code)] -fn new_t(x: T) { - x.my_to_string(); -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-20644.rs b/src/test/ui/run-pass/issues/issue-20644.rs deleted file mode 100644 index 728e2be3d23..00000000000 --- a/src/test/ui/run-pass/issues/issue-20644.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// A reduced version of the rustbook ice. The problem this encountered -// had to do with codegen ignoring binders. - -// pretty-expanded FIXME #23616 -// ignore-cloudabi no std::fs - -#![feature(os)] - -use std::iter; -use std::os; -use std::fs::File; -use std::io::prelude::*; -use std::env; -use std::path::Path; - -pub fn parse_summary(_: R, _: &Path) { - let path_from_root = Path::new(""); - Path::new(&iter::repeat("../") - .take(path_from_root.components().count() - 1) - .collect::()); - } - -fn foo() { - let cwd = env::current_dir().unwrap(); - let src = cwd.clone(); - let summary = File::open(&src.join("SUMMARY.md")).unwrap(); - let _ = parse_summary(summary, &src); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20676.rs b/src/test/ui/run-pass/issues/issue-20676.rs deleted file mode 100644 index ff7ea9eaae4..00000000000 --- a/src/test/ui/run-pass/issues/issue-20676.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #20676. Error was that we didn't support -// UFCS-style calls to a method in `Trait` where `Self` was bound to a -// trait object of type `Trait`. See also `ufcs-trait-object.rs`. - - -use std::fmt; - -fn main() { - let a: &fmt::Debug = &1; - format!("{:?}", a); -} diff --git a/src/test/ui/run-pass/issues/issue-2074.rs b/src/test/ui/run-pass/issues/issue-2074.rs deleted file mode 100644 index 9aba2637068..00000000000 --- a/src/test/ui/run-pass/issues/issue-2074.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(non_camel_case_types)] - -pub fn main() { - let one = || { - enum r { a }; - r::a as usize - }; - let two = || { - enum r { a }; - r::a as usize - }; - one(); two(); -} diff --git a/src/test/ui/run-pass/issues/issue-20763-1.rs b/src/test/ui/run-pass/issues/issue-20763-1.rs deleted file mode 100644 index 0afcc1bd966..00000000000 --- a/src/test/ui/run-pass/issues/issue-20763-1.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait T0 { - type O; - fn dummy(&self) { } -} - -struct S(A); -impl T0 for S { type O = A; } - -trait T1: T0 { - // this looks okay but as we see below, `f` is unusable - fn m0::O) -> bool>(self, f: F) -> bool; -} - -// complains about the bounds on F here not being required by the trait -impl T1 for S { - fn m0 bool>(self, f: F) -> bool { f(self.0) } -} - -// // complains about mismatched types: as T0>::O vs. A -// impl T1 for S -// { -// fn m0::O) -> bool>(self, f: F) -> bool { f(self.0) } -// } - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-20763-2.rs b/src/test/ui/run-pass/issues/issue-20763-2.rs deleted file mode 100644 index 4b25d4f05de..00000000000 --- a/src/test/ui/run-pass/issues/issue-20763-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait T0 { - type O; - fn dummy(&self) { } -} - -struct S(A); -impl T0 for S { type O = A; } - -trait T1: T0 { - // this looks okay but as we see below, `f` is unusable - fn m0::O) -> bool>(self, f: F) -> bool; -} - -// complains about mismatched types: as T0>::O vs. A -impl T1 for S -{ - fn m0::O) -> bool>(self, f: F) -> bool { f(self.0) } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-20797.rs b/src/test/ui/run-pass/issues/issue-20797.rs deleted file mode 100644 index 9c8a2571deb..00000000000 --- a/src/test/ui/run-pass/issues/issue-20797.rs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no std::fs - -// Regression test for #20797. - -use std::default::Default; -use std::io; -use std::fs; -use std::path::PathBuf; - -pub trait PathExtensions { - fn is_dir(&self) -> bool { false } -} - -impl PathExtensions for PathBuf {} - -/// A strategy for acquiring more subpaths to walk. -pub trait Strategy { - type P: PathExtensions; - /// Get additional subpaths from a given path. - fn get_more(&self, item: &Self::P) -> io::Result>; - /// Determine whether a path should be walked further. - /// This is run against each item from `get_more()`. - fn prune(&self, p: &Self::P) -> bool; -} - -/// The basic fully-recursive strategy. Nothing is pruned. -#[derive(Copy, Clone, Default)] -pub struct Recursive; - -impl Strategy for Recursive { - type P = PathBuf; - fn get_more(&self, p: &PathBuf) -> io::Result> { - Ok(fs::read_dir(p).unwrap().map(|s| s.unwrap().path()).collect()) - } - - fn prune(&self, _: &PathBuf) -> bool { false } -} - -/// A directory walker of `P` using strategy `S`. -pub struct Subpaths { - stack: Vec, - strategy: S, -} - -impl Subpaths { - /// Create a directory walker with a root path and strategy. - pub fn new(p: &S::P, strategy: S) -> io::Result> { - let stack = strategy.get_more(p)?; - Ok(Subpaths { stack: stack, strategy: strategy }) - } -} - -impl Subpaths { - /// Create a directory walker with a root path and a default strategy. - pub fn walk(p: &S::P) -> io::Result> { - Subpaths::new(p, Default::default()) - } -} - -impl Default for Subpaths { - fn default() -> Subpaths { - Subpaths { stack: Vec::new(), strategy: Default::default() } - } -} - -impl Iterator for Subpaths { - type Item = S::P; - fn next (&mut self) -> Option { - let mut opt_path = self.stack.pop(); - while opt_path.is_some() && self.strategy.prune(opt_path.as_ref().unwrap()) { - opt_path = self.stack.pop(); - } - match opt_path { - Some(path) => { - if path.is_dir() { - let result = self.strategy.get_more(&path); - match result { - Ok(dirs) => { self.stack.extend(dirs); }, - Err(..) => { } - } - } - Some(path) - } - None => None, - } - } -} - -fn _foo() { - let _walker: Subpaths = Subpaths::walk(&PathBuf::from("/home")).unwrap(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20803.rs b/src/test/ui/run-pass/issues/issue-20803.rs deleted file mode 100644 index 7a3e4e71ace..00000000000 --- a/src/test/ui/run-pass/issues/issue-20803.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Add; - -fn foo(x: T) -> >::Output where i32: Add { - 42i32 + x -} - -fn main() { - println!("{}", foo(0i32)); -} diff --git a/src/test/ui/run-pass/issues/issue-20823.rs b/src/test/ui/run-pass/issues/issue-20823.rs deleted file mode 100644 index 0a3b6f6eaa0..00000000000 --- a/src/test/ui/run-pass/issues/issue-20823.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --test - -#[test] -pub fn foo() {} diff --git a/src/test/ui/run-pass/issues/issue-20825.rs b/src/test/ui/run-pass/issues/issue-20825.rs deleted file mode 100644 index 62435fd343e..00000000000 --- a/src/test/ui/run-pass/issues/issue-20825.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Subscriber { - type Input; -} - -pub trait Processor: Subscriber::Input> { - type Input; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-20847.rs b/src/test/ui/run-pass/issues/issue-20847.rs deleted file mode 100644 index 4cb5a01b9de..00000000000 --- a/src/test/ui/run-pass/issues/issue-20847.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(fn_traits)] - -use std::ops::Fn; - -fn say(x: u32, y: u32) { - println!("{} {}", x, y); -} - -fn main() { - Fn::call(&say, (1, 2)); -} diff --git a/src/test/ui/run-pass/issues/issue-20953.rs b/src/test/ui/run-pass/issues/issue-20953.rs deleted file mode 100644 index e3dc286df34..00000000000 --- a/src/test/ui/run-pass/issues/issue-20953.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let mut shrinker: Box> = Box::new(vec![1].into_iter()); - println!("{:?}", shrinker.next()); - for v in shrinker { assert!(false); } - - let mut shrinker: &mut Iterator = &mut vec![1].into_iter(); - println!("{:?}", shrinker.next()); - for v in shrinker { assert!(false); } -} diff --git a/src/test/ui/run-pass/issues/issue-21033.rs b/src/test/ui/run-pass/issues/issue-21033.rs deleted file mode 100644 index f96d2db30d3..00000000000 --- a/src/test/ui/run-pass/issues/issue-21033.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_patterns)] -#![feature(box_syntax)] - -enum E { - StructVar { boxed: Box } -} - -fn main() { - - // Test matching each shorthand notation for field patterns. - let mut a = E::StructVar { boxed: box 3 }; - match a { - E::StructVar { box boxed } => { } - } - match a { - E::StructVar { box ref boxed } => { } - } - match a { - E::StructVar { box mut boxed } => { } - } - match a { - E::StructVar { box ref mut boxed } => { } - } - match a { - E::StructVar { ref boxed } => { } - } - match a { - E::StructVar { ref mut boxed } => { } - } - match a { - E::StructVar { mut boxed } => { } - } - - // Test matching non shorthand notation. Recreate a since last test - // moved `boxed` - let mut a = E::StructVar { boxed: box 3 }; - match a { - E::StructVar { boxed: box ref mut num } => { } - } - match a { - E::StructVar { boxed: ref mut num } => { } - } - -} diff --git a/src/test/ui/run-pass/issues/issue-21058.rs b/src/test/ui/run-pass/issues/issue-21058.rs deleted file mode 100644 index 318abfe691e..00000000000 --- a/src/test/ui/run-pass/issues/issue-21058.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] - -struct NT(str); -struct DST { a: u32, b: str } - -fn main() { - // type_name should support unsized types - assert_eq!(unsafe {( - // Slice - std::intrinsics::type_name::<[u8]>(), - // str - std::intrinsics::type_name::(), - // Trait - std::intrinsics::type_name::(), - // Newtype - std::intrinsics::type_name::(), - // DST - std::intrinsics::type_name::() - )}, ("[u8]", "str", "dyn std::marker::Send", "NT", "DST")); -} diff --git a/src/test/ui/run-pass/issues/issue-21140.rs b/src/test/ui/run-pass/issues/issue-21140.rs deleted file mode 100644 index ebd5f6752e3..00000000000 --- a/src/test/ui/run-pass/issues/issue-21140.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Trait where Self::Out: std::fmt::Display { - type Out; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21174.rs b/src/test/ui/run-pass/issues/issue-21174.rs deleted file mode 100644 index 3af5e5323a6..00000000000 --- a/src/test/ui/run-pass/issues/issue-21174.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Trait<'a> { - type A; - type B; -} - -fn foo<'a, T: Trait<'a>>(value: T::A) { - let new: T::B = unsafe { std::mem::transmute_copy(&value) }; -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-21245.rs b/src/test/ui/run-pass/issues/issue-21245.rs deleted file mode 100644 index 6bc14489d95..00000000000 --- a/src/test/ui/run-pass/issues/issue-21245.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #21245. Check that we are able to infer -// the types in these examples correctly. It used to be that -// insufficient type propagation caused the type of the iterator to be -// incorrectly unified with the `*const` type to which it is coerced. - -// pretty-expanded FIXME #23616 - -use std::ptr; - -trait IntoIterator { - type Iter: Iterator; - - fn into_iter2(self) -> Self::Iter; -} - -impl IntoIterator for I where I: Iterator { - type Iter = I; - - fn into_iter2(self) -> I { - self - } -} - -fn desugared_for_loop_bad(v: Vec) { - match IntoIterator::into_iter2(v.iter()) { - mut iter => { - loop { - match ::std::iter::Iterator::next(&mut iter) { - ::std::option::Option::Some(x) => { - unsafe { ptr::read(x); } - }, - ::std::option::Option::None => break - } - } - } - } -} - -fn desugared_for_loop_good(v: Vec) { - match v.iter().into_iter() { - mut iter => { - loop { - match ::std::iter::Iterator::next(&mut iter) { - ::std::option::Option::Some(x) => { - unsafe { ptr::read(x); } - }, - ::std::option::Option::None => break - } - } - } - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21291.rs b/src/test/ui/run-pass/issues/issue-21291.rs deleted file mode 100644 index 99912be8f8e..00000000000 --- a/src/test/ui/run-pass/issues/issue-21291.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -// Regression test for unwrapping the result of `join`, issue #21291 - -use std::thread; - -fn main() { - thread::spawn(|| {}).join().unwrap() -} diff --git a/src/test/ui/run-pass/issues/issue-21306.rs b/src/test/ui/run-pass/issues/issue-21306.rs deleted file mode 100644 index e01f0aaac10..00000000000 --- a/src/test/ui/run-pass/issues/issue-21306.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::sync::Arc; - -fn main() { - let x = 5; - let command = Arc::new(Box::new(|| { x*2 })); - assert_eq!(command(), 10); -} diff --git a/src/test/ui/run-pass/issues/issue-21361.rs b/src/test/ui/run-pass/issues/issue-21361.rs deleted file mode 100644 index 4a566d7f78f..00000000000 --- a/src/test/ui/run-pass/issues/issue-21361.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let v = vec![1, 2, 3]; - let boxed: Box> = Box::new(v.into_iter()); - assert_eq!(boxed.max(), Some(3)); - - let v = vec![1, 2, 3]; - let boxed: &mut Iterator = &mut v.into_iter(); - assert_eq!(boxed.max(), Some(3)); -} diff --git a/src/test/ui/run-pass/issues/issue-21363.rs b/src/test/ui/run-pass/issues/issue-21363.rs deleted file mode 100644 index e7f7a80a1de..00000000000 --- a/src/test/ui/run-pass/issues/issue-21363.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![no_implicit_prelude] - -trait Iterator { - type Item; - fn dummy(&self) { } -} - -impl<'a, T> Iterator for &'a mut (Iterator + 'a) { - type Item = T; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21384.rs b/src/test/ui/run-pass/issues/issue-21384.rs deleted file mode 100644 index eccd1208969..00000000000 --- a/src/test/ui/run-pass/issues/issue-21384.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use ::std::ops::RangeFull; - -fn test(arg: T) -> T { - arg.clone() -} - -#[derive(PartialEq, Debug)] -struct Test(isize); - -fn main() { - // Check that ranges implement clone - assert_eq!(test(1..5), (1..5)); - assert_eq!(test(..5), (..5)); - assert_eq!(test(1..), (1..)); - assert_eq!(test(RangeFull), (RangeFull)); - - // Check that ranges can still be used with non-clone limits - assert_eq!((Test(1)..Test(5)), (Test(1)..Test(5))); -} diff --git a/src/test/ui/run-pass/issues/issue-21400.rs b/src/test/ui/run-pass/issues/issue-21400.rs deleted file mode 100644 index 2c575d28e12..00000000000 --- a/src/test/ui/run-pass/issues/issue-21400.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #21400 which itself was extracted from -// stackoverflow.com/questions/28031155/is-my-borrow-checker-drunk/28031580 - -fn main() { - let mut t = Test; - assert_eq!(t.method1("one"), Ok(1)); - assert_eq!(t.method2("two"), Ok(2)); - assert_eq!(t.test(), Ok(2)); -} - -struct Test; - -impl Test { - fn method1(&mut self, _arg: &str) -> Result { - Ok(1) - } - - fn method2(self: &mut Test, _arg: &str) -> Result { - Ok(2) - } - - fn test(self: &mut Test) -> Result { - let s = format!("abcde"); - // (Originally, this invocation of method2 was saying that `s` - // does not live long enough.) - let data = match self.method2(&*s) { - Ok(r) => r, - Err(e) => return Err(e) - }; - Ok(data) - } -} - -// Below is a closer match for the original test that was failing to compile - -pub struct GitConnect; - -impl GitConnect { - fn command(self: &mut GitConnect, _s: &str) -> Result>, &str> { - unimplemented!() - } - - pub fn git_upload_pack(self: &mut GitConnect) -> Result { - let c = format!("git-upload-pack"); - - let mut out = String::new(); - let data = self.command(&c)?; - - for line in data.iter() { - out.push_str(&format!("{:?}", line)); - } - - Ok(out) - } -} - diff --git a/src/test/ui/run-pass/issues/issue-21402.rs b/src/test/ui/run-pass/issues/issue-21402.rs deleted file mode 100644 index 210ba0711b4..00000000000 --- a/src/test/ui/run-pass/issues/issue-21402.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(Hash)] -struct Foo { - a: Vec, - b: (bool, bool), - c: [bool; 2], -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21475.rs b/src/test/ui/run-pass/issues/issue-21475.rs deleted file mode 100644 index 883d6d215bd..00000000000 --- a/src/test/ui/run-pass/issues/issue-21475.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use m::{START, END}; - -fn main() { - match 42 { - m::START..=m::END => {}, - 0..=m::END => {}, - m::START..=59 => {}, - _ => {}, - } -} - -mod m { - pub const START: u32 = 4; - pub const END: u32 = 14; -} diff --git a/src/test/ui/run-pass/issues/issue-21486.rs b/src/test/ui/run-pass/issues/issue-21486.rs deleted file mode 100644 index faf9b42a0e8..00000000000 --- a/src/test/ui/run-pass/issues/issue-21486.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #21486: Make sure that all structures are dropped, even when -// created via FRU and control-flow breaks in the middle of -// construction. - -use std::sync::atomic::{Ordering, AtomicUsize}; - -#[derive(Debug)] -struct Noisy(u8); -impl Drop for Noisy { - fn drop(&mut self) { - // println!("splat #{}", self.0); - event(self.0); - } -} - -#[allow(dead_code)] -#[derive(Debug)] -struct Foo { n0: Noisy, n1: Noisy } -impl Foo { - fn vals(&self) -> (u8, u8) { (self.n0.0, self.n1.0) } -} - -fn leak_1_ret() -> Foo { - let _old_foo = Foo { n0: Noisy(1), n1: Noisy(2) }; - Foo { n0: { return Foo { n0: Noisy(3), n1: Noisy(4) } }, - .._old_foo - }; -} - -fn leak_2_ret() -> Foo { - let _old_foo = Foo { n0: Noisy(1), n1: Noisy(2) }; - Foo { n1: { return Foo { n0: Noisy(3), n1: Noisy(4) } }, - .._old_foo - }; -} - -// In this case, the control flow break happens *before* we construct -// `Foo(Noisy(1),Noisy(2))`, so there should be no record of it in the -// event log. -fn leak_3_ret() -> Foo { - let _old_foo = || Foo { n0: Noisy(1), n1: Noisy(2) }; - Foo { n1: { return Foo { n0: Noisy(3), n1: Noisy(4) } }, - .._old_foo() - }; -} - -pub fn main() { - reset_log(); - assert_eq!(leak_1_ret().vals(), (3,4)); - assert_eq!(0x01_02_03_04, event_log()); - - reset_log(); - assert_eq!(leak_2_ret().vals(), (3,4)); - assert_eq!(0x01_02_03_04, event_log()); - - reset_log(); - assert_eq!(leak_3_ret().vals(), (3,4)); - assert_eq!(0x03_04, event_log()); -} - -static LOG: AtomicUsize = AtomicUsize::new(0); - -fn reset_log() { - LOG.store(0, Ordering::SeqCst); -} - -fn event_log() -> usize { - LOG.load(Ordering::SeqCst) -} - -fn event(tag: u8) { - let old_log = LOG.load(Ordering::SeqCst); - let new_log = (old_log << 8) + tag as usize; - LOG.store(new_log, Ordering::SeqCst); -} diff --git a/src/test/ui/run-pass/issues/issue-21520.rs b/src/test/ui/run-pass/issues/issue-21520.rs deleted file mode 100644 index 71eb229ef00..00000000000 --- a/src/test/ui/run-pass/issues/issue-21520.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the requirement (in `Bar`) that `T::Bar : 'static` does -// not wind up propagating to `T`. - -// pretty-expanded FIXME #23616 - -pub trait Foo { - type Bar; - - fn foo(&self) -> Self; -} - -pub struct Static(T); - -struct Bar - where T::Bar : 'static -{ - x: Static> -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-21562.rs b/src/test/ui/run-pass/issues/issue-21562.rs deleted file mode 100644 index 6b876df9d04..00000000000 --- a/src/test/ui/run-pass/issues/issue-21562.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -extern crate core; -use core::marker::Sync; - -static SARRAY: [i32; 1] = [11]; - -struct MyStruct { - pub arr: *const [i32], -} -unsafe impl Sync for MyStruct {} - -static mystruct: MyStruct = MyStruct { - arr: &SARRAY -}; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21622.rs b/src/test/ui/run-pass/issues/issue-21622.rs deleted file mode 100644 index e7289e5d162..00000000000 --- a/src/test/ui/run-pass/issues/issue-21622.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Index; - -impl Index { - fn new() -> Self { Index } -} - -fn user() { - let new = Index::new; - - fn inner() { - let index = Index::new(); - } - - let index2 = new(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21634.rs b/src/test/ui/run-pass/issues/issue-21634.rs deleted file mode 100644 index 8c914ac5adc..00000000000 --- a/src/test/ui/run-pass/issues/issue-21634.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(cfg_target_feature)] - -#[cfg(any(not(target_arch = "x86"), target_feature = "sse2"))] -fn main() { - if let Ok(x) = "3.1415".parse::() { - assert_eq!(false, x <= 0.0); - } - if let Ok(x) = "3.1415".parse::() { - assert_eq!(3.1415, x + 0.0); - } - if let Ok(mut x) = "3.1415".parse::() { - assert_eq!(8.1415, { x += 5.0; x }); - } -} - -#[cfg(all(target_arch = "x86", not(target_feature = "sse2")))] -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-21655.rs b/src/test/ui/run-pass/issues/issue-21655.rs deleted file mode 100644 index 208a5a3f926..00000000000 --- a/src/test/ui/run-pass/issues/issue-21655.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn test(it: &mut Iterator) { - for x in it { - assert_eq!(x, 1) - } -} - -fn main() { - let v = vec![1]; - test(&mut v.into_iter()) -} diff --git a/src/test/ui/run-pass/issues/issue-21721.rs b/src/test/ui/run-pass/issues/issue-21721.rs deleted file mode 100644 index adda70a0f79..00000000000 --- a/src/test/ui/run-pass/issues/issue-21721.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - static NONE: Option<((), &'static u8)> = None; - let ptr = unsafe { - *(&NONE as *const _ as *const *const u8) - }; - assert!(ptr.is_null()); -} diff --git a/src/test/ui/run-pass/issues/issue-21726.rs b/src/test/ui/run-pass/issues/issue-21726.rs deleted file mode 100644 index 49369759929..00000000000 --- a/src/test/ui/run-pass/issues/issue-21726.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #21726: an issue arose around the rules for -// subtyping of projection types that resulted in an unconstrained -// region, yielding region inference failures. - -// pretty-expanded FIXME #23616 - -fn main() { } - -fn foo<'a>(s: &'a str) { - let b: B<()> = B::new(s, ()); - b.get_short(); -} - -trait IntoRef<'a> { - type T: Clone; - fn into_ref(self, _: &'a str) -> Self::T; -} - -impl<'a> IntoRef<'a> for () { - type T = &'a str; - fn into_ref(self, s: &'a str) -> &'a str { - s - } -} - -struct B<'a, P: IntoRef<'a>>(P::T); - -impl<'a, P: IntoRef<'a>> B<'a, P> { - fn new(s: &'a str, i: P) -> B<'a, P> { - B(i.into_ref(s)) - } - - fn get_short(&self) -> P::T { - self.0.clone() - } -} diff --git a/src/test/ui/run-pass/issues/issue-21891.rs b/src/test/ui/run-pass/issues/issue-21891.rs deleted file mode 100644 index 1e577ba7303..00000000000 --- a/src/test/ui/run-pass/issues/issue-21891.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// pretty-expanded FIXME #23616 - -static foo: [usize; 3] = [1, 2, 3]; - -static slice_1: &'static [usize] = &foo; -static slice_2: &'static [usize] = &foo; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2190-1.rs b/src/test/ui/run-pass/issues/issue-2190-1.rs deleted file mode 100644 index 2d7a7382f0b..00000000000 --- a/src/test/ui/run-pass/issues/issue-2190-1.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// pretty-expanded FIXME #23616 -// ignore-emscripten no threads - -use std::thread::Builder; - -static generations: usize = 1024+256+128+49; - -fn spawn(mut f: Box) { - Builder::new().stack_size(32 * 1024).spawn(move|| f()); -} - -fn child_no(x: usize) -> Box { - Box::new(move|| { - if x < generations { - spawn(child_no(x+1)); - } - }) -} - -pub fn main() { - spawn(child_no(0)); -} diff --git a/src/test/ui/run-pass/issues/issue-21909.rs b/src/test/ui/run-pass/issues/issue-21909.rs deleted file mode 100644 index ad5f1611e6f..00000000000 --- a/src/test/ui/run-pass/issues/issue-21909.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait A { - fn dummy(&self, arg: X); -} - -trait B { - type X; - type Y: A; - - fn dummy(&self); -} - -fn main () { } diff --git a/src/test/ui/run-pass/issues/issue-21922.rs b/src/test/ui/run-pass/issues/issue-21922.rs deleted file mode 100644 index 79e9976672e..00000000000 --- a/src/test/ui/run-pass/issues/issue-21922.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Add; -fn show(z: i32) { - println!("{}", z) -} -fn main() { - let x = 23; - let y = 42; - show(Add::add( x, y)); - show(Add::add( x, &y)); - show(Add::add(&x, y)); - show(Add::add(&x, &y)); - show( x + y); - show( x + &y); - show(&x + y); - show(&x + &y); -} diff --git a/src/test/ui/run-pass/issues/issue-22008.rs b/src/test/ui/run-pass/issues/issue-22008.rs deleted file mode 100644 index 54882cda624..00000000000 --- a/src/test/ui/run-pass/issues/issue-22008.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let command = "a"; - - match command { - "foo" => println!("foo"), - _ => println!("{}", command), - } -} diff --git a/src/test/ui/run-pass/issues/issue-22036.rs b/src/test/ui/run-pass/issues/issue-22036.rs deleted file mode 100644 index b814712b91a..00000000000 --- a/src/test/ui/run-pass/issues/issue-22036.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait DigitCollection: Sized { - type Iter: Iterator; - fn digit_iter(self) -> Self::Iter; - - fn digit_sum(self) -> u32 { - self.digit_iter() - .map(|digit: u8| digit as u32) - .fold(0, |sum, digit| sum + digit) - } -} - -impl DigitCollection for I where I: Iterator { - type Iter = I; - - fn digit_iter(self) -> I { - self - } -} - -fn main() { - let xs = vec![1, 2, 3, 4, 5]; - assert_eq!(xs.into_iter().digit_sum(), 15); -} diff --git a/src/test/ui/run-pass/issues/issue-22066.rs b/src/test/ui/run-pass/issues/issue-22066.rs deleted file mode 100644 index ef4753703bf..00000000000 --- a/src/test/ui/run-pass/issues/issue-22066.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait LineFormatter<'a> { - type Iter: Iterator + 'a; - fn iter(&'a self, line: &'a str) -> Self::Iter; - - fn dimensions(&'a self, line: &'a str) { - let iter: Self::Iter = self.iter(line); - <_ as IntoIterator>::into_iter(iter); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2214.rs b/src/test/ui/run-pass/issues/issue-2214.rs deleted file mode 100644 index 8329847d3c5..00000000000 --- a/src/test/ui/run-pass/issues/issue-2214.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -extern crate libc; - -use std::mem; -use libc::{c_double, c_int}; - -fn to_c_int(v: &mut isize) -> &mut c_int { - unsafe { - mem::transmute_copy(&v) - } -} - -fn lgamma(n: c_double, value: &mut isize) -> c_double { - unsafe { - return m::lgamma(n, to_c_int(value)); - } -} - -mod m { - use libc::{c_double, c_int}; - - #[link_name = "m"] - extern { - #[cfg(any(unix, target_os = "cloudabi"))] - #[link_name="lgamma_r"] - pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; - #[cfg(windows)] - #[link_name="lgamma"] - pub fn lgamma(n: c_double, sign: &mut c_int) -> c_double; - } -} - -pub fn main() { - let mut y: isize = 5; - let x: &mut isize = &mut y; - assert_eq!(lgamma(1.0 as c_double, x), 0.0 as c_double); -} diff --git a/src/test/ui/run-pass/issues/issue-2216.rs b/src/test/ui/run-pass/issues/issue-2216.rs deleted file mode 100644 index 9283cd93fa3..00000000000 --- a/src/test/ui/run-pass/issues/issue-2216.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let mut x = 0; - - 'foo: loop { - 'bar: loop { - 'quux: loop { - if 1 == 2 { - break 'foo; - } - else { - break 'bar; - } - } - continue 'foo; - } - x = 42; - break; - } - - println!("{}", x); - assert_eq!(x, 42); -} diff --git a/src/test/ui/run-pass/issues/issue-22258.rs b/src/test/ui/run-pass/issues/issue-22258.rs deleted file mode 100644 index 6f97da9b5b5..00000000000 --- a/src/test/ui/run-pass/issues/issue-22258.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Add; - -fn f(a: T, b: T) -> ::Output { - a + b -} - -fn main() { - println!("a + b is {}", f::(100f32, 200f32)); -} diff --git a/src/test/ui/run-pass/issues/issue-22346.rs b/src/test/ui/run-pass/issues/issue-22346.rs deleted file mode 100644 index 6689b6081ec..00000000000 --- a/src/test/ui/run-pass/issues/issue-22346.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -// This used to cause an ICE because the retslot for the "return" had the wrong type -fn testcase<'a>() -> Box + 'a> { - return Box::new((0..3).map(|i| { return i; })); -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-22356.rs b/src/test/ui/run-pass/issues/issue-22356.rs deleted file mode 100644 index 6e62ae06982..00000000000 --- a/src/test/ui/run-pass/issues/issue-22356.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(type_alias_bounds)] - -// pretty-expanded FIXME #23616 - -use std::marker::PhantomData; - -pub struct Handle(T, I); - -impl Handle { - pub fn get_info(&self) -> &I { - let Handle(_, ref info) = *self; - info - } -} - -pub struct BufferHandle { - raw: RawBufferHandle, - _marker: PhantomData, -} - -impl BufferHandle { - pub fn get_info(&self) -> &String { - self.raw.get_info() - } -} - -pub type RawBufferHandle = Handle<::Buffer, String>; - -pub trait Device { - type Buffer; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-22375.rs b/src/test/ui/run-pass/issues/issue-22375.rs deleted file mode 100644 index cf7ff0c404c..00000000000 --- a/src/test/ui/run-pass/issues/issue-22375.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait A> {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-22403.rs b/src/test/ui/run-pass/issues/issue-22403.rs deleted file mode 100644 index 76c4af1140b..00000000000 --- a/src/test/ui/run-pass/issues/issue-22403.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let x = Box::new([1, 2, 3]); - let y = x as Box<[i32]>; - println!("y: {:?}", y); -} diff --git a/src/test/ui/run-pass/issues/issue-22426.rs b/src/test/ui/run-pass/issues/issue-22426.rs deleted file mode 100644 index 8056b74ff8e..00000000000 --- a/src/test/ui/run-pass/issues/issue-22426.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - match 42 { - x if x < 7 => (), - _ => () - } -} diff --git a/src/test/ui/run-pass/issues/issue-22463.rs b/src/test/ui/run-pass/issues/issue-22463.rs deleted file mode 100644 index e308b65ec87..00000000000 --- a/src/test/ui/run-pass/issues/issue-22463.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! items { - () => { - type A = (); - fn a() {} - } -} - -trait Foo { - type A; - fn a(); -} - -impl Foo for () { - items!(); -} - -fn main() { - -} diff --git a/src/test/ui/run-pass/issues/issue-22471.rs b/src/test/ui/run-pass/issues/issue-22471.rs deleted file mode 100644 index 87b4bc1734b..00000000000 --- a/src/test/ui/run-pass/issues/issue-22471.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(type_alias_bounds)] - -type Foo where T: Copy = Box; - -fn main(){} diff --git a/src/test/ui/run-pass/issues/issue-22536-copy-mustnt-zero.rs b/src/test/ui/run-pass/issues/issue-22536-copy-mustnt-zero.rs deleted file mode 100644 index 116d0620136..00000000000 --- a/src/test/ui/run-pass/issues/issue-22536-copy-mustnt-zero.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for Issue #22536: If a type implements Copy, then -// moving it must not zero the original memory. - - -trait Resources { - type Buffer: Copy; - fn foo(&self) {} -} - -struct BufferHandle { - raw: ::Buffer, -} -impl Copy for BufferHandle {} -impl Clone for BufferHandle { - fn clone(&self) -> BufferHandle { *self } -} - -enum Res {} -impl Resources for Res { - type Buffer = u32; -} - -fn main() { - let b: BufferHandle = BufferHandle { raw: 1 }; - let c = b; - assert_eq!(c.raw, b.raw) -} diff --git a/src/test/ui/run-pass/issues/issue-22546.rs b/src/test/ui/run-pass/issues/issue-22546.rs deleted file mode 100644 index 28aaae1d8cc..00000000000 --- a/src/test/ui/run-pass/issues/issue-22546.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Parsing patterns with paths with type parameters (issue #22544) - -use std::default::Default; - -#[derive(Default)] -pub struct Foo(T, T); - -impl Foo { - fn foo(&self) { - match *self { - Foo::(ref x, ref y) => println!("Goodbye, World! {} {}", x, y) - } - } -} - -trait Tr { - type U; -} - -impl Tr for Foo { - type U = T; -} - -struct Wrapper { - value: T -} - -fn main() { - let Foo::(a, b) = Default::default(); - - let f = Foo(2,3); - f.foo(); - - let w = Wrapper { value: Foo(10u8, 11u8) }; - match w { - Wrapper::> { value: Foo(10, 11) } => {}, - ::Wrapper::< as Tr>::U> { value: Foo::(11, 16) } => { panic!() }, - _ => { panic!() } - } - - if let None:: = Some(8) { - panic!(); - } - if let None:: { .. } = Some(8) { - panic!(); - } - if let Option::None:: { .. } = Some(8) { - panic!(); - } -} diff --git a/src/test/ui/run-pass/issues/issue-22577.rs b/src/test/ui/run-pass/issues/issue-22577.rs deleted file mode 100644 index 774416c9251..00000000000 --- a/src/test/ui/run-pass/issues/issue-22577.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -// ignore-cloudabi no std::fs - -use std::{fs, net}; - -fn assert_both() {} -fn assert_send() {} - -fn main() { - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); - assert_both::(); -} diff --git a/src/test/ui/run-pass/issues/issue-22629.rs b/src/test/ui/run-pass/issues/issue-22629.rs deleted file mode 100644 index 9254a080794..00000000000 --- a/src/test/ui/run-pass/issues/issue-22629.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test transitive analysis for associated types. Collected types -// should be normalized and new obligations generated. - -// pretty-expanded FIXME #23616 - -use std::borrow::{ToOwned, Cow}; - -fn assert_send(_: T) {} - -fn main() { - assert_send(Cow::Borrowed("foo")); -} diff --git a/src/test/ui/run-pass/issues/issue-22777.rs b/src/test/ui/run-pass/issues/issue-22777.rs deleted file mode 100644 index 92ad7a43d4d..00000000000 --- a/src/test/ui/run-pass/issues/issue-22777.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test is reduced from libsyntax. It is just checking that we -// can successfully deal with a "deep" structure, which the drop-check -// was hitting a recursion limit on at one point. - -// pretty-expanded FIXME #23616 - -#![allow(non_camel_case_types)] - -pub fn noop_fold_impl_item() -> SmallVector { - loop { } -} - -pub struct SmallVector(P); -pub struct ImplItem(P); - -struct P(Box); - -struct S01_Method(P); -struct S02_Generics(P); -struct S03_TyParam(P); -struct S04_TyParamBound(S05_PolyTraitRef); -struct S05_PolyTraitRef(S06_TraitRef); -struct S06_TraitRef(S07_Path); -struct S07_Path(Vec); -struct S08_PathSegment(S09_GenericArgs); -struct S09_GenericArgs(P); -struct S10_ParenthesizedParameterData(Option>); -struct S11_Ty(P); -struct S12_Expr(P); -struct S13_Block(Vec>); -struct S14_Stmt(P); -struct S15_Decl(P); -struct S16_Local(P); -struct S17_Pat(P); -struct S18_Mac(Vec>); -struct S19_TokenTree(P); -struct S20_Token(P); -struct S21_Nonterminal(P); -struct S22_Item(P); -struct S23_EnumDef(Vec>); -struct S24_Variant(P); -struct S25_VariantKind(P); -struct S26_StructDef(Vec>); -struct S27_StructField(P); -struct S28_StructFieldKind; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-22781.rs b/src/test/ui/run-pass/issues/issue-22781.rs deleted file mode 100644 index af95b6e1d1a..00000000000 --- a/src/test/ui/run-pass/issues/issue-22781.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::HashMap; -use std::collections::hash_map::Entry::Vacant; - -pub fn foo() { - type F = Box; - let mut map: HashMap<(), F> = HashMap::new(); - let x: &mut F = match map.entry(()) { - Vacant(_) => unimplemented!(), - _ => unimplemented!() - }; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-22814.rs b/src/test/ui/run-pass/issues/issue-22814.rs deleted file mode 100644 index 13c7dab3751..00000000000 --- a/src/test/ui/run-pass/issues/issue-22814.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Test {} - -macro_rules! test { -( $($name:ident)+) => ( - impl<$($name: Test),*> Test for ($($name,)*) { - } -) -} - -test!(A B C); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-22828.rs b/src/test/ui/run-pass/issues/issue-22828.rs deleted file mode 100644 index cc92f080936..00000000000 --- a/src/test/ui/run-pass/issues/issue-22828.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test transitive analysis for associated types. Collected types -// should be normalized and new obligations generated. - -// pretty-expanded FIXME #23616 - -trait Foo { - type A; - fn foo(&self) {} -} - -impl Foo for usize { - type A = usize; -} - -struct Bar { inner: T::A } - -fn is_send() {} - -fn main() { - is_send::>(); -} diff --git a/src/test/ui/run-pass/issues/issue-2284.rs b/src/test/ui/run-pass/issues/issue-2284.rs deleted file mode 100644 index 77d1d6e0aa2..00000000000 --- a/src/test/ui/run-pass/issues/issue-2284.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Send { - fn f(&self); -} - -fn f(t: T) { - t.f(); -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-22864-1.rs b/src/test/ui/run-pass/issues/issue-22864-1.rs deleted file mode 100644 index e70e199bc2f..00000000000 --- a/src/test/ui/run-pass/issues/issue-22864-1.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - struct Fun(F); - let f = Fun(|x| 3*x); - let Fun(g) = f; - println!("{:?}",g(4)); -} diff --git a/src/test/ui/run-pass/issues/issue-22864-2.rs b/src/test/ui/run-pass/issues/issue-22864-2.rs deleted file mode 100644 index dea4ec49aad..00000000000 --- a/src/test/ui/run-pass/issues/issue-22864-2.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -pub fn main() { - let f = || || 0; - std::thread::spawn(f()); -} diff --git a/src/test/ui/run-pass/issues/issue-2288.rs b/src/test/ui/run-pass/issues/issue-2288.rs deleted file mode 100644 index 6185aaca6cf..00000000000 --- a/src/test/ui/run-pass/issues/issue-2288.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#![feature(box_syntax)] - -trait clam { - fn chowder(&self, y: A); -} - -#[derive(Copy, Clone)] -struct foo { - x: A, -} - -impl clam for foo { - fn chowder(&self, _y: A) { - } -} - -fn foo(b: A) -> foo { - foo { - x: b - } -} - -fn f(x: Box>, a: A) { - x.chowder(a); -} - -pub fn main() { - - let c = foo(42); - let d: Box> = box c as Box>; - f(d, c.x); -} diff --git a/src/test/ui/run-pass/issues/issue-22894.rs b/src/test/ui/run-pass/issues/issue-22894.rs deleted file mode 100644 index d1cd8efd73c..00000000000 --- a/src/test/ui/run-pass/issues/issue-22894.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[allow(dead_code)] -static X: &'static str = &*""; -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-22992-2.rs b/src/test/ui/run-pass/issues/issue-22992-2.rs deleted file mode 100644 index ccf5354b4ee..00000000000 --- a/src/test/ui/run-pass/issues/issue-22992-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct A(B); -struct B; - -use std::ops::Deref; - -impl Deref for A { - type Target = B; - fn deref(&self) -> &B { &self.0 } -} - -impl B { - fn foo(&self) {} -} - -fn main() { - A(B).foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-22992.rs b/src/test/ui/run-pass/issues/issue-22992.rs deleted file mode 100644 index 18f5021f49e..00000000000 --- a/src/test/ui/run-pass/issues/issue-22992.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37201 - -struct X { val: i32 } -impl std::ops::Deref for X { - type Target = i32; - fn deref(&self) -> &i32 { &self.val } -} - - -trait M { fn m(self); } -impl M for i32 { fn m(self) { println!("i32::m()"); } } -impl M for X { fn m(self) { println!("X::m()"); } } -impl<'a> M for &'a X { fn m(self) { println!("&X::m()"); } } -impl<'a, 'b> M for &'a &'b X { fn m(self) { println!("&&X::m()"); } } -impl<'a, 'b, 'c> M for &'a &'b &'c X { fn m(self) { println!("&&&X::m()"); } } - -trait RefM { fn refm(&self); } -impl RefM for i32 { fn refm(&self) { println!("i32::refm()"); } } -impl RefM for X { fn refm(&self) { println!("X::refm()"); } } -impl<'a> RefM for &'a X { fn refm(&self) { println!("&X::refm()"); } } -impl<'a, 'b> RefM for &'a &'b X { fn refm(&self) { println!("&&X::refm()"); } } -impl<'a, 'b, 'c> RefM for &'a &'b &'c X { fn refm(&self) { println!("&&&X::refm()"); } } - -struct Y { val: i32 } -impl std::ops::Deref for Y { - type Target = i32; - fn deref(&self) -> &i32 { &self.val } -} - -struct Z { val: Y } -impl std::ops::Deref for Z { - type Target = Y; - fn deref(&self) -> &Y { &self.val } -} - -struct A; -impl std::marker::Copy for A {} -impl Clone for A { fn clone(&self) -> Self { *self } } -impl M for A { fn m(self) { println!("A::m()"); } } -impl<'a, 'b, 'c> M for &'a &'b &'c A { fn m(self) { println!("&&&A::m()"); } } -impl RefM for A { fn refm(&self) { println!("A::refm()"); } } -impl<'a, 'b, 'c> RefM for &'a &'b &'c A { fn refm(&self) { println!("&&&A::refm()"); } } - -fn main() { - // I'll use @ to denote left side of the dot operator - (*X{val:42}).m(); // i32::refm() , self == @ - X{val:42}.m(); // X::m() , self == @ - (&X{val:42}).m(); // &X::m() , self == @ - (&&X{val:42}).m(); // &&X::m() , self == @ - (&&&X{val:42}).m(); // &&&X:m() , self == @ - (&&&&X{val:42}).m(); // &&&X::m() , self == *@ - (&&&&&X{val:42}).m(); // &&&X::m() , self == **@ - - (*X{val:42}).refm(); // i32::refm() , self == @ - X{val:42}.refm(); // X::refm() , self == @ - (&X{val:42}).refm(); // X::refm() , self == *@ - (&&X{val:42}).refm(); // &X::refm() , self == *@ - (&&&X{val:42}).refm(); // &&X::refm() , self == *@ - (&&&&X{val:42}).refm(); // &&&X::refm(), self == *@ - (&&&&&X{val:42}).refm(); // &&&X::refm(), self == **@ - - Y{val:42}.refm(); // i32::refm() , self == *@ - Z{val:Y{val:42}}.refm(); // i32::refm() , self == **@ - - A.m(); // A::m() , self == @ - // without the Copy trait, (&A).m() would be a compilation error: - // cannot move out of borrowed content - (&A).m(); // A::m() , self == *@ - (&&A).m(); // &&&A::m() , self == &@ - (&&&A).m(); // &&&A::m() , self == @ - A.refm(); // A::refm() , self == @ - (&A).refm(); // A::refm() , self == *@ - (&&A).refm(); // A::refm() , self == **@ - (&&&A).refm(); // &&&A::refm(), self == @ -} diff --git a/src/test/ui/run-pass/issues/issue-23036.rs b/src/test/ui/run-pass/issues/issue-23036.rs deleted file mode 100644 index 4017ae1731c..00000000000 --- a/src/test/ui/run-pass/issues/issue-23036.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no std::path - -use std::collections::HashMap; -use std::path::Path; - -fn main() { - let mut map = HashMap::new(); - map.insert(Path::new("a"), 0); - map.get(Path::new("a")); -} diff --git a/src/test/ui/run-pass/issues/issue-2311-2.rs b/src/test/ui/run-pass/issues/issue-2311-2.rs deleted file mode 100644 index 8cfd941cca8..00000000000 --- a/src/test/ui/run-pass/issues/issue-2311-2.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -trait clam { - fn get(self) -> A; -} - -struct foo { - x: A, -} - -impl foo { - pub fn bar>(&self, _c: C) -> B { - panic!(); - } -} - -fn foo(b: A) -> foo { - foo { - x: b - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-2311.rs b/src/test/ui/run-pass/issues/issue-2311.rs deleted file mode 100644 index 816754c4617..00000000000 --- a/src/test/ui/run-pass/issues/issue-2311.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -trait clam { fn get(self) -> A; } -trait foo { - fn bar>(&self, c: C) -> B; -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-2312.rs b/src/test/ui/run-pass/issues/issue-2312.rs deleted file mode 100644 index 33a033ef37f..00000000000 --- a/src/test/ui/run-pass/issues/issue-2312.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Testing that the B's are resolved - - -trait clam { fn get(self) -> A; } - -struct foo(isize); - -impl foo { - pub fn bar>(&self, _c: C) -> B { panic!(); } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-2316-c.rs b/src/test/ui/run-pass/issues/issue-2316-c.rs deleted file mode 100644 index b7a4b6b31e4..00000000000 --- a/src/test/ui/run-pass/issues/issue-2316-c.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_2316_a.rs -// aux-build:issue_2316_b.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_2316_b; -use issue_2316_b::cloth; - -pub fn main() { - let _c: cloth::fabric = cloth::fabric::calico; -} diff --git a/src/test/ui/run-pass/issues/issue-23208.rs b/src/test/ui/run-pass/issues/issue-23208.rs deleted file mode 100644 index 78384017ebc..00000000000 --- a/src/test/ui/run-pass/issues/issue-23208.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait TheTrait : TheSuperTrait<::Item> { - type Item; -} - -trait TheSuperTrait { - fn get(&self) -> T; -} - -impl TheTrait for i32 { - type Item = u32; -} - -impl TheSuperTrait for i32 { - fn get(&self) -> u32 { - *self as u32 - } -} - -fn foo>(t: &T) -> u32 { - t.get() -} - -fn main() { - foo::(&22); -} diff --git a/src/test/ui/run-pass/issues/issue-23261.rs b/src/test/ui/run-pass/issues/issue-23261.rs deleted file mode 100644 index 08f178beaf3..00000000000 --- a/src/test/ui/run-pass/issues/issue-23261.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Matching on a DST struct should not trigger an LLVM assertion. - -struct Foo { - a: i32, - inner: T -} - -trait Get { - fn get(&self) -> i32; -} - -impl Get for i32 { - fn get(&self) -> i32 { - *self - } -} - -fn check_val(val: &Foo<[u8]>) { - match *val { - Foo { a, .. } => { - assert_eq!(a, 32); - } - } -} - -fn check_dst_val(val: &Foo<[u8]>) { - match *val { - Foo { ref inner, .. } => { - assert_eq!(inner, [1, 2, 3]); - } - } -} - -fn check_both(val: &Foo<[u8]>) { - match *val { - Foo { a, ref inner } => { - assert_eq!(a, 32); - assert_eq!(inner, [1, 2, 3]); - } - } -} - -fn check_trait_obj(val: &Foo) { - match *val { - Foo { a, ref inner } => { - assert_eq!(a, 32); - assert_eq!(inner.get(), 32); - } - } -} - -fn main() { - let foo: &Foo<[u8]> = &Foo { a: 32, inner: [1, 2, 3] }; - check_val(foo); - check_dst_val(foo); - check_both(foo); - - let foo: &Foo = &Foo { a: 32, inner: 32 }; - check_trait_obj(foo); -} diff --git a/src/test/ui/run-pass/issues/issue-23304-1.rs b/src/test/ui/run-pass/issues/issue-23304-1.rs deleted file mode 100644 index 0a6b4e41e2e..00000000000 --- a/src/test/ui/run-pass/issues/issue-23304-1.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -#[repr(u8)] -#[allow(dead_code)] -enum ValueType { - DOUBLE = 0x00, - INT32 = 0x01, -} - -#[repr(u32)] -enum ValueTag { - INT32 = 0x1FFF0u32 | (ValueType::INT32 as u32), - X, -} - -#[repr(u64)] -enum ValueShiftedTag { - INT32 = ValueTag::INT32 as u64, - X, -} - -fn main() { - println!("{}", ValueTag::INT32 as u32); -} diff --git a/src/test/ui/run-pass/issues/issue-23304-2.rs b/src/test/ui/run-pass/issues/issue-23304-2.rs deleted file mode 100644 index 511bec0dde9..00000000000 --- a/src/test/ui/run-pass/issues/issue-23304-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -enum X { A = 42 as isize } - -enum Y { A = X::A as isize } - -fn main() { - let x = X::A; - let x = x as isize; - assert_eq!(x, 42); - assert_eq!(Y::A as isize, 42); -} diff --git a/src/test/ui/run-pass/issues/issue-23311.rs b/src/test/ui/run-pass/issues/issue-23311.rs deleted file mode 100644 index 3c91f5e1dfe..00000000000 --- a/src/test/ui/run-pass/issues/issue-23311.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we do not ICE when pattern matching an array against a slice. - -#![feature(slice_patterns)] - -fn main() { - match "foo".as_bytes() { - b"food" => (), - &[b'f', ..] => (), - _ => () - } -} diff --git a/src/test/ui/run-pass/issues/issue-23336.rs b/src/test/ui/run-pass/issues/issue-23336.rs deleted file mode 100644 index 0f0477bf844..00000000000 --- a/src/test/ui/run-pass/issues/issue-23336.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Data { fn doit(&self) {} } -impl Data for T {} -pub trait UnaryLogic { type D: Data; } -impl UnaryLogic for () { type D = i32; } - -pub fn crashes(t: T::D) { - t.doit(); -} - -fn main() { crashes::<()>(0); } diff --git a/src/test/ui/run-pass/issues/issue-23338-ensure-param-drop-order.rs b/src/test/ui/run-pass/issues/issue-23338-ensure-param-drop-order.rs deleted file mode 100644 index f1029a8c49a..00000000000 --- a/src/test/ui/run-pass/issues/issue-23338-ensure-param-drop-order.rs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// ignore-pretty issue #37201 - -// This test is ensuring that parameters are indeed dropped after -// temporaries in a fn body. - -use std::cell::RefCell; - -use self::d::D; - -pub fn main() { - let log = RefCell::new(vec![]); - d::println("created empty log"); - test(&log); - - assert_eq!(&log.borrow()[..], - [ - // created empty log - // +-- Make D(da_0, 0) - // | +-- Make D(de_1, 1) - // | | calling foo - // | | entered foo - // | | +-- Make D(de_2, 2) - // | | | +-- Make D(da_1, 3) - // | | | | +-- Make D(de_3, 4) - // | | | | | +-- Make D(de_4, 5) - 3, // | | | +-- Drop D(da_1, 3) - // | | | | | - 4, // | | | +-- Drop D(de_3, 4) - // | | | | - // | | | | eval tail of foo - // | | | +-- Make D(de_5, 6) - // | | | | +-- Make D(de_6, 7) - 5, // | | | | | +-- Drop D(de_4, 5) - // | | | | | - 2, // | | +-- Drop D(de_2, 2) - // | | | | - 6, // | | +-- Drop D(de_5, 6) - // | | | - 1, // | +-- Drop D(de_1, 1) - // | | - 0, // +-- Drop D(da_0, 0) - // | - // | result D(de_6, 7) - 7 // +-- Drop D(de_6, 7) - - ]); -} - -fn test<'a>(log: d::Log<'a>) { - let da = D::new("da", 0, log); - let de = D::new("de", 1, log); - d::println("calling foo"); - let result = foo(da, de); - d::println(&format!("result {}", result)); -} - -fn foo<'a>(da0: D<'a>, de1: D<'a>) -> D<'a> { - d::println("entered foo"); - let de2 = de1.incr(); // creates D(de_2, 2) - let de4 = { - let _da1 = da0.incr(); // creates D(da_1, 3) - de2.incr().incr() // creates D(de_3, 4) and D(de_4, 5) - }; - d::println("eval tail of foo"); - de4.incr().incr() // creates D(de_5, 6) and D(de_6, 7) -} - -// This module provides simultaneous printouts of the dynamic extents -// of all of the D values, in addition to logging the order that each -// is dropped. - -const PREF_INDENT: u32 = 16; - -pub mod d { - #![allow(unused_parens)] - use std::fmt; - use std::mem; - use std::cell::RefCell; - - static mut counter: u32 = 0; - static mut trails: u64 = 0; - - pub type Log<'a> = &'a RefCell>; - - pub fn current_width() -> u32 { - unsafe { max_width() - trails.leading_zeros() } - } - - pub fn max_width() -> u32 { - unsafe { - (mem::size_of_val(&trails)*8) as u32 - } - } - - pub fn indent_println(my_trails: u32, s: &str) { - let mut indent: String = String::new(); - for i in 0..my_trails { - unsafe { - if trails & (1 << i) != 0 { - indent = indent + "| "; - } else { - indent = indent + " "; - } - } - } - println!("{}{}", indent, s); - } - - pub fn println(s: &str) { - indent_println(super::PREF_INDENT, s); - } - - fn first_avail() -> u32 { - unsafe { - for i in 0..64 { - if trails & (1 << i) == 0 { - return i; - } - } - } - panic!("exhausted trails"); - } - - pub struct D<'a> { - name: &'static str, i: u32, uid: u32, trail: u32, log: Log<'a> - } - - impl<'a> fmt::Display for D<'a> { - fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { - write!(w, "D({}_{}, {})", self.name, self.i, self.uid) - } - } - - impl<'a> D<'a> { - pub fn new(name: &'static str, i: u32, log: Log<'a>) -> D<'a> { - unsafe { - let trail = first_avail(); - let ctr = counter; - counter += 1; - trails |= (1 << trail); - let ret = D { - name: name, i: i, log: log, uid: ctr, trail: trail - }; - indent_println(trail, &format!("+-- Make {}", ret)); - ret - } - } - pub fn incr(&self) -> D<'a> { - D::new(self.name, self.i + 1, self.log) - } - } - - impl<'a> Drop for D<'a> { - fn drop(&mut self) { - unsafe { trails &= !(1 << self.trail); }; - self.log.borrow_mut().push(self.uid); - indent_println(self.trail, &format!("+-- Drop {}", self)); - indent_println(::PREF_INDENT, ""); - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs b/src/test/ui/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs deleted file mode 100644 index e5eb41b235d..00000000000 --- a/src/test/ui/run-pass/issues/issue-23338-params-outlive-temps-of-body.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is largely checking that we now accept code where temp values -// are borrowing from the input parameters (the `foo` case below). -// -// Compare to run-pass/issue-23338-params-outlive-temps-of-body.rs -// -// (The `foo2` case is just for parity with the above test, which -// shows what happens when you move the `y`-binding to the inside of -// the inner block.) - -use std::cell::RefCell; - -fn foo(x: RefCell) -> String { - x.borrow().clone() -} - -fn foo2(x: RefCell) -> String { - let y = x; - let ret = { - y.borrow().clone() - }; - ret -} - -pub 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/run-pass/issues/issue-23406.rs b/src/test/ui/run-pass/issues/issue-23406.rs deleted file mode 100644 index fb44e2d9270..00000000000 --- a/src/test/ui/run-pass/issues/issue-23406.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Inner { - type T; -} - -impl<'a> Inner for &'a i32 { - type T = i32; -} - -fn f<'a>(x: &'a i32) -> <&'a i32 as Inner>::T { - *x -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-23433.rs b/src/test/ui/run-pass/issues/issue-23433.rs deleted file mode 100644 index 9c1e9b00000..00000000000 --- a/src/test/ui/run-pass/issues/issue-23433.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Don't fail if we encounter a NonNull where T is an unsized type - -use std::ptr::NonNull; - -fn main() { - let mut a = [0u8; 5]; - let b: Option> = Some(NonNull::from(&mut a)); - match b { - Some(_) => println!("Got `Some`"), - None => panic!("Unexpected `None`"), - } -} diff --git a/src/test/ui/run-pass/issues/issue-23442.rs b/src/test/ui/run-pass/issues/issue-23442.rs deleted file mode 100644 index 9f39b30f107..00000000000 --- a/src/test/ui/run-pass/issues/issue-23442.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::marker::PhantomData; - -pub struct UnionedKeys<'a,K> - where K: UnifyKey + 'a -{ - table: &'a mut UnificationTable, - root_key: K, - stack: Vec, -} - -pub trait UnifyKey { - type Value; -} - -pub struct UnificationTable { - values: Delegate, -} - -pub struct Delegate(PhantomData); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-23477.rs b/src/test/ui/run-pass/issues/issue-23477.rs deleted file mode 100644 index c862b0dbc2f..00000000000 --- a/src/test/ui/run-pass/issues/issue-23477.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compiler-flags: -g - -pub struct Dst { - pub a: (), - pub b: (), - pub data: [u8], -} - -pub unsafe fn borrow(bytes: &[u8]) -> &Dst { - let dst: &Dst = std::mem::transmute((bytes.as_ptr(), bytes.len())); - dst -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-23485.rs b/src/test/ui/run-pass/issues/issue-23485.rs deleted file mode 100644 index 42ccf5995ac..00000000000 --- a/src/test/ui/run-pass/issues/issue-23485.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test for an ICE that occurred when a default method implementation -// was applied to a type that did not meet the prerequisites. The -// problem occurred specifically because normalizing -// `Self::Item::Target` was impossible in this case. - -use std::boxed::Box; -use std::marker::Sized; -use std::clone::Clone; -use std::ops::Deref; -use std::option::Option; -use std::option::Option::{Some,None}; - -trait Iterator { - type Item; - - fn next(&mut self) -> Option; - - fn clone_first(mut self) -> Option<::Target> where - Self: Sized, - Self::Item: Deref, - ::Target: Clone, - { - self.next().map(|x| x.clone()) - } -} - -struct Counter { - value: i32 -} - -struct Token { - value: i32 -} - -impl Iterator for Counter { - type Item = Token; - - fn next(&mut self) -> Option { - let x = self.value; - self.value += 1; - Some(Token { value: x }) - } -} - -fn main() { - let mut x: Box> = Box::new(Counter { value: 22 }); - assert_eq!(x.next().unwrap().value, 22); -} diff --git a/src/test/ui/run-pass/issues/issue-23491.rs b/src/test/ui/run-pass/issues/issue-23491.rs deleted file mode 100644 index a6e06050c0e..00000000000 --- a/src/test/ui/run-pass/issues/issue-23491.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Node(T); - -fn main() { - let x: Box> = box Node([]); -} diff --git a/src/test/ui/run-pass/issues/issue-23550.rs b/src/test/ui/run-pass/issues/issue-23550.rs deleted file mode 100644 index 143e0babcd9..00000000000 --- a/src/test/ui/run-pass/issues/issue-23550.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] -#![allow(warnings)] - -use std::intrinsics; - -#[derive(Copy, Clone)] -struct Wrap(i64); - -// These volatile intrinsics used to cause an ICE - -unsafe fn test_bool(p: &mut bool, v: bool) { - intrinsics::volatile_load(p); - intrinsics::volatile_store(p, v); -} - -unsafe fn test_immediate_fca(p: &mut Wrap, v: Wrap) { - intrinsics::volatile_load(p); - intrinsics::volatile_store(p, v); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-23611-enum-swap-in-drop.rs b/src/test/ui/run-pass/issues/issue-23611-enum-swap-in-drop.rs deleted file mode 100644 index ab5a89cbba3..00000000000 --- a/src/test/ui/run-pass/issues/issue-23611-enum-swap-in-drop.rs +++ /dev/null @@ -1,268 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Issue 23611: this test is ensuring that, for an instance `X` of the -// enum `E`, if you swap in a different variant during the execution -// of the `::drop`, then the appropriate substructure will -// be torn down after the `::drop` method returns. - -use std::cell::RefCell; -use std::mem; - -use self::d::D; - -pub fn main() { - let log = RefCell::new(vec![]); - d::println("created empty log"); - test(&log); - - // println!("log: {:?}", &log.borrow()[..]); - assert_eq!( - &log.borrow()[..], - [ - // created empty log - // +-- Make D(test_1, 10000000) - // | +-- Make D(g_b_5, 50000001) - // | | in g_B(b2b0) from E::drop, b=b4b0 - // | +-- Drop D(g_b_5, 50000001) - 50000001, - // | - // | +-- Make D(drop_6, 60000002) - // | | +-- Make D(g_b_5, 50000003) - // | | | in g_B(b2b0) from E::drop, b=b4b1 - // | | +-- Drop D(g_b_5, 50000003) - 50000003, - // | | - // | | +-- Make D(GaspB::drop_3, 30000004) - // | | | +-- Make D(g_b_5, 50000005) - // | | | | in g_B(b4b2) from GaspB::drop - // | | | +-- Drop D(g_b_5, 50000005) - 50000005, - // | | | - // | | +-- Drop D(GaspB::drop_3, 30000004) - 30000004, - // | | - // +-- Drop D(test_1, 10000000) - 10000000, - // | - // +-- Make D(GaspA::drop_2, 20000006) - // | | +-- Make D(f_a_4, 40000007) - // | | | in f_A(a3a0) from GaspA::drop - // | | +-- Drop D(f_a_4, 40000007) - 40000007, - // | | - // +-- Drop D(GaspA::drop_2, 20000006) - 20000006, - // | - // +-- Drop D(drop_6, 60000002) - 60000002 - // - ]); - - // For reference purposes, the old (incorrect) behavior would produce the following - // output, which you can compare to the above: - // - // created empty log - // +-- Make D(test_1, 10000000) - // | +-- Make D(g_b_5, 50000001) - // | | in g_B(b2b0) from E::drop, b=b4b0 - // | +-- Drop D(g_b_5, 50000001) - // | - // | +-- Make D(drop_6, 60000002) - // | | +-- Make D(g_b_5, 50000003) - // | | | in g_B(b2b0) from E::drop, b=b4b1 - // | | +-- Drop D(g_b_5, 50000003) - // | | - // | | +-- Make D(GaspB::drop_3, 30000004) - // | | | +-- Make D(g_b_5, 50000005) - // | | | | in g_B(b4b2) from GaspB::drop - // | | | +-- Drop D(g_b_5, 50000005) - // | | | - // | | +-- Drop D(GaspB::drop_3, 30000004) - // | | - // +-- Drop D(test_1, 10000000) - // | - // +-- Make D(GaspB::drop_3, 30000006) - // | | +-- Make D(f_a_4, 40000007) - // | | | in f_A(a3a0) from GaspB::drop - // | | +-- Drop D(f_a_4, 40000007) - // | | - // +-- Drop D(GaspB::drop_3, 30000006) - // | - // +-- Drop D(drop_6, 60000002) - - // Note that this calls f_A from GaspB::drop (and thus creates a D - // with a uid incorporating the origin of GaspB's drop that - // surrounds the f_A invocation), but the code as written only - // ever hands f_A off to instances of GaspA, and thus one should - // be able to prove the invariant that f_A is *only* invoked from - // from an instance of GaspA (either via the GaspA drop - // implementation or the E drop implementaton). Yet the old (bad) - // behavior allowed a call to f_A to leak in while we are tearing - // down a value of type GaspB. -} - -fn test<'a>(log: d::Log<'a>) { - let _e = E::B(GaspB(g_b, 0xB4B0, log, D::new("test", 1, log)), true); -} - -struct GaspA<'a>(for <'b> fn(u32, &'b str, d::Log<'a>), u32, d::Log<'a>, d::D<'a>); -struct GaspB<'a>(for <'b> fn(u32, &'b str, d::Log<'a>), u32, d::Log<'a>, d::D<'a>); - -impl<'a> Drop for GaspA<'a> { - fn drop(&mut self) { - let _d = d::D::new("GaspA::drop", 2, self.2); - (self.0)(self.1, "GaspA::drop", self.2); - } -} - -impl<'a> Drop for GaspB<'a> { - fn drop(&mut self) { - let _d = d::D::new("GaspB::drop", 3, self.2); - (self.0)(self.1, "GaspB::drop", self.2); - } -} - -enum E<'a> { - A(GaspA<'a>, bool), B(GaspB<'a>, bool), -} - -fn f_a(x: u32, ctxt: &str, log: d::Log) { - let _d = d::D::new("f_a", 4, log); - d::println(&format!("in f_A({:x}) from {}", x, ctxt)); -} -fn g_b(y: u32, ctxt: &str, log: d::Log) { - let _d = d::D::new("g_b", 5, log); - d::println(&format!("in g_B({:x}) from {}", y, ctxt)); -} - -impl<'a> Drop for E<'a> { - fn drop(&mut self) { - let (do_drop, log) = match *self { - E::A(GaspA(ref f, ref mut val_a, log, ref _d_a), ref mut do_drop) => { - f(0xA1A0, &format!("E::drop, a={:x}", val_a), log); - *val_a += 1; - // swap in do_drop := false to avoid infinite dtor regress - (mem::replace(do_drop, false), log) - } - E::B(GaspB(ref g, ref mut val_b, log, ref _d_b), ref mut do_drop) => { - g(0xB2B0, &format!("E::drop, b={:x}", val_b), log); - *val_b += 1; - // swap in do_drop := false to avoid infinite dtor regress - (mem::replace(do_drop, false), log) - } - }; - - if do_drop { - mem::replace(self, E::A(GaspA(f_a, 0xA3A0, log, D::new("drop", 6, log)), true)); - } - } -} - -// This module provides simultaneous printouts of the dynamic extents -// of all of the D values, in addition to logging the order that each -// is dropped. -// -// This code is similar to a support code module embedded within -// test/run-pass/issue-123338-ensure-param-drop-order.rs; however, -// that (slightly simpler) code only identifies objects in the log via -// (creation) time-stamps; this incorporates both timestamping and the -// point of origin within the source code into the unique ID (uid). - -const PREF_INDENT: u32 = 20; - -pub mod d { - #![allow(unused_parens)] - use std::fmt; - use std::mem; - use std::cell::RefCell; - - static mut counter: u16 = 0; - static mut trails: u64 = 0; - - pub type Log<'a> = &'a RefCell>; - - pub fn current_width() -> u32 { - unsafe { max_width() - trails.leading_zeros() } - } - - pub fn max_width() -> u32 { - unsafe { - (mem::size_of_val(&trails)*8) as u32 - } - } - - pub fn indent_println(my_trails: u32, s: &str) { - let mut indent: String = String::new(); - for i in 0..my_trails { - unsafe { - if trails & (1 << i) != 0 { - indent = indent + "| "; - } else { - indent = indent + " "; - } - } - } - println!("{}{}", indent, s); - } - - pub fn println(s: &str) { - indent_println(super::PREF_INDENT, s); - } - - fn first_avail() -> u32 { - unsafe { - for i in 0..64 { - if trails & (1 << i) == 0 { - return i; - } - } - } - panic!("exhausted trails"); - } - - pub struct D<'a> { - name: &'static str, i: u8, uid: u32, trail: u32, log: Log<'a> - } - - impl<'a> fmt::Display for D<'a> { - fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result { - write!(w, "D({}_{}, {})", self.name, self.i, self.uid) - } - } - - impl<'a> D<'a> { - pub fn new(name: &'static str, i: u8, log: Log<'a>) -> D<'a> { - unsafe { - let trail = first_avail(); - let ctr = ((i as u32) * 10_000_000) + (counter as u32); - counter += 1; - trails |= (1 << trail); - let ret = D { - name: name, i: i, log: log, uid: ctr, trail: trail - }; - indent_println(trail, &format!("+-- Make {}", ret)); - ret - } - } - } - - impl<'a> Drop for D<'a> { - fn drop(&mut self) { - unsafe { trails &= !(1 << self.trail); }; - self.log.borrow_mut().push(self.uid); - indent_println(self.trail, &format!("+-- Drop {}", self)); - indent_println(::PREF_INDENT, ""); - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-23649-1.rs b/src/test/ui/run-pass/issues/issue-23649-1.rs deleted file mode 100644 index f270f536cf1..00000000000 --- a/src/test/ui/run-pass/issues/issue-23649-1.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; - -pub struct X([u8]); - -fn _f(x: &X) -> usize { match *x { X(ref x) => { x.len() } } } - -fn main() { - let b: &[u8] = &[11; 42]; - let v: &X = unsafe { mem::transmute(b) }; - assert_eq!(_f(v), 42); -} diff --git a/src/test/ui/run-pass/issues/issue-23649-2.rs b/src/test/ui/run-pass/issues/issue-23649-2.rs deleted file mode 100644 index 6cdd94c381e..00000000000 --- a/src/test/ui/run-pass/issues/issue-23649-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no std::path - -use std::collections::HashMap; -use std::path::{Path, PathBuf}; - -fn main() { - let m: HashMap = HashMap::new(); - let k = Path::new("foo"); - println!("{:?}", m.get(k)); -} diff --git a/src/test/ui/run-pass/issues/issue-23649-3.rs b/src/test/ui/run-pass/issues/issue-23649-3.rs deleted file mode 100644 index 067628ec12a..00000000000 --- a/src/test/ui/run-pass/issues/issue-23649-3.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq)] -struct Slice { slice: [u8] } - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-23699.rs b/src/test/ui/run-pass/issues/issue-23699.rs deleted file mode 100644 index a33d1039267..00000000000 --- a/src/test/ui/run-pass/issues/issue-23699.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn gimme_a_raw_pointer(_: *const T) { } - -fn test(t: T) { } - -fn main() { - // Clearly `pointer` must be of type `*const ()`. - let pointer = &() as *const _; - gimme_a_raw_pointer(pointer); - - let t = test as fn (i32); - t(0i32); -} - diff --git a/src/test/ui/run-pass/issues/issue-23781.rs b/src/test/ui/run-pass/issues/issue-23781.rs deleted file mode 100644 index fcd6dd196ac..00000000000 --- a/src/test/ui/run-pass/issues/issue-23781.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt; - -struct Foo; -impl fmt::Debug for Foo { - fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { - println!("::fmt()"); - - write!(fmt, "") - } -} - -fn test1() { - let foo_str = format!("{:?}", Foo); - - println!("{}", foo_str); -} - -fn test2() { - println!("{:?}", Foo); -} - -fn main() { - // This works fine - test1(); - - // This fails - test2(); -} diff --git a/src/test/ui/run-pass/issues/issue-2380-b.rs b/src/test/ui/run-pass/issues/issue-2380-b.rs deleted file mode 100644 index fe28c2f3f1b..00000000000 --- a/src/test/ui/run-pass/issues/issue-2380-b.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-2380.rs - -// pretty-expanded FIXME #23616 - -extern crate a; - -pub fn main() { - a::f::<()>(); -} diff --git a/src/test/ui/run-pass/issues/issue-23808.rs b/src/test/ui/run-pass/issues/issue-23808.rs deleted file mode 100644 index 133da00ffaa..00000000000 --- a/src/test/ui/run-pass/issues/issue-23808.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(dead_code)] - -// use different types / traits to test all combinations - -trait Const { - const C: (); -} - -trait StaticFn { - fn sfn(); -} - -struct ConstStruct; -struct StaticFnStruct; - -enum ConstEnum {} -enum StaticFnEnum {} - -struct AliasedConstStruct; -struct AliasedStaticFnStruct; - -enum AliasedConstEnum {} -enum AliasedStaticFnEnum {} - -type AliasConstStruct = AliasedConstStruct; -type AliasStaticFnStruct = AliasedStaticFnStruct; -type AliasConstEnum = AliasedConstEnum; -type AliasStaticFnEnum = AliasedStaticFnEnum; - -macro_rules! impl_Const {($($T:ident),*) => {$( - impl Const for $T { - const C: () = (); - } -)*}} - -macro_rules! impl_StaticFn {($($T:ident),*) => {$( - impl StaticFn for $T { - fn sfn() {} - } -)*}} - -impl_Const!(ConstStruct, ConstEnum, AliasedConstStruct, AliasedConstEnum); -impl_StaticFn!(StaticFnStruct, StaticFnEnum, AliasedStaticFnStruct, AliasedStaticFnEnum); - -fn main() { - let _ = ConstStruct::C; - let _ = ConstEnum::C; - - StaticFnStruct::sfn(); - StaticFnEnum::sfn(); - - let _ = AliasConstStruct::C; - let _ = AliasConstEnum::C; - - AliasStaticFnStruct::sfn(); - AliasStaticFnEnum::sfn(); -} diff --git a/src/test/ui/run-pass/issues/issue-23825.rs b/src/test/ui/run-pass/issues/issue-23825.rs deleted file mode 100644 index 2bcadefe9b8..00000000000 --- a/src/test/ui/run-pass/issues/issue-23825.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Stringify { - fn to_string(&self) -> String; -} - -impl Stringify for u32 { - fn to_string(&self) -> String { format!("u32: {}", *self) } -} - -impl Stringify for f32 { - fn to_string(&self) -> String { format!("f32: {}", *self) } -} - -fn print(x: T) -> String { - x.to_string() -} - -fn main() { - assert_eq!(&print(5), "u32: 5"); - assert_eq!(&print(5.0), "f32: 5"); -} diff --git a/src/test/ui/run-pass/issues/issue-2383.rs b/src/test/ui/run-pass/issues/issue-2383.rs deleted file mode 100644 index 2e1318ee6c8..00000000000 --- a/src/test/ui/run-pass/issues/issue-2383.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::collections::VecDeque; - -pub fn main() { - let mut q = VecDeque::new(); - q.push_front(10); -} diff --git a/src/test/ui/run-pass/issues/issue-23833.rs b/src/test/ui/run-pass/issues/issue-23833.rs deleted file mode 100644 index eeb7db925da..00000000000 --- a/src/test/ui/run-pass/issues/issue-23833.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt; -use std::{i8, i16, i32, i64, isize}; -use std::{u8, u16, u32, u64, usize}; - -const A_I8_T - : [u32; (i8::MAX as i8 - 1i8) as usize] - = [0; (i8::MAX as usize) - 1]; - -fn main() { - foo(&A_I8_T[..]); -} - -fn foo(x: T) { - println!("{:?}", x); -} diff --git a/src/test/ui/run-pass/issues/issue-23891.rs b/src/test/ui/run-pass/issues/issue-23891.rs deleted file mode 100644 index c2197b885c9..00000000000 --- a/src/test/ui/run-pass/issues/issue-23891.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! id { - ($s: pat) => ($s); -} - -fn main() { - match (Some(123), Some(456)) { - (id!(Some(a)), _) | (_, id!(Some(a))) => println!("{}", a), - _ => (), - } -} diff --git a/src/test/ui/run-pass/issues/issue-23898.rs b/src/test/ui/run-pass/issues/issue-23898.rs deleted file mode 100644 index d06814d620e..00000000000 --- a/src/test/ui/run-pass/issues/issue-23898.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Note: This test was used to demonstrate #5873 (now #23898). - -enum State { ST_NULL, ST_WHITESPACE } - -fn main() { - [State::ST_NULL; (State::ST_WHITESPACE as usize)]; -} diff --git a/src/test/ui/run-pass/issues/issue-23958.rs b/src/test/ui/run-pass/issues/issue-23958.rs deleted file mode 100644 index 6f9e7e21668..00000000000 --- a/src/test/ui/run-pass/issues/issue-23958.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Collection where for<'a> &'a Self: IntoIterator { - fn my_iter(&self) -> <&Self as IntoIterator>::IntoIter { - self.into_iter() - } -} - -impl Collection for [T] { } - -fn main() { - let v = [0usize]; - let _ = v.my_iter(); -} diff --git a/src/test/ui/run-pass/issues/issue-23968-const-not-overflow.rs b/src/test/ui/run-pass/issues/issue-23968-const-not-overflow.rs deleted file mode 100644 index d51167c47f8..00000000000 --- a/src/test/ui/run-pass/issues/issue-23968-const-not-overflow.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const U8_MAX_HALF: u8 = !0u8 / 2; -const U16_MAX_HALF: u16 = !0u16 / 2; -const U32_MAX_HALF: u32 = !0u32 / 2; -const U64_MAX_HALF: u64 = !0u64 / 2; - -fn main() { - assert_eq!(U8_MAX_HALF, 0x7f); - assert_eq!(U16_MAX_HALF, 0x7fff); - assert_eq!(U32_MAX_HALF, 0x7fff_ffff); - assert_eq!(U64_MAX_HALF, 0x7fff_ffff_ffff_ffff); -} diff --git a/src/test/ui/run-pass/issues/issue-23992.rs b/src/test/ui/run-pass/issues/issue-23992.rs deleted file mode 100644 index be8588f33a2..00000000000 --- a/src/test/ui/run-pass/issues/issue-23992.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Outer(T); -pub struct Inner<'a> { value: &'a bool } - -pub trait Trait { - type Error; - fn ready(self) -> Self::Error; -} - -impl<'a> Trait for Inner<'a> { - type Error = Outer>; - fn ready(self) -> Outer> { Outer(self) } -} - -fn main() { - let value = true; - let inner = Inner { value: &value }; - assert_eq!(inner.ready().0.value, &value); -} diff --git a/src/test/ui/run-pass/issues/issue-24085.rs b/src/test/ui/run-pass/issues/issue-24085.rs deleted file mode 100644 index 6d8cacf8b29..00000000000 --- a/src/test/ui/run-pass/issues/issue-24085.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #24085. Errors were occurring in region -// inference due to the requirement that `'a:b'`, which was getting -// incorrectly codegened in connection with the closure below. - -#[derive(Copy,Clone)] -struct Path<'a:'b, 'b> { - x: &'a i32, - tail: Option<&'b Path<'a, 'b>> -} - -#[allow(dead_code, unconditional_recursion)] -fn foo<'a,'b,F>(p: Path<'a, 'b>, mut f: F) - where F: for<'c> FnMut(Path<'a, 'c>) { - foo(p, |x| f(x)) -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-24086.rs b/src/test/ui/run-pass/issues/issue-24086.rs deleted file mode 100644 index 632afc00688..00000000000 --- a/src/test/ui/run-pass/issues/issue-24086.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Registry<'a> { - listener: &'a mut (), -} - -pub struct Listener<'a> { - pub announce: Option>, - pub remove: Option>, -} - -impl<'a> Drop for Registry<'a> { - fn drop(&mut self) {} -} - -fn main() { - let mut registry_listener = Listener { - announce: None, - remove: None, - }; -} diff --git a/src/test/ui/run-pass/issues/issue-2414-c.rs b/src/test/ui/run-pass/issues/issue-2414-c.rs deleted file mode 100644 index d285074accf..00000000000 --- a/src/test/ui/run-pass/issues/issue-2414-c.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-2414-a.rs -// aux-build:issue-2414-b.rs - -// pretty-expanded FIXME #23616 - -extern crate b; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-24161.rs b/src/test/ui/run-pass/issues/issue-24161.rs deleted file mode 100644 index 1ac5d1237a7..00000000000 --- a/src/test/ui/run-pass/issues/issue-24161.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Copy,Clone)] -struct Functions { - a: fn(u32) -> u32, - b: extern "C" fn(u32) -> u32, - c: unsafe fn(u32) -> u32, - d: unsafe extern "C" fn(u32) -> u32 -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-24227.rs b/src/test/ui/run-pass/issues/issue-24227.rs deleted file mode 100644 index 86241b1763a..00000000000 --- a/src/test/ui/run-pass/issues/issue-24227.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This resulted in an ICE. Test for future-proofing -// Issue #24227 - -#![allow(unused)] - -struct Foo<'a> { - x: &'a u8 -} - -impl<'a> Foo<'a> { - fn foo() { - let mut tmp: Self; - } - -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2428.rs b/src/test/ui/run-pass/issues/issue-2428.rs deleted file mode 100644 index 5a0c9f5a85b..00000000000 --- a/src/test/ui/run-pass/issues/issue-2428.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - - -pub fn main() { - let _foo = 100; - const quux: isize = 5; - - enum Stuff { - Bar = quux - } - - assert_eq!(Stuff::Bar as isize, quux); -} diff --git a/src/test/ui/run-pass/issues/issue-24308.rs b/src/test/ui/run-pass/issues/issue-24308.rs deleted file mode 100644 index 6cbdd61273f..00000000000 --- a/src/test/ui/run-pass/issues/issue-24308.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Foo { - fn method1() {} - fn method2(); -} - -struct Slice<'a, T: 'a>(&'a [T]); - -impl<'a, T: 'a> Foo for Slice<'a, T> { - fn method2() { - ::method1(); - } -} - -fn main() { - as Foo>::method2(); -} diff --git a/src/test/ui/run-pass/issues/issue-24313.rs b/src/test/ui/run-pass/issues/issue-24313.rs deleted file mode 100644 index cd20ab5a843..00000000000 --- a/src/test/ui/run-pass/issues/issue-24313.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no threads - -use std::thread; -use std::env; -use std::process::Command; - -struct Handle(i32); - -impl Drop for Handle { - fn drop(&mut self) { panic!(); } -} - -thread_local!(static HANDLE: Handle = Handle(0)); - -fn main() { - let args = env::args().collect::>(); - if args.len() == 1 { - let out = Command::new(&args[0]).arg("test").output().unwrap(); - let stderr = std::str::from_utf8(&out.stderr).unwrap(); - assert!(stderr.contains("panicked at 'explicit panic'"), - "bad failure message:\n{}\n", stderr); - } else { - // TLS dtors are not always run on process exit - thread::spawn(|| { - HANDLE.with(|h| { - println!("{}", h.0); - }); - }).join().unwrap(); - } -} - diff --git a/src/test/ui/run-pass/issues/issue-24353.rs b/src/test/ui/run-pass/issues/issue-24353.rs deleted file mode 100644 index f4b0e6814e8..00000000000 --- a/src/test/ui/run-pass/issues/issue-24353.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - return (); - - let x = (); - x -} diff --git a/src/test/ui/run-pass/issues/issue-24389.rs b/src/test/ui/run-pass/issues/issue-24389.rs deleted file mode 100644 index 5eb622bb932..00000000000 --- a/src/test/ui/run-pass/issues/issue-24389.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -struct Foo; - -impl Foo { - fn new() -> Self { Foo } - fn bar() { Self::new(); } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-24434.rs b/src/test/ui/run-pass/issues/issue-24434.rs deleted file mode 100644 index a4f22e3c79a..00000000000 --- a/src/test/ui/run-pass/issues/issue-24434.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--cfg set1 - -#![cfg_attr(set1, feature(custom_attribute))] - -#![foobar] -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2445-b.rs b/src/test/ui/run-pass/issues/issue-2445-b.rs deleted file mode 100644 index 144861dc94e..00000000000 --- a/src/test/ui/run-pass/issues/issue-2445-b.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct c1 { - x: T, -} - -impl c1 { - pub fn f1(&self, _x: isize) { - } -} - -fn c1(x: T) -> c1 { - c1 { - x: x - } -} - -impl c1 { - pub fn f2(&self, _x: isize) { - } -} - - -pub fn main() { - c1::(3).f1(4); - c1::(3).f2(4); -} diff --git a/src/test/ui/run-pass/issues/issue-2445.rs b/src/test/ui/run-pass/issues/issue-2445.rs deleted file mode 100644 index 1d368e908ed..00000000000 --- a/src/test/ui/run-pass/issues/issue-2445.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct c1 { - x: T, -} - -impl c1 { - pub fn f1(&self, _x: T) {} -} - -fn c1(x: T) -> c1 { - c1 { - x: x - } -} - -impl c1 { - pub fn f2(&self, _x: T) {} -} - - -pub fn main() { - c1::(3).f1(4); - c1::(3).f2(4); -} diff --git a/src/test/ui/run-pass/issues/issue-24533.rs b/src/test/ui/run-pass/issues/issue-24533.rs deleted file mode 100644 index 316773e8915..00000000000 --- a/src/test/ui/run-pass/issues/issue-24533.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::slice::Iter; -use std::io::{Error, ErrorKind, Result}; -use std::vec::*; - -fn foo(it: &mut Iter) -> Result { - Ok(*it.next().unwrap()) -} - -fn bar() -> Result { - let data: Vec = Vec::new(); - - if true { - return Err(Error::new(ErrorKind::NotFound, "msg")); - } - - let mut it = data.iter(); - foo(&mut it) -} - -fn main() { - bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs b/src/test/ui/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs deleted file mode 100644 index 3f46b0e312d..00000000000 --- a/src/test/ui/run-pass/issues/issue-24535-allow-mutable-borrow-in-match-guard.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test illustrates that under NLL, we can remove our overly -// conservative approach for disallowing mutations of match inputs. - -// See further discussion on rust-lang/rust#24535 and -// rust-lang/rfcs#1006. - -// compile-flags: -Z disable-ast-check-for-mutation-in-guard - -#![feature(nll)] - -fn main() { - rust_issue_24535(); - rfcs_issue_1006_1(); - rfcs_issue_1006_2(); -} - -fn rust_issue_24535() { - fn compare(a: &u8, b: &mut u8) -> bool { - a == b - } - - let a = 3u8; - - match a { - 0 => panic!("nope"), - 3 if compare(&a, &mut 3) => (), - _ => panic!("nope"), - } -} - -fn rfcs_issue_1006_1() { - let v = vec!["1".to_string(), "2".to_string(), "3".to_string()]; - match Some(&v) { - Some(iv) if iv.iter().any(|x| &x[..]=="2") => true, - _ => panic!("nope"), - }; -} - -fn rfcs_issue_1006_2() { - #[inline(always)] - fn check<'a, I: Iterator>(mut i: I) -> bool { - i.any(|&x| x == 2) - } - - let slice = [1, 2, 3]; - - match 42 { - _ if slice.iter().any(|&x| x == 2) => { true }, - _ => { panic!("nope"); } - }; - - // (This match is just illustrating how easy it was to circumvent - // the checking performed for the previous `match`.) - match 42 { - _ if check(slice.iter()) => { true }, - _ => { panic!("nope"); } - }; -} diff --git a/src/test/ui/run-pass/issues/issue-24589.rs b/src/test/ui/run-pass/issues/issue-24589.rs deleted file mode 100644 index 825e3cbd93b..00000000000 --- a/src/test/ui/run-pass/issues/issue-24589.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct _X([u8]); - -impl std::ops::Deref for _X { - type Target = [u8]; - - fn deref(&self) -> &[u8] { - &self.0 - } -} - -pub fn _g(x: &_X) -> &[u8] { - x -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-2463.rs b/src/test/ui/run-pass/issues/issue-2463.rs deleted file mode 100644 index 1c655f87435..00000000000 --- a/src/test/ui/run-pass/issues/issue-2463.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Pair { f: isize, g: isize } - -pub fn main() { - - let x = Pair { - f: 0, - g: 0, - }; - - let _y = Pair { - f: 1, - g: 1, - .. x - }; - - let _z = Pair { - f: 1, - .. x - }; - -} diff --git a/src/test/ui/run-pass/issues/issue-2472.rs b/src/test/ui/run-pass/issues/issue-2472.rs deleted file mode 100644 index bc078ea49cf..00000000000 --- a/src/test/ui/run-pass/issues/issue-2472.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_2472_b.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_2472_b; - -use issue_2472_b::{S, T}; - -pub fn main() { - let s = S(()); - s.foo(); - s.bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-24779.rs b/src/test/ui/run-pass/issues/issue-24779.rs deleted file mode 100644 index 85ab4c6d4c5..00000000000 --- a/src/test/ui/run-pass/issues/issue-24779.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - assert_eq!((||||42)()(), 42); -} diff --git a/src/test/ui/run-pass/issues/issue-24805-dropck-itemless.rs b/src/test/ui/run-pass/issues/issue-24805-dropck-itemless.rs deleted file mode 100644 index 1d1bd21075b..00000000000 --- a/src/test/ui/run-pass/issues/issue-24805-dropck-itemless.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -// Check that item-less traits do not cause dropck to inject extra -// region constraints. - -#![allow(non_camel_case_types)] - -#![feature(dropck_parametricity)] - -trait UserDefined { } - -impl UserDefined for i32 { } -impl<'a, T> UserDefined for &'a T { } - -// 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 { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { } - } - } -} - -impl_drop!{Send, D_Send} -impl_drop!{Sized, D_Sized} - -// See note below regarding Issue 24895 -// impl_drop!{Copy, D_Copy} - -impl_drop!{Sync, D_Sync} -impl_drop!{UserDefined, D_UserDefined} - -macro_rules! body { - ($id:ident) => { { - // `_d` and `d1` are assigned the *same* lifetime by region inference ... - let (_d, d1); - - d1 = $id(1); - // ... we store a reference to `d1` within `_d` ... - _d = $id(&d1); - - // ... a *conservative* dropck will thus complain, because it - // thinks Drop of _d could access the already dropped `d1`. - } } -} - -fn f_send() { body!(D_Send) } -fn f_sized() { body!(D_Sized) } -fn f_sync() { body!(D_Sync) } - -// Issue 24895: Copy: Clone implies `impl Drop for ...` can -// access a user-defined clone() method, which causes this test case -// to fail. -// -// If 24895 is resolved by removing the `Copy: Clone` relationship, -// then this definition and the call below should be uncommented. If -// it is resolved by deciding to keep the `Copy: Clone` relationship, -// then this comment and the associated bits of code can all be -// removed. - -// fn f_copy() { body!(D_Copy) } - -fn f_userdefined() { body!(D_UserDefined) } - -fn main() { - f_send(); - f_sized(); - // See note above regarding Issue 24895. - // f_copy(); - f_sync(); - f_userdefined(); -} diff --git a/src/test/ui/run-pass/issues/issue-2487-a.rs b/src/test/ui/run-pass/issues/issue-2487-a.rs deleted file mode 100644 index ee0ee106076..00000000000 --- a/src/test/ui/run-pass/issues/issue-2487-a.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct socket { - sock: isize, - -} - -impl Drop for socket { - fn drop(&mut self) {} -} - -impl socket { - pub fn set_identity(&self) { - closure(|| setsockopt_bytes(self.sock.clone())) - } -} - -fn socket() -> socket { - socket { - sock: 1 - } -} - -fn closure(f: F) where F: FnOnce() { f() } - -fn setsockopt_bytes(_sock: isize) { } - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-24945-repeat-dash-opts.rs b/src/test/ui/run-pass/issues/issue-24945-repeat-dash-opts.rs deleted file mode 100644 index 5206acb8e94..00000000000 --- a/src/test/ui/run-pass/issues/issue-24945-repeat-dash-opts.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test is just checking that we continue to accept `-g -g -O -O` -// as options to the compiler. - -// compile-flags:-g -g -O -O - -fn main() { - assert_eq!(1, 1); -} diff --git a/src/test/ui/run-pass/issues/issue-24947.rs b/src/test/ui/run-pass/issues/issue-24947.rs deleted file mode 100644 index 91549128447..00000000000 --- a/src/test/ui/run-pass/issues/issue-24947.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #24947 ICE using a trait-associated const in an array size - - -struct Foo; - -impl Foo { - const SIZE: usize = 8; -} - -trait Bar { - const BAR_SIZE: usize; -} - -impl Bar for Foo { - const BAR_SIZE: usize = 12; -} - -#[allow(unused_variables)] -fn main() { - let w: [u8; 12] = [0u8; ::BAR_SIZE]; - let x: [u8; 12] = [0u8; ::BAR_SIZE]; - let y: [u8; 8] = [0u8; ::SIZE]; - let z: [u8; 8] = [0u8; Foo::SIZE]; -} diff --git a/src/test/ui/run-pass/issues/issue-24954.rs b/src/test/ui/run-pass/issues/issue-24954.rs deleted file mode 100644 index e8f135f7f67..00000000000 --- a/src/test/ui/run-pass/issues/issue-24954.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - ($y:expr) => ({ - $y = 2; - }) -} - -#[allow(unused_variables)] -#[allow(unused_assignments)] -fn main() { - let mut x = 1; - foo!(x); -} diff --git a/src/test/ui/run-pass/issues/issue-2502.rs b/src/test/ui/run-pass/issues/issue-2502.rs deleted file mode 100644 index d06f99910a0..00000000000 --- a/src/test/ui/run-pass/issues/issue-2502.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -// pretty-expanded FIXME #23616 - -struct font<'a> { - fontbuf: &'a Vec , -} - -impl<'a> font<'a> { - pub fn buf(&self) -> &'a Vec { - self.fontbuf - } -} - -fn font(fontbuf: &Vec ) -> font { - font { - fontbuf: fontbuf - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-25089.rs b/src/test/ui/run-pass/issues/issue-25089.rs deleted file mode 100644 index e059ac329b4..00000000000 --- a/src/test/ui/run-pass/issues/issue-25089.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -struct Foo(i32); - -impl Drop for Foo { - fn drop(&mut self) { - static mut DROPPED: bool = false; - unsafe { - assert!(!DROPPED); - DROPPED = true; - } - } -} - -struct Empty; - -fn empty() -> Empty { Empty } - -fn should_panic(_: Foo, _: Empty) { - panic!("test panic"); -} - -fn test() { - should_panic(Foo(1), empty()); -} - -fn main() { - let ret = thread::spawn(test).join(); - assert!(ret.is_err()); -} diff --git a/src/test/ui/run-pass/issues/issue-25145.rs b/src/test/ui/run-pass/issues/issue-25145.rs deleted file mode 100644 index 79b1e7c5ef8..00000000000 --- a/src/test/ui/run-pass/issues/issue-25145.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct S; - -impl S { - const N: usize = 3; -} - -static STUFF: [u8; S::N] = [0; S::N]; - -fn main() { - assert_eq!(STUFF, [0; 3]); -} diff --git a/src/test/ui/run-pass/issues/issue-25180.rs b/src/test/ui/run-pass/issues/issue-25180.rs deleted file mode 100644 index edfa369ed46..00000000000 --- a/src/test/ui/run-pass/issues/issue-25180.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -const x: &'static Fn() = &|| println!("ICE here"); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-25185.rs b/src/test/ui/run-pass/issues/issue-25185.rs deleted file mode 100644 index 764cfdc187a..00000000000 --- a/src/test/ui/run-pass/issues/issue-25185.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-25185-1.rs -// aux-build:issue-25185-2.rs -// ignore-wasm32-bare no libc for ffi testing - -extern crate issue_25185_2; - -fn main() { - let x = unsafe { - issue_25185_2::rust_dbg_extern_identity_u32(1) - }; - assert_eq!(x, 1); -} diff --git a/src/test/ui/run-pass/issues/issue-2526-a.rs b/src/test/ui/run-pass/issues/issue-2526-a.rs deleted file mode 100644 index 210ad831859..00000000000 --- a/src/test/ui/run-pass/issues/issue-2526-a.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-2526.rs - -// pretty-expanded FIXME #23616 - -#![allow(unused_imports)] - -extern crate issue_2526; -use issue_2526::*; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-25279.rs b/src/test/ui/run-pass/issues/issue-25279.rs deleted file mode 100644 index 47714cef2d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-25279.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S<'a>(&'a ()); - -impl<'a> S<'a> { - fn foo(self) -> &'a () { - ::bar(self) - } - - fn bar(self) -> &'a () { - self.0 - } -} - -fn main() { - S(&()).foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-25339.rs b/src/test/ui/run-pass/issues/issue-25339.rs deleted file mode 100644 index 279a8865377..00000000000 --- a/src/test/ui/run-pass/issues/issue-25339.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(associated_type_defaults)] - -use std::marker::PhantomData; - -pub trait Routing { - type Output; - fn resolve(&self, input: I); -} - -pub trait ToRouting { - type Input; - type Routing : ?Sized = Routing; - fn to_routing(self) -> Self::Routing; -} - -pub struct Mount> { - action: R, - _marker: PhantomData -} - -impl> Mount { - pub fn create>(mount: &str, input: T) { - input.to_routing(); - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-25343.rs b/src/test/ui/run-pass/issues/issue-25343.rs deleted file mode 100644 index 40e9924e5d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-25343.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[allow(unused)] -fn main() { - || { - 'label: loop { - } - }; - - // More cases added from issue 31754 - - 'label2: loop { - break; - } - - let closure = || { - 'label2: loop {} - }; - - fn inner_fn() { - 'label2: loop {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-25394.rs b/src/test/ui/run-pass/issues/issue-25394.rs deleted file mode 100644 index df1fe399a4a..00000000000 --- a/src/test/ui/run-pass/issues/issue-25394.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct Row([T]); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-25467.rs b/src/test/ui/run-pass/issues/issue-25467.rs deleted file mode 100644 index 37ce124e132..00000000000 --- a/src/test/ui/run-pass/issues/issue-25467.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-25467.rs - -pub type Issue25467BarT = (); -pub type Issue25467FooT = (); - -extern crate issue_25467 as aux; - -fn main() { - let o: aux::Object = None; -} diff --git a/src/test/ui/run-pass/issues/issue-25497.rs b/src/test/ui/run-pass/issues/issue-25497.rs deleted file mode 100644 index ab5a0bf92f0..00000000000 --- a/src/test/ui/run-pass/issues/issue-25497.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Clone, Debug, PartialEq)] -enum Expression { - Dummy, - Add(Box), -} - -use Expression::*; - -fn simplify(exp: Expression) -> Expression { - match exp { - Add(n) => *n.clone(), - _ => Dummy - } -} - -fn main() { - assert_eq!(simplify(Add(Box::new(Dummy))), Dummy); -} diff --git a/src/test/ui/run-pass/issues/issue-2550.rs b/src/test/ui/run-pass/issues/issue-2550.rs deleted file mode 100644 index 0552e97e642..00000000000 --- a/src/test/ui/run-pass/issues/issue-2550.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// pretty-expanded FIXME #23616 - -struct C { - x: usize, -} - -fn C(x: usize) -> C { - C { - x: x - } -} - -fn f(_x: T) { -} - -pub fn main() { - f(C(1)); -} diff --git a/src/test/ui/run-pass/issues/issue-25515.rs b/src/test/ui/run-pass/issues/issue-25515.rs deleted file mode 100644 index 03ad360bcd3..00000000000 --- a/src/test/ui/run-pass/issues/issue-25515.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::rc::Rc; - -struct Foo<'r>(&'r mut i32); - -impl<'r> Drop for Foo<'r> { - fn drop(&mut self) { - *self.0 += 1; - } -} - -fn main() { - let mut drops = 0; - - { - let _: Rc = Rc::new(Foo(&mut drops)); - } - - assert_eq!(1, drops); -} diff --git a/src/test/ui/run-pass/issues/issue-25549-multiple-drop.rs b/src/test/ui/run-pass/issues/issue-25549-multiple-drop.rs deleted file mode 100644 index 24f44f2ecba..00000000000 --- a/src/test/ui/run-pass/issues/issue-25549-multiple-drop.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo<'r>(&'r mut i32); - -impl<'r> Drop for Foo<'r> { - fn drop(&mut self) { - *self.0 += 1; - } -} - -trait Trait {} -impl<'r> Trait for Foo<'r> {} - -struct Holder(T); - -fn main() { - let mut drops = 0; - - { - let y = &Holder([Foo(&mut drops)]) as &Holder<[Foo]>; - // this used to cause an extra drop of the Foo instance - let x = &y.0; - } - assert_eq!(1, drops); - - drops = 0; - { - let y = &Holder(Foo(&mut drops)) as &Holder; - // this used to cause an extra drop of the Foo instance - let x = &y.0; - } - assert_eq!(1, drops); -} diff --git a/src/test/ui/run-pass/issues/issue-25679.rs b/src/test/ui/run-pass/issues/issue-25679.rs deleted file mode 100644 index 29e4b44592f..00000000000 --- a/src/test/ui/run-pass/issues/issue-25679.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Device { - type Resources; -} -struct Foo(D, R); - -impl Foo { - fn present(&self) {} -} - -struct Res; -struct Dev; - -impl Device for Dev { type Resources = Res; } - -fn main() { - let foo = Foo(Dev, Res); - foo.present(); -} diff --git a/src/test/ui/run-pass/issues/issue-25693.rs b/src/test/ui/run-pass/issues/issue-25693.rs deleted file mode 100644 index 86fe6c08147..00000000000 --- a/src/test/ui/run-pass/issues/issue-25693.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Parameters { type SelfRef; } - -struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> } -struct BP; - -impl<'a> Parameters for RP<'a> { type SelfRef = &'a X>; } -impl Parameters for BP { type SelfRef = Box>; } - -pub struct Y; -pub enum X { - Nothing, - SameAgain(P::SelfRef, Y) -} - -fn main() { - let bnil: Box> = Box::new(X::Nothing); - let bx: Box> = Box::new(X::SameAgain(bnil, Y)); - let rnil: X = X::Nothing; - let rx: X = X::SameAgain(&rnil, Y); -} diff --git a/src/test/ui/run-pass/issues/issue-25700-1.rs b/src/test/ui/run-pass/issues/issue-25700-1.rs deleted file mode 100644 index f1109ac93cd..00000000000 --- a/src/test/ui/run-pass/issues/issue-25700-1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S(Option<&'static T>); - -trait Tr { type Out; } -impl Tr for T { type Out = T; } - -impl Copy for S where S: Tr {} -impl Clone for S where S: Tr { - fn clone(&self) -> Self { *self } -} -fn main() { - S::<()>(None); -} diff --git a/src/test/ui/run-pass/issues/issue-25700-2.rs b/src/test/ui/run-pass/issues/issue-25700-2.rs deleted file mode 100644 index 99c381042bf..00000000000 --- a/src/test/ui/run-pass/issues/issue-25700-2.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Parser { - type Input; -} - -pub struct Iter(P, P::Input); - -pub struct Map(P, F); -impl Parser for Map where F: FnMut(P) { - type Input = u8; -} - -trait AstId { type Untyped; } -impl AstId for u32 { type Untyped = u32; } - -fn record_type(i: Id::Untyped) -> u8 { - Iter(Map(i, |_: Id::Untyped| {}), 42).1 -} - -pub fn main() { - assert_eq!(record_type::(3), 42); -} diff --git a/src/test/ui/run-pass/issues/issue-25746-bool-transmute.rs b/src/test/ui/run-pass/issues/issue-25746-bool-transmute.rs deleted file mode 100644 index da63bc61607..00000000000 --- a/src/test/ui/run-pass/issues/issue-25746-bool-transmute.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem::transmute; - -fn main() { - unsafe { - let _: i8 = transmute(false); - let _: i8 = transmute(true); - let _: bool = transmute(0u8); - let _: bool = transmute(1u8); - } -} diff --git a/src/test/ui/run-pass/issues/issue-25757.rs b/src/test/ui/run-pass/issues/issue-25757.rs deleted file mode 100644 index f2fbef2c581..00000000000 --- a/src/test/ui/run-pass/issues/issue-25757.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - a: u32 -} - -impl Foo { - fn x(&mut self) { - self.a = 5; - } -} - -const FUNC: &'static Fn(&mut Foo) -> () = &Foo::x; - -fn main() { - let mut foo = Foo { a: 137 }; - FUNC(&mut foo); - assert_eq!(foo.a, 5); -} diff --git a/src/test/ui/run-pass/issues/issue-25810.rs b/src/test/ui/run-pass/issues/issue-25810.rs deleted file mode 100644 index 986ba48d4b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-25810.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let x = X(15); - let y = x.foo(); - println!("{:?}",y); -} - -trait Foo - where for<'a> &'a Self: Bar -{ - fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output; -} - -trait Bar { - type Output; -} - -struct X(i32); - -impl<'a> Bar for &'a X { - type Output = &'a i32; -} - -impl Foo for X { - fn foo<'a>(&'a self) -> <&'a Self as Bar>::Output { - &self.0 - } -} diff --git a/src/test/ui/run-pass/issues/issue-25916.rs b/src/test/ui/run-pass/issues/issue-25916.rs deleted file mode 100644 index cf8753119bf..00000000000 --- a/src/test/ui/run-pass/issues/issue-25916.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - macro_rules! f { - () => { 0 + 0 } - } - // 16 per line - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); - f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!();f!(); -} diff --git a/src/test/ui/run-pass/issues/issue-26095.rs b/src/test/ui/run-pass/issues/issue-26095.rs deleted file mode 100644 index 0c6bc7c4885..00000000000 --- a/src/test/ui/run-pass/issues/issue-26095.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - - -trait HasNumber { - const Number: usize; -} - -enum One {} -enum Two {} - -enum Foo {} - -impl HasNumber for One { - const Number: usize = 1; -} - -impl HasNumber for Two { - const Number: usize = 2; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2611-3.rs b/src/test/ui/run-pass/issues/issue-2611-3.rs deleted file mode 100644 index 4b66aa48a5b..00000000000 --- a/src/test/ui/run-pass/issues/issue-2611-3.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that impls are allowed to have looser, more permissive bounds -// than the traits require. - - -trait A { - fn b(&self, x: C) -> C; -} - -struct E { - f: isize -} - -impl A for E { - fn b(&self, _x: F) -> F { panic!() } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-26127.rs b/src/test/ui/run-pass/issues/issue-26127.rs deleted file mode 100644 index c2634ed5690..00000000000 --- a/src/test/ui/run-pass/issues/issue-26127.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Tr { type T; } -impl Tr for u8 { type T=(); } -struct S(I::T); - -fn foo(i: I::T) { - S::(i); -} - -fn main() { - foo::(()); -} diff --git a/src/test/ui/run-pass/issues/issue-26205.rs b/src/test/ui/run-pass/issues/issue-26205.rs deleted file mode 100644 index e015acfdc2a..00000000000 --- a/src/test/ui/run-pass/issues/issue-26205.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::{Deref, DerefMut}; - -struct Foo; - -impl Foo { - fn foo_mut(&mut self) {} -} - -struct Bar(Foo); - -impl Deref for Bar { - type Target = Foo; - - fn deref(&self) -> &Foo { - &self.0 - } -} - -impl DerefMut for Bar { - fn deref_mut(&mut self) -> &mut Foo { - &mut self.0 - } -} - -fn test(mut bar: Box) { - bar.foo_mut(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-26251.rs b/src/test/ui/run-pass/issues/issue-26251.rs deleted file mode 100644 index 20ad091695a..00000000000 --- a/src/test/ui/run-pass/issues/issue-26251.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let x = 'a'; - - let y = match x { - 'a'..='b' if false => "one", - 'a' => "two", - 'a'..='b' => "three", - _ => panic!("what?"), - }; - - assert_eq!(y, "two"); -} diff --git a/src/test/ui/run-pass/issues/issue-2631-b.rs b/src/test/ui/run-pass/issues/issue-2631-b.rs deleted file mode 100644 index d53741b470e..00000000000 --- a/src/test/ui/run-pass/issues/issue-2631-b.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:issue-2631-a.rs - -extern crate req; - -use req::request; -use std::cell::RefCell; -use std::collections::HashMap; -use std::rc::Rc; - -pub fn main() { - let v = vec![Rc::new("hi".to_string())]; - let mut m: req::header_map = HashMap::new(); - m.insert("METHOD".to_string(), Rc::new(RefCell::new(v))); - request::(&m); -} diff --git a/src/test/ui/run-pass/issues/issue-26322.rs b/src/test/ui/run-pass/issues/issue-26322.rs deleted file mode 100644 index 23f6a739bd5..00000000000 --- a/src/test/ui/run-pass/issues/issue-26322.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -macro_rules! columnline { - () => ( - (column!(), line!()) - ) -} - -macro_rules! indirectcolumnline { - () => ( - (||{ columnline!() })() - ) -} - -fn main() { - let closure = || { - columnline!() - }; - let iflet = if let Some(_) = Some(0) { - columnline!() - } else { (0, 0) }; - let cl = columnline!(); - assert_eq!(closure(), (9, 29)); - assert_eq!(iflet, (9, 32)); - assert_eq!(cl, (14, 34)); - let indirect = indirectcolumnline!(); - assert_eq!(indirect, (20, 38)); -} diff --git a/src/test/ui/run-pass/issues/issue-2633-2.rs b/src/test/ui/run-pass/issues/issue-2633-2.rs deleted file mode 100644 index ffc2b6a32a5..00000000000 --- a/src/test/ui/run-pass/issues/issue-2633-2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - - -fn a_val(x: Box, y: Box) -> isize { - *x + *y -} - -pub fn main() { - let z: Box<_> = box 22; - a_val(z.clone(), z.clone()); -} diff --git a/src/test/ui/run-pass/issues/issue-2633.rs b/src/test/ui/run-pass/issues/issue-2633.rs deleted file mode 100644 index c02c4e7b9d6..00000000000 --- a/src/test/ui/run-pass/issues/issue-2633.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#[derive(Copy, Clone)] -struct cat { - meow: extern "Rust" fn(), -} - -fn meow() { - println!("meow") -} - -fn cat() -> cat { - cat { - meow: meow, - } -} - -#[derive(Copy, Clone)] -struct KittyInfo {kitty: cat} - -// Code compiles and runs successfully if we add a + before the first arg -fn nyan(kitty: cat, _kitty_info: KittyInfo) { - (kitty.meow)(); -} - -pub fn main() { - let kitty = cat(); - nyan(kitty, KittyInfo {kitty: kitty}); -} diff --git a/src/test/ui/run-pass/issues/issue-2642.rs b/src/test/ui/run-pass/issues/issue-2642.rs deleted file mode 100644 index c900fa7b42c..00000000000 --- a/src/test/ui/run-pass/issues/issue-2642.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn f() { - let _x: usize = loop { loop { break; } }; -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-26468.rs b/src/test/ui/run-pass/issues/issue-26468.rs deleted file mode 100644 index 2c9a48802a6..00000000000 --- a/src/test/ui/run-pass/issues/issue-26468.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -enum FooMode { - Check = 0x1001, -} - -enum BarMode { - Check = 0x2001, -} - -enum Mode { - Foo(FooMode), - Bar(BarMode), -} - -#[inline(never)] -fn broken(mode: &Mode) -> u32 { - for _ in 0..1 { - if let Mode::Foo(FooMode::Check) = *mode { return 17 } - if let Mode::Bar(BarMode::Check) = *mode { return 19 } - } - return 42; -} - -fn main() { - let mode = Mode::Bar(BarMode::Check); - assert_eq!(broken(&mode), 19); -} diff --git a/src/test/ui/run-pass/issues/issue-26484.rs b/src/test/ui/run-pass/issues/issue-26484.rs deleted file mode 100644 index 66fb1df1675..00000000000 --- a/src/test/ui/run-pass/issues/issue-26484.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:-g - -fn helper bool>(_f: F) { - print!(""); -} - -fn main() { - let cond = 0; - helper(|v| v == cond) -} diff --git a/src/test/ui/run-pass/issues/issue-26641.rs b/src/test/ui/run-pass/issues/issue-26641.rs deleted file mode 100644 index 90c2243222c..00000000000 --- a/src/test/ui/run-pass/issues/issue-26641.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Parser<'a>(Box); - -fn main() { - let _x = Parser(Box::new(|_|{})); -} diff --git a/src/test/ui/run-pass/issues/issue-26646.rs b/src/test/ui/run-pass/issues/issue-26646.rs deleted file mode 100644 index 05602f7504e..00000000000 --- a/src/test/ui/run-pass/issues/issue-26646.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(unused_attributes)] - -#[repr(C)] -#[repr(packed)] -pub struct Foo; - -#[repr(packed)] -#[repr(C)] -pub struct Bar; - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-26655.rs b/src/test/ui/run-pass/issues/issue-26655.rs deleted file mode 100644 index db373f2cc8d..00000000000 --- a/src/test/ui/run-pass/issues/issue-26655.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -// Check that the destructors of simple enums are run on unwinding - -use std::sync::atomic::{Ordering, AtomicUsize}; -use std::thread; - -static LOG: AtomicUsize = AtomicUsize::new(0); - -enum WithDtor { Val } -impl Drop for WithDtor { - fn drop(&mut self) { - LOG.store(LOG.load(Ordering::SeqCst)+1,Ordering::SeqCst); - } -} - -pub fn main() { - thread::spawn(move|| { - let _e: WithDtor = WithDtor::Val; - panic!("fail"); - }).join().unwrap_err(); - - assert_eq!(LOG.load(Ordering::SeqCst), 1); -} diff --git a/src/test/ui/run-pass/issues/issue-26709.rs b/src/test/ui/run-pass/issues/issue-26709.rs deleted file mode 100644 index f8f20405a3d..00000000000 --- a/src/test/ui/run-pass/issues/issue-26709.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Wrapper<'a, T: ?Sized>(&'a mut i32, T); - -impl<'a, T: ?Sized> Drop for Wrapper<'a, T> { - fn drop(&mut self) { - *self.0 = 432; - } -} - -fn main() { - let mut x = 0; - { - let wrapper = Box::new(Wrapper(&mut x, 123)); - let _: Box> = wrapper; - } - assert_eq!(432, x) -} diff --git a/src/test/ui/run-pass/issues/issue-26802.rs b/src/test/ui/run-pass/issues/issue-26802.rs deleted file mode 100644 index 85d4e4a3f9f..00000000000 --- a/src/test/ui/run-pass/issues/issue-26802.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo<'a> { - fn bar<'b>(&self, x: &'b u8) -> u8 where 'a: 'b { *x+7 } -} - -pub struct FooBar; -impl Foo<'static> for FooBar {} -fn test(foobar: FooBar) -> Box> { - Box::new(foobar) -} - -fn main() { - assert_eq!(test(FooBar).bar(&4), 11); -} diff --git a/src/test/ui/run-pass/issues/issue-26805.rs b/src/test/ui/run-pass/issues/issue-26805.rs deleted file mode 100644 index 0459c654458..00000000000 --- a/src/test/ui/run-pass/issues/issue-26805.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct NonOrd; - -fn main() { - let _: Box> = Box::new(vec![NonOrd].into_iter()); -} diff --git a/src/test/ui/run-pass/issues/issue-26873-multifile.rs b/src/test/ui/run-pass/issues/issue-26873-multifile.rs deleted file mode 100644 index c557c0698d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-26873-multifile.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// ignore-pretty issue #37195 - -mod issue_26873_multifile; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-26873-onefile.rs b/src/test/ui/run-pass/issues/issue-26873-onefile.rs deleted file mode 100644 index 005491ecc58..00000000000 --- a/src/test/ui/run-pass/issues/issue-26873-onefile.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -mod A { - pub mod B { - use super::*; - - pub struct S; - } - - pub mod C { - use super::*; - use super::B::S; - - pub struct T; - } - - pub use self::C::T; -} - -use A::*; - -fn main() {} - diff --git a/src/test/ui/run-pass/issues/issue-26905.rs b/src/test/ui/run-pass/issues/issue-26905.rs deleted file mode 100644 index ec0f6b15a34..00000000000 --- a/src/test/ui/run-pass/issues/issue-26905.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(unsize, coerce_unsized)] - -// Verfies that PhantomData is ignored for DST coercions - -use std::marker::{Unsize, PhantomData}; -use std::ops::CoerceUnsized; - -struct MyRc { - _ptr: *const T, - _boo: PhantomData, -} - -impl, U: ?Sized> CoerceUnsized> for MyRc{ } - -fn main() { - let data = [1, 2, 3]; - let iter = data.iter(); - let x = MyRc { _ptr: &iter, _boo: PhantomData }; - let _y: MyRc> = x; -} - diff --git a/src/test/ui/run-pass/issues/issue-26996.rs b/src/test/ui/run-pass/issues/issue-26996.rs deleted file mode 100644 index 8d53b739da2..00000000000 --- a/src/test/ui/run-pass/issues/issue-26996.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let mut c = (1, "".to_owned()); - match c { - c2 => { - c.0 = 2; - assert_eq!(c2.0, 1); - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-26997.rs b/src/test/ui/run-pass/issues/issue-26997.rs deleted file mode 100644 index e6d0ef14431..00000000000 --- a/src/test/ui/run-pass/issues/issue-26997.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Foo { - x: isize, - y: isize -} - -impl Foo { - pub extern fn foo_new() -> Foo { - Foo { x: 21, y: 33 } - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-27021.rs b/src/test/ui/run-pass/issues/issue-27021.rs deleted file mode 100644 index addeebe9def..00000000000 --- a/src/test/ui/run-pass/issues/issue-27021.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let mut c = (1, (1, "".to_owned())); - match c { - c2 => { (c.1).0 = 2; assert_eq!((c2.1).0, 1); } - } - - let mut c = (1, (1, (1, "".to_owned()))); - match c.1 { - c2 => { ((c.1).1).0 = 3; assert_eq!((c2.1).0, 1); } - } -} diff --git a/src/test/ui/run-pass/issues/issue-27054-primitive-binary-ops.rs b/src/test/ui/run-pass/issues/issue-27054-primitive-binary-ops.rs deleted file mode 100644 index cd7e94a2352..00000000000 --- a/src/test/ui/run-pass/issues/issue-27054-primitive-binary-ops.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let x = &mut 1; - assert_eq!(*x + { *x=2; 1 }, 2); -} diff --git a/src/test/ui/run-pass/issues/issue-27060.rs b/src/test/ui/run-pass/issues/issue-27060.rs deleted file mode 100644 index 594edb3fd71..00000000000 --- a/src/test/ui/run-pass/issues/issue-27060.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[repr(packed)] -pub struct Good { - data: &'static u32, - data2: [&'static u32; 2], - aligned: [u8; 32], -} - -#[repr(packed)] -pub struct JustArray { - array: [u32] -} - -// kill this test when that turns to a hard error -#[allow(safe_packed_borrows)] -fn main() { - let good = Good { - data: &0, - data2: [&0, &0], - aligned: [0; 32] - }; - - unsafe { - let _ = &good.data; // ok - let _ = &good.data2[0]; // ok - } - - let _ = &good.data; - let _ = &good.data2[0]; - let _ = &*good.data; // ok, behind a pointer - let _ = &good.aligned; // ok, has align 1 - let _ = &good.aligned[2]; // ok, has align 1 -} diff --git a/src/test/ui/run-pass/issues/issue-2708.rs b/src/test/ui/run-pass/issues/issue-2708.rs deleted file mode 100644 index 5fccdb0f137..00000000000 --- a/src/test/ui/run-pass/issues/issue-2708.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -struct Font { - fontbuf: usize, - cairo_font: usize, - font_dtor: usize, - -} - -impl Drop for Font { - fn drop(&mut self) {} -} - -fn Font() -> Font { - Font { - fontbuf: 0, - cairo_font: 0, - font_dtor: 0 - } -} - -pub fn main() { - let _f: Box<_> = box Font(); -} diff --git a/src/test/ui/run-pass/issues/issue-27105.rs b/src/test/ui/run-pass/issues/issue-27105.rs deleted file mode 100644 index e565acde2f0..00000000000 --- a/src/test/ui/run-pass/issues/issue-27105.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cell::RefCell; -use std::rc::Rc; - -pub struct Callbacks { - callbacks: Vec>>, -} - -impl Callbacks { - pub fn register(&mut self, callback: F) { - self.callbacks.push(Rc::new(RefCell::new(callback))); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2718.rs b/src/test/ui/run-pass/issues/issue-2718.rs deleted file mode 100644 index 1c5e7c7333d..00000000000 --- a/src/test/ui/run-pass/issues/issue-2718.rs +++ /dev/null @@ -1,334 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -pub type Task = isize; - -// tjc: I don't know why -pub mod pipes { - use self::state::{empty, full, blocked, terminated}; - use super::Task; - use std::mem::{forget, transmute}; - use std::mem::{replace, swap}; - use std::mem; - use std::thread; - use std::marker::Send; - - pub struct Stuff { - state: state, - blocked_task: Option, - payload: Option - } - - #[derive(PartialEq, Debug)] - #[repr(isize)] - pub enum state { - empty, - full, - blocked, - terminated - } - - pub struct packet { - state: state, - blocked_task: Option, - payload: Option - } - - unsafe impl Send for packet {} - - pub fn packet() -> *const packet { - unsafe { - let p: *const packet = mem::transmute(Box::new(Stuff{ - state: empty, - blocked_task: None::, - payload: None:: - })); - p - } - } - - mod rusti { - pub fn atomic_xchg(_dst: &mut isize, _src: isize) -> isize { panic!(); } - pub fn atomic_xchg_acq(_dst: &mut isize, _src: isize) -> isize { panic!(); } - pub fn atomic_xchg_rel(_dst: &mut isize, _src: isize) -> isize { panic!(); } - } - - // We should consider moving this to ::std::unsafe, although I - // suspect graydon would want us to use void pointers instead. - pub unsafe fn uniquify(x: *const T) -> Box { - mem::transmute(x) - } - - pub fn swap_state_acq(dst: &mut state, src: state) -> state { - unsafe { - transmute(rusti::atomic_xchg_acq(transmute(dst), src as isize)) - } - } - - pub fn swap_state_rel(dst: &mut state, src: state) -> state { - unsafe { - transmute(rusti::atomic_xchg_rel(transmute(dst), src as isize)) - } - } - - pub fn send(mut p: send_packet, payload: T) { - let p = p.unwrap(); - let mut p = unsafe { uniquify(p) }; - assert!((*p).payload.is_none()); - (*p).payload = Some(payload); - let old_state = swap_state_rel(&mut (*p).state, full); - match old_state { - empty => { - // Yay, fastpath. - - // The receiver will eventually clean this up. - unsafe { forget(p); } - } - full => { panic!("duplicate send") } - blocked => { - - // The receiver will eventually clean this up. - unsafe { forget(p); } - } - terminated => { - // The receiver will never receive this. Rely on drop_glue - // to clean everything up. - } - } - } - - pub fn recv(mut p: recv_packet) -> Option { - let p = p.unwrap(); - let mut p = unsafe { uniquify(p) }; - loop { - let old_state = swap_state_acq(&mut (*p).state, - blocked); - match old_state { - empty | blocked => { thread::yield_now(); } - full => { - let payload = replace(&mut p.payload, None); - return Some(payload.unwrap()) - } - terminated => { - assert_eq!(old_state, terminated); - return None; - } - } - } - } - - pub fn sender_terminate(p: *const packet) { - let mut p = unsafe { uniquify(p) }; - match swap_state_rel(&mut (*p).state, terminated) { - empty | blocked => { - // The receiver will eventually clean up. - unsafe { forget(p) } - } - full => { - // This is impossible - panic!("you dun goofed") - } - terminated => { - // I have to clean up, use drop_glue - } - } - } - - pub fn receiver_terminate(p: *const packet) { - let mut p = unsafe { uniquify(p) }; - match swap_state_rel(&mut (*p).state, terminated) { - empty => { - // the sender will clean up - unsafe { forget(p) } - } - blocked => { - // this shouldn't happen. - panic!("terminating a blocked packet") - } - terminated | full => { - // I have to clean up, use drop_glue - } - } - } - - pub struct send_packet { - p: Option<*const packet>, - } - - impl Drop for send_packet { - fn drop(&mut self) { - unsafe { - if self.p != None { - let self_p: &mut Option<*const packet> = - mem::transmute(&mut self.p); - let p = replace(self_p, None); - sender_terminate(p.unwrap()) - } - } - } - } - - impl send_packet { - pub fn unwrap(&mut self) -> *const packet { - replace(&mut self.p, None).unwrap() - } - } - - pub fn send_packet(p: *const packet) -> send_packet { - send_packet { - p: Some(p) - } - } - - pub struct recv_packet { - p: Option<*const packet>, - } - - impl Drop for recv_packet { - fn drop(&mut self) { - unsafe { - if self.p != None { - let self_p: &mut Option<*const packet> = - mem::transmute(&mut self.p); - let p = replace(self_p, None); - receiver_terminate(p.unwrap()) - } - } - } - } - - impl recv_packet { - pub fn unwrap(&mut self) -> *const packet { - replace(&mut self.p, None).unwrap() - } - } - - pub fn recv_packet(p: *const packet) -> recv_packet { - recv_packet { - p: Some(p) - } - } - - pub fn entangle() -> (send_packet, recv_packet) { - let p = packet(); - (send_packet(p), recv_packet(p)) - } -} - -pub mod pingpong { - use std::mem; - - pub struct ping(::pipes::send_packet); - - unsafe impl Send for ping {} - - pub struct pong(::pipes::send_packet); - - unsafe impl Send for pong {} - - pub fn liberate_ping(p: ping) -> ::pipes::send_packet { - unsafe { - let _addr : *const ::pipes::send_packet = match &p { - &ping(ref x) => { mem::transmute(x) } - }; - panic!() - } - } - - pub fn liberate_pong(p: pong) -> ::pipes::send_packet { - unsafe { - let _addr : *const ::pipes::send_packet = match &p { - &pong(ref x) => { mem::transmute(x) } - }; - panic!() - } - } - - pub fn init() -> (client::ping, server::ping) { - ::pipes::entangle() - } - - pub mod client { - use pingpong; - - pub type ping = ::pipes::send_packet; - pub type pong = ::pipes::recv_packet; - - pub fn do_ping(c: ping) -> pong { - let (sp, rp) = ::pipes::entangle(); - - ::pipes::send(c, pingpong::ping(sp)); - rp - } - - pub fn do_pong(c: pong) -> (ping, ()) { - let packet = ::pipes::recv(c); - if packet.is_none() { - panic!("sender closed the connection") - } - (pingpong::liberate_pong(packet.unwrap()), ()) - } - } - - pub mod server { - use pingpong; - - pub type ping = ::pipes::recv_packet; - pub type pong = ::pipes::send_packet; - - pub fn do_ping(c: ping) -> (pong, ()) { - let packet = ::pipes::recv(c); - if packet.is_none() { - panic!("sender closed the connection") - } - (pingpong::liberate_ping(packet.unwrap()), ()) - } - - pub fn do_pong(c: pong) -> ping { - let (sp, rp) = ::pipes::entangle(); - ::pipes::send(c, pingpong::pong(sp)); - rp - } - } -} - -fn client(chan: pingpong::client::ping) { - let chan = pingpong::client::do_ping(chan); - println!("Sent ping"); - let (_chan, _data) = pingpong::client::do_pong(chan); - println!("Received pong"); -} - -fn server(chan: pingpong::server::ping) { - let (chan, _data) = pingpong::server::do_ping(chan); - println!("Received ping"); - let _chan = pingpong::server::do_pong(chan); - println!("Sent pong"); -} - -pub fn main() { - /* -// Commented out because of option::get error - - let (client_, server_) = pingpong::init(); - - task::spawn {|client_| - let client__ = client_.take(); - client(client__); - }; - task::spawn {|server_| - let server__ = server_.take(); - server(server_ËŠ); - }; - */ -} diff --git a/src/test/ui/run-pass/issues/issue-2723-b.rs b/src/test/ui/run-pass/issues/issue-2723-b.rs deleted file mode 100644 index 34f5238cc80..00000000000 --- a/src/test/ui/run-pass/issues/issue-2723-b.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_2723_a.rs - -extern crate issue_2723_a; -use issue_2723_a::f; - -pub fn main() { - unsafe { - f(vec![2]); - } -} diff --git a/src/test/ui/run-pass/issues/issue-27240.rs b/src/test/ui/run-pass/issues/issue-27240.rs deleted file mode 100644 index 5e65a8084c3..00000000000 --- a/src/test/ui/run-pass/issues/issue-27240.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt; -struct NoisyDrop(T); -impl Drop for NoisyDrop { - fn drop(&mut self) {} -} - -struct Bar([*const NoisyDrop; 2]); - -fn fine() { - let (u,b); - u = vec![43]; - b = Bar([&NoisyDrop(&u), &NoisyDrop(&u)]); -} - -struct Bar2(*const NoisyDrop, *const NoisyDrop); - -fn lolwut() { - let (u,v); - u = vec![43]; - v = Bar2(&NoisyDrop(&u), &NoisyDrop(&u)); -} - -fn main() { fine(); lolwut() } diff --git a/src/test/ui/run-pass/issues/issue-27268.rs b/src/test/ui/run-pass/issues/issue-27268.rs deleted file mode 100644 index fa23241a25b..00000000000 --- a/src/test/ui/run-pass/issues/issue-27268.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - const _C: &'static Fn() = &||{}; -} diff --git a/src/test/ui/run-pass/issues/issue-27281.rs b/src/test/ui/run-pass/issues/issue-27281.rs deleted file mode 100644 index 1dc4ac5cdcc..00000000000 --- a/src/test/ui/run-pass/issues/issue-27281.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Trait<'a> { - type T; - type U; - fn foo(&self, s: &'a ()) -> &'a (); -} - -impl<'a> Trait<'a> for () { - type T = &'a (); - type U = Self::T; - - fn foo(&self, s: &'a ()) -> &'a () { - let t: Self::T = s; t - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-27320.rs b/src/test/ui/run-pass/issues/issue-27320.rs deleted file mode 100644 index e5df3ccd76e..00000000000 --- a/src/test/ui/run-pass/issues/issue-27320.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_variables)] -#![allow(dead_code)] - -macro_rules! piece( - ($piece:pat) => ($piece); -); - -enum Piece {A, B} - -fn main() { - match Piece::A { - piece!(pt@ Piece::A) | piece!(pt@ Piece::B) => {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-2734.rs b/src/test/ui/run-pass/issues/issue-2734.rs deleted file mode 100644 index e3b1618c625..00000000000 --- a/src/test/ui/run-pass/issues/issue-2734.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -trait hax { - fn dummy(&self) { } -} -impl hax for A { } - -fn perform_hax(x: Box) -> Box { - box x as Box -} - -fn deadcode() { - perform_hax(box "deadcode".to_string()); -} - -pub fn main() { - let _ = perform_hax(box 42); -} diff --git a/src/test/ui/run-pass/issues/issue-2735-2.rs b/src/test/ui/run-pass/issues/issue-2735-2.rs deleted file mode 100644 index a8e81682ada..00000000000 --- a/src/test/ui/run-pass/issues/issue-2735-2.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -// This test should behave exactly like issue-2735-3 -struct defer<'a> { - b: &'a Cell, -} - -impl<'a> Drop for defer<'a> { - fn drop(&mut self) { - self.b.set(true); - } -} - -fn defer(b: &Cell) -> defer { - defer { - b: b - } -} - -pub fn main() { - let dtor_ran = &Cell::new(false); - let _ = defer(dtor_ran); - assert!(dtor_ran.get()); -} diff --git a/src/test/ui/run-pass/issues/issue-2735-3.rs b/src/test/ui/run-pass/issues/issue-2735-3.rs deleted file mode 100644 index 9b8c2a5142f..00000000000 --- a/src/test/ui/run-pass/issues/issue-2735-3.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -// This test should behave exactly like issue-2735-2 -struct defer<'a> { - b: &'a Cell, -} - -impl<'a> Drop for defer<'a> { - fn drop(&mut self) { - self.b.set(true); - } -} - -fn defer(b: &Cell) -> defer { - defer { - b: b - } -} - -pub fn main() { - let dtor_ran = &Cell::new(false); - defer(dtor_ran); - assert!(dtor_ran.get()); -} diff --git a/src/test/ui/run-pass/issues/issue-2735.rs b/src/test/ui/run-pass/issues/issue-2735.rs deleted file mode 100644 index b22051700d8..00000000000 --- a/src/test/ui/run-pass/issues/issue-2735.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -trait hax { - fn dummy(&self) { } -} -impl hax for A { } - -fn perform_hax(x: Box) -> Box { - box x as Box -} - -fn deadcode() { - perform_hax(box "deadcode".to_string()); -} - -pub fn main() { - perform_hax(box 42); -} diff --git a/src/test/ui/run-pass/issues/issue-27401-dropflag-reinit.rs b/src/test/ui/run-pass/issues/issue-27401-dropflag-reinit.rs deleted file mode 100644 index d72c8309a5f..00000000000 --- a/src/test/ui/run-pass/issues/issue-27401-dropflag-reinit.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37201 - -// Check that when a `let`-binding occurs in a loop, its associated -// drop-flag is reinitialized (to indicate "needs-drop" at the end of -// the owning variable's scope). - -struct A<'a>(&'a mut i32); - -impl<'a> Drop for A<'a> { - fn drop(&mut self) { - *self.0 += 1; - } -} - -fn main() { - let mut cnt = 0; - for i in 0..2 { - let a = A(&mut cnt); - if i == 1 { // Note that - break; // both this break - } // and also - drop(a); // this move of `a` - // are necessary to expose the bug - } - assert_eq!(cnt, 2); -} diff --git a/src/test/ui/run-pass/issues/issue-2748-a.rs b/src/test/ui/run-pass/issues/issue-2748-a.rs deleted file mode 100644 index 9d84e2dccbc..00000000000 --- a/src/test/ui/run-pass/issues/issue-2748-a.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// pretty-expanded FIXME #23616 - -struct CMap<'a> { - buf: &'a [u8], -} - -fn CMap(buf: &[u8]) -> CMap { - CMap { - buf: buf - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-2748-b.rs b/src/test/ui/run-pass/issues/issue-2748-b.rs deleted file mode 100644 index 78e3a3882c2..00000000000 --- a/src/test/ui/run-pass/issues/issue-2748-b.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn thing<'r>(x: &'r [isize]) -> &'r [isize] { x } - -pub fn main() { - let x = &[1,2,3]; - let y = x; - let z = thing(x); - assert_eq!(z[2], x[2]); - assert_eq!(z[1], y[1]); -} diff --git a/src/test/ui/run-pass/issues/issue-27583.rs b/src/test/ui/run-pass/issues/issue-27583.rs deleted file mode 100644 index 1a1ad2bc194..00000000000 --- a/src/test/ui/run-pass/issues/issue-27583.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #27583. Unclear how useful this will be -// going forward, since the issue in question was EXTREMELY sensitive -// to compiler internals (like the precise numbering of nodes), but -// what the hey. - -#![allow(warnings)] - -use std::cell::Cell; -use std::marker::PhantomData; - -pub trait Delegate<'tcx> { } - -pub struct InferCtxt<'a, 'tcx: 'a> { - x: PhantomData<&'a Cell<&'tcx ()>> -} - -pub struct MemCategorizationContext<'t, 'a: 't, 'tcx : 'a> { - x: &'t InferCtxt<'a, 'tcx>, -} - -pub struct ExprUseVisitor<'d, 't, 'a: 't, 'tcx:'a+'d> { - typer: &'t InferCtxt<'a, 'tcx>, - mc: MemCategorizationContext<'t, 'a, 'tcx>, - delegate: &'d mut (Delegate<'tcx>+'d), -} - -impl<'d,'t,'a,'tcx> ExprUseVisitor<'d,'t,'a,'tcx> { - pub fn new(delegate: &'d mut Delegate<'tcx>, - typer: &'t InferCtxt<'a, 'tcx>) - -> ExprUseVisitor<'d,'t,'a,'tcx> - { - ExprUseVisitor { - typer: typer, - mc: MemCategorizationContext::new(typer), - delegate: delegate, - } - } -} - -impl<'t, 'a,'tcx> MemCategorizationContext<'t, 'a, 'tcx> { - pub fn new(typer: &'t InferCtxt<'a, 'tcx>) -> MemCategorizationContext<'t, 'a, 'tcx> { - MemCategorizationContext { x: typer } - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-27639.rs b/src/test/ui/run-pass/issues/issue-27639.rs deleted file mode 100644 index 81b1a2518fc..00000000000 --- a/src/test/ui/run-pass/issues/issue-27639.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -fn main() { - const iter: i32 = 0; - - for i in 1..10 { - println!("{}", i); - } -} diff --git a/src/test/ui/run-pass/issues/issue-27859.rs b/src/test/ui/run-pass/issues/issue-27859.rs deleted file mode 100644 index e289995317f..00000000000 --- a/src/test/ui/run-pass/issues/issue-27859.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no std::env -// ignore-wasm32 issue 42629 - -#[inline(never)] -fn foo(a: f32, b: f32) -> f32 { - a % b -} - -#[inline(never)] -fn bar(a: f32, b: f32) -> f32 { - ((a as f64) % (b as f64)) as f32 -} - -fn main() { - let unknown_float = std::env::args().len(); - println!("{}", foo(4.0, unknown_float as f32)); - println!("{}", foo(5.0, (unknown_float as f32) + 1.0)); - println!("{}", bar(6.0, (unknown_float as f32) + 2.0)); - println!("{}", bar(7.0, (unknown_float as f32) + 3.0)); -} diff --git a/src/test/ui/run-pass/issues/issue-27889.rs b/src/test/ui/run-pass/issues/issue-27889.rs deleted file mode 100644 index a16bfeb8daa..00000000000 --- a/src/test/ui/run-pass/issues/issue-27889.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a field can have the same name in different variants -// of an enum - -pub enum Foo { - X { foo: u32 }, - Y { foo: u32 } -} - -pub fn foo(mut x: Foo) { - let mut y = None; - let mut z = None; - if let Foo::X { ref foo } = x { - z = Some(foo); - } - if let Foo::Y { ref mut foo } = x { - y = Some(foo); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-27890.rs b/src/test/ui/run-pass/issues/issue-27890.rs deleted file mode 100644 index 3526a77cbd5..00000000000 --- a/src/test/ui/run-pass/issues/issue-27890.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -static PLUS_ONE: &'static (Fn(i32) -> i32 + Sync) = (&|x: i32| { x + 1 }) - as &'static (Fn(i32) -> i32 + Sync); - -fn main() { - assert_eq!(PLUS_ONE(2), 3); -} diff --git a/src/test/ui/run-pass/issues/issue-27901.rs b/src/test/ui/run-pass/issues/issue-27901.rs deleted file mode 100644 index 5d02bace609..00000000000 --- a/src/test/ui/run-pass/issues/issue-27901.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Stream { type Item; } -impl<'a> Stream for &'a str { type Item = u8; } -fn f<'s>(s: &'s str) -> (&'s str, <&'s str as Stream>::Item) { - (s, 42) -} - -fn main() { - let fx = f as for<'t> fn(&'t str) -> (&'t str, <&'t str as Stream>::Item); - assert_eq!(fx("hi"), ("hi", 42)); -} diff --git a/src/test/ui/run-pass/issues/issue-27997.rs b/src/test/ui/run-pass/issues/issue-27997.rs deleted file mode 100644 index f8dba27390c..00000000000 --- a/src/test/ui/run-pass/issues/issue-27997.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::sync::atomic::{Ordering, AtomicUsize}; - -use std::mem; -struct S { - _u: U, - size_of_u: usize, - _v: V, - size_of_v: usize -} - -impl S { - fn new(u: U, v: V) -> Self { - S { - _u: u, - size_of_u: mem::size_of::(), - _v: v, - size_of_v: mem::size_of::() - } - } -} - -static COUNT: AtomicUsize = AtomicUsize::new(0); - -impl Drop for S { - fn drop(&mut self) { - assert_eq!(mem::size_of::(), self.size_of_u); - assert_eq!(mem::size_of::(), self.size_of_v); - COUNT.store(COUNT.load(Ordering::SeqCst)+1, Ordering::SeqCst); - } -} - -fn main() { - assert_eq!(COUNT.load(Ordering::SeqCst), 0); - { S::new(0u8, 1u16); } - assert_eq!(COUNT.load(Ordering::SeqCst), 1); -} diff --git a/src/test/ui/run-pass/issues/issue-2804-2.rs b/src/test/ui/run-pass/issues/issue-2804-2.rs deleted file mode 100644 index a080627c686..00000000000 --- a/src/test/ui/run-pass/issues/issue-2804-2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Minimized version of issue-2804.rs. Both check that callee IDs don't -// clobber the previous node ID in a macro expr - -use std::collections::HashMap; - -fn add_interfaces(managed_ip: String, device: HashMap) { - println!("{}, {}", managed_ip, device["interfaces"]); -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-28181.rs b/src/test/ui/run-pass/issues/issue-28181.rs deleted file mode 100644 index 21b0100e815..00000000000 --- a/src/test/ui/run-pass/issues/issue-28181.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn bar(f: F) -> usize where F: Fn([usize; 1]) -> usize { f([2]) } - -fn main() { - bar(|u| { u[0] }); -} diff --git a/src/test/ui/run-pass/issues/issue-28279.rs b/src/test/ui/run-pass/issues/issue-28279.rs deleted file mode 100644 index bc615c8f7e3..00000000000 --- a/src/test/ui/run-pass/issues/issue-28279.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::rc::Rc; - -fn test1() -> Rc Fn(&'a usize) + 'static> { - if let Some(_) = Some(1) { - loop{} - } else { - loop{} - } -} - -fn test2() -> *mut (for<'a> Fn(&'a usize) + 'static) { - if let Some(_) = Some(1) { - loop{} - } else { - loop{} - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-28550.rs b/src/test/ui/run-pass/issues/issue-28550.rs deleted file mode 100644 index 95b6943849c..00000000000 --- a/src/test/ui/run-pass/issues/issue-28550.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct AT,T>(F::Output); -struct BT,T>(A); - -// Removing Option causes it to compile. -fn fooT>(f: F) -> Option> { - Some(B(A(f()))) -} - -fn main() { - let v = (|| foo(||4))(); - match v { - Some(B(A(4))) => {}, - _ => unreachable!() - } -} diff --git a/src/test/ui/run-pass/issues/issue-28561.rs b/src/test/ui/run-pass/issues/issue-28561.rs deleted file mode 100644 index 5927ce77f8e..00000000000 --- a/src/test/ui/run-pass/issues/issue-28561.rs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -struct Array { - f00: [T; 00], - f01: [T; 01], - f02: [T; 02], - f03: [T; 03], - f04: [T; 04], - f05: [T; 05], - f06: [T; 06], - f07: [T; 07], - f08: [T; 08], - f09: [T; 09], - f10: [T; 10], - f11: [T; 11], - f12: [T; 12], - f13: [T; 13], - f14: [T; 14], - f15: [T; 15], - f16: [T; 16], - f17: [T; 17], - f18: [T; 18], - f19: [T; 19], - f20: [T; 20], - f21: [T; 21], - f22: [T; 22], - f23: [T; 23], - f24: [T; 24], - f25: [T; 25], - f26: [T; 26], - f27: [T; 27], - f28: [T; 28], - f29: [T; 29], - f30: [T; 30], - f31: [T; 31], - f32: [T; 32], -} - -// FIXME(#44580): merge with `Array` once `[T; N]: Clone` where `T: Clone` -#[derive(Clone, Copy)] -struct CopyArray { - f00: [T; 00], - f01: [T; 01], - f02: [T; 02], - f03: [T; 03], - f04: [T; 04], - f05: [T; 05], - f06: [T; 06], - f07: [T; 07], - f08: [T; 08], - f09: [T; 09], - f10: [T; 10], - f11: [T; 11], - f12: [T; 12], - f13: [T; 13], - f14: [T; 14], - f15: [T; 15], - f16: [T; 16], - f17: [T; 17], - f18: [T; 18], - f19: [T; 19], - f20: [T; 20], - f21: [T; 21], - f22: [T; 22], - f23: [T; 23], - f24: [T; 24], - f25: [T; 25], - f26: [T; 26], - f27: [T; 27], - f28: [T; 28], - f29: [T; 29], - f30: [T; 30], - f31: [T; 31], - f32: [T; 32], -} - -#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] -struct Fn { - f00: fn(), - f01: fn(A), - f02: fn(A, B), - f03: fn(A, B, C), - f04: fn(A, B, C, D), - f05: fn(A, B, C, D, E), - f06: fn(A, B, C, D, E, F), - f07: fn(A, B, C, D, E, F, G), - f08: fn(A, B, C, D, E, F, G, H), - f09: fn(A, B, C, D, E, F, G, H, I), - f10: fn(A, B, C, D, E, F, G, H, I, J), - f11: fn(A, B, C, D, E, F, G, H, I, J, K), - f12: fn(A, B, C, D, E, F, G, H, I, J, K, L), -} - -#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)] -struct Tuple { - f00: (), - f01: (A), - f02: (A, B), - f03: (A, B, C), - f04: (A, B, C, D), - f05: (A, B, C, D, E), - f06: (A, B, C, D, E, F), - f07: (A, B, C, D, E, F, G), - f08: (A, B, C, D, E, F, G, H), - f09: (A, B, C, D, E, F, G, H, I), - f10: (A, B, C, D, E, F, G, H, I, J), - f11: (A, B, C, D, E, F, G, H, I, J, K), - f12: (A, B, C, D, E, F, G, H, I, J, K, L), -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-28600.rs b/src/test/ui/run-pass/issues/issue-28600.rs deleted file mode 100644 index 0f3573f7e62..00000000000 --- a/src/test/ui/run-pass/issues/issue-28600.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #28600 ICE: pub extern fn with parameter type &str inside struct impl - -struct Test; - -impl Test { - #[allow(dead_code)] - #[allow(unused_variables)] - pub extern fn test(val: &str) { - - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-28676.rs b/src/test/ui/run-pass/issues/issue-28676.rs deleted file mode 100644 index 978d2136334..00000000000 --- a/src/test/ui/run-pass/issues/issue-28676.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// ignore-wasm32-bare no libc to test ffi with - -#[derive(Copy, Clone)] -pub struct Quad { a: u64, b: u64, c: u64, d: u64 } - -mod rustrt { - use super::Quad; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn get_c_many_params(_: *const (), _: *const (), - _: *const (), _: *const (), f: Quad) -> u64; - } -} - -fn test() { - unsafe { - let null = std::ptr::null(); - let q = Quad { - a: 1, - b: 2, - c: 3, - d: 4 - }; - assert_eq!(rustrt::get_c_many_params(null, null, null, null, q), q.c); - } -} - -pub fn main() { - test(); -} diff --git a/src/test/ui/run-pass/issues/issue-28777.rs b/src/test/ui/run-pass/issues/issue-28777.rs deleted file mode 100644 index a796d211df2..00000000000 --- a/src/test/ui/run-pass/issues/issue-28777.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let v1 = { 1 + {2} * {3} }; - let v2 = 1 + {2} * {3} ; - - assert_eq!(7, v1); - assert_eq!(7, v2); - - let v3; - v3 = { 1 + {2} * {3} }; - let v4; - v4 = 1 + {2} * {3}; - assert_eq!(7, v3); - assert_eq!(7, v4); - - let v5 = { 1 + {2} * 3 }; - assert_eq!(7, v5); - - let v9 = { 1 + if 1 > 2 {1} else {2} * {3} }; - assert_eq!(7, v9); -} diff --git a/src/test/ui/run-pass/issues/issue-28822.rs b/src/test/ui/run-pass/issues/issue-28822.rs deleted file mode 100644 index 39e4a23e3cd..00000000000 --- a/src/test/ui/run-pass/issues/issue-28822.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -fn main() {} - -const fn size_ofs(_: usize) {} -const fn size_ofs2(_foo: usize) {} diff --git a/src/test/ui/run-pass/issues/issue-28828.rs b/src/test/ui/run-pass/issues/issue-28828.rs deleted file mode 100644 index 2fb6b5875c1..00000000000 --- a/src/test/ui/run-pass/issues/issue-28828.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Foo { - type Out; -} - -impl Foo for () { - type Out = bool; -} - -fn main() { - type Bool = <() as Foo>::Out; - - let x: Bool = true; - assert!(x); - - let y: Option = None; - assert_eq!(y, None); -} diff --git a/src/test/ui/run-pass/issues/issue-28839.rs b/src/test/ui/run-pass/issues/issue-28839.rs deleted file mode 100644 index 1b536fe83c7..00000000000 --- a/src/test/ui/run-pass/issues/issue-28839.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37199 - -pub struct Foo; - -pub fn get_foo2<'a>(foo: &'a mut Option<&'a mut Foo>) -> &'a mut Foo { - match foo { - // Ensure that this is not considered a move, but rather a reborrow. - &mut Some(ref mut x) => *x, - &mut None => panic!(), - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-28871.rs b/src/test/ui/run-pass/issues/issue-28871.rs deleted file mode 100644 index 2be32409274..00000000000 --- a/src/test/ui/run-pass/issues/issue-28871.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #28871. The problem is that rustc encountered -// two ways to project, one from a where clause and one from the where -// clauses on the trait definition. (In fact, in this case, the where -// clauses originated from the trait definition as well.) The true -// cause of the error is that the trait definition where clauses are -// not being normalized, and hence the two sources are considered in -// conflict, and not a duplicate. Hacky solution is to prefer where -// clauses over the data found in the trait definition. - -trait T { - type T; -} - -struct S; -impl T for S { - type T = S; -} - -trait T2 { - type T: Iterator::T>; -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-28936.rs b/src/test/ui/run-pass/issues/issue-28936.rs deleted file mode 100644 index 1e3e3474c17..00000000000 --- a/src/test/ui/run-pass/issues/issue-28936.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub type Session = i32; -pub struct StreamParser<'a, T> { - _tokens: T, - _session: &'a mut Session, -} - -impl<'a, T> StreamParser<'a, T> { - pub fn thing(&mut self) -> bool { true } -} - -pub fn parse_stream, U, F>( - _session: &mut Session, _tokens: T, _f: F) -> U - where F: Fn(&mut StreamParser) -> U { panic!(); } - -pub fn thing(session: &mut Session) { - let mut stream = vec![1, 2, 3].into_iter(); - - let _b = parse_stream(session, - stream.by_ref(), - // replacing the above with the following fixes it - //&mut stream, - |p| p.thing()); - -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2895.rs b/src/test/ui/run-pass/issues/issue-2895.rs deleted file mode 100644 index e52126e16f8..00000000000 --- a/src/test/ui/run-pass/issues/issue-2895.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem; - -struct Cat { - x: isize -} - -struct Kitty { - x: isize, -} - -impl Drop for Kitty { - fn drop(&mut self) {} -} - -#[cfg(target_pointer_width = "64")] -pub fn main() { - assert_eq!(mem::size_of::(), 8 as usize); - assert_eq!(mem::size_of::(), 8 as usize); -} - -#[cfg(target_pointer_width = "32")] -pub fn main() { - assert_eq!(mem::size_of::(), 4 as usize); - assert_eq!(mem::size_of::(), 4 as usize); -} diff --git a/src/test/ui/run-pass/issues/issue-28950.rs b/src/test/ui/run-pass/issues/issue-28950.rs deleted file mode 100644 index b7426571fbd..00000000000 --- a/src/test/ui/run-pass/issues/issue-28950.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads -// compile-flags: -O - -// Tests that the `vec!` macro does not overflow the stack when it is -// given data larger than the stack. - -// FIXME(eddyb) Improve unoptimized codegen to avoid the temporary, -// and thus run successfully even when compiled at -C opt-level=0. - -const LEN: usize = 1 << 15; - -use std::thread::Builder; - -fn main() { - assert!(Builder::new().stack_size(LEN / 2).spawn(|| { - // FIXME(eddyb) this can be vec![[0: LEN]] pending - // https://llvm.org/bugs/show_bug.cgi?id=28987 - let vec = vec![unsafe { std::mem::zeroed::<[u8; LEN]>() }]; - assert_eq!(vec.len(), 1); - }).unwrap().join().is_ok()); -} diff --git a/src/test/ui/run-pass/issues/issue-28983.rs b/src/test/ui/run-pass/issues/issue-28983.rs deleted file mode 100644 index d38a519cb98..00000000000 --- a/src/test/ui/run-pass/issues/issue-28983.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Test { type T; } - -impl Test for u32 { - type T = i32; -} - -pub mod export { - #[no_mangle] - pub extern "C" fn issue_28983(t: ::T) -> i32 { t*3 } -} - -// to test both exporting and importing functions, import -// a function from ourselves. -extern "C" { - fn issue_28983(t: ::T) -> i32; -} - -fn main() { - assert_eq!(export::issue_28983(2), 6); - assert_eq!(unsafe { issue_28983(3) }, 9); -} diff --git a/src/test/ui/run-pass/issues/issue-28999.rs b/src/test/ui/run-pass/issues/issue-28999.rs deleted file mode 100644 index bb5747ca744..00000000000 --- a/src/test/ui/run-pass/issues/issue-28999.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Xyz<'a, V> { - pub v: (V, &'a u32), -} - -pub fn eq<'a, 's, 't, V>(this: &'s Xyz<'a, V>, other: &'t Xyz<'a, V>) -> bool - where V: PartialEq { - this.v == other.v -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29030.rs b/src/test/ui/run-pass/issues/issue-29030.rs deleted file mode 100644 index 51dbf58a77d..00000000000 --- a/src/test/ui/run-pass/issues/issue-29030.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct Message<'a, P: 'a = &'a [u8]> { - header: &'a [u8], - payload: P, -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29037.rs b/src/test/ui/run-pass/issues/issue-29037.rs deleted file mode 100644 index 2ee4446820b..00000000000 --- a/src/test/ui/run-pass/issues/issue-29037.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test ensures that each pointer type `P` is covariant in `X`. - -use std::rc::Rc; -use std::sync::Arc; - -fn a<'r>(x: Box<&'static str>) -> Box<&'r str> { - x -} - -fn b<'r, 'w>(x: &'w &'static str) -> &'w &'r str { - x -} - -fn c<'r>(x: Arc<&'static str>) -> Arc<&'r str> { - x -} - -fn d<'r>(x: Rc<&'static str>) -> Rc<&'r str> { - x -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2904.rs b/src/test/ui/run-pass/issues/issue-2904.rs deleted file mode 100644 index dcb8515c776..00000000000 --- a/src/test/ui/run-pass/issues/issue-2904.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Map representation - -use std::fmt; -use std::io::prelude::*; -use square::{bot, wall, rock, lambda, closed_lift, open_lift, earth, empty}; - -enum square { - bot, - wall, - rock, - lambda, - closed_lift, - open_lift, - earth, - empty -} - -impl fmt::Debug for square { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", match *self { - bot => { "R".to_string() } - wall => { "#".to_string() } - rock => { "*".to_string() } - lambda => { "\\".to_string() } - closed_lift => { "L".to_string() } - open_lift => { "O".to_string() } - earth => { ".".to_string() } - empty => { " ".to_string() } - }) - } -} - -fn square_from_char(c: char) -> square { - match c { - 'R' => { bot } - '#' => { wall } - '*' => { rock } - '\\' => { lambda } - 'L' => { closed_lift } - 'O' => { open_lift } - '.' => { earth } - ' ' => { empty } - _ => { - println!("invalid square: {}", c); - panic!() - } - } -} - -fn read_board_grid(mut input: rdr) - -> Vec> { - let mut input: &mut Read = &mut input; - let mut grid = Vec::new(); - let mut line = [0; 10]; - input.read(&mut line); - let mut row = Vec::new(); - for c in &line { - row.push(square_from_char(*c as char)) - } - grid.push(row); - let width = grid[0].len(); - for row in &grid { assert_eq!(row.len(), width) } - grid -} - -mod test { - #[test] - pub fn trivial_to_string() { - assert_eq!(lambda.to_string(), "\\") - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29048.rs b/src/test/ui/run-pass/issues/issue-29048.rs deleted file mode 100644 index f889cd8af61..00000000000 --- a/src/test/ui/run-pass/issues/issue-29048.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Chan; -pub struct ChanSelect<'c, T> { - chans: Vec<(&'c Chan, T)>, -} -impl<'c, T> ChanSelect<'c, T> { - pub fn add_recv_ret(&mut self, chan: &'c Chan, ret: T) - { - self.chans.push((chan, ret)); - } -} -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29053.rs b/src/test/ui/run-pass/issues/issue-29053.rs deleted file mode 100644 index 47800b48de4..00000000000 --- a/src/test/ui/run-pass/issues/issue-29053.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let x: &'static str = "x"; - - { - let y = "y".to_string(); - let ref mut x = &*x; - *x = &*y; - } - - assert_eq!(x, "x"); -} diff --git a/src/test/ui/run-pass/issues/issue-29071-2.rs b/src/test/ui/run-pass/issues/issue-29071-2.rs deleted file mode 100644 index f0025f25557..00000000000 --- a/src/test/ui/run-pass/issues/issue-29071-2.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn t1() -> u32 { - let x; - x = if true { [1, 2, 3] } else { [2, 3, 4] }[0]; - x -} - -fn t2() -> [u32; 1] { - if true { [1, 2, 3]; } else { [2, 3, 4]; } - [0] -} - -fn t3() -> u32 { - let x; - x = if true { i1 as F } else { i2 as F }(); - x -} - -fn t4() -> () { - if true { i1 as F; } else { i2 as F; } - () -} - -type F = fn() -> u32; -fn i1() -> u32 { 1 } -fn i2() -> u32 { 2 } - -fn main() { - assert_eq!(t1(), 1); - assert_eq!(t3(), 1); -} diff --git a/src/test/ui/run-pass/issues/issue-29071.rs b/src/test/ui/run-pass/issues/issue-29071.rs deleted file mode 100644 index 06570f41a53..00000000000 --- a/src/test/ui/run-pass/issues/issue-29071.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -fn ret() -> u32 { - static x: u32 = 10; - x & if true { 10u32 } else { 20u32 } & x -} - -fn ret2() -> &'static u32 { - static x: u32 = 10; - if true { 10u32; } else { 20u32; } - &x -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29092.rs b/src/test/ui/run-pass/issues/issue-29092.rs deleted file mode 100644 index 3517f016675..00000000000 --- a/src/test/ui/run-pass/issues/issue-29092.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for Issue #29092. -// -// (Possibly redundant with regression test run-pass/issue-30530.rs) - -use self::Term::*; - -#[derive(Clone)] -pub enum Term { - Dummy, - A(Box), - B(Box), -} - -// a small-step evaluator -pub fn small_eval(v: Term) -> Term { - match v { - A(t) => *t.clone(), - B(t) => *t.clone(), - _ => Dummy, - } -} - -fn main() { - small_eval(Dummy); -} diff --git a/src/test/ui/run-pass/issues/issue-29147.rs b/src/test/ui/run-pass/issues/issue-29147.rs deleted file mode 100644 index 93ff713eafe..00000000000 --- a/src/test/ui/run-pass/issues/issue-29147.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![recursion_limit="1024"] - -use std::mem; - -pub struct S0(T,T); -pub struct S1(Option>>>,Option>>>); -pub struct S2(Option>>>,Option>>>); -pub struct S3(Option>>>,Option>>>); -pub struct S4(Option>>>,Option>>>); -pub struct S5(Option>>>,Option>>>,Option); - -trait Foo { fn xxx(&self); } -/// some local of #[fundamental] trait -trait Bar {} - -impl Foo for T where T: Bar, T: Sync { - fn xxx(&self) {} -} - -impl Foo for S5 { fn xxx(&self) {} } - -fn main() { - let s = S5(None,None,None); - s.xxx(); - assert_eq!(mem::size_of_val(&s.2), mem::size_of::>()); -} diff --git a/src/test/ui/run-pass/issues/issue-29166.rs b/src/test/ui/run-pass/issues/issue-29166.rs deleted file mode 100644 index 1cc2c7a8893..00000000000 --- a/src/test/ui/run-pass/issues/issue-29166.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test ensures that vec.into_iter does not overconstrain element lifetime. - -pub fn main() { - original_report(); - revision_1(); - revision_2(); -} - -fn original_report() { - drop(vec![&()].into_iter()) -} - -fn revision_1() { - // below is what above `vec!` expands into at time of this writing. - drop(<[_]>::into_vec(::std::boxed::Box::new([&()])).into_iter()) -} - -fn revision_2() { - drop((match (Vec::new(), &()) { (mut v, b) => { v.push(b); v } }).into_iter()) -} diff --git a/src/test/ui/run-pass/issues/issue-29227.rs b/src/test/ui/run-pass/issues/issue-29227.rs deleted file mode 100644 index a33bb698634..00000000000 --- a/src/test/ui/run-pass/issues/issue-29227.rs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-tidy-linelength - -// Regression test for #29227. The problem here was that MIR -// construction for these gigantic match expressions was very -// inefficient. - -pub trait CharExt : Sized + Copy { - fn is_unicode_uppercase_letter(self) -> bool { false } - fn is_unicode_lowercase_letter(self) -> bool { false } - fn is_unicode_titlecase_letter(self) -> bool { false } - fn is_unicode_modifier_letter(self) -> bool { false } - fn is_unicode_other_letter(self) -> bool { false } - fn is_unicode_letter_number(self) -> bool { false } - fn is_unicode_nonspacing_mark(self) -> bool { false } - fn is_unicode_combining_spacing_mark(self) -> bool { false } - fn is_unicode_decimal_number(self) -> bool{ false } - fn is_unicode_connector_punctiation(self) -> bool { false } - fn is_unicode_space_separator(self) -> bool { false } - - fn is_es_identifier_start(self) -> bool { false } - fn is_es_identifier_part(self) -> bool { false } - fn is_es_whitespace(self) -> bool { false } - fn is_es_line_terminator(self) -> bool { false } - - fn is_unicode_letter(self) -> bool { - self.is_unicode_uppercase_letter() - || self.is_unicode_lowercase_letter() - || self.is_unicode_titlecase_letter() - || self.is_unicode_modifier_letter() - || self.is_unicode_modifier_letter() - || self.is_unicode_letter_number() - } - -} - - -macro_rules! match_char_class { - ($thing:expr, $($c:expr),*) => { - match $thing { - $($c)|* => true, - _ => false - } - } -} - -impl CharExt for char { - fn is_unicode_uppercase_letter(self) -> bool { - match_char_class!(self, - '\u{0041}', '\u{0042}', '\u{0043}', '\u{0044}', '\u{0045}', '\u{0046}', '\u{0047}', '\u{0048}', '\u{0049}', '\u{004A}', '\u{004B}', '\u{004C}', '\u{004D}', '\u{004E}', '\u{004F}', '\u{0050}', '\u{0051}', '\u{0052}', '\u{0053}', '\u{0054}', '\u{0055}', '\u{0056}', '\u{0057}', '\u{0058}', '\u{0059}', '\u{005A}', '\u{00C0}', '\u{00C1}', '\u{00C2}', '\u{00C3}', '\u{00C4}', '\u{00C5}', '\u{00C6}', '\u{00C7}', '\u{00C8}', '\u{00C9}', '\u{00CA}', '\u{00CB}', '\u{00CC}', '\u{00CD}', '\u{00CE}', '\u{00CF}', '\u{00D0}', '\u{00D1}', '\u{00D2}', '\u{00D3}', '\u{00D4}', '\u{00D5}', '\u{00D6}', '\u{00D8}', '\u{00D9}', '\u{00DA}', '\u{00DB}', '\u{00DC}', '\u{00DD}', '\u{00DE}', '\u{0100}', '\u{0102}', '\u{0104}', '\u{0106}', '\u{0108}', '\u{010A}', '\u{010C}', '\u{010E}', '\u{0110}', '\u{0112}', '\u{0114}', '\u{0116}', '\u{0118}', '\u{011A}', '\u{011C}', '\u{011E}', '\u{0120}', '\u{0122}', '\u{0124}', '\u{0126}', '\u{0128}', '\u{012A}', '\u{012C}', '\u{012E}', '\u{0130}', '\u{0132}', '\u{0134}', '\u{0136}', '\u{0139}', '\u{013B}', '\u{013D}', '\u{013F}', '\u{0141}', '\u{0143}', '\u{0145}', '\u{0147}', '\u{014A}', '\u{014C}', '\u{014E}', '\u{0150}', '\u{0152}', '\u{0154}', '\u{0156}', '\u{0158}', '\u{015A}', '\u{015C}', '\u{015E}', '\u{0160}', '\u{0162}', '\u{0164}', '\u{0166}', '\u{0168}', '\u{016A}', '\u{016C}', '\u{016E}', '\u{0170}', '\u{0172}', '\u{0174}', '\u{0176}', '\u{0178}', '\u{0179}', '\u{017B}', '\u{017D}', '\u{0181}', '\u{0182}', '\u{0184}', '\u{0186}', '\u{0187}', '\u{0189}', '\u{018A}', '\u{018B}', '\u{018E}', '\u{018F}', '\u{0190}', '\u{0191}', '\u{0193}', '\u{0194}', '\u{0196}', '\u{0197}', '\u{0198}', '\u{019C}', '\u{019D}', '\u{019F}', '\u{01A0}', '\u{01A2}', '\u{01A4}', '\u{01A6}', '\u{01A7}', '\u{01A9}', '\u{01AC}', '\u{01AE}', '\u{01AF}', '\u{01B1}', '\u{01B2}', '\u{01B3}', '\u{01B5}', '\u{01B7}', '\u{01B8}', '\u{01BC}', '\u{01C4}', '\u{01C7}', '\u{01CA}', '\u{01CD}', '\u{01CF}', '\u{01D1}', '\u{01D3}', '\u{01D5}', '\u{01D7}', '\u{01D9}', '\u{01DB}', '\u{01DE}', '\u{01E0}', '\u{01E2}', '\u{01E4}', '\u{01E6}', '\u{01E8}', '\u{01EA}', '\u{01EC}', '\u{01EE}', '\u{01F1}', '\u{01F4}', '\u{01F6}', '\u{01F7}', '\u{01F8}', '\u{01FA}', '\u{01FC}', '\u{01FE}', '\u{0200}', '\u{0202}', '\u{0204}', '\u{0206}', '\u{0208}', '\u{020A}', '\u{020C}', '\u{020E}', '\u{0210}', '\u{0212}', '\u{0214}', '\u{0216}', '\u{0218}', '\u{021A}', '\u{021C}', '\u{021E}', '\u{0220}', '\u{0222}', '\u{0224}', '\u{0226}', '\u{0228}', '\u{022A}', '\u{022C}', '\u{022E}', '\u{0230}', '\u{0232}', '\u{023A}', '\u{023B}', '\u{023D}', '\u{023E}', '\u{0241}', '\u{0243}', '\u{0244}', '\u{0245}', '\u{0246}', '\u{0248}', '\u{024A}', '\u{024C}', '\u{024E}', '\u{0370}', '\u{0372}', '\u{0376}', '\u{0386}', '\u{0388}', '\u{0389}', '\u{038A}', '\u{038C}', '\u{038E}', '\u{038F}', '\u{0391}', '\u{0392}', '\u{0393}', '\u{0394}', '\u{0395}', '\u{0396}', '\u{0397}', '\u{0398}', '\u{0399}', '\u{039A}', '\u{039B}', '\u{039C}', '\u{039D}', '\u{039E}', '\u{039F}', '\u{03A0}', '\u{03A1}', '\u{03A3}', '\u{03A4}', '\u{03A5}', '\u{03A6}', '\u{03A7}', '\u{03A8}', '\u{03A9}', '\u{03AA}', '\u{03AB}', '\u{03CF}', '\u{03D2}', '\u{03D3}', '\u{03D4}', '\u{03D8}', '\u{03DA}', '\u{03DC}', '\u{03DE}', '\u{03E0}', '\u{03E2}', '\u{03E4}', '\u{03E6}', '\u{03E8}', '\u{03EA}', '\u{03EC}', '\u{03EE}', '\u{03F4}', '\u{03F7}', '\u{03F9}', '\u{03FA}', '\u{03FD}', '\u{03FE}', '\u{03FF}', '\u{0400}', '\u{0401}', '\u{0402}', '\u{0403}', '\u{0404}', '\u{0405}', '\u{0406}', '\u{0407}', '\u{0408}', '\u{0409}', '\u{040A}', '\u{040B}', '\u{040C}', '\u{040D}', '\u{040E}', '\u{040F}', '\u{0410}', '\u{0411}', '\u{0412}', '\u{0413}', '\u{0414}', '\u{0415}', '\u{0416}', '\u{0417}', '\u{0418}', '\u{0419}', '\u{041A}', '\u{041B}', '\u{041C}', '\u{041D}', '\u{041E}', '\u{041F}', '\u{0420}', '\u{0421}', '\u{0422}', '\u{0423}', '\u{0424}', '\u{0425}', '\u{0426}', '\u{0427}', '\u{0428}', '\u{0429}', '\u{042A}', '\u{042B}', '\u{042C}', '\u{042D}', '\u{042E}', '\u{042F}', '\u{0460}', '\u{0462}', '\u{0464}', '\u{0466}', '\u{0468}', '\u{046A}', '\u{046C}', '\u{046E}', '\u{0470}', '\u{0472}', '\u{0474}', '\u{0476}', '\u{0478}', '\u{047A}', '\u{047C}', '\u{047E}', '\u{0480}', '\u{048A}', '\u{048C}', '\u{048E}', '\u{0490}', '\u{0492}', '\u{0494}', '\u{0496}', '\u{0498}', '\u{049A}', '\u{049C}', '\u{049E}', '\u{04A0}', '\u{04A2}', '\u{04A4}', '\u{04A6}', '\u{04A8}', '\u{04AA}', '\u{04AC}', '\u{04AE}', '\u{04B0}', '\u{04B2}', '\u{04B4}', '\u{04B6}', '\u{04B8}', '\u{04BA}', '\u{04BC}', '\u{04BE}', '\u{04C0}', '\u{04C1}', '\u{04C3}', '\u{04C5}', '\u{04C7}', '\u{04C9}', '\u{04CB}', '\u{04CD}', '\u{04D0}', '\u{04D2}', '\u{04D4}', '\u{04D6}', '\u{04D8}', '\u{04DA}', '\u{04DC}', '\u{04DE}', '\u{04E0}', '\u{04E2}', '\u{04E4}', '\u{04E6}', '\u{04E8}', '\u{04EA}', '\u{04EC}', '\u{04EE}', '\u{04F0}', '\u{04F2}', '\u{04F4}', '\u{04F6}', '\u{04F8}', '\u{04FA}', '\u{04FC}', '\u{04FE}', '\u{0500}', '\u{0502}', '\u{0504}', '\u{0506}', '\u{0508}', '\u{050A}', '\u{050C}', '\u{050E}', '\u{0510}', '\u{0512}', '\u{0514}', '\u{0516}', '\u{0518}', '\u{051A}', '\u{051C}', '\u{051E}', '\u{0520}', '\u{0522}', '\u{0531}', '\u{0532}', '\u{0533}', '\u{0534}', '\u{0535}', '\u{0536}', '\u{0537}', '\u{0538}', '\u{0539}', '\u{053A}', '\u{053B}', '\u{053C}', '\u{053D}', '\u{053E}', '\u{053F}', '\u{0540}', '\u{0541}', '\u{0542}', '\u{0543}', '\u{0544}', '\u{0545}', '\u{0546}', '\u{0547}', '\u{0548}', '\u{0549}', '\u{054A}', '\u{054B}', '\u{054C}', '\u{054D}', '\u{054E}', '\u{054F}', '\u{0550}', '\u{0551}', '\u{0552}', '\u{0553}', '\u{0554}', '\u{0555}', '\u{0556}', '\u{10A0}', '\u{10A1}', '\u{10A2}', '\u{10A3}', '\u{10A4}', '\u{10A5}', '\u{10A6}', '\u{10A7}', '\u{10A8}', '\u{10A9}', '\u{10AA}', '\u{10AB}', '\u{10AC}', '\u{10AD}', '\u{10AE}', '\u{10AF}', '\u{10B0}', '\u{10B1}', '\u{10B2}', '\u{10B3}', '\u{10B4}', '\u{10B5}', '\u{10B6}', '\u{10B7}', '\u{10B8}', '\u{10B9}', '\u{10BA}', '\u{10BB}', '\u{10BC}', '\u{10BD}', '\u{10BE}', '\u{10BF}', '\u{10C0}', '\u{10C1}', '\u{10C2}', '\u{10C3}', '\u{10C4}', '\u{10C5}', '\u{1E00}', '\u{1E02}', '\u{1E04}', '\u{1E06}', '\u{1E08}', '\u{1E0A}', '\u{1E0C}', '\u{1E0E}', '\u{1E10}', '\u{1E12}', '\u{1E14}', '\u{1E16}', '\u{1E18}', '\u{1E1A}', '\u{1E1C}', '\u{1E1E}', '\u{1E20}', '\u{1E22}', '\u{1E24}', '\u{1E26}', '\u{1E28}', '\u{1E2A}', '\u{1E2C}', '\u{1E2E}', '\u{1E30}', '\u{1E32}', '\u{1E34}', '\u{1E36}', '\u{1E38}', '\u{1E3A}', '\u{1E3C}', '\u{1E3E}', '\u{1E40}', '\u{1E42}', '\u{1E44}', '\u{1E46}', '\u{1E48}', '\u{1E4A}', '\u{1E4C}', '\u{1E4E}', '\u{1E50}', '\u{1E52}', '\u{1E54}', '\u{1E56}', '\u{1E58}', '\u{1E5A}', '\u{1E5C}', '\u{1E5E}', '\u{1E60}', '\u{1E62}', '\u{1E64}', '\u{1E66}', '\u{1E68}', '\u{1E6A}', '\u{1E6C}', '\u{1E6E}', '\u{1E70}', '\u{1E72}', '\u{1E74}', '\u{1E76}', '\u{1E78}', '\u{1E7A}', '\u{1E7C}', '\u{1E7E}', '\u{1E80}', '\u{1E82}', '\u{1E84}', '\u{1E86}', '\u{1E88}', '\u{1E8A}', '\u{1E8C}', '\u{1E8E}', '\u{1E90}', '\u{1E92}', '\u{1E94}', '\u{1E9E}', '\u{1EA0}', '\u{1EA2}', '\u{1EA4}', '\u{1EA6}', '\u{1EA8}', '\u{1EAA}', '\u{1EAC}', '\u{1EAE}', '\u{1EB0}', '\u{1EB2}', '\u{1EB4}', '\u{1EB6}', '\u{1EB8}', '\u{1EBA}', '\u{1EBC}', '\u{1EBE}', '\u{1EC0}', '\u{1EC2}', '\u{1EC4}', '\u{1EC6}', '\u{1EC8}', '\u{1ECA}', '\u{1ECC}', '\u{1ECE}', '\u{1ED0}', '\u{1ED2}', '\u{1ED4}', '\u{1ED6}', '\u{1ED8}', '\u{1EDA}', '\u{1EDC}', '\u{1EDE}', '\u{1EE0}', '\u{1EE2}', '\u{1EE4}', '\u{1EE6}', '\u{1EE8}', '\u{1EEA}', '\u{1EEC}', '\u{1EEE}', '\u{1EF0}', '\u{1EF2}', '\u{1EF4}', '\u{1EF6}', '\u{1EF8}', '\u{1EFA}', '\u{1EFC}', '\u{1EFE}', '\u{1F08}', '\u{1F09}', '\u{1F0A}', '\u{1F0B}', '\u{1F0C}', '\u{1F0D}', '\u{1F0E}', '\u{1F0F}', '\u{1F18}', '\u{1F19}', '\u{1F1A}', '\u{1F1B}', '\u{1F1C}', '\u{1F1D}', '\u{1F28}', '\u{1F29}', '\u{1F2A}', '\u{1F2B}', '\u{1F2C}', '\u{1F2D}', '\u{1F2E}', '\u{1F2F}', '\u{1F38}', '\u{1F39}', '\u{1F3A}', '\u{1F3B}', '\u{1F3C}', '\u{1F3D}', '\u{1F3E}', '\u{1F3F}', '\u{1F48}', '\u{1F49}', '\u{1F4A}', '\u{1F4B}', '\u{1F4C}', '\u{1F4D}', '\u{1F59}', '\u{1F5B}', '\u{1F5D}', '\u{1F5F}', '\u{1F68}', '\u{1F69}', '\u{1F6A}', '\u{1F6B}', '\u{1F6C}', '\u{1F6D}', '\u{1F6E}', '\u{1F6F}', '\u{1FB8}', '\u{1FB9}', '\u{1FBA}', '\u{1FBB}', '\u{1FC8}', '\u{1FC9}', '\u{1FCA}', '\u{1FCB}', '\u{1FD8}', '\u{1FD9}', '\u{1FDA}', '\u{1FDB}', '\u{1FE8}', '\u{1FE9}', '\u{1FEA}', '\u{1FEB}', '\u{1FEC}', '\u{1FF8}', '\u{1FF9}', '\u{1FFA}', '\u{1FFB}', '\u{2102}', '\u{2107}', '\u{210B}', '\u{210C}', '\u{210D}', '\u{2110}', '\u{2111}', '\u{2112}', '\u{2115}', '\u{2119}', '\u{211A}', '\u{211B}', '\u{211C}', '\u{211D}', '\u{2124}', '\u{2126}', '\u{2128}', '\u{212A}', '\u{212B}', '\u{212C}', '\u{212D}', '\u{2130}', '\u{2131}', '\u{2132}', '\u{2133}', '\u{213E}', '\u{213F}', '\u{2145}', '\u{2183}', '\u{2C00}', '\u{2C01}', '\u{2C02}', '\u{2C03}', '\u{2C04}', '\u{2C05}', '\u{2C06}', '\u{2C07}', '\u{2C08}', '\u{2C09}', '\u{2C0A}', '\u{2C0B}', '\u{2C0C}', '\u{2C0D}', '\u{2C0E}', '\u{2C0F}', '\u{2C10}', '\u{2C11}', '\u{2C12}', '\u{2C13}', '\u{2C14}', '\u{2C15}', '\u{2C16}', '\u{2C17}', '\u{2C18}', '\u{2C19}', '\u{2C1A}', '\u{2C1B}', '\u{2C1C}', '\u{2C1D}', '\u{2C1E}', '\u{2C1F}', '\u{2C20}', '\u{2C21}', '\u{2C22}', '\u{2C23}', '\u{2C24}', '\u{2C25}', '\u{2C26}', '\u{2C27}', '\u{2C28}', '\u{2C29}', '\u{2C2A}', '\u{2C2B}', '\u{2C2C}', '\u{2C2D}', '\u{2C2E}', '\u{2C60}', '\u{2C62}', '\u{2C63}', '\u{2C64}', '\u{2C67}', '\u{2C69}', '\u{2C6B}', '\u{2C6D}', '\u{2C6E}', '\u{2C6F}', '\u{2C72}', '\u{2C75}', '\u{2C80}', '\u{2C82}', '\u{2C84}', '\u{2C86}', '\u{2C88}', '\u{2C8A}', '\u{2C8C}', '\u{2C8E}', '\u{2C90}', '\u{2C92}', '\u{2C94}', '\u{2C96}', '\u{2C98}', '\u{2C9A}', '\u{2C9C}', '\u{2C9E}', '\u{2CA0}', '\u{2CA2}', '\u{2CA4}', '\u{2CA6}', '\u{2CA8}', '\u{2CAA}', '\u{2CAC}', '\u{2CAE}', '\u{2CB0}', '\u{2CB2}', '\u{2CB4}', '\u{2CB6}', '\u{2CB8}', '\u{2CBA}', '\u{2CBC}', '\u{2CBE}', '\u{2CC0}', '\u{2CC2}', '\u{2CC4}', '\u{2CC6}', '\u{2CC8}', '\u{2CCA}', '\u{2CCC}', '\u{2CCE}', '\u{2CD0}', '\u{2CD2}', '\u{2CD4}', '\u{2CD6}', '\u{2CD8}', '\u{2CDA}', '\u{2CDC}', '\u{2CDE}', '\u{2CE0}', '\u{2CE2}', '\u{A640}', '\u{A642}', '\u{A644}', '\u{A646}', '\u{A648}', '\u{A64A}', '\u{A64C}', '\u{A64E}', '\u{A650}', '\u{A652}', '\u{A654}', '\u{A656}', '\u{A658}', '\u{A65A}', '\u{A65C}', '\u{A65E}', '\u{A662}', '\u{A664}', '\u{A666}', '\u{A668}', '\u{A66A}', '\u{A66C}', '\u{A680}', '\u{A682}', '\u{A684}', '\u{A686}', '\u{A688}', '\u{A68A}', '\u{A68C}', '\u{A68E}', '\u{A690}', '\u{A692}', '\u{A694}', '\u{A696}', '\u{A722}', '\u{A724}', '\u{A726}', '\u{A728}', '\u{A72A}', '\u{A72C}', '\u{A72E}', '\u{A732}', '\u{A734}', '\u{A736}', '\u{A738}', '\u{A73A}', '\u{A73C}', '\u{A73E}', '\u{A740}', '\u{A742}', '\u{A744}', '\u{A746}', '\u{A748}', '\u{A74A}', '\u{A74C}', '\u{A74E}', '\u{A750}', '\u{A752}', '\u{A754}', '\u{A756}', '\u{A758}', '\u{A75A}', '\u{A75C}', '\u{A75E}', '\u{A760}', '\u{A762}', '\u{A764}', '\u{A766}', '\u{A768}', '\u{A76A}', '\u{A76C}', '\u{A76E}', '\u{A779}', '\u{A77B}', '\u{A77D}', '\u{A77E}', '\u{A780}', '\u{A782}', '\u{A784}', '\u{A786}', '\u{A78B}', '\u{FF21}', '\u{FF22}', '\u{FF23}', '\u{FF24}', '\u{FF25}', '\u{FF26}', '\u{FF27}', '\u{FF28}', '\u{FF29}', '\u{FF2A}', '\u{FF2B}', '\u{FF2C}', '\u{FF2D}', '\u{FF2E}', '\u{FF2F}', '\u{FF30}', '\u{FF31}', '\u{FF32}', '\u{FF33}', '\u{FF34}', '\u{FF35}', '\u{FF36}', '\u{FF37}', '\u{FF38}', '\u{FF39}', '\u{FF3A}') - } - - fn is_unicode_lowercase_letter(self) -> bool { - match_char_class!(self, - '\u{0061}', '\u{0062}', '\u{0063}', '\u{0064}', '\u{0065}', '\u{0066}', '\u{0067}', '\u{0068}', '\u{0069}', '\u{006A}', '\u{006B}', '\u{006C}', '\u{006D}', '\u{006E}', '\u{006F}', '\u{0070}', '\u{0071}', '\u{0072}', '\u{0073}', '\u{0074}', '\u{0075}', '\u{0076}', '\u{0077}', '\u{0078}', '\u{0079}', '\u{007A}', '\u{00AA}', '\u{00B5}', '\u{00BA}', '\u{00DF}', '\u{00E0}', '\u{00E1}', '\u{00E2}', '\u{00E3}', '\u{00E4}', '\u{00E5}', '\u{00E6}', '\u{00E7}', '\u{00E8}', '\u{00E9}', '\u{00EA}', '\u{00EB}', '\u{00EC}', '\u{00ED}', '\u{00EE}', '\u{00EF}', '\u{00F0}', '\u{00F1}', '\u{00F2}', '\u{00F3}', '\u{00F4}', '\u{00F5}', '\u{00F6}', '\u{00F8}', '\u{00F9}', '\u{00FA}', '\u{00FB}', '\u{00FC}', '\u{00FD}', '\u{00FE}', '\u{00FF}', '\u{0101}', '\u{0103}', '\u{0105}', '\u{0107}', '\u{0109}', '\u{010B}', '\u{010D}', '\u{010F}', '\u{0111}', '\u{0113}', '\u{0115}', '\u{0117}', '\u{0119}', '\u{011B}', '\u{011D}', '\u{011F}', '\u{0121}', '\u{0123}', '\u{0125}', '\u{0127}', '\u{0129}', '\u{012B}', '\u{012D}', '\u{012F}', '\u{0131}', '\u{0133}', '\u{0135}', '\u{0137}', '\u{0138}', '\u{013A}', '\u{013C}', '\u{013E}', '\u{0140}', '\u{0142}', '\u{0144}', '\u{0146}', '\u{0148}', '\u{0149}', '\u{014B}', '\u{014D}', '\u{014F}', '\u{0151}', '\u{0153}', '\u{0155}', '\u{0157}', '\u{0159}', '\u{015B}', '\u{015D}', '\u{015F}', '\u{0161}', '\u{0163}', '\u{0165}', '\u{0167}', '\u{0169}', '\u{016B}', '\u{016D}', '\u{016F}', '\u{0171}', '\u{0173}', '\u{0175}', '\u{0177}', '\u{017A}', '\u{017C}', '\u{017E}', '\u{017F}', '\u{0180}', '\u{0183}', '\u{0185}', '\u{0188}', '\u{018C}', '\u{018D}', '\u{0192}', '\u{0195}', '\u{0199}', '\u{019A}', '\u{019B}', '\u{019E}', '\u{01A1}', '\u{01A3}', '\u{01A5}', '\u{01A8}', '\u{01AA}', '\u{01AB}', '\u{01AD}', '\u{01B0}', '\u{01B4}', '\u{01B6}', '\u{01B9}', '\u{01BA}', '\u{01BD}', '\u{01BE}', '\u{01BF}', '\u{01C6}', '\u{01C9}', '\u{01CC}', '\u{01CE}', '\u{01D0}', '\u{01D2}', '\u{01D4}', '\u{01D6}', '\u{01D8}', '\u{01DA}', '\u{01DC}', '\u{01DD}', '\u{01DF}', '\u{01E1}', '\u{01E3}', '\u{01E5}', '\u{01E7}', '\u{01E9}', '\u{01EB}', '\u{01ED}', '\u{01EF}', '\u{01F0}', '\u{01F3}', '\u{01F5}', '\u{01F9}', '\u{01FB}', '\u{01FD}', '\u{01FF}', '\u{0201}', '\u{0203}', '\u{0205}', '\u{0207}', '\u{0209}', '\u{020B}', '\u{020D}', '\u{020F}', '\u{0211}', '\u{0213}', '\u{0215}', '\u{0217}', '\u{0219}', '\u{021B}', '\u{021D}', '\u{021F}', '\u{0221}', '\u{0223}', '\u{0225}', '\u{0227}', '\u{0229}', '\u{022B}', '\u{022D}', '\u{022F}', '\u{0231}', '\u{0233}', '\u{0234}', '\u{0235}', '\u{0236}', '\u{0237}', '\u{0238}', '\u{0239}', '\u{023C}', '\u{023F}', '\u{0240}', '\u{0242}', '\u{0247}', '\u{0249}', '\u{024B}', '\u{024D}', '\u{024F}', '\u{0250}', '\u{0251}', '\u{0252}', '\u{0253}', '\u{0254}', '\u{0255}', '\u{0256}', '\u{0257}', '\u{0258}', '\u{0259}', '\u{025A}', '\u{025B}', '\u{025C}', '\u{025D}', '\u{025E}', '\u{025F}', '\u{0260}', '\u{0261}', '\u{0262}', '\u{0263}', '\u{0264}', '\u{0265}', '\u{0266}', '\u{0267}', '\u{0268}', '\u{0269}', '\u{026A}', '\u{026B}', '\u{026C}', '\u{026D}', '\u{026E}', '\u{026F}', '\u{0270}', '\u{0271}', '\u{0272}', '\u{0273}', '\u{0274}', '\u{0275}', '\u{0276}', '\u{0277}', '\u{0278}', '\u{0279}', '\u{027A}', '\u{027B}', '\u{027C}', '\u{027D}', '\u{027E}', '\u{027F}', '\u{0280}', '\u{0281}', '\u{0282}', '\u{0283}', '\u{0284}', '\u{0285}', '\u{0286}', '\u{0287}', '\u{0288}', '\u{0289}', '\u{028A}', '\u{028B}', '\u{028C}', '\u{028D}', '\u{028E}', '\u{028F}', '\u{0290}', '\u{0291}', '\u{0292}', '\u{0293}', '\u{0295}', '\u{0296}', '\u{0297}', '\u{0298}', '\u{0299}', '\u{029A}', '\u{029B}', '\u{029C}', '\u{029D}', '\u{029E}', '\u{029F}', '\u{02A0}', '\u{02A1}', '\u{02A2}', '\u{02A3}', '\u{02A4}', '\u{02A5}', '\u{02A6}', '\u{02A7}', '\u{02A8}', '\u{02A9}', '\u{02AA}', '\u{02AB}', '\u{02AC}', '\u{02AD}', '\u{02AE}', '\u{02AF}', '\u{0371}', '\u{0373}', '\u{0377}', '\u{037B}', '\u{037C}', '\u{037D}', '\u{0390}', '\u{03AC}', '\u{03AD}', '\u{03AE}', '\u{03AF}', '\u{03B0}', '\u{03B1}', '\u{03B2}', '\u{03B3}', '\u{03B4}', '\u{03B5}', '\u{03B6}', '\u{03B7}', '\u{03B8}', '\u{03B9}', '\u{03BA}', '\u{03BB}', '\u{03BC}', '\u{03BD}', '\u{03BE}', '\u{03BF}', '\u{03C0}', '\u{03C1}', '\u{03C2}', '\u{03C3}', '\u{03C4}', '\u{03C5}', '\u{03C6}', '\u{03C7}', '\u{03C8}', '\u{03C9}', '\u{03CA}', '\u{03CB}', '\u{03CC}', '\u{03CD}', '\u{03CE}', '\u{03D0}', '\u{03D1}', '\u{03D5}', '\u{03D6}', '\u{03D7}', '\u{03D9}', '\u{03DB}', '\u{03DD}', '\u{03DF}', '\u{03E1}', '\u{03E3}', '\u{03E5}', '\u{03E7}', '\u{03E9}', '\u{03EB}', '\u{03ED}', '\u{03EF}', '\u{03F0}', '\u{03F1}', '\u{03F2}', '\u{03F3}', '\u{03F5}', '\u{03F8}', '\u{03FB}', '\u{03FC}', '\u{0430}', '\u{0431}', '\u{0432}', '\u{0433}', '\u{0434}', '\u{0435}', '\u{0436}', '\u{0437}', '\u{0438}', '\u{0439}', '\u{043A}', '\u{043B}', '\u{043C}', '\u{043D}', '\u{043E}', '\u{043F}', '\u{0440}', '\u{0441}', '\u{0442}', '\u{0443}', '\u{0444}', '\u{0445}', '\u{0446}', '\u{0447}', '\u{0448}', '\u{0449}', '\u{044A}', '\u{044B}', '\u{044C}', '\u{044D}', '\u{044E}', '\u{044F}', '\u{0450}', '\u{0451}', '\u{0452}', '\u{0453}', '\u{0454}', '\u{0455}', '\u{0456}', '\u{0457}', '\u{0458}', '\u{0459}', '\u{045A}', '\u{045B}', '\u{045C}', '\u{045D}', '\u{045E}', '\u{045F}', '\u{0461}', '\u{0463}', '\u{0465}', '\u{0467}', '\u{0469}', '\u{046B}', '\u{046D}', '\u{046F}', '\u{0471}', '\u{0473}', '\u{0475}', '\u{0477}', '\u{0479}', '\u{047B}', '\u{047D}', '\u{047F}', '\u{0481}', '\u{048B}', '\u{048D}', '\u{048F}', '\u{0491}', '\u{0493}', '\u{0495}', '\u{0497}', '\u{0499}', '\u{049B}', '\u{049D}', '\u{049F}', '\u{04A1}', '\u{04A3}', '\u{04A5}', '\u{04A7}', '\u{04A9}', '\u{04AB}', '\u{04AD}', '\u{04AF}', '\u{04B1}', '\u{04B3}', '\u{04B5}', '\u{04B7}', '\u{04B9}', '\u{04BB}', '\u{04BD}', '\u{04BF}', '\u{04C2}', '\u{04C4}', '\u{04C6}', '\u{04C8}', '\u{04CA}', '\u{04CC}', '\u{04CE}', '\u{04CF}', '\u{04D1}', '\u{04D3}', '\u{04D5}', '\u{04D7}', '\u{04D9}', '\u{04DB}', '\u{04DD}', '\u{04DF}', '\u{04E1}', '\u{04E3}', '\u{04E5}', '\u{04E7}', '\u{04E9}', '\u{04EB}', '\u{04ED}', '\u{04EF}', '\u{04F1}', '\u{04F3}', '\u{04F5}', '\u{04F7}', '\u{04F9}', '\u{04FB}', '\u{04FD}', '\u{04FF}', '\u{0501}', '\u{0503}', '\u{0505}', '\u{0507}', '\u{0509}', '\u{050B}', '\u{050D}', '\u{050F}', '\u{0511}', '\u{0513}', '\u{0515}', '\u{0517}', '\u{0519}', '\u{051B}', '\u{051D}', '\u{051F}', '\u{0521}', '\u{0523}', '\u{0561}', '\u{0562}', '\u{0563}', '\u{0564}', '\u{0565}', '\u{0566}', '\u{0567}', '\u{0568}', '\u{0569}', '\u{056A}', '\u{056B}', '\u{056C}', '\u{056D}', '\u{056E}', '\u{056F}', '\u{0570}', '\u{0571}', '\u{0572}', '\u{0573}', '\u{0574}', '\u{0575}', '\u{0576}', '\u{0577}', '\u{0578}', '\u{0579}', '\u{057A}', '\u{057B}', '\u{057C}', '\u{057D}', '\u{057E}', '\u{057F}', '\u{0580}', '\u{0581}', '\u{0582}', '\u{0583}', '\u{0584}', '\u{0585}', '\u{0586}', '\u{0587}', '\u{1D00}', '\u{1D01}', '\u{1D02}', '\u{1D03}', '\u{1D04}', '\u{1D05}', '\u{1D06}', '\u{1D07}', '\u{1D08}', '\u{1D09}', '\u{1D0A}', '\u{1D0B}', '\u{1D0C}', '\u{1D0D}', '\u{1D0E}', '\u{1D0F}', '\u{1D10}', '\u{1D11}', '\u{1D12}', '\u{1D13}', '\u{1D14}', '\u{1D15}', '\u{1D16}', '\u{1D17}', '\u{1D18}', '\u{1D19}', '\u{1D1A}', '\u{1D1B}', '\u{1D1C}', '\u{1D1D}', '\u{1D1E}', '\u{1D1F}', '\u{1D20}', '\u{1D21}', '\u{1D22}', '\u{1D23}', '\u{1D24}', '\u{1D25}', '\u{1D26}', '\u{1D27}', '\u{1D28}', '\u{1D29}', '\u{1D2A}', '\u{1D2B}', '\u{1D62}', '\u{1D63}', '\u{1D64}', '\u{1D65}', '\u{1D66}', '\u{1D67}', '\u{1D68}', '\u{1D69}', '\u{1D6A}', '\u{1D6B}', '\u{1D6C}', '\u{1D6D}', '\u{1D6E}', '\u{1D6F}', '\u{1D70}', '\u{1D71}', '\u{1D72}', '\u{1D73}', '\u{1D74}', '\u{1D75}', '\u{1D76}', '\u{1D77}', '\u{1D79}', '\u{1D7A}', '\u{1D7B}', '\u{1D7C}', '\u{1D7D}', '\u{1D7E}', '\u{1D7F}', '\u{1D80}', '\u{1D81}', '\u{1D82}', '\u{1D83}', '\u{1D84}', '\u{1D85}', '\u{1D86}', '\u{1D87}', '\u{1D88}', '\u{1D89}', '\u{1D8A}', '\u{1D8B}', '\u{1D8C}', '\u{1D8D}', '\u{1D8E}', '\u{1D8F}', '\u{1D90}', '\u{1D91}', '\u{1D92}', '\u{1D93}', '\u{1D94}', '\u{1D95}', '\u{1D96}', '\u{1D97}', '\u{1D98}', '\u{1D99}', '\u{1D9A}', '\u{1E01}', '\u{1E03}', '\u{1E05}', '\u{1E07}', '\u{1E09}', '\u{1E0B}', '\u{1E0D}', '\u{1E0F}', '\u{1E11}', '\u{1E13}', '\u{1E15}', '\u{1E17}', '\u{1E19}', '\u{1E1B}', '\u{1E1D}', '\u{1E1F}', '\u{1E21}', '\u{1E23}', '\u{1E25}', '\u{1E27}', '\u{1E29}', '\u{1E2B}', '\u{1E2D}', '\u{1E2F}', '\u{1E31}', '\u{1E33}', '\u{1E35}', '\u{1E37}', '\u{1E39}', '\u{1E3B}', '\u{1E3D}', '\u{1E3F}', '\u{1E41}', '\u{1E43}', '\u{1E45}', '\u{1E47}', '\u{1E49}', '\u{1E4B}', '\u{1E4D}', '\u{1E4F}', '\u{1E51}', '\u{1E53}', '\u{1E55}', '\u{1E57}', '\u{1E59}', '\u{1E5B}', '\u{1E5D}', '\u{1E5F}', '\u{1E61}', '\u{1E63}', '\u{1E65}', '\u{1E67}', '\u{1E69}', '\u{1E6B}', '\u{1E6D}', '\u{1E6F}', '\u{1E71}', '\u{1E73}', '\u{1E75}', '\u{1E77}', '\u{1E79}', '\u{1E7B}', '\u{1E7D}', '\u{1E7F}', '\u{1E81}', '\u{1E83}', '\u{1E85}', '\u{1E87}', '\u{1E89}', '\u{1E8B}', '\u{1E8D}', '\u{1E8F}', '\u{1E91}', '\u{1E93}', '\u{1E95}', '\u{1E96}', '\u{1E97}', '\u{1E98}', '\u{1E99}', '\u{1E9A}', '\u{1E9B}', '\u{1E9C}', '\u{1E9D}', '\u{1E9F}', '\u{1EA1}', '\u{1EA3}', '\u{1EA5}', '\u{1EA7}', '\u{1EA9}', '\u{1EAB}', '\u{1EAD}', '\u{1EAF}', '\u{1EB1}', '\u{1EB3}', '\u{1EB5}', '\u{1EB7}', '\u{1EB9}', '\u{1EBB}', '\u{1EBD}', '\u{1EBF}', '\u{1EC1}', '\u{1EC3}', '\u{1EC5}', '\u{1EC7}', '\u{1EC9}', '\u{1ECB}', '\u{1ECD}', '\u{1ECF}', '\u{1ED1}', '\u{1ED3}', '\u{1ED5}', '\u{1ED7}', '\u{1ED9}', '\u{1EDB}', '\u{1EDD}', '\u{1EDF}', '\u{1EE1}', '\u{1EE3}', '\u{1EE5}', '\u{1EE7}', '\u{1EE9}', '\u{1EEB}', '\u{1EED}', '\u{1EEF}', '\u{1EF1}', '\u{1EF3}', '\u{1EF5}', '\u{1EF7}', '\u{1EF9}', '\u{1EFB}', '\u{1EFD}', '\u{1EFF}', '\u{1F00}', '\u{1F01}', '\u{1F02}', '\u{1F03}', '\u{1F04}', '\u{1F05}', '\u{1F06}', '\u{1F07}', '\u{1F10}', '\u{1F11}', '\u{1F12}', '\u{1F13}', '\u{1F14}', '\u{1F15}', '\u{1F20}', '\u{1F21}', '\u{1F22}', '\u{1F23}', '\u{1F24}', '\u{1F25}', '\u{1F26}', '\u{1F27}', '\u{1F30}', '\u{1F31}', '\u{1F32}', '\u{1F33}', '\u{1F34}', '\u{1F35}', '\u{1F36}', '\u{1F37}', '\u{1F40}', '\u{1F41}', '\u{1F42}', '\u{1F43}', '\u{1F44}', '\u{1F45}', '\u{1F50}', '\u{1F51}', '\u{1F52}', '\u{1F53}', '\u{1F54}', '\u{1F55}', '\u{1F56}', '\u{1F57}', '\u{1F60}', '\u{1F61}', '\u{1F62}', '\u{1F63}', '\u{1F64}', '\u{1F65}', '\u{1F66}', '\u{1F67}', '\u{1F70}', '\u{1F71}', '\u{1F72}', '\u{1F73}', '\u{1F74}', '\u{1F75}', '\u{1F76}', '\u{1F77}', '\u{1F78}', '\u{1F79}', '\u{1F7A}', '\u{1F7B}', '\u{1F7C}', '\u{1F7D}', '\u{1F80}', '\u{1F81}', '\u{1F82}', '\u{1F83}', '\u{1F84}', '\u{1F85}', '\u{1F86}', '\u{1F87}', '\u{1F90}', '\u{1F91}', '\u{1F92}', '\u{1F93}', '\u{1F94}', '\u{1F95}', '\u{1F96}', '\u{1F97}', '\u{1FA0}', '\u{1FA1}', '\u{1FA2}', '\u{1FA3}', '\u{1FA4}', '\u{1FA5}', '\u{1FA6}', '\u{1FA7}', '\u{1FB0}', '\u{1FB1}', '\u{1FB2}', '\u{1FB3}', '\u{1FB4}', '\u{1FB6}', '\u{1FB7}', '\u{1FBE}', '\u{1FC2}', '\u{1FC3}', '\u{1FC4}', '\u{1FC6}', '\u{1FC7}', '\u{1FD0}', '\u{1FD1}', '\u{1FD2}', '\u{1FD3}', '\u{1FD6}', '\u{1FD7}', '\u{1FE0}', '\u{1FE1}', '\u{1FE2}', '\u{1FE3}', '\u{1FE4}', '\u{1FE5}', '\u{1FE6}', '\u{1FE7}', '\u{1FF2}', '\u{1FF3}', '\u{1FF4}', '\u{1FF6}', '\u{1FF7}', '\u{2071}', '\u{207F}', '\u{210A}', '\u{210E}', '\u{210F}', '\u{2113}', '\u{212F}', '\u{2134}', '\u{2139}', '\u{213C}', '\u{213D}', '\u{2146}', '\u{2147}', '\u{2148}', '\u{2149}', '\u{214E}', '\u{2184}', '\u{2C30}', '\u{2C31}', '\u{2C32}', '\u{2C33}', '\u{2C34}', '\u{2C35}', '\u{2C36}', '\u{2C37}', '\u{2C38}', '\u{2C39}', '\u{2C3A}', '\u{2C3B}', '\u{2C3C}', '\u{2C3D}', '\u{2C3E}', '\u{2C3F}', '\u{2C40}', '\u{2C41}', '\u{2C42}', '\u{2C43}', '\u{2C44}', '\u{2C45}', '\u{2C46}', '\u{2C47}', '\u{2C48}', '\u{2C49}', '\u{2C4A}', '\u{2C4B}', '\u{2C4C}', '\u{2C4D}', '\u{2C4E}', '\u{2C4F}', '\u{2C50}', '\u{2C51}', '\u{2C52}', '\u{2C53}', '\u{2C54}', '\u{2C55}', '\u{2C56}', '\u{2C57}', '\u{2C58}', '\u{2C59}', '\u{2C5A}', '\u{2C5B}', '\u{2C5C}', '\u{2C5D}', '\u{2C5E}', '\u{2C61}', '\u{2C65}', '\u{2C66}', '\u{2C68}', '\u{2C6A}', '\u{2C6C}', '\u{2C71}', '\u{2C73}', '\u{2C74}', '\u{2C76}', '\u{2C77}', '\u{2C78}', '\u{2C79}', '\u{2C7A}', '\u{2C7B}', '\u{2C7C}', '\u{2C81}', '\u{2C83}', '\u{2C85}', '\u{2C87}', '\u{2C89}', '\u{2C8B}', '\u{2C8D}', '\u{2C8F}', '\u{2C91}', '\u{2C93}', '\u{2C95}', '\u{2C97}', '\u{2C99}', '\u{2C9B}', '\u{2C9D}', '\u{2C9F}', '\u{2CA1}', '\u{2CA3}', '\u{2CA5}', '\u{2CA7}', '\u{2CA9}', '\u{2CAB}', '\u{2CAD}', '\u{2CAF}', '\u{2CB1}', '\u{2CB3}', '\u{2CB5}', '\u{2CB7}', '\u{2CB9}', '\u{2CBB}', '\u{2CBD}', '\u{2CBF}', '\u{2CC1}', '\u{2CC3}', '\u{2CC5}', '\u{2CC7}', '\u{2CC9}', '\u{2CCB}', '\u{2CCD}', '\u{2CCF}', '\u{2CD1}', '\u{2CD3}', '\u{2CD5}', '\u{2CD7}', '\u{2CD9}', '\u{2CDB}', '\u{2CDD}', '\u{2CDF}', '\u{2CE1}', '\u{2CE3}', '\u{2CE4}', '\u{2D00}', '\u{2D01}', '\u{2D02}', '\u{2D03}', '\u{2D04}', '\u{2D05}', '\u{2D06}', '\u{2D07}', '\u{2D08}', '\u{2D09}', '\u{2D0A}', '\u{2D0B}', '\u{2D0C}', '\u{2D0D}', '\u{2D0E}', '\u{2D0F}', '\u{2D10}', '\u{2D11}', '\u{2D12}', '\u{2D13}', '\u{2D14}', '\u{2D15}', '\u{2D16}', '\u{2D17}', '\u{2D18}', '\u{2D19}', '\u{2D1A}', '\u{2D1B}', '\u{2D1C}', '\u{2D1D}', '\u{2D1E}', '\u{2D1F}', '\u{2D20}', '\u{2D21}', '\u{2D22}', '\u{2D23}', '\u{2D24}', '\u{2D25}', '\u{A641}', '\u{A643}', '\u{A645}', '\u{A647}', '\u{A649}', '\u{A64B}', '\u{A64D}', '\u{A64F}', '\u{A651}', '\u{A653}', '\u{A655}', '\u{A657}', '\u{A659}', '\u{A65B}', '\u{A65D}', '\u{A65F}', '\u{A663}', '\u{A665}', '\u{A667}', '\u{A669}', '\u{A66B}', '\u{A66D}', '\u{A681}', '\u{A683}', '\u{A685}', '\u{A687}', '\u{A689}', '\u{A68B}', '\u{A68D}', '\u{A68F}', '\u{A691}', '\u{A693}', '\u{A695}', '\u{A697}', '\u{A723}', '\u{A725}', '\u{A727}', '\u{A729}', '\u{A72B}', '\u{A72D}', '\u{A72F}', '\u{A730}', '\u{A731}', '\u{A733}', '\u{A735}', '\u{A737}', '\u{A739}', '\u{A73B}', '\u{A73D}', '\u{A73F}', '\u{A741}', '\u{A743}', '\u{A745}', '\u{A747}', '\u{A749}', '\u{A74B}', '\u{A74D}', '\u{A74F}', '\u{A751}', '\u{A753}', '\u{A755}', '\u{A757}', '\u{A759}', '\u{A75B}', '\u{A75D}', '\u{A75F}', '\u{A761}', '\u{A763}', '\u{A765}', '\u{A767}', '\u{A769}', '\u{A76B}', '\u{A76D}', '\u{A76F}', '\u{A771}', '\u{A772}', '\u{A773}', '\u{A774}', '\u{A775}', '\u{A776}', '\u{A777}', '\u{A778}', '\u{A77A}', '\u{A77C}', '\u{A77F}', '\u{A781}', '\u{A783}', '\u{A785}', '\u{A787}', '\u{A78C}', '\u{FB00}', '\u{FB01}', '\u{FB02}', '\u{FB03}', '\u{FB04}', '\u{FB05}', '\u{FB06}', '\u{FB13}', '\u{FB14}', '\u{FB15}', '\u{FB16}', '\u{FB17}', '\u{FF41}', '\u{FF42}', '\u{FF43}', '\u{FF44}', '\u{FF45}', '\u{FF46}', '\u{FF47}', '\u{FF48}', '\u{FF49}', '\u{FF4A}', '\u{FF4B}', '\u{FF4C}', '\u{FF4D}', '\u{FF4E}', '\u{FF4F}', '\u{FF50}', '\u{FF51}', '\u{FF52}', '\u{FF53}', '\u{FF54}', '\u{FF55}', '\u{FF56}', '\u{FF57}', '\u{FF58}', '\u{FF59}', '\u{FF5A}') - - } - - fn is_unicode_titlecase_letter(self) -> bool { - match_char_class!(self, - '\u{01C5}', '\u{01C8}', '\u{01CB}', '\u{01F2}', '\u{1F88}', '\u{1F89}', '\u{1F8A}', '\u{1F8B}', '\u{1F8C}', '\u{1F8D}', '\u{1F8E}', '\u{1F8F}', '\u{1F98}', '\u{1F99}', '\u{1F9A}', '\u{1F9B}', '\u{1F9C}', '\u{1F9D}', '\u{1F9E}', '\u{1F9F}', '\u{1FA8}', '\u{1FA9}', '\u{1FAA}', '\u{1FAB}', '\u{1FAC}', '\u{1FAD}', '\u{1FAE}', '\u{1FAF}', '\u{1FBC}', '\u{1FCC}') - } - - fn is_unicode_modifier_letter(self) -> bool { - match_char_class!(self, - '\u{02B0}', '\u{02B1}', '\u{02B2}', '\u{02B3}', '\u{02B4}', '\u{02B5}', '\u{02B6}', '\u{02B7}', '\u{02B8}', '\u{02B9}', '\u{02BA}', '\u{02BB}', '\u{02BC}', '\u{02BD}', '\u{02BE}', '\u{02BF}', '\u{02C0}', '\u{02C1}', '\u{02C6}', '\u{02C7}', '\u{02C8}', '\u{02C9}', '\u{02CA}', '\u{02CB}', '\u{02CC}', '\u{02CD}', '\u{02CE}', '\u{02CF}', '\u{02D0}', '\u{02D1}', '\u{02E0}', '\u{02E1}', '\u{02E2}', '\u{02E3}', '\u{02E4}', '\u{02EC}', '\u{02EE}', '\u{0374}', '\u{037A}', '\u{0559}', '\u{0640}', '\u{06E5}', '\u{06E6}', '\u{07F4}', '\u{07F5}', '\u{07FA}', '\u{0971}', '\u{0E46}', '\u{0EC6}', '\u{10FC}', '\u{17D7}', '\u{1843}', '\u{1C78}', '\u{1C79}', '\u{1C7A}', '\u{1C7B}', '\u{1C7C}', '\u{1C7D}', '\u{1D2C}', '\u{1D2D}', '\u{1D2E}', '\u{1D2F}', '\u{1D30}', '\u{1D31}', '\u{1D32}', '\u{1D33}', '\u{1D34}', '\u{1D35}', '\u{1D36}', '\u{1D37}', '\u{1D38}', '\u{1D39}', '\u{1D3A}', '\u{1D3B}', '\u{1D3C}', '\u{1D3D}', '\u{1D3E}', '\u{1D3F}', '\u{1D40}', '\u{1D41}', '\u{1D42}', '\u{1D43}', '\u{1D44}', '\u{1D45}', '\u{1D46}', '\u{1D47}', '\u{1D48}', '\u{1D49}', '\u{1D4A}', '\u{1D4B}', '\u{1D4C}', '\u{1D4D}', '\u{1D4E}', '\u{1D4F}', '\u{1D50}', '\u{1D51}', '\u{1D52}', '\u{1D53}', '\u{1D54}', '\u{1D55}', '\u{1D56}', '\u{1D57}', '\u{1D58}', '\u{1D59}', '\u{1D5A}', '\u{1D5B}', '\u{1D5C}', '\u{1D5D}', '\u{1D5E}', '\u{1D5F}', '\u{1D60}', '\u{1D61}', '\u{1D78}', '\u{1D9B}', '\u{1D9C}', '\u{1D9D}', '\u{1D9E}', '\u{1D9F}', '\u{1DA0}', '\u{1DA1}', '\u{1DA2}', '\u{1DA3}', '\u{1DA4}', '\u{1DA5}', '\u{1DA6}', '\u{1DA7}', '\u{1DA8}', '\u{1DA9}', '\u{1DAA}', '\u{1DAB}', '\u{1DAC}', '\u{1DAD}', '\u{1DAE}', '\u{1DAF}', '\u{1DB0}', '\u{1DB1}', '\u{1DB2}', '\u{1DB3}', '\u{1DB4}', '\u{1DB5}', '\u{1DB6}', '\u{1DB7}', '\u{1DB8}', '\u{1DB9}', '\u{1DBA}', '\u{1DBB}', '\u{1DBC}', '\u{1DBD}', '\u{1DBE}', '\u{1DBF}', '\u{2090}', '\u{2091}', '\u{2092}', '\u{2093}', '\u{2094}', '\u{2C7D}', '\u{2D6F}', '\u{2E2F}', '\u{3005}', '\u{3031}', '\u{3032}', '\u{3033}', '\u{3034}', '\u{3035}', '\u{303B}', '\u{309D}', '\u{309E}', '\u{30FC}', '\u{30FD}', '\u{30FE}', '\u{A015}', '\u{A60C}', '\u{A67F}', '\u{A717}', '\u{A718}', '\u{A719}', '\u{A71A}', '\u{A71B}', '\u{A71C}', '\u{A71D}', '\u{A71E}', '\u{A71F}', '\u{A770}', '\u{A788}', '\u{FF70}', '\u{FF9E}', '\u{FF9F}') - } - - fn is_unicode_other_letter(self) -> bool { - match_char_class!(self, - '\u{01BB}', '\u{01C0}', '\u{01C1}', '\u{01C2}', '\u{01C3}', '\u{0294}', '\u{05D0}', '\u{05D1}', '\u{05D2}', '\u{05D3}', '\u{05D4}', '\u{05D5}', '\u{05D6}', '\u{05D7}', '\u{05D8}', '\u{05D9}', '\u{05DA}', '\u{05DB}', '\u{05DC}', '\u{05DD}', '\u{05DE}', '\u{05DF}', '\u{05E0}', '\u{05E1}', '\u{05E2}', '\u{05E3}', '\u{05E4}', '\u{05E5}', '\u{05E6}', '\u{05E7}', '\u{05E8}', '\u{05E9}', '\u{05EA}', '\u{05F0}', '\u{05F1}', '\u{05F2}', '\u{0621}', '\u{0622}', '\u{0623}', '\u{0624}', '\u{0625}', '\u{0626}', '\u{0627}', '\u{0628}', '\u{0629}', '\u{062A}', '\u{062B}', '\u{062C}', '\u{062D}', '\u{062E}', '\u{062F}', '\u{0630}', '\u{0631}', '\u{0632}', '\u{0633}', '\u{0634}', '\u{0635}', '\u{0636}', '\u{0637}', '\u{0638}', '\u{0639}', '\u{063A}', '\u{063B}', '\u{063C}', '\u{063D}', '\u{063E}', '\u{063F}', '\u{0641}', '\u{0642}', '\u{0643}', '\u{0644}', '\u{0645}', '\u{0646}', '\u{0647}', '\u{0648}', '\u{0649}', '\u{064A}', '\u{066E}', '\u{066F}', '\u{0671}', '\u{0672}', '\u{0673}', '\u{0674}', '\u{0675}', '\u{0676}', '\u{0677}', '\u{0678}', '\u{0679}', '\u{067A}', '\u{067B}', '\u{067C}', '\u{067D}', '\u{067E}', '\u{067F}', '\u{0680}', '\u{0681}', '\u{0682}', '\u{0683}', '\u{0684}', '\u{0685}', '\u{0686}', '\u{0687}', '\u{0688}', '\u{0689}', '\u{068A}', '\u{068B}', '\u{068C}', '\u{068D}', '\u{068E}', '\u{068F}', '\u{0690}', '\u{0691}', '\u{0692}', '\u{0693}', '\u{0694}', '\u{0695}', '\u{0696}', '\u{0697}', '\u{0698}', '\u{0699}', '\u{069A}', '\u{069B}', '\u{069C}', '\u{069D}', '\u{069E}', '\u{069F}', '\u{06A0}', '\u{06A1}', '\u{06A2}', '\u{06A3}', '\u{06A4}', '\u{06A5}', '\u{06A6}', '\u{06A7}', '\u{06A8}', '\u{06A9}', '\u{06AA}', '\u{06AB}', '\u{06AC}', '\u{06AD}', '\u{06AE}', '\u{06AF}', '\u{06B0}', '\u{06B1}', '\u{06B2}', '\u{06B3}', '\u{06B4}', '\u{06B5}', '\u{06B6}', '\u{06B7}', '\u{06B8}', '\u{06B9}', '\u{06BA}', '\u{06BB}', '\u{06BC}', '\u{06BD}', '\u{06BE}', '\u{06BF}', '\u{06C0}', '\u{06C1}', '\u{06C2}', '\u{06C3}', '\u{06C4}', '\u{06C5}', '\u{06C6}', '\u{06C7}', '\u{06C8}', '\u{06C9}', '\u{06CA}', '\u{06CB}', '\u{06CC}', '\u{06CD}', '\u{06CE}', '\u{06CF}', '\u{06D0}', '\u{06D1}', '\u{06D2}', '\u{06D3}', '\u{06D5}', '\u{06EE}', '\u{06EF}', '\u{06FA}', '\u{06FB}', '\u{06FC}', '\u{06FF}', '\u{0710}', '\u{0712}', '\u{0713}', '\u{0714}', '\u{0715}', '\u{0716}', '\u{0717}', '\u{0718}', '\u{0719}', '\u{071A}', '\u{071B}', '\u{071C}', '\u{071D}', '\u{071E}', '\u{071F}', '\u{0720}', '\u{0721}', '\u{0722}', '\u{0723}', '\u{0724}', '\u{0725}', '\u{0726}', '\u{0727}', '\u{0728}', '\u{0729}', '\u{072A}', '\u{072B}', '\u{072C}', '\u{072D}', '\u{072E}', '\u{072F}', '\u{074D}', '\u{074E}', '\u{074F}', '\u{0750}', '\u{0751}', '\u{0752}', '\u{0753}', '\u{0754}', '\u{0755}', '\u{0756}', '\u{0757}', '\u{0758}', '\u{0759}', '\u{075A}', '\u{075B}', '\u{075C}', '\u{075D}', '\u{075E}', '\u{075F}', '\u{0760}', '\u{0761}', '\u{0762}', '\u{0763}', '\u{0764}', '\u{0765}', '\u{0766}', '\u{0767}', '\u{0768}', '\u{0769}', '\u{076A}', '\u{076B}', '\u{076C}', '\u{076D}', '\u{076E}', '\u{076F}', '\u{0770}', '\u{0771}', '\u{0772}', '\u{0773}', '\u{0774}', '\u{0775}', '\u{0776}', '\u{0777}', '\u{0778}', '\u{0779}', '\u{077A}', '\u{077B}', '\u{077C}', '\u{077D}', '\u{077E}', '\u{077F}', '\u{0780}', '\u{0781}', '\u{0782}', '\u{0783}', '\u{0784}', '\u{0785}', '\u{0786}', '\u{0787}', '\u{0788}', '\u{0789}', '\u{078A}', '\u{078B}', '\u{078C}', '\u{078D}', '\u{078E}', '\u{078F}', '\u{0790}', '\u{0791}', '\u{0792}', '\u{0793}', '\u{0794}', '\u{0795}', '\u{0796}', '\u{0797}', '\u{0798}', '\u{0799}', '\u{079A}', '\u{079B}', '\u{079C}', '\u{079D}', '\u{079E}', '\u{079F}', '\u{07A0}', '\u{07A1}', '\u{07A2}', '\u{07A3}', '\u{07A4}', '\u{07A5}', '\u{07B1}', '\u{07CA}', '\u{07CB}', '\u{07CC}', '\u{07CD}', '\u{07CE}', '\u{07CF}', '\u{07D0}', '\u{07D1}', '\u{07D2}', '\u{07D3}', '\u{07D4}', '\u{07D5}', '\u{07D6}', '\u{07D7}', '\u{07D8}', '\u{07D9}', '\u{07DA}', '\u{07DB}', '\u{07DC}', '\u{07DD}', '\u{07DE}', '\u{07DF}', '\u{07E0}', '\u{07E1}', '\u{07E2}', '\u{07E3}', '\u{07E4}', '\u{07E5}', '\u{07E6}', '\u{07E7}', '\u{07E8}', '\u{07E9}', '\u{07EA}', '\u{0904}', '\u{0905}', '\u{0906}', '\u{0907}', '\u{0908}', '\u{0909}', '\u{090A}', '\u{090B}', '\u{090C}', '\u{090D}', '\u{090E}', '\u{090F}', '\u{0910}', '\u{0911}', '\u{0912}', '\u{0913}', '\u{0914}', '\u{0915}', '\u{0916}', '\u{0917}', '\u{0918}', '\u{0919}', '\u{091A}', '\u{091B}', '\u{091C}', '\u{091D}', '\u{091E}', '\u{091F}', '\u{0920}', '\u{0921}', '\u{0922}', '\u{0923}', '\u{0924}', '\u{0925}', '\u{0926}', '\u{0927}', '\u{0928}', '\u{0929}', '\u{092A}', '\u{092B}', '\u{092C}', '\u{092D}', '\u{092E}', '\u{092F}', '\u{0930}', '\u{0931}', '\u{0932}', '\u{0933}', '\u{0934}', '\u{0935}', '\u{0936}', '\u{0937}', '\u{0938}', '\u{0939}', '\u{093D}', '\u{0950}', '\u{0958}', '\u{0959}', '\u{095A}', '\u{095B}', '\u{095C}', '\u{095D}', '\u{095E}', '\u{095F}', '\u{0960}', '\u{0961}', '\u{0972}', '\u{097B}', '\u{097C}', '\u{097D}', '\u{097E}', '\u{097F}', '\u{0985}', '\u{0986}', '\u{0987}', '\u{0988}', '\u{0989}', '\u{098A}', '\u{098B}', '\u{098C}', '\u{098F}', '\u{0990}', '\u{0993}', '\u{0994}', '\u{0995}', '\u{0996}', '\u{0997}', '\u{0998}', '\u{0999}', '\u{099A}', '\u{099B}', '\u{099C}', '\u{099D}', '\u{099E}', '\u{099F}', '\u{09A0}', '\u{09A1}', '\u{09A2}', '\u{09A3}', '\u{09A4}', '\u{09A5}', '\u{09A6}', '\u{09A7}', '\u{09A8}', '\u{09AA}', '\u{09AB}', '\u{09AC}', '\u{09AD}', '\u{09AE}', '\u{09AF}', '\u{09B0}', '\u{09B2}', '\u{09B6}', '\u{09B7}', '\u{09B8}', '\u{09B9}', '\u{09BD}', '\u{09CE}', '\u{09DC}', '\u{09DD}', '\u{09DF}', '\u{09E0}', '\u{09E1}', '\u{09F0}', '\u{09F1}', '\u{0A05}', '\u{0A06}', '\u{0A07}', '\u{0A08}', '\u{0A09}', '\u{0A0A}', '\u{0A0F}', '\u{0A10}', '\u{0A13}', '\u{0A14}', '\u{0A15}', '\u{0A16}', '\u{0A17}', '\u{0A18}', '\u{0A19}', '\u{0A1A}', '\u{0A1B}', '\u{0A1C}', '\u{0A1D}', '\u{0A1E}', '\u{0A1F}', '\u{0A20}', '\u{0A21}', '\u{0A22}', '\u{0A23}', '\u{0A24}', '\u{0A25}', '\u{0A26}', '\u{0A27}', '\u{0A28}', '\u{0A2A}', '\u{0A2B}', '\u{0A2C}', '\u{0A2D}', '\u{0A2E}', '\u{0A2F}', '\u{0A30}', '\u{0A32}', '\u{0A33}', '\u{0A35}', '\u{0A36}', '\u{0A38}', '\u{0A39}', '\u{0A59}', '\u{0A5A}', '\u{0A5B}', '\u{0A5C}', '\u{0A5E}', '\u{0A72}', '\u{0A73}', '\u{0A74}', '\u{0A85}', '\u{0A86}', '\u{0A87}', '\u{0A88}', '\u{0A89}', '\u{0A8A}', '\u{0A8B}', '\u{0A8C}', '\u{0A8D}', '\u{0A8F}', '\u{0A90}', '\u{0A91}', '\u{0A93}', '\u{0A94}', '\u{0A95}', '\u{0A96}', '\u{0A97}', '\u{0A98}', '\u{0A99}', '\u{0A9A}', '\u{0A9B}', '\u{0A9C}', '\u{0A9D}', '\u{0A9E}', '\u{0A9F}', '\u{0AA0}', '\u{0AA1}', '\u{0AA2}', '\u{0AA3}', '\u{0AA4}', '\u{0AA5}', '\u{0AA6}', '\u{0AA7}', '\u{0AA8}', '\u{0AAA}', '\u{0AAB}', '\u{0AAC}', '\u{0AAD}', '\u{0AAE}', '\u{0AAF}', '\u{0AB0}', '\u{0AB2}', '\u{0AB3}', '\u{0AB5}', '\u{0AB6}', '\u{0AB7}', '\u{0AB8}', '\u{0AB9}', '\u{0ABD}', '\u{0AD0}', '\u{0AE0}', '\u{0AE1}', '\u{0B05}', '\u{0B06}', '\u{0B07}', '\u{0B08}', '\u{0B09}', '\u{0B0A}', '\u{0B0B}', '\u{0B0C}', '\u{0B0F}', '\u{0B10}', '\u{0B13}', '\u{0B14}', '\u{0B15}', '\u{0B16}', '\u{0B17}', '\u{0B18}', '\u{0B19}', '\u{0B1A}', '\u{0B1B}', '\u{0B1C}', '\u{0B1D}', '\u{0B1E}', '\u{0B1F}', '\u{0B20}', '\u{0B21}', '\u{0B22}', '\u{0B23}', '\u{0B24}', '\u{0B25}', '\u{0B26}', '\u{0B27}', '\u{0B28}', '\u{0B2A}', '\u{0B2B}', '\u{0B2C}', '\u{0B2D}', '\u{0B2E}', '\u{0B2F}', '\u{0B30}', '\u{0B32}', '\u{0B33}', '\u{0B35}', '\u{0B36}', '\u{0B37}', '\u{0B38}', '\u{0B39}', '\u{0B3D}', '\u{0B5C}', '\u{0B5D}', '\u{0B5F}', '\u{0B60}', '\u{0B61}', '\u{0B71}', '\u{0B83}', '\u{0B85}', '\u{0B86}', '\u{0B87}', '\u{0B88}', '\u{0B89}', '\u{0B8A}', '\u{0B8E}', '\u{0B8F}', '\u{0B90}', '\u{0B92}', '\u{0B93}', '\u{0B94}', '\u{0B95}', '\u{0B99}', '\u{0B9A}', '\u{0B9C}', '\u{0B9E}', '\u{0B9F}', '\u{0BA3}', '\u{0BA4}', '\u{0BA8}', '\u{0BA9}', '\u{0BAA}', '\u{0BAE}', '\u{0BAF}', '\u{0BB0}', '\u{0BB1}', '\u{0BB2}', '\u{0BB3}', '\u{0BB4}', '\u{0BB5}', '\u{0BB6}', '\u{0BB7}', '\u{0BB8}', '\u{0BB9}', '\u{0BD0}', '\u{0C05}', '\u{0C06}', '\u{0C07}', '\u{0C08}', '\u{0C09}', '\u{0C0A}', '\u{0C0B}', '\u{0C0C}', '\u{0C0E}', '\u{0C0F}', '\u{0C10}', '\u{0C12}', '\u{0C13}', '\u{0C14}', '\u{0C15}', '\u{0C16}', '\u{0C17}', '\u{0C18}', '\u{0C19}', '\u{0C1A}', '\u{0C1B}', '\u{0C1C}', '\u{0C1D}', '\u{0C1E}', '\u{0C1F}', '\u{0C20}', '\u{0C21}', '\u{0C22}', '\u{0C23}', '\u{0C24}', '\u{0C25}', '\u{0C26}', '\u{0C27}', '\u{0C28}', '\u{0C2A}', '\u{0C2B}', '\u{0C2C}', '\u{0C2D}', '\u{0C2E}', '\u{0C2F}', '\u{0C30}', '\u{0C31}', '\u{0C32}', '\u{0C33}', '\u{0C35}', '\u{0C36}', '\u{0C37}', '\u{0C38}', '\u{0C39}', '\u{0C3D}', '\u{0C58}', '\u{0C59}', '\u{0C60}', '\u{0C61}', '\u{0C85}', '\u{0C86}', '\u{0C87}', '\u{0C88}', '\u{0C89}', '\u{0C8A}', '\u{0C8B}', '\u{0C8C}', '\u{0C8E}', '\u{0C8F}', '\u{0C90}', '\u{0C92}', '\u{0C93}', '\u{0C94}', '\u{0C95}', '\u{0C96}', '\u{0C97}', '\u{0C98}', '\u{0C99}', '\u{0C9A}', '\u{0C9B}', '\u{0C9C}', '\u{0C9D}', '\u{0C9E}', '\u{0C9F}', '\u{0CA0}', '\u{0CA1}', '\u{0CA2}', '\u{0CA3}', '\u{0CA4}', '\u{0CA5}', '\u{0CA6}', '\u{0CA7}', '\u{0CA8}', '\u{0CAA}', '\u{0CAB}', '\u{0CAC}', '\u{0CAD}', '\u{0CAE}', '\u{0CAF}', '\u{0CB0}', '\u{0CB1}', '\u{0CB2}', '\u{0CB3}', '\u{0CB5}', '\u{0CB6}', '\u{0CB7}', '\u{0CB8}', '\u{0CB9}', '\u{0CBD}', '\u{0CDE}', '\u{0CE0}', '\u{0CE1}', '\u{0D05}', '\u{0D06}', '\u{0D07}', '\u{0D08}', '\u{0D09}', '\u{0D0A}', '\u{0D0B}', '\u{0D0C}', '\u{0D0E}', '\u{0D0F}', '\u{0D10}', '\u{0D12}', '\u{0D13}', '\u{0D14}', '\u{0D15}', '\u{0D16}', '\u{0D17}', '\u{0D18}', '\u{0D19}', '\u{0D1A}', '\u{0D1B}', '\u{0D1C}', '\u{0D1D}', '\u{0D1E}', '\u{0D1F}', '\u{0D20}', '\u{0D21}', '\u{0D22}', '\u{0D23}', '\u{0D24}', '\u{0D25}', '\u{0D26}', '\u{0D27}', '\u{0D28}', '\u{0D2A}', '\u{0D2B}', '\u{0D2C}', '\u{0D2D}', '\u{0D2E}', '\u{0D2F}', '\u{0D30}', '\u{0D31}', '\u{0D32}', '\u{0D33}', '\u{0D34}', '\u{0D35}', '\u{0D36}', '\u{0D37}', '\u{0D38}', '\u{0D39}', '\u{0D3D}', '\u{0D60}', '\u{0D61}', '\u{0D7A}', '\u{0D7B}', '\u{0D7C}', '\u{0D7D}', '\u{0D7E}', '\u{0D7F}', '\u{0D85}', '\u{0D86}', '\u{0D87}', '\u{0D88}', '\u{0D89}', '\u{0D8A}', '\u{0D8B}', '\u{0D8C}', '\u{0D8D}', '\u{0D8E}', '\u{0D8F}', '\u{0D90}', '\u{0D91}', '\u{0D92}', '\u{0D93}', '\u{0D94}', '\u{0D95}', '\u{0D96}', '\u{0D9A}', '\u{0D9B}', '\u{0D9C}', '\u{0D9D}', '\u{0D9E}', '\u{0D9F}', '\u{0DA0}', '\u{0DA1}', '\u{0DA2}', '\u{0DA3}', '\u{0DA4}', '\u{0DA5}', '\u{0DA6}', '\u{0DA7}', '\u{0DA8}', '\u{0DA9}', '\u{0DAA}', '\u{0DAB}', '\u{0DAC}', '\u{0DAD}', '\u{0DAE}', '\u{0DAF}', '\u{0DB0}', '\u{0DB1}', '\u{0DB3}', '\u{0DB4}', '\u{0DB5}', '\u{0DB6}', '\u{0DB7}', '\u{0DB8}', '\u{0DB9}', '\u{0DBA}', '\u{0DBB}', '\u{0DBD}', '\u{0DC0}', '\u{0DC1}', '\u{0DC2}', '\u{0DC3}', '\u{0DC4}', '\u{0DC5}', '\u{0DC6}', '\u{0E01}', '\u{0E02}', '\u{0E03}', '\u{0E04}', '\u{0E05}', '\u{0E06}', '\u{0E07}', '\u{0E08}', '\u{0E09}', '\u{0E0A}', '\u{0E0B}', '\u{0E0C}', '\u{0E0D}', '\u{0E0E}', '\u{0E0F}', '\u{0E10}', '\u{0E11}', '\u{0E12}', '\u{0E13}', '\u{0E14}', '\u{0E15}', '\u{0E16}', '\u{0E17}', '\u{0E18}', '\u{0E19}', '\u{0E1A}', '\u{0E1B}', '\u{0E1C}', '\u{0E1D}', '\u{0E1E}', '\u{0E1F}', '\u{0E20}', '\u{0E21}', '\u{0E22}', '\u{0E23}', '\u{0E24}', '\u{0E25}', '\u{0E26}', '\u{0E27}', '\u{0E28}', '\u{0E29}', '\u{0E2A}', '\u{0E2B}', '\u{0E2C}', '\u{0E2D}', '\u{0E2E}', '\u{0E2F}', '\u{0E30}', '\u{0E32}', '\u{0E33}', '\u{0E40}', '\u{0E41}', '\u{0E42}', '\u{0E43}', '\u{0E44}', '\u{0E45}', '\u{0E81}', '\u{0E82}', '\u{0E84}', '\u{0E87}', '\u{0E88}', '\u{0E8A}', '\u{0E8D}', '\u{0E94}', '\u{0E95}', '\u{0E96}', '\u{0E97}', '\u{0E99}', '\u{0E9A}', '\u{0E9B}', '\u{0E9C}', '\u{0E9D}', '\u{0E9E}', '\u{0E9F}', '\u{0EA1}', '\u{0EA2}', '\u{0EA3}', '\u{0EA5}', '\u{0EA7}', '\u{0EAA}', '\u{0EAB}', '\u{0EAD}', '\u{0EAE}', '\u{0EAF}', '\u{0EB0}', '\u{0EB2}', '\u{0EB3}', '\u{0EBD}', '\u{0EC0}', '\u{0EC1}', '\u{0EC2}', '\u{0EC3}', '\u{0EC4}', '\u{0EDC}', '\u{0EDD}', '\u{0F00}', '\u{0F40}', '\u{0F41}', '\u{0F42}', '\u{0F43}', '\u{0F44}', '\u{0F45}', '\u{0F46}', '\u{0F47}', '\u{0F49}', '\u{0F4A}', '\u{0F4B}', '\u{0F4C}', '\u{0F4D}', '\u{0F4E}', '\u{0F4F}', '\u{0F50}', '\u{0F51}', '\u{0F52}', '\u{0F53}', '\u{0F54}', '\u{0F55}', '\u{0F56}', '\u{0F57}', '\u{0F58}', '\u{0F59}', '\u{0F5A}', '\u{0F5B}', '\u{0F5C}', '\u{0F5D}', '\u{0F5E}', '\u{0F5F}', '\u{0F60}', '\u{0F61}', '\u{0F62}', '\u{0F63}', '\u{0F64}', '\u{0F65}', '\u{0F66}', '\u{0F67}', '\u{0F68}', '\u{0F69}', '\u{0F6A}', '\u{0F6B}', '\u{0F6C}', '\u{0F88}', '\u{0F89}', '\u{0F8A}', '\u{0F8B}', '\u{1000}', '\u{1001}', '\u{1002}', '\u{1003}', '\u{1004}', '\u{1005}', '\u{1006}', '\u{1007}', '\u{1008}', '\u{1009}', '\u{100A}', '\u{100B}', '\u{100C}', '\u{100D}', '\u{100E}', '\u{100F}', '\u{1010}', '\u{1011}', '\u{1012}', '\u{1013}', '\u{1014}', '\u{1015}', '\u{1016}', '\u{1017}', '\u{1018}', '\u{1019}', '\u{101A}', '\u{101B}', '\u{101C}', '\u{101D}', '\u{101E}', '\u{101F}', '\u{1020}', '\u{1021}', '\u{1022}', '\u{1023}', '\u{1024}', '\u{1025}', '\u{1026}', '\u{1027}', '\u{1028}', '\u{1029}', '\u{102A}', '\u{103F}', '\u{1050}', '\u{1051}', '\u{1052}', '\u{1053}', '\u{1054}', '\u{1055}', '\u{105A}', '\u{105B}', '\u{105C}', '\u{105D}', '\u{1061}', '\u{1065}', '\u{1066}', '\u{106E}', '\u{106F}', '\u{1070}', '\u{1075}', '\u{1076}', '\u{1077}', '\u{1078}', '\u{1079}', '\u{107A}', '\u{107B}', '\u{107C}', '\u{107D}', '\u{107E}', '\u{107F}', '\u{1080}', '\u{1081}', '\u{108E}', '\u{10D0}', '\u{10D1}', '\u{10D2}', '\u{10D3}', '\u{10D4}', '\u{10D5}', '\u{10D6}', '\u{10D7}', '\u{10D8}', '\u{10D9}', '\u{10DA}', '\u{10DB}', '\u{10DC}', '\u{10DD}', '\u{10DE}', '\u{10DF}', '\u{10E0}', '\u{10E1}', '\u{10E2}', '\u{10E3}', '\u{10E4}', '\u{10E5}', '\u{10E6}', '\u{10E7}', '\u{10E8}', '\u{10E9}', '\u{10EA}', '\u{10EB}', '\u{10EC}', '\u{10ED}', '\u{10EE}', '\u{10EF}', '\u{10F0}', '\u{10F1}', '\u{10F2}', '\u{10F3}', '\u{10F4}', '\u{10F5}', '\u{10F6}', '\u{10F7}', '\u{10F8}', '\u{10F9}', '\u{10FA}', '\u{1100}', '\u{1101}', '\u{1102}', '\u{1103}', '\u{1104}', '\u{1105}', '\u{1106}', '\u{1107}', '\u{1108}', '\u{1109}', '\u{110A}', '\u{110B}', '\u{110C}', '\u{110D}', '\u{110E}', '\u{110F}', '\u{1110}', '\u{1111}', '\u{1112}', '\u{1113}', '\u{1114}', '\u{1115}', '\u{1116}', '\u{1117}', '\u{1118}', '\u{1119}', '\u{111A}', '\u{111B}', '\u{111C}', '\u{111D}', '\u{111E}', '\u{111F}', '\u{1120}', '\u{1121}', '\u{1122}', '\u{1123}', '\u{1124}', '\u{1125}', '\u{1126}', '\u{1127}', '\u{1128}', '\u{1129}', '\u{112A}', '\u{112B}', '\u{112C}', '\u{112D}', '\u{112E}', '\u{112F}', '\u{1130}', '\u{1131}', '\u{1132}', '\u{1133}', '\u{1134}', '\u{1135}', '\u{1136}', '\u{1137}', '\u{1138}', '\u{1139}', '\u{113A}', '\u{113B}', '\u{113C}', '\u{113D}', '\u{113E}', '\u{113F}', '\u{1140}', '\u{1141}', '\u{1142}', '\u{1143}', '\u{1144}', '\u{1145}', '\u{1146}', '\u{1147}', '\u{1148}', '\u{1149}', '\u{114A}', '\u{114B}', '\u{114C}', '\u{114D}', '\u{114E}', '\u{114F}', '\u{1150}', '\u{1151}', '\u{1152}', '\u{1153}', '\u{1154}', '\u{1155}', '\u{1156}', '\u{1157}', '\u{1158}', '\u{1159}', '\u{115F}', '\u{1160}', '\u{1161}', '\u{1162}', '\u{1163}', '\u{1164}', '\u{1165}', '\u{1166}', '\u{1167}', '\u{1168}', '\u{1169}', '\u{116A}', '\u{116B}', '\u{116C}', '\u{116D}', '\u{116E}', '\u{116F}', '\u{1170}', '\u{1171}', '\u{1172}', '\u{1173}', '\u{1174}', '\u{1175}', '\u{1176}', '\u{1177}', '\u{1178}', '\u{1179}', '\u{117A}', '\u{117B}', '\u{117C}', '\u{117D}', '\u{117E}', '\u{117F}', '\u{1180}', '\u{1181}', '\u{1182}', '\u{1183}', '\u{1184}', '\u{1185}', '\u{1186}', '\u{1187}', '\u{1188}', '\u{1189}', '\u{118A}', '\u{118B}', '\u{118C}', '\u{118D}', '\u{118E}', '\u{118F}', '\u{1190}', '\u{1191}', '\u{1192}', '\u{1193}', '\u{1194}', '\u{1195}', '\u{1196}', '\u{1197}', '\u{1198}', '\u{1199}', '\u{119A}', '\u{119B}', '\u{119C}', '\u{119D}', '\u{119E}', '\u{119F}', '\u{11A0}', '\u{11A1}', '\u{11A2}', '\u{11A8}', '\u{11A9}', '\u{11AA}', '\u{11AB}', '\u{11AC}', '\u{11AD}', '\u{11AE}', '\u{11AF}', '\u{11B0}', '\u{11B1}', '\u{11B2}', '\u{11B3}', '\u{11B4}', '\u{11B5}', '\u{11B6}', '\u{11B7}', '\u{11B8}', '\u{11B9}', '\u{11BA}', '\u{11BB}', '\u{11BC}', '\u{11BD}', '\u{11BE}', '\u{11BF}', '\u{11C0}', '\u{11C1}', '\u{11C2}', '\u{11C3}', '\u{11C4}', '\u{11C5}', '\u{11C6}', '\u{11C7}', '\u{11C8}', '\u{11C9}', '\u{11CA}', '\u{11CB}', '\u{11CC}', '\u{11CD}', '\u{11CE}', '\u{11CF}', '\u{11D0}', '\u{11D1}', '\u{11D2}', '\u{11D3}', '\u{11D4}', '\u{11D5}', '\u{11D6}', '\u{11D7}', '\u{11D8}', '\u{11D9}', '\u{11DA}', '\u{11DB}', '\u{11DC}', '\u{11DD}', '\u{11DE}', '\u{11DF}', '\u{11E0}', '\u{11E1}', '\u{11E2}', '\u{11E3}', '\u{11E4}', '\u{11E5}', '\u{11E6}', '\u{11E7}', '\u{11E8}', '\u{11E9}', '\u{11EA}', '\u{11EB}', '\u{11EC}', '\u{11ED}', '\u{11EE}', '\u{11EF}', '\u{11F0}', '\u{11F1}', '\u{11F2}', '\u{11F3}', '\u{11F4}', '\u{11F5}', '\u{11F6}', '\u{11F7}', '\u{11F8}', '\u{11F9}', '\u{1200}', '\u{1201}', '\u{1202}', '\u{1203}', '\u{1204}', '\u{1205}', '\u{1206}', '\u{1207}', '\u{1208}', '\u{1209}', '\u{120A}', '\u{120B}', '\u{120C}', '\u{120D}', '\u{120E}', '\u{120F}', '\u{1210}', '\u{1211}', '\u{1212}', '\u{1213}', '\u{1214}', '\u{1215}', '\u{1216}', '\u{1217}', '\u{1218}', '\u{1219}', '\u{121A}', '\u{121B}', '\u{121C}', '\u{121D}', '\u{121E}', '\u{121F}', '\u{1220}', '\u{1221}', '\u{1222}', '\u{1223}', '\u{1224}', '\u{1225}', '\u{1226}', '\u{1227}', '\u{1228}', '\u{1229}', '\u{122A}', '\u{122B}', '\u{122C}', '\u{122D}', '\u{122E}', '\u{122F}', '\u{1230}', '\u{1231}', '\u{1232}', '\u{1233}', '\u{1234}', '\u{1235}', '\u{1236}', '\u{1237}', '\u{1238}', '\u{1239}', '\u{123A}', '\u{123B}', '\u{123C}', '\u{123D}', '\u{123E}', '\u{123F}', '\u{1240}', '\u{1241}', '\u{1242}', '\u{1243}', '\u{1244}', '\u{1245}', '\u{1246}', '\u{1247}', '\u{1248}', '\u{124A}', '\u{124B}', '\u{124C}', '\u{124D}', '\u{1250}', '\u{1251}', '\u{1252}', '\u{1253}', '\u{1254}', '\u{1255}', '\u{1256}', '\u{1258}', '\u{125A}', '\u{125B}', '\u{125C}', '\u{125D}', '\u{1260}', '\u{1261}', '\u{1262}', '\u{1263}', '\u{1264}', '\u{1265}', '\u{1266}', '\u{1267}', '\u{1268}', '\u{1269}', '\u{126A}', '\u{126B}', '\u{126C}', '\u{126D}', '\u{126E}', '\u{126F}', '\u{1270}', '\u{1271}', '\u{1272}', '\u{1273}', '\u{1274}', '\u{1275}', '\u{1276}', '\u{1277}', '\u{1278}', '\u{1279}', '\u{127A}', '\u{127B}', '\u{127C}', '\u{127D}', '\u{127E}', '\u{127F}', '\u{1280}', '\u{1281}', '\u{1282}', '\u{1283}', '\u{1284}', '\u{1285}', '\u{1286}', '\u{1287}', '\u{1288}', '\u{128A}', '\u{128B}', '\u{128C}', '\u{128D}', '\u{1290}', '\u{1291}', '\u{1292}', '\u{1293}', '\u{1294}', '\u{1295}', '\u{1296}', '\u{1297}', '\u{1298}', '\u{1299}', '\u{129A}', '\u{129B}', '\u{129C}', '\u{129D}', '\u{129E}', '\u{129F}', '\u{12A0}', '\u{12A1}', '\u{12A2}', '\u{12A3}', '\u{12A4}', '\u{12A5}', '\u{12A6}', '\u{12A7}', '\u{12A8}', '\u{12A9}', '\u{12AA}', '\u{12AB}', '\u{12AC}', '\u{12AD}', '\u{12AE}', '\u{12AF}', '\u{12B0}', '\u{12B2}', '\u{12B3}', '\u{12B4}', '\u{12B5}', '\u{12B8}', '\u{12B9}', '\u{12BA}', '\u{12BB}', '\u{12BC}', '\u{12BD}', '\u{12BE}', '\u{12C0}', '\u{12C2}', '\u{12C3}', '\u{12C4}', '\u{12C5}', '\u{12C8}', '\u{12C9}', '\u{12CA}', '\u{12CB}', '\u{12CC}', '\u{12CD}', '\u{12CE}', '\u{12CF}', '\u{12D0}', '\u{12D1}', '\u{12D2}', '\u{12D3}', '\u{12D4}', '\u{12D5}', '\u{12D6}', '\u{12D8}', '\u{12D9}', '\u{12DA}', '\u{12DB}', '\u{12DC}', '\u{12DD}', '\u{12DE}', '\u{12DF}', '\u{12E0}', '\u{12E1}', '\u{12E2}', '\u{12E3}', '\u{12E4}', '\u{12E5}', '\u{12E6}', '\u{12E7}', '\u{12E8}', '\u{12E9}', '\u{12EA}', '\u{12EB}', '\u{12EC}', '\u{12ED}', '\u{12EE}', '\u{12EF}', '\u{12F0}', '\u{12F1}', '\u{12F2}', '\u{12F3}', '\u{12F4}', '\u{12F5}', '\u{12F6}', '\u{12F7}', '\u{12F8}', '\u{12F9}', '\u{12FA}', '\u{12FB}', '\u{12FC}', '\u{12FD}', '\u{12FE}', '\u{12FF}', '\u{1300}', '\u{1301}', '\u{1302}', '\u{1303}', '\u{1304}', '\u{1305}', '\u{1306}', '\u{1307}', '\u{1308}', '\u{1309}', '\u{130A}', '\u{130B}', '\u{130C}', '\u{130D}', '\u{130E}', '\u{130F}', '\u{1310}', '\u{1312}', '\u{1313}', '\u{1314}', '\u{1315}', '\u{1318}', '\u{1319}', '\u{131A}', '\u{131B}', '\u{131C}', '\u{131D}', '\u{131E}', '\u{131F}', '\u{1320}', '\u{1321}', '\u{1322}', '\u{1323}', '\u{1324}', '\u{1325}', '\u{1326}', '\u{1327}', '\u{1328}', '\u{1329}', '\u{132A}', '\u{132B}', '\u{132C}', '\u{132D}', '\u{132E}', '\u{132F}', '\u{1330}', '\u{1331}', '\u{1332}', '\u{1333}', '\u{1334}', '\u{1335}', '\u{1336}', '\u{1337}', '\u{1338}', '\u{1339}', '\u{133A}', '\u{133B}', '\u{133C}', '\u{133D}', '\u{133E}', '\u{133F}', '\u{1340}', '\u{1341}', '\u{1342}', '\u{1343}', '\u{1344}', '\u{1345}', '\u{1346}', '\u{1347}', '\u{1348}', '\u{1349}', '\u{134A}', '\u{134B}', '\u{134C}', '\u{134D}', '\u{134E}', '\u{134F}', '\u{1350}', '\u{1351}', '\u{1352}', '\u{1353}', '\u{1354}', '\u{1355}', '\u{1356}', '\u{1357}', '\u{1358}', '\u{1359}', '\u{135A}', '\u{1380}', '\u{1381}', '\u{1382}', '\u{1383}', '\u{1384}', '\u{1385}', '\u{1386}', '\u{1387}', '\u{1388}', '\u{1389}', '\u{138A}', '\u{138B}', '\u{138C}', '\u{138D}', '\u{138E}', '\u{138F}', '\u{13A0}', '\u{13A1}', '\u{13A2}', '\u{13A3}', '\u{13A4}', '\u{13A5}', '\u{13A6}', '\u{13A7}', '\u{13A8}', '\u{13A9}', '\u{13AA}', '\u{13AB}', '\u{13AC}', '\u{13AD}', '\u{13AE}', '\u{13AF}', '\u{13B0}', '\u{13B1}', '\u{13B2}', '\u{13B3}', '\u{13B4}', '\u{13B5}', '\u{13B6}', '\u{13B7}', '\u{13B8}', '\u{13B9}', '\u{13BA}', '\u{13BB}', '\u{13BC}', '\u{13BD}', '\u{13BE}', '\u{13BF}', '\u{13C0}', '\u{13C1}', '\u{13C2}', '\u{13C3}', '\u{13C4}', '\u{13C5}', '\u{13C6}', '\u{13C7}', '\u{13C8}', '\u{13C9}', '\u{13CA}', '\u{13CB}', '\u{13CC}', '\u{13CD}', '\u{13CE}', '\u{13CF}', '\u{13D0}', '\u{13D1}', '\u{13D2}', '\u{13D3}', '\u{13D4}', '\u{13D5}', '\u{13D6}', '\u{13D7}', '\u{13D8}', '\u{13D9}', '\u{13DA}', '\u{13DB}', '\u{13DC}', '\u{13DD}', '\u{13DE}', '\u{13DF}', '\u{13E0}', '\u{13E1}', '\u{13E2}', '\u{13E3}', '\u{13E4}', '\u{13E5}', '\u{13E6}', '\u{13E7}', '\u{13E8}', '\u{13E9}', '\u{13EA}', '\u{13EB}', '\u{13EC}', '\u{13ED}', '\u{13EE}', '\u{13EF}', '\u{13F0}', '\u{13F1}', '\u{13F2}', '\u{13F3}', '\u{13F4}', '\u{1401}', '\u{1402}', '\u{1403}', '\u{1404}', '\u{1405}', '\u{1406}', '\u{1407}', '\u{1408}', '\u{1409}', '\u{140A}', '\u{140B}', '\u{140C}', '\u{140D}', '\u{140E}', '\u{140F}', '\u{1410}', '\u{1411}', '\u{1412}', '\u{1413}', '\u{1414}', '\u{1415}', '\u{1416}', '\u{1417}', '\u{1418}', '\u{1419}', '\u{141A}', '\u{141B}', '\u{141C}', '\u{141D}', '\u{141E}', '\u{141F}', '\u{1420}', '\u{1421}', '\u{1422}', '\u{1423}', '\u{1424}', '\u{1425}', '\u{1426}', '\u{1427}', '\u{1428}', '\u{1429}', '\u{142A}', '\u{142B}', '\u{142C}', '\u{142D}', '\u{142E}', '\u{142F}', '\u{1430}', '\u{1431}', '\u{1432}', '\u{1433}', '\u{1434}', '\u{1435}', '\u{1436}', '\u{1437}', '\u{1438}', '\u{1439}', '\u{143A}', '\u{143B}', '\u{143C}', '\u{143D}', '\u{143E}', '\u{143F}', '\u{1440}', '\u{1441}', '\u{1442}', '\u{1443}', '\u{1444}', '\u{1445}', '\u{1446}', '\u{1447}', '\u{1448}', '\u{1449}', '\u{144A}', '\u{144B}', '\u{144C}', '\u{144D}', '\u{144E}', '\u{144F}', '\u{1450}', '\u{1451}', '\u{1452}', '\u{1453}', '\u{1454}', '\u{1455}', '\u{1456}', '\u{1457}', '\u{1458}', '\u{1459}', '\u{145A}', '\u{145B}', '\u{145C}', '\u{145D}', '\u{145E}', '\u{145F}', '\u{1460}', '\u{1461}', '\u{1462}', '\u{1463}', '\u{1464}', '\u{1465}', '\u{1466}', '\u{1467}', '\u{1468}', '\u{1469}', '\u{146A}', '\u{146B}', '\u{146C}', '\u{146D}', '\u{146E}', '\u{146F}', '\u{1470}', '\u{1471}', '\u{1472}', '\u{1473}', '\u{1474}', '\u{1475}', '\u{1476}', '\u{1477}', '\u{1478}', '\u{1479}', '\u{147A}', '\u{147B}', '\u{147C}', '\u{147D}', '\u{147E}', '\u{147F}', '\u{1480}', '\u{1481}', '\u{1482}', '\u{1483}', '\u{1484}', '\u{1485}', '\u{1486}', '\u{1487}', '\u{1488}', '\u{1489}', '\u{148A}', '\u{148B}', '\u{148C}', '\u{148D}', '\u{148E}', '\u{148F}', '\u{1490}', '\u{1491}', '\u{1492}', '\u{1493}', '\u{1494}', '\u{1495}', '\u{1496}', '\u{1497}', '\u{1498}', '\u{1499}', '\u{149A}', '\u{149B}', '\u{149C}', '\u{149D}', '\u{149E}', '\u{149F}', '\u{14A0}', '\u{14A1}', '\u{14A2}', '\u{14A3}', '\u{14A4}', '\u{14A5}', '\u{14A6}', '\u{14A7}', '\u{14A8}', '\u{14A9}', '\u{14AA}', '\u{14AB}', '\u{14AC}', '\u{14AD}', '\u{14AE}', '\u{14AF}', '\u{14B0}', '\u{14B1}', '\u{14B2}', '\u{14B3}', '\u{14B4}', '\u{14B5}', '\u{14B6}', '\u{14B7}', '\u{14B8}', '\u{14B9}', '\u{14BA}', '\u{14BB}', '\u{14BC}', '\u{14BD}', '\u{14BE}', '\u{14BF}', '\u{14C0}', '\u{14C1}', '\u{14C2}', '\u{14C3}', '\u{14C4}', '\u{14C5}', '\u{14C6}', '\u{14C7}', '\u{14C8}', '\u{14C9}', '\u{14CA}', '\u{14CB}', '\u{14CC}', '\u{14CD}', '\u{14CE}', '\u{14CF}', '\u{14D0}', '\u{14D1}', '\u{14D2}', '\u{14D3}', '\u{14D4}', '\u{14D5}', '\u{14D6}', '\u{14D7}', '\u{14D8}', '\u{14D9}', '\u{14DA}', '\u{14DB}', '\u{14DC}', '\u{14DD}', '\u{14DE}', '\u{14DF}', '\u{14E0}', '\u{14E1}', '\u{14E2}', '\u{14E3}', '\u{14E4}', '\u{14E5}', '\u{14E6}', '\u{14E7}', '\u{14E8}', '\u{14E9}', '\u{14EA}', '\u{14EB}', '\u{14EC}', '\u{14ED}', '\u{14EE}', '\u{14EF}', '\u{14F0}', '\u{14F1}', '\u{14F2}', '\u{14F3}', '\u{14F4}', '\u{14F5}', '\u{14F6}', '\u{14F7}', '\u{14F8}', '\u{14F9}', '\u{14FA}', '\u{14FB}', '\u{14FC}', '\u{14FD}', '\u{14FE}', '\u{14FF}', '\u{1500}', '\u{1501}', '\u{1502}', '\u{1503}', '\u{1504}', '\u{1505}', '\u{1506}', '\u{1507}', '\u{1508}', '\u{1509}', '\u{150A}', '\u{150B}', '\u{150C}', '\u{150D}', '\u{150E}', '\u{150F}', '\u{1510}', '\u{1511}', '\u{1512}', '\u{1513}', '\u{1514}', '\u{1515}', '\u{1516}', '\u{1517}', '\u{1518}', '\u{1519}', '\u{151A}', '\u{151B}', '\u{151C}', '\u{151D}', '\u{151E}', '\u{151F}', '\u{1520}', '\u{1521}', '\u{1522}', '\u{1523}', '\u{1524}', '\u{1525}', '\u{1526}', '\u{1527}', '\u{1528}', '\u{1529}', '\u{152A}', '\u{152B}', '\u{152C}', '\u{152D}', '\u{152E}', '\u{152F}', '\u{1530}', '\u{1531}', '\u{1532}', '\u{1533}', '\u{1534}', '\u{1535}', '\u{1536}', '\u{1537}', '\u{1538}', '\u{1539}', '\u{153A}', '\u{153B}', '\u{153C}', '\u{153D}', '\u{153E}', '\u{153F}', '\u{1540}', '\u{1541}', '\u{1542}', '\u{1543}', '\u{1544}', '\u{1545}', '\u{1546}', '\u{1547}', '\u{1548}', '\u{1549}', '\u{154A}', '\u{154B}', '\u{154C}', '\u{154D}', '\u{154E}', '\u{154F}', '\u{1550}', '\u{1551}', '\u{1552}', '\u{1553}', '\u{1554}', '\u{1555}', '\u{1556}', '\u{1557}', '\u{1558}', '\u{1559}', '\u{155A}', '\u{155B}', '\u{155C}', '\u{155D}', '\u{155E}', '\u{155F}', '\u{1560}', '\u{1561}', '\u{1562}', '\u{1563}', '\u{1564}', '\u{1565}', '\u{1566}', '\u{1567}', '\u{1568}', '\u{1569}', '\u{156A}', '\u{156B}', '\u{156C}', '\u{156D}', '\u{156E}', '\u{156F}', '\u{1570}', '\u{1571}', '\u{1572}', '\u{1573}', '\u{1574}', '\u{1575}', '\u{1576}', '\u{1577}', '\u{1578}', '\u{1579}', '\u{157A}', '\u{157B}', '\u{157C}', '\u{157D}', '\u{157E}', '\u{157F}', '\u{1580}', '\u{1581}', '\u{1582}', '\u{1583}', '\u{1584}', '\u{1585}', '\u{1586}', '\u{1587}', '\u{1588}', '\u{1589}', '\u{158A}', '\u{158B}', '\u{158C}', '\u{158D}', '\u{158E}', '\u{158F}', '\u{1590}', '\u{1591}', '\u{1592}', '\u{1593}', '\u{1594}', '\u{1595}', '\u{1596}', '\u{1597}', '\u{1598}', '\u{1599}', '\u{159A}', '\u{159B}', '\u{159C}', '\u{159D}', '\u{159E}', '\u{159F}', '\u{15A0}', '\u{15A1}', '\u{15A2}', '\u{15A3}', '\u{15A4}', '\u{15A5}', '\u{15A6}', '\u{15A7}', '\u{15A8}', '\u{15A9}', '\u{15AA}', '\u{15AB}', '\u{15AC}', '\u{15AD}', '\u{15AE}', '\u{15AF}', '\u{15B0}', '\u{15B1}', '\u{15B2}', '\u{15B3}', '\u{15B4}', '\u{15B5}', '\u{15B6}', '\u{15B7}', '\u{15B8}', '\u{15B9}', '\u{15BA}', '\u{15BB}', '\u{15BC}', '\u{15BD}', '\u{15BE}', '\u{15BF}', '\u{15C0}', '\u{15C1}', '\u{15C2}', '\u{15C3}', '\u{15C4}', '\u{15C5}', '\u{15C6}', '\u{15C7}', '\u{15C8}', '\u{15C9}', '\u{15CA}', '\u{15CB}', '\u{15CC}', '\u{15CD}', '\u{15CE}', '\u{15CF}', '\u{15D0}', '\u{15D1}', '\u{15D2}', '\u{15D3}', '\u{15D4}', '\u{15D5}', '\u{15D6}', '\u{15D7}', '\u{15D8}', '\u{15D9}', '\u{15DA}', '\u{15DB}', '\u{15DC}', '\u{15DD}', '\u{15DE}', '\u{15DF}', '\u{15E0}', '\u{15E1}', '\u{15E2}', '\u{15E3}', '\u{15E4}', '\u{15E5}', '\u{15E6}', '\u{15E7}', '\u{15E8}', '\u{15E9}', '\u{15EA}', '\u{15EB}', '\u{15EC}', '\u{15ED}', '\u{15EE}', '\u{15EF}', '\u{15F0}', '\u{15F1}', '\u{15F2}', '\u{15F3}', '\u{15F4}', '\u{15F5}', '\u{15F6}', '\u{15F7}', '\u{15F8}', '\u{15F9}', '\u{15FA}', '\u{15FB}', '\u{15FC}', '\u{15FD}', '\u{15FE}', '\u{15FF}', '\u{1600}', '\u{1601}', '\u{1602}', '\u{1603}', '\u{1604}', '\u{1605}', '\u{1606}', '\u{1607}', '\u{1608}', '\u{1609}', '\u{160A}', '\u{160B}', '\u{160C}', '\u{160D}', '\u{160E}', '\u{160F}', '\u{1610}', '\u{1611}', '\u{1612}', '\u{1613}', '\u{1614}', '\u{1615}', '\u{1616}', '\u{1617}', '\u{1618}', '\u{1619}', '\u{161A}', '\u{161B}', '\u{161C}', '\u{161D}', '\u{161E}', '\u{161F}', '\u{1620}', '\u{1621}', '\u{1622}', '\u{1623}', '\u{1624}', '\u{1625}', '\u{1626}', '\u{1627}', '\u{1628}', '\u{1629}', '\u{162A}', '\u{162B}', '\u{162C}', '\u{162D}', '\u{162E}', '\u{162F}', '\u{1630}', '\u{1631}', '\u{1632}', '\u{1633}', '\u{1634}', '\u{1635}', '\u{1636}', '\u{1637}', '\u{1638}', '\u{1639}', '\u{163A}', '\u{163B}', '\u{163C}', '\u{163D}', '\u{163E}', '\u{163F}', '\u{1640}', '\u{1641}', '\u{1642}', '\u{1643}', '\u{1644}', '\u{1645}', '\u{1646}', '\u{1647}', '\u{1648}', '\u{1649}', '\u{164A}', '\u{164B}', '\u{164C}', '\u{164D}', '\u{164E}', '\u{164F}', '\u{1650}', '\u{1651}', '\u{1652}', '\u{1653}', '\u{1654}', '\u{1655}', '\u{1656}', '\u{1657}', '\u{1658}', '\u{1659}', '\u{165A}', '\u{165B}', '\u{165C}', '\u{165D}', '\u{165E}', '\u{165F}', '\u{1660}', '\u{1661}', '\u{1662}', '\u{1663}', '\u{1664}', '\u{1665}', '\u{1666}', '\u{1667}', '\u{1668}', '\u{1669}', '\u{166A}', '\u{166B}', '\u{166C}', '\u{166F}', '\u{1670}', '\u{1671}', '\u{1672}', '\u{1673}', '\u{1674}', '\u{1675}', '\u{1676}', '\u{1681}', '\u{1682}', '\u{1683}', '\u{1684}', '\u{1685}', '\u{1686}', '\u{1687}', '\u{1688}', '\u{1689}', '\u{168A}', '\u{168B}', '\u{168C}', '\u{168D}', '\u{168E}', '\u{168F}', '\u{1690}', '\u{1691}', '\u{1692}', '\u{1693}', '\u{1694}', '\u{1695}', '\u{1696}', '\u{1697}', '\u{1698}', '\u{1699}', '\u{169A}', '\u{16A0}', '\u{16A1}', '\u{16A2}', '\u{16A3}', '\u{16A4}', '\u{16A5}', '\u{16A6}', '\u{16A7}', '\u{16A8}', '\u{16A9}', '\u{16AA}', '\u{16AB}', '\u{16AC}', '\u{16AD}', '\u{16AE}', '\u{16AF}', '\u{16B0}', '\u{16B1}', '\u{16B2}', '\u{16B3}', '\u{16B4}', '\u{16B5}', '\u{16B6}', '\u{16B7}', '\u{16B8}', '\u{16B9}', '\u{16BA}', '\u{16BB}', '\u{16BC}', '\u{16BD}', '\u{16BE}', '\u{16BF}', '\u{16C0}', '\u{16C1}', '\u{16C2}', '\u{16C3}', '\u{16C4}', '\u{16C5}', '\u{16C6}', '\u{16C7}', '\u{16C8}', '\u{16C9}', '\u{16CA}', '\u{16CB}', '\u{16CC}', '\u{16CD}', '\u{16CE}', '\u{16CF}', '\u{16D0}', '\u{16D1}', '\u{16D2}', '\u{16D3}', '\u{16D4}', '\u{16D5}', '\u{16D6}', '\u{16D7}', '\u{16D8}', '\u{16D9}', '\u{16DA}', '\u{16DB}', '\u{16DC}', '\u{16DD}', '\u{16DE}', '\u{16DF}', '\u{16E0}', '\u{16E1}', '\u{16E2}', '\u{16E3}', '\u{16E4}', '\u{16E5}', '\u{16E6}', '\u{16E7}', '\u{16E8}', '\u{16E9}', '\u{16EA}', '\u{1700}', '\u{1701}', '\u{1702}', '\u{1703}', '\u{1704}', '\u{1705}', '\u{1706}', '\u{1707}', '\u{1708}', '\u{1709}', '\u{170A}', '\u{170B}', '\u{170C}', '\u{170E}', '\u{170F}', '\u{1710}', '\u{1711}', '\u{1720}', '\u{1721}', '\u{1722}', '\u{1723}', '\u{1724}', '\u{1725}', '\u{1726}', '\u{1727}', '\u{1728}', '\u{1729}', '\u{172A}', '\u{172B}', '\u{172C}', '\u{172D}', '\u{172E}', '\u{172F}', '\u{1730}', '\u{1731}', '\u{1740}', '\u{1741}', '\u{1742}', '\u{1743}', '\u{1744}', '\u{1745}', '\u{1746}', '\u{1747}', '\u{1748}', '\u{1749}', '\u{174A}', '\u{174B}', '\u{174C}', '\u{174D}', '\u{174E}', '\u{174F}', '\u{1750}', '\u{1751}', '\u{1760}', '\u{1761}', '\u{1762}', '\u{1763}', '\u{1764}', '\u{1765}', '\u{1766}', '\u{1767}', '\u{1768}', '\u{1769}', '\u{176A}', '\u{176B}', '\u{176C}', '\u{176E}', '\u{176F}', '\u{1770}', '\u{1780}', '\u{1781}', '\u{1782}', '\u{1783}', '\u{1784}', '\u{1785}', '\u{1786}', '\u{1787}', '\u{1788}', '\u{1789}', '\u{178A}', '\u{178B}', '\u{178C}', '\u{178D}', '\u{178E}', '\u{178F}', '\u{1790}', '\u{1791}', '\u{1792}', '\u{1793}', '\u{1794}', '\u{1795}', '\u{1796}', '\u{1797}', '\u{1798}', '\u{1799}', '\u{179A}', '\u{179B}', '\u{179C}', '\u{179D}', '\u{179E}', '\u{179F}', '\u{17A0}', '\u{17A1}', '\u{17A2}', '\u{17A3}', '\u{17A4}', '\u{17A5}', '\u{17A6}', '\u{17A7}', '\u{17A8}', '\u{17A9}', '\u{17AA}', '\u{17AB}', '\u{17AC}', '\u{17AD}', '\u{17AE}', '\u{17AF}', '\u{17B0}', '\u{17B1}', '\u{17B2}', '\u{17B3}', '\u{17DC}', '\u{1820}', '\u{1821}', '\u{1822}', '\u{1823}', '\u{1824}', '\u{1825}', '\u{1826}', '\u{1827}', '\u{1828}', '\u{1829}', '\u{182A}', '\u{182B}', '\u{182C}', '\u{182D}', '\u{182E}', '\u{182F}', '\u{1830}', '\u{1831}', '\u{1832}', '\u{1833}', '\u{1834}', '\u{1835}', '\u{1836}', '\u{1837}', '\u{1838}', '\u{1839}', '\u{183A}', '\u{183B}', '\u{183C}', '\u{183D}', '\u{183E}', '\u{183F}', '\u{1840}', '\u{1841}', '\u{1842}', '\u{1844}', '\u{1845}', '\u{1846}', '\u{1847}', '\u{1848}', '\u{1849}', '\u{184A}', '\u{184B}', '\u{184C}', '\u{184D}', '\u{184E}', '\u{184F}', '\u{1850}', '\u{1851}', '\u{1852}', '\u{1853}', '\u{1854}', '\u{1855}', '\u{1856}', '\u{1857}', '\u{1858}', '\u{1859}', '\u{185A}', '\u{185B}', '\u{185C}', '\u{185D}', '\u{185E}', '\u{185F}', '\u{1860}', '\u{1861}', '\u{1862}', '\u{1863}', '\u{1864}', '\u{1865}', '\u{1866}', '\u{1867}', '\u{1868}', '\u{1869}', '\u{186A}', '\u{186B}', '\u{186C}', '\u{186D}', '\u{186E}', '\u{186F}', '\u{1870}', '\u{1871}', '\u{1872}', '\u{1873}', '\u{1874}', '\u{1875}', '\u{1876}', '\u{1877}', '\u{1880}', '\u{1881}', '\u{1882}', '\u{1883}', '\u{1884}', '\u{1885}', '\u{1886}', '\u{1887}', '\u{1888}', '\u{1889}', '\u{188A}', '\u{188B}', '\u{188C}', '\u{188D}', '\u{188E}', '\u{188F}', '\u{1890}', '\u{1891}', '\u{1892}', '\u{1893}', '\u{1894}', '\u{1895}', '\u{1896}', '\u{1897}', '\u{1898}', '\u{1899}', '\u{189A}', '\u{189B}', '\u{189C}', '\u{189D}', '\u{189E}', '\u{189F}', '\u{18A0}', '\u{18A1}', '\u{18A2}', '\u{18A3}', '\u{18A4}', '\u{18A5}', '\u{18A6}', '\u{18A7}', '\u{18A8}', '\u{18AA}', '\u{1900}', '\u{1901}', '\u{1902}', '\u{1903}', '\u{1904}', '\u{1905}', '\u{1906}', '\u{1907}', '\u{1908}', '\u{1909}', '\u{190A}', '\u{190B}', '\u{190C}', '\u{190D}', '\u{190E}', '\u{190F}', '\u{1910}', '\u{1911}', '\u{1912}', '\u{1913}', '\u{1914}', '\u{1915}', '\u{1916}', '\u{1917}', '\u{1918}', '\u{1919}', '\u{191A}', '\u{191B}', '\u{191C}', '\u{1950}', '\u{1951}', '\u{1952}', '\u{1953}', '\u{1954}', '\u{1955}', '\u{1956}', '\u{1957}', '\u{1958}', '\u{1959}', '\u{195A}', '\u{195B}', '\u{195C}', '\u{195D}', '\u{195E}', '\u{195F}', '\u{1960}', '\u{1961}', '\u{1962}', '\u{1963}', '\u{1964}', '\u{1965}', '\u{1966}', '\u{1967}', '\u{1968}', '\u{1969}', '\u{196A}', '\u{196B}', '\u{196C}', '\u{196D}', '\u{1970}', '\u{1971}', '\u{1972}', '\u{1973}', '\u{1974}', '\u{1980}', '\u{1981}', '\u{1982}', '\u{1983}', '\u{1984}', '\u{1985}', '\u{1986}', '\u{1987}', '\u{1988}', '\u{1989}', '\u{198A}', '\u{198B}', '\u{198C}', '\u{198D}', '\u{198E}', '\u{198F}', '\u{1990}', '\u{1991}', '\u{1992}', '\u{1993}', '\u{1994}', '\u{1995}', '\u{1996}', '\u{1997}', '\u{1998}', '\u{1999}', '\u{199A}', '\u{199B}', '\u{199C}', '\u{199D}', '\u{199E}', '\u{199F}', '\u{19A0}', '\u{19A1}', '\u{19A2}', '\u{19A3}', '\u{19A4}', '\u{19A5}', '\u{19A6}', '\u{19A7}', '\u{19A8}', '\u{19A9}', '\u{19C1}', '\u{19C2}', '\u{19C3}', '\u{19C4}', '\u{19C5}', '\u{19C6}', '\u{19C7}', '\u{1A00}', '\u{1A01}', '\u{1A02}', '\u{1A03}', '\u{1A04}', '\u{1A05}', '\u{1A06}', '\u{1A07}', '\u{1A08}', '\u{1A09}', '\u{1A0A}', '\u{1A0B}', '\u{1A0C}', '\u{1A0D}', '\u{1A0E}', '\u{1A0F}', '\u{1A10}', '\u{1A11}', '\u{1A12}', '\u{1A13}', '\u{1A14}', '\u{1A15}', '\u{1A16}', '\u{1B05}', '\u{1B06}', '\u{1B07}', '\u{1B08}', '\u{1B09}', '\u{1B0A}', '\u{1B0B}', '\u{1B0C}', '\u{1B0D}', '\u{1B0E}', '\u{1B0F}', '\u{1B10}', '\u{1B11}', '\u{1B12}', '\u{1B13}', '\u{1B14}', '\u{1B15}', '\u{1B16}', '\u{1B17}', '\u{1B18}', '\u{1B19}', '\u{1B1A}', '\u{1B1B}', '\u{1B1C}', '\u{1B1D}', '\u{1B1E}', '\u{1B1F}', '\u{1B20}', '\u{1B21}', '\u{1B22}', '\u{1B23}', '\u{1B24}', '\u{1B25}', '\u{1B26}', '\u{1B27}', '\u{1B28}', '\u{1B29}', '\u{1B2A}', '\u{1B2B}', '\u{1B2C}', '\u{1B2D}', '\u{1B2E}', '\u{1B2F}', '\u{1B30}', '\u{1B31}', '\u{1B32}', '\u{1B33}', '\u{1B45}', '\u{1B46}', '\u{1B47}', '\u{1B48}', '\u{1B49}', '\u{1B4A}', '\u{1B4B}', '\u{1B83}', '\u{1B84}', '\u{1B85}', '\u{1B86}', '\u{1B87}', '\u{1B88}', '\u{1B89}', '\u{1B8A}', '\u{1B8B}', '\u{1B8C}', '\u{1B8D}', '\u{1B8E}', '\u{1B8F}', '\u{1B90}', '\u{1B91}', '\u{1B92}', '\u{1B93}', '\u{1B94}', '\u{1B95}', '\u{1B96}', '\u{1B97}', '\u{1B98}', '\u{1B99}', '\u{1B9A}', '\u{1B9B}', '\u{1B9C}', '\u{1B9D}', '\u{1B9E}', '\u{1B9F}', '\u{1BA0}', '\u{1BAE}', '\u{1BAF}', '\u{1C00}', '\u{1C01}', '\u{1C02}', '\u{1C03}', '\u{1C04}', '\u{1C05}', '\u{1C06}', '\u{1C07}', '\u{1C08}', '\u{1C09}', '\u{1C0A}', '\u{1C0B}', '\u{1C0C}', '\u{1C0D}', '\u{1C0E}', '\u{1C0F}', '\u{1C10}', '\u{1C11}', '\u{1C12}', '\u{1C13}', '\u{1C14}', '\u{1C15}', '\u{1C16}', '\u{1C17}', '\u{1C18}', '\u{1C19}', '\u{1C1A}', '\u{1C1B}', '\u{1C1C}', '\u{1C1D}', '\u{1C1E}', '\u{1C1F}', '\u{1C20}', '\u{1C21}', '\u{1C22}', '\u{1C23}', '\u{1C4D}', '\u{1C4E}', '\u{1C4F}', '\u{1C5A}', '\u{1C5B}', '\u{1C5C}', '\u{1C5D}', '\u{1C5E}', '\u{1C5F}', '\u{1C60}', '\u{1C61}', '\u{1C62}', '\u{1C63}', '\u{1C64}', '\u{1C65}', '\u{1C66}', '\u{1C67}', '\u{1C68}', '\u{1C69}', '\u{1C6A}', '\u{1C6B}', '\u{1C6C}', '\u{1C6D}', '\u{1C6E}', '\u{1C6F}', '\u{1C70}', '\u{1C71}', '\u{1C72}', '\u{1C73}', '\u{1C74}', '\u{1C75}', '\u{1C76}', '\u{1C77}', '\u{2135}', '\u{2136}', '\u{2137}', '\u{2138}', '\u{2D30}', '\u{2D31}', '\u{2D32}', '\u{2D33}', '\u{2D34}', '\u{2D35}', '\u{2D36}', '\u{2D37}', '\u{2D38}', '\u{2D39}', '\u{2D3A}', '\u{2D3B}', '\u{2D3C}', '\u{2D3D}', '\u{2D3E}', '\u{2D3F}', '\u{2D40}', '\u{2D41}', '\u{2D42}', '\u{2D43}', '\u{2D44}', '\u{2D45}', '\u{2D46}', '\u{2D47}', '\u{2D48}', '\u{2D49}', '\u{2D4A}', '\u{2D4B}', '\u{2D4C}', '\u{2D4D}', '\u{2D4E}', '\u{2D4F}', '\u{2D50}', '\u{2D51}', '\u{2D52}', '\u{2D53}', '\u{2D54}', '\u{2D55}', '\u{2D56}', '\u{2D57}', '\u{2D58}', '\u{2D59}', '\u{2D5A}', '\u{2D5B}', '\u{2D5C}', '\u{2D5D}', '\u{2D5E}', '\u{2D5F}', '\u{2D60}', '\u{2D61}', '\u{2D62}', '\u{2D63}', '\u{2D64}', '\u{2D65}', '\u{2D80}', '\u{2D81}', '\u{2D82}', '\u{2D83}', '\u{2D84}', '\u{2D85}', '\u{2D86}', '\u{2D87}', '\u{2D88}', '\u{2D89}', '\u{2D8A}', '\u{2D8B}', '\u{2D8C}', '\u{2D8D}', '\u{2D8E}', '\u{2D8F}', '\u{2D90}', '\u{2D91}', '\u{2D92}', '\u{2D93}', '\u{2D94}', '\u{2D95}', '\u{2D96}', '\u{2DA0}', '\u{2DA1}', '\u{2DA2}', '\u{2DA3}', '\u{2DA4}', '\u{2DA5}', '\u{2DA6}', '\u{2DA8}', '\u{2DA9}', '\u{2DAA}', '\u{2DAB}', '\u{2DAC}', '\u{2DAD}', '\u{2DAE}', '\u{2DB0}', '\u{2DB1}', '\u{2DB2}', '\u{2DB3}', '\u{2DB4}', '\u{2DB5}', '\u{2DB6}', '\u{2DB8}', '\u{2DB9}', '\u{2DBA}', '\u{2DBB}', '\u{2DBC}', '\u{2DBD}', '\u{2DBE}', '\u{2DC0}', '\u{2DC1}', '\u{2DC2}', '\u{2DC3}', '\u{2DC4}', '\u{2DC5}', '\u{2DC6}', '\u{2DC8}', '\u{2DC9}', '\u{2DCA}', '\u{2DCB}', '\u{2DCC}', '\u{2DCD}', '\u{2DCE}', '\u{2DD0}', '\u{2DD1}', '\u{2DD2}', '\u{2DD3}', '\u{2DD4}', '\u{2DD5}', '\u{2DD6}', '\u{2DD8}', '\u{2DD9}', '\u{2DDA}', '\u{2DDB}', '\u{2DDC}', '\u{2DDD}', '\u{2DDE}', '\u{3006}', '\u{303C}', '\u{3041}', '\u{3042}', '\u{3043}', '\u{3044}', '\u{3045}', '\u{3046}', '\u{3047}', '\u{3048}', '\u{3049}', '\u{304A}', '\u{304B}', '\u{304C}', '\u{304D}', '\u{304E}', '\u{304F}', '\u{3050}', '\u{3051}', '\u{3052}', '\u{3053}', '\u{3054}', '\u{3055}', '\u{3056}', '\u{3057}', '\u{3058}', '\u{3059}', '\u{305A}', '\u{305B}', '\u{305C}', '\u{305D}', '\u{305E}', '\u{305F}', '\u{3060}', '\u{3061}', '\u{3062}', '\u{3063}', '\u{3064}', '\u{3065}', '\u{3066}', '\u{3067}', '\u{3068}', '\u{3069}', '\u{306A}', '\u{306B}', '\u{306C}', '\u{306D}', '\u{306E}', '\u{306F}', '\u{3070}', '\u{3071}', '\u{3072}', '\u{3073}', '\u{3074}', '\u{3075}', '\u{3076}', '\u{3077}', '\u{3078}', '\u{3079}', '\u{307A}', '\u{307B}', '\u{307C}', '\u{307D}', '\u{307E}', '\u{307F}', '\u{3080}', '\u{3081}', '\u{3082}', '\u{3083}', '\u{3084}', '\u{3085}', '\u{3086}', '\u{3087}', '\u{3088}', '\u{3089}', '\u{308A}', '\u{308B}', '\u{308C}', '\u{308D}', '\u{308E}', '\u{308F}', '\u{3090}', '\u{3091}', '\u{3092}', '\u{3093}', '\u{3094}', '\u{3095}', '\u{3096}', '\u{309F}', '\u{30A1}', '\u{30A2}', '\u{30A3}', '\u{30A4}', '\u{30A5}', '\u{30A6}', '\u{30A7}', '\u{30A8}', '\u{30A9}', '\u{30AA}', '\u{30AB}', '\u{30AC}', '\u{30AD}', '\u{30AE}', '\u{30AF}', '\u{30B0}', '\u{30B1}', '\u{30B2}', '\u{30B3}', '\u{30B4}', '\u{30B5}', '\u{30B6}', '\u{30B7}', '\u{30B8}', '\u{30B9}', '\u{30BA}', '\u{30BB}', '\u{30BC}', '\u{30BD}', '\u{30BE}', '\u{30BF}', '\u{30C0}', '\u{30C1}', '\u{30C2}', '\u{30C3}', '\u{30C4}', '\u{30C5}', '\u{30C6}', '\u{30C7}', '\u{30C8}', '\u{30C9}', '\u{30CA}', '\u{30CB}', '\u{30CC}', '\u{30CD}', '\u{30CE}', '\u{30CF}', '\u{30D0}', '\u{30D1}', '\u{30D2}', '\u{30D3}', '\u{30D4}', '\u{30D5}', '\u{30D6}', '\u{30D7}', '\u{30D8}', '\u{30D9}', '\u{30DA}', '\u{30DB}', '\u{30DC}', '\u{30DD}', '\u{30DE}', '\u{30DF}', '\u{30E0}', '\u{30E1}', '\u{30E2}', '\u{30E3}', '\u{30E4}', '\u{30E5}', '\u{30E6}', '\u{30E7}', '\u{30E8}', '\u{30E9}', '\u{30EA}', '\u{30EB}', '\u{30EC}', '\u{30ED}', '\u{30EE}', '\u{30EF}', '\u{30F0}', '\u{30F1}', '\u{30F2}', '\u{30F3}', '\u{30F4}', '\u{30F5}', '\u{30F6}', '\u{30F7}', '\u{30F8}', '\u{30F9}', '\u{30FA}', '\u{30FF}', '\u{3105}', '\u{3106}', '\u{3107}', '\u{3108}', '\u{3109}', '\u{310A}', '\u{310B}', '\u{310C}', '\u{310D}', '\u{310E}', '\u{310F}', '\u{3110}', '\u{3111}', '\u{3112}', '\u{3113}', '\u{3114}', '\u{3115}', '\u{3116}', '\u{3117}', '\u{3118}', '\u{3119}', '\u{311A}', '\u{311B}', '\u{311C}', '\u{311D}', '\u{311E}', '\u{311F}', '\u{3120}', '\u{3121}', '\u{3122}', '\u{3123}', '\u{3124}', '\u{3125}', '\u{3126}', '\u{3127}', '\u{3128}', '\u{3129}', '\u{312A}', '\u{312B}', '\u{312C}', '\u{312D}', '\u{3131}', '\u{3132}', '\u{3133}', '\u{3134}', '\u{3135}', '\u{3136}', '\u{3137}', '\u{3138}', '\u{3139}', '\u{313A}', '\u{313B}', '\u{313C}', '\u{313D}', '\u{313E}', '\u{313F}', '\u{3140}', '\u{3141}', '\u{3142}', '\u{3143}', '\u{3144}', '\u{3145}', '\u{3146}', '\u{3147}', '\u{3148}', '\u{3149}', '\u{314A}', '\u{314B}', '\u{314C}', '\u{314D}', '\u{314E}', '\u{314F}', '\u{3150}', '\u{3151}', '\u{3152}', '\u{3153}', '\u{3154}', '\u{3155}', '\u{3156}', '\u{3157}', '\u{3158}', '\u{3159}', '\u{315A}', '\u{315B}', '\u{315C}', '\u{315D}', '\u{315E}', '\u{315F}', '\u{3160}', '\u{3161}', '\u{3162}', '\u{3163}', '\u{3164}', '\u{3165}', '\u{3166}', '\u{3167}', '\u{3168}', '\u{3169}', '\u{316A}', '\u{316B}', '\u{316C}', '\u{316D}', '\u{316E}', '\u{316F}', '\u{3170}', '\u{3171}', '\u{3172}', '\u{3173}', '\u{3174}', '\u{3175}', '\u{3176}', '\u{3177}', '\u{3178}', '\u{3179}', '\u{317A}', '\u{317B}', '\u{317C}', '\u{317D}', '\u{317E}', '\u{317F}', '\u{3180}', '\u{3181}', '\u{3182}', '\u{3183}', '\u{3184}', '\u{3185}', '\u{3186}', '\u{3187}', '\u{3188}', '\u{3189}', '\u{318A}', '\u{318B}', '\u{318C}', '\u{318D}', '\u{318E}', '\u{31A0}', '\u{31A1}', '\u{31A2}', '\u{31A3}', '\u{31A4}', '\u{31A5}', '\u{31A6}', '\u{31A7}', '\u{31A8}', '\u{31A9}', '\u{31AA}', '\u{31AB}', '\u{31AC}', '\u{31AD}', '\u{31AE}', '\u{31AF}', '\u{31B0}', '\u{31B1}', '\u{31B2}', '\u{31B3}', '\u{31B4}', '\u{31B5}', '\u{31B6}', '\u{31B7}', '\u{31F0}', '\u{31F1}', '\u{31F2}', '\u{31F3}', '\u{31F4}', '\u{31F5}', '\u{31F6}', '\u{31F7}', '\u{31F8}', '\u{31F9}', '\u{31FA}', '\u{31FB}', '\u{31FC}', '\u{31FD}', '\u{31FE}', '\u{31FF}', '\u{3400}', '\u{4DB5}', '\u{4E00}', '\u{9FC3}', '\u{A000}', '\u{A001}', '\u{A002}', '\u{A003}', '\u{A004}', '\u{A005}', '\u{A006}', '\u{A007}', '\u{A008}', '\u{A009}', '\u{A00A}', '\u{A00B}', '\u{A00C}', '\u{A00D}', '\u{A00E}', '\u{A00F}', '\u{A010}', '\u{A011}', '\u{A012}', '\u{A013}', '\u{A014}', '\u{A016}', '\u{A017}', '\u{A018}', '\u{A019}', '\u{A01A}', '\u{A01B}', '\u{A01C}', '\u{A01D}', '\u{A01E}', '\u{A01F}', '\u{A020}', '\u{A021}', '\u{A022}', '\u{A023}', '\u{A024}', '\u{A025}', '\u{A026}', '\u{A027}', '\u{A028}', '\u{A029}', '\u{A02A}', '\u{A02B}', '\u{A02C}', '\u{A02D}', '\u{A02E}', '\u{A02F}', '\u{A030}', '\u{A031}', '\u{A032}', '\u{A033}', '\u{A034}', '\u{A035}', '\u{A036}', '\u{A037}', '\u{A038}', '\u{A039}', '\u{A03A}', '\u{A03B}', '\u{A03C}', '\u{A03D}', '\u{A03E}', '\u{A03F}', '\u{A040}', '\u{A041}', '\u{A042}', '\u{A043}', '\u{A044}', '\u{A045}', '\u{A046}', '\u{A047}', '\u{A048}', '\u{A049}', '\u{A04A}', '\u{A04B}', '\u{A04C}', '\u{A04D}', '\u{A04E}', '\u{A04F}', '\u{A050}', '\u{A051}', '\u{A052}', '\u{A053}', '\u{A054}', '\u{A055}', '\u{A056}', '\u{A057}', '\u{A058}', '\u{A059}', '\u{A05A}', '\u{A05B}', '\u{A05C}', '\u{A05D}', '\u{A05E}', '\u{A05F}', '\u{A060}', '\u{A061}', '\u{A062}', '\u{A063}', '\u{A064}', '\u{A065}', '\u{A066}', '\u{A067}', '\u{A068}', '\u{A069}', '\u{A06A}', '\u{A06B}', '\u{A06C}', '\u{A06D}', '\u{A06E}', '\u{A06F}', '\u{A070}', '\u{A071}', '\u{A072}', '\u{A073}', '\u{A074}', '\u{A075}', '\u{A076}', '\u{A077}', '\u{A078}', '\u{A079}', '\u{A07A}', '\u{A07B}', '\u{A07C}', '\u{A07D}', '\u{A07E}', '\u{A07F}', '\u{A080}', '\u{A081}', '\u{A082}', '\u{A083}', '\u{A084}', '\u{A085}', '\u{A086}', '\u{A087}', '\u{A088}', '\u{A089}', '\u{A08A}', '\u{A08B}', '\u{A08C}', '\u{A08D}', '\u{A08E}', '\u{A08F}', '\u{A090}', '\u{A091}', '\u{A092}', '\u{A093}', '\u{A094}', '\u{A095}', '\u{A096}', '\u{A097}', '\u{A098}', '\u{A099}', '\u{A09A}', '\u{A09B}', '\u{A09C}', '\u{A09D}', '\u{A09E}', '\u{A09F}', '\u{A0A0}', '\u{A0A1}', '\u{A0A2}', '\u{A0A3}', '\u{A0A4}', '\u{A0A5}', '\u{A0A6}', '\u{A0A7}', '\u{A0A8}', '\u{A0A9}', '\u{A0AA}', '\u{A0AB}', '\u{A0AC}', '\u{A0AD}', '\u{A0AE}', '\u{A0AF}', '\u{A0B0}', '\u{A0B1}', '\u{A0B2}', '\u{A0B3}', '\u{A0B4}', '\u{A0B5}', '\u{A0B6}', '\u{A0B7}', '\u{A0B8}', '\u{A0B9}', '\u{A0BA}', '\u{A0BB}', '\u{A0BC}', '\u{A0BD}', '\u{A0BE}', '\u{A0BF}', '\u{A0C0}', '\u{A0C1}', '\u{A0C2}', '\u{A0C3}', '\u{A0C4}', '\u{A0C5}', '\u{A0C6}', '\u{A0C7}', '\u{A0C8}', '\u{A0C9}', '\u{A0CA}', '\u{A0CB}', '\u{A0CC}', '\u{A0CD}', '\u{A0CE}', '\u{A0CF}', '\u{A0D0}', '\u{A0D1}', '\u{A0D2}', '\u{A0D3}', '\u{A0D4}', '\u{A0D5}', '\u{A0D6}', '\u{A0D7}', '\u{A0D8}', '\u{A0D9}', '\u{A0DA}', '\u{A0DB}', '\u{A0DC}', '\u{A0DD}', '\u{A0DE}', '\u{A0DF}', '\u{A0E0}', '\u{A0E1}', '\u{A0E2}', '\u{A0E3}', '\u{A0E4}', '\u{A0E5}', '\u{A0E6}', '\u{A0E7}', '\u{A0E8}', '\u{A0E9}', '\u{A0EA}', '\u{A0EB}', '\u{A0EC}', '\u{A0ED}', '\u{A0EE}', '\u{A0EF}', '\u{A0F0}', '\u{A0F1}', '\u{A0F2}', '\u{A0F3}', '\u{A0F4}', '\u{A0F5}', '\u{A0F6}', '\u{A0F7}', '\u{A0F8}', '\u{A0F9}', '\u{A0FA}', '\u{A0FB}', '\u{A0FC}', '\u{A0FD}', '\u{A0FE}', '\u{A0FF}', '\u{A100}', '\u{A101}', '\u{A102}', '\u{A103}', '\u{A104}', '\u{A105}', '\u{A106}', '\u{A107}', '\u{A108}', '\u{A109}', '\u{A10A}', '\u{A10B}', '\u{A10C}', '\u{A10D}', '\u{A10E}', '\u{A10F}', '\u{A110}', '\u{A111}', '\u{A112}', '\u{A113}', '\u{A114}', '\u{A115}', '\u{A116}', '\u{A117}', '\u{A118}', '\u{A119}', '\u{A11A}', '\u{A11B}', '\u{A11C}', '\u{A11D}', '\u{A11E}', '\u{A11F}', '\u{A120}', '\u{A121}', '\u{A122}', '\u{A123}', '\u{A124}', '\u{A125}', '\u{A126}', '\u{A127}', '\u{A128}', '\u{A129}', '\u{A12A}', '\u{A12B}', '\u{A12C}', '\u{A12D}', '\u{A12E}', '\u{A12F}', '\u{A130}', '\u{A131}', '\u{A132}', '\u{A133}', '\u{A134}', '\u{A135}', '\u{A136}', '\u{A137}', '\u{A138}', '\u{A139}', '\u{A13A}', '\u{A13B}', '\u{A13C}', '\u{A13D}', '\u{A13E}', '\u{A13F}', '\u{A140}', '\u{A141}', '\u{A142}', '\u{A143}', '\u{A144}', '\u{A145}', '\u{A146}', '\u{A147}', '\u{A148}', '\u{A149}', '\u{A14A}', '\u{A14B}', '\u{A14C}', '\u{A14D}', '\u{A14E}', '\u{A14F}', '\u{A150}', '\u{A151}', '\u{A152}', '\u{A153}', '\u{A154}', '\u{A155}', '\u{A156}', '\u{A157}', '\u{A158}', '\u{A159}', '\u{A15A}', '\u{A15B}', '\u{A15C}', '\u{A15D}', '\u{A15E}', '\u{A15F}', '\u{A160}', '\u{A161}', '\u{A162}', '\u{A163}', '\u{A164}', '\u{A165}', '\u{A166}', '\u{A167}', '\u{A168}', '\u{A169}', '\u{A16A}', '\u{A16B}', '\u{A16C}', '\u{A16D}', '\u{A16E}', '\u{A16F}', '\u{A170}', '\u{A171}', '\u{A172}', '\u{A173}', '\u{A174}', '\u{A175}', '\u{A176}', '\u{A177}', '\u{A178}', '\u{A179}', '\u{A17A}', '\u{A17B}', '\u{A17C}', '\u{A17D}', '\u{A17E}', '\u{A17F}', '\u{A180}', '\u{A181}', '\u{A182}', '\u{A183}', '\u{A184}', '\u{A185}', '\u{A186}', '\u{A187}', '\u{A188}', '\u{A189}', '\u{A18A}', '\u{A18B}', '\u{A18C}', '\u{A18D}', '\u{A18E}', '\u{A18F}', '\u{A190}', '\u{A191}', '\u{A192}', '\u{A193}', '\u{A194}', '\u{A195}', '\u{A196}', '\u{A197}', '\u{A198}', '\u{A199}', '\u{A19A}', '\u{A19B}', '\u{A19C}', '\u{A19D}', '\u{A19E}', '\u{A19F}', '\u{A1A0}', '\u{A1A1}', '\u{A1A2}', '\u{A1A3}', '\u{A1A4}', '\u{A1A5}', '\u{A1A6}', '\u{A1A7}', '\u{A1A8}', '\u{A1A9}', '\u{A1AA}', '\u{A1AB}', '\u{A1AC}', '\u{A1AD}', '\u{A1AE}', '\u{A1AF}') - } - - fn is_unicode_letter_number(self) -> bool { - match_char_class!(self, - '\u{16EE}', '\u{16EF}', '\u{16F0}', '\u{2160}', '\u{2161}', '\u{2162}', '\u{2163}', '\u{2164}', '\u{2165}', '\u{2166}', '\u{2167}', '\u{2168}', '\u{2169}', '\u{216A}', '\u{216B}', '\u{216C}', '\u{216D}', '\u{216E}', '\u{216F}', '\u{2170}', '\u{2171}', '\u{2172}', '\u{2173}', '\u{2174}', '\u{2175}', '\u{2176}', '\u{2177}', '\u{2178}', '\u{2179}', '\u{217A}', '\u{217B}', '\u{217C}', '\u{217D}', '\u{217E}', '\u{217F}', '\u{2180}', '\u{2181}', '\u{2182}', '\u{2185}', '\u{2186}', '\u{2187}', '\u{2188}', '\u{3007}', '\u{3021}', '\u{3022}', '\u{3023}', '\u{3024}', '\u{3025}', '\u{3026}', '\u{3027}', '\u{3028}', '\u{3029}', '\u{3038}', '\u{3039}', '\u{303A}') - } - - fn is_unicode_nonspacing_mark(self) -> bool { - match_char_class!(self, - '\u{0300}', '\u{0301}', '\u{0302}', '\u{0303}', '\u{0304}', '\u{0305}', '\u{0306}', '\u{0307}', '\u{0308}', '\u{0309}', '\u{030A}', '\u{030B}', '\u{030C}', '\u{030D}', '\u{030E}', '\u{030F}', '\u{0310}', '\u{0311}', '\u{0312}', '\u{0313}', '\u{0314}', '\u{0315}', '\u{0316}', '\u{0317}', '\u{0318}', '\u{0319}', '\u{031A}', '\u{031B}', '\u{031C}', '\u{031D}', '\u{031E}', '\u{031F}', '\u{0320}', '\u{0321}', '\u{0322}', '\u{0323}', '\u{0324}', '\u{0325}', '\u{0326}', '\u{0327}', '\u{0328}', '\u{0329}', '\u{032A}', '\u{032B}', '\u{032C}', '\u{032D}', '\u{032E}', '\u{032F}', '\u{0330}', '\u{0331}', '\u{0332}', '\u{0333}', '\u{0334}', '\u{0335}', '\u{0336}', '\u{0337}', '\u{0338}', '\u{0339}', '\u{033A}', '\u{033B}', '\u{033C}', '\u{033D}', '\u{033E}', '\u{033F}', '\u{0340}', '\u{0341}', '\u{0342}', '\u{0343}', '\u{0344}', '\u{0345}', '\u{0346}', '\u{0347}', '\u{0348}', '\u{0349}', '\u{034A}', '\u{034B}', '\u{034C}', '\u{034D}', '\u{034E}', '\u{034F}', '\u{0350}', '\u{0351}', '\u{0352}', '\u{0353}', '\u{0354}', '\u{0355}', '\u{0356}', '\u{0357}', '\u{0358}', '\u{0359}', '\u{035A}', '\u{035B}', '\u{035C}', '\u{035D}', '\u{035E}', '\u{035F}', '\u{0360}', '\u{0361}', '\u{0362}', '\u{0363}', '\u{0364}', '\u{0365}', '\u{0366}', '\u{0367}', '\u{0368}', '\u{0369}', '\u{036A}', '\u{036B}', '\u{036C}', '\u{036D}', '\u{036E}', '\u{036F}', '\u{0483}', '\u{0484}', '\u{0485}', '\u{0486}', '\u{0487}', '\u{0591}', '\u{0592}', '\u{0593}', '\u{0594}', '\u{0595}', '\u{0596}', '\u{0597}', '\u{0598}', '\u{0599}', '\u{059A}', '\u{059B}', '\u{059C}', '\u{059D}', '\u{059E}', '\u{059F}', '\u{05A0}', '\u{05A1}', '\u{05A2}', '\u{05A3}', '\u{05A4}', '\u{05A5}', '\u{05A6}', '\u{05A7}', '\u{05A8}', '\u{05A9}', '\u{05AA}', '\u{05AB}', '\u{05AC}', '\u{05AD}', '\u{05AE}', '\u{05AF}', '\u{05B0}', '\u{05B1}', '\u{05B2}', '\u{05B3}', '\u{05B4}', '\u{05B5}', '\u{05B6}', '\u{05B7}', '\u{05B8}', '\u{05B9}', '\u{05BA}', '\u{05BB}', '\u{05BC}', '\u{05BD}', '\u{05BF}', '\u{05C1}', '\u{05C2}', '\u{05C4}', '\u{05C5}', '\u{05C7}', '\u{0610}', '\u{0611}', '\u{0612}', '\u{0613}', '\u{0614}', '\u{0615}', '\u{0616}', '\u{0617}', '\u{0618}', '\u{0619}', '\u{061A}', '\u{064B}', '\u{064C}', '\u{064D}', '\u{064E}', '\u{064F}', '\u{0650}', '\u{0651}', '\u{0652}', '\u{0653}', '\u{0654}', '\u{0655}', '\u{0656}', '\u{0657}', '\u{0658}', '\u{0659}', '\u{065A}', '\u{065B}', '\u{065C}', '\u{065D}', '\u{065E}', '\u{0670}', '\u{06D6}', '\u{06D7}', '\u{06D8}', '\u{06D9}', '\u{06DA}', '\u{06DB}', '\u{06DC}', '\u{06DF}', '\u{06E0}', '\u{06E1}', '\u{06E2}', '\u{06E3}', '\u{06E4}', '\u{06E7}', '\u{06E8}', '\u{06EA}', '\u{06EB}', '\u{06EC}', '\u{06ED}', '\u{0711}', '\u{0730}', '\u{0731}', '\u{0732}', '\u{0733}', '\u{0734}', '\u{0735}', '\u{0736}', '\u{0737}', '\u{0738}', '\u{0739}', '\u{073A}', '\u{073B}', '\u{073C}', '\u{073D}', '\u{073E}', '\u{073F}', '\u{0740}', '\u{0741}', '\u{0742}', '\u{0743}', '\u{0744}', '\u{0745}', '\u{0746}', '\u{0747}', '\u{0748}', '\u{0749}', '\u{074A}', '\u{07A6}', '\u{07A7}', '\u{07A8}', '\u{07A9}', '\u{07AA}', '\u{07AB}', '\u{07AC}', '\u{07AD}', '\u{07AE}', '\u{07AF}', '\u{07B0}', '\u{07EB}', '\u{07EC}', '\u{07ED}', '\u{07EE}', '\u{07EF}', '\u{07F0}', '\u{07F1}', '\u{07F2}', '\u{07F3}', '\u{0901}', '\u{0902}', '\u{093C}', '\u{0941}', '\u{0942}', '\u{0943}', '\u{0944}', '\u{0945}', '\u{0946}', '\u{0947}', '\u{0948}', '\u{094D}', '\u{0951}', '\u{0952}', '\u{0953}', '\u{0954}', '\u{0962}', '\u{0963}', '\u{0981}', '\u{09BC}', '\u{09C1}', '\u{09C2}', '\u{09C3}', '\u{09C4}', '\u{09CD}', '\u{09E2}', '\u{09E3}', '\u{0A01}', '\u{0A02}', '\u{0A3C}', '\u{0A41}', '\u{0A42}', '\u{0A47}', '\u{0A48}', '\u{0A4B}', '\u{0A4C}', '\u{0A4D}', '\u{0A51}', '\u{0A70}', '\u{0A71}', '\u{0A75}', '\u{0A81}', '\u{0A82}', '\u{0ABC}', '\u{0AC1}', '\u{0AC2}', '\u{0AC3}', '\u{0AC4}', '\u{0AC5}', '\u{0AC7}', '\u{0AC8}', '\u{0ACD}', '\u{0AE2}', '\u{0AE3}', '\u{0B01}', '\u{0B3C}', '\u{0B3F}', '\u{0B41}', '\u{0B42}', '\u{0B43}', '\u{0B44}', '\u{0B4D}', '\u{0B56}', '\u{0B62}', '\u{0B63}', '\u{0B82}', '\u{0BC0}', '\u{0BCD}', '\u{0C3E}', '\u{0C3F}', '\u{0C40}', '\u{0C46}', '\u{0C47}', '\u{0C48}', '\u{0C4A}', '\u{0C4B}', '\u{0C4C}', '\u{0C4D}', '\u{0C55}', '\u{0C56}', '\u{0C62}', '\u{0C63}', '\u{0CBC}', '\u{0CBF}', '\u{0CC6}', '\u{0CCC}', '\u{0CCD}', '\u{0CE2}', '\u{0CE3}', '\u{0D41}', '\u{0D42}', '\u{0D43}', '\u{0D44}', '\u{0D4D}', '\u{0D62}', '\u{0D63}', '\u{0DCA}', '\u{0DD2}', '\u{0DD3}', '\u{0DD4}', '\u{0DD6}', '\u{0E31}', '\u{0E34}', '\u{0E35}', '\u{0E36}', '\u{0E37}', '\u{0E38}', '\u{0E39}', '\u{0E3A}', '\u{0E47}', '\u{0E48}', '\u{0E49}', '\u{0E4A}', '\u{0E4B}', '\u{0E4C}', '\u{0E4D}', '\u{0E4E}', '\u{0EB1}', '\u{0EB4}', '\u{0EB5}', '\u{0EB6}', '\u{0EB7}', '\u{0EB8}', '\u{0EB9}', '\u{0EBB}', '\u{0EBC}', '\u{0EC8}', '\u{0EC9}', '\u{0ECA}', '\u{0ECB}', '\u{0ECC}', '\u{0ECD}', '\u{0F18}', '\u{0F19}', '\u{0F35}', '\u{0F37}', '\u{0F39}', '\u{0F71}', '\u{0F72}', '\u{0F73}', '\u{0F74}', '\u{0F75}', '\u{0F76}', '\u{0F77}', '\u{0F78}', '\u{0F79}', '\u{0F7A}', '\u{0F7B}', '\u{0F7C}', '\u{0F7D}', '\u{0F7E}', '\u{0F80}', '\u{0F81}', '\u{0F82}', '\u{0F83}', '\u{0F84}', '\u{0F86}', '\u{0F87}', '\u{0F90}', '\u{0F91}', '\u{0F92}', '\u{0F93}', '\u{0F94}', '\u{0F95}', '\u{0F96}', '\u{0F97}', '\u{0F99}', '\u{0F9A}', '\u{0F9B}', '\u{0F9C}', '\u{0F9D}', '\u{0F9E}', '\u{0F9F}', '\u{0FA0}', '\u{0FA1}', '\u{0FA2}', '\u{0FA3}', '\u{0FA4}', '\u{0FA5}', '\u{0FA6}', '\u{0FA7}', '\u{0FA8}', '\u{0FA9}', '\u{0FAA}', '\u{0FAB}', '\u{0FAC}', '\u{0FAD}', '\u{0FAE}', '\u{0FAF}', '\u{0FB0}', '\u{0FB1}', '\u{0FB2}', '\u{0FB3}', '\u{0FB4}', '\u{0FB5}', '\u{0FB6}', '\u{0FB7}', '\u{0FB8}', '\u{0FB9}', '\u{0FBA}', '\u{0FBB}', '\u{0FBC}', '\u{0FC6}', '\u{102D}', '\u{102E}', '\u{102F}', '\u{1030}', '\u{1032}', '\u{1033}', '\u{1034}', '\u{1035}', '\u{1036}', '\u{1037}', '\u{1039}', '\u{103A}', '\u{103D}', '\u{103E}', '\u{1058}', '\u{1059}', '\u{105E}', '\u{105F}', '\u{1060}', '\u{1071}', '\u{1072}', '\u{1073}', '\u{1074}', '\u{1082}', '\u{1085}', '\u{1086}', '\u{108D}', '\u{135F}', '\u{1712}', '\u{1713}', '\u{1714}', '\u{1732}', '\u{1733}', '\u{1734}', '\u{1752}', '\u{1753}', '\u{1772}', '\u{1773}', '\u{17B7}', '\u{17B8}', '\u{17B9}', '\u{17BA}', '\u{17BB}', '\u{17BC}', '\u{17BD}', '\u{17C6}', '\u{17C9}', '\u{17CA}', '\u{17CB}', '\u{17CC}', '\u{17CD}', '\u{17CE}', '\u{17CF}', '\u{17D0}', '\u{17D1}', '\u{17D2}', '\u{17D3}', '\u{17DD}', '\u{180B}', '\u{180C}', '\u{180D}', '\u{18A9}', '\u{1920}', '\u{1921}', '\u{1922}', '\u{1927}', '\u{1928}', '\u{1932}', '\u{1939}', '\u{193A}', '\u{193B}', '\u{1A17}', '\u{1A18}', '\u{1B00}', '\u{1B01}', '\u{1B02}', '\u{1B03}', '\u{1B34}', '\u{1B36}', '\u{1B37}', '\u{1B38}', '\u{1B39}', '\u{1B3A}', '\u{1B3C}', '\u{1B42}', '\u{1B6B}', '\u{1B6C}', '\u{1B6D}', '\u{1B6E}', '\u{1B6F}', '\u{1B70}', '\u{1B71}', '\u{1B72}', '\u{1B73}', '\u{1B80}', '\u{1B81}', '\u{1BA2}', '\u{1BA3}', '\u{1BA4}', '\u{1BA5}', '\u{1BA8}', '\u{1BA9}', '\u{1C2C}', '\u{1C2D}', '\u{1C2E}', '\u{1C2F}', '\u{1C30}', '\u{1C31}', '\u{1C32}', '\u{1C33}', '\u{1C36}', '\u{1C37}', '\u{1DC0}', '\u{1DC1}', '\u{1DC2}', '\u{1DC3}', '\u{1DC4}', '\u{1DC5}', '\u{1DC6}', '\u{1DC7}', '\u{1DC8}', '\u{1DC9}', '\u{1DCA}', '\u{1DCB}', '\u{1DCC}', '\u{1DCD}', '\u{1DCE}', '\u{1DCF}', '\u{1DD0}', '\u{1DD1}', '\u{1DD2}', '\u{1DD3}', '\u{1DD4}', '\u{1DD5}', '\u{1DD6}', '\u{1DD7}', '\u{1DD8}', '\u{1DD9}', '\u{1DDA}', '\u{1DDB}', '\u{1DDC}', '\u{1DDD}', '\u{1DDE}', '\u{1DDF}', '\u{1DE0}', '\u{1DE1}', '\u{1DE2}', '\u{1DE3}', '\u{1DE4}', '\u{1DE5}', '\u{1DE6}', '\u{1DFE}', '\u{1DFF}', '\u{20D0}', '\u{20D1}', '\u{20D2}', '\u{20D3}', '\u{20D4}', '\u{20D5}', '\u{20D6}', '\u{20D7}', '\u{20D8}', '\u{20D9}', '\u{20DA}', '\u{20DB}', '\u{20DC}', '\u{20E1}', '\u{20E5}', '\u{20E6}', '\u{20E7}', '\u{20E8}', '\u{20E9}', '\u{20EA}', '\u{20EB}', '\u{20EC}', '\u{20ED}', '\u{20EE}', '\u{20EF}', '\u{20F0}', '\u{2DE0}', '\u{2DE1}', '\u{2DE2}', '\u{2DE3}', '\u{2DE4}', '\u{2DE5}', '\u{2DE6}', '\u{2DE7}', '\u{2DE8}', '\u{2DE9}', '\u{2DEA}', '\u{2DEB}', '\u{2DEC}', '\u{2DED}', '\u{2DEE}', '\u{2DEF}', '\u{2DF0}', '\u{2DF1}', '\u{2DF2}', '\u{2DF3}', '\u{2DF4}', '\u{2DF5}', '\u{2DF6}', '\u{2DF7}', '\u{2DF8}', '\u{2DF9}', '\u{2DFA}', '\u{2DFB}', '\u{2DFC}', '\u{2DFD}', '\u{2DFE}', '\u{2DFF}', '\u{302A}', '\u{302B}', '\u{302C}', '\u{302D}', '\u{302E}', '\u{302F}', '\u{3099}', '\u{309A}', '\u{A66F}', '\u{A67C}', '\u{A67D}', '\u{A802}', '\u{A806}', '\u{A80B}', '\u{A825}', '\u{A826}', '\u{A8C4}', '\u{A926}', '\u{A927}', '\u{A928}', '\u{A929}', '\u{A92A}', '\u{A92B}', '\u{A92C}', '\u{A92D}', '\u{A947}', '\u{A948}', '\u{A949}', '\u{A94A}', '\u{A94B}', '\u{A94C}', '\u{A94D}', '\u{A94E}', '\u{A94F}', '\u{A950}', '\u{A951}', '\u{AA29}', '\u{AA2A}', '\u{AA2B}', '\u{AA2C}', '\u{AA2D}', '\u{AA2E}', '\u{AA31}', '\u{AA32}', '\u{AA35}', '\u{AA36}', '\u{AA43}', '\u{AA4C}', '\u{FB1E}', '\u{FE00}', '\u{FE01}', '\u{FE02}', '\u{FE03}', '\u{FE04}', '\u{FE05}', '\u{FE06}', '\u{FE07}', '\u{FE08}', '\u{FE09}', '\u{FE0A}', '\u{FE0B}', '\u{FE0C}', '\u{FE0D}', '\u{FE0E}', '\u{FE0F}', '\u{FE20}', '\u{FE21}', '\u{FE22}', '\u{FE23}', '\u{FE24}', '\u{FE25}', '\u{FE26}', '\u{01BB}', '\u{01C0}', '\u{01C1}', '\u{01C2}', '\u{01C3}', '\u{0294}', '\u{05D0}', '\u{05D1}', '\u{05D2}', '\u{05D3}', '\u{05D4}', '\u{05D5}', '\u{05D6}', '\u{05D7}', '\u{05D8}', '\u{05D9}', '\u{05DA}', '\u{05DB}', '\u{05DC}', '\u{05DD}', '\u{05DE}', '\u{05DF}', '\u{05E0}', '\u{05E1}', '\u{05E2}', '\u{05E3}', '\u{05E4}', '\u{05E5}', '\u{05E6}', '\u{05E7}', '\u{05E8}', '\u{05E9}', '\u{05EA}', '\u{05F0}', '\u{05F1}', '\u{05F2}', '\u{0621}', '\u{0622}', '\u{0623}', '\u{0624}', '\u{0625}', '\u{0626}', '\u{0627}', '\u{0628}', '\u{0629}', '\u{062A}', '\u{062B}', '\u{062C}', '\u{062D}', '\u{062E}', '\u{062F}', '\u{0630}', '\u{0631}', '\u{0632}', '\u{0633}', '\u{0634}', '\u{0635}', '\u{0636}', '\u{0637}', '\u{0638}', '\u{0639}', '\u{063A}', '\u{063B}', '\u{063C}', '\u{063D}', '\u{063E}', '\u{063F}', '\u{0641}', '\u{0642}', '\u{0643}', '\u{0644}', '\u{0645}', '\u{0646}', '\u{0647}', '\u{0648}', '\u{0649}', '\u{064A}', '\u{066E}', '\u{066F}', '\u{0671}', '\u{0672}', '\u{0673}', '\u{0674}', '\u{0675}', '\u{0676}', '\u{0677}', '\u{0678}', '\u{0679}', '\u{067A}', '\u{067B}', '\u{067C}', '\u{067D}', '\u{067E}', '\u{067F}', '\u{0680}', '\u{0681}', '\u{0682}', '\u{0683}', '\u{0684}', '\u{0685}', '\u{0686}', '\u{0687}', '\u{0688}', '\u{0689}', '\u{068A}', '\u{068B}', '\u{068C}', '\u{068D}', '\u{068E}', '\u{068F}', '\u{0690}', '\u{0691}', '\u{0692}', '\u{0693}', '\u{0694}', '\u{0695}', '\u{0696}', '\u{0697}', '\u{0698}', '\u{0699}', '\u{069A}', '\u{069B}', '\u{069C}', '\u{069D}', '\u{069E}', '\u{069F}', '\u{06A0}', '\u{06A1}', '\u{06A2}', '\u{06A3}', '\u{06A4}', '\u{06A5}', '\u{06A6}', '\u{06A7}', '\u{06A8}', '\u{06A9}', '\u{06AA}', '\u{06AB}', '\u{06AC}', '\u{06AD}', '\u{06AE}', '\u{06AF}', '\u{06B0}', '\u{06B1}', '\u{06B2}', '\u{06B3}', '\u{06B4}', '\u{06B5}', '\u{06B6}', '\u{06B7}', '\u{06B8}', '\u{06B9}', '\u{06BA}', '\u{06BB}', '\u{06BC}', '\u{06BD}', '\u{06BE}', '\u{06BF}', '\u{06C0}', '\u{06C1}', '\u{06C2}', '\u{06C3}', '\u{06C4}', '\u{06C5}', '\u{06C6}', '\u{06C7}', '\u{06C8}', '\u{06C9}', '\u{06CA}', '\u{06CB}', '\u{06CC}', '\u{06CD}', '\u{06CE}', '\u{06CF}', '\u{06D0}', '\u{06D1}', '\u{06D2}', '\u{06D3}', '\u{06D5}', '\u{06EE}', '\u{06EF}', '\u{06FA}', '\u{06FB}', '\u{06FC}', '\u{06FF}', '\u{0710}', '\u{0712}', '\u{0713}', '\u{0714}', '\u{0715}', '\u{0716}', '\u{0717}', '\u{0718}', '\u{0719}', '\u{071A}', '\u{071B}', '\u{071C}', '\u{071D}', '\u{071E}', '\u{071F}', '\u{0720}', '\u{0721}', '\u{0722}', '\u{0723}', '\u{0724}', '\u{0725}', '\u{0726}', '\u{0727}', '\u{0728}', '\u{0729}', '\u{072A}', '\u{072B}', '\u{072C}', '\u{072D}', '\u{072E}', '\u{072F}', '\u{074D}', '\u{074E}', '\u{074F}', '\u{0750}', '\u{0751}', '\u{0752}', '\u{0753}', '\u{0754}', '\u{0755}', '\u{0756}', '\u{0757}', '\u{0758}', '\u{0759}', '\u{075A}', '\u{075B}', '\u{075C}', '\u{075D}', '\u{075E}', '\u{075F}', '\u{0760}', '\u{0761}', '\u{0762}', '\u{0763}', '\u{0764}', '\u{0765}', '\u{0766}', '\u{0767}', '\u{0768}', '\u{0769}', '\u{076A}', '\u{076B}', '\u{076C}', '\u{076D}', '\u{076E}', '\u{076F}', '\u{0770}', '\u{0771}', '\u{0772}', '\u{0773}', '\u{0774}', '\u{0775}', '\u{0776}', '\u{0777}', '\u{0778}', '\u{0779}', '\u{077A}', '\u{077B}', '\u{077C}', '\u{077D}', '\u{077E}', '\u{077F}', '\u{0780}', '\u{0781}', '\u{0782}', '\u{0783}', '\u{0784}', '\u{0785}', '\u{0786}', '\u{0787}', '\u{0788}', '\u{0789}', '\u{078A}', '\u{078B}', '\u{078C}', '\u{078D}', '\u{078E}', '\u{078F}', '\u{0790}', '\u{0791}', '\u{0792}', '\u{0793}', '\u{0794}', '\u{0795}', '\u{0796}', '\u{0797}', '\u{0798}', '\u{0799}', '\u{079A}', '\u{079B}', '\u{079C}', '\u{079D}', '\u{079E}', '\u{079F}', '\u{07A0}', '\u{07A1}', '\u{07A2}', '\u{07A3}', '\u{07A4}', '\u{07A5}', '\u{07B1}', '\u{07CA}', '\u{07CB}', '\u{07CC}', '\u{07CD}', '\u{07CE}', '\u{07CF}', '\u{07D0}', '\u{07D1}', '\u{07D2}', '\u{07D3}', '\u{07D4}', '\u{07D5}', '\u{07D6}', '\u{07D7}', '\u{07D8}', '\u{07D9}', '\u{07DA}', '\u{07DB}', '\u{07DC}', '\u{07DD}', '\u{07DE}', '\u{07DF}', '\u{07E0}', '\u{07E1}', '\u{07E2}', '\u{07E3}', '\u{07E4}', '\u{07E5}', '\u{07E6}', '\u{07E7}', '\u{07E8}', '\u{07E9}', '\u{07EA}', '\u{0904}', '\u{0905}', '\u{0906}', '\u{0907}', '\u{0908}', '\u{0909}', '\u{090A}', '\u{090B}', '\u{090C}', '\u{090D}', '\u{090E}', '\u{090F}', '\u{0910}', '\u{0911}', '\u{0912}', '\u{0913}', '\u{0914}', '\u{0915}', '\u{0916}', '\u{0917}', '\u{0918}', '\u{0919}', '\u{091A}', '\u{091B}', '\u{091C}', '\u{091D}', '\u{091E}', '\u{091F}', '\u{0920}', '\u{0921}', '\u{0922}', '\u{0923}', '\u{0924}', '\u{0925}', '\u{0926}', '\u{0927}', '\u{0928}', '\u{0929}', '\u{092A}', '\u{092B}', '\u{092C}', '\u{092D}', '\u{092E}', '\u{092F}', '\u{0930}', '\u{0931}', '\u{0932}', '\u{0933}', '\u{0934}', '\u{0935}', '\u{0936}', '\u{0937}', '\u{0938}', '\u{0939}', '\u{093D}', '\u{0950}', '\u{0958}', '\u{0959}', '\u{095A}', '\u{095B}', '\u{095C}', '\u{095D}', '\u{095E}', '\u{095F}', '\u{0960}', '\u{0961}', '\u{0972}', '\u{097B}', '\u{097C}', '\u{097D}', '\u{097E}', '\u{097F}', '\u{0985}', '\u{0986}', '\u{0987}', '\u{0988}', '\u{0989}', '\u{098A}', '\u{098B}', '\u{098C}', '\u{098F}', '\u{0990}', '\u{0993}', '\u{0994}', '\u{0995}', '\u{0996}', '\u{0997}', '\u{0998}', '\u{0999}', '\u{099A}', '\u{099B}', '\u{099C}', '\u{099D}', '\u{099E}', '\u{099F}', '\u{09A0}', '\u{09A1}', '\u{09A2}', '\u{09A3}', '\u{09A4}', '\u{09A5}', '\u{09A6}', '\u{09A7}', '\u{09A8}', '\u{09AA}', '\u{09AB}', '\u{09AC}', '\u{09AD}', '\u{09AE}', '\u{09AF}', '\u{09B0}', '\u{09B2}', '\u{09B6}', '\u{09B7}', '\u{09B8}', '\u{09B9}', '\u{09BD}', '\u{09CE}', '\u{09DC}', '\u{09DD}', '\u{09DF}', '\u{09E0}', '\u{09E1}', '\u{09F0}', '\u{09F1}', '\u{0A05}', '\u{0A06}', '\u{0A07}', '\u{0A08}', '\u{0A09}', '\u{0A0A}', '\u{0A0F}', '\u{0A10}', '\u{0A13}', '\u{0A14}', '\u{0A15}', '\u{0A16}', '\u{0A17}', '\u{0A18}', '\u{0A19}', '\u{0A1A}', '\u{0A1B}', '\u{0A1C}', '\u{0A1D}', '\u{0A1E}', '\u{0A1F}', '\u{0A20}', '\u{0A21}', '\u{0A22}', '\u{0A23}', '\u{0A24}', '\u{0A25}', '\u{0A26}', '\u{0A27}', '\u{0A28}', '\u{0A2A}', '\u{0A2B}', '\u{0A2C}', '\u{0A2D}', '\u{0A2E}', '\u{0A2F}', '\u{0A30}', '\u{0A32}', '\u{0A33}', '\u{0A35}', '\u{0A36}', '\u{0A38}', '\u{0A39}', '\u{0A59}', '\u{0A5A}', '\u{0A5B}', '\u{0A5C}', '\u{0A5E}', '\u{0A72}', '\u{0A73}', '\u{0A74}', '\u{0A85}', '\u{0A86}', '\u{0A87}', '\u{0A88}', '\u{0A89}', '\u{0A8A}', '\u{0A8B}', '\u{0A8C}', '\u{0A8D}', '\u{0A8F}', '\u{0A90}', '\u{0A91}', '\u{0A93}', '\u{0A94}', '\u{0A95}', '\u{0A96}', '\u{0A97}', '\u{0A98}', '\u{0A99}', '\u{0A9A}', '\u{0A9B}', '\u{0A9C}', '\u{0A9D}', '\u{0A9E}', '\u{0A9F}', '\u{0AA0}', '\u{0AA1}', '\u{0AA2}', '\u{0AA3}', '\u{0AA4}', '\u{0AA5}', '\u{0AA6}', '\u{0AA7}', '\u{0AA8}', '\u{0AAA}', '\u{0AAB}', '\u{0AAC}', '\u{0AAD}', '\u{0AAE}', '\u{0AAF}', '\u{0AB0}', '\u{0AB2}', '\u{0AB3}', '\u{0AB5}', '\u{0AB6}', '\u{0AB7}', '\u{0AB8}', '\u{0AB9}', '\u{0ABD}', '\u{0AD0}', '\u{0AE0}', '\u{0AE1}', '\u{0B05}', '\u{0B06}', '\u{0B07}', '\u{0B08}', '\u{0B09}', '\u{0B0A}', '\u{0B0B}', '\u{0B0C}', '\u{0B0F}', '\u{0B10}', '\u{0B13}', '\u{0B14}', '\u{0B15}', '\u{0B16}', '\u{0B17}', '\u{0B18}', '\u{0B19}', '\u{0B1A}', '\u{0B1B}', '\u{0B1C}', '\u{0B1D}', '\u{0B1E}', '\u{0B1F}', '\u{0B20}', '\u{0B21}', '\u{0B22}', '\u{0B23}', '\u{0B24}', '\u{0B25}', '\u{0B26}', '\u{0B27}', '\u{0B28}', '\u{0B2A}', '\u{0B2B}', '\u{0B2C}', '\u{0B2D}', '\u{0B2E}', '\u{0B2F}', '\u{0B30}', '\u{0B32}', '\u{0B33}', '\u{0B35}', '\u{0B36}', '\u{0B37}', '\u{0B38}', '\u{0B39}', '\u{0B3D}', '\u{0B5C}', '\u{0B5D}', '\u{0B5F}', '\u{0B60}', '\u{0B61}', '\u{0B71}', '\u{0B83}', '\u{0B85}', '\u{0B86}', '\u{0B87}', '\u{0B88}', '\u{0B89}', '\u{0B8A}', '\u{0B8E}', '\u{0B8F}', '\u{0B90}', '\u{0B92}', '\u{0B93}', '\u{0B94}', '\u{0B95}', '\u{0B99}', '\u{0B9A}', '\u{0B9C}', '\u{0B9E}', '\u{0B9F}', '\u{0BA3}', '\u{0BA4}', '\u{0BA8}', '\u{0BA9}', '\u{0BAA}', '\u{0BAE}', '\u{0BAF}', '\u{0BB0}', '\u{0BB1}', '\u{0BB2}', '\u{0BB3}', '\u{0BB4}', '\u{0BB5}', '\u{0BB6}', '\u{0BB7}', '\u{0BB8}', '\u{0BB9}', '\u{0BD0}', '\u{0C05}', '\u{0C06}', '\u{0C07}', '\u{0C08}', '\u{0C09}', '\u{0C0A}', '\u{0C0B}', '\u{0C0C}', '\u{0C0E}', '\u{0C0F}', '\u{0C10}', '\u{0C12}', '\u{0C13}', '\u{0C14}', '\u{0C15}', '\u{0C16}', '\u{0C17}', '\u{0C18}', '\u{0C19}', '\u{0C1A}', '\u{0C1B}', '\u{0C1C}', '\u{0C1D}', '\u{0C1E}', '\u{0C1F}', '\u{0C20}', '\u{0C21}', '\u{0C22}', '\u{0C23}', '\u{0C24}', '\u{0C25}', '\u{0C26}', '\u{0C27}', '\u{0C28}', '\u{0C2A}', '\u{0C2B}', '\u{0C2C}', '\u{0C2D}', '\u{0C2E}', '\u{0C2F}', '\u{0C30}', '\u{0C31}', '\u{0C32}', '\u{0C33}', '\u{0C35}', '\u{0C36}', '\u{0C37}', '\u{0C38}', '\u{0C39}', '\u{0C3D}', '\u{0C58}', '\u{0C59}', '\u{0C60}', '\u{0C61}', '\u{0C85}', '\u{0C86}', '\u{0C87}', '\u{0C88}', '\u{0C89}', '\u{0C8A}', '\u{0C8B}', '\u{0C8C}', '\u{0C8E}', '\u{0C8F}', '\u{0C90}', '\u{0C92}', '\u{0C93}', '\u{0C94}', '\u{0C95}', '\u{0C96}', '\u{0C97}', '\u{0C98}', '\u{0C99}', '\u{0C9A}', '\u{0C9B}', '\u{0C9C}', '\u{0C9D}', '\u{0C9E}', '\u{0C9F}', '\u{0CA0}', '\u{0CA1}', '\u{0CA2}', '\u{0CA3}', '\u{0CA4}', '\u{0CA5}', '\u{0CA6}', '\u{0CA7}', '\u{0CA8}', '\u{0CAA}', '\u{0CAB}', '\u{0CAC}', '\u{0CAD}', '\u{0CAE}', '\u{0CAF}', '\u{0CB0}', '\u{0CB1}', '\u{0CB2}', '\u{0CB3}', '\u{0CB5}', '\u{0CB6}', '\u{0CB7}', '\u{0CB8}', '\u{0CB9}', '\u{0CBD}', '\u{0CDE}', '\u{0CE0}', '\u{0CE1}', '\u{0D05}', '\u{0D06}', '\u{0D07}', '\u{0D08}', '\u{0D09}', '\u{0D0A}', '\u{0D0B}', '\u{0D0C}', '\u{0D0E}', '\u{0D0F}', '\u{0D10}', '\u{0D12}', '\u{0D13}', '\u{0D14}', '\u{0D15}', '\u{0D16}', '\u{0D17}', '\u{0D18}', '\u{0D19}', '\u{0D1A}', '\u{0D1B}', '\u{0D1C}', '\u{0D1D}', '\u{0D1E}', '\u{0D1F}', '\u{0D20}', '\u{0D21}', '\u{0D22}', '\u{0D23}', '\u{0D24}', '\u{0D25}', '\u{0D26}', '\u{0D27}', '\u{0D28}', '\u{0D2A}', '\u{0D2B}', '\u{0D2C}', '\u{0D2D}', '\u{0D2E}', '\u{0D2F}', '\u{0D30}', '\u{0D31}', '\u{0D32}', '\u{0D33}', '\u{0D34}', '\u{0D35}', '\u{0D36}', '\u{0D37}', '\u{0D38}', '\u{0D39}', '\u{0D3D}', '\u{0D60}', '\u{0D61}', '\u{0D7A}', '\u{0D7B}', '\u{0D7C}', '\u{0D7D}', '\u{0D7E}', '\u{0D7F}', '\u{0D85}', '\u{0D86}', '\u{0D87}', '\u{0D88}', '\u{0D89}', '\u{0D8A}', '\u{0D8B}', '\u{0D8C}', '\u{0D8D}', '\u{0D8E}', '\u{0D8F}', '\u{0D90}', '\u{0D91}', '\u{0D92}', '\u{0D93}', '\u{0D94}', '\u{0D95}', '\u{0D96}', '\u{0D9A}', '\u{0D9B}', '\u{0D9C}', '\u{0D9D}', '\u{0D9E}', '\u{0D9F}', '\u{0DA0}', '\u{0DA1}', '\u{0DA2}', '\u{0DA3}', '\u{0DA4}', '\u{0DA5}', '\u{0DA6}', '\u{0DA7}', '\u{0DA8}', '\u{0DA9}', '\u{0DAA}', '\u{0DAB}', '\u{0DAC}', '\u{0DAD}', '\u{0DAE}', '\u{0DAF}', '\u{0DB0}', '\u{0DB1}', '\u{0DB3}', '\u{0DB4}', '\u{0DB5}', '\u{0DB6}', '\u{0DB7}', '\u{0DB8}', '\u{0DB9}', '\u{0DBA}', '\u{0DBB}', '\u{0DBD}', '\u{0DC0}', '\u{0DC1}', '\u{0DC2}', '\u{0DC3}', '\u{0DC4}', '\u{0DC5}', '\u{0DC6}', '\u{0E01}', '\u{0E02}', '\u{0E03}', '\u{0E04}', '\u{0E05}', '\u{0E06}', '\u{0E07}', '\u{0E08}', '\u{0E09}', '\u{0E0A}', '\u{0E0B}', '\u{0E0C}', '\u{0E0D}', '\u{0E0E}', '\u{0E0F}', '\u{0E10}', '\u{0E11}', '\u{0E12}', '\u{0E13}', '\u{0E14}', '\u{0E15}', '\u{0E16}', '\u{0E17}', '\u{0E18}', '\u{0E19}', '\u{0E1A}', '\u{0E1B}', '\u{0E1C}', '\u{0E1D}', '\u{0E1E}', '\u{0E1F}', '\u{0E20}', '\u{0E21}', '\u{0E22}', '\u{0E23}', '\u{0E24}', '\u{0E25}', '\u{0E26}', '\u{0E27}', '\u{0E28}', '\u{0E29}', '\u{0E2A}', '\u{0E2B}', '\u{0E2C}', '\u{0E2D}', '\u{0E2E}', '\u{0E2F}', '\u{0E30}', '\u{0E32}', '\u{0E33}', '\u{0E40}', '\u{0E41}', '\u{0E42}', '\u{0E43}', '\u{0E44}', '\u{0E45}', '\u{0E81}', '\u{0E82}', '\u{0E84}', '\u{0E87}', '\u{0E88}', '\u{0E8A}', '\u{0E8D}', '\u{0E94}', '\u{0E95}', '\u{0E96}', '\u{0E97}', '\u{0E99}', '\u{0E9A}', '\u{0E9B}', '\u{0E9C}', '\u{0E9D}', '\u{0E9E}', '\u{0E9F}', '\u{0EA1}', '\u{0EA2}', '\u{0EA3}', '\u{0EA5}', '\u{0EA7}', '\u{0EAA}', '\u{0EAB}', '\u{0EAD}', '\u{0EAE}', '\u{0EAF}', '\u{0EB0}', '\u{0EB2}', '\u{0EB3}', '\u{0EBD}', '\u{0EC0}', '\u{0EC1}', '\u{0EC2}', '\u{0EC3}', '\u{0EC4}', '\u{0EDC}', '\u{0EDD}', '\u{0F00}', '\u{0F40}', '\u{0F41}', '\u{0F42}', '\u{0F43}', '\u{0F44}', '\u{0F45}', '\u{0F46}', '\u{0F47}', '\u{0F49}', '\u{0F4A}', '\u{0F4B}', '\u{0F4C}', '\u{0F4D}', '\u{0F4E}', '\u{0F4F}', '\u{0F50}', '\u{0F51}', '\u{0F52}', '\u{0F53}', '\u{0F54}', '\u{0F55}', '\u{0F56}', '\u{0F57}', '\u{0F58}', '\u{0F59}', '\u{0F5A}', '\u{0F5B}', '\u{0F5C}', '\u{0F5D}', '\u{0F5E}', '\u{0F5F}', '\u{0F60}', '\u{0F61}', '\u{0F62}', '\u{0F63}', '\u{0F64}', '\u{0F65}', '\u{0F66}', '\u{0F67}', '\u{0F68}', '\u{0F69}', '\u{0F6A}', '\u{0F6B}', '\u{0F6C}', '\u{0F88}', '\u{0F89}', '\u{0F8A}', '\u{0F8B}', '\u{1000}', '\u{1001}', '\u{1002}', '\u{1003}', '\u{1004}', '\u{1005}', '\u{1006}', '\u{1007}', '\u{1008}', '\u{1009}', '\u{100A}', '\u{100B}', '\u{100C}', '\u{100D}', '\u{100E}', '\u{100F}', '\u{1010}', '\u{1011}', '\u{1012}', '\u{1013}', '\u{1014}', '\u{1015}', '\u{1016}', '\u{1017}', '\u{1018}', '\u{1019}', '\u{101A}', '\u{101B}', '\u{101C}', '\u{101D}', '\u{101E}', '\u{101F}', '\u{1020}', '\u{1021}', '\u{1022}', '\u{1023}', '\u{1024}', '\u{1025}', '\u{1026}', '\u{1027}', '\u{1028}', '\u{1029}', '\u{102A}', '\u{103F}', '\u{1050}', '\u{1051}', '\u{1052}', '\u{1053}', '\u{1054}', '\u{1055}', '\u{105A}', '\u{105B}', '\u{105C}', '\u{105D}', '\u{1061}', '\u{1065}', '\u{1066}', '\u{106E}', '\u{106F}', '\u{1070}', '\u{1075}', '\u{1076}', '\u{1077}', '\u{1078}', '\u{1079}', '\u{107A}', '\u{107B}', '\u{107C}', '\u{107D}', '\u{107E}', '\u{107F}', '\u{1080}', '\u{1081}', '\u{108E}', '\u{10D0}', '\u{10D1}', '\u{10D2}', '\u{10D3}', '\u{10D4}', '\u{10D5}', '\u{10D6}', '\u{10D7}', '\u{10D8}', '\u{10D9}', '\u{10DA}', '\u{10DB}', '\u{10DC}', '\u{10DD}', '\u{10DE}', '\u{10DF}', '\u{10E0}', '\u{10E1}', '\u{10E2}', '\u{10E3}', '\u{10E4}', '\u{10E5}', '\u{10E6}', '\u{10E7}', '\u{10E8}', '\u{10E9}', '\u{10EA}', '\u{10EB}', '\u{10EC}', '\u{10ED}', '\u{10EE}', '\u{10EF}', '\u{10F0}', '\u{10F1}', '\u{10F2}', '\u{10F3}', '\u{10F4}', '\u{10F5}', '\u{10F6}', '\u{10F7}', '\u{10F8}', '\u{10F9}', '\u{10FA}', '\u{1100}', '\u{1101}', '\u{1102}', '\u{1103}', '\u{1104}', '\u{1105}', '\u{1106}', '\u{1107}', '\u{1108}', '\u{1109}', '\u{110A}', '\u{110B}', '\u{110C}', '\u{110D}', '\u{110E}', '\u{110F}', '\u{1110}', '\u{1111}', '\u{1112}', '\u{1113}', '\u{1114}', '\u{1115}', '\u{1116}', '\u{1117}', '\u{1118}', '\u{1119}', '\u{111A}', '\u{111B}', '\u{111C}', '\u{111D}', '\u{111E}', '\u{111F}', '\u{1120}', '\u{1121}', '\u{1122}', '\u{1123}', '\u{1124}', '\u{1125}', '\u{1126}', '\u{1127}', '\u{1128}', '\u{1129}', '\u{112A}', '\u{112B}', '\u{112C}', '\u{112D}', '\u{112E}', '\u{112F}', '\u{1130}', '\u{1131}', '\u{1132}', '\u{1133}', '\u{1134}', '\u{1135}', '\u{1136}', '\u{1137}', '\u{1138}', '\u{1139}', '\u{113A}', '\u{113B}', '\u{113C}', '\u{113D}', '\u{113E}', '\u{113F}', '\u{1140}', '\u{1141}', '\u{1142}', '\u{1143}', '\u{1144}', '\u{1145}', '\u{1146}', '\u{1147}', '\u{1148}', '\u{1149}', '\u{114A}', '\u{114B}', '\u{114C}', '\u{114D}', '\u{114E}', '\u{114F}', '\u{1150}', '\u{1151}', '\u{1152}', '\u{1153}', '\u{1154}', '\u{1155}', '\u{1156}', '\u{1157}', '\u{1158}', '\u{1159}', '\u{115F}', '\u{1160}', '\u{1161}', '\u{1162}', '\u{1163}', '\u{1164}', '\u{1165}', '\u{1166}', '\u{1167}', '\u{1168}', '\u{1169}', '\u{116A}', '\u{116B}', '\u{116C}', '\u{116D}', '\u{116E}', '\u{116F}', '\u{1170}', '\u{1171}', '\u{1172}', '\u{1173}', '\u{1174}', '\u{1175}', '\u{1176}', '\u{1177}', '\u{1178}', '\u{1179}', '\u{117A}', '\u{117B}', '\u{117C}', '\u{117D}', '\u{117E}', '\u{117F}', '\u{1180}', '\u{1181}', '\u{1182}', '\u{1183}', '\u{1184}', '\u{1185}', '\u{1186}', '\u{1187}', '\u{1188}', '\u{1189}', '\u{118A}', '\u{118B}', '\u{118C}', '\u{118D}', '\u{118E}', '\u{118F}', '\u{1190}', '\u{1191}', '\u{1192}', '\u{1193}', '\u{1194}', '\u{1195}', '\u{1196}', '\u{1197}', '\u{1198}', '\u{1199}', '\u{119A}', '\u{119B}', '\u{119C}', '\u{119D}', '\u{119E}', '\u{119F}', '\u{11A0}', '\u{11A1}', '\u{11A2}', '\u{11A8}', '\u{11A9}', '\u{11AA}', '\u{11AB}', '\u{11AC}', '\u{11AD}', '\u{11AE}', '\u{11AF}', '\u{11B0}', '\u{11B1}', '\u{11B2}', '\u{11B3}', '\u{11B4}', '\u{11B5}', '\u{11B6}', '\u{11B7}', '\u{11B8}', '\u{11B9}', '\u{11BA}', '\u{11BB}', '\u{11BC}', '\u{11BD}', '\u{11BE}', '\u{11BF}', '\u{11C0}', '\u{11C1}', '\u{11C2}', '\u{11C3}', '\u{11C4}', '\u{11C5}', '\u{11C6}', '\u{11C7}', '\u{11C8}', '\u{11C9}', '\u{11CA}', '\u{11CB}', '\u{11CC}', '\u{11CD}', '\u{11CE}', '\u{11CF}', '\u{11D0}', '\u{11D1}', '\u{11D2}', '\u{11D3}', '\u{11D4}', '\u{11D5}', '\u{11D6}', '\u{11D7}', '\u{11D8}', '\u{11D9}', '\u{11DA}', '\u{11DB}', '\u{11DC}', '\u{11DD}', '\u{11DE}', '\u{11DF}', '\u{11E0}', '\u{11E1}', '\u{11E2}', '\u{11E3}', '\u{11E4}', '\u{11E5}', '\u{11E6}', '\u{11E7}', '\u{11E8}', '\u{11E9}', '\u{11EA}', '\u{11EB}', '\u{11EC}', '\u{11ED}', '\u{11EE}', '\u{11EF}', '\u{11F0}', '\u{11F1}', '\u{11F2}', '\u{11F3}', '\u{11F4}', '\u{11F5}', '\u{11F6}', '\u{11F7}', '\u{11F8}', '\u{11F9}', '\u{1200}', '\u{1201}', '\u{1202}', '\u{1203}', '\u{1204}', '\u{1205}', '\u{1206}', '\u{1207}', '\u{1208}', '\u{1209}', '\u{120A}', '\u{120B}', '\u{120C}', '\u{120D}', '\u{120E}', '\u{120F}', '\u{1210}', '\u{1211}', '\u{1212}', '\u{1213}', '\u{1214}', '\u{1215}', '\u{1216}', '\u{1217}', '\u{1218}', '\u{1219}', '\u{121A}', '\u{121B}', '\u{121C}', '\u{121D}', '\u{121E}', '\u{121F}', '\u{1220}', '\u{1221}', '\u{1222}', '\u{1223}', '\u{1224}', '\u{1225}', '\u{1226}', '\u{1227}', '\u{1228}', '\u{1229}', '\u{122A}', '\u{122B}', '\u{122C}', '\u{122D}', '\u{122E}', '\u{122F}', '\u{1230}', '\u{1231}', '\u{1232}', '\u{1233}', '\u{1234}', '\u{1235}', '\u{1236}', '\u{1237}', '\u{1238}', '\u{1239}', '\u{123A}', '\u{123B}', '\u{123C}', '\u{123D}', '\u{123E}', '\u{123F}', '\u{1240}', '\u{1241}', '\u{1242}', '\u{1243}', '\u{1244}', '\u{1245}', '\u{1246}', '\u{1247}', '\u{1248}', '\u{124A}', '\u{124B}', '\u{124C}', '\u{124D}', '\u{1250}', '\u{1251}', '\u{1252}', '\u{1253}', '\u{1254}', '\u{1255}', '\u{1256}', '\u{1258}', '\u{125A}', '\u{125B}', '\u{125C}', '\u{125D}', '\u{1260}', '\u{1261}', '\u{1262}', '\u{1263}', '\u{1264}', '\u{1265}', '\u{1266}', '\u{1267}', '\u{1268}', '\u{1269}', '\u{126A}', '\u{126B}', '\u{126C}', '\u{126D}', '\u{126E}', '\u{126F}', '\u{1270}', '\u{1271}', '\u{1272}', '\u{1273}', '\u{1274}', '\u{1275}', '\u{1276}', '\u{1277}', '\u{1278}', '\u{1279}', '\u{127A}', '\u{127B}', '\u{127C}', '\u{127D}', '\u{127E}', '\u{127F}', '\u{1280}', '\u{1281}', '\u{1282}', '\u{1283}', '\u{1284}', '\u{1285}', '\u{1286}', '\u{1287}', '\u{1288}', '\u{128A}', '\u{128B}', '\u{128C}', '\u{128D}', '\u{1290}', '\u{1291}', '\u{1292}', '\u{1293}', '\u{1294}', '\u{1295}', '\u{1296}', '\u{1297}', '\u{1298}', '\u{1299}', '\u{129A}', '\u{129B}', '\u{129C}', '\u{129D}', '\u{129E}', '\u{129F}', '\u{12A0}', '\u{12A1}', '\u{12A2}', '\u{12A3}', '\u{12A4}', '\u{12A5}', '\u{12A6}', '\u{12A7}', '\u{12A8}', '\u{12A9}', '\u{12AA}', '\u{12AB}', '\u{12AC}', '\u{12AD}', '\u{12AE}', '\u{12AF}', '\u{12B0}', '\u{12B2}', '\u{12B3}', '\u{12B4}', '\u{12B5}', '\u{12B8}', '\u{12B9}', '\u{12BA}', '\u{12BB}', '\u{12BC}', '\u{12BD}', '\u{12BE}', '\u{12C0}', '\u{12C2}', '\u{12C3}', '\u{12C4}', '\u{12C5}', '\u{12C8}', '\u{12C9}', '\u{12CA}', '\u{12CB}', '\u{12CC}', '\u{12CD}', '\u{12CE}', '\u{12CF}', '\u{12D0}', '\u{12D1}', '\u{12D2}', '\u{12D3}', '\u{12D4}', '\u{12D5}', '\u{12D6}', '\u{12D8}', '\u{12D9}', '\u{12DA}', '\u{12DB}', '\u{12DC}', '\u{12DD}', '\u{12DE}', '\u{12DF}', '\u{12E0}', '\u{12E1}', '\u{12E2}', '\u{12E3}', '\u{12E4}', '\u{12E5}', '\u{12E6}', '\u{12E7}', '\u{12E8}', '\u{12E9}', '\u{12EA}', '\u{12EB}', '\u{12EC}', '\u{12ED}', '\u{12EE}', '\u{12EF}', '\u{12F0}', '\u{12F1}', '\u{12F2}', '\u{12F3}', '\u{12F4}', '\u{12F5}', '\u{12F6}', '\u{12F7}', '\u{12F8}', '\u{12F9}', '\u{12FA}', '\u{12FB}', '\u{12FC}', '\u{12FD}', '\u{12FE}', '\u{12FF}', '\u{1300}', '\u{1301}', '\u{1302}', '\u{1303}', '\u{1304}', '\u{1305}', '\u{1306}', '\u{1307}', '\u{1308}', '\u{1309}', '\u{130A}', '\u{130B}', '\u{130C}', '\u{130D}', '\u{130E}', '\u{130F}', '\u{1310}', '\u{1312}', '\u{1313}', '\u{1314}', '\u{1315}', '\u{1318}', '\u{1319}', '\u{131A}', '\u{131B}', '\u{131C}', '\u{131D}', '\u{131E}', '\u{131F}', '\u{1320}', '\u{1321}', '\u{1322}', '\u{1323}', '\u{1324}', '\u{1325}', '\u{1326}', '\u{1327}', '\u{1328}', '\u{1329}', '\u{132A}', '\u{132B}', '\u{132C}', '\u{132D}', '\u{132E}', '\u{132F}', '\u{1330}', '\u{1331}', '\u{1332}', '\u{1333}', '\u{1334}', '\u{1335}', '\u{1336}', '\u{1337}', '\u{1338}', '\u{1339}', '\u{133A}', '\u{133B}', '\u{133C}', '\u{133D}', '\u{133E}', '\u{133F}', '\u{1340}', '\u{1341}', '\u{1342}', '\u{1343}', '\u{1344}', '\u{1345}', '\u{1346}', '\u{1347}', '\u{1348}', '\u{1349}', '\u{134A}', '\u{134B}', '\u{134C}', '\u{134D}', '\u{134E}', '\u{134F}', '\u{1350}', '\u{1351}', '\u{1352}', '\u{1353}', '\u{1354}', '\u{1355}', '\u{1356}', '\u{1357}', '\u{1358}', '\u{1359}', '\u{135A}', '\u{1380}', '\u{1381}', '\u{1382}', '\u{1383}', '\u{1384}', '\u{1385}', '\u{1386}', '\u{1387}', '\u{1388}', '\u{1389}', '\u{138A}', '\u{138B}', '\u{138C}', '\u{138D}', '\u{138E}', '\u{138F}', '\u{13A0}', '\u{13A1}', '\u{13A2}', '\u{13A3}', '\u{13A4}', '\u{13A5}', '\u{13A6}', '\u{13A7}', '\u{13A8}', '\u{13A9}', '\u{13AA}', '\u{13AB}', '\u{13AC}', '\u{13AD}', '\u{13AE}', '\u{13AF}', '\u{13B0}', '\u{13B1}', '\u{13B2}', '\u{13B3}', '\u{13B4}', '\u{13B5}', '\u{13B6}', '\u{13B7}', '\u{13B8}', '\u{13B9}', '\u{13BA}', '\u{13BB}', '\u{13BC}', '\u{13BD}', '\u{13BE}', '\u{13BF}', '\u{13C0}', '\u{13C1}', '\u{13C2}', '\u{13C3}', '\u{13C4}', '\u{13C5}', '\u{13C6}', '\u{13C7}', '\u{13C8}', '\u{13C9}', '\u{13CA}', '\u{13CB}', '\u{13CC}', '\u{13CD}', '\u{13CE}', '\u{13CF}', '\u{13D0}', '\u{13D1}', '\u{13D2}', '\u{13D3}', '\u{13D4}', '\u{13D5}', '\u{13D6}', '\u{13D7}', '\u{13D8}', '\u{13D9}', '\u{13DA}', '\u{13DB}', '\u{13DC}', '\u{13DD}', '\u{13DE}', '\u{13DF}', '\u{13E0}', '\u{13E1}', '\u{13E2}', '\u{13E3}', '\u{13E4}', '\u{13E5}', '\u{13E6}', '\u{13E7}', '\u{13E8}', '\u{13E9}', '\u{13EA}', '\u{13EB}', '\u{13EC}', '\u{13ED}', '\u{13EE}', '\u{13EF}', '\u{13F0}', '\u{13F1}', '\u{13F2}', '\u{13F3}', '\u{13F4}', '\u{1401}', '\u{1402}', '\u{1403}', '\u{1404}', '\u{1405}', '\u{1406}', '\u{1407}', '\u{1408}', '\u{1409}', '\u{140A}', '\u{140B}', '\u{140C}', '\u{140D}', '\u{140E}', '\u{140F}', '\u{1410}', '\u{1411}', '\u{1412}', '\u{1413}', '\u{1414}', '\u{1415}', '\u{1416}', '\u{1417}', '\u{1418}', '\u{1419}', '\u{141A}', '\u{141B}', '\u{141C}', '\u{141D}', '\u{141E}', '\u{141F}', '\u{1420}', '\u{1421}', '\u{1422}', '\u{1423}', '\u{1424}', '\u{1425}', '\u{1426}', '\u{1427}', '\u{1428}', '\u{1429}', '\u{142A}', '\u{142B}', '\u{142C}', '\u{142D}', '\u{142E}', '\u{142F}', '\u{1430}', '\u{1431}', '\u{1432}', '\u{1433}', '\u{1434}', '\u{1435}', '\u{1436}', '\u{1437}', '\u{1438}', '\u{1439}', '\u{143A}', '\u{143B}', '\u{143C}', '\u{143D}', '\u{143E}', '\u{143F}', '\u{1440}', '\u{1441}', '\u{1442}', '\u{1443}', '\u{1444}', '\u{1445}', '\u{1446}', '\u{1447}', '\u{1448}', '\u{1449}', '\u{144A}', '\u{144B}', '\u{144C}', '\u{144D}', '\u{144E}', '\u{144F}', '\u{1450}', '\u{1451}', '\u{1452}', '\u{1453}', '\u{1454}', '\u{1455}', '\u{1456}', '\u{1457}', '\u{1458}', '\u{1459}', '\u{145A}', '\u{145B}', '\u{145C}', '\u{145D}', '\u{145E}', '\u{145F}', '\u{1460}', '\u{1461}', '\u{1462}', '\u{1463}', '\u{1464}', '\u{1465}', '\u{1466}', '\u{1467}', '\u{1468}', '\u{1469}', '\u{146A}', '\u{146B}', '\u{146C}', '\u{146D}', '\u{146E}', '\u{146F}', '\u{1470}', '\u{1471}', '\u{1472}', '\u{1473}', '\u{1474}', '\u{1475}', '\u{1476}', '\u{1477}', '\u{1478}', '\u{1479}', '\u{147A}', '\u{147B}', '\u{147C}', '\u{147D}', '\u{147E}', '\u{147F}', '\u{1480}', '\u{1481}', '\u{1482}', '\u{1483}', '\u{1484}', '\u{1485}', '\u{1486}', '\u{1487}', '\u{1488}', '\u{1489}', '\u{148A}', '\u{148B}', '\u{148C}', '\u{148D}', '\u{148E}', '\u{148F}', '\u{1490}', '\u{1491}', '\u{1492}', '\u{1493}', '\u{1494}', '\u{1495}', '\u{1496}', '\u{1497}', '\u{1498}', '\u{1499}', '\u{149A}', '\u{149B}', '\u{149C}', '\u{149D}', '\u{149E}', '\u{149F}', '\u{14A0}', '\u{14A1}', '\u{14A2}', '\u{14A3}', '\u{14A4}', '\u{14A5}', '\u{14A6}', '\u{14A7}', '\u{14A8}', '\u{14A9}', '\u{14AA}', '\u{14AB}', '\u{14AC}', '\u{14AD}', '\u{14AE}', '\u{14AF}', '\u{14B0}', '\u{14B1}', '\u{14B2}', '\u{14B3}', '\u{14B4}', '\u{14B5}', '\u{14B6}', '\u{14B7}', '\u{14B8}', '\u{14B9}', '\u{14BA}', '\u{14BB}', '\u{14BC}', '\u{14BD}', '\u{14BE}', '\u{14BF}', '\u{14C0}', '\u{14C1}', '\u{14C2}', '\u{14C3}', '\u{14C4}', '\u{14C5}', '\u{14C6}', '\u{14C7}', '\u{14C8}', '\u{14C9}', '\u{14CA}', '\u{14CB}', '\u{14CC}', '\u{14CD}', '\u{14CE}', '\u{14CF}', '\u{14D0}', '\u{14D1}', '\u{14D2}', '\u{14D3}', '\u{14D4}', '\u{14D5}', '\u{14D6}', '\u{14D7}', '\u{14D8}', '\u{14D9}', '\u{14DA}', '\u{14DB}', '\u{14DC}', '\u{14DD}', '\u{14DE}', '\u{14DF}', '\u{14E0}', '\u{14E1}', '\u{14E2}', '\u{14E3}', '\u{14E4}', '\u{14E5}', '\u{14E6}', '\u{14E7}', '\u{14E8}', '\u{14E9}', '\u{14EA}', '\u{14EB}', '\u{14EC}', '\u{14ED}', '\u{14EE}', '\u{14EF}', '\u{14F0}', '\u{14F1}', '\u{14F2}', '\u{14F3}', '\u{14F4}', '\u{14F5}', '\u{14F6}', '\u{14F7}', '\u{14F8}', '\u{14F9}', '\u{14FA}', '\u{14FB}', '\u{14FC}', '\u{14FD}', '\u{14FE}', '\u{14FF}', '\u{1500}', '\u{1501}', '\u{1502}', '\u{1503}', '\u{1504}', '\u{1505}', '\u{1506}', '\u{1507}', '\u{1508}', '\u{1509}', '\u{150A}', '\u{150B}', '\u{150C}', '\u{150D}', '\u{150E}', '\u{150F}', '\u{1510}', '\u{1511}', '\u{1512}', '\u{1513}', '\u{1514}', '\u{1515}', '\u{1516}', '\u{1517}', '\u{1518}', '\u{1519}', '\u{151A}', '\u{151B}', '\u{151C}', '\u{151D}', '\u{151E}', '\u{151F}', '\u{1520}', '\u{1521}', '\u{1522}', '\u{1523}', '\u{1524}', '\u{1525}', '\u{1526}', '\u{1527}', '\u{1528}', '\u{1529}', '\u{152A}', '\u{152B}', '\u{152C}', '\u{152D}', '\u{152E}', '\u{152F}', '\u{1530}', '\u{1531}', '\u{1532}', '\u{1533}', '\u{1534}', '\u{1535}', '\u{1536}', '\u{1537}', '\u{1538}', '\u{1539}', '\u{153A}', '\u{153B}', '\u{153C}', '\u{153D}', '\u{153E}', '\u{153F}', '\u{1540}', '\u{1541}', '\u{1542}', '\u{1543}', '\u{1544}', '\u{1545}', '\u{1546}', '\u{1547}', '\u{1548}', '\u{1549}', '\u{154A}', '\u{154B}', '\u{154C}', '\u{154D}', '\u{154E}', '\u{154F}', '\u{1550}', '\u{1551}', '\u{1552}', '\u{1553}', '\u{1554}', '\u{1555}', '\u{1556}', '\u{1557}', '\u{1558}', '\u{1559}', '\u{155A}', '\u{155B}', '\u{155C}', '\u{155D}', '\u{155E}', '\u{155F}', '\u{1560}', '\u{1561}', '\u{1562}', '\u{1563}', '\u{1564}', '\u{1565}', '\u{1566}', '\u{1567}', '\u{1568}', '\u{1569}', '\u{156A}', '\u{156B}', '\u{156C}', '\u{156D}', '\u{156E}', '\u{156F}', '\u{1570}', '\u{1571}', '\u{1572}', '\u{1573}', '\u{1574}', '\u{1575}', '\u{1576}', '\u{1577}', '\u{1578}', '\u{1579}', '\u{157A}', '\u{157B}', '\u{157C}', '\u{157D}', '\u{157E}', '\u{157F}', '\u{1580}', '\u{1581}', '\u{1582}', '\u{1583}', '\u{1584}', '\u{1585}', '\u{1586}', '\u{1587}', '\u{1588}', '\u{1589}', '\u{158A}', '\u{158B}', '\u{158C}', '\u{158D}', '\u{158E}', '\u{158F}', '\u{1590}', '\u{1591}', '\u{1592}', '\u{1593}', '\u{1594}', '\u{1595}', '\u{1596}', '\u{1597}', '\u{1598}', '\u{1599}', '\u{159A}', '\u{159B}', '\u{159C}', '\u{159D}', '\u{159E}', '\u{159F}', '\u{15A0}', '\u{15A1}', '\u{15A2}', '\u{15A3}', '\u{15A4}', '\u{15A5}', '\u{15A6}', '\u{15A7}', '\u{15A8}', '\u{15A9}', '\u{15AA}', '\u{15AB}', '\u{15AC}', '\u{15AD}', '\u{15AE}', '\u{15AF}', '\u{15B0}', '\u{15B1}', '\u{15B2}', '\u{15B3}', '\u{15B4}', '\u{15B5}', '\u{15B6}', '\u{15B7}', '\u{15B8}', '\u{15B9}', '\u{15BA}', '\u{15BB}', '\u{15BC}', '\u{15BD}', '\u{15BE}', '\u{15BF}', '\u{15C0}', '\u{15C1}', '\u{15C2}', '\u{15C3}', '\u{15C4}', '\u{15C5}', '\u{15C6}', '\u{15C7}', '\u{15C8}', '\u{15C9}', '\u{15CA}', '\u{15CB}', '\u{15CC}', '\u{15CD}', '\u{15CE}', '\u{15CF}', '\u{15D0}', '\u{15D1}', '\u{15D2}', '\u{15D3}', '\u{15D4}', '\u{15D5}', '\u{15D6}', '\u{15D7}', '\u{15D8}', '\u{15D9}', '\u{15DA}', '\u{15DB}', '\u{15DC}', '\u{15DD}', '\u{15DE}', '\u{15DF}', '\u{15E0}', '\u{15E1}', '\u{15E2}', '\u{15E3}', '\u{15E4}', '\u{15E5}', '\u{15E6}', '\u{15E7}', '\u{15E8}', '\u{15E9}', '\u{15EA}', '\u{15EB}', '\u{15EC}', '\u{15ED}', '\u{15EE}', '\u{15EF}', '\u{15F0}', '\u{15F1}', '\u{15F2}', '\u{15F3}', '\u{15F4}', '\u{15F5}', '\u{15F6}', '\u{15F7}', '\u{15F8}', '\u{15F9}', '\u{15FA}', '\u{15FB}', '\u{15FC}', '\u{15FD}', '\u{15FE}', '\u{15FF}', '\u{1600}', '\u{1601}', '\u{1602}', '\u{1603}', '\u{1604}', '\u{1605}', '\u{1606}', '\u{1607}', '\u{1608}', '\u{1609}', '\u{160A}', '\u{160B}', '\u{160C}', '\u{160D}', '\u{160E}', '\u{160F}', '\u{1610}', '\u{1611}', '\u{1612}', '\u{1613}', '\u{1614}', '\u{1615}', '\u{1616}', '\u{1617}', '\u{1618}', '\u{1619}', '\u{161A}', '\u{161B}', '\u{161C}', '\u{161D}', '\u{161E}', '\u{161F}', '\u{1620}', '\u{1621}', '\u{1622}', '\u{1623}', '\u{1624}', '\u{1625}', '\u{1626}', '\u{1627}', '\u{1628}', '\u{1629}', '\u{162A}', '\u{162B}', '\u{162C}', '\u{162D}', '\u{162E}', '\u{162F}', '\u{1630}', '\u{1631}', '\u{1632}', '\u{1633}', '\u{1634}', '\u{1635}', '\u{1636}', '\u{1637}', '\u{1638}', '\u{1639}', '\u{163A}', '\u{163B}', '\u{163C}', '\u{163D}', '\u{163E}', '\u{163F}', '\u{1640}', '\u{1641}', '\u{1642}', '\u{1643}', '\u{1644}', '\u{1645}', '\u{1646}', '\u{1647}', '\u{1648}', '\u{1649}', '\u{164A}', '\u{164B}', '\u{164C}', '\u{164D}', '\u{164E}', '\u{164F}', '\u{1650}', '\u{1651}', '\u{1652}', '\u{1653}', '\u{1654}', '\u{1655}', '\u{1656}', '\u{1657}', '\u{1658}', '\u{1659}', '\u{165A}', '\u{165B}', '\u{165C}', '\u{165D}', '\u{165E}', '\u{165F}', '\u{1660}', '\u{1661}', '\u{1662}', '\u{1663}', '\u{1664}', '\u{1665}', '\u{1666}', '\u{1667}', '\u{1668}', '\u{1669}', '\u{166A}', '\u{166B}', '\u{166C}', '\u{166F}', '\u{1670}', '\u{1671}', '\u{1672}', '\u{1673}', '\u{1674}', '\u{1675}', '\u{1676}', '\u{1681}', '\u{1682}', '\u{1683}', '\u{1684}', '\u{1685}', '\u{1686}', '\u{1687}', '\u{1688}', '\u{1689}', '\u{168A}', '\u{168B}', '\u{168C}', '\u{168D}', '\u{168E}', '\u{168F}', '\u{1690}', '\u{1691}', '\u{1692}', '\u{1693}', '\u{1694}', '\u{1695}', '\u{1696}', '\u{1697}', '\u{1698}', '\u{1699}', '\u{169A}', '\u{16A0}', '\u{16A1}', '\u{16A2}', '\u{16A3}', '\u{16A4}', '\u{16A5}', '\u{16A6}', '\u{16A7}', '\u{16A8}', '\u{16A9}', '\u{16AA}', '\u{16AB}', '\u{16AC}', '\u{16AD}', '\u{16AE}', '\u{16AF}', '\u{16B0}', '\u{16B1}', '\u{16B2}', '\u{16B3}', '\u{16B4}', '\u{16B5}', '\u{16B6}', '\u{16B7}', '\u{16B8}', '\u{16B9}', '\u{16BA}', '\u{16BB}', '\u{16BC}', '\u{16BD}', '\u{16BE}', '\u{16BF}', '\u{16C0}', '\u{16C1}', '\u{16C2}', '\u{16C3}', '\u{16C4}', '\u{16C5}', '\u{16C6}', '\u{16C7}', '\u{16C8}', '\u{16C9}', '\u{16CA}', '\u{16CB}', '\u{16CC}', '\u{16CD}', '\u{16CE}', '\u{16CF}', '\u{16D0}', '\u{16D1}', '\u{16D2}', '\u{16D3}', '\u{16D4}', '\u{16D5}', '\u{16D6}', '\u{16D7}', '\u{16D8}', '\u{16D9}', '\u{16DA}', '\u{16DB}', '\u{16DC}', '\u{16DD}', '\u{16DE}', '\u{16DF}', '\u{16E0}', '\u{16E1}', '\u{16E2}', '\u{16E3}', '\u{16E4}', '\u{16E5}', '\u{16E6}', '\u{16E7}', '\u{16E8}', '\u{16E9}', '\u{16EA}', '\u{1700}', '\u{1701}', '\u{1702}', '\u{1703}', '\u{1704}', '\u{1705}', '\u{1706}', '\u{1707}', '\u{1708}', '\u{1709}', '\u{170A}', '\u{170B}', '\u{170C}', '\u{170E}', '\u{170F}', '\u{1710}', '\u{1711}', '\u{1720}', '\u{1721}', '\u{1722}', '\u{1723}', '\u{1724}', '\u{1725}', '\u{1726}', '\u{1727}', '\u{1728}', '\u{1729}', '\u{172A}', '\u{172B}', '\u{172C}', '\u{172D}', '\u{172E}', '\u{172F}', '\u{1730}', '\u{1731}', '\u{1740}', '\u{1741}', '\u{1742}', '\u{1743}', '\u{1744}', '\u{1745}', '\u{1746}', '\u{1747}', '\u{1748}', '\u{1749}', '\u{174A}', '\u{174B}', '\u{174C}', '\u{174D}', '\u{174E}', '\u{174F}', '\u{1750}', '\u{1751}', '\u{1760}', '\u{1761}', '\u{1762}', '\u{1763}', '\u{1764}', '\u{1765}', '\u{1766}', '\u{1767}', '\u{1768}', '\u{1769}', '\u{176A}', '\u{176B}', '\u{176C}', '\u{176E}', '\u{176F}', '\u{1770}', '\u{1780}', '\u{1781}', '\u{1782}', '\u{1783}', '\u{1784}', '\u{1785}', '\u{1786}', '\u{1787}', '\u{1788}', '\u{1789}', '\u{178A}', '\u{178B}', '\u{178C}', '\u{178D}', '\u{178E}', '\u{178F}', '\u{1790}', '\u{1791}', '\u{1792}', '\u{1793}', '\u{1794}', '\u{1795}', '\u{1796}', '\u{1797}', '\u{1798}', '\u{1799}', '\u{179A}', '\u{179B}', '\u{179C}', '\u{179D}', '\u{179E}', '\u{179F}', '\u{17A0}', '\u{17A1}', '\u{17A2}', '\u{17A3}', '\u{17A4}', '\u{17A5}', '\u{17A6}', '\u{17A7}', '\u{17A8}', '\u{17A9}', '\u{17AA}', '\u{17AB}', '\u{17AC}', '\u{17AD}', '\u{17AE}', '\u{17AF}', '\u{17B0}', '\u{17B1}', '\u{17B2}', '\u{17B3}', '\u{17DC}', '\u{1820}', '\u{1821}', '\u{1822}', '\u{1823}', '\u{1824}', '\u{1825}', '\u{1826}', '\u{1827}', '\u{1828}', '\u{1829}', '\u{182A}', '\u{182B}', '\u{182C}', '\u{182D}', '\u{182E}', '\u{182F}', '\u{1830}', '\u{1831}', '\u{1832}', '\u{1833}', '\u{1834}', '\u{1835}', '\u{1836}', '\u{1837}', '\u{1838}', '\u{1839}', '\u{183A}', '\u{183B}', '\u{183C}', '\u{183D}', '\u{183E}', '\u{183F}', '\u{1840}', '\u{1841}', '\u{1842}', '\u{1844}', '\u{1845}', '\u{1846}', '\u{1847}', '\u{1848}', '\u{1849}', '\u{184A}', '\u{184B}', '\u{184C}', '\u{184D}', '\u{184E}', '\u{184F}', '\u{1850}', '\u{1851}', '\u{1852}', '\u{1853}', '\u{1854}', '\u{1855}', '\u{1856}', '\u{1857}', '\u{1858}', '\u{1859}', '\u{185A}', '\u{185B}', '\u{185C}', '\u{185D}', '\u{185E}', '\u{185F}', '\u{1860}', '\u{1861}', '\u{1862}', '\u{1863}', '\u{1864}', '\u{1865}', '\u{1866}', '\u{1867}', '\u{1868}', '\u{1869}', '\u{186A}', '\u{186B}', '\u{186C}', '\u{186D}', '\u{186E}', '\u{186F}', '\u{1870}', '\u{1871}', '\u{1872}', '\u{1873}', '\u{1874}', '\u{1875}', '\u{1876}', '\u{1877}', '\u{1880}', '\u{1881}', '\u{1882}', '\u{1883}', '\u{1884}', '\u{1885}', '\u{1886}', '\u{1887}', '\u{1888}', '\u{1889}', '\u{188A}', '\u{188B}', '\u{188C}', '\u{188D}', '\u{188E}', '\u{188F}', '\u{1890}', '\u{1891}', '\u{1892}', '\u{1893}', '\u{1894}', '\u{1895}', '\u{1896}', '\u{1897}', '\u{1898}', '\u{1899}', '\u{189A}', '\u{189B}', '\u{189C}', '\u{189D}', '\u{189E}', '\u{189F}', '\u{18A0}', '\u{18A1}', '\u{18A2}', '\u{18A3}', '\u{18A4}', '\u{18A5}', '\u{18A6}', '\u{18A7}', '\u{18A8}', '\u{18AA}', '\u{1900}', '\u{1901}', '\u{1902}', '\u{1903}', '\u{1904}', '\u{1905}', '\u{1906}', '\u{1907}', '\u{1908}', '\u{1909}', '\u{190A}', '\u{190B}', '\u{190C}', '\u{190D}', '\u{190E}', '\u{190F}', '\u{1910}', '\u{1911}', '\u{1912}', '\u{1913}', '\u{1914}', '\u{1915}', '\u{1916}', '\u{1917}', '\u{1918}', '\u{1919}', '\u{191A}', '\u{191B}', '\u{191C}', '\u{1950}', '\u{1951}', '\u{1952}', '\u{1953}', '\u{1954}', '\u{1955}', '\u{1956}', '\u{1957}', '\u{1958}', '\u{1959}', '\u{195A}', '\u{195B}', '\u{195C}', '\u{195D}', '\u{195E}', '\u{195F}', '\u{1960}', '\u{1961}', '\u{1962}', '\u{1963}', '\u{1964}', '\u{1965}', '\u{1966}', '\u{1967}', '\u{1968}', '\u{1969}', '\u{196A}', '\u{196B}', '\u{196C}', '\u{196D}', '\u{1970}', '\u{1971}', '\u{1972}', '\u{1973}', '\u{1974}', '\u{1980}', '\u{1981}', '\u{1982}', '\u{1983}', '\u{1984}', '\u{1985}', '\u{1986}', '\u{1987}', '\u{1988}', '\u{1989}', '\u{198A}', '\u{198B}', '\u{198C}', '\u{198D}', '\u{198E}', '\u{198F}', '\u{1990}', '\u{1991}', '\u{1992}', '\u{1993}', '\u{1994}', '\u{1995}', '\u{1996}', '\u{1997}', '\u{1998}', '\u{1999}', '\u{199A}', '\u{199B}', '\u{199C}', '\u{199D}', '\u{199E}', '\u{199F}', '\u{19A0}', '\u{19A1}', '\u{19A2}', '\u{19A3}', '\u{19A4}', '\u{19A5}', '\u{19A6}', '\u{19A7}', '\u{19A8}', '\u{19A9}', '\u{19C1}', '\u{19C2}', '\u{19C3}', '\u{19C4}', '\u{19C5}', '\u{19C6}', '\u{19C7}', '\u{1A00}', '\u{1A01}', '\u{1A02}', '\u{1A03}', '\u{1A04}', '\u{1A05}', '\u{1A06}', '\u{1A07}', '\u{1A08}', '\u{1A09}', '\u{1A0A}', '\u{1A0B}', '\u{1A0C}', '\u{1A0D}', '\u{1A0E}', '\u{1A0F}', '\u{1A10}', '\u{1A11}', '\u{1A12}', '\u{1A13}', '\u{1A14}', '\u{1A15}', '\u{1A16}', '\u{1B05}', '\u{1B06}', '\u{1B07}', '\u{1B08}', '\u{1B09}', '\u{1B0A}', '\u{1B0B}', '\u{1B0C}', '\u{1B0D}', '\u{1B0E}', '\u{1B0F}', '\u{1B10}', '\u{1B11}', '\u{1B12}', '\u{1B13}', '\u{1B14}', '\u{1B15}', '\u{1B16}', '\u{1B17}', '\u{1B18}', '\u{1B19}', '\u{1B1A}', '\u{1B1B}', '\u{1B1C}', '\u{1B1D}', '\u{1B1E}', '\u{1B1F}', '\u{1B20}', '\u{1B21}', '\u{1B22}', '\u{1B23}', '\u{1B24}', '\u{1B25}', '\u{1B26}', '\u{1B27}', '\u{1B28}', '\u{1B29}', '\u{1B2A}', '\u{1B2B}', '\u{1B2C}', '\u{1B2D}', '\u{1B2E}', '\u{1B2F}', '\u{1B30}', '\u{1B31}', '\u{1B32}', '\u{1B33}', '\u{1B45}', '\u{1B46}', '\u{1B47}', '\u{1B48}', '\u{1B49}', '\u{1B4A}', '\u{1B4B}', '\u{1B83}', '\u{1B84}', '\u{1B85}', '\u{1B86}', '\u{1B87}', '\u{1B88}', '\u{1B89}', '\u{1B8A}', '\u{1B8B}', '\u{1B8C}', '\u{1B8D}', '\u{1B8E}', '\u{1B8F}', '\u{1B90}', '\u{1B91}', '\u{1B92}', '\u{1B93}', '\u{1B94}', '\u{1B95}', '\u{1B96}', '\u{1B97}', '\u{1B98}', '\u{1B99}', '\u{1B9A}', '\u{1B9B}', '\u{1B9C}', '\u{1B9D}', '\u{1B9E}', '\u{1B9F}', '\u{1BA0}', '\u{1BAE}', '\u{1BAF}', '\u{1C00}', '\u{1C01}', '\u{1C02}', '\u{1C03}', '\u{1C04}', '\u{1C05}', '\u{1C06}', '\u{1C07}', '\u{1C08}', '\u{1C09}', '\u{1C0A}', '\u{1C0B}', '\u{1C0C}', '\u{1C0D}', '\u{1C0E}', '\u{1C0F}', '\u{1C10}', '\u{1C11}', '\u{1C12}', '\u{1C13}', '\u{1C14}', '\u{1C15}', '\u{1C16}', '\u{1C17}', '\u{1C18}', '\u{1C19}', '\u{1C1A}', '\u{1C1B}', '\u{1C1C}', '\u{1C1D}', '\u{1C1E}', '\u{1C1F}', '\u{1C20}', '\u{1C21}', '\u{1C22}', '\u{1C23}', '\u{1C4D}', '\u{1C4E}', '\u{1C4F}', '\u{1C5A}', '\u{1C5B}', '\u{1C5C}', '\u{1C5D}', '\u{1C5E}', '\u{1C5F}', '\u{1C60}', '\u{1C61}', '\u{1C62}', '\u{1C63}', '\u{1C64}', '\u{1C65}', '\u{1C66}', '\u{1C67}', '\u{1C68}', '\u{1C69}', '\u{1C6A}', '\u{1C6B}', '\u{1C6C}', '\u{1C6D}', '\u{1C6E}', '\u{1C6F}', '\u{1C70}', '\u{1C71}', '\u{1C72}', '\u{1C73}', '\u{1C74}', '\u{1C75}', '\u{1C76}', '\u{1C77}', '\u{2135}', '\u{2136}', '\u{2137}', '\u{2138}', '\u{2D30}', '\u{2D31}', '\u{2D32}', '\u{2D33}', '\u{2D34}', '\u{2D35}', '\u{2D36}', '\u{2D37}', '\u{2D38}', '\u{2D39}', '\u{2D3A}', '\u{2D3B}', '\u{2D3C}', '\u{2D3D}', '\u{2D3E}', '\u{2D3F}', '\u{2D40}', '\u{2D41}', '\u{2D42}', '\u{2D43}', '\u{2D44}', '\u{2D45}', '\u{2D46}', '\u{2D47}', '\u{2D48}', '\u{2D49}', '\u{2D4A}', '\u{2D4B}', '\u{2D4C}', '\u{2D4D}', '\u{2D4E}', '\u{2D4F}', '\u{2D50}', '\u{2D51}', '\u{2D52}', '\u{2D53}', '\u{2D54}', '\u{2D55}', '\u{2D56}', '\u{2D57}', '\u{2D58}', '\u{2D59}', '\u{2D5A}', '\u{2D5B}', '\u{2D5C}', '\u{2D5D}', '\u{2D5E}', '\u{2D5F}', '\u{2D60}', '\u{2D61}', '\u{2D62}', '\u{2D63}', '\u{2D64}', '\u{2D65}', '\u{2D80}', '\u{2D81}', '\u{2D82}', '\u{2D83}', '\u{2D84}', '\u{2D85}', '\u{2D86}', '\u{2D87}', '\u{2D88}', '\u{2D89}', '\u{2D8A}', '\u{2D8B}', '\u{2D8C}', '\u{2D8D}', '\u{2D8E}', '\u{2D8F}', '\u{2D90}', '\u{2D91}', '\u{2D92}', '\u{2D93}', '\u{2D94}', '\u{2D95}', '\u{2D96}', '\u{2DA0}', '\u{2DA1}', '\u{2DA2}', '\u{2DA3}', '\u{2DA4}', '\u{2DA5}', '\u{2DA6}', '\u{2DA8}', '\u{2DA9}', '\u{2DAA}', '\u{2DAB}', '\u{2DAC}', '\u{2DAD}', '\u{2DAE}', '\u{2DB0}', '\u{2DB1}', '\u{2DB2}', '\u{2DB3}', '\u{2DB4}', '\u{2DB5}', '\u{2DB6}', '\u{2DB8}', '\u{2DB9}', '\u{2DBA}', '\u{2DBB}', '\u{2DBC}', '\u{2DBD}', '\u{2DBE}', '\u{2DC0}', '\u{2DC1}', '\u{2DC2}', '\u{2DC3}', '\u{2DC4}', '\u{2DC5}', '\u{2DC6}', '\u{2DC8}', '\u{2DC9}', '\u{2DCA}', '\u{2DCB}', '\u{2DCC}', '\u{2DCD}', '\u{2DCE}', '\u{2DD0}', '\u{2DD1}', '\u{2DD2}', '\u{2DD3}', '\u{2DD4}', '\u{2DD5}', '\u{2DD6}', '\u{2DD8}', '\u{2DD9}', '\u{2DDA}', '\u{2DDB}', '\u{2DDC}', '\u{2DDD}', '\u{2DDE}', '\u{3006}', '\u{303C}', '\u{3041}', '\u{3042}', '\u{3043}', '\u{3044}', '\u{3045}', '\u{3046}', '\u{3047}', '\u{3048}', '\u{3049}', '\u{304A}', '\u{304B}', '\u{304C}', '\u{304D}', '\u{304E}', '\u{304F}', '\u{3050}', '\u{3051}', '\u{3052}', '\u{3053}', '\u{3054}', '\u{3055}', '\u{3056}', '\u{3057}', '\u{3058}', '\u{3059}', '\u{305A}', '\u{305B}', '\u{305C}', '\u{305D}', '\u{305E}', '\u{305F}', '\u{3060}', '\u{3061}', '\u{3062}', '\u{3063}', '\u{3064}', '\u{3065}', '\u{3066}', '\u{3067}', '\u{3068}', '\u{3069}', '\u{306A}', '\u{306B}', '\u{306C}', '\u{306D}', '\u{306E}', '\u{306F}', '\u{3070}', '\u{3071}', '\u{3072}', '\u{3073}', '\u{3074}', '\u{3075}', '\u{3076}', '\u{3077}', '\u{3078}', '\u{3079}', '\u{307A}', '\u{307B}', '\u{307C}', '\u{307D}', '\u{307E}', '\u{307F}', '\u{3080}', '\u{3081}', '\u{3082}', '\u{3083}', '\u{3084}', '\u{3085}', '\u{3086}', '\u{3087}', '\u{3088}', '\u{3089}', '\u{308A}', '\u{308B}', '\u{308C}', '\u{308D}', '\u{308E}', '\u{308F}', '\u{3090}', '\u{3091}', '\u{3092}', '\u{3093}', '\u{3094}', '\u{3095}', '\u{3096}', '\u{309F}', '\u{30A1}', '\u{30A2}', '\u{30A3}', '\u{30A4}', '\u{30A5}', '\u{30A6}', '\u{30A7}', '\u{30A8}', '\u{30A9}', '\u{30AA}', '\u{30AB}', '\u{30AC}', '\u{30AD}', '\u{30AE}', '\u{30AF}', '\u{30B0}', '\u{30B1}', '\u{30B2}', '\u{30B3}', '\u{30B4}', '\u{30B5}', '\u{30B6}', '\u{30B7}', '\u{30B8}', '\u{30B9}', '\u{30BA}', '\u{30BB}', '\u{30BC}', '\u{30BD}', '\u{30BE}', '\u{30BF}', '\u{30C0}', '\u{30C1}', '\u{30C2}', '\u{30C3}', '\u{30C4}', '\u{30C5}', '\u{30C6}', '\u{30C7}', '\u{30C8}', '\u{30C9}', '\u{30CA}', '\u{30CB}', '\u{30CC}', '\u{30CD}', '\u{30CE}', '\u{30CF}', '\u{30D0}', '\u{30D1}', '\u{30D2}', '\u{30D3}', '\u{30D4}', '\u{30D5}', '\u{30D6}', '\u{30D7}', '\u{30D8}', '\u{30D9}', '\u{30DA}', '\u{30DB}', '\u{30DC}', '\u{30DD}', '\u{30DE}', '\u{30DF}', '\u{30E0}', '\u{30E1}', '\u{30E2}', '\u{30E3}', '\u{30E4}', '\u{30E5}', '\u{30E6}', '\u{30E7}', '\u{30E8}', '\u{30E9}', '\u{30EA}', '\u{30EB}', '\u{30EC}', '\u{30ED}', '\u{30EE}', '\u{30EF}', '\u{30F0}', '\u{30F1}', '\u{30F2}', '\u{30F3}', '\u{30F4}', '\u{30F5}', '\u{30F6}', '\u{30F7}', '\u{30F8}', '\u{30F9}', '\u{30FA}', '\u{30FF}', '\u{3105}', '\u{3106}', '\u{3107}', '\u{3108}', '\u{3109}', '\u{310A}', '\u{310B}', '\u{310C}', '\u{310D}', '\u{310E}', '\u{310F}', '\u{3110}', '\u{3111}', '\u{3112}', '\u{3113}', '\u{3114}', '\u{3115}', '\u{3116}', '\u{3117}', '\u{3118}', '\u{3119}', '\u{311A}', '\u{311B}', '\u{311C}', '\u{311D}', '\u{311E}', '\u{311F}', '\u{3120}', '\u{3121}', '\u{3122}', '\u{3123}', '\u{3124}', '\u{3125}', '\u{3126}', '\u{3127}', '\u{3128}', '\u{3129}', '\u{312A}', '\u{312B}', '\u{312C}', '\u{312D}', '\u{3131}', '\u{3132}', '\u{3133}', '\u{3134}', '\u{3135}', '\u{3136}', '\u{3137}', '\u{3138}', '\u{3139}', '\u{313A}', '\u{313B}', '\u{313C}', '\u{313D}', '\u{313E}', '\u{313F}', '\u{3140}', '\u{3141}', '\u{3142}', '\u{3143}', '\u{3144}', '\u{3145}', '\u{3146}', '\u{3147}', '\u{3148}', '\u{3149}', '\u{314A}', '\u{314B}', '\u{314C}', '\u{314D}', '\u{314E}', '\u{314F}', '\u{3150}', '\u{3151}', '\u{3152}', '\u{3153}', '\u{3154}', '\u{3155}', '\u{3156}', '\u{3157}', '\u{3158}', '\u{3159}', '\u{315A}', '\u{315B}', '\u{315C}', '\u{315D}', '\u{315E}', '\u{315F}', '\u{3160}', '\u{3161}', '\u{3162}', '\u{3163}', '\u{3164}', '\u{3165}', '\u{3166}', '\u{3167}', '\u{3168}', '\u{3169}', '\u{316A}', '\u{316B}', '\u{316C}', '\u{316D}', '\u{316E}', '\u{316F}', '\u{3170}', '\u{3171}', '\u{3172}', '\u{3173}', '\u{3174}', '\u{3175}', '\u{3176}', '\u{3177}', '\u{3178}', '\u{3179}', '\u{317A}', '\u{317B}', '\u{317C}', '\u{317D}', '\u{317E}', '\u{317F}', '\u{3180}', '\u{3181}', '\u{3182}', '\u{3183}', '\u{3184}', '\u{3185}', '\u{3186}', '\u{3187}', '\u{3188}', '\u{3189}', '\u{318A}', '\u{318B}', '\u{318C}', '\u{318D}', '\u{318E}', '\u{31A0}', '\u{31A1}', '\u{31A2}', '\u{31A3}', '\u{31A4}', '\u{31A5}', '\u{31A6}', '\u{31A7}', '\u{31A8}', '\u{31A9}', '\u{31AA}', '\u{31AB}', '\u{31AC}', '\u{31AD}', '\u{31AE}', '\u{31AF}', '\u{31B0}', '\u{31B1}', '\u{31B2}', '\u{31B3}', '\u{31B4}', '\u{31B5}', '\u{31B6}', '\u{31B7}', '\u{31F0}', '\u{31F1}', '\u{31F2}', '\u{31F3}', '\u{31F4}', '\u{31F5}', '\u{31F6}', '\u{31F7}', '\u{31F8}', '\u{31F9}', '\u{31FA}', '\u{31FB}', '\u{31FC}', '\u{31FD}', '\u{31FE}', '\u{31FF}', '\u{3400}', '\u{4DB5}', '\u{4E00}', '\u{9FC3}', '\u{A000}', '\u{A001}', '\u{A002}', '\u{A003}', '\u{A004}', '\u{A005}', '\u{A006}', '\u{A007}', '\u{A008}', '\u{A009}', '\u{A00A}', '\u{A00B}', '\u{A00C}', '\u{A00D}', '\u{A00E}', '\u{A00F}', '\u{A010}', '\u{A011}', '\u{A012}', '\u{A013}', '\u{A014}', '\u{A016}', '\u{A017}', '\u{A018}', '\u{A019}', '\u{A01A}', '\u{A01B}', '\u{A01C}', '\u{A01D}', '\u{A01E}', '\u{A01F}', '\u{A020}', '\u{A021}', '\u{A022}', '\u{A023}', '\u{A024}', '\u{A025}', '\u{A026}', '\u{A027}', '\u{A028}', '\u{A029}', '\u{A02A}', '\u{A02B}', '\u{A02C}', '\u{A02D}', '\u{A02E}', '\u{A02F}', '\u{A030}', '\u{A031}', '\u{A032}', '\u{A033}', '\u{A034}', '\u{A035}', '\u{A036}', '\u{A037}', '\u{A038}', '\u{A039}', '\u{A03A}', '\u{A03B}', '\u{A03C}', '\u{A03D}', '\u{A03E}', '\u{A03F}', '\u{A040}', '\u{A041}', '\u{A042}', '\u{A043}', '\u{A044}', '\u{A045}', '\u{A046}', '\u{A047}', '\u{A048}', '\u{A049}', '\u{A04A}', '\u{A04B}', '\u{A04C}', '\u{A04D}', '\u{A04E}', '\u{A04F}', '\u{A050}', '\u{A051}', '\u{A052}', '\u{A053}', '\u{A054}', '\u{A055}', '\u{A056}', '\u{A057}', '\u{A058}', '\u{A059}', '\u{A05A}', '\u{A05B}', '\u{A05C}', '\u{A05D}', '\u{A05E}', '\u{A05F}', '\u{A060}', '\u{A061}', '\u{A062}', '\u{A063}', '\u{A064}', '\u{A065}', '\u{A066}', '\u{A067}', '\u{A068}', '\u{A069}', '\u{A06A}', '\u{A06B}', '\u{A06C}', '\u{A06D}', '\u{A06E}', '\u{A06F}', '\u{A070}', '\u{A071}', '\u{A072}', '\u{A073}', '\u{A074}', '\u{A075}', '\u{A076}', '\u{A077}', '\u{A078}', '\u{A079}', '\u{A07A}', '\u{A07B}', '\u{A07C}', '\u{A07D}', '\u{A07E}', '\u{A07F}', '\u{A080}', '\u{A081}', '\u{A082}', '\u{A083}', '\u{A084}', '\u{A085}', '\u{A086}', '\u{A087}', '\u{A088}', '\u{A089}', '\u{A08A}', '\u{A08B}', '\u{A08C}', '\u{A08D}', '\u{A08E}', '\u{A08F}', '\u{A090}', '\u{A091}', '\u{A092}', '\u{A093}', '\u{A094}', '\u{A095}', '\u{A096}', '\u{A097}', '\u{A098}', '\u{A099}', '\u{A09A}', '\u{A09B}', '\u{A09C}', '\u{A09D}', '\u{A09E}', '\u{A09F}', '\u{A0A0}', '\u{A0A1}', '\u{A0A2}', '\u{A0A3}', '\u{A0A4}', '\u{A0A5}', '\u{A0A6}', '\u{A0A7}', '\u{A0A8}', '\u{A0A9}', '\u{A0AA}', '\u{A0AB}', '\u{A0AC}', '\u{A0AD}', '\u{A0AE}', '\u{A0AF}', '\u{A0B0}', '\u{A0B1}', '\u{A0B2}', '\u{A0B3}', '\u{A0B4}', '\u{A0B5}', '\u{A0B6}', '\u{A0B7}', '\u{A0B8}', '\u{A0B9}', '\u{A0BA}', '\u{A0BB}', '\u{A0BC}', '\u{A0BD}', '\u{A0BE}', '\u{A0BF}', '\u{A0C0}', '\u{A0C1}', '\u{A0C2}', '\u{A0C3}', '\u{A0C4}', '\u{A0C5}', '\u{A0C6}', '\u{A0C7}', '\u{A0C8}', '\u{A0C9}', '\u{A0CA}', '\u{A0CB}', '\u{A0CC}', '\u{A0CD}', '\u{A0CE}', '\u{A0CF}', '\u{A0D0}', '\u{A0D1}', '\u{A0D2}', '\u{A0D3}', '\u{A0D4}', '\u{A0D5}', '\u{A0D6}', '\u{A0D7}', '\u{A0D8}', '\u{A0D9}', '\u{A0DA}', '\u{A0DB}', '\u{A0DC}', '\u{A0DD}', '\u{A0DE}', '\u{A0DF}', '\u{A0E0}', '\u{A0E1}', '\u{A0E2}', '\u{A0E3}', '\u{A0E4}', '\u{A0E5}', '\u{A0E6}', '\u{A0E7}', '\u{A0E8}', '\u{A0E9}', '\u{A0EA}', '\u{A0EB}', '\u{A0EC}', '\u{A0ED}', '\u{A0EE}', '\u{A0EF}', '\u{A0F0}', '\u{A0F1}', '\u{A0F2}', '\u{A0F3}', '\u{A0F4}', '\u{A0F5}', '\u{A0F6}', '\u{A0F7}', '\u{A0F8}', '\u{A0F9}', '\u{A0FA}', '\u{A0FB}', '\u{A0FC}', '\u{A0FD}', '\u{A0FE}', '\u{A0FF}', '\u{A100}', '\u{A101}', '\u{A102}', '\u{A103}', '\u{A104}', '\u{A105}', '\u{A106}', '\u{A107}', '\u{A108}', '\u{A109}', '\u{A10A}', '\u{A10B}', '\u{A10C}', '\u{A10D}', '\u{A10E}', '\u{A10F}', '\u{A110}', '\u{A111}', '\u{A112}', '\u{A113}', '\u{A114}', '\u{A115}', '\u{A116}', '\u{A117}', '\u{A118}', '\u{A119}', '\u{A11A}', '\u{A11B}', '\u{A11C}', '\u{A11D}', '\u{A11E}', '\u{A11F}', '\u{A120}', '\u{A121}', '\u{A122}', '\u{A123}', '\u{A124}', '\u{A125}', '\u{A126}', '\u{A127}', '\u{A128}', '\u{A129}', '\u{A12A}', '\u{A12B}', '\u{A12C}', '\u{A12D}', '\u{A12E}', '\u{A12F}', '\u{A130}', '\u{A131}', '\u{A132}', '\u{A133}', '\u{A134}', '\u{A135}', '\u{A136}', '\u{A137}', '\u{A138}', '\u{A139}', '\u{A13A}', '\u{A13B}', '\u{A13C}', '\u{A13D}', '\u{A13E}', '\u{A13F}', '\u{A140}', '\u{A141}', '\u{A142}', '\u{A143}', '\u{A144}', '\u{A145}', '\u{A146}', '\u{A147}', '\u{A148}', '\u{A149}', '\u{A14A}', '\u{A14B}', '\u{A14C}', '\u{A14D}', '\u{A14E}', '\u{A14F}', '\u{A150}', '\u{A151}', '\u{A152}', '\u{A153}', '\u{A154}', '\u{A155}', '\u{A156}', '\u{A157}', '\u{A158}', '\u{A159}', '\u{A15A}', '\u{A15B}', '\u{A15C}', '\u{A15D}', '\u{A15E}', '\u{A15F}', '\u{A160}', '\u{A161}', '\u{A162}', '\u{A163}', '\u{A164}', '\u{A165}', '\u{A166}', '\u{A167}', '\u{A168}', '\u{A169}', '\u{A16A}', '\u{A16B}', '\u{A16C}', '\u{A16D}', '\u{A16E}', '\u{A16F}', '\u{A170}', '\u{A171}', '\u{A172}', '\u{A173}', '\u{A174}', '\u{A175}', '\u{A176}', '\u{A177}', '\u{A178}', '\u{A179}', '\u{A17A}', '\u{A17B}', '\u{A17C}', '\u{A17D}', '\u{A17E}', '\u{A17F}', '\u{A180}', '\u{A181}', '\u{A182}', '\u{A183}', '\u{A184}', '\u{A185}', '\u{A186}', '\u{A187}', '\u{A188}', '\u{A189}', '\u{A18A}', '\u{A18B}', '\u{A18C}', '\u{A18D}', '\u{A18E}', '\u{A18F}', '\u{A190}', '\u{A191}', '\u{A192}', '\u{A193}', '\u{A194}', '\u{A195}', '\u{A196}', '\u{A197}', '\u{A198}', '\u{A199}', '\u{A19A}', '\u{A19B}', '\u{A19C}', '\u{A19D}', '\u{A19E}', '\u{A19F}', '\u{A1A0}', '\u{A1A1}', '\u{A1A2}', '\u{A1A3}', '\u{A1A4}', '\u{A1A5}', '\u{A1A6}', '\u{A1A7}', '\u{A1A8}', '\u{A1A9}', '\u{A1AA}', '\u{A1AB}', '\u{A1AC}', '\u{A1AD}', '\u{A1AE}', '\u{A1AF}') - } - - fn is_unicode_combining_spacing_mark(self) -> bool { - match_char_class!(self, - '\u{0903}', '\u{093E}', '\u{093F}', '\u{0940}', '\u{0949}', '\u{094A}', '\u{094B}', '\u{094C}', '\u{0982}', '\u{0983}', '\u{09BE}', '\u{09BF}', '\u{09C0}', '\u{09C7}', '\u{09C8}', '\u{09CB}', '\u{09CC}', '\u{09D7}', '\u{0A03}', '\u{0A3E}', '\u{0A3F}', '\u{0A40}', '\u{0A83}', '\u{0ABE}', '\u{0ABF}', '\u{0AC0}', '\u{0AC9}', '\u{0ACB}', '\u{0ACC}', '\u{0B02}', '\u{0B03}', '\u{0B3E}', '\u{0B40}', '\u{0B47}', '\u{0B48}', '\u{0B4B}', '\u{0B4C}', '\u{0B57}', '\u{0BBE}', '\u{0BBF}', '\u{0BC1}', '\u{0BC2}', '\u{0BC6}', '\u{0BC7}', '\u{0BC8}', '\u{0BCA}', '\u{0BCB}', '\u{0BCC}', '\u{0BD7}', '\u{0C01}', '\u{0C02}', '\u{0C03}', '\u{0C41}', '\u{0C42}', '\u{0C43}', '\u{0C44}', '\u{0C82}', '\u{0C83}', '\u{0CBE}', '\u{0CC0}', '\u{0CC1}', '\u{0CC2}', '\u{0CC3}', '\u{0CC4}', '\u{0CC7}', '\u{0CC8}', '\u{0CCA}', '\u{0CCB}', '\u{0CD5}', '\u{0CD6}', '\u{0D02}', '\u{0D03}', '\u{0D3E}', '\u{0D3F}', '\u{0D40}', '\u{0D46}', '\u{0D47}', '\u{0D48}', '\u{0D4A}', '\u{0D4B}', '\u{0D4C}', '\u{0D57}', '\u{0D82}', '\u{0D83}', '\u{0DCF}', '\u{0DD0}', '\u{0DD1}', '\u{0DD8}', '\u{0DD9}', '\u{0DDA}', '\u{0DDB}', '\u{0DDC}', '\u{0DDD}', '\u{0DDE}', '\u{0DDF}', '\u{0DF2}', '\u{0DF3}', '\u{0F3E}', '\u{0F3F}', '\u{0F7F}', '\u{102B}', '\u{102C}', '\u{1031}', '\u{1038}', '\u{103B}', '\u{103C}', '\u{1056}', '\u{1057}', '\u{1062}', '\u{1063}', '\u{1064}', '\u{1067}', '\u{1068}', '\u{1069}', '\u{106A}', '\u{106B}', '\u{106C}', '\u{106D}', '\u{1083}', '\u{1084}', '\u{1087}', '\u{1088}', '\u{1089}', '\u{108A}', '\u{108B}', '\u{108C}', '\u{108F}', '\u{17B6}', '\u{17BE}', '\u{17BF}', '\u{17C0}', '\u{17C1}', '\u{17C2}', '\u{17C3}', '\u{17C4}', '\u{17C5}', '\u{17C7}', '\u{17C8}', '\u{1923}', '\u{1924}', '\u{1925}', '\u{1926}', '\u{1929}', '\u{192A}', '\u{192B}', '\u{1930}', '\u{1931}', '\u{1933}', '\u{1934}', '\u{1935}', '\u{1936}', '\u{1937}', '\u{1938}', '\u{19B0}', '\u{19B1}', '\u{19B2}', '\u{19B3}', '\u{19B4}', '\u{19B5}', '\u{19B6}', '\u{19B7}', '\u{19B8}', '\u{19B9}', '\u{19BA}', '\u{19BB}', '\u{19BC}', '\u{19BD}', '\u{19BE}', '\u{19BF}', '\u{19C0}', '\u{19C8}', '\u{19C9}', '\u{1A19}', '\u{1A1A}', '\u{1A1B}', '\u{1B04}', '\u{1B35}', '\u{1B3B}', '\u{1B3D}', '\u{1B3E}', '\u{1B3F}', '\u{1B40}', '\u{1B41}', '\u{1B43}', '\u{1B44}', '\u{1B82}', '\u{1BA1}', '\u{1BA6}', '\u{1BA7}', '\u{1BAA}', '\u{1C24}', '\u{1C25}', '\u{1C26}', '\u{1C27}', '\u{1C28}', '\u{1C29}', '\u{1C2A}', '\u{1C2B}', '\u{1C34}', '\u{1C35}', '\u{A823}', '\u{A824}', '\u{A827}', '\u{A880}', '\u{A881}', '\u{A8B4}', '\u{A8B5}', '\u{A8B6}', '\u{A8B7}', '\u{A8B8}', '\u{A8B9}', '\u{A8BA}', '\u{A8BB}', '\u{A8BC}', '\u{A8BD}', '\u{A8BE}', '\u{A8BF}', '\u{A8C0}', '\u{A8C1}', '\u{A8C2}', '\u{A8C3}', '\u{A952}', '\u{A953}', '\u{AA2F}', '\u{AA30}', '\u{AA33}', '\u{AA34}', '\u{AA4D}') - } - - fn is_unicode_decimal_number(self) -> bool { - match_char_class!(self, - '\u{0030}', '\u{0031}', '\u{0032}', '\u{0033}', '\u{0034}', '\u{0035}', '\u{0036}', '\u{0037}', '\u{0038}', '\u{0039}', '\u{0660}', '\u{0661}', '\u{0662}', '\u{0663}', '\u{0664}', '\u{0665}', '\u{0666}', '\u{0667}', '\u{0668}', '\u{0669}', '\u{06F0}', '\u{06F1}', '\u{06F2}', '\u{06F3}', '\u{06F4}', '\u{06F5}', '\u{06F6}', '\u{06F7}', '\u{06F8}', '\u{06F9}', '\u{07C0}', '\u{07C1}', '\u{07C2}', '\u{07C3}', '\u{07C4}', '\u{07C5}', '\u{07C6}', '\u{07C7}', '\u{07C8}', '\u{07C9}', '\u{0966}', '\u{0967}', '\u{0968}', '\u{0969}', '\u{096A}', '\u{096B}', '\u{096C}', '\u{096D}', '\u{096E}', '\u{096F}', '\u{09E6}', '\u{09E7}', '\u{09E8}', '\u{09E9}', '\u{09EA}', '\u{09EB}', '\u{09EC}', '\u{09ED}', '\u{09EE}', '\u{09EF}', '\u{0A66}', '\u{0A67}', '\u{0A68}', '\u{0A69}', '\u{0A6A}', '\u{0A6B}', '\u{0A6C}', '\u{0A6D}', '\u{0A6E}', '\u{0A6F}', '\u{0AE6}', '\u{0AE7}', '\u{0AE8}', '\u{0AE9}', '\u{0AEA}', '\u{0AEB}', '\u{0AEC}', '\u{0AED}', '\u{0AEE}', '\u{0AEF}', '\u{0B66}', '\u{0B67}', '\u{0B68}', '\u{0B69}', '\u{0B6A}', '\u{0B6B}', '\u{0B6C}', '\u{0B6D}', '\u{0B6E}', '\u{0B6F}', '\u{0BE6}', '\u{0BE7}', '\u{0BE8}', '\u{0BE9}', '\u{0BEA}', '\u{0BEB}', '\u{0BEC}', '\u{0BED}', '\u{0BEE}', '\u{0BEF}', '\u{0C66}', '\u{0C67}', '\u{0C68}', '\u{0C69}', '\u{0C6A}', '\u{0C6B}', '\u{0C6C}', '\u{0C6D}', '\u{0C6E}', '\u{0C6F}', '\u{0CE6}', '\u{0CE7}', '\u{0CE8}', '\u{0CE9}', '\u{0CEA}', '\u{0CEB}', '\u{0CEC}', '\u{0CED}', '\u{0CEE}', '\u{0CEF}', '\u{0D66}', '\u{0D67}', '\u{0D68}', '\u{0D69}', '\u{0D6A}', '\u{0D6B}', '\u{0D6C}', '\u{0D6D}', '\u{0D6E}', '\u{0D6F}', '\u{0E50}', '\u{0E51}', '\u{0E52}', '\u{0E53}', '\u{0E54}', '\u{0E55}', '\u{0E56}', '\u{0E57}', '\u{0E58}', '\u{0E59}', '\u{0ED0}', '\u{0ED1}', '\u{0ED2}', '\u{0ED3}', '\u{0ED4}', '\u{0ED5}', '\u{0ED6}', '\u{0ED7}', '\u{0ED8}', '\u{0ED9}', '\u{0F20}', '\u{0F21}', '\u{0F22}', '\u{0F23}', '\u{0F24}', '\u{0F25}', '\u{0F26}', '\u{0F27}', '\u{0F28}', '\u{0F29}', '\u{1040}', '\u{1041}', '\u{1042}', '\u{1043}', '\u{1044}', '\u{1045}', '\u{1046}', '\u{1047}', '\u{1048}', '\u{1049}', '\u{1090}', '\u{1091}', '\u{1092}', '\u{1093}', '\u{1094}', '\u{1095}', '\u{1096}', '\u{1097}', '\u{1098}', '\u{1099}', '\u{17E0}', '\u{17E1}', '\u{17E2}', '\u{17E3}', '\u{17E4}', '\u{17E5}', '\u{17E6}', '\u{17E7}', '\u{17E8}', '\u{17E9}', '\u{1810}', '\u{1811}', '\u{1812}', '\u{1813}', '\u{1814}', '\u{1815}', '\u{1816}', '\u{1817}', '\u{1818}', '\u{1819}', '\u{1946}', '\u{1947}', '\u{1948}', '\u{1949}', '\u{194A}', '\u{194B}', '\u{194C}', '\u{194D}', '\u{194E}', '\u{194F}', '\u{19D0}', '\u{19D1}', '\u{19D2}', '\u{19D3}', '\u{19D4}', '\u{19D5}', '\u{19D6}', '\u{19D7}', '\u{19D8}', '\u{19D9}', '\u{1B50}', '\u{1B51}', '\u{1B52}', '\u{1B53}', '\u{1B54}', '\u{1B55}', '\u{1B56}', '\u{1B57}', '\u{1B58}', '\u{1B59}', '\u{1BB0}', '\u{1BB1}', '\u{1BB2}', '\u{1BB3}', '\u{1BB4}', '\u{1BB5}', '\u{1BB6}', '\u{1BB7}', '\u{1BB8}', '\u{1BB9}', '\u{1C40}', '\u{1C41}', '\u{1C42}', '\u{1C43}', '\u{1C44}', '\u{1C45}', '\u{1C46}', '\u{1C47}', '\u{1C48}', '\u{1C49}', '\u{1C50}', '\u{1C51}', '\u{1C52}', '\u{1C53}', '\u{1C54}', '\u{1C55}', '\u{1C56}', '\u{1C57}', '\u{1C58}', '\u{1C59}', '\u{A620}', '\u{A621}', '\u{A622}', '\u{A623}', '\u{A624}', '\u{A625}', '\u{A626}', '\u{A627}', '\u{A628}', '\u{A629}', '\u{A8D0}', '\u{A8D1}', '\u{A8D2}', '\u{A8D3}', '\u{A8D4}', '\u{A8D5}', '\u{A8D6}', '\u{A8D7}', '\u{A8D8}', '\u{A8D9}', '\u{A900}', '\u{A901}', '\u{A902}', '\u{A903}', '\u{A904}', '\u{A905}', '\u{A906}', '\u{A907}', '\u{A908}', '\u{A909}', '\u{AA50}', '\u{AA51}', '\u{AA52}', '\u{AA53}', '\u{AA54}', '\u{AA55}', '\u{AA56}', '\u{AA57}', '\u{AA58}', '\u{AA59}', '\u{FF10}', '\u{FF11}', '\u{FF12}', '\u{FF13}', '\u{FF14}', '\u{FF15}', '\u{FF16}', '\u{FF17}', '\u{FF18}', '\u{FF19}') - } - - fn is_unicode_connector_punctiation(self) -> bool { - match_char_class!(self, - '\u{005F}', '\u{203F}', '\u{2040}', '\u{2054}', '\u{FE33}', '\u{FE34}', '\u{FE4D}', '\u{FE4E}', '\u{FE4F}', '\u{FF3F}') - } - - fn is_unicode_space_separator(self) -> bool { - match_char_class!(self, - '\u{0020}', '\u{00A0}', '\u{1680}', '\u{2000}', '\u{2001}', '\u{2002}', '\u{2003}', '\u{2004}', '\u{2005}', '\u{2006}', '\u{2007}', '\u{2008}', '\u{2009}', '\u{200A}', '\u{202F}', '\u{205F}', '\u{3000}') - } - - fn is_es_identifier_start(self) -> bool { - match self { - '$' | '_' | '\\' => true, - c if c.is_unicode_letter() => true, - _ => false - } - } - - // see section 7.6 - fn is_es_identifier_part(self) -> bool { - match self { - '\u{200C}' | '\u{200D}' => true, - c if c.is_es_identifier_start() => true, - c if c.is_unicode_combining_spacing_mark() => true, - c if c.is_unicode_nonspacing_mark() => true, - c if c.is_unicode_decimal_number() => true, - c if c.is_unicode_connector_punctiation() => true, - _ => false - } - } - - fn is_es_whitespace(self) -> bool { - match self { - '\t' | '\u{000B}' | '\u{000C}' | '\u{0020}' | '\u{00A0}' | '\u{FEFF}' => true, - c => c.is_unicode_space_separator() - } - } - - fn is_es_line_terminator(self) -> bool { - match self { - '\n' | '\r' | '\u{2028}' | '\u{2029}' => true, - _ => false - } - } -} - -fn main() { - -} diff --git a/src/test/ui/run-pass/issues/issue-29276.rs b/src/test/ui/run-pass/issues/issue-29276.rs deleted file mode 100644 index 6797dbc31c1..00000000000 --- a/src/test/ui/run-pass/issues/issue-29276.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S([u8; { struct Z; 0 }]); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-2935.rs b/src/test/ui/run-pass/issues/issue-2935.rs deleted file mode 100644 index d2af8325181..00000000000 --- a/src/test/ui/run-pass/issues/issue-2935.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -//type t = { a: isize }; -// type t = { a: bool }; -type t = bool; - -trait it { - fn f(&self); -} - -impl it for t { - fn f(&self) { } -} - -pub fn main() { - // let x = ({a: 4} as it); - // let y = box ({a: 4}); - // let z = box ({a: 4} as it); - // let z = box ({a: true} as it); - let z: Box<_> = box (box true as Box); - // x.f(); - // y.f(); - // (*z).f(); - println!("ok so far..."); - z.f(); //segfault -} diff --git a/src/test/ui/run-pass/issues/issue-2936.rs b/src/test/ui/run-pass/issues/issue-2936.rs deleted file mode 100644 index 84201348af3..00000000000 --- a/src/test/ui/run-pass/issues/issue-2936.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -trait bar { - fn get_bar(&self) -> T; -} - -fn foo>(b: U) -> T { - b.get_bar() -} - -struct cbar { - x: isize, -} - -impl bar for cbar { - fn get_bar(&self) -> isize { - self.x - } -} - -fn cbar(x: isize) -> cbar { - cbar { - x: x - } -} - -pub fn main() { - let x: isize = foo::(cbar(5)); - assert_eq!(x, 5); -} diff --git a/src/test/ui/run-pass/issues/issue-29466.rs b/src/test/ui/run-pass/issues/issue-29466.rs deleted file mode 100644 index 1c8fc88f8f2..00000000000 --- a/src/test/ui/run-pass/issues/issue-29466.rs +++ /dev/null @@ -1,3608 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! m( - ($e1:expr => $e2:expr) => ({ $e1 }) -); - -fn main() { - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - let x = m!(1 => 2); - - println!("{}", x); -} diff --git a/src/test/ui/run-pass/issues/issue-29485.rs b/src/test/ui/run-pass/issues/issue-29485.rs deleted file mode 100644 index 67725b02ded..00000000000 --- a/src/test/ui/run-pass/issues/issue-29485.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-29485.rs -// ignore-emscripten no threads - -#[feature(recover)] - -extern crate a; - -fn main() { - let _ = std::thread::spawn(move || { - a::f(&mut a::X(0), g); - }).join(); -} - -fn g() { - panic!(); -} diff --git a/src/test/ui/run-pass/issues/issue-29488.rs b/src/test/ui/run-pass/issues/issue-29488.rs deleted file mode 100644 index d9d53ceaaeb..00000000000 --- a/src/test/ui/run-pass/issues/issue-29488.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -struct Foo; - -impl Drop for Foo { - fn drop(&mut self) { - println!("test2"); - } -} - -thread_local!(static FOO: Foo = Foo); - -fn main() { - // Off the main thread due to #28129, be sure to initialize FOO first before - // calling `println!` - thread::spawn(|| { - FOO.with(|_| {}); - println!("test1"); - }).join().unwrap(); -} diff --git a/src/test/ui/run-pass/issues/issue-29516.rs b/src/test/ui/run-pass/issues/issue-29516.rs deleted file mode 100644 index 55caa65f1cf..00000000000 --- a/src/test/ui/run-pass/issues/issue-29516.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(optin_builtin_traits)] - -auto trait NotSame {} - -impl !NotSame for (A, A) {} - -trait OneOfEach {} - -impl OneOfEach for (A,) {} - -impl OneOfEach for (A, B) -where - (B,): OneOfEach, - (A, B): NotSame, -{ -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29522.rs b/src/test/ui/run-pass/issues/issue-29522.rs deleted file mode 100644 index 9d5a12dadbe..00000000000 --- a/src/test/ui/run-pass/issues/issue-29522.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that we don't accidentally capture upvars just because their name -// occurs in a path - -fn assert_static(_t: T) {} - -mod foo { - pub fn scope() {} -} - -fn main() { - let scope = &mut 0; - assert_static(|| { - foo::scope(); - }); -} diff --git a/src/test/ui/run-pass/issues/issue-29540.rs b/src/test/ui/run-pass/issues/issue-29540.rs deleted file mode 100644 index 7e01efcd05f..00000000000 --- a/src/test/ui/run-pass/issues/issue-29540.rs +++ /dev/null @@ -1,502 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -pub struct Config { - pub name: String, - pub cluster: String, - pub debug_none: String, - pub debug_lockdep: String, - pub debug_context: String, - pub debug_crush: String, - pub debug_mds: String, - pub debug_mds_balancer: String, - pub debug_mds_locker: String, - pub debug_mds_log: String, - pub debug_mds_log_expire: String, - pub debug_mds_migrator: String, - pub debug_buffer: String, - pub debug_timer: String, - pub debug_filer: String, - pub debug_striper: String, - pub debug_objecter: String, - pub debug_rados: String, - pub debug_rbd: String, - pub debug_journaler: String, - pub debug_objectcacher: String, - pub debug_client: String, - pub debug_osd: String, - pub debug_optracker: String, - pub debug_objclass: String, - pub debug_filestore: String, - pub debug_keyvaluestore: String, - pub debug_journal: String, - pub debug_ms: String, - pub debug_mon: String, - pub debug_monc: String, - pub debug_paxos: String, - pub debug_tp: String, - pub debug_auth: String, - pub debug_crypto: String, - pub debug_finisher: String, - pub debug_heartbeatmap: String, - pub debug_perfcounter: String, - pub debug_rgw: String, - pub debug_civetweb: String, - pub debug_javaclient: String, - pub debug_asok: String, - pub debug_throttle: String, - pub host: String, - pub fsid: String, - pub public_addr: String, - pub cluster_addr: String, - pub public_network: String, - pub cluster_network: String, - pub num_client: String, - pub monmap: String, - pub mon_host: String, - pub lockdep: String, - pub run_dir: String, - pub admin_socket: String, - pub daemonize: String, - pub pid_file: String, - pub chdir: String, - pub max_open_files: String, - pub restapi_log_level: String, - pub restapi_base_url: String, - pub fatal_signal_handlers: String, - pub log_file: String, - pub log_max_new: String, - pub log_max_recent: String, - pub log_to_stderr: String, - pub err_to_stderr: String, - pub log_to_syslog: String, - pub err_to_syslog: String, - pub log_flush_on_exit: String, - pub log_stop_at_utilization: String, - pub clog_to_monitors: String, - pub clog_to_syslog: String, - pub clog_to_syslog_level: String, - pub clog_to_syslog_facility: String, - pub mon_cluster_log_to_syslog: String, - pub mon_cluster_log_to_syslog_level: String, - pub mon_cluster_log_to_syslog_facility: String, - pub mon_cluster_log_file: String, - pub mon_cluster_log_file_level: String, - pub key: String, - pub keyfile: String, - pub keyring: String, - pub heartbeat_interval: String, - pub heartbeat_file: String, - pub heartbeat_inject_failure: String, - pub perf: String, - pub ms_tcp_nodelay: String, - pub ms_tcp_rcvbuf: String, - pub ms_initial_backoff: String, - pub ms_max_backoff: String, - pub ms_nocrc: String, - pub ms_die_on_bad_msg: String, - pub ms_die_on_unhandled_msg: String, - pub ms_die_on_old_message: String, - pub ms_dispatch_throttle_bytes: String, - pub ms_bind_ipv6: String, - pub ms_bind_port_min: String, - pub ms_bind_port_max: String, - pub ms_rwthread_stack_bytes: String, - pub ms_tcp_read_timeout: String, - pub ms_pq_max_tokens_per_priority: String, - pub ms_pq_min_cost: String, - pub ms_inject_socket_failures: String, - pub ms_inject_delay_type: String, - pub ms_inject_delay_msg_type: String, - pub ms_inject_delay_max: String, - pub ms_inject_delay_probability: String, - pub ms_inject_internal_delays: String, - pub ms_dump_on_send: String, - pub inject_early_sigterm: String, - pub mon_data: String, - pub mon_initial_members: String, - pub mon_sync_fs_threshold: String, - pub mon_compact_on_start: String, - pub mon_compact_on_bootstrap: String, - pub mon_compact_on_trim: String, - pub mon_tick_interval: String, - pub mon_subscribe_interval: String, - pub mon_delta_reset_interval: String, - pub mon_osd_laggy_halflife: String, - pub mon_osd_laggy_weight: String, - pub mon_osd_adjust_heartbeat_grace: String, - pub mon_osd_adjust_down_out_interval: String, - pub mon_osd_auto_mark_in: String, - pub mon_osd_auto_mark_auto_out_in: String, - pub mon_osd_auto_mark_new_in: String, - pub mon_osd_down_out_interval: String, - pub mon_osd_down_out_subtree_limit: String, - pub mon_osd_min_up_ratio: String, - pub mon_osd_min_in_ratio: String, - pub mon_osd_max_op_age: String, - pub mon_osd_max_split_count: String, - pub mon_osd_allow_primary_temp: String, - pub mon_osd_allow_primary_affinity: String, - pub mon_stat_smooth_intervals: String, - pub mon_lease: String, - pub mon_lease_renew_interval: String, - pub mon_lease_ack_timeout: String, - pub mon_clock_drift_allowed: String, - pub mon_clock_drift_warn_backoff: String, - pub mon_timecheck_interval: String, - pub mon_accept_timeout: String, - pub mon_pg_create_interval: String, - pub mon_pg_stuck_threshold: String, - pub mon_pg_warn_min_per_osd: String, - pub mon_pg_warn_max_object_skew: String, - pub mon_pg_warn_min_objects: String, - pub mon_pg_warn_min_pool_objects: String, - pub mon_cache_target_full_warn_ratio: String, - pub mon_osd_full_ratio: String, - pub mon_osd_nearfull_ratio: String, - pub mon_globalid_prealloc: String, - pub mon_osd_report_timeout: String, - pub mon_force_standby_active: String, - pub mon_warn_on_old_mons: String, - pub mon_warn_on_legacy_crush_tunables: String, - pub mon_warn_on_osd_down_out_interval_zero: String, - pub mon_warn_on_cache_pools_without_hit_sets: String, - pub mon_min_osdmap_epochs: String, - pub mon_max_pgmap_epochs: String, - pub mon_max_log_epochs: String, - pub mon_max_mdsmap_epochs: String, - pub mon_max_osd: String, - pub mon_probe_timeout: String, - pub mon_slurp_timeout: String, - pub mon_slurp_bytes: String, - pub mon_client_bytes: String, - pub mon_daemon_bytes: String, - pub mon_max_log_entries_per_event: String, - pub mon_health_data_update_interval: String, - pub mon_data_avail_crit: String, - pub mon_data_avail_warn: String, - pub mon_config_key_max_entry_size: String, - pub mon_sync_timeout: String, - pub mon_sync_max_payload_size: String, - pub mon_sync_debug: String, - pub mon_sync_debug_leader: String, - pub mon_sync_debug_provider: String, - pub mon_sync_debug_provider_fallback: String, - pub mon_inject_sync_get_chunk_delay: String, - pub mon_osd_min_down_reporters: String, - pub mon_osd_min_down_reports: String, - pub mon_osd_force_trim_to: String, - pub mon_mds_force_trim_to: String, - pub mon_advanced_debug_mode: String, - pub mon_debug_dump_transactions: String, - pub mon_debug_dump_location: String, - pub mon_sync_provider_kill_at: String, - pub mon_sync_requester_kill_at: String, - pub mon_leveldb_write_buffer_size: String, - pub mon_leveldb_cache_size: String, - pub mon_leveldb_block_size: String, - pub mon_leveldb_bloom_size: String, - pub mon_leveldb_max_open_files: String, - pub mon_leveldb_compression: String, - pub mon_leveldb_paranoid: String, - pub mon_leveldb_log: String, - pub mon_leveldb_size_warn: String, - pub mon_force_quorum_join: String, - pub paxos_stash_full_interval: String, - pub paxos_max_join_drift: String, - pub paxos_propose_interval: String, - pub paxos_min_wait: String, - pub paxos_min: String, - pub paxos_trim_min: String, - pub paxos_trim_max: String, - pub paxos_service_trim_min: String, - pub paxos_service_trim_max: String, - pub paxos_kill_at: String, - pub clock_offset: String, - pub auth_cluster_required: String, - pub auth_service_required: String, - pub auth_client_required: String, - pub auth_supported: String, - pub cephx_require_signatures: String, - pub cephx_cluster_require_signatures: String, - pub cephx_service_require_signatures: String, - pub cephx_sign_messages: String, - pub auth_mon_ticket_ttl: String, - pub auth_service_ticket_ttl: String, - pub auth_debug: String, - pub mon_client_hunt_interval: String, - pub mon_client_ping_interval: String, - pub mon_client_ping_timeout: String, - pub mon_client_hunt_interval_backoff: String, - pub mon_client_hunt_interval_max_multiple: String, - pub mon_client_max_log_entries_per_message: String, - pub mon_max_pool_pg_num: String, - pub mon_pool_quota_warn_threshold: String, - pub mon_pool_quota_crit_threshold: String, - pub client_cache_size: String, - pub client_cache_mid: String, - pub client_use_random_mds: String, - pub client_mount_timeout: String, - pub client_tick_interval: String, - pub client_trace: String, - pub client_readahead_min: String, - pub client_readahead_max_bytes: String, - pub client_readahead_max_periods: String, - pub client_snapdir: String, - pub client_mountpoint: String, - pub client_notify_timeout: String, - pub osd_client_watch_timeout: String, - pub client_caps_release_delay: String, - pub client_oc: String, - pub client_oc_size: String, - pub client_oc_max_dirty: String, - pub client_oc_target_dirty: String, - pub client_oc_max_dirty_age: String, - pub client_oc_max_objects: String, - pub client_debug_force_sync_read: String, - pub client_debug_inject_tick_delay: String, - pub client_max_inline_size: String, - pub fuse_use_invalidate_cb: String, - pub fuse_allow_other: String, - pub fuse_default_permissions: String, - pub fuse_big_writes: String, - pub fuse_atomic_o_trunc: String, - pub fuse_debug: String, - pub fuse_multithreaded: String, - pub crush_location: String, - pub objecter_tick_interval: String, - pub objecter_timeout: String, - pub objecter_inflight_op_bytes: String, - pub objecter_inflight_ops: String, - pub journaler_allow_split_entries: String, - pub journaler_write_head_interval: String, - pub journaler_prefetch_periods: String, - pub journaler_prezero_periods: String, - pub journaler_batch_interval: String, - pub journaler_batch_max: String, - pub mds_data: String, - pub mds_max_file_size: String, - pub mds_cache_size: String, - pub mds_cache_mid: String, - pub mds_mem_max: String, - pub mds_dir_max_commit_size: String, - pub mds_decay_halflife: String, - pub mds_beacon_interval: String, - pub mds_beacon_grace: String, - pub mds_enforce_unique_name: String, - pub mds_blacklist_interval: String, - pub mds_session_timeout: String, - pub mds_freeze_tree_timeout: String, - pub mds_session_autoclose: String, - pub mds_reconnect_timeout: String, - pub mds_tick_interval: String, - pub mds_dirstat_min_interval: String, - pub mds_scatter_nudge_interval: String, - pub mds_client_prealloc_inos: String, - pub mds_early_reply: String, - pub mds_default_dir_hash: String, - pub mds_log: String, - pub mds_log_skip_corrupt_events: String, - pub mds_log_max_events: String, - pub mds_log_segment_size: String, - pub mds_log_max_segments: String, - pub mds_log_max_expiring: String, - pub mds_bal_sample_interval: String, - pub mds_bal_replicate_threshold: String, - pub mds_bal_unreplicate_threshold: String, - pub mds_bal_frag: String, - pub mds_bal_split_size: String, - pub mds_bal_split_rd: String, - pub mds_bal_split_wr: String, - pub mds_bal_split_bits: String, - pub mds_bal_merge_size: String, - pub mds_bal_merge_rd: String, - pub mds_bal_merge_wr: String, - pub mds_bal_interval: String, - pub mds_bal_fragment_interval: String, - pub mds_bal_idle_threshold: String, - pub mds_bal_max: String, - pub mds_bal_max_until: String, - pub mds_bal_mode: String, - pub mds_bal_min_rebalance: String, - pub mds_bal_min_start: String, - pub mds_bal_need_min: String, - pub mds_bal_need_max: String, - pub mds_bal_midchunk: String, - pub mds_bal_minchunk: String, - pub mds_bal_target_removal_min: String, - pub mds_bal_target_removal_max: String, - pub mds_replay_interval: String, - pub mds_shutdown_check: String, - pub mds_thrash_exports: String, - pub mds_thrash_fragments: String, - pub mds_dump_cache_on_map: String, - pub mds_dump_cache_after_rejoin: String, - pub mds_verify_scatter: String, - pub mds_debug_scatterstat: String, - pub mds_debug_frag: String, - pub mds_debug_auth_pins: String, - pub mds_debug_subtrees: String, - pub mds_kill_mdstable_at: String, - pub mds_kill_export_at: String, - pub mds_kill_import_at: String, - pub mds_kill_link_at: String, - pub mds_kill_rename_at: String, - pub mds_kill_openc_at: String, - pub mds_kill_journal_at: String, - pub mds_kill_journal_expire_at: String, - pub mds_kill_journal_replay_at: String, - pub mds_kill_create_at: String, - pub mds_open_remote_link_mode: String, - pub mds_inject_traceless_reply_probability: String, - pub mds_wipe_sessions: String, - pub mds_wipe_ino_prealloc: String, - pub mds_skip_ino: String, - pub max_mds: String, - pub mds_standby_for_name: String, - pub mds_standby_for_rank: String, - pub mds_standby_replay: String, - pub osd_compact_leveldb_on_mount: String, - pub osd_max_backfills: String, - pub osd_backfill_full_ratio: String, - pub osd_backfill_retry_interval: String, - pub osd_agent_max_ops: String, - pub osd_agent_min_evict_effort: String, - pub osd_agent_quantize_effort: String, - pub osd_agent_delay_time: String, - pub osd_agent_hist_halflife: String, - pub osd_agent_slop: String, - pub osd_uuid: String, - pub osd_data: String, - pub osd_journal: String, - pub osd_journal_size: String, - pub osd_max_write_size: String, - pub osd_max_pgls: String, - pub osd_client_message_size_cap: String, - pub osd_client_message_cap: String, - pub osd_pg_bits: String, - pub osd_pgp_bits: String, - pub osd_crush_chooseleaf_type: String, - pub osd_pool_default_crush_rule: String, - pub osd_pool_default_crush_replicated_ruleset: String, - pub osd_pool_erasure_code_stripe_width: String, - pub osd_pool_default_size: String, - pub osd_pool_default_min_size: String, - pub osd_pool_default_pg_num: String, - pub osd_pool_default_pgp_num: String, - pub osd_pool_default_erasure_code_directory: String, - pub osd_pool_default_erasure_code_profile: String, - pub osd_erasure_code_plugins: String, - pub osd_pool_default_flags: String, - pub osd_pool_default_flag_hashpspool: String, - pub osd_pool_default_hit_set_bloom_fpp: String, - pub osd_pool_default_cache_target_dirty_ratio: String, - pub osd_pool_default_cache_target_full_ratio: String, - pub osd_pool_default_cache_min_flush_age: String, - pub osd_pool_default_cache_min_evict_age: String, - pub osd_hit_set_min_size: String, - pub osd_hit_set_max_size: String, - pub osd_hit_set_namespace: String, - pub osd_tier_default_cache_mode: String, - pub osd_tier_default_cache_hit_set_count: String, - pub osd_tier_default_cache_hit_set_period: String, - pub osd_tier_default_cache_hit_set_type: String, - pub osd_map_dedup: String, - pub osd_map_max_advance: String, - pub osd_map_cache_size: String, - pub osd_map_message_max: String, - pub osd_map_share_max_epochs: String, - pub osd_op_threads: String, - pub osd_peering_wq_batch_size: String, - pub osd_op_pq_max_tokens_per_priority: String, - pub osd_op_pq_min_cost: String, - pub osd_disk_threads: String, - pub osd_disk_thread_ioprio_class: String, - pub osd_disk_thread_ioprio_priority: String, - pub osd_recovery_threads: String, - pub osd_recover_clone_overlap: String, - pub osd_recover_clone_overlap_limit: String, - pub osd_backfill_scan_min: String, - pub osd_backfill_scan_max: String, - pub osd_op_thread_timeout: String, - pub osd_recovery_thread_timeout: String, - pub osd_snap_trim_thread_timeout: String, - pub osd_snap_trim_sleep: String, - pub osd_scrub_thread_timeout: String, - pub osd_scrub_finalize_thread_timeout: String, - pub osd_scrub_invalid_stats: String, - pub osd_remove_thread_timeout: String, - pub osd_command_thread_timeout: String, - pub osd_age: String, - pub osd_age_time: String, - pub osd_heartbeat_addr: String, - pub osd_heartbeat_interval: String, - pub osd_heartbeat_grace: String, - pub osd_heartbeat_min_peers: String, - pub osd_pg_max_concurrent_snap_trims: String, - pub osd_heartbeat_min_healthy_ratio: String, - pub osd_mon_heartbeat_interval: String, - pub osd_mon_report_interval_max: String, - pub osd_mon_report_interval_min: String, - pub osd_pg_stat_report_interval_max: String, - pub osd_mon_ack_timeout: String, - pub osd_default_data_pool_replay_window: String, - pub osd_preserve_trimmed_log: String, - pub osd_auto_mark_unfound_lost: String, - pub osd_recovery_delay_start: String, - pub osd_recovery_max_active: String, - pub osd_recovery_max_single_start: String, - pub osd_recovery_max_chunk: String, - pub osd_copyfrom_max_chunk: String, - pub osd_push_per_object_cost: String, - pub osd_max_push_cost: String, - pub osd_max_push_objects: String, - pub osd_recovery_forget_lost_objects: String, - pub osd_max_scrubs: String, - pub osd_scrub_load_threshold: String, - pub osd_scrub_min_interval: String, - pub osd_scrub_max_interval: String, - pub osd_scrub_chunk_min: String, - pub osd_scrub_chunk_max: String, - pub osd_scrub_sleep: String, - pub osd_deep_scrub_interval: String, - pub osd_deep_scrub_stride: String, - pub osd_scan_list_ping_tp_interval: String, - pub osd_auto_weight: String, - pub osd_class_dir: String, - pub osd_open_classes_on_start: String, - pub osd_check_for_log_corruption: String, - pub osd_use_stale_snap: String, - pub osd_rollback_to_cluster_snap: String, - pub osd_default_notify_timeout: String, - pub osd_kill_backfill_at: String, - pub osd_pg_epoch_persisted_max_stale: String, - pub osd_min_pg_log_entries: String, - pub osd_max_pg_log_entries: String, - pub osd_op_complaint_time: String, - pub osd_command_max_records: String, - pub osd_op_log_threshold: String, - pub osd_verify_sparse_read_holes: String, - pub osd_debug_drop_ping_probability: String, - pub osd_debug_drop_ping_duration: String, - pub osd_debug_drop_pg_create_probability: String, - pub osd_debug_drop_pg_create_duration: String, - pub osd_debug_drop_op_probability: String, - pub osd_debug_op_order: String, - pub osd_debug_verify_snaps_on_info: String, - pub osd_debug_verify_stray_on_activate: String, - pub osd_debug_skip_full_check_in_backfill_reservation: String, - pub osd_debug_reject_backfill_probability: String, - pub osd_enable_op_tracker: String, -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29663.rs b/src/test/ui/run-pass/issues/issue-29663.rs deleted file mode 100644 index 709bea268d1..00000000000 --- a/src/test/ui/run-pass/issues/issue-29663.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -// write_volatile causes an LLVM assert with composite types - -#![feature(volatile)] -use std::ptr::{read_volatile, write_volatile}; - -#[derive(Debug, Eq, PartialEq)] -struct A(u32); -#[derive(Debug, Eq, PartialEq)] -struct B(u64); -#[derive(Debug, Eq, PartialEq)] -struct C(u32, u32); -#[derive(Debug, Eq, PartialEq)] -struct D(u64, u64); -#[derive(Debug, Eq, PartialEq)] -struct E([u64; 32]); - -fn main() { - unsafe { - let mut x: u32 = 0; - write_volatile(&mut x, 1); - assert_eq!(read_volatile(&x), 1); - assert_eq!(x, 1); - - let mut x: u64 = 0; - write_volatile(&mut x, 1); - assert_eq!(read_volatile(&x), 1); - assert_eq!(x, 1); - - let mut x = A(0); - write_volatile(&mut x, A(1)); - assert_eq!(read_volatile(&x), A(1)); - assert_eq!(x, A(1)); - - let mut x = B(0); - write_volatile(&mut x, B(1)); - assert_eq!(read_volatile(&x), B(1)); - assert_eq!(x, B(1)); - - let mut x = C(0, 0); - write_volatile(&mut x, C(1, 1)); - assert_eq!(read_volatile(&x), C(1, 1)); - assert_eq!(x, C(1, 1)); - - let mut x = D(0, 0); - write_volatile(&mut x, D(1, 1)); - assert_eq!(read_volatile(&x), D(1, 1)); - assert_eq!(x, D(1, 1)); - - let mut x = E([0; 32]); - write_volatile(&mut x, E([1; 32])); - assert_eq!(read_volatile(&x), E([1; 32])); - assert_eq!(x, E([1; 32])); - } -} diff --git a/src/test/ui/run-pass/issues/issue-29668.rs b/src/test/ui/run-pass/issues/issue-29668.rs deleted file mode 100644 index f10152b29c9..00000000000 --- a/src/test/ui/run-pass/issues/issue-29668.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Functions can return unnameable types - -mod m1 { - mod m2 { - #[derive(Debug)] - pub struct A; - } - use self::m2::A; - pub fn x() -> A { A } -} - -fn main() { - let x = m1::x(); - println!("{:?}", x); -} diff --git a/src/test/ui/run-pass/issues/issue-29710.rs b/src/test/ui/run-pass/issues/issue-29710.rs deleted file mode 100644 index fa768340b71..00000000000 --- a/src/test/ui/run-pass/issues/issue-29710.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(unused_results)] -#![allow(dead_code)] - -#[derive(Debug)] -struct A(usize); - -#[derive(Debug)] -struct B { a: usize } - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-29740.rs b/src/test/ui/run-pass/issues/issue-29740.rs deleted file mode 100644 index b0959e83009..00000000000 --- a/src/test/ui/run-pass/issues/issue-29740.rs +++ /dev/null @@ -1,326 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #29740. Inefficient MIR matching algorithms -// generated way too much code for this sort of case, leading to OOM. -#![allow(non_snake_case)] - -pub mod KeyboardEventConstants { - pub const DOM_KEY_LOCATION_STANDARD: u32 = 0; - pub const DOM_KEY_LOCATION_LEFT: u32 = 1; - pub const DOM_KEY_LOCATION_RIGHT: u32 = 2; - pub const DOM_KEY_LOCATION_NUMPAD: u32 = 3; -} // mod KeyboardEventConstants - -pub enum Key { - Space, - Apostrophe, - Comma, - Minus, - Period, - Slash, - Num0, - Num1, - Num2, - Num3, - Num4, - Num5, - Num6, - Num7, - Num8, - Num9, - Semicolon, - Equal, - A, - B, - C, - D, - E, - F, - G, - H, - I, - J, - K, - L, - M, - N, - O, - P, - Q, - R, - S, - T, - U, - V, - W, - X, - Y, - Z, - LeftBracket, - Backslash, - RightBracket, - GraveAccent, - World1, - World2, - - Escape, - Enter, - Tab, - Backspace, - Insert, - Delete, - Right, - Left, - Down, - Up, - PageUp, - PageDown, - Home, - End, - CapsLock, - ScrollLock, - NumLock, - PrintScreen, - Pause, - F1, - F2, - F3, - F4, - F5, - F6, - F7, - F8, - F9, - F10, - F11, - F12, - F13, - F14, - F15, - F16, - F17, - F18, - F19, - F20, - F21, - F22, - F23, - F24, - F25, - Kp0, - Kp1, - Kp2, - Kp3, - Kp4, - Kp5, - Kp6, - Kp7, - Kp8, - Kp9, - KpDecimal, - KpDivide, - KpMultiply, - KpSubtract, - KpAdd, - KpEnter, - KpEqual, - LeftShift, - LeftControl, - LeftAlt, - LeftSuper, - RightShift, - RightControl, - RightAlt, - RightSuper, - Menu, -} - -fn key_from_string(key_string: &str, location: u32) -> Option { - match key_string { - " " => Some(Key::Space), - "\"" => Some(Key::Apostrophe), - "'" => Some(Key::Apostrophe), - "<" => Some(Key::Comma), - "," => Some(Key::Comma), - "_" => Some(Key::Minus), - "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Minus), - ">" => Some(Key::Period), - "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Period), - "?" => Some(Key::Slash), - "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Slash), - "~" => Some(Key::GraveAccent), - "`" => Some(Key::GraveAccent), - ")" => Some(Key::Num0), - "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num0), - "!" => Some(Key::Num1), - "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num1), - "@" => Some(Key::Num2), - "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num2), - "#" => Some(Key::Num3), - "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num3), - "$" => Some(Key::Num4), - "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num4), - "%" => Some(Key::Num5), - "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num5), - "^" => Some(Key::Num6), - "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num6), - "&" => Some(Key::Num7), - "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num7), - "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), - "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num8), - "(" => Some(Key::Num9), - "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Num9), - ":" => Some(Key::Semicolon), - ";" => Some(Key::Semicolon), - "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), - "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD => Some(Key::Equal), - "A" => Some(Key::A), - "a" => Some(Key::A), - "B" => Some(Key::B), - "b" => Some(Key::B), - "C" => Some(Key::C), - "c" => Some(Key::C), - "D" => Some(Key::D), - "d" => Some(Key::D), - "E" => Some(Key::E), - "e" => Some(Key::E), - "F" => Some(Key::F), - "f" => Some(Key::F), - "G" => Some(Key::G), - "g" => Some(Key::G), - "H" => Some(Key::H), - "h" => Some(Key::H), - "I" => Some(Key::I), - "i" => Some(Key::I), - "J" => Some(Key::J), - "j" => Some(Key::J), - "K" => Some(Key::K), - "k" => Some(Key::K), - "L" => Some(Key::L), - "l" => Some(Key::L), - "M" => Some(Key::M), - "m" => Some(Key::M), - "N" => Some(Key::N), - "n" => Some(Key::N), - "O" => Some(Key::O), - "o" => Some(Key::O), - "P" => Some(Key::P), - "p" => Some(Key::P), - "Q" => Some(Key::Q), - "q" => Some(Key::Q), - "R" => Some(Key::R), - "r" => Some(Key::R), - "S" => Some(Key::S), - "s" => Some(Key::S), - "T" => Some(Key::T), - "t" => Some(Key::T), - "U" => Some(Key::U), - "u" => Some(Key::U), - "V" => Some(Key::V), - "v" => Some(Key::V), - "W" => Some(Key::W), - "w" => Some(Key::W), - "X" => Some(Key::X), - "x" => Some(Key::X), - "Y" => Some(Key::Y), - "y" => Some(Key::Y), - "Z" => Some(Key::Z), - "z" => Some(Key::Z), - "{" => Some(Key::LeftBracket), - "[" => Some(Key::LeftBracket), - "|" => Some(Key::Backslash), - "\\" => Some(Key::Backslash), - "}" => Some(Key::RightBracket), - "]" => Some(Key::RightBracket), - "Escape" => Some(Key::Escape), - "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_STANDARD - => Some(Key::Enter), - "Tab" => Some(Key::Tab), - "Backspace" => Some(Key::Backspace), - "Insert" => Some(Key::Insert), - "Delete" => Some(Key::Delete), - "ArrowRight" => Some(Key::Right), - "ArrowLeft" => Some(Key::Left), - "ArrowDown" => Some(Key::Down), - "ArrowUp" => Some(Key::Up), - "PageUp" => Some(Key::PageUp), - "PageDown" => Some(Key::PageDown), - "Home" => Some(Key::Home), - "End" => Some(Key::End), - "CapsLock" => Some(Key::CapsLock), - "ScrollLock" => Some(Key::ScrollLock), - "NumLock" => Some(Key::NumLock), - "PrintScreen" => Some(Key::PrintScreen), - "Pause" => Some(Key::Pause), - "F1" => Some(Key::F1), - "F2" => Some(Key::F2), - "F3" => Some(Key::F3), - "F4" => Some(Key::F4), - "F5" => Some(Key::F5), - "F6" => Some(Key::F6), - "F7" => Some(Key::F7), - "F8" => Some(Key::F8), - "F9" => Some(Key::F9), - "F10" => Some(Key::F10), - "F11" => Some(Key::F11), - "F12" => Some(Key::F12), - "F13" => Some(Key::F13), - "F14" => Some(Key::F14), - "F15" => Some(Key::F15), - "F16" => Some(Key::F16), - "F17" => Some(Key::F17), - "F18" => Some(Key::F18), - "F19" => Some(Key::F19), - "F20" => Some(Key::F20), - "F21" => Some(Key::F21), - "F22" => Some(Key::F22), - "F23" => Some(Key::F23), - "F24" => Some(Key::F24), - "F25" => Some(Key::F25), - "0" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp0), - "1" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp1), - "2" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp2), - "3" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp3), - "4" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp4), - "5" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp5), - "6" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp6), - "7" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp7), - "8" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp8), - "9" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::Kp9), - "." if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDecimal), - "/" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpDivide), - "*" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpMultiply), - "-" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpSubtract), - "+" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpAdd), - "Enter" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD - => Some(Key::KpEnter), - "=" if location == KeyboardEventConstants::DOM_KEY_LOCATION_NUMPAD => Some(Key::KpEqual), - "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT - => Some(Key::LeftShift), - "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT - => Some(Key::LeftControl), - "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT => Some(Key::LeftAlt), - "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_LEFT - => Some(Key::LeftSuper), - "Shift" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT - => Some(Key::RightShift), - "Control" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT - => Some(Key::RightControl), - "Alt" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT => Some(Key::RightAlt), - "Super" if location == KeyboardEventConstants::DOM_KEY_LOCATION_RIGHT - => Some(Key::RightSuper), - "ContextMenu" => Some(Key::Menu), - _ => None - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-29746.rs b/src/test/ui/run-pass/issues/issue-29746.rs deleted file mode 100644 index c2072ddddce..00000000000 --- a/src/test/ui/run-pass/issues/issue-29746.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// zip!(a1,a2,a3,a4) is equivalent to: -// a1.zip(a2).zip(a3).zip(a4).map(|(((x1,x2),x3),x4)| (x1,x2,x3,x4)) -macro_rules! zip { - // Entry point - ([$a:expr, $b:expr, $($rest:expr),*]) => { - zip!([$($rest),*], $a.zip($b), (x,y), [x,y]) - }; - - // Intermediate steps to build the zipped expression, the match pattern, and - // and the output tuple of the closure, using macro hygiene to repeatedly - // introduce new variables named 'x'. - ([$a:expr, $($rest:expr),*], $zip:expr, $pat:pat, [$($flat:expr),*]) => { - zip!([$($rest),*], $zip.zip($a), ($pat,x), [$($flat),*, x]) - }; - - // Final step - ([], $zip:expr, $pat:pat, [$($flat:expr),+]) => { - $zip.map(|$pat| ($($flat),+)) - }; - - // Comma - ([$a:expr], $zip:expr, $pat:pat, [$($flat:expr),*]) => { - zip!([$a,], $zip, $pat, [$($flat),*]) - }; -} - -fn main() { - let p1 = vec![1i32, 2].into_iter(); - let p2 = vec!["10", "20"].into_iter(); - let p3 = vec![100u16, 200].into_iter(); - let p4 = vec![1000i64, 2000].into_iter(); - - let e = zip!([p1,p2,p3,p4]).collect::>(); - assert_eq!(e[0], (1i32,"10",100u16,1000i64)); -} diff --git a/src/test/ui/run-pass/issues/issue-29844.rs b/src/test/ui/run-pass/issues/issue-29844.rs deleted file mode 100644 index 0a17b708fcf..00000000000 --- a/src/test/ui/run-pass/issues/issue-29844.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::sync::Arc; - -pub struct DescriptorSet<'a> { - pub slots: Vec> -} - -pub trait ResourcesTrait<'r>: Sized { - type DescriptorSet: 'r; -} - -pub struct Resources; - -impl<'a> ResourcesTrait<'a> for Resources { - type DescriptorSet = DescriptorSet<'a>; -} - -pub enum AttachInfo<'a, R: ResourcesTrait<'a>> { - NextDescriptorSet(Arc) -} - -fn main() { - let _x = DescriptorSet {slots: Vec::new()}; -} diff --git a/src/test/ui/run-pass/issues/issue-2989.rs b/src/test/ui/run-pass/issues/issue-2989.rs deleted file mode 100644 index 7690d9a6927..00000000000 --- a/src/test/ui/run-pass/issues/issue-2989.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -trait methods { - fn to_bytes(&self) -> Vec ; -} - -impl methods for () { - fn to_bytes(&self) -> Vec { - Vec::new() - } -} - -// the position of this function is significant! - if it comes before methods -// then it works, if it comes after it then it doesn't! -fn to_bools(bitv: Storage) -> Vec { - (0..8).map(|i| { - let w = i / 64; - let b = i % 64; - let x = 1 & (bitv.storage[w] >> b); - x == 1 - }).collect() -} - -struct Storage { storage: Vec } - -pub fn main() { - let bools = vec![false, false, true, false, false, true, true, false]; - let bools2 = to_bools(Storage{storage: vec![0b01100100]}); - - for i in 0..8 { - println!("{} => {} vs {}", i, bools[i], bools2[i]); - } - - assert_eq!(bools, bools2); -} diff --git a/src/test/ui/run-pass/issues/issue-29914-2.rs b/src/test/ui/run-pass/issues/issue-29914-2.rs deleted file mode 100644 index e3b9aa1afae..00000000000 --- a/src/test/ui/run-pass/issues/issue-29914-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const ARR: [usize; 5] = [5, 4, 3, 2, 1]; - -fn main() { - assert_eq!(3, ARR[ARR[3]]); -} diff --git a/src/test/ui/run-pass/issues/issue-29914-3.rs b/src/test/ui/run-pass/issues/issue-29914-3.rs deleted file mode 100644 index 1d54e068a72..00000000000 --- a/src/test/ui/run-pass/issues/issue-29914-3.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const ARR: [usize; 5] = [5, 4, 3, 2, 1]; -const BLA: usize = ARR[ARR[3]]; - -fn main() { - assert_eq!(3, BLA); -} diff --git a/src/test/ui/run-pass/issues/issue-29914.rs b/src/test/ui/run-pass/issues/issue-29914.rs deleted file mode 100644 index 16f03592756..00000000000 --- a/src/test/ui/run-pass/issues/issue-29914.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(const_indexing)] - -const ARR: [usize; 5] = [5, 4, 3, 2, 1]; - -fn main() { - assert_eq!(3, ARR[ARR[3]]); -} diff --git a/src/test/ui/run-pass/issues/issue-29927.rs b/src/test/ui/run-pass/issues/issue-29927.rs deleted file mode 100644 index 4eab938609f..00000000000 --- a/src/test/ui/run-pass/issues/issue-29927.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] -struct A { - field: usize, -} -const fn f() -> usize { - 5 -} -fn main() { - let _ = [0; f()]; -} diff --git a/src/test/ui/run-pass/issues/issue-29948.rs b/src/test/ui/run-pass/issues/issue-29948.rs deleted file mode 100644 index 2beaaec55a1..00000000000 --- a/src/test/ui/run-pass/issues/issue-29948.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default - -use std::panic; - -impl<'a> panic::UnwindSafe for Foo<'a> {} -impl<'a> panic::RefUnwindSafe for Foo<'a> {} - -struct Foo<'a>(&'a mut bool); - -impl<'a> Drop for Foo<'a> { - fn drop(&mut self) { - *self.0 = true; - } -} - -fn f(t: T) { - t() -} - -fn main() { - let mut ran_drop = false; - { - let x = Foo(&mut ran_drop); - let x = move || { let _ = x; }; - f(x); - } - assert!(ran_drop); - - let mut ran_drop = false; - { - let x = Foo(&mut ran_drop); - let result = panic::catch_unwind(move || { - let x = move || { let _ = x; panic!() }; - f(x); - }); - assert!(result.is_err()); - } - assert!(ran_drop); -} diff --git a/src/test/ui/run-pass/issues/issue-30018-nopanic.rs b/src/test/ui/run-pass/issues/issue-30018-nopanic.rs deleted file mode 100644 index bb94d4f8517..00000000000 --- a/src/test/ui/run-pass/issues/issue-30018-nopanic.rs +++ /dev/null @@ -1,112 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// More thorough regression test for Issues #30018 and #30822. This -// attempts to explore different ways that array element construction -// (for both scratch arrays and non-scratch ones) interacts with -// breaks in the control-flow, in terms of the order of evaluation of -// the destructors (which may change; see RFC Issue 744) and the -// number of times that the destructor evaluates for each value (which -// should never exceed 1; this latter case is what #30822 is about). - -use std::cell::RefCell; - -struct D<'a>(&'a RefCell>, i32); - -impl<'a> Drop for D<'a> { - fn drop(&mut self) { - println!("Dropping D({})", self.1); - (self.0).borrow_mut().push(self.1); - } -} - -fn main() { - println!("Start"); - break_during_elem(); - break_after_whole(); - println!("Finis"); -} - -fn break_during_elem() { - let log = &RefCell::new(Vec::new()); - - // CASE 1: Fixed-size array itself is stored in _r slot. - loop { - let _r = [D(log, 10), - D(log, 11), - { D(log, 12); break; }, - D(log, 13)]; - } - assert_eq!(&log.borrow()[..], &[12, 11, 10]); - log.borrow_mut().clear(); - - // CASE 2: Slice (borrow of array) is stored in _r slot. - // This is the case that is actually being reported in #30018. - loop { - let _r = &[D(log, 20), - D(log, 21), - { D(log, 22); break; }, - D(log, 23)]; - } - assert_eq!(&log.borrow()[..], &[22, 21, 20]); - log.borrow_mut().clear(); - - // CASE 3: (Borrow of) slice-index of array is stored in _r slot. - loop { - let _r = &[D(log, 30), - D(log, 31), - { D(log, 32); break; }, - D(log, 33)][..]; - } - assert_eq!(&log.borrow()[..], &[32, 31, 30]); - log.borrow_mut().clear(); -} - -// The purpose of these functions is to test what happens when we -// panic after an array has been constructed in its entirety. -// -// It is meant to act as proof that we still need to continue -// scheduling the destruction of an array even after we've scheduling -// drop for its elements during construction; the latter is tested by -// `fn break_during_elem()`. -fn break_after_whole() { - let log = &RefCell::new(Vec::new()); - - // CASE 1: Fixed-size array itself is stored in _r slot. - loop { - let _r = [D(log, 10), - D(log, 11), - D(log, 12)]; - break; - } - assert_eq!(&log.borrow()[..], &[10, 11, 12]); - log.borrow_mut().clear(); - - // CASE 2: Slice (borrow of array) is stored in _r slot. - loop { - let _r = &[D(log, 20), - D(log, 21), - D(log, 22)]; - break; - } - assert_eq!(&log.borrow()[..], &[20, 21, 22]); - log.borrow_mut().clear(); - - // CASE 3: (Borrow of) slice-index of array is stored in _r slot. - loop { - let _r = &[D(log, 30), - D(log, 31), - D(log, 32)][..]; - break; - } - assert_eq!(&log.borrow()[..], &[30, 31, 32]); - log.borrow_mut().clear(); -} diff --git a/src/test/ui/run-pass/issues/issue-30018-panic.rs b/src/test/ui/run-pass/issues/issue-30018-panic.rs deleted file mode 100644 index 0922cfb9c21..00000000000 --- a/src/test/ui/run-pass/issues/issue-30018-panic.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for Issue #30018. This is very similar to the -// original reported test, except that the panic is wrapped in a -// spawned thread to isolate the expected error result from the -// SIGTRAP injected by the drop-flag consistency checking. - -// ignore-emscripten no threads support - -struct Foo; - -impl Drop for Foo { - fn drop(&mut self) {} -} - -fn foo() -> Foo { - panic!(); -} - -fn main() { - use std::thread; - let handle = thread::spawn(|| { - let _ = &[foo()]; - }); - let _ = handle.join(); -} diff --git a/src/test/ui/run-pass/issues/issue-30081.rs b/src/test/ui/run-pass/issues/issue-30081.rs deleted file mode 100644 index b866f7f8f33..00000000000 --- a/src/test/ui/run-pass/issues/issue-30081.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This used to segfault #30081 - -pub enum Instruction { - Increment(i8), - Loop(Box>), -} - -fn main() { - let instrs: Option<(u8, Box)> = None; - instrs.into_iter() - .map(|(_, instr)| instr) - .map(|instr| match *instr { _other => {} }) - .last(); -} diff --git a/src/test/ui/run-pass/issues/issue-3012-2.rs b/src/test/ui/run-pass/issues/issue-3012-2.rs deleted file mode 100644 index 1a64d6bb9ae..00000000000 --- a/src/test/ui/run-pass/issues/issue-3012-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-3012-1.rs - -// pretty-expanded FIXME #23616 - -extern crate socketlib; - -use socketlib::socket; - -pub fn main() { - let fd: u32 = 1 as u32; - let _sock: Box<_> = Box::new(socket::socket_handle(fd)); -} diff --git a/src/test/ui/run-pass/issues/issue-30240.rs b/src/test/ui/run-pass/issues/issue-30240.rs deleted file mode 100644 index c18a821c0e8..00000000000 --- a/src/test/ui/run-pass/issues/issue-30240.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let &ref a = &[0i32] as &[_]; - assert_eq!(a, &[0i32] as &[_]); - - let &ref a = "hello"; - assert_eq!(a, "hello"); - - match "foo" { - "fool" => unreachable!(), - "foo" => {}, - ref _x => unreachable!() - } -} diff --git a/src/test/ui/run-pass/issues/issue-3026.rs b/src/test/ui/run-pass/issues/issue-3026.rs deleted file mode 100644 index dcd1572c1a4..00000000000 --- a/src/test/ui/run-pass/issues/issue-3026.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -use std::collections::HashMap; - -pub fn main() { - let x: Box<_>; - let mut buggy_map: HashMap = HashMap::new(); - x = box 1; - buggy_map.insert(42, &*x); -} diff --git a/src/test/ui/run-pass/issues/issue-3037.rs b/src/test/ui/run-pass/issues/issue-3037.rs deleted file mode 100644 index ab2d5a5ae88..00000000000 --- a/src/test/ui/run-pass/issues/issue-3037.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_camel_case_types)] - -enum what { } - -fn what_to_string(x: what) -> String -{ - match x { - } -} - -pub fn main() -{ -} diff --git a/src/test/ui/run-pass/issues/issue-30371.rs b/src/test/ui/run-pass/issues/issue-30371.rs deleted file mode 100644 index f95d442c1b9..00000000000 --- a/src/test/ui/run-pass/issues/issue-30371.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(unused_variables)] - -fn main() { - for _ in match return () { - () => Some(0), - } {} -} - diff --git a/src/test/ui/run-pass/issues/issue-30490.rs b/src/test/ui/run-pass/issues/issue-30490.rs deleted file mode 100644 index 500999cc1cf..00000000000 --- a/src/test/ui/run-pass/issues/issue-30490.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -// Previously libstd would set stdio descriptors of a child process -// by `dup`ing the requested descriptors to inherit directly into the -// stdio descriptors. This, however, would incorrectly handle cases -// where the descriptors to inherit were already stdio descriptors. -// This test checks to avoid that regression. - -#![cfg_attr(unix, feature(libc))] -#![cfg_attr(windows, allow(unused_imports))] - -#[cfg(unix)] -extern crate libc; - -use std::fs::File; -use std::io::{Read, Write}; -use std::io::{stdout, stderr}; -use std::process::{Command, Stdio}; - -#[cfg(unix)] -use std::os::unix::io::FromRawFd; - -#[cfg(not(unix))] -fn main() { - // Bug not present in Windows -} - -#[cfg(unix)] -fn main() { - let mut args = std::env::args(); - let name = args.next().unwrap(); - let args: Vec = args.collect(); - if let Some("--child") = args.get(0).map(|s| &**s) { - return child(); - } else if !args.is_empty() { - panic!("unknown options"); - } - - let stdout_backup = unsafe { libc::dup(libc::STDOUT_FILENO) }; - let stderr_backup = unsafe { libc::dup(libc::STDERR_FILENO) }; - assert!(stdout_backup > -1); - assert!(stderr_backup > -1); - - let (stdout_reader, stdout_writer) = pipe(); - let (stderr_reader, stderr_writer) = pipe(); - assert!(unsafe { libc::dup2(stdout_writer, libc::STDOUT_FILENO) } > -1); - assert!(unsafe { libc::dup2(stderr_writer, libc::STDERR_FILENO) } > -1); - - // Make sure we close any duplicates of the writer end of the pipe, - // otherwise we can get stuck reading from the pipe which has open - // writers but no one supplying any input - assert_eq!(unsafe { libc::close(stdout_writer) }, 0); - assert_eq!(unsafe { libc::close(stderr_writer) }, 0); - - stdout().write_all("parent stdout\n".as_bytes()).expect("failed to write to stdout"); - stderr().write_all("parent stderr\n".as_bytes()).expect("failed to write to stderr"); - - let child = { - Command::new(name) - .arg("--child") - .stdin(Stdio::inherit()) - .stdout(unsafe { Stdio::from_raw_fd(libc::STDERR_FILENO) }) - .stderr(unsafe { Stdio::from_raw_fd(libc::STDOUT_FILENO) }) - .spawn() - }; - - // The Stdio passed into the Command took over (and closed) std{out, err} - // so we should restore them as they were. - assert!(unsafe { libc::dup2(stdout_backup, libc::STDOUT_FILENO) } > -1); - assert!(unsafe { libc::dup2(stderr_backup, libc::STDERR_FILENO) } > -1); - - // Using File as a shim around the descriptor - let mut read = String::new(); - let mut f: File = unsafe { FromRawFd::from_raw_fd(stdout_reader) }; - f.read_to_string(&mut read).expect("failed to read from stdout file"); - assert_eq!(read, "parent stdout\nchild stderr\n"); - - // Using File as a shim around the descriptor - read.clear(); - let mut f: File = unsafe { FromRawFd::from_raw_fd(stderr_reader) }; - f.read_to_string(&mut read).expect("failed to read from stderr file"); - assert_eq!(read, "parent stderr\nchild stdout\n"); - - assert!(child.expect("failed to execute child process").wait().unwrap().success()); -} - -#[cfg(unix)] -fn child() { - stdout().write_all("child stdout\n".as_bytes()).expect("child failed to write to stdout"); - stderr().write_all("child stderr\n".as_bytes()).expect("child failed to write to stderr"); -} - -#[cfg(unix)] -/// Returns a pipe (reader, writer combo) -fn pipe() -> (i32, i32) { - let mut fds = [0; 2]; - assert_eq!(unsafe { libc::pipe(fds.as_mut_ptr()) }, 0); - (fds[0], fds[1]) -} diff --git a/src/test/ui/run-pass/issues/issue-3052.rs b/src/test/ui/run-pass/issues/issue-3052.rs deleted file mode 100644 index 6c2d3899bf3..00000000000 --- a/src/test/ui/run-pass/issues/issue-3052.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -type Connection = Box) + 'static>; - -fn f() -> Option { - let mock_connection: Connection = Box::new(|_| {}); - Some(mock_connection) -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-30530.rs b/src/test/ui/run-pass/issues/issue-30530.rs deleted file mode 100644 index 0e25d72ed88..00000000000 --- a/src/test/ui/run-pass/issues/issue-30530.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012-2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for Issue #30530: alloca's created for storing -// intermediate scratch values during brace-less match arms need to be -// initialized with their drop-flag set to "dropped" (or else we end -// up running the destructors on garbage data at the end of the -// function). - -pub enum Handler { - Default, - #[allow(dead_code)] - Custom(*mut Box), -} - -fn main() { - take(Handler::Default, Box::new(main)); -} - -#[inline(never)] -pub fn take(h: Handler, f: Box) -> Box { - unsafe { - match h { - Handler::Custom(ptr) => *Box::from_raw(ptr), - Handler::Default => f, - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-30615.rs b/src/test/ui/run-pass/issues/issue-30615.rs deleted file mode 100644 index 28a21adbd29..00000000000 --- a/src/test/ui/run-pass/issues/issue-30615.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - &0u8 as *const u8 as *const PartialEq; - &[0u8] as *const [u8; 1] as *const [u8]; -} diff --git a/src/test/ui/run-pass/issues/issue-30756.rs b/src/test/ui/run-pass/issues/issue-30756.rs deleted file mode 100644 index 6ed0d441b93..00000000000 --- a/src/test/ui/run-pass/issues/issue-30756.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![forbid(unsafe_code)] - -thread_local!(static FOO: u8 = 1); - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-30891.rs b/src/test/ui/run-pass/issues/issue-30891.rs deleted file mode 100644 index 0ec42d44902..00000000000 --- a/src/test/ui/run-pass/issues/issue-30891.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const ERROR_CONST: bool = true; - -fn get() -> bool { - false || ERROR_CONST -} - -pub fn main() { - assert_eq!(get(), true); -} diff --git a/src/test/ui/run-pass/issues/issue-3091.rs b/src/test/ui/run-pass/issues/issue-3091.rs deleted file mode 100644 index c6103bf017f..00000000000 --- a/src/test/ui/run-pass/issues/issue-3091.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let x = 1; - let y = 1; - assert_eq!(&x, &y); -} diff --git a/src/test/ui/run-pass/issues/issue-3109.rs b/src/test/ui/run-pass/issues/issue-3109.rs deleted file mode 100644 index 6017a9ffbe6..00000000000 --- a/src/test/ui/run-pass/issues/issue-3109.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - println!("{:?}", ("hi there!", "you")); -} diff --git a/src/test/ui/run-pass/issues/issue-3121.rs b/src/test/ui/run-pass/issues/issue-3121.rs deleted file mode 100644 index 9d70cf90d1c..00000000000 --- a/src/test/ui/run-pass/issues/issue-3121.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -#[derive(Copy, Clone)] -enum side { mayo, catsup, vinegar } -#[derive(Copy, Clone)] -enum order { hamburger, fries(side), shake } -#[derive(Copy, Clone)] -enum meal { to_go(order), for_here(order) } - -fn foo(m: Box, cond: bool) { - match *m { - meal::to_go(_) => { } - meal::for_here(_) if cond => {} - meal::for_here(order::hamburger) => {} - meal::for_here(order::fries(_s)) => {} - meal::for_here(order::shake) => {} - } -} - -pub fn main() { - foo(box meal::for_here(order::hamburger), true) -} diff --git a/src/test/ui/run-pass/issues/issue-31260.rs b/src/test/ui/run-pass/issues/issue-31260.rs deleted file mode 100644 index 6b31a1ac996..00000000000 --- a/src/test/ui/run-pass/issues/issue-31260.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Struct { - pub field: K, -} - -static STRUCT: Struct<&'static [u8]> = Struct { - field: {&[1]} -}; - -static STRUCT2: Struct<&'static [u8]> = Struct { - field: &[1] -}; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-31267-additional.rs b/src/test/ui/run-pass/issues/issue-31267-additional.rs deleted file mode 100644 index d07cd8e2a77..00000000000 --- a/src/test/ui/run-pass/issues/issue-31267-additional.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(Clone, Copy, Debug)] -struct Bar; - -const BAZ: Bar = Bar; - -#[derive(Debug)] -struct Foo([Bar; 1]); - -struct Biz; - -impl Biz { - const BAZ: Foo = Foo([BAZ; 1]); -} - -fn main() { - let foo = Biz::BAZ; - println!("{:?}", foo); -} diff --git a/src/test/ui/run-pass/issues/issue-31267.rs b/src/test/ui/run-pass/issues/issue-31267.rs deleted file mode 100644 index 761ef1f89ff..00000000000 --- a/src/test/ui/run-pass/issues/issue-31267.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #31267 - - -struct Foo; - -impl Foo { - const FOO: [i32; 3] = [0; 3]; -} - -pub fn main() { - let foo = Foo::FOO; - assert_eq!(foo, [0i32, 0, 0]); -} diff --git a/src/test/ui/run-pass/issues/issue-31299.rs b/src/test/ui/run-pass/issues/issue-31299.rs deleted file mode 100644 index 6d3be955577..00000000000 --- a/src/test/ui/run-pass/issues/issue-31299.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #31299. This was generating an overflow error -// because of eager normalization: -// -// proving `M: Sized` requires -// - proving `PtrBack>: Sized` requires -// - normalizing `Vec< as Front>::Back>>: Sized` requires -// - proving `Vec: Front` requires -// - `M: Sized` <-- cycle! -// -// If we skip the normalization step, though, everything goes fine. -// -// This could be fixed by implementing lazy normalization everywhere. -// -// However, we want this to work before then. For that, when checking -// whether a type is Sized we only check that the tails are Sized. As -// PtrBack does not have a tail, we don't need to normalize anything -// and this compiles - -trait Front { - type Back; -} - -impl Front for Vec { - type Back = Vec; -} - -struct PtrBack(Vec); - -struct M(PtrBack>); - -fn main() { - std::mem::size_of::(); -} diff --git a/src/test/ui/run-pass/issues/issue-3149.rs b/src/test/ui/run-pass/issues/issue-3149.rs deleted file mode 100644 index 324aec23ab0..00000000000 --- a/src/test/ui/run-pass/issues/issue-3149.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] -// pretty-expanded FIXME #23616 - -fn Matrix4(m11: T, m12: T, m13: T, m14: T, - m21: T, m22: T, m23: T, m24: T, - m31: T, m32: T, m33: T, m34: T, - m41: T, m42: T, m43: T, m44: T) - -> Matrix4 { - Matrix4 { - m11: m11, m12: m12, m13: m13, m14: m14, - m21: m21, m22: m22, m23: m23, m24: m24, - m31: m31, m32: m32, m33: m33, m34: m34, - m41: m41, m42: m42, m43: m43, m44: m44 - } -} - -struct Matrix4 { - m11: T, m12: T, m13: T, m14: T, - m21: T, m22: T, m23: T, m24: T, - m31: T, m32: T, m33: T, m34: T, - m41: T, m42: T, m43: T, m44: T, -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-31597.rs b/src/test/ui/run-pass/issues/issue-31597.rs deleted file mode 100644 index 50aefb7d870..00000000000 --- a/src/test/ui/run-pass/issues/issue-31597.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Make { - type Out; - - fn make() -> Self::Out; -} - -impl Make for () { - type Out = (); - - fn make() -> Self::Out {} -} - -// Also make sure we don't hit an ICE when the projection can't be known -fn f() -> ::Out { loop {} } - -// ...and that it works with a blanket impl -trait Tr { - type Assoc; -} - -impl Tr for T { - type Assoc = (); -} - -fn g() -> ::Assoc { } - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-31702.rs b/src/test/ui/run-pass/issues/issue-31702.rs deleted file mode 100644 index 8ce06e8d343..00000000000 --- a/src/test/ui/run-pass/issues/issue-31702.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-31702-1.rs -// aux-build:issue-31702-2.rs -// ignore-test: FIXME(#31702) when this test was added it was thought that the -// accompanying llvm update would fix it, but -// unfortunately it appears that was not the case. In -// the interest of not deleting the test, though, -// this is just tagged with ignore-test - -// this test is actually entirely in the linked library crates - -extern crate issue_31702_1; -extern crate issue_31702_2; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-31776.rs b/src/test/ui/run-pass/issues/issue-31776.rs deleted file mode 100644 index db866b86a2a..00000000000 --- a/src/test/ui/run-pass/issues/issue-31776.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Various scenarios in which `pub` is required in blocks - -struct S; - -mod m { - fn f() { - impl ::S { - pub fn s(&self) {} - } - } -} - -// ------------------------------------------------------ - -pub trait Tr { - type A; -} -pub struct S1; - -fn f() { - pub struct Z; - - impl ::Tr for ::S1 { - type A = Z; // Private-in-public error unless `struct Z` is pub - } -} - -// ------------------------------------------------------ - -trait Tr1 { - type A; - fn pull(&self) -> Self::A; -} -struct S2; - -mod m1 { - fn f() { - pub struct Z { - pub field: u8 - } - - impl ::Tr1 for ::S2 { - type A = Z; - fn pull(&self) -> Self::A { Z{field: 10} } - } - } -} - -// ------------------------------------------------------ - -fn main() { - S.s(); // Privacy error, unless `fn s` is pub - let a = S2.pull().field; // Privacy error unless `field: u8` is pub -} diff --git a/src/test/ui/run-pass/issues/issue-32008.rs b/src/test/ui/run-pass/issues/issue-32008.rs deleted file mode 100644 index 7fccf09bdaa..00000000000 --- a/src/test/ui/run-pass/issues/issue-32008.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that binary operators allow subtyping on both the LHS and RHS, -// and as such do not introduce unnecessarily strict lifetime constraints. - -use std::ops::Add; - -struct Foo; - -impl<'a> Add<&'a Foo> for &'a Foo { - type Output = (); - fn add(self, rhs: &'a Foo) {} -} - -fn try_to_add(input: &Foo) { - let local = Foo; - - // Manual reborrow worked even with invariant trait search. - &*input + &local; - - // Direct use of the reference on the LHS requires additional - // subtyping before searching (invariantly) for `LHS: Add`. - input + &local; -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-3211.rs b/src/test/ui/run-pass/issues/issue-3211.rs deleted file mode 100644 index 8f90b710dae..00000000000 --- a/src/test/ui/run-pass/issues/issue-3211.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let mut x = 0; - for _ in 0..4096 { x += 1; } - assert_eq!(x, 4096); - println!("x = {}", x); -} diff --git a/src/test/ui/run-pass/issues/issue-3220.rs b/src/test/ui/run-pass/issues/issue-3220.rs deleted file mode 100644 index 2d32a08e37b..00000000000 --- a/src/test/ui/run-pass/issues/issue-3220.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 - -struct thing { x: isize, } - -impl Drop for thing { - fn drop(&mut self) {} -} - -fn thing() -> thing { - thing { - x: 0 - } -} - -impl thing { - pub fn f(self) {} -} - -pub fn main() { - let z = thing(); - (z).f(); -} diff --git a/src/test/ui/run-pass/issues/issue-32292.rs b/src/test/ui/run-pass/issues/issue-32292.rs deleted file mode 100644 index 856b7e2382b..00000000000 --- a/src/test/ui/run-pass/issues/issue-32292.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(warnings)] - -#[derive(Hash, Ord, PartialOrd, Eq, PartialEq, Debug, Clone, Copy)] -struct Foo; - -fn main() { - let _ = Foo; -} diff --git a/src/test/ui/run-pass/issues/issue-32324.rs b/src/test/ui/run-pass/issues/issue-32324.rs deleted file mode 100644 index 483ddaeb957..00000000000 --- a/src/test/ui/run-pass/issues/issue-32324.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -trait Resources { - type Buffer: Copy; -} - -#[derive(Copy, Clone)] -struct ConstantBufferSet( - pub R::Buffer -); - -#[derive(Copy, Clone)] -enum It {} -impl Resources for It { - type Buffer = u8; -} - -#[derive(Copy, Clone)] -enum Command { - BindConstantBuffers(ConstantBufferSet) -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-32389.rs b/src/test/ui/run-pass/issues/issue-32389.rs deleted file mode 100644 index 31e4a5c9e47..00000000000 --- a/src/test/ui/run-pass/issues/issue-32389.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo() -> T { loop {} } - -fn test() { - let ref mut a: &mut FnMut((i8,), i16) = foo(); - a((0,), 0); -} - -fn main() { - let _ = test; -} diff --git a/src/test/ui/run-pass/issues/issue-32518.rs b/src/test/ui/run-pass/issues/issue-32518.rs deleted file mode 100644 index bc8b11d3e66..00000000000 --- a/src/test/ui/run-pass/issues/issue-32518.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// no-prefer-dynamic -// aux-build:cgu_test.rs -// aux-build:cgu_test_a.rs -// aux-build:cgu_test_b.rs - -extern crate cgu_test_a; -extern crate cgu_test_b; - -fn main() { - cgu_test_a::a::a(); - cgu_test_b::a::a(); -} diff --git a/src/test/ui/run-pass/issues/issue-32805.rs b/src/test/ui/run-pass/issues/issue-32805.rs deleted file mode 100644 index 4c68bed4b05..00000000000 --- a/src/test/ui/run-pass/issues/issue-32805.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn const_mir() -> f32 { 9007199791611905.0 } - -fn main() { - let original = "9007199791611905.0"; // (1<<53)+(1<<29)+1 - let expected = "9007200000000000"; - - assert_eq!(const_mir().to_string(), expected); - assert_eq!(original.parse::().unwrap().to_string(), expected); -} diff --git a/src/test/ui/run-pass/issues/issue-3290.rs b/src/test/ui/run-pass/issues/issue-3290.rs deleted file mode 100644 index 02f27cbf483..00000000000 --- a/src/test/ui/run-pass/issues/issue-3290.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut x: Box<_> = box 3; - x = x; - assert_eq!(*x, 3); -} diff --git a/src/test/ui/run-pass/issues/issue-32947.rs b/src/test/ui/run-pass/issues/issue-32947.rs deleted file mode 100644 index 9b00a09338e..00000000000 --- a/src/test/ui/run-pass/issues/issue-32947.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten FIXME(#45351) - -#![feature(repr_simd, test)] - -extern crate test; - -#[repr(simd)] -pub struct Mu64(pub u64, pub u64, pub u64, pub u64); - -fn main() { - // This ensures an unaligned pointer even in optimized builds, though LLVM - // gets enough type information to actually not mess things up in that case, - // but at the time of writing this, it's enough to trigger the bug in - // non-optimized builds - unsafe { - let memory = &mut [0u64; 8] as *mut _ as *mut u8; - let misaligned_ptr: &mut [u8; 32] = { - std::mem::transmute(memory.offset(1)) - }; - *misaligned_ptr = std::mem::transmute(Mu64(1, 1, 1, 1)); - test::black_box(memory); - } -} diff --git a/src/test/ui/run-pass/issues/issue-33096.rs b/src/test/ui/run-pass/issues/issue-33096.rs deleted file mode 100644 index f89295c0627..00000000000 --- a/src/test/ui/run-pass/issues/issue-33096.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -g - -use std::ops::Deref; - -trait Foo { - fn foo() {} -} - -impl Foo for u8 {} - -fn bar() where T::Target: Foo { - <::Target as Foo>::foo() -} - -fn main() { - bar::<&u8>(); -} diff --git a/src/test/ui/run-pass/issues/issue-33185.rs b/src/test/ui/run-pass/issues/issue-33185.rs deleted file mode 100644 index 6268454658f..00000000000 --- a/src/test/ui/run-pass/issues/issue-33185.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -#[macro_export] -macro_rules! state { - ( $( $name:ident : $field:ty )* ) => ( - #[derive(Default)] - struct State { - $($name : $field),* - } - ) -} - -state! { x: i64 } - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-33187.rs b/src/test/ui/run-pass/issues/issue-33187.rs deleted file mode 100644 index a998a953b06..00000000000 --- a/src/test/ui/run-pass/issues/issue-33187.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo(::Data); - -impl Copy for Foo where ::Data: Copy { } -impl Clone for Foo where ::Data: Clone { - fn clone(&self) -> Self { Foo(self.0.clone()) } -} - -trait Repr { - type Data; -} - -impl Repr for A { - type Data = u32; -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-33202.rs b/src/test/ui/run-pass/issues/issue-33202.rs deleted file mode 100644 index 1101861c09e..00000000000 --- a/src/test/ui/run-pass/issues/issue-33202.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[repr(C)] -pub enum CPOption { - PSome(T), -} - -fn main() { - println!("sizeof CPOption {}", std::mem::size_of::>()); -} diff --git a/src/test/ui/run-pass/issues/issue-33264.rs b/src/test/ui/run-pass/issues/issue-33264.rs deleted file mode 100644 index 1c0ad2a659e..00000000000 --- a/src/test/ui/run-pass/issues/issue-33264.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// only-x86_64 - -#![allow(dead_code, non_upper_case_globals)] -#![feature(asm)] - -#[repr(C)] -pub struct D32x4(f32,f32,f32,f32); - -impl D32x4 { - fn add(&self, vec: Self) -> Self { - unsafe { - let ret: Self; - asm!(" - movaps $1, %xmm1 - movaps $2, %xmm2 - addps %xmm1, %xmm2 - movaps $xmm1, $0 - " - : "=r"(ret) - : "1"(self), "2"(vec) - : "xmm1", "xmm2" - ); - ret - } - } -} - -fn main() { } - diff --git a/src/test/ui/run-pass/issues/issue-33287.rs b/src/test/ui/run-pass/issues/issue-33287.rs deleted file mode 100644 index e99c53caa87..00000000000 --- a/src/test/ui/run-pass/issues/issue-33287.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const A: [u32; 1] = [0]; - -fn test() { - let range = A[1]..; -} - -fn main() { } - diff --git a/src/test/ui/run-pass/issues/issue-333.rs b/src/test/ui/run-pass/issues/issue-333.rs deleted file mode 100644 index 4c47ab77a48..00000000000 --- a/src/test/ui/run-pass/issues/issue-333.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn quux(x: T) -> T { let f = id::; return f(x); } - -fn id(x: T) -> T { return x; } - -pub fn main() { assert_eq!(quux(10), 10); } diff --git a/src/test/ui/run-pass/issues/issue-33387.rs b/src/test/ui/run-pass/issues/issue-33387.rs deleted file mode 100644 index def4059b9df..00000000000 --- a/src/test/ui/run-pass/issues/issue-33387.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(rustc_attrs)] - -use std::sync::Arc; - -trait Foo { - fn get(&self) -> [u8; 2]; -} - -impl Foo for [u8; 2] { - fn get(&self) -> [u8; 2] { - *self - } -} - -struct Bar(T); - -fn unsize_fat_ptr<'a>(x: &'a Bar) -> &'a Bar { - x -} - -fn unsize_nested_fat_ptr(x: Arc) -> Arc { - x -} - -fn main() { - let x: Box> = Box::new(Bar([1,2])); - assert_eq!(unsize_fat_ptr(&*x).0.get(), [1, 2]); - - let x: Arc = Arc::new([3, 4]); - assert_eq!(unsize_nested_fat_ptr(x).get(), [3, 4]); -} diff --git a/src/test/ui/run-pass/issues/issue-33461.rs b/src/test/ui/run-pass/issues/issue-33461.rs deleted file mode 100644 index 17938a38474..00000000000 --- a/src/test/ui/run-pass/issues/issue-33461.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::marker::PhantomData; - -struct TheType { - t: PhantomData -} - -pub trait TheTrait { - type TheAssociatedType; -} - -impl TheTrait for () { - type TheAssociatedType = (); -} - -pub trait Shape { - fn doit(&self) { - } -} - -impl Shape

for TheType { -} - -fn main() { - let ball = TheType { t: PhantomData }; - let handle: &Shape<()> = &ball; -} diff --git a/src/test/ui/run-pass/issues/issue-33498.rs b/src/test/ui/run-pass/issues/issue-33498.rs deleted file mode 100644 index e7e89083032..00000000000 --- a/src/test/ui/run-pass/issues/issue-33498.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let x = (0, 2); - - match x { - (0, ref y) => {} - (y, 0) => {} - _ => (), - } -} diff --git a/src/test/ui/run-pass/issues/issue-33537.rs b/src/test/ui/run-pass/issues/issue-33537.rs deleted file mode 100644 index 3ef1595b958..00000000000 --- a/src/test/ui/run-pass/issues/issue-33537.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -const fn foo() -> *const i8 { - b"foo" as *const _ as *const i8 -} - -const fn bar() -> i32 { - *&{(1, 2, 3).1} -} - -fn main() { - assert_eq!(foo(), b"foo" as *const _ as *const i8); - assert_eq!(bar(), 2); -} diff --git a/src/test/ui/run-pass/issues/issue-33687.rs b/src/test/ui/run-pass/issues/issue-33687.rs deleted file mode 100644 index e6841595916..00000000000 --- a/src/test/ui/run-pass/issues/issue-33687.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(unboxed_closures)] -#![feature(fn_traits)] - -struct Test; - -impl FnOnce<(u32, u32)> for Test { - type Output = u32; - - extern "rust-call" fn call_once(self, (a, b): (u32, u32)) -> u32 { - a + b - } -} - -fn main() { - assert_eq!(Test(1u32, 2u32), 3u32); -} diff --git a/src/test/ui/run-pass/issues/issue-33770.rs b/src/test/ui/run-pass/issues/issue-33770.rs deleted file mode 100644 index 5d1de986b47..00000000000 --- a/src/test/ui/run-pass/issues/issue-33770.rs +++ /dev/null @@ -1,104 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::process::{Command, Stdio}; -use std::env; -use std::sync::{Mutex, RwLock}; -use std::time::Duration; -use std::thread; - -fn test_mutex() { - let m = Mutex::new(0); - let _g = m.lock().unwrap(); - let _g2 = m.lock().unwrap(); -} - -fn test_try_mutex() { - let m = Mutex::new(0); - let _g = m.lock().unwrap(); - let _g2 = m.try_lock().unwrap(); -} - -fn test_rwlock_ww() { - let m = RwLock::new(0); - let _g = m.write().unwrap(); - let _g2 = m.write().unwrap(); -} - -fn test_try_rwlock_ww() { - let m = RwLock::new(0); - let _g = m.write().unwrap(); - let _g2 = m.try_write().unwrap(); -} - -fn test_rwlock_rw() { - let m = RwLock::new(0); - let _g = m.read().unwrap(); - let _g2 = m.write().unwrap(); -} - -fn test_try_rwlock_rw() { - let m = RwLock::new(0); - let _g = m.read().unwrap(); - let _g2 = m.try_write().unwrap(); -} - -fn test_rwlock_wr() { - let m = RwLock::new(0); - let _g = m.write().unwrap(); - let _g2 = m.read().unwrap(); -} - -fn test_try_rwlock_wr() { - let m = RwLock::new(0); - let _g = m.write().unwrap(); - let _g2 = m.try_read().unwrap(); -} - -fn main() { - let args: Vec = env::args().collect(); - if args.len() > 1 { - match &*args[1] { - "mutex" => test_mutex(), - "try_mutex" => test_try_mutex(), - "rwlock_ww" => test_rwlock_ww(), - "try_rwlock_ww" => test_try_rwlock_ww(), - "rwlock_rw" => test_rwlock_rw(), - "try_rwlock_rw" => test_try_rwlock_rw(), - "rwlock_wr" => test_rwlock_wr(), - "try_rwlock_wr" => test_try_rwlock_wr(), - _ => unreachable!(), - } - // If we reach this point then the test failed - println!("TEST FAILED: {}", args[1]); - } else { - let mut v = vec![]; - v.push(Command::new(&args[0]).arg("mutex").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("try_mutex").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("rwlock_ww").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("try_rwlock_ww").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("rwlock_rw").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("try_rwlock_rw").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("rwlock_wr").stderr(Stdio::null()).spawn().unwrap()); - v.push(Command::new(&args[0]).arg("try_rwlock_wr").stderr(Stdio::null()).spawn().unwrap()); - - thread::sleep(Duration::new(1, 0)); - - // Make sure all subprocesses either panicked or were killed because they deadlocked - for mut c in v { - c.kill().ok(); - assert!(!c.wait().unwrap().success()); - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-3389.rs b/src/test/ui/run-pass/issues/issue-3389.rs deleted file mode 100644 index 7102bb469e4..00000000000 --- a/src/test/ui/run-pass/issues/issue-3389.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct trie_node { - content: Vec , - children: Vec , -} - -fn print_str_vector(vector: Vec ) { - for string in &vector { - println!("{}", *string); - } -} - -pub fn main() { - let mut node: trie_node = trie_node { - content: Vec::new(), - children: Vec::new() - }; - let v = vec!["123".to_string(), "abc".to_string()]; - node.content = vec!["123".to_string(), "abc".to_string()]; - print_str_vector(v); - print_str_vector(node.content.clone()); - -} diff --git a/src/test/ui/run-pass/issues/issue-33903.rs b/src/test/ui/run-pass/issues/issue-33903.rs deleted file mode 100644 index df2f5e3e7a0..00000000000 --- a/src/test/ui/run-pass/issues/issue-33903.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 33903: -// Built-in indexing should be used even when the index is not -// trivially an integer -// Only built-in indexing can be used in constant expressions - -const FOO: i32 = [12, 34][0 + 1]; - -fn main() {} - diff --git a/src/test/ui/run-pass/issues/issue-33992.rs b/src/test/ui/run-pass/issues/issue-33992.rs deleted file mode 100644 index d10c11644d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-33992.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-windows -// ignore-macos - -#![feature(linkage)] - -#[linkage = "common"] -pub static mut TEST1: u32 = 0u32; - -#[linkage = "external"] -pub static TEST2: bool = true; - -#[linkage = "internal"] -pub static TEST3: bool = true; - -#[linkage = "linkonce"] -pub static TEST4: bool = true; - -#[linkage = "linkonce_odr"] -pub static TEST5: bool = true; - -#[linkage = "private"] -pub static TEST6: bool = true; - -#[linkage = "weak"] -pub static TEST7: bool = true; - -#[linkage = "weak_odr"] -pub static TEST8: bool = true; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-34053.rs b/src/test/ui/run-pass/issues/issue-34053.rs deleted file mode 100644 index fb6417ee870..00000000000 --- a/src/test/ui/run-pass/issues/issue-34053.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::sync::atomic::{AtomicUsize, ATOMIC_USIZE_INIT, Ordering}; - -static DROP_COUNTER: AtomicUsize = ATOMIC_USIZE_INIT; - -struct A(i32); - -impl Drop for A { - fn drop(&mut self) { - // update global drop count - DROP_COUNTER.fetch_add(1, Ordering::SeqCst); - } -} - -static FOO: A = A(123); -const BAR: A = A(456); - -impl A { - const BAZ: A = A(789); -} - -fn main() { - assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 0); - assert_eq!(&FOO.0, &123); - assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 0); - assert_eq!(BAR.0, 456); - assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 1); - assert_eq!(A::BAZ.0, 789); - assert_eq!(DROP_COUNTER.load(Ordering::SeqCst), 2); -} diff --git a/src/test/ui/run-pass/issues/issue-34074.rs b/src/test/ui/run-pass/issues/issue-34074.rs deleted file mode 100644 index 3f64cfd2e58..00000000000 --- a/src/test/ui/run-pass/issues/issue-34074.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Make sure several unnamed function parameters don't conflict with each other - -trait Tr { - #[allow(anonymous_parameters)] - fn f(u8, u8) {} -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-34194.rs b/src/test/ui/run-pass/issues/issue-34194.rs deleted file mode 100644 index dfc0a34651a..00000000000 --- a/src/test/ui/run-pass/issues/issue-34194.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -struct A { - a: &'static (), -} - -static B: &'static A = &A { a: &() }; -static C: &'static A = &B; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3424.rs b/src/test/ui/run-pass/issues/issue-3424.rs deleted file mode 100644 index 1e914eaee58..00000000000 --- a/src/test/ui/run-pass/issues/issue-3424.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -// rustc --test ignores2.rs && ./ignores2 - -pub struct Path; - -type rsrc_loader = Box Result>; - -fn tester() -{ - let mut loader: rsrc_loader = Box::new(move |_path| { - Ok("more blah".to_string()) - }); - - let path = Path; - assert!(loader(&path).is_ok()); -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3429.rs b/src/test/ui/run-pass/issues/issue-3429.rs deleted file mode 100644 index d6bc8739377..00000000000 --- a/src/test/ui/run-pass/issues/issue-3429.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let x = 1_usize; - let y = || x; - let _z = y(); -} diff --git a/src/test/ui/run-pass/issues/issue-34427.rs b/src/test/ui/run-pass/issues/issue-34427.rs deleted file mode 100644 index b43e9ff8b52..00000000000 --- a/src/test/ui/run-pass/issues/issue-34427.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #34427: On ARM, the code in `foo` at one time was generating -// a machine code instruction of the form: `str r0, [r0, rN]!` (for -// some N), which is not legal because the source register and base -// register cannot be identical in the preindexed form signalled by -// the `!`. -// -// See LLVM bug: https://llvm.org/bugs/show_bug.cgi?id=28809 - -#[inline(never)] -fn foo(n: usize) -> Vec> { - (0..n).map(|_| None).collect() -} - -fn main() { - let _ = (foo(10), foo(32)); -} diff --git a/src/test/ui/run-pass/issues/issue-3447.rs b/src/test/ui/run-pass/issues/issue-3447.rs deleted file mode 100644 index ff4642e47eb..00000000000 --- a/src/test/ui/run-pass/issues/issue-3447.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] -#![allow(non_camel_case_types)] -#![feature(box_syntax)] - -use std::cell::RefCell; - -static S: &'static str = "str"; - -struct list { - element: T, - next: Option>>> -} - -impl list { - pub fn addEnd(&mut self, element: T) { - let newList = list { - element: element, - next: None - }; - - self.next = Some(box RefCell::new(newList)); - } -} - -pub fn main() { - let ls = list { - element: S, - next: None - }; - println!("{}", ls.element); -} diff --git a/src/test/ui/run-pass/issues/issue-34503.rs b/src/test/ui/run-pass/issues/issue-34503.rs deleted file mode 100644 index b470518fd43..00000000000 --- a/src/test/ui/run-pass/issues/issue-34503.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - struct X; - trait Foo { - fn foo(&self) where (T, Option): Ord {} - fn bar(&self, x: &Option) -> bool - where Option: Ord { *x < *x } - } - impl Foo for () {} - let _ = &() as &Foo; -} diff --git a/src/test/ui/run-pass/issues/issue-34569.rs b/src/test/ui/run-pass/issues/issue-34569.rs deleted file mode 100644 index 1bdd56b15ab..00000000000 --- a/src/test/ui/run-pass/issues/issue-34569.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:-g - -// In this test we just want to make sure that the code below does not lead to -// a debuginfo verification assertion during compilation. This was caused by the -// closure in the guard being codegened twice due to how match expressions are -// handled. -// -// See https://github.com/rust-lang/rust/issues/34569 for details. - -fn main() { - match 0 { - e if (|| { e == 0 })() => {}, - 1 => {}, - _ => {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-34571.rs b/src/test/ui/run-pass/issues/issue-34571.rs deleted file mode 100644 index dbb85007be8..00000000000 --- a/src/test/ui/run-pass/issues/issue-34571.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[repr(u8)] -enum Foo { - Foo(u8), -} - -fn main() { - match Foo::Foo(1) { - _ => () - } -} diff --git a/src/test/ui/run-pass/issues/issue-34751.rs b/src/test/ui/run-pass/issues/issue-34751.rs deleted file mode 100644 index 382212a1908..00000000000 --- a/src/test/ui/run-pass/issues/issue-34751.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #34751 ICE: 'rustc' panicked at 'assertion failed: !substs.has_regions_escaping_depth(0)' - -#[allow(dead_code)] - -use std::marker::PhantomData; - -fn f<'a>(PhantomData::<&'a u8>: PhantomData<&'a u8>) {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-34780.rs b/src/test/ui/run-pass/issues/issue-34780.rs deleted file mode 100644 index b7f2871a8d1..00000000000 --- a/src/test/ui/run-pass/issues/issue-34780.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![feature(associated_consts)] - -use std::marker::PhantomData; - -trait Tr<'a> { - const C: PhantomData<&'a u8> = PhantomData::<&'a u8>; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-34784.rs b/src/test/ui/run-pass/issues/issue-34784.rs deleted file mode 100644 index 0a6a25c41d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-34784.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const C: *const u8 = &0; - -fn foo(x: *const u8) { - match x { - C => {} - _ => {} - } -} - -const D: *const [u8; 4] = b"abcd"; - -fn main() { - match D { - D => {} - _ => {} - } -} - diff --git a/src/test/ui/run-pass/issues/issue-34796.rs b/src/test/ui/run-pass/issues/issue-34796.rs deleted file mode 100644 index ea9172ae483..00000000000 --- a/src/test/ui/run-pass/issues/issue-34796.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test case exposes conditions where the encoding of a trait object type -// with projection predicates would differ between this crate and the upstream -// crate, because the predicates were encoded in different order within each -// crate. This led to different symbol hashes of functions using these type, -// which in turn led to linker errors because the two crates would not agree on -// the symbol name. -// The fix was to make the order in which predicates get encoded stable. - -// aux-build:issue34796aux.rs -extern crate issue34796aux; - -fn mk() -> T { loop {} } - -struct Data { - data: T, - error: E, -} - -fn main() { - issue34796aux::bar(|()| { - Data::<(), std::io::Error> { - data: mk(), - error: mk(), - } - }) -} diff --git a/src/test/ui/run-pass/issues/issue-34798.rs b/src/test/ui/run-pass/issues/issue-34798.rs deleted file mode 100644 index 33e78be4889..00000000000 --- a/src/test/ui/run-pass/issues/issue-34798.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![forbid(improper_ctypes)] -#![allow(dead_code)] - -#[repr(C)] -pub struct Foo { - size: u8, - __value: ::std::marker::PhantomData, -} - -#[repr(C)] -pub struct ZeroSizeWithPhantomData(::std::marker::PhantomData); - -#[repr(C)] -pub struct Bar { - size: u8, - baz: ZeroSizeWithPhantomData, -} - -extern "C" { - pub fn bar(_: *mut Foo, _: *mut Bar); -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-34932.rs b/src/test/ui/run-pass/issues/issue-34932.rs deleted file mode 100644 index 8f249c32110..00000000000 --- a/src/test/ui/run-pass/issues/issue-34932.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--test -// rustc-env:RUSTC_BOOTSTRAP_KEY= -#![cfg(any())] // This test should be configured away -#![feature(rustc_attrs)] // Test that this is allowed on stable/beta -#![feature(iter_arith_traits)] // Test that this is not unused -#![deny(unused_features)] - -#[test] -fn dummy() { - let () = "this should not reach type-checking"; -} diff --git a/src/test/ui/run-pass/issues/issue-3500.rs b/src/test/ui/run-pass/issues/issue-3500.rs deleted file mode 100644 index c4d3255cd30..00000000000 --- a/src/test/ui/run-pass/issues/issue-3500.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let x = &Some(1); - match x { - &Some(_) => (), - &None => (), - } -} diff --git a/src/test/ui/run-pass/issues/issue-35376.rs b/src/test/ui/run-pass/issues/issue-35376.rs deleted file mode 100644 index ee8c6c9f35c..00000000000 --- a/src/test/ui/run-pass/issues/issue-35376.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(specialization)] - -fn main() {} - -pub trait Alpha { } - -pub trait Beta { - type Event; -} - -pub trait Delta { - type Handle; - fn process(&self); -} - -pub struct Parent(A, T); - -impl Delta for Parent -where A: Alpha, - T: Delta, - T::Handle: Beta::Event> { - type Handle = Handle; - default fn process(&self) { - unimplemented!() - } -} - -impl Delta for Parent -where A: Alpha + Alpha, - T: Delta, - T::Handle: Beta::Event> { - fn process(&self) { - unimplemented!() - } -} - -pub struct Handle; - -impl Beta for Handle { - type Event = (); -} diff --git a/src/test/ui/run-pass/issues/issue-35423.rs b/src/test/ui/run-pass/issues/issue-35423.rs deleted file mode 100644 index 969925679fa..00000000000 --- a/src/test/ui/run-pass/issues/issue-35423.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main () { - let x = 4; - match x { - ref r if *r < 0 => println!("got negative num {} < 0", r), - e @ 1 ..= 100 => println!("got number within range [1,100] {}", e), - _ => println!("no"), - } -} diff --git a/src/test/ui/run-pass/issues/issue-35546.rs b/src/test/ui/run-pass/issues/issue-35546.rs deleted file mode 100644 index 9c39941232f..00000000000 --- a/src/test/ui/run-pass/issues/issue-35546.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #35546. Check that we are able to codegen -// this. Before we had problems because of the drop glue signature -// around dropping a trait object (specifically, when dropping the -// `value` field of `Node`). - -struct Node { - next: Option>>, - value: T, -} - -fn clear(head: &mut Option>>) { - match head.take() { - Some(node) => *head = node.next, - None => (), - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3556.rs b/src/test/ui/run-pass/issues/issue-3556.rs deleted file mode 100644 index b71d94adfeb..00000000000 --- a/src/test/ui/run-pass/issues/issue-3556.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(Debug)] -enum Token { - Text(String), - ETag(Vec, String), - UTag(Vec, String), - Section(Vec, bool, Vec, String, - String, String, String, String), - IncompleteSection(Vec, bool, String, bool), - Partial(String, String, String), -} - -fn check_strs(actual: &str, expected: &str) -> bool -{ - if actual != expected - { - println!("Found {}, but expected {}", actual, expected); - return false; - } - return true; -} - -pub fn main() -{ - let t = Token::Text("foo".to_string()); - let u = Token::Section(vec!["alpha".to_string()], - true, - vec![t], - "foo".to_string(), - "foo".to_string(), "foo".to_string(), "foo".to_string(), - "foo".to_string()); - let v = format!("{:?}", u); // this is the line that causes the seg fault - assert!(!v.is_empty()); -} diff --git a/src/test/ui/run-pass/issues/issue-3559.rs b/src/test/ui/run-pass/issues/issue-3559.rs deleted file mode 100644 index 8ca001691bb..00000000000 --- a/src/test/ui/run-pass/issues/issue-3559.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::HashMap; - -fn check_strs(actual: &str, expected: &str) -> bool { - if actual != expected { - println!("Found {}, but expected {}", actual, expected); - return false; - } - return true; -} - -pub fn main() { - let mut table = HashMap::new(); - table.insert("one".to_string(), 1); - table.insert("two".to_string(), 2); - assert!(check_strs(&format!("{:?}", table), "{\"one\": 1, \"two\": 2}") || - check_strs(&format!("{:?}", table), "{\"two\": 2, \"one\": 1}")); -} diff --git a/src/test/ui/run-pass/issues/issue-35600.rs b/src/test/ui/run-pass/issues/issue-35600.rs deleted file mode 100644 index 1083aa808cb..00000000000 --- a/src/test/ui/run-pass/issues/issue-35600.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - type bar; - fn bar(); -} - -impl Foo for () { - type bar = (); - fn bar() {} -} - -fn main() { - let x: <() as Foo>::bar = (); - <()>::bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-3563-2.rs b/src/test/ui/run-pass/issues/issue-3563-2.rs deleted file mode 100644 index 534bec59018..00000000000 --- a/src/test/ui/run-pass/issues/issue-3563-2.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Canvas { - fn add_point(&self, point: &isize); - fn add_points(&self, shapes: &[isize]) { - for pt in shapes { - self.add_point(pt) - } - } - -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3563-3.rs b/src/test/ui/run-pass/issues/issue-3563-3.rs deleted file mode 100644 index cd31abaca35..00000000000 --- a/src/test/ui/run-pass/issues/issue-3563-3.rs +++ /dev/null @@ -1,189 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// ASCII art shape renderer. Demonstrates traits, impls, operator overloading, -// non-copyable struct, unit testing. To run execute: rustc --test shapes.rs && -// ./shapes - -// Rust's std library is tightly bound to the language itself so it is -// automatically linked in. However the extra library is designed to be -// optional (for code that must run on constrained environments like embedded -// devices or special environments like kernel code) so it must be explicitly -// linked in. - -// Extern mod controls linkage. Use controls the visibility of names to modules -// that are already linked in. Using WriterUtil allows us to use the write_line -// method. - -use std::fmt; -use std::iter::repeat; -use std::slice; - -// Represents a position on a canvas. -#[derive(Copy, Clone)] -struct Point { - x: isize, - y: isize, -} - -// Represents an offset on a canvas. (This has the same structure as a Point. -// but different semantics). -#[derive(Copy, Clone)] -struct Size { - width: isize, - height: isize, -} - -#[derive(Copy, Clone)] -struct Rect { - top_left: Point, - size: Size, -} - -// Contains the information needed to do shape rendering via ASCII art. -struct AsciiArt { - width: usize, - height: usize, - fill: char, - lines: Vec > , - - // This struct can be quite large so we'll disable copying: developers need - // to either pass these structs around via references or move them. -} - -impl Drop for AsciiArt { - fn drop(&mut self) {} -} - -// It's common to define a constructor sort of function to create struct instances. -// If there is a canonical constructor it is typically named the same as the type. -// Other constructor sort of functions are typically named from_foo, from_bar, etc. -fn AsciiArt(width: usize, height: usize, fill: char) -> AsciiArt { - // Build a vector of vectors containing blank characters for each position in - // our canvas. - let lines = vec![vec!['.'; width]; height]; - - // Rust code often returns values by omitting the trailing semi-colon - // instead of using an explicit return statement. - AsciiArt {width: width, height: height, fill: fill, lines: lines} -} - -// Methods particular to the AsciiArt struct. -impl AsciiArt { - fn add_pt(&mut self, x: isize, y: isize) { - if x >= 0 && x < self.width as isize { - if y >= 0 && y < self.height as isize { - // Note that numeric types don't implicitly convert to each other. - let v = y as usize; - let h = x as usize; - - // Vector subscripting will normally copy the element, but &v[i] - // will return a reference which is what we need because the - // element is: - // 1) potentially large - // 2) needs to be modified - let row = &mut self.lines[v]; - row[h] = self.fill; - } - } - } -} - -// Allows AsciiArt to be converted to a string using the libcore ToString trait. -// Note that the %s fmt! specifier will not call this automatically. -impl fmt::Display for AsciiArt { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // Convert each line into a string. - let lines = self.lines.iter() - .map(|line| line.iter().cloned().collect()) - .collect::>(); - - // Concatenate the lines together using a new-line. - write!(f, "{}", lines.join("\n")) - } -} - -// This is similar to an interface in other languages: it defines a protocol which -// developers can implement for arbitrary concrete types. -trait Canvas { - fn add_point(&mut self, shape: Point); - fn add_rect(&mut self, shape: Rect); - - // Unlike interfaces traits support default implementations. - // Got an ICE as soon as I added this method. - fn add_points(&mut self, shapes: &[Point]) { - for pt in shapes {self.add_point(*pt)}; - } -} - -// Here we provide an implementation of the Canvas methods for AsciiArt. -// Other implementations could also be provided (e.g. for PDF or Apple's Quartz) -// and code can use them polymorphically via the Canvas trait. -impl Canvas for AsciiArt { - fn add_point(&mut self, shape: Point) { - self.add_pt(shape.x, shape.y); - } - - fn add_rect(&mut self, shape: Rect) { - // Add the top and bottom lines. - for x in shape.top_left.x..shape.top_left.x + shape.size.width { - self.add_pt(x, shape.top_left.y); - self.add_pt(x, shape.top_left.y + shape.size.height - 1); - } - - // Add the left and right lines. - for y in shape.top_left.y..shape.top_left.y + shape.size.height { - self.add_pt(shape.top_left.x, y); - self.add_pt(shape.top_left.x + shape.size.width - 1, y); - } - } -} - -// Rust's unit testing framework is currently a bit under-developed so we'll use -// this little helper. -pub fn check_strs(actual: &str, expected: &str) -> bool { - if actual != expected { - println!("Found:\n{}\nbut expected\n{}", actual, expected); - return false; - } - return true; -} - - -fn test_ascii_art_ctor() { - let art = AsciiArt(3, 3, '*'); - assert!(check_strs(&art.to_string(), "...\n...\n...")); -} - - -fn test_add_pt() { - let mut art = AsciiArt(3, 3, '*'); - art.add_pt(0, 0); - art.add_pt(0, -10); - art.add_pt(1, 2); - assert!(check_strs(&art.to_string(), "*..\n...\n.*.")); -} - - -fn test_shapes() { - let mut art = AsciiArt(4, 4, '*'); - art.add_rect(Rect {top_left: Point {x: 0, y: 0}, size: Size {width: 4, height: 4}}); - art.add_point(Point {x: 2, y: 2}); - assert!(check_strs(&art.to_string(), "****\n*..*\n*.**\n****")); -} - -pub fn main() { - test_ascii_art_ctor(); - test_add_pt(); - test_shapes(); -} diff --git a/src/test/ui/run-pass/issues/issue-3574.rs b/src/test/ui/run-pass/issues/issue-3574.rs deleted file mode 100644 index 1b5f80031b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-3574.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// rustc --test match_borrowed_str.rs.rs && ./match_borrowed_str.rs - - -fn compare(x: &str, y: &str) -> bool { - match x { - "foo" => y == "foo", - _ => y == "bar", - } -} - -pub fn main() { - assert!(compare("foo", "foo")); -} diff --git a/src/test/ui/run-pass/issues/issue-35815.rs b/src/test/ui/run-pass/issues/issue-35815.rs deleted file mode 100644 index 62bd6aa37fd..00000000000 --- a/src/test/ui/run-pass/issues/issue-35815.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; - -struct Foo { - a: i64, - b: bool, - c: T, -} - -fn main() { - let foo: &Foo = &Foo { a: 1, b: false, c: 2i32 }; - let foo_unsized: &Foo = foo; - assert_eq!(mem::size_of_val(foo), mem::size_of_val(foo_unsized)); -} diff --git a/src/test/ui/run-pass/issues/issue-36023.rs b/src/test/ui/run-pass/issues/issue-36023.rs deleted file mode 100644 index a654a813edf..00000000000 --- a/src/test/ui/run-pass/issues/issue-36023.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Deref; - -fn main() { - if env_var("FOOBAR").as_ref().map(Deref::deref).ok() == Some("yes") { - panic!() - } - - let env_home: Result = Ok("foo-bar-baz".to_string()); - let env_home = env_home.as_ref().map(Deref::deref).ok(); - - if env_home == Some("") { panic!() } -} - -#[inline(never)] -fn env_var(s: &str) -> Result { - Err(VarError::NotPresent) -} - -pub enum VarError { - NotPresent, - NotUnicode(String), -} diff --git a/src/test/ui/run-pass/issues/issue-36036-associated-type-layout.rs b/src/test/ui/run-pass/issues/issue-36036-associated-type-layout.rs deleted file mode 100644 index 772a936af86..00000000000 --- a/src/test/ui/run-pass/issues/issue-36036-associated-type-layout.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 36036: computing the layout of a type composed from another -// trait's associated type caused compiler to ICE when the associated -// type was allowed to be unsized, even though the known instantiated -// type is itself sized. - -#![allow(dead_code)] - -trait Context { - type Container: ?Sized; -} - -impl Context for u16 { - type Container = u8; -} - -struct Wrapper { - container: &'static C::Container -} - -fn foobar(_: Wrapper) {} - -static VALUE: u8 = 0; - -fn main() { - foobar(Wrapper { container: &VALUE }); -} diff --git a/src/test/ui/run-pass/issues/issue-36053.rs b/src/test/ui/run-pass/issues/issue-36053.rs deleted file mode 100644 index 3f1fa529d72..00000000000 --- a/src/test/ui/run-pass/issues/issue-36053.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #36053. ICE was caused due to obligations being -// added to a special, dedicated fulfillment cx during a -// probe. Problem seems to be related to the particular definition of -// `FusedIterator` in std but I was not able to isolate that into an -// external crate. - -use std::iter::FusedIterator; - -struct Thing<'a>(&'a str); -impl<'a> Iterator for Thing<'a> { - type Item = &'a str; - fn next(&mut self) -> Option<&'a str> { - None - } -} - -impl<'a> FusedIterator for Thing<'a> {} - -fn main() { - Thing("test").fuse().filter(|_| true).count(); -} diff --git a/src/test/ui/run-pass/issues/issue-36075.rs b/src/test/ui/run-pass/issues/issue-36075.rs deleted file mode 100644 index e11d35669f5..00000000000 --- a/src/test/ui/run-pass/issues/issue-36075.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait DeclarationParser { - type Declaration; -} - -struct DeclarationListParser<'i, I, P> - where P: DeclarationParser -{ - input: &'i (), - parser: P -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3609.rs b/src/test/ui/run-pass/issues/issue-3609.rs deleted file mode 100644 index 384964188db..00000000000 --- a/src/test/ui/run-pass/issues/issue-3609.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::thread; -use std::sync::mpsc::Sender; - -type RingBuffer = Vec ; -type SamplesFn = Box; - -enum Msg -{ - GetSamples(String, SamplesFn), // sample set name, callback which receives samples -} - -fn foo(name: String, samples_chan: Sender) { - thread::spawn(move|| { - let mut samples_chan = samples_chan; - - let callback: SamplesFn = Box::new(move |buffer| { - for i in 0..buffer.len() { - println!("{}: {}", i, buffer[i]) - } - }); - - samples_chan.send(Msg::GetSamples(name.clone(), callback)); - }).join(); -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-36139-normalize-closure-sig.rs b/src/test/ui/run-pass/issues/issue-36139-normalize-closure-sig.rs deleted file mode 100644 index 04693f4e615..00000000000 --- a/src/test/ui/run-pass/issues/issue-36139-normalize-closure-sig.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Previously the closure's argument would be inferred to -// >::Item, causing an error in MIR type -// checking - -trait ITrait<'a> {type Item;} - -struct S {} - -impl<'a> ITrait<'a> for S { type Item = &'a mut usize; } - -fn m(_: F) - where I: for<'a> ITrait<'a>, - F: for<'a> FnMut(>::Item) { } - - -fn main() { - m::(|x| { *x += 1; }); -} diff --git a/src/test/ui/run-pass/issues/issue-36260.rs b/src/test/ui/run-pass/issues/issue-36260.rs deleted file mode 100644 index 052fd9d8477..00000000000 --- a/src/test/ui/run-pass/issues/issue-36260.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Make sure this compiles without getting a linker error because of missing -// drop-glue because the collector missed adding drop-glue for the closure: - -fn create_fn() -> Box { - let text = String::new(); - - Box::new(move || { let _ = &text; }) -} - -fn main() { - let _ = create_fn(); -} diff --git a/src/test/ui/run-pass/issues/issue-36278-prefix-nesting.rs b/src/test/ui/run-pass/issues/issue-36278-prefix-nesting.rs deleted file mode 100644 index 41c01db076e..00000000000 --- a/src/test/ui/run-pass/issues/issue-36278-prefix-nesting.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 36278: On an unsized struct with >1 level of nontrivial -// nesting, ensure we are computing dynamic size of prefix correctly. - -use std::mem; - -const SZ: usize = 100; -struct P([u8; SZ], T); - -type Ack = P>; - -fn main() { - let size_of_sized; let size_of_unsized; - let x: Box> = Box::new(P([0; SZ], P([0; SZ], [0; 0]))); - size_of_sized = mem::size_of_val::>(&x); - let y: Box> = x; - size_of_unsized = mem::size_of_val::>(&y); - assert_eq!(size_of_sized, size_of_unsized); -} diff --git a/src/test/ui/run-pass/issues/issue-36381.rs b/src/test/ui/run-pass/issues/issue-36381.rs deleted file mode 100644 index e7e0dca4f64..00000000000 --- a/src/test/ui/run-pass/issues/issue-36381.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #36381. The monomorphization collector was asserting that -// there are no projection types, but the `<&str as -// StreamOnce>::Position` projection contained a late-bound region, -// and we don't currently normalize in that case until the function is -// actually invoked. - -pub trait StreamOnce { - type Position; -} - -impl<'a> StreamOnce for &'a str { - type Position = usize; -} - -pub fn parser(_: F) { -} - -fn follow(_: &str) -> <&str as StreamOnce>::Position { - panic!() -} - -fn main() { - parser(follow); -} diff --git a/src/test/ui/run-pass/issues/issue-36401.rs b/src/test/ui/run-pass/issues/issue-36401.rs deleted file mode 100644 index fb180a359dd..00000000000 --- a/src/test/ui/run-pass/issues/issue-36401.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -pub enum Event { - Key(u8), - Resize, - Unknown(u16), -} - -static XTERM_SINGLE_BYTES : [(u8, Event); 1] = [(1, Event::Resize)]; - -fn main() { - match XTERM_SINGLE_BYTES[0] { - (1, Event::Resize) => {}, - ref bad => panic!("unexpected {:?}", bad) - } -} diff --git a/src/test/ui/run-pass/issues/issue-36474.rs b/src/test/ui/run-pass/issues/issue-36474.rs deleted file mode 100644 index cfb136c1157..00000000000 --- a/src/test/ui/run-pass/issues/issue-36474.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - remove_axis(&3, 0); -} - -trait Dimension { - fn slice(&self) -> &[usize]; -} - -impl Dimension for () { - fn slice(&self) -> &[usize] { &[] } -} - -impl Dimension for usize { - fn slice(&self) -> &[usize] { - unsafe { - ::std::slice::from_raw_parts(self, 1) - } - } -} - -fn remove_axis(value: &usize, axis: usize) -> () { - let tup = (); - let mut it = tup.slice().iter(); - for (i, _) in value.slice().iter().enumerate() { - if i == axis { - continue; - } - it.next(); - } -} diff --git a/src/test/ui/run-pass/issues/issue-3656.rs b/src/test/ui/run-pass/issues/issue-3656.rs deleted file mode 100644 index 1e626e2e9c1..00000000000 --- a/src/test/ui/run-pass/issues/issue-3656.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// Issue #3656 -// Incorrect struct size computation in the FFI, because of not taking -// the alignment of elements into account. - -// pretty-expanded FIXME #23616 -// ignore-wasm32-bare no libc to test with - -#![feature(libc)] - -extern crate libc; -use libc::{c_uint, uint32_t, c_void}; - -pub struct KEYGEN { - hash_algorithm: [c_uint; 2], - count: uint32_t, - salt: *const c_void, - salt_size: uint32_t, -} - -extern { - // Bogus signature, just need to test if it compiles. - pub fn malloc(data: KEYGEN); -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-36744-bitcast-args-if-needed.rs b/src/test/ui/run-pass/issues/issue-36744-bitcast-args-if-needed.rs deleted file mode 100644 index 4a566d94a50..00000000000 --- a/src/test/ui/run-pass/issues/issue-36744-bitcast-args-if-needed.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This tests for an ICE (and, if ignored, subsequent LLVM abort) when -// a lifetime-parametric fn is passed into a context whose expected -// type has a differing lifetime parameterization. - -struct A<'a> { - _a: &'a i32, -} - -fn call(s: T, functions: &Vec fn(&'n T)>) { - for function in functions { - function(&s); - } -} - -fn f(a: &A) { println!("a holds {}", a._a); } - -fn main() { - let a = A { _a: &10 }; - - let vec: Vec fn(&'u A<'v>)> = vec![f]; - call(a, &vec); -} diff --git a/src/test/ui/run-pass/issues/issue-36744-without-calls.rs b/src/test/ui/run-pass/issues/issue-36744-without-calls.rs deleted file mode 100644 index ad54d6e403c..00000000000 --- a/src/test/ui/run-pass/issues/issue-36744-without-calls.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests for an LLVM abort when storing a lifetime-parametric fn into -// context that is expecting one that is not lifetime-parametric -// (i.e. has no `for <'_>`). - -pub struct A<'a>(&'a ()); -pub struct S(T); - -pub fn bad<'s>(v: &mut S)>, y: S fn(A<'b>)>) { - *v = y; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-36768.rs b/src/test/ui/run-pass/issues/issue-36768.rs deleted file mode 100644 index c6a76b2ca13..00000000000 --- a/src/test/ui/run-pass/issues/issue-36768.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--test -#![deny(private_in_public)] - -#[test] fn foo() {} -mod foo {} - -#[test] fn core() {} -extern crate core; diff --git a/src/test/ui/run-pass/issues/issue-36786-resolve-call.rs b/src/test/ui/run-pass/issues/issue-36786-resolve-call.rs deleted file mode 100644 index 51aa7906b94..00000000000 --- a/src/test/ui/run-pass/issues/issue-36786-resolve-call.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensure that types that rely on obligations are autoderefed -// correctly - -fn main() { - let x : Vec> = vec![Box::new(|| ())]; - x[0]() -} diff --git a/src/test/ui/run-pass/issues/issue-36792.rs b/src/test/ui/run-pass/issues/issue-36792.rs deleted file mode 100644 index 91e76140b82..00000000000 --- a/src/test/ui/run-pass/issues/issue-36792.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo() -> impl Copy { - foo -} -fn main() { - foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-36816.rs b/src/test/ui/run-pass/issues/issue-36816.rs deleted file mode 100644 index 292829b4d24..00000000000 --- a/src/test/ui/run-pass/issues/issue-36816.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! m { () => { 1 } } -macro_rules! n { () => { 1 + m!() } } - -fn main() { - let _: [u32; n!()] = [0, 0]; -} diff --git a/src/test/ui/run-pass/issues/issue-3683.rs b/src/test/ui/run-pass/issues/issue-3683.rs deleted file mode 100644 index 9b39577ec65..00000000000 --- a/src/test/ui/run-pass/issues/issue-3683.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - fn a(&self) -> isize; - fn b(&self) -> isize { - self.a() + 2 - } -} - -impl Foo for isize { - fn a(&self) -> isize { - 3 - } -} - -pub fn main() { - assert_eq!(3.b(), 5); -} diff --git a/src/test/ui/run-pass/issues/issue-36856.rs b/src/test/ui/run-pass/issues/issue-36856.rs deleted file mode 100644 index 9aebb900183..00000000000 --- a/src/test/ui/run-pass/issues/issue-36856.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #36856. - -// compile-flags:-g - -fn g() -> bool { - false -} - -pub fn main() { - let a = !g(); - if a != !g() { - panic!(); - } -} diff --git a/src/test/ui/run-pass/issues/issue-36936.rs b/src/test/ui/run-pass/issues/issue-36936.rs deleted file mode 100644 index da187ac173d..00000000000 --- a/src/test/ui/run-pass/issues/issue-36936.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that casts are not being treated as lexprs. - -fn main() { - let mut a = 0i32; - let b = &(a as i32); - a = 1; - assert_ne!(&a as *const i32, b as *const i32); - assert_eq!(*b, 0); - - assert_eq!(issue_36936(), 1); -} - - -struct A(u32); - -impl Drop for A { - fn drop(&mut self) { - self.0 = 0; - } -} - -fn issue_36936() -> u32 { - let a = &(A(1) as A); - a.0 -} diff --git a/src/test/ui/run-pass/issues/issue-36954.rs b/src/test/ui/run-pass/issues/issue-36954.rs deleted file mode 100644 index d12e9e41ee6..00000000000 --- a/src/test/ui/run-pass/issues/issue-36954.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-36954.rs - -extern crate issue_36954 as lib; - -fn main() { - let _ = lib::FOO; -} diff --git a/src/test/ui/run-pass/issues/issue-3702.rs b/src/test/ui/run-pass/issues/issue-3702.rs deleted file mode 100644 index 5ca851f8b77..00000000000 --- a/src/test/ui/run-pass/issues/issue-3702.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - trait Text { - fn to_string(&self) -> String; - } - - fn to_string(t: Box) { - println!("{}", (*t).to_string()); - } - -} diff --git a/src/test/ui/run-pass/issues/issue-37109.rs b/src/test/ui/run-pass/issues/issue-37109.rs deleted file mode 100644 index a683af9bbb2..00000000000 --- a/src/test/ui/run-pass/issues/issue-37109.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait ToRef<'a> { - type Ref: 'a; -} - -impl<'a, U: 'a> ToRef<'a> for U { - type Ref = &'a U; -} - -fn example<'a, T>(value: &'a T) -> (>::Ref, u32) { - (value, 0) -} - -fn main() { - example(&0); -} diff --git a/src/test/ui/run-pass/issues/issue-37175.rs b/src/test/ui/run-pass/issues/issue-37175.rs deleted file mode 100644 index a51f829abd8..00000000000 --- a/src/test/ui/run-pass/issues/issue-37175.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! m { (<$t:ty>) => { stringify!($t) } } -fn main() { - println!("{}", m!(>)); -} diff --git a/src/test/ui/run-pass/issues/issue-37222.rs b/src/test/ui/run-pass/issues/issue-37222.rs deleted file mode 100644 index af19a922fae..00000000000 --- a/src/test/ui/run-pass/issues/issue-37222.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug, PartialEq)] -enum Bar { - A(i64), - B(i32), - C, -} - -#[derive(Debug, PartialEq)] -struct Foo(Bar, u8); - -static FOO: [Foo; 2] = [Foo(Bar::C, 0), Foo(Bar::C, 0xFF)]; - -fn main() { - assert_eq!(&FOO[1], &Foo(Bar::C, 0xFF)); -} diff --git a/src/test/ui/run-pass/issues/issue-37291/auxiliary/lib.rs b/src/test/ui/run-pass/issues/issue-37291/auxiliary/lib.rs deleted file mode 100644 index 67cdea807be..00000000000 --- a/src/test/ui/run-pass/issues/issue-37291/auxiliary/lib.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -use std::ops::Mul; - -pub trait A {} -pub trait B { - type AT: A; -} -pub trait C { - type BT: B; -} - -pub struct AV; -impl A for AV {} - -pub struct BV; -impl B for BV { - type AT = AV; -} - -pub struct CV; -impl C for CV { - type BT = BV; -} - -pub struct WrapperB(pub T); -pub struct WrapperC(pub T); - -impl Mul::AT>> for WrapperC - where C1: C -{ - type Output = u8; - fn mul(self, _: WrapperB<::AT>) -> Self::Output { - loop {} - } -} -impl Mul> for WrapperC { - type Output = u8; - fn mul(self, _: WrapperC) -> Self::Output { - loop {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-37291/main.rs b/src/test/ui/run-pass/issues/issue-37291/main.rs deleted file mode 100644 index c30e87ad785..00000000000 --- a/src/test/ui/run-pass/issues/issue-37291/main.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:lib.rs - -// Regression test for #37291. The problem was that the starting -// environment for a specialization check was not including the -// where-clauses from the impl when attempting to normalize the impl's -// trait-ref, so things like `::Item` could not resolve, -// since the `C: Foo` trait bound was not included in the environment. - -extern crate lib; - -use lib::{CV, WrapperB, WrapperC}; - -fn main() { - let a = WrapperC(CV); - let b = WrapperC(CV); - if false { - let _ = a * b; - } -} diff --git a/src/test/ui/run-pass/issues/issue-3743.rs b/src/test/ui/run-pass/issues/issue-3743.rs deleted file mode 100644 index e884bc4d5c4..00000000000 --- a/src/test/ui/run-pass/issues/issue-3743.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// If `Mul` used an associated type for its output, this test would -// work more smoothly. - -use std::ops::Mul; - -#[derive(Copy, Clone)] -struct Vec2 { - x: f64, - y: f64 -} - -// methods we want to export as methods as well as operators -impl Vec2 { -#[inline(always)] - fn vmul(self, other: f64) -> Vec2 { - Vec2 { x: self.x * other, y: self.y * other } - } -} - -// Right-hand-side operator visitor pattern -trait RhsOfVec2Mul { - type Result; - - fn mul_vec2_by(&self, lhs: &Vec2) -> Self::Result; -} - -// Vec2's implementation of Mul "from the other side" using the above trait -impl> Mul for Vec2 { - type Output = Res; - - fn mul(self, rhs: Rhs) -> Res { rhs.mul_vec2_by(&self) } -} - -// Implementation of 'f64 as right-hand-side of Vec2::Mul' -impl RhsOfVec2Mul for f64 { - type Result = Vec2; - - fn mul_vec2_by(&self, lhs: &Vec2) -> Vec2 { lhs.vmul(*self) } -} - -// Usage with failing inference -pub fn main() { - let a = Vec2 { x: 3.0f64, y: 4.0f64 }; - - // the following compiles and works properly - let v1: Vec2 = a * 3.0f64; - println!("{} {}", v1.x, v1.y); - - // the following compiles but v2 will not be Vec2 yet and - // using it later will cause an error that the type of v2 - // must be known - let v2 = a * 3.0f64; - println!("{} {}", v2.x, v2.y); // error regarding v2's type -} diff --git a/src/test/ui/run-pass/issues/issue-3753.rs b/src/test/ui/run-pass/issues/issue-3753.rs deleted file mode 100644 index 7941b016d14..00000000000 --- a/src/test/ui/run-pass/issues/issue-3753.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #3656 -// Issue Name: pub method preceded by attribute can't be parsed -// Abstract: Visibility parsing failed when compiler parsing - -use std::f64; - -#[derive(Copy, Clone)] -pub struct Point { - x: f64, - y: f64 -} - -#[derive(Copy, Clone)] -pub enum Shape { - Circle(Point, f64), - Rectangle(Point, Point) -} - -impl Shape { - pub fn area(&self, sh: Shape) -> f64 { - match sh { - Shape::Circle(_, size) => f64::consts::PI * size * size, - Shape::Rectangle(Point {x, y}, Point {x: x2, y: y2}) => (x2 - x) * (y2 - y) - } - } -} - -pub fn main(){ - let s = Shape::Circle(Point { x: 1.0, y: 2.0 }, 3.0); - println!("{}", s.area(s)); -} diff --git a/src/test/ui/run-pass/issues/issue-37598.rs b/src/test/ui/run-pass/issues/issue-37598.rs deleted file mode 100644 index b5a11f5a0fd..00000000000 --- a/src/test/ui/run-pass/issues/issue-37598.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn check(list: &[u8]) { - match list { - &[] => {}, - &[_u1, _u2, ref _next..] => {}, - &[_u1] => {}, - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-37655.rs b/src/test/ui/run-pass/issues/issue-37655.rs deleted file mode 100644 index 899686befc2..00000000000 --- a/src/test/ui/run-pass/issues/issue-37655.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #37655. The problem was a false edge created by -// coercion that wound up requiring that `'a` (in `split()`) outlive -// `'b`, which shouldn't be necessary. - -#![allow(warnings)] - -trait SliceExt { - type Item; - - fn get_me(&self, index: I) -> &I::Output - where I: SliceIndex; -} - -impl SliceExt for [T] { - type Item = T; - - fn get_me(&self, index: I) -> &I::Output - where I: SliceIndex - { - panic!() - } -} - -pub trait SliceIndex { - type Output: ?Sized; -} - -impl SliceIndex for usize { - type Output = T; -} - -fn foo<'a, 'b>(split: &'b [&'a [u8]]) -> &'a [u8] { - split.get_me(0) -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-37686.rs b/src/test/ui/run-pass/issues/issue-37686.rs deleted file mode 100644 index 824f80c04f9..00000000000 --- a/src/test/ui/run-pass/issues/issue-37686.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - match (0, 0) { - (std::usize::MIN, std::usize::MAX) => {} - _ => {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-37725.rs b/src/test/ui/run-pass/issues/issue-37725.rs deleted file mode 100644 index ce952a7e520..00000000000 --- a/src/test/ui/run-pass/issues/issue-37725.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - fn foo(&self); -} - -fn foo<'a>(s: &'a mut ()) where &'a mut (): Foo { - s.foo(); -} -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-37733.rs b/src/test/ui/run-pass/issues/issue-37733.rs deleted file mode 100644 index 0b1b08d4e7b..00000000000 --- a/src/test/ui/run-pass/issues/issue-37733.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -type A = for<> fn(); - -type B = for<'a,> fn(); - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3794.rs b/src/test/ui/run-pass/issues/issue-3794.rs deleted file mode 100644 index 936e9db6715..00000000000 --- a/src/test/ui/run-pass/issues/issue-3794.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -trait T { - fn print(&self); -} - -#[derive(Debug)] -struct S { - s: isize, -} - -impl T for S { - fn print(&self) { - println!("{:?}", self); - } -} - -fn print_t(t: &T) { - t.print(); -} - -fn print_s(s: &S) { - s.print(); -} - -pub fn main() { - let s: Box = box S { s: 5 }; - print_s(&*s); - let t: Box = s as Box; - print_t(&*t); -} diff --git a/src/test/ui/run-pass/issues/issue-37991.rs b/src/test/ui/run-pass/issues/issue-37991.rs deleted file mode 100644 index 578c22fe232..00000000000 --- a/src/test/ui/run-pass/issues/issue-37991.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] - -const fn foo() -> i64 { - 3 -} - -const fn bar(x: i64) -> i64 { - x*2 -} - -fn main() { - let val = &(foo() % 2); - assert_eq!(*val, 1); - - let val2 = &(bar(1+1) % 3); - assert_eq!(*val2, 1); -} diff --git a/src/test/ui/run-pass/issues/issue-38002.rs b/src/test/ui/run-pass/issues/issue-38002.rs deleted file mode 100644 index 70892ba7d62..00000000000 --- a/src/test/ui/run-pass/issues/issue-38002.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that constant ADTs are codegened OK, part k of N. - -enum Bar { - C -} - -enum Foo { - A {}, - B { - y: usize, - z: Bar - }, -} - -const LIST: [(usize, Foo); 2] = [ - (51, Foo::B { y: 42, z: Bar::C }), - (52, Foo::B { y: 45, z: Bar::C }), -]; - -pub fn main() { - match LIST { - [ - (51, Foo::B { y: 42, z: Bar::C }), - (52, Foo::B { y: 45, z: Bar::C }) - ] => {} - _ => { - // I would want to print the enum here, but if - // the discriminant is garbage this causes an - // `unreachable` and silent process exit. - panic!("trivial match failed") - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-38033.rs b/src/test/ui/run-pass/issues/issue-38033.rs deleted file mode 100644 index 3f6ef26ed79..00000000000 --- a/src/test/ui/run-pass/issues/issue-38033.rs +++ /dev/null @@ -1,89 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::marker; -use std::mem; - -fn main() { - let workers = (0..0).map(|_| result::()); - drop(join_all(workers).poll()); -} - -trait Future { - type Item; - type Error; - - fn poll(&mut self) -> Result; -} - -trait IntoFuture { - type Future: Future; - type Item; - type Error; - - fn into_future(self) -> Self::Future; -} - -impl IntoFuture for F { - type Future = F; - type Item = F::Item; - type Error = F::Error; - - fn into_future(self) -> F { - self - } -} - -struct FutureResult { - _inner: marker::PhantomData<(T, E)>, -} - -fn result() -> FutureResult { - loop {} -} - -impl Future for FutureResult { - type Item = T; - type Error = E; - - fn poll(&mut self) -> Result { - loop {} - } -} - -struct JoinAll - where I: IntoIterator, - I::Item: IntoFuture, -{ - elems: Vec<::Item>, -} - -fn join_all(_: I) -> JoinAll - where I: IntoIterator, - I::Item: IntoFuture, -{ - JoinAll { elems: vec![] } -} - -impl Future for JoinAll - where I: IntoIterator, - I::Item: IntoFuture, -{ - type Item = Vec<::Item>; - type Error = ::Error; - - fn poll(&mut self) -> Result { - let elems = mem::replace(&mut self.elems, Vec::new()); - Ok(elems.into_iter().map(|e| { - e - }).collect::>()) - } -} diff --git a/src/test/ui/run-pass/issues/issue-38074.rs b/src/test/ui/run-pass/issues/issue-38074.rs deleted file mode 100644 index bae0f5fd3ff..00000000000 --- a/src/test/ui/run-pass/issues/issue-38074.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten FIXME(#45351) - -#![feature(platform_intrinsics, repr_simd)] - -extern "platform-intrinsic" { - fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; -} - -#[repr(simd)] -#[derive(Clone, Copy)] -#[allow(non_camel_case_types)] -struct u64x2(u64, u64); - -fn main() { - let a = u64x2(1, 2); - let r: u64x2 = unsafe { simd_shuffle2(a, a, [0-0, 0-0]) }; - assert_eq!(r.0, 1); - assert_eq!(r.1, 1); -} diff --git a/src/test/ui/run-pass/issues/issue-38091.rs b/src/test/ui/run-pass/issues/issue-38091.rs deleted file mode 100644 index 2e3cf210c4a..00000000000 --- a/src/test/ui/run-pass/issues/issue-38091.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(specialization)] - -trait Iterate<'a> { - type Ty: Valid; - fn iterate(self); -} -impl<'a, T> Iterate<'a> for T where T: Check { - default type Ty = (); - default fn iterate(self) {} -} - -trait Check {} -impl<'a, T> Check for T where >::Ty: Valid {} - -trait Valid {} - -fn main() { - Iterate::iterate(0); -} diff --git a/src/test/ui/run-pass/issues/issue-38190.rs b/src/test/ui/run-pass/issues/issue-38190.rs deleted file mode 100644 index 86bc2ba02b8..00000000000 --- a/src/test/ui/run-pass/issues/issue-38190.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_38190.rs -// ignore-pretty issue #37195 - -#[macro_use] -extern crate issue_38190; - -mod auxiliary { - m!([mod issue_38190;]); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-38226.rs b/src/test/ui/run-pass/issues/issue-38226.rs deleted file mode 100644 index d26807a4d68..00000000000 --- a/src/test/ui/run-pass/issues/issue-38226.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test makes sure that we don't run into a linker error because of the -// middle::reachable pass missing trait methods with default impls. - -// aux-build:issue_38226_aux.rs - -// Need -Cno-prepopulate-passes to really disable inlining, otherwise the faulty -// code gets optimized out: -// compile-flags: -Cno-prepopulate-passes -Cpasses=name-anon-globals - -extern crate issue_38226_aux; - -fn main() { - issue_38226_aux::foo::<()>(); -} diff --git a/src/test/ui/run-pass/issues/issue-38437.rs b/src/test/ui/run-pass/issues/issue-38437.rs deleted file mode 100644 index cea55270aa0..00000000000 --- a/src/test/ui/run-pass/issues/issue-38437.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that drop elaboration clears the "master" discriminant -// drop flag even if it protects no fields. - -struct Good(usize); -impl Drop for Good { - #[inline(never)] - fn drop(&mut self) { - println!("dropping Good({})", self.0); - } -} - -struct Void; -impl Drop for Void { - #[inline(never)] - fn drop(&mut self) { - panic!("Suddenly, a Void appears."); - } -} - -enum E { - Never(Void), - Fine(Good) -} - -fn main() { - let mut go = true; - - loop { - let next; - match go { - true => next = E::Fine(Good(123)), - false => return, - } - - match next { - E::Never(_) => return, - E::Fine(_good) => go = false, - } - - // `next` is dropped and StorageDead'd here. We must reset the - // discriminant's drop flag to avoid random variants being - // dropped. - } -} diff --git a/src/test/ui/run-pass/issues/issue-3847.rs b/src/test/ui/run-pass/issues/issue-3847.rs deleted file mode 100644 index 1342843f870..00000000000 --- a/src/test/ui/run-pass/issues/issue-3847.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -mod buildings { - pub struct Tower { pub height: usize } -} - -pub fn main() { - let sears = buildings::Tower { height: 1451 }; - let h: usize = match sears { - buildings::Tower { height: h } => { h } - }; - - println!("{}", h); -} diff --git a/src/test/ui/run-pass/issues/issue-38556.rs b/src/test/ui/run-pass/issues/issue-38556.rs deleted file mode 100644 index b1a30f910df..00000000000 --- a/src/test/ui/run-pass/issues/issue-38556.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Foo; - -macro_rules! reexport { - () => { use Foo as Bar; } -} - -reexport!(); - -fn main() { - use Bar; - fn f(_: Bar) {} -} diff --git a/src/test/ui/run-pass/issues/issue-38715.rs b/src/test/ui/run-pass/issues/issue-38715.rs deleted file mode 100644 index 8cc1d8af89c..00000000000 --- a/src/test/ui/run-pass/issues/issue-38715.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_38715.rs -// aux-build:issue_38715-modern.rs - -// Test that `#[macro_export] macro_rules!` shadow earlier `#[macro_export] macro_rules!` - -#[macro_use] -extern crate issue_38715; -#[macro_use] -extern crate issue_38715_modern; - -fn main() { - foo!(); - foo_modern!(); -} diff --git a/src/test/ui/run-pass/issues/issue-38727.rs b/src/test/ui/run-pass/issues/issue-38727.rs deleted file mode 100644 index 81e63476524..00000000000 --- a/src/test/ui/run-pass/issues/issue-38727.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[repr(u64)] -enum A { - A = 0u64, - B = !0u64, -} - -fn cmp() -> A { - A::B -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3874.rs b/src/test/ui/run-pass/issues/issue-3874.rs deleted file mode 100644 index 53a57c9943b..00000000000 --- a/src/test/ui/run-pass/issues/issue-3874.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum PureCounter { PureCounterVariant(usize) } - -fn each(thing: PureCounter, blk: F) where F: FnOnce(&usize) { - let PureCounter::PureCounterVariant(ref x) = thing; - blk(x); -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-38763.rs b/src/test/ui/run-pass/issues/issue-38763.rs deleted file mode 100644 index c488aa5ca1a..00000000000 --- a/src/test/ui/run-pass/issues/issue-38763.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten - -#[repr(C)] -pub struct Foo(i128); - -#[no_mangle] -pub extern "C" fn foo(x: Foo) -> Foo { x } - -fn main() { - foo(Foo(1)); -} diff --git a/src/test/ui/run-pass/issues/issue-3878.rs b/src/test/ui/run-pass/issues/issue-3878.rs deleted file mode 100644 index 9e073c749bb..00000000000 --- a/src/test/ui/run-pass/issues/issue-3878.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(path_statements)] -#![feature(box_syntax)] - -pub fn main() { - let y: Box<_> = box 1; - y; -} diff --git a/src/test/ui/run-pass/issues/issue-3888-2.rs b/src/test/ui/run-pass/issues/issue-3888-2.rs deleted file mode 100644 index 707145392c7..00000000000 --- a/src/test/ui/run-pass/issues/issue-3888-2.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { - &v[1..5] -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-38942.rs b/src/test/ui/run-pass/issues/issue-38942.rs deleted file mode 100644 index 740bf952828..00000000000 --- a/src/test/ui/run-pass/issues/issue-38942.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// See https://github.com/rust-lang/rust/issues/38942 - -#[repr(u64)] -pub enum NSEventType { - NSEventTypePressure, -} - -pub const A: u64 = NSEventType::NSEventTypePressure as u64; - -fn banana() -> u64 { - A -} - -fn main() { - println!("banana! {}", banana()); -} diff --git a/src/test/ui/run-pass/issues/issue-3895.rs b/src/test/ui/run-pass/issues/issue-3895.rs deleted file mode 100644 index 3620cb874f5..00000000000 --- a/src/test/ui/run-pass/issues/issue-3895.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - enum State { BadChar, BadSyntax } - - match State::BadChar { - _ if true => State::BadChar, - State::BadChar | State::BadSyntax => panic!() , - }; -} diff --git a/src/test/ui/run-pass/issues/issue-38987.rs b/src/test/ui/run-pass/issues/issue-38987.rs deleted file mode 100644 index ef89ed6fee4..00000000000 --- a/src/test/ui/run-pass/issues/issue-38987.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - let _ = -0x8000_0000_0000_0000_0000_0000_0000_0000i128; -} diff --git a/src/test/ui/run-pass/issues/issue-3904.rs b/src/test/ui/run-pass/issues/issue-3904.rs deleted file mode 100644 index 1f5b777c4d2..00000000000 --- a/src/test/ui/run-pass/issues/issue-3904.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn example_err(prog: &str, arg: &str) { - println!("{}: {}", prog, arg) -} - -fn exit(print: F, prog: &str, arg: &str) where F: FnOnce(&str, &str) { - print(prog, arg); -} - -struct X where F: FnOnce(&str, &str) { - err: F, -} - -impl X where F: FnOnce(&str, &str) { - pub fn boom(self) { - exit(self.err, "prog", "arg"); - } -} - -pub fn main(){ - let val = X { - err: example_err, - }; - val.boom(); -} diff --git a/src/test/ui/run-pass/issues/issue-39089.rs b/src/test/ui/run-pass/issues/issue-39089.rs deleted file mode 100644 index e4ace4299bd..00000000000 --- a/src/test/ui/run-pass/issues/issue-39089.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn f Sized>() {} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-39292.rs b/src/test/ui/run-pass/issues/issue-39292.rs deleted file mode 100644 index 4b79e08f334..00000000000 --- a/src/test/ui/run-pass/issues/issue-39292.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #39292. The object vtable was being -// incorrectly left with a null pointer. - -trait Foo { - fn print<'a>(&'a self) where T: 'a { println!("foo"); } -} - -impl<'a> Foo<&'a ()> for () { } - -trait Bar: for<'a> Foo<&'a ()> { } - -impl Bar for () {} - -fn main() { - (&() as &Bar).print(); // Segfault -} diff --git a/src/test/ui/run-pass/issues/issue-3935.rs b/src/test/ui/run-pass/issues/issue-3935.rs deleted file mode 100644 index 756bc7b5797..00000000000 --- a/src/test/ui/run-pass/issues/issue-3935.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(PartialEq)] -struct Bike { - name: String, -} - -pub fn main() { - let town_bike = Bike { name: "schwinn".to_string() }; - let my_bike = Bike { name: "surly".to_string() }; - - assert!(town_bike != my_bike); -} diff --git a/src/test/ui/run-pass/issues/issue-39367.rs b/src/test/ui/run-pass/issues/issue-39367.rs deleted file mode 100644 index 4f6ed57a7ae..00000000000 --- a/src/test/ui/run-pass/issues/issue-39367.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Deref; - -struct ArenaSet::Target>(U, &'static V) - where V: 'static + ?Sized; - -static Z: [u8; 4] = [1,2,3,4]; - -fn arena() -> &'static ArenaSet> { - fn __static_ref_initialize() -> ArenaSet> { - ArenaSet(vec![], &Z) - } - unsafe { - use std::sync::{Once, ONCE_INIT}; - fn require_sync(_: &T) { } - unsafe fn __stability() -> &'static ArenaSet> { - use std::mem::transmute; - use std::boxed::Box; - static mut DATA: *const ArenaSet> = 0 as *const ArenaSet>; - - static mut ONCE: Once = ONCE_INIT; - ONCE.call_once(|| { - DATA = transmute - ::>>, *const ArenaSet>> - (Box::new(__static_ref_initialize())); - }); - - &*DATA - } - let static_ref = __stability(); - require_sync(static_ref); - static_ref - } -} - -fn main() { - let &ArenaSet(ref u, v) = arena(); - assert!(u.is_empty()); - assert_eq!(v, Z); -} diff --git a/src/test/ui/run-pass/issues/issue-39467.rs b/src/test/ui/run-pass/issues/issue-39467.rs deleted file mode 100644 index 3fab06d9a68..00000000000 --- a/src/test/ui/run-pass/issues/issue-39467.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! expr { () => { () } } - -enum A {} - -impl A { - const A: () = expr!(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-39548.rs b/src/test/ui/run-pass/issues/issue-39548.rs deleted file mode 100644 index 28bf971c830..00000000000 --- a/src/test/ui/run-pass/issues/issue-39548.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -type Array = [(); ((1 < 2) == false) as usize]; - -fn main() { - let _: Array = []; -} diff --git a/src/test/ui/run-pass/issues/issue-39709.rs b/src/test/ui/run-pass/issues/issue-39709.rs deleted file mode 100644 index 44caa644edf..00000000000 --- a/src/test/ui/run-pass/issues/issue-39709.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - println!("{}", { macro_rules! x { ($(t:tt)*) => {} } 33 }); -} - diff --git a/src/test/ui/run-pass/issues/issue-39720.rs b/src/test/ui/run-pass/issues/issue-39720.rs deleted file mode 100644 index 157cc41cdd3..00000000000 --- a/src/test/ui/run-pass/issues/issue-39720.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// ignore-emscripten FIXME(#45351) - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(C)] -#[repr(simd)] -#[derive(Copy, Clone, Debug)] -pub struct char3(pub i8, pub i8, pub i8); - -#[repr(C)] -#[repr(simd)] -#[derive(Copy, Clone, Debug)] -pub struct short3(pub i16, pub i16, pub i16); - -extern "platform-intrinsic" { - fn simd_cast(x: T) -> U; -} - -fn main() { - let cast: short3 = unsafe { simd_cast(char3(10, -3, -9)) }; - - println!("{:?}", cast); -} diff --git a/src/test/ui/run-pass/issues/issue-39720.stderr b/src/test/ui/run-pass/issues/issue-39720.stderr deleted file mode 100644 index 7b717d86335..00000000000 --- a/src/test/ui/run-pass/issues/issue-39720.stderr +++ /dev/null @@ -1,16 +0,0 @@ -warning[E0566]: conflicting representation hints - --> $DIR/issue-39720.rs:18:8 - | -LL | #[repr(C)] - | ^ -LL | #[repr(simd)] - | ^^^^ - -warning[E0566]: conflicting representation hints - --> $DIR/issue-39720.rs:23:8 - | -LL | #[repr(C)] - | ^ -LL | #[repr(simd)] - | ^^^^ - diff --git a/src/test/ui/run-pass/issues/issue-3979-2.rs b/src/test/ui/run-pass/issues/issue-3979-2.rs deleted file mode 100644 index 9b8e5817c6c..00000000000 --- a/src/test/ui/run-pass/issues/issue-3979-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait A { - fn a_method(&self); -} - -trait B: A { - fn b_method(&self); -} - -trait C: B { - fn c_method(&self) { - self.a_method(); - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-3979-generics.rs b/src/test/ui/run-pass/issues/issue-3979-generics.rs deleted file mode 100644 index 7766d7d1bdc..00000000000 --- a/src/test/ui/run-pass/issues/issue-3979-generics.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -use std::ops::Add; - -trait Positioned { - fn SetX(&mut self, _: S); - fn X(&self) -> S; -} - -trait Movable>: Positioned { - fn translate(&mut self, dx: S) { - let x = self.X() + dx; - self.SetX(x); - } -} - -struct Point { x: isize, y: isize } - -impl Positioned for Point { - fn SetX(&mut self, x: isize) { - self.x = x; - } - fn X(&self) -> isize { - self.x - } -} - -impl Movable for Point {} - -pub fn main() { - let mut p = Point{ x: 1, y: 2}; - p.translate(3); - assert_eq!(p.X(), 4); -} diff --git a/src/test/ui/run-pass/issues/issue-3979-xcrate.rs b/src/test/ui/run-pass/issues/issue-3979-xcrate.rs deleted file mode 100644 index d698e7ac775..00000000000 --- a/src/test/ui/run-pass/issues/issue-3979-xcrate.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_3979_traits.rs - -extern crate issue_3979_traits; -use issue_3979_traits::{Positioned, Movable}; - -struct Point { x: isize, y: isize } - -impl Positioned for Point { - fn SetX(&mut self, x: isize) { - self.x = x; - } - fn X(&self) -> isize { - self.x - } -} - -impl Movable for Point {} - -pub fn main() { - let mut p = Point{ x: 1, y: 2}; - p.translate(3); - assert_eq!(p.X(), 4); -} diff --git a/src/test/ui/run-pass/issues/issue-3979.rs b/src/test/ui/run-pass/issues/issue-3979.rs deleted file mode 100644 index 4cc2e882baa..00000000000 --- a/src/test/ui/run-pass/issues/issue-3979.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -trait Positioned { - fn SetX(&mut self, _: isize); - fn X(&self) -> isize; -} - -trait Movable: Positioned { - fn translate(&mut self, dx: isize) { - let x = self.X(); - self.SetX(x + dx); - } -} - -struct Point { x: isize, y: isize } - -impl Positioned for Point { - fn SetX(&mut self, x: isize) { - self.x = x; - } - fn X(&self) -> isize { - self.x - } -} - -impl Movable for Point {} - -pub fn main() { - let mut p = Point{ x: 1, y: 2}; - p.translate(3); - assert_eq!(p.X(), 4); -} diff --git a/src/test/ui/run-pass/issues/issue-39808.rs b/src/test/ui/run-pass/issues/issue-39808.rs deleted file mode 100644 index 78c67302a99..00000000000 --- a/src/test/ui/run-pass/issues/issue-39808.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unreachable_code)] - -// Regression test for #39808. The type parameter of `Owned` was -// considered to be "unconstrained" because the type resulting from -// `format!` (`String`) was not being propagated upward, owing to the -// fact that the expression diverges. - -use std::borrow::Cow; - -fn main() { - let _ = if false { - Cow::Owned(format!("{:?}", panic!())) - } else { - Cow::Borrowed("") - }; -} diff --git a/src/test/ui/run-pass/issues/issue-39823.rs b/src/test/ui/run-pass/issues/issue-39823.rs deleted file mode 100644 index 4a2e4846a59..00000000000 --- a/src/test/ui/run-pass/issues/issue-39823.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_39823.rs - -extern crate issue_39823; -use issue_39823::{RemoteC, RemoteG}; - -#[derive(Debug, PartialEq)] -struct LocalC(u32); - -#[derive(Debug, PartialEq)] -struct LocalG(T); - -fn main() { - let virtual_localc : &Fn(_) -> LocalC = &LocalC; - assert_eq!(virtual_localc(1), LocalC(1)); - - let virtual_localg : &Fn(_) -> LocalG = &LocalG; - assert_eq!(virtual_localg(1), LocalG(1)); - - let virtual_remotec : &Fn(_) -> RemoteC = &RemoteC; - assert_eq!(virtual_remotec(1), RemoteC(1)); - - let virtual_remoteg : &Fn(_) -> RemoteG = &RemoteG; - assert_eq!(virtual_remoteg(1), RemoteG(1)); -} diff --git a/src/test/ui/run-pass/issues/issue-39827.rs b/src/test/ui/run-pass/issues/issue-39827.rs deleted file mode 100644 index c7b2a0d4fc0..00000000000 --- a/src/test/ui/run-pass/issues/issue-39827.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] - -use std::intrinsics::{ volatile_copy_memory, volatile_store, volatile_load, - volatile_copy_nonoverlapping_memory, - volatile_set_memory }; - -// -// This test ensures that volatile intrinsics can be specialised with -// zero-sized types and, in case of copy/set functions, can accept -// number of elements equal to zero. -// -fn main () { - let mut dst_pair = (1, 2); - let src_pair = (3, 4); - let mut dst_empty = (); - let src_empty = (); - - const COUNT_0: usize = 0; - const COUNT_100: usize = 100; - - unsafe { - volatile_copy_memory(&mut dst_pair, &dst_pair, COUNT_0); - volatile_copy_nonoverlapping_memory(&mut dst_pair, &src_pair, 0); - volatile_copy_memory(&mut dst_empty, &dst_empty, 100); - volatile_copy_nonoverlapping_memory(&mut dst_empty, &src_empty, - COUNT_100); - volatile_set_memory(&mut dst_empty, 0, COUNT_100); - volatile_set_memory(&mut dst_pair, 0, COUNT_0); - volatile_store(&mut dst_empty, ()); - volatile_store(&mut dst_empty, src_empty); - volatile_load(&src_empty); - } -} diff --git a/src/test/ui/run-pass/issues/issue-3991.rs b/src/test/ui/run-pass/issues/issue-3991.rs deleted file mode 100644 index d3efcaf636e..00000000000 --- a/src/test/ui/run-pass/issues/issue-3991.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -struct HasNested { - nest: Vec > , -} - -impl HasNested { - fn method_push_local(&mut self) { - self.nest[0].push(0); - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-39984.rs b/src/test/ui/run-pass/issues/issue-39984.rs deleted file mode 100644 index 450620da35a..00000000000 --- a/src/test/ui/run-pass/issues/issue-39984.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #39984. -// -// The key here is that the error type of the `Ok` call ought to be -// constrained to `String`, even though it is dead-code. - -fn main() {} - -fn t() -> Result<(), String> { - return Err("".into()); - Ok(()) -} diff --git a/src/test/ui/run-pass/issues/issue-40003.rs b/src/test/ui/run-pass/issues/issue-40003.rs deleted file mode 100644 index cf18ab47c39..00000000000 --- a/src/test/ui/run-pass/issues/issue-40003.rs +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - if false { test(); } -} - -fn test() { - let rx = Err::, u32>(1).into_future(); - - rx.map(|l: Vec| stream::iter(l.into_iter().map(|i| Ok(i)))) - .flatten_stream() - .chunks(50) - .buffer_unordered(5); -} - -use future::{Future, IntoFuture}; -mod future { - use std::result; - - use {stream, Stream}; - - pub trait Future { - type Item; - type Error; - - fn map(self, _: F) -> Map - where F: FnOnce(Self::Item) -> U, - Self: Sized, - { - panic!() - } - - fn flatten_stream(self) -> FlattenStream - where ::Item: stream::Stream, - Self: Sized - { - panic!() - } - } - - pub trait IntoFuture { - type Future: Future; - type Item; - type Error; - fn into_future(self) -> Self::Future; - } - - impl IntoFuture for F { - type Future = F; - type Item = F::Item; - type Error = F::Error; - - fn into_future(self) -> F { - panic!() - } - } - - impl IntoFuture for result::Result { - type Future = FutureResult; - type Item = T; - type Error = E; - - fn into_future(self) -> FutureResult { - panic!() - } - } - - pub struct Map { - _a: (A, F), - } - - impl Future for Map - where A: Future, - F: FnOnce(A::Item) -> U, - { - type Item = U; - type Error = A::Error; - } - - pub struct FlattenStream { - _f: F, - } - - impl Stream for FlattenStream - where F: Future, - ::Item: Stream, - { - type Item = ::Item; - type Error = ::Error; - } - - pub struct FutureResult { - _inner: (T, E), - } - - impl Future for FutureResult { - type Item = T; - type Error = E; - } -} - -mod stream { - use IntoFuture; - - pub trait Stream { - type Item; - type Error; - - fn buffer_unordered(self, amt: usize) -> BufferUnordered - where Self::Item: IntoFuture::Error>, - Self: Sized - { - new(self, amt) - } - - fn chunks(self, _capacity: usize) -> Chunks - where Self: Sized - { - panic!() - } - } - - pub struct IterStream { - _iter: I, - } - - pub fn iter(_: J) -> IterStream - where J: IntoIterator>, - { - panic!() - } - - impl Stream for IterStream - where I: Iterator>, - { - type Item = T; - type Error = E; - } - - pub struct Chunks { - _stream: S - } - - impl Stream for Chunks - where S: Stream - { - type Item = Result::Item>, u32>; - type Error = ::Error; - } - - pub struct BufferUnordered { - _stream: S, - } - - enum Slot { - Next(usize), - _Data { _a: T }, - } - - fn new(_s: S, _amt: usize) -> BufferUnordered - where S: Stream, - S::Item: IntoFuture::Error>, - { - (0..0).map(|_| { - Slot::Next::<::Future>(1) - }).collect::>(); - panic!() - } - - impl Stream for BufferUnordered - where S: Stream, - S::Item: IntoFuture::Error>, - { - type Item = ::Item; - type Error = ::Error; - } -} -use stream::Stream; diff --git a/src/test/ui/run-pass/issues/issue-40085.rs b/src/test/ui/run-pass/issues/issue-40085.rs deleted file mode 100644 index 062366941d9..00000000000 --- a/src/test/ui/run-pass/issues/issue-40085.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Index; -fn bar() {} -static UNIT: () = (); -struct S; -impl Index for S { - type Output = (); - fn index(&self, _: fn()) -> &() { &UNIT } -} -fn main() { - S.index(bar); - S[bar]; -} diff --git a/src/test/ui/run-pass/issues/issue-40136.rs b/src/test/ui/run-pass/issues/issue-40136.rs deleted file mode 100644 index 5c1a527dbeb..00000000000 --- a/src/test/ui/run-pass/issues/issue-40136.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! m { () => { 0 } } - -trait T { - const C: i32 = m!(); -} - -struct S; -impl S { - const C: i32 = m!(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-40235.rs b/src/test/ui/run-pass/issues/issue-40235.rs deleted file mode 100644 index 3c26183f146..00000000000 --- a/src/test/ui/run-pass/issues/issue-40235.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo() {} - -fn main() { - while let Some(foo) = Some(1) { break } - foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-4025.rs b/src/test/ui/run-pass/issues/issue-4025.rs deleted file mode 100644 index f216ba9b9c9..00000000000 --- a/src/test/ui/run-pass/issues/issue-4025.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -/* -# if b { x } else { y } requires identical types for x and y -*/ - -fn print1(b: bool, s1: &str, s2: &str) { - println!("{}", if b { s1 } else { s2 }); -} -fn print2<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { - println!("{}", if b { s1 } else { s2 }); -} -fn print3(b: bool, s1: &str, s2: &str) { - let mut s: &str; - if b { s = s1; } else { s = s2; } - println!("{}", s); -} -fn print4<'a, 'b>(b: bool, s1: &'a str, s2: &'b str) { - let mut s: &str; - if b { s = s1; } else { s = s2; } - println!("{}", s); -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-40408.rs b/src/test/ui/run-pass/issues/issue-40408.rs deleted file mode 100644 index 68f2858df47..00000000000 --- a/src/test/ui/run-pass/issues/issue-40408.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - println!("{}", 0E+10); - println!("{}", 0e+10); - println!("{}", 00e+10); - println!("{}", 00E+10); -} diff --git a/src/test/ui/run-pass/issues/issue-40469.rs b/src/test/ui/run-pass/issues/issue-40469.rs deleted file mode 100644 index fd0ad2d0e08..00000000000 --- a/src/test/ui/run-pass/issues/issue-40469.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -#![allow(dead_code)] - -include!("auxiliary/issue_40469.rs"); -fn f() { m!(); } - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-40770.rs b/src/test/ui/run-pass/issues/issue-40770.rs deleted file mode 100644 index d27b13c3a10..00000000000 --- a/src/test/ui/run-pass/issues/issue-40770.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! m { - ($e:expr) => { - macro_rules! n { () => { $e } } - } -} - -fn main() { - m!(foo!()); -} diff --git a/src/test/ui/run-pass/issues/issue-40847.rs b/src/test/ui/run-pass/issues/issue-40847.rs deleted file mode 100644 index 4d18cd6c7de..00000000000 --- a/src/test/ui/run-pass/issues/issue-40847.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! gen { - ($name:ident ( $($dol:tt $var:ident)* ) $($body:tt)*) => { - macro_rules! $name { - ($($dol $var:ident)*) => { - $($body)* - } - } - } -} - -gen!(m($var) $var); - -fn main() { - let x = 1; - assert_eq!(m!(x), 1); -} diff --git a/src/test/ui/run-pass/issues/issue-40883.rs b/src/test/ui/run-pass/issues/issue-40883.rs deleted file mode 100644 index 357152b60e5..00000000000 --- a/src/test/ui/run-pass/issues/issue-40883.rs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check that we don't have linear stack usage with multiple calls to `push` - -#![feature(test)] - -extern crate test; -use std::mem; - -fn meal() -> Big { - if test::black_box(false) { - panic!() - } - Big { drop_me: [ - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - None, None, None, None, None, None, None, None, - ]} -} - -pub struct Big { - drop_me: [Option>; 48], -} - -#[inline] -fn push(out: &mut Vec) { - out.push(meal()); -} - -#[inline(never)] -pub fn supersize_me(out: &mut Vec) { - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); // 16 calls to `push` - - verify_stack_usage(out); - - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); - push(out); // 16 calls to `push` -} - -#[inline(never)] -fn verify_stack_usage(before_ptr: *mut Vec) { - // to check stack usage, create locals before and after - // and check the difference in addresses between them. - let mut stack_var: Vec = vec![]; - test::black_box(&mut stack_var); - let stack_usage = isize::abs( - (&mut stack_var as *mut _ as isize) - - (before_ptr as isize)) as usize; - // give space for 2 copies of `Big` + 128 "misc" bytes. - if stack_usage > mem::size_of::() * 2 + 128 { - panic!("used {} bytes of stack, but `struct Big` is only {} bytes", - stack_usage, mem::size_of::()); - } - -} - -pub fn main() { - let mut v = vec![]; - test::black_box(&mut v); - supersize_me(&mut v); -} diff --git a/src/test/ui/run-pass/issues/issue-40951.rs b/src/test/ui/run-pass/issues/issue-40951.rs deleted file mode 100644 index b6f74f4f1cd..00000000000 --- a/src/test/ui/run-pass/issues/issue-40951.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #40951. - -const FOO: [&'static str; 1] = ["foo"]; - -fn find(t: &[T], element: &T) { } - -fn main() { - let x = format!("hi"); - find(&FOO, &&*x); -} diff --git a/src/test/ui/run-pass/issues/issue-40962.rs b/src/test/ui/run-pass/issues/issue-40962.rs deleted file mode 100644 index 9c9fb2ce9cb..00000000000 --- a/src/test/ui/run-pass/issues/issue-40962.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! m { - ($i:meta) => { - #[derive($i)] - struct S; - } -} - -m!(Clone); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-41053.rs b/src/test/ui/run-pass/issues/issue-41053.rs deleted file mode 100644 index 2d9dec6bbc7..00000000000 --- a/src/test/ui/run-pass/issues/issue-41053.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_41053.rs - -pub trait Trait { fn foo(&self) {} } - -pub struct Foo; - -impl Iterator for Foo { - type Item = Box; - fn next(&mut self) -> Option> { - extern crate issue_41053; - impl ::Trait for issue_41053::Test { - fn foo(&self) {} - } - Some(Box::new(issue_41053::Test)) - } -} - -fn main() { - Foo.next().unwrap().foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-4107.rs b/src/test/ui/run-pass/issues/issue-4107.rs deleted file mode 100644 index a05b1ddd9f4..00000000000 --- a/src/test/ui/run-pass/issues/issue-4107.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let _id: &Mat2 = &Matrix::identity(1.0); -} - -pub trait Index { fn get(&self, _: Index) -> Result { panic!() } } -pub trait Dimensional: Index { } - -pub struct Mat2 { x: T } -pub struct Vec2 { x: T } - -impl Dimensional> for Mat2 { } -impl Index> for Mat2 { } - -impl Dimensional for Vec2 { } -impl Index for Vec2 { } - -pub trait Matrix: Dimensional { - fn identity(t:T) -> Self; -} - -impl Matrix> for Mat2 { - fn identity(t:T) -> Mat2 { Mat2{ x: t } } -} diff --git a/src/test/ui/run-pass/issues/issue-41213.rs b/src/test/ui/run-pass/issues/issue-41213.rs deleted file mode 100644 index 0f1d8fe7249..00000000000 --- a/src/test/ui/run-pass/issues/issue-41213.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum A { - A1, - A2, - A3, -} - -enum B { - B1(String, String), - B2(String, String), -} - -fn main() { - let a = A::A1; - loop { - let _ctor = match a { - A::A3 => break, - A::A1 => B::B1, - A::A2 => B::B2, - }; - break; - } -} diff --git a/src/test/ui/run-pass/issues/issue-41272.rs b/src/test/ui/run-pass/issues/issue-41272.rs deleted file mode 100644 index 3debd77d123..00000000000 --- a/src/test/ui/run-pass/issues/issue-41272.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo; - -impl Foo { - fn bar(&mut self) -> bool { true } -} - -fn error(foo: &mut Foo) { - if let Some(_) = Some(true) { - } else if foo.bar() {} -} - -fn ok(foo: &mut Foo) { - if let Some(_) = Some(true) { - } else { - if foo.bar() {} - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-41298.rs b/src/test/ui/run-pass/issues/issue-41298.rs deleted file mode 100644 index 62e1afb9230..00000000000 --- a/src/test/ui/run-pass/issues/issue-41298.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Function { t: T, f: F } - -impl Function R> { fn foo() { } } -impl Function R> { fn bar() { } } - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-41394.rs b/src/test/ui/run-pass/issues/issue-41394.rs deleted file mode 100644 index 9287c672108..00000000000 --- a/src/test/ui/run-pass/issues/issue-41394.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-41394.rs - -extern crate issue_41394 as lib; - -fn main() { - assert_eq!(lib::foo() as u32, 42); -} diff --git a/src/test/ui/run-pass/issues/issue-41479.rs b/src/test/ui/run-pass/issues/issue-41479.rs deleted file mode 100644 index f527257207a..00000000000 --- a/src/test/ui/run-pass/issues/issue-41479.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn split(pair: (A, B)) { - let _a = pair.0; - let _b = pair.1; -} - -fn main() { - split(((), ((), ()))); -} diff --git a/src/test/ui/run-pass/issues/issue-41498.rs b/src/test/ui/run-pass/issues/issue-41498.rs deleted file mode 100644 index 18acc7d7c31..00000000000 --- a/src/test/ui/run-pass/issues/issue-41498.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// regression test for issue #41498. - -struct S; -impl S { - fn mutate(&mut self) {} -} - -fn call_and_ref T>(x: &mut Option, f: F) -> &mut T { - *x = Some(f()); - x.as_mut().unwrap() -} - -fn main() { - let mut n = None; - call_and_ref(&mut n, || [S])[0].mutate(); -} diff --git a/src/test/ui/run-pass/issues/issue-41604.rs b/src/test/ui/run-pass/issues/issue-41604.rs deleted file mode 100644 index c4eda86c9c0..00000000000 --- a/src/test/ui/run-pass/issues/issue-41604.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct B; - -impl B { - fn init(&mut self) {} -} - -fn main() { - let mut b = [B]; - b[1-1].init(); -} diff --git a/src/test/ui/run-pass/issues/issue-41628.rs b/src/test/ui/run-pass/issues/issue-41628.rs deleted file mode 100644 index f4b9588ff05..00000000000 --- a/src/test/ui/run-pass/issues/issue-41628.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(dead_code)] - -#[used] -static FOO: u32 = 0; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-41677.rs b/src/test/ui/run-pass/issues/issue-41677.rs deleted file mode 100644 index b99a5f7f2a7..00000000000 --- a/src/test/ui/run-pass/issues/issue-41677.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #41677. The local variable was winding up with -// a type `Receiver` where `?T` was unconstrained, because we -// failed to enforce the WF obligations and `?T` is a bivariant type -// parameter position. - -#![allow(unused_variables, dead_code)] - -use std::marker::PhantomData; - -trait Handle { - type Inner; -} - -struct ResizingHandle(PhantomData); -impl Handle for ResizingHandle { - type Inner = H; -} - -struct Receiver>(PhantomData); - -fn channel(size: usize) -> Receiver> { - let rx = Receiver(PhantomData); - rx -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-41696.rs b/src/test/ui/run-pass/issues/issue-41696.rs deleted file mode 100644 index 780290dce7f..00000000000 --- a/src/test/ui/run-pass/issues/issue-41696.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// this used to cause exponential code-size blowup during LLVM passes. - -#![feature(test)] - -extern crate test; - -struct MayUnwind; - -impl Drop for MayUnwind { - fn drop(&mut self) { - if test::black_box(false) { - panic!() - } - } -} - -struct DS { - may_unwind: MayUnwind, - name: String, - next: U, -} - -fn add(ds: DS, name: String) -> DS> { - DS { - may_unwind: MayUnwind, - name: "?".to_owned(), - next: ds, - } -} - -fn main() { - let deserializers = DS { may_unwind: MayUnwind, name: "?".to_owned(), next: () }; - let deserializers = add(deserializers, "?".to_owned()); - let deserializers = add(deserializers, "?".to_owned()); - let deserializers = add(deserializers, "?".to_owned()); - let deserializers = add(deserializers, "?".to_owned()); - let deserializers = add(deserializers, "?".to_owned()); - let deserializers = add(deserializers, "?".to_owned()); - let deserializers = add(deserializers, "?".to_owned()); // 0.7s - let deserializers = add(deserializers, "?".to_owned()); // 1.3s - let deserializers = add(deserializers, "?".to_owned()); // 2.4s - let deserializers = add(deserializers, "?".to_owned()); // 6.7s - let deserializers = add(deserializers, "?".to_owned()); // 26.0s - let deserializers = add(deserializers, "?".to_owned()); // 114.0s - let deserializers = add(deserializers, "?".to_owned()); // 228.0s - let deserializers = add(deserializers, "?".to_owned()); // 400.0s - let deserializers = add(deserializers, "?".to_owned()); // 800.0s - let deserializers = add(deserializers, "?".to_owned()); // 1600.0s - let deserializers = add(deserializers, "?".to_owned()); // 3200.0s -} diff --git a/src/test/ui/run-pass/issues/issue-41744.rs b/src/test/ui/run-pass/issues/issue-41744.rs deleted file mode 100644 index b667b1d929b..00000000000 --- a/src/test/ui/run-pass/issues/issue-41744.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Tc {} -impl Tc for bool {} - -fn main() { - let _: &[&Tc] = &[&true]; -} diff --git a/src/test/ui/run-pass/issues/issue-41803.rs b/src/test/ui/run-pass/issues/issue-41803.rs deleted file mode 100644 index 30e3d60bd34..00000000000 --- a/src/test/ui/run-pass/issues/issue-41803.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -/// A compile-time map from identifiers to arbitrary (heterogeneous) expressions -macro_rules! ident_map { - ( $name:ident = { $($key:ident => $e:expr,)* } ) => { - macro_rules! $name { - $( - ( $key ) => { $e }; - )* - // Empty invocation expands to nothing. Needed when the map is empty. - () => {}; - } - }; -} - -ident_map!(my_map = { - main => 0, -}); - -fn main() { - my_map!(main); -} diff --git a/src/test/ui/run-pass/issues/issue-41849-variance-req.rs b/src/test/ui/run-pass/issues/issue-41849-variance-req.rs deleted file mode 100644 index 2f8c108f590..00000000000 --- a/src/test/ui/run-pass/issues/issue-41849-variance-req.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #41849. - -use std::ops::Mul; - -const C: usize = 1; -const CAPACITY: usize = 1 * C; - -struct A { - f: [X; CAPACITY], -} - -struct B { - f: T, -} - -impl Mul for B { - type Output = Self; - fn mul(self, _rhs: B) -> Self::Output { - self - } -} - -impl Mul for B { - type Output = Self; - fn mul(self, _rhs: usize) -> Self::Output { - self - } -} - -fn main() { - let a = A { f: [1] }; - let _ = B { f: a }; -} diff --git a/src/test/ui/run-pass/issues/issue-41888.rs b/src/test/ui/run-pass/issues/issue-41888.rs deleted file mode 100644 index 5ae8029e224..00000000000 --- a/src/test/ui/run-pass/issues/issue-41888.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { let _ = g(Some(E::F(K))); } - -type R = Result<(), ()>; -struct K; - -enum E { - F(K), // must not be built-in type - #[allow(dead_code)] - G(Box, Box), -} - -fn translate(x: R) -> R { x } - -fn g(mut status: Option) -> R { - loop { - match status { - Some(infix_or_postfix) => match infix_or_postfix { - E::F(_op) => { // <- must be captured by value - match Ok(()) { - Err(err) => return Err(err), - Ok(_) => {}, - }; - } - _ => (), - }, - _ => match translate(Err(())) { - Err(err) => return Err(err), - Ok(_) => {}, - } - } - status = None; - } -} diff --git a/src/test/ui/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs b/src/test/ui/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs deleted file mode 100644 index f47e69931d5..00000000000 --- a/src/test/ui/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #41936. The coerce-unsized trait check in -// coherence was using subtyping, which triggered variance -// computation, which failed because it required type info for fields -// that had not (yet) been computed. - -#![feature(unsize)] -#![feature(coerce_unsized)] - -use std::{marker,ops}; - -// Change the array to a non-array, and error disappears -// Adding a new field to the end keeps the error -struct LogDataBuf([u8;8]); - -struct Aref -{ - // Inner structure triggers the error, removing the inner removes the message. - ptr: Box>, -} -impl, U: ?Sized> ops::CoerceUnsized> for Aref {} - -struct ArefInner -{ - // Even with this field commented out, the error is raised. - data: T, -} - -fn main(){} diff --git a/src/test/ui/run-pass/issues/issue-42007.rs b/src/test/ui/run-pass/issues/issue-42007.rs deleted file mode 100644 index b72343f05c6..00000000000 --- a/src/test/ui/run-pass/issues/issue-42007.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_42007_s.rs - -extern crate issue_42007_s; - -enum I { - E(issue_42007_s::E), -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-4208.rs b/src/test/ui/run-pass/issues/issue-4208.rs deleted file mode 100644 index fa6f56bc817..00000000000 --- a/src/test/ui/run-pass/issues/issue-4208.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-4208-cc.rs - -// pretty-expanded FIXME #23616 - -extern crate numeric; -use numeric::{sin, Angle}; - -fn foo>(theta: A) -> T { sin(&theta) } - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-42148.rs b/src/test/ui/run-pass/issues/issue-42148.rs deleted file mode 100644 index 76947e8b0ba..00000000000 --- a/src/test/ui/run-pass/issues/issue-42148.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Zst; - -fn main() { - unsafe { ::std::ptr::write_volatile(1 as *mut Zst, Zst) } -} diff --git a/src/test/ui/run-pass/issues/issue-42210.rs b/src/test/ui/run-pass/issues/issue-42210.rs deleted file mode 100644 index d3b0da5e044..00000000000 --- a/src/test/ui/run-pass/issues/issue-42210.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #42210. - -// compile-flags: -g - -trait Foo { - fn foo() { } -} - -struct Bar; - -trait Baz { -} - -impl Foo for (Bar, Baz) { } - - -fn main() { - <(Bar, Baz) as Foo>::foo() -} diff --git a/src/test/ui/run-pass/issues/issue-4228.rs b/src/test/ui/run-pass/issues/issue-4228.rs deleted file mode 100644 index e66921fe115..00000000000 --- a/src/test/ui/run-pass/issues/issue-4228.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo; - -impl Foo { - fn first() {} -} -impl Foo { - fn second() {} -} - -pub fn main() { - Foo::first(); - Foo::second(); -} diff --git a/src/test/ui/run-pass/issues/issue-42453.rs b/src/test/ui/run-pass/issues/issue-42453.rs deleted file mode 100644 index 649f52ef82e..00000000000 --- a/src/test/ui/run-pass/issues/issue-42453.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#[derive(Debug)] -struct builder; - -fn main() { - -} - diff --git a/src/test/ui/run-pass/issues/issue-42463.rs b/src/test/ui/run-pass/issues/issue-42463.rs deleted file mode 100644 index 9074ab8b6dd..00000000000 --- a/src/test/ui/run-pass/issues/issue-42463.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::{Deref, DerefMut}; - -struct CheckedDeref { - value: T, - check: F -} - -impl bool, T> Deref for CheckedDeref { - type Target = T; - fn deref(&self) -> &T { - assert!((self.check)(&self.value)); - &self.value - } -} - -impl bool, T> DerefMut for CheckedDeref { - fn deref_mut(&mut self) -> &mut T { - assert!((self.check)(&self.value)); - &mut self.value - } -} - - -fn main() { - let mut v = CheckedDeref { - value: vec![0], - check: |v: &Vec<_>| !v.is_empty() - }; - v.push(1); - assert_eq!(*v, vec![0, 1]); -} diff --git a/src/test/ui/run-pass/issues/issue-42467.rs b/src/test/ui/run-pass/issues/issue-42467.rs deleted file mode 100644 index 0f89d505751..00000000000 --- a/src/test/ui/run-pass/issues/issue-42467.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo(T); - -struct IntoIter(T); - -impl<'a, T: 'a> Iterator for IntoIter { - type Item = (); - - fn next(&mut self) -> Option<()> { - None - } -} - -impl IntoIterator for Foo { - type Item = (); - type IntoIter = IntoIter; - - fn into_iter(self) -> IntoIter { - IntoIter(self.0) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-4252.rs b/src/test/ui/run-pass/issues/issue-4252.rs deleted file mode 100644 index c733bf5b764..00000000000 --- a/src/test/ui/run-pass/issues/issue-4252.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait X { - fn call(&self, x: &T); - fn default_method(&self, x: &T) { - println!("X::default_method {:?}", x); - } -} - -#[derive(Debug)] -struct Y(isize); - -#[derive(Debug)] -struct Z { - x: T -} - -impl X for Y { - fn call(&self, x: &T) { - println!("X::call {:?} {:?}", self, x); - } -} - -impl Drop for Z { - fn drop(&mut self) { - // These statements used to cause an ICE. - self.x.call(self); - self.x.default_method(self); - } -} - -pub fn main() { - let _z = Z {x: Y(42)}; -} diff --git a/src/test/ui/run-pass/issues/issue-42552.rs b/src/test/ui/run-pass/issues/issue-42552.rs deleted file mode 100644 index e1c3a1bd141..00000000000 --- a/src/test/ui/run-pass/issues/issue-42552.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for an obscure issue with the projection cache. - -fn into_iter(a: &I) -> Groups { - Groups { _a: a } -} - -pub struct Groups<'a, I: 'a> { - _a: &'a I, -} - -impl<'a, I: Iterator> Iterator for Groups<'a, I> { - type Item = Group<'a, I>; - fn next(&mut self) -> Option { - None - } -} - -pub struct Group<'a, I: Iterator + 'a> - where I::Item: 'a // <-- needed to trigger ICE! -{ - _phantom: &'a (), - _ice_trigger: I::Item, // <-- needed to trigger ICE! -} - - -fn main() { - let _ = into_iter(&[0].iter().map(|_| 0)).map(|grp| { - let _g = grp; - }); -} diff --git a/src/test/ui/run-pass/issues/issue-42679.rs b/src/test/ui/run-pass/issues/issue-42679.rs deleted file mode 100644 index 452d231a846..00000000000 --- a/src/test/ui/run-pass/issues/issue-42679.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] -#![feature(box_patterns)] - -#[derive(Debug, PartialEq)] -enum Test { - Foo(usize), - Bar(isize), -} - -fn main() { - let a = box Test::Foo(10); - let b = box Test::Bar(-20); - match (a, b) { - (_, box Test::Foo(_)) => unreachable!(), - (box Test::Foo(x), b) => { - assert_eq!(x, 10); - assert_eq!(b, box Test::Bar(-20)); - }, - _ => unreachable!(), - } -} diff --git a/src/test/ui/run-pass/issues/issue-42747.rs b/src/test/ui/run-pass/issues/issue-42747.rs deleted file mode 100644 index c91de3f40ea..00000000000 --- a/src/test/ui/run-pass/issues/issue-42747.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! fooN { - ($cur:ident $prev:ty) => { - #[allow(dead_code)] - enum $cur { - Empty, - First($prev), - Second($prev), - Third($prev), - Fourth($prev), - } - } -} - -fooN!(Foo0 ()); -fooN!(Foo1 Foo0); -fooN!(Foo2 Foo1); -fooN!(Foo3 Foo2); -fooN!(Foo4 Foo3); -fooN!(Foo5 Foo4); -fooN!(Foo6 Foo5); -fooN!(Foo7 Foo6); -fooN!(Foo8 Foo7); -fooN!(Foo9 Foo8); -fooN!(Foo10 Foo9); -fooN!(Foo11 Foo10); -fooN!(Foo12 Foo11); -fooN!(Foo13 Foo12); -fooN!(Foo14 Foo13); -fooN!(Foo15 Foo14); -fooN!(Foo16 Foo15); -fooN!(Foo17 Foo16); -fooN!(Foo18 Foo17); -fooN!(Foo19 Foo18); -fooN!(Foo20 Foo19); -fooN!(Foo21 Foo20); -fooN!(Foo22 Foo21); -fooN!(Foo23 Foo22); -fooN!(Foo24 Foo23); -fooN!(Foo25 Foo24); -fooN!(Foo26 Foo25); -fooN!(Foo27 Foo26); - -fn main() { - let _foo = Foo27::Empty; -} diff --git a/src/test/ui/run-pass/issues/issue-42956.rs b/src/test/ui/run-pass/issues/issue-42956.rs deleted file mode 100644 index cee9d8be98d..00000000000 --- a/src/test/ui/run-pass/issues/issue-42956.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![feature(associated_consts)] - -impl A for i32 { - type Foo = u32; -} -impl B for u32 { - const BAR: i32 = 0; -} - -trait A { - type Foo: B; -} - -trait B { - const BAR: i32; -} - -fn generic() { - // This panics if the universal function call syntax is used as well - println!("{}", T::Foo::BAR); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-43057.rs b/src/test/ui/run-pass/issues/issue-43057.rs deleted file mode 100644 index 26140246a7f..00000000000 --- a/src/test/ui/run-pass/issues/issue-43057.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused)] - -macro_rules! column { - ($i:ident) => { - $i - }; -} - -fn foo() -> ! { - panic!(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-43132.rs b/src/test/ui/run-pass/issues/issue-43132.rs deleted file mode 100644 index b80e000d2e7..00000000000 --- a/src/test/ui/run-pass/issues/issue-43132.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused)] - -fn main() { -} - -fn foo() { - let b = mk::< - Forward<(Box>,)>, - >(); - b.map_err(|_| ()).join(); -} - -fn mk() -> T { - loop {} -} - -impl, E> Future for (I,) { - type Error = E; -} - -struct Forward { - _a: T, -} - -impl Future for Forward -where - T::Error: From, -{ - type Error = T::Error; -} - -trait Future { - type Error; - - fn map_err(self, _: F) -> (Self, F) - where - F: FnOnce(Self::Error) -> E, - Self: Sized, - { - loop {} - } - - fn join(self) -> (MaybeDone, ()) - where - Self: Sized, - { - loop {} - } -} - -impl Future for Box { - type Error = S::Error; -} - -enum MaybeDone { - _Done(A::Error), -} - -impl Future for (A, F) -where - F: FnOnce(A::Error) -> U, -{ - type Error = U; -} diff --git a/src/test/ui/run-pass/issues/issue-43205.rs b/src/test/ui/run-pass/issues/issue-43205.rs deleted file mode 100644 index 8f89942ddfc..00000000000 --- a/src/test/ui/run-pass/issues/issue-43205.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - &&[()][0]; - println!("{:?}", &[(),()][1]); -} diff --git a/src/test/ui/run-pass/issues/issue-43291.rs b/src/test/ui/run-pass/issues/issue-43291.rs deleted file mode 100644 index cb850b54f7b..00000000000 --- a/src/test/ui/run-pass/issues/issue-43291.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - assert_eq!(!0usize as *const (), foo(0, 1)); - assert_eq!(!0usize as *const (), (0i8 - 1) as *const ()); -} - -pub fn foo(a: i8, b: i8) -> *const () { - (a - b) as *const () -} diff --git a/src/test/ui/run-pass/issues/issue-4333.rs b/src/test/ui/run-pass/issues/issue-4333.rs deleted file mode 100644 index 193a438fc9c..00000000000 --- a/src/test/ui/run-pass/issues/issue-4333.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::io; - -pub fn main() { - let stdout = &mut io::stdout() as &mut io::Write; - stdout.write(b"Hello!"); -} diff --git a/src/test/ui/run-pass/issues/issue-43357.rs b/src/test/ui/run-pass/issues/issue-43357.rs deleted file mode 100644 index 75d05c06428..00000000000 --- a/src/test/ui/run-pass/issues/issue-43357.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Trait { - type Output; -} - -fn f() { - std::mem::size_of::(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-43483.rs b/src/test/ui/run-pass/issues/issue-43483.rs deleted file mode 100644 index 52ee080125f..00000000000 --- a/src/test/ui/run-pass/issues/issue-43483.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait VecN { - const DIM: usize; -} - -trait Mat { - type Row: VecN; -} - -fn m() { - let x = M::Row::DIM; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-43692.rs b/src/test/ui/run-pass/issues/issue-43692.rs deleted file mode 100644 index a84dd86a156..00000000000 --- a/src/test/ui/run-pass/issues/issue-43692.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - assert_eq!('\u{10__FFFF}', '\u{10FFFF}'); - assert_eq!("\u{10_F0FF__}foo\u{1_0_0_0__}", "\u{10F0FF}foo\u{1000}"); -} diff --git a/src/test/ui/run-pass/issues/issue-43853.rs b/src/test/ui/run-pass/issues/issue-43853.rs deleted file mode 100644 index bb8af71b54d..00000000000 --- a/src/test/ui/run-pass/issues/issue-43853.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default - -use std::panic; - -fn test() { - wait(|| panic!()); -} - -fn wait T>(f: F) -> F::Output { - From::from(f()) -} - -fn main() { - let result = panic::catch_unwind(move || test()); - assert!(result.is_err()); -} diff --git a/src/test/ui/run-pass/issues/issue-4387.rs b/src/test/ui/run-pass/issues/issue-4387.rs deleted file mode 100644 index 45c26433a20..00000000000 --- a/src/test/ui/run-pass/issues/issue-4387.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let _foo = [0; 2*4]; -} diff --git a/src/test/ui/run-pass/issues/issue-43910.rs b/src/test/ui/run-pass/issues/issue-43910.rs deleted file mode 100644 index 5c401a7f82d..00000000000 --- a/src/test/ui/run-pass/issues/issue-43910.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(unused_variables)] - -fn main() { - #[allow(unused_variables)] - let x = 12; -} diff --git a/src/test/ui/run-pass/issues/issue-43923.rs b/src/test/ui/run-pass/issues/issue-43923.rs deleted file mode 100644 index 220a68e1335..00000000000 --- a/src/test/ui/run-pass/issues/issue-43923.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct A { ptr: T } - -fn foo(x: &A<[T]>) {} - -fn main() { - let a = foo; - let b = A { ptr: [a, a, a] }; - a(&A { ptr: [()] }); -} diff --git a/src/test/ui/run-pass/issues/issue-44005.rs b/src/test/ui/run-pass/issues/issue-44005.rs deleted file mode 100644 index 699cb18ffc7..00000000000 --- a/src/test/ui/run-pass/issues/issue-44005.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait Foo<'a> { - type Bar; - fn foo(&'a self) -> Self::Bar; -} - -impl<'a, 'b, T: 'a> Foo<'a> for &'b T { - type Bar = &'a T; - fn foo(&'a self) -> &'a T { - self - } -} - -pub fn uncallable(x: T, f: F) - where T: for<'a> Foo<'a>, - F: for<'a> Fn(>::Bar) -{ - f(x.foo()); -} - -pub fn catalyst(x: &i32) { - broken(x, |_| {}) -} - -pub fn broken(x: &i32, f: F) { - uncallable(x, |y| f(y)); -} - -fn main() { } - diff --git a/src/test/ui/run-pass/issues/issue-4401.rs b/src/test/ui/run-pass/issues/issue-4401.rs deleted file mode 100644 index 5935901efe7..00000000000 --- a/src/test/ui/run-pass/issues/issue-4401.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let mut count = 0; - for _ in 0..999_999 { count += 1; } - assert_eq!(count, 999_999); - println!("{}", count); -} diff --git a/src/test/ui/run-pass/issues/issue-44056.rs b/src/test/ui/run-pass/issues/issue-44056.rs deleted file mode 100644 index 50fe9997066..00000000000 --- a/src/test/ui/run-pass/issues/issue-44056.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// only-x86_64 -// no-prefer-dynamic -// compile-flags: -Ctarget-feature=+avx -Clto - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-44247.rs b/src/test/ui/run-pass/issues/issue-44247.rs deleted file mode 100644 index f431e94889c..00000000000 --- a/src/test/ui/run-pass/issues/issue-44247.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait T { - type X; - const X: Self::X; -} -fn foo() { - let _: X::X = X::X; -} - -trait S { - const X: Self::X; - type X; -} -fn bar() { - let _: X::X = X::X; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-44333.rs b/src/test/ui/run-pass/issues/issue-44333.rs deleted file mode 100644 index 28fadb9014d..00000000000 --- a/src/test/ui/run-pass/issues/issue-44333.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -type Func = fn(usize, usize) -> usize; - -fn foo(a: usize, b: usize) -> usize { a + b } -fn bar(a: usize, b: usize) -> usize { a * b } -fn test(x: usize) -> Func { - if x % 2 == 0 { foo } - else { bar } -} - -const FOO: Func = foo; -const BAR: Func = bar; - -fn main() { - match test(std::env::consts::ARCH.len()) { - FOO => println!("foo"), - BAR => println!("bar"), - _ => unreachable!(), - } -} diff --git a/src/test/ui/run-pass/issues/issue-44373.rs b/src/test/ui/run-pass/issues/issue-44373.rs deleted file mode 100644 index 4d5bb5449b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-44373.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z borrowck=compare - -struct Foo(bool); - -struct Container(&'static [&'static Foo]); - -static FOO: Foo = Foo(true); -static CONTAINER: Container = Container(&[&FOO]); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-44402.rs b/src/test/ui/run-pass/issues/issue-44402.rs deleted file mode 100644 index 427ac016c08..00000000000 --- a/src/test/ui/run-pass/issues/issue-44402.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(never_type)] -#![feature(exhaustive_patterns)] - -// Regression test for inhabitedness check. The old -// cache used to cause us to incorrectly decide -// that `test_b` was invalid. - -struct Foo { - field1: !, - field2: Option<&'static Bar>, -} - -struct Bar { - field1: &'static Foo -} - -fn test_a() { - let x: Option = None; - match x { None => () } -} - -fn test_b() { - let x: Option = None; - match x { None => () } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-4446.rs b/src/test/ui/run-pass/issues/issue-4446.rs deleted file mode 100644 index 3cd70df23cf..00000000000 --- a/src/test/ui/run-pass/issues/issue-4446.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::sync::mpsc::channel; -use std::thread; - -pub fn main() { - let (tx, rx) = channel(); - - tx.send("hello, world").unwrap(); - - thread::spawn(move|| { - println!("{}", rx.recv().unwrap()); - }).join().ok().unwrap(); -} diff --git a/src/test/ui/run-pass/issues/issue-4448.rs b/src/test/ui/run-pass/issues/issue-4448.rs deleted file mode 100644 index eb474d4c459..00000000000 --- a/src/test/ui/run-pass/issues/issue-4448.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::sync::mpsc::channel; -use std::thread; - -pub fn main() { - let (tx, rx) = channel::<&'static str>(); - - let t = thread::spawn(move|| { - assert_eq!(rx.recv().unwrap(), "hello, world"); - }); - - tx.send("hello, world").unwrap(); - t.join().ok().unwrap(); -} diff --git a/src/test/ui/run-pass/issues/issue-4464.rs b/src/test/ui/run-pass/issues/issue-4464.rs deleted file mode 100644 index bb788aaf88d..00000000000 --- a/src/test/ui/run-pass/issues/issue-4464.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn broken(v: &[u8], i: usize, j: usize) -> &[u8] { &v[i..j] } - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-44730.rs b/src/test/ui/run-pass/issues/issue-44730.rs deleted file mode 100644 index 0f4d2e174fc..00000000000 --- a/src/test/ui/run-pass/issues/issue-44730.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -//! dox - -#![deny(missing_docs)] - -macro_rules! doc { - ($e:expr) => ( - #[doc = $e] - pub struct Foo; - ) -} - -doc!("a"); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-44851.rs b/src/test/ui/run-pass/issues/issue-44851.rs deleted file mode 100644 index 1e9f4d3e4e5..00000000000 --- a/src/test/ui/run-pass/issues/issue-44851.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! a { - () => { "a" } -} - -macro_rules! b { - ($doc:expr) => { - #[doc = $doc] - pub struct B; - } -} - -b!(a!()); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-45124.rs b/src/test/ui/run-pass/issues/issue-45124.rs deleted file mode 100644 index 774ad8ac760..00000000000 --- a/src/test/ui/run-pass/issues/issue-45124.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --edition 2018 - -#![feature(try_blocks)] - -fn main() { - let mut a = 0; - let () = { - let _: Result<(), ()> = try { - let _ = Err(())?; - return - }; - a += 1; - }; - a += 2; - assert_eq!(a, 3); -} diff --git a/src/test/ui/run-pass/issues/issue-45152.rs b/src/test/ui/run-pass/issues/issue-45152.rs deleted file mode 100644 index 71c1f92baa7..00000000000 --- a/src/test/ui/run-pass/issues/issue-45152.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(unsize, coerce_unsized)] - -#[repr(packed)] -struct UnalignedPtr<'a, T: ?Sized> - where T: 'a, -{ - data: &'a T, -} - -fn main() { - - impl<'a, T, U> std::ops::CoerceUnsized> for UnalignedPtr<'a, T> - where - T: std::marker::Unsize + ?Sized, - U: ?Sized, - { } - - let arr = [1, 2, 3]; - let arr_unaligned: UnalignedPtr<[i32; 3]> = UnalignedPtr { data: &arr }; - let arr_unaligned: UnalignedPtr<[i32]> = arr_unaligned; -} diff --git a/src/test/ui/run-pass/issues/issue-4541.rs b/src/test/ui/run-pass/issues/issue-4541.rs deleted file mode 100644 index 99415297feb..00000000000 --- a/src/test/ui/run-pass/issues/issue-4541.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no std::env - -fn parse_args() -> String { - let args: Vec<_> = ::std::env::args().collect(); - let mut n = 0; - - while n < args.len() { - match &*args[n] { - "-v" => (), - s => { - return s.to_string(); - } - } - n += 1; - } - - return "".to_string() -} - -pub fn main() { - println!("{}", parse_args()); -} diff --git a/src/test/ui/run-pass/issues/issue-4542.rs b/src/test/ui/run-pass/issues/issue-4542.rs deleted file mode 100644 index 3e19e7fa583..00000000000 --- a/src/test/ui/run-pass/issues/issue-4542.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -// ignore-cloudabi no std::env - -use std::env; - -pub fn main() { - for arg in env::args() { - match arg.clone() { - _s => { } - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-45425.rs b/src/test/ui/run-pass/issues/issue-45425.rs deleted file mode 100644 index c7523664047..00000000000 --- a/src/test/ui/run-pass/issues/issue-45425.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Add; - -fn ref_add(a: &T, b: &T) -> T -where - for<'x> &'x T: Add<&'x T, Output = T>, -{ - a + b -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-4545.rs b/src/test/ui/run-pass/issues/issue-4545.rs deleted file mode 100644 index 94eedbdb93a..00000000000 --- a/src/test/ui/run-pass/issues/issue-4545.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-4545.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_4545 as somelib; -pub fn main() { somelib::mk::(); } diff --git a/src/test/ui/run-pass/issues/issue-45731.rs b/src/test/ui/run-pass/issues/issue-45731.rs deleted file mode 100644 index 568d6674c3a..00000000000 --- a/src/test/ui/run-pass/issues/issue-45731.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--test -g - -#[cfg(target_os = "macos")] -#[test] -fn simple_test() { - use std::{env, panic, fs}; - - // Find our dSYM and replace the DWARF binary with an empty file - let mut dsym_path = env::current_exe().unwrap(); - let executable_name = dsym_path.file_name().unwrap().to_str().unwrap().to_string(); - assert!(dsym_path.pop()); // Pop executable - dsym_path.push(format!("{}.dSYM/Contents/Resources/DWARF/{0}", executable_name)); - { - let file = fs::OpenOptions::new().read(false).write(true).truncate(true).create(false) - .open(&dsym_path).unwrap(); - } - - env::set_var("RUST_BACKTRACE", "1"); - - // We don't need to die of panic, just trigger a backtrace - let _ = panic::catch_unwind(|| { - assert!(false); - }); -} diff --git a/src/test/ui/run-pass/issues/issue-46069.rs b/src/test/ui/run-pass/issues/issue-46069.rs deleted file mode 100644 index 573b2b8198a..00000000000 --- a/src/test/ui/run-pass/issues/issue-46069.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::iter::{Fuse, Cloned}; -use std::slice::Iter; - -struct Foo<'a, T: 'a>(&'a T); -impl<'a, T: 'a> Copy for Foo<'a, T> {} -impl<'a, T: 'a> Clone for Foo<'a, T> { - fn clone(&self) -> Self { *self } -} - -fn copy_ex() { - let s = 2; - let k1 = || s; - let upvar = Foo(&k1); - let k = || upvar; - k(); -} - -fn main() { - let _f = 0 as *mut >> as Iterator>::Item; - - copy_ex(); -} diff --git a/src/test/ui/run-pass/issues/issue-46095.rs b/src/test/ui/run-pass/issues/issue-46095.rs deleted file mode 100644 index ac6ca3923f7..00000000000 --- a/src/test/ui/run-pass/issues/issue-46095.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct A; - -impl A { - fn take_mutably(&mut self) {} -} - -fn identity(t: T) -> T { - t -} - -// Issue 46095 -// Built-in indexing should be used even when the index is not -// trivially an integer -// Overloaded indexing would cause wrapped to be borrowed mutably - -fn main() { - let mut a1 = A; - let mut a2 = A; - - let wrapped = [&mut a1, &mut a2]; - - { - wrapped[0 + 1 - 1].take_mutably(); - } - - { - wrapped[identity(0)].take_mutably(); - } -} diff --git a/src/test/ui/run-pass/issues/issue-46519.rs b/src/test/ui/run-pass/issues/issue-46519.rs deleted file mode 100644 index 94b7032417a..00000000000 --- a/src/test/ui/run-pass/issues/issue-46519.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:--test -O - -#[test] -#[should_panic(expected = "creating inhabited type")] -fn test() { - FontLanguageOverride::system_font(SystemFont::new()); -} - -pub enum FontLanguageOverride { - Normal, - Override(&'static str), - System(SystemFont) -} - -pub enum SystemFont {} - -impl FontLanguageOverride { - fn system_font(f: SystemFont) -> Self { - FontLanguageOverride::System(f) - } -} - -impl SystemFont { - fn new() -> Self { - panic!("creating inhabited type") - } -} diff --git a/src/test/ui/run-pass/issues/issue-46553.rs b/src/test/ui/run-pass/issues/issue-46553.rs deleted file mode 100644 index 001db9d8691..00000000000 --- a/src/test/ui/run-pass/issues/issue-46553.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(const_fn)] -#![deny(const_err)] - -pub struct Data { - function: fn() -> T, -} - -impl Data { - pub const fn new(function: fn() -> T) -> Data { - Data { - function: function, - } - } -} - -pub static DATA: Data = Data::new(|| { - 413i32 -}); - -fn main() { - print!("{:?}", (DATA.function)()); -} diff --git a/src/test/ui/run-pass/issues/issue-46845.rs b/src/test/ui/run-pass/issues/issue-46845.rs deleted file mode 100644 index f8f3a2bb5bd..00000000000 --- a/src/test/ui/run-pass/issues/issue-46845.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// To work around #46855 -// compile-flags: -Z mir-opt-level=0 -// Regression test for the inhabitedness of unions with uninhabited variants, issue #46845 - -use std::mem; - -#[derive(Copy, Clone)] -enum Never { } - -// A single uninhabited variant shouldn't make the whole union uninhabited. -union Foo { - a: u64, - _b: Never -} - -// If all the variants are uninhabited, however, the union should be uninhabited. -// NOTE(#49298) the union being uninhabited shouldn't change its size. -union Bar { - _a: (Never, u64), - _b: (u64, Never) -} - -fn main() { - assert_eq!(mem::size_of::(), 8); - // See the note on `Bar`'s definition for why this isn't `0`. - assert_eq!(mem::size_of::(), 8); - - let f = [Foo { a: 42 }, Foo { a: 10 }]; - println!("{}", unsafe { f[0].a }); - assert_eq!(unsafe { f[1].a }, 10); -} diff --git a/src/test/ui/run-pass/issues/issue-46855.rs b/src/test/ui/run-pass/issues/issue-46855.rs deleted file mode 100644 index 8e6a37083e3..00000000000 --- a/src/test/ui/run-pass/issues/issue-46855.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Zmir-opt-level=1 - -use std::mem; - -#[derive(Copy, Clone)] -enum Never {} - -union Foo { - a: u64, - b: Never -} - -fn foo(xs: [(Never, u32); 1]) -> u32 { xs[0].1 } - -fn bar([(_, x)]: [(Never, u32); 1]) -> u32 { x } - -fn main() { - println!("{}", mem::size_of::()); - - let f = [Foo { a: 42 }, Foo { a: 10 }]; - println!("{:?}", unsafe { f[0].a }); -} diff --git a/src/test/ui/run-pass/issues/issue-46920-byte-array-patterns.rs b/src/test/ui/run-pass/issues/issue-46920-byte-array-patterns.rs deleted file mode 100644 index 1e1f1f0baa9..00000000000 --- a/src/test/ui/run-pass/issues/issue-46920-byte-array-patterns.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const CURSOR_PARTITION_LABEL: &'static [u8] = b"partition"; -const CURSOR_EVENT_TYPE_LABEL: &'static [u8] = b"event_type"; -const BYTE_PATTERN: &'static [u8; 5] = b"hello"; - -fn match_slice(x: &[u8]) -> u32 { - match x { - CURSOR_PARTITION_LABEL => 0, - CURSOR_EVENT_TYPE_LABEL => 1, - _ => 2, - } -} - -fn match_array(x: &[u8; 5]) -> bool { - match x { - BYTE_PATTERN => true, - _ => false - } -} - -fn main() { - assert_eq!(match_slice(b"abcde"), 2); - assert_eq!(match_slice(b"event_type"), 1); - assert_eq!(match_slice(b"partition"), 0); - - assert_eq!(match_array(b"hello"), true); - assert_eq!(match_array(b"hella"), false); -} diff --git a/src/test/ui/run-pass/issues/issue-46959.rs b/src/test/ui/run-pass/issues/issue-46959.rs deleted file mode 100644 index baaff2d4581..00000000000 --- a/src/test/ui/run-pass/issues/issue-46959.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(non_camel_case_types)] - -#[allow(dead_code)] -fn qqq(lol: impl Iterator) -> impl Iterator { - lol.map(|x|x as u64) -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-46964.rs b/src/test/ui/run-pass/issues/issue-46964.rs deleted file mode 100644 index ad4d6e3ac1a..00000000000 --- a/src/test/ui/run-pass/issues/issue-46964.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -mod my_mod { - #[derive(Clone, Copy, Eq, PartialEq, PartialOrd, Ord, Hash)] - pub struct Name<'a> { - source: &'a str, - } - - pub const JSON: Name = Name { source: "JSON" }; -} - -pub fn crash() -> bool { - match (my_mod::JSON, None) { - (_, Some(my_mod::JSON)) => true, - (my_mod::JSON, None) => true, - _ => false, - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-47139-1.rs b/src/test/ui/run-pass/issues/issue-47139-1.rs deleted file mode 100644 index df225b6e0d9..00000000000 --- a/src/test/ui/run-pass/issues/issue-47139-1.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #47139: -// -// Coherence was encountering an (unnecessary) overflow trying to -// decide if the two impls of dummy overlap. -// -// The overflow went something like: -// -// - `&'a ?T: Insertable` ? -// - let ?T = Option ? -// - `Option: Insertable` ? -// - `Option<&'a ?U>: Insertable` ? -// - `&'a ?U: Insertable` ? -// -// While somewhere in the middle, a projection would occur, which -// broke cycle detection. -// -// It turned out that this cycle was being kicked off due to some -// extended diagnostic attempts in coherence, so removing those -// sidestepped the issue for now. - -#![allow(dead_code)] - -pub trait Insertable { - type Values; - - fn values(self) -> Self::Values; -} - -impl Insertable for Option - where - T: Insertable, - T::Values: Default, -{ - type Values = T::Values; - - fn values(self) -> Self::Values { - self.map(Insertable::values).unwrap_or_default() - } -} - -impl<'a, T> Insertable for &'a Option - where - Option<&'a T>: Insertable, -{ - type Values = as Insertable>::Values; - - fn values(self) -> Self::Values { - self.as_ref().values() - } -} - -impl<'a, T> Insertable for &'a [T] -{ - type Values = Self; - - fn values(self) -> Self::Values { - self - } -} - -trait Unimplemented { } - -trait Dummy { } - -struct Foo { t: T } - -impl<'a, U> Dummy for Foo<&'a U> - where &'a U: Insertable -{ -} - -impl Dummy for T - where T: Unimplemented -{ } - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-47139-2.rs b/src/test/ui/run-pass/issues/issue-47139-2.rs deleted file mode 100644 index dfc506dc8f1..00000000000 --- a/src/test/ui/run-pass/issues/issue-47139-2.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #47139: -// -// Same as issue-47139-1.rs, but the impls of dummy are in the -// opposite order. This influenced the way that coherence ran and in -// some cases caused the overflow to occur when it wouldn't otherwise. -// In an effort to make the regr test more robust, I am including both -// orderings. - -#![allow(dead_code)] - -pub trait Insertable { - type Values; - - fn values(self) -> Self::Values; -} - -impl Insertable for Option - where - T: Insertable, - T::Values: Default, -{ - type Values = T::Values; - - fn values(self) -> Self::Values { - self.map(Insertable::values).unwrap_or_default() - } -} - -impl<'a, T> Insertable for &'a Option - where - Option<&'a T>: Insertable, -{ - type Values = as Insertable>::Values; - - fn values(self) -> Self::Values { - self.as_ref().values() - } -} - -impl<'a, T> Insertable for &'a [T] -{ - type Values = Self; - - fn values(self) -> Self::Values { - self - } -} - -trait Unimplemented { } - -trait Dummy { } - -struct Foo { t: T } - -impl Dummy for T - where T: Unimplemented -{ } - -impl<'a, U> Dummy for Foo<&'a U> - where &'a U: Insertable -{ -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-4734.rs b/src/test/ui/run-pass/issues/issue-4734.rs deleted file mode 100644 index 216fd537022..00000000000 --- a/src/test/ui/run-pass/issues/issue-4734.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensures that destructors are run for expressions of the form "e;" where -// `e` is a type which requires a destructor. - - -#![allow(path_statements)] - -struct A { n: isize } -struct B; - -static mut NUM_DROPS: usize = 0; - -impl Drop for A { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} - -impl Drop for B { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} - -fn main() { - assert_eq!(unsafe { NUM_DROPS }, 0); - { let _a = A { n: 1 }; } - assert_eq!(unsafe { NUM_DROPS }, 1); - { A { n: 3 }; } - assert_eq!(unsafe { NUM_DROPS }, 2); - - { let _b = B; } - assert_eq!(unsafe { NUM_DROPS }, 3); - { B; } - assert_eq!(unsafe { NUM_DROPS }, 4); -} diff --git a/src/test/ui/run-pass/issues/issue-4735.rs b/src/test/ui/run-pass/issues/issue-4735.rs deleted file mode 100644 index 1b136be9a91..00000000000 --- a/src/test/ui/run-pass/issues/issue-4735.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::mem::transmute; - -struct NonCopyable(*const u8); - -impl Drop for NonCopyable { - fn drop(&mut self) { - let NonCopyable(p) = *self; - let _v = unsafe { transmute::<*const u8, Box>(p) }; - } -} - -pub fn main() { - let t = Box::new(0); - let p = unsafe { transmute::, *const u8>(t) }; - let _z = NonCopyable(p); -} diff --git a/src/test/ui/run-pass/issues/issue-47364.rs b/src/test/ui/run-pass/issues/issue-47364.rs deleted file mode 100644 index 61dd0714a1f..00000000000 --- a/src/test/ui/run-pass/issues/issue-47364.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -C codegen-units=8 -O -#![allow(non_snake_case)] - -fn main() { - nom_sql::selection(b"x "); -} - -pub enum Err

{ - Position(P), - NodePosition(u32), -} - -pub enum IResult { - Done(I,O), - Error(Err), - Incomplete(u32, u64) -} - -pub fn multispace(input: T) -> ::IResult { - ::IResult::Done(0, 0) -} - -mod nom_sql { - fn where_clause(i: &[u8]) -> ::IResult<&[u8], Option> { - let X = match ::multispace(i) { - ::IResult::Done(..) => ::IResult::Done(i, None::), - _ => ::IResult::Error(::Err::NodePosition(0)), - }; - match X { - ::IResult::Done(_, _) => ::IResult::Done(i, None), - _ => X - } - } - - pub fn selection(i: &[u8]) { - let Y = match { - match { - where_clause(i) - } { - ::IResult::Done(_, o) => ::IResult::Done(i, Some(o)), - ::IResult::Error(_) => ::IResult::Done(i, None), - _ => ::IResult::Incomplete(0, 0), - } - } { - ::IResult::Done(z, _) => ::IResult::Done(z, None::), - _ => return () - }; - match Y { - ::IResult::Done(x, _) => { - let bytes = b"; "; - let len = x.len(); - bytes[len]; - } - _ => () - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-4759-1.rs b/src/test/ui/run-pass/issues/issue-4759-1.rs deleted file mode 100644 index f05cea777af..00000000000 --- a/src/test/ui/run-pass/issues/issue-4759-1.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait U { fn f(self); } -impl U for isize { fn f(self) {} } -pub fn main() { 4.f(); } diff --git a/src/test/ui/run-pass/issues/issue-4759.rs b/src/test/ui/run-pass/issues/issue-4759.rs deleted file mode 100644 index 12f2874341f..00000000000 --- a/src/test/ui/run-pass/issues/issue-4759.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_shorthand_field_patterns)] - -#![feature(box_syntax)] - -struct T { a: Box } - -trait U { - fn f(self); -} - -impl U for Box { - fn f(self) { } -} - -pub fn main() { - let T { a: a } = T { a: box 0 }; - a.f(); -} diff --git a/src/test/ui/run-pass/issues/issue-47638.rs b/src/test/ui/run-pass/issues/issue-47638.rs deleted file mode 100644 index c3c662ea2d4..00000000000 --- a/src/test/ui/run-pass/issues/issue-47638.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn id<'c, 'b>(f: &'c &'b Fn(&i32)) -> &'c &'b Fn(&'static i32) { - f -} - -fn main() { - let f: &Fn(&i32) = &|x| {}; - id(&f); -} diff --git a/src/test/ui/run-pass/issues/issue-47673.rs b/src/test/ui/run-pass/issues/issue-47673.rs deleted file mode 100644 index 96f38deec4c..00000000000 --- a/src/test/ui/run-pass/issues/issue-47673.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use {{}, {}}; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-47703-1.rs b/src/test/ui/run-pass/issues/issue-47703-1.rs deleted file mode 100644 index 8fa931abb86..00000000000 --- a/src/test/ui/run-pass/issues/issue-47703-1.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(nll)] - -struct AtomicRefMut<'a> { - value: &'a mut i32, - borrow: AtomicBorrowRefMut, -} - -struct AtomicBorrowRefMut { -} - -impl Drop for AtomicBorrowRefMut { - fn drop(&mut self) { - } -} - -fn map(orig: AtomicRefMut) -> AtomicRefMut { - AtomicRefMut { - value: orig.value, - borrow: orig.borrow, - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-47703-tuple.rs b/src/test/ui/run-pass/issues/issue-47703-tuple.rs deleted file mode 100644 index 188d4bc5520..00000000000 --- a/src/test/ui/run-pass/issues/issue-47703-tuple.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(nll)] - -struct WithDrop; - -impl Drop for WithDrop { - fn drop(&mut self) {} -} - -fn consume(x: (&mut (), WithDrop)) -> &mut () { x.0 } - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-47703.rs b/src/test/ui/run-pass/issues/issue-47703.rs deleted file mode 100644 index 0a0388ac48e..00000000000 --- a/src/test/ui/run-pass/issues/issue-47703.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(nll)] - -struct MyStruct<'a> { - field: &'a mut (), - field2: WithDrop -} - -struct WithDrop; - -impl Drop for WithDrop { - fn drop(&mut self) {} -} - -impl<'a> MyStruct<'a> { - fn consume(self) -> &'a mut () { self.field } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-47722.rs b/src/test/ui/run-pass/issues/issue-47722.rs deleted file mode 100644 index 92309297356..00000000000 --- a/src/test/ui/run-pass/issues/issue-47722.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Tests that automatic coercions from &mut T to *mut T -// allow borrows of T to expire immediately - essentially, that -// they work identically to 'foo as *mut T' -#![feature(nll)] - -struct SelfReference { - self_reference: *mut SelfReference, -} - -impl SelfReference { - fn set_self_ref(&mut self) { - self.self_reference = self; - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-47789.rs b/src/test/ui/run-pass/issues/issue-47789.rs deleted file mode 100644 index 57aac45e51a..00000000000 --- a/src/test/ui/run-pass/issues/issue-47789.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -#![feature(nll)] - -static mut x: &'static u32 = &0; - -fn foo() { - unsafe { x = &1; } -} - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-48159.rs b/src/test/ui/run-pass/issues/issue-48159.rs deleted file mode 100644 index 2f625747b25..00000000000 --- a/src/test/ui/run-pass/issues/issue-48159.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(repr_packed)] -#![allow(non_camel_case_types)] - -use std::mem; - -pub enum c_void {} - -type uintptr_t = usize; -type int16_t = u16; -type uint16_t = int16_t; -type uint32_t = u32; -type intptr_t = uintptr_t; - -#[repr(C)] -#[repr(packed(4))] -pub struct kevent { - pub ident: uintptr_t, - pub filter: int16_t, - pub flags: uint16_t, - pub fflags: uint32_t, - pub data: intptr_t, - pub udata: *mut c_void, -} - -fn main() { - assert_eq!(mem::align_of::(), 4); -} diff --git a/src/test/ui/run-pass/issues/issue-4830.rs b/src/test/ui/run-pass/issues/issue-4830.rs deleted file mode 100644 index 42800255c6b..00000000000 --- a/src/test/ui/run-pass/issues/issue-4830.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -pub struct Scheduler { - /// The event loop used to drive the scheduler and perform I/O - event_loop: Box -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-48508-aux.rs b/src/test/ui/run-pass/issues/issue-48508-aux.rs deleted file mode 100644 index 1d5ae23cb5e..00000000000 --- a/src/test/ui/run-pass/issues/issue-48508-aux.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-test Not a test. Used by issue-48508.rs - -pub fn other() -> f64 { - let µ = 1.0; - µ -} diff --git a/src/test/ui/run-pass/issues/issue-48508.rs b/src/test/ui/run-pass/issues/issue-48508.rs deleted file mode 100644 index 8297d7c33a7..00000000000 --- a/src/test/ui/run-pass/issues/issue-48508.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #48508: -// -// Confusion between global and local file offsets caused incorrect handling of multibyte character -// spans when compiling multiple files. One visible effect was an ICE generating debug information -// when a multibyte character is at the end of a scope. The problematic code is actually in -// issue-48508-aux.rs - -// compile-flags:-g -// ignore-pretty issue #37195 - -#![feature(non_ascii_idents)] - -#[path = "issue-48508-aux.rs"] -mod other_file; - -fn main() { - other_file::other(); -} diff --git a/src/test/ui/run-pass/issues/issue-48551.rs b/src/test/ui/run-pass/issues/issue-48551.rs deleted file mode 100644 index b4059d1fd75..00000000000 --- a/src/test/ui/run-pass/issues/issue-48551.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #48551. Covers a case where duplicate candidates -// arose during associated type projection. - -use std::ops::{Mul, MulAssign}; - -pub trait ClosedMul: Sized + Mul + MulAssign {} -impl ClosedMul for T -where - T: Mul + MulAssign, -{ -} - -pub trait InnerSpace: ClosedMul<::Real> { - type Real; -} - -pub trait FiniteDimVectorSpace: ClosedMul<::Field> { - type Field; -} - -pub trait FiniteDimInnerSpace - : InnerSpace + FiniteDimVectorSpace::Real> { -} - -pub trait EuclideanSpace: ClosedMul<::Real> { - type Coordinates: FiniteDimInnerSpace - + Mul - + MulAssign; - - type Real; -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-4865-1.rs b/src/test/ui/run-pass/issues/issue-4865-1.rs deleted file mode 100644 index 9a22cf08c04..00000000000 --- a/src/test/ui/run-pass/issues/issue-4865-1.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This should resolve fine. -// Prior to fix, the crossed imports between a and b -// would block on the glob import, itself never being resolved -// because these previous imports were not resolved. - -pub mod a { - use b::fn_b; - use c::*; - - pub fn fn_a(){ - } -} - -pub mod b { - use a::fn_a; - use c::*; - - pub fn fn_b(){ - } -} - -pub mod c{ - pub fn fn_c(){ - } -} - -use a::fn_a; -use b::fn_b; - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-4865-2.rs b/src/test/ui/run-pass/issues/issue-4865-2.rs deleted file mode 100644 index 6d0395f7ab2..00000000000 --- a/src/test/ui/run-pass/issues/issue-4865-2.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Previously, this would have failed to resolve due to the circular -// block between `use say` and `pub use hello::*`. -// -// Now, as `use say` is not `pub`, the glob import can resolve -// without any problem and this resolves fine. - -pub use hello::*; - -pub mod say { - pub fn hello() { println!("hello"); } -} - -pub mod hello { - use say; - - pub fn hello() { - say::hello(); - } -} - -fn main() { - hello(); -} diff --git a/src/test/ui/run-pass/issues/issue-4865-3.rs b/src/test/ui/run-pass/issues/issue-4865-3.rs deleted file mode 100644 index 4a18539c302..00000000000 --- a/src/test/ui/run-pass/issues/issue-4865-3.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This should resolve fine even with the circular imports as -// they are not `pub`. - -pub mod a { - use b::*; -} - -pub mod b { - use a::*; -} - -use a::*; - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-4875.rs b/src/test/ui/run-pass/issues/issue-4875.rs deleted file mode 100644 index d33d08ab18c..00000000000 --- a/src/test/ui/run-pass/issues/issue-4875.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// regression test for issue 4875 - -// pretty-expanded FIXME #23616 - -pub struct Foo { - data: T, -} - -fn foo(Foo{..}: Foo) { -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-48962.rs b/src/test/ui/run-pass/issues/issue-48962.rs deleted file mode 100644 index ea309981af1..00000000000 --- a/src/test/ui/run-pass/issues/issue-48962.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to reinitialize box with moved referent -#![feature(nll)] -static mut ORDER: [usize; 3] = [0, 0, 0]; -static mut INDEX: usize = 0; - -struct Dropee (usize); - -impl Drop for Dropee { - fn drop(&mut self) { - unsafe { - ORDER[INDEX] = self.0; - INDEX = INDEX + 1; - } - } -} - -fn add_sentintel() { - unsafe { - ORDER[INDEX] = 2; - INDEX = INDEX + 1; - } -} - -fn main() { - let mut x = Box::new(Dropee(1)); - *x; // move out from `*x` - add_sentintel(); - *x = Dropee(3); // re-initialize `*x` - {x}; // drop value - unsafe { - assert_eq!(ORDER, [1, 2, 3]); - } -} diff --git a/src/test/ui/run-pass/issues/issue-48984.rs b/src/test/ui/run-pass/issues/issue-48984.rs deleted file mode 100644 index faffc2e4fb0..00000000000 --- a/src/test/ui/run-pass/issues/issue-48984.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-48984-aux.rs -extern crate issue48984aux; -use issue48984aux::Bar; - -fn do_thing() { } - -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-49298.rs b/src/test/ui/run-pass/issues/issue-49298.rs deleted file mode 100644 index 22a34f334cb..00000000000 --- a/src/test/ui/run-pass/issues/issue-49298.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(test)] - -extern crate test; - -enum Void {} - -fn main() { - let mut x: (Void, usize); - let mut y = 42; - x.1 = 13; - - // Make sure `y` stays on the stack. - test::black_box(&mut y); - - // Check that the write to `x.1` did not overwrite `y`. - // Note that this doesn't fail with optimizations enabled, - // because we can't keep `x.1` on the stack, like we can `y`, - // as we can't borrow partially initialized variables. - assert_eq!(y.to_string(), "42"); - - // Check that `(Void, usize)` has space for the `usize` field. - assert_eq!(std::mem::size_of::<(Void, usize)>(), - std::mem::size_of::()); -} diff --git a/src/test/ui/run-pass/issues/issue-49556.rs b/src/test/ui/run-pass/issues/issue-49556.rs deleted file mode 100644 index aeeb55d6c60..00000000000 --- a/src/test/ui/run-pass/issues/issue-49556.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn iter<'a>(data: &'a [usize]) -> impl Iterator + 'a { - data.iter() - .map( - |x| x // fn(&'a usize) -> &'(ReScope) usize - ) - .map( - |x| *x // fn(&'(ReScope) usize) -> usize - ) -} - -fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs b/src/test/ui/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs deleted file mode 100644 index 3a70bdfb2fd..00000000000 --- a/src/test/ui/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(non_shorthand_field_patterns)] - -pub struct Value { pub value: A } - -#[macro_export] -macro_rules! pat { - ($a:pat) => { - Value { value: $a } - }; -} - -fn main() { - let pat!(value) = Value { value: () }; -} diff --git a/src/test/ui/run-pass/issues/issue-49632.rs b/src/test/ui/run-pass/issues/issue-49632.rs deleted file mode 100644 index 2552363b9c9..00000000000 --- a/src/test/ui/run-pass/issues/issue-49632.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(stmt_expr_attributes)] - -pub fn main() { - let _x = #[inline(always)] || {}; - let _y = #[inline(never)] || {}; - let _z = #[inline] || {}; -} diff --git a/src/test/ui/run-pass/issues/issue-49685.rs b/src/test/ui/run-pass/issues/issue-49685.rs deleted file mode 100644 index e4dfef1e3da..00000000000 --- a/src/test/ui/run-pass/issues/issue-49685.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for #49685: drop elaboration was not revealing the -// value of `impl Trait` returns, leading to an ICE. - -fn main() { - let _ = Some(()) - .into_iter() - .flat_map(|_| Some(()).into_iter().flat_map(func)); -} - -fn func(_: ()) -> impl Iterator { - Some(()).into_iter().flat_map(|_| vec![]) -} diff --git a/src/test/ui/run-pass/issues/issue-49854.rs b/src/test/ui/run-pass/issues/issue-49854.rs deleted file mode 100644 index 5dd323eaf8e..00000000000 --- a/src/test/ui/run-pass/issues/issue-49854.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ffi::OsString; - -fn main() { - let os_str = OsString::from("Hello Rust!"); - - assert_eq!(os_str, "Hello Rust!"); - assert_eq!("Hello Rust!", os_str); -} diff --git a/src/test/ui/run-pass/issues/issue-49955-2.rs b/src/test/ui/run-pass/issues/issue-49955-2.rs deleted file mode 100644 index 40827b01622..00000000000 --- a/src/test/ui/run-pass/issues/issue-49955-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z borrowck=mir - -use std::cell::Cell; - -#[inline(never)] -fn tuple_field() -> &'static u32 { - // This test is MIR-borrowck-only because the old borrowck - // doesn't agree that borrows of "frozen" (i.e. without any - // interior mutability) fields of non-frozen temporaries, - // should be promoted, while MIR promotion does promote them. - &(Cell::new(5), 42).1 -} - -fn main() { - assert_eq!(tuple_field().to_string(), "42"); -} diff --git a/src/test/ui/run-pass/issues/issue-49955.rs b/src/test/ui/run-pass/issues/issue-49955.rs deleted file mode 100644 index a5e67928115..00000000000 --- a/src/test/ui/run-pass/issues/issue-49955.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z borrowck=compare - -const ALL_THE_NUMS: [u32; 1] = [ - 1 -]; - -#[inline(never)] -fn array(i: usize) -> &'static u32 { - return &ALL_THE_NUMS[i]; -} - -#[inline(never)] -fn tuple_field() -> &'static u32 { - &(42,).0 -} - -fn main() { - assert_eq!(tuple_field().to_string(), "42"); - assert_eq!(array(0).to_string(), "1"); -} diff --git a/src/test/ui/run-pass/issues/issue-49973.rs b/src/test/ui/run-pass/issues/issue-49973.rs deleted file mode 100644 index c5a3f6c124a..00000000000 --- a/src/test/ui/run-pass/issues/issue-49973.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -#[repr(i32)] -enum E { - Min = -2147483648i32, - _Max = 2147483647i32, -} - -fn main() { - assert_eq!(Some(E::Min).unwrap() as i32, -2147483648i32); -} diff --git a/src/test/ui/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs b/src/test/ui/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs deleted file mode 100644 index 6a08a0c58ac..00000000000 --- a/src/test/ui/run-pass/issues/issue-5008-borrowed-traitobject-method-call.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -/* - -#5008 cast to &Trait causes code to segfault on method call - -It fixes itself if the &Trait is changed to @Trait. -*/ - -trait Debuggable { - fn debug_name(&self) -> String; -} - -#[derive(Clone)] -struct Thing { - name: String, -} - -impl Thing { - fn new() -> Thing { Thing { name: "dummy".to_string() } } -} - -impl Debuggable for Thing { - fn debug_name(&self) -> String { self.name.clone() } -} - -fn print_name(x: &Debuggable) -{ - println!("debug_name = {}", x.debug_name()); -} - -pub fn main() { - let thing = Thing::new(); - print_name(&thing as &Debuggable); -} diff --git a/src/test/ui/run-pass/issues/issue-50415.rs b/src/test/ui/run-pass/issues/issue-50415.rs deleted file mode 100644 index 282b3b414fa..00000000000 --- a/src/test/ui/run-pass/issues/issue-50415.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - // -------- Simplified test case -------- - - let _ = || 0..=1; - - // -------- Original test case -------- - - let full_length = 1024; - let range = { - // do some stuff, omit here - None - }; - - let range = range.map(|(s, t)| s..=t).unwrap_or(0..=(full_length-1)); - - assert_eq!(range, 0..=1023); -} diff --git a/src/test/ui/run-pass/issues/issue-50442.rs b/src/test/ui/run-pass/issues/issue-50442.rs deleted file mode 100644 index 6a55f2d633b..00000000000 --- a/src/test/ui/run-pass/issues/issue-50442.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Void {} - -enum Foo { - A(i32), - B(Void), - C(i32) -} - -fn main() { - let _foo = Foo::A(0); -} diff --git a/src/test/ui/run-pass/issues/issue-5060.rs b/src/test/ui/run-pass/issues/issue-5060.rs deleted file mode 100644 index 2caa6541f09..00000000000 --- a/src/test/ui/run-pass/issues/issue-5060.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! print_hd_tl { - ($field_hd:ident, $($field_tl:ident),+) => ({ - print!("{}", stringify!($field_hd)); - print!("::["); - $( - print!("{}", stringify!($field_tl)); - print!(", "); - )+ - print!("]\n"); - }) -} - -pub fn main() { - print_hd_tl!(x, y, z, w) -} diff --git a/src/test/ui/run-pass/issues/issue-50689.rs b/src/test/ui/run-pass/issues/issue-50689.rs deleted file mode 100644 index bc94066b041..00000000000 --- a/src/test/ui/run-pass/issues/issue-50689.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Foo { - Bar = (|x: i32| { }, 42).1, -} - -fn main() { - assert_eq!(Foo::Bar as usize, 42); -} diff --git a/src/test/ui/run-pass/issues/issue-50731.rs b/src/test/ui/run-pass/issues/issue-50731.rs deleted file mode 100644 index fd1d5579fbf..00000000000 --- a/src/test/ui/run-pass/issues/issue-50731.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Void {} -fn foo(_: Result<(Void, u32), (Void, String)>) {} -fn main() { - let _: fn(_) = foo; -} diff --git a/src/test/ui/run-pass/issues/issue-50811.rs b/src/test/ui/run-pass/issues/issue-50811.rs deleted file mode 100644 index 381afd4ee11..00000000000 --- a/src/test/ui/run-pass/issues/issue-50811.rs +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(test)] - -extern crate test; - -use std::f64::{NAN, NEG_INFINITY, INFINITY, MAX}; -use std::mem::size_of; -use test::black_box; - -// Ensure the const-eval result and runtime result of float comparison are equivalent. - -macro_rules! compare { - ($op:tt) => { - compare!( - [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN], - $op - ); - }; - ([$($lhs:expr),+], $op:tt) => { - $(compare!( - $lhs, - $op, - [NEG_INFINITY, -MAX, -1.0, -0.0, 0.0, 1.0, MAX, INFINITY, NAN] - );)+ - }; - ($lhs:expr, $op:tt, [$($rhs:expr),+]) => { - $({ - // Wrap the check in its own function to reduce time needed to borrowck. - fn check() { - static CONST_EVAL: bool = $lhs $op $rhs; - let runtime_eval = black_box($lhs) $op black_box($rhs); - assert_eq!(CONST_EVAL, runtime_eval, stringify!($lhs $op $rhs)); - assert_eq!( - size_of::<[u8; ($lhs $op $rhs) as usize]>(), - runtime_eval as usize, - stringify!($lhs $op $rhs (forced const eval)) - ); - } - check(); - })+ - }; -} - -fn main() { - assert_eq!(0.0/0.0 < 0.0/0.0, false); - assert_eq!(0.0/0.0 > 0.0/0.0, false); - assert_eq!(NAN < NAN, false); - assert_eq!(NAN > NAN, false); - - compare!(==); - compare!(!=); - compare!(<); - compare!(<=); - compare!(>); - compare!(>=); -} diff --git a/src/test/ui/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs b/src/test/ui/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs deleted file mode 100644 index 306256d53d3..00000000000 --- a/src/test/ui/run-pass/issues/issue-50865-private-impl-trait/auxiliary/lib.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub fn bar

( // Error won't happen if "bar" is not generic - _baz: P, -) { - hide_foo()(); -} - -fn hide_foo() -> impl Fn() { // Error won't happen if "iterate" hasn't impl Trait or has generics - foo -} - -fn foo() { // Error won't happen if "foo" isn't used in "iterate" or has generics -} diff --git a/src/test/ui/run-pass/issues/issue-50865-private-impl-trait/main.rs b/src/test/ui/run-pass/issues/issue-50865-private-impl-trait/main.rs deleted file mode 100644 index 8c53ecd9c55..00000000000 --- a/src/test/ui/run-pass/issues/issue-50865-private-impl-trait/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:lib.rs - -// Regression test for #50865. -// When using generics or specifying the type directly, this example -// codegens `foo` internally. However, when using a private `impl Trait` -// function which references another private item, `foo` (in this case) -// wouldn't be codegenned until main.rs used `bar`, as with impl Trait -// it is not cast to `fn()` automatically to satisfy e.g. -// `fn foo() -> fn() { ... }`. - -extern crate lib; - -fn main() { - lib::bar(()); // Error won't happen if bar is called from same crate -} diff --git a/src/test/ui/run-pass/issues/issue-51185.rs b/src/test/ui/run-pass/issues/issue-51185.rs deleted file mode 100644 index 3fd38e76d1d..00000000000 --- a/src/test/ui/run-pass/issues/issue-51185.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo() -> impl Into fn(&'a ())> { - (|_| {}) as for<'a> fn(&'a ()) -} - -fn main() { - foo().into()(&()); -} diff --git a/src/test/ui/run-pass/issues/issue-51345.rs b/src/test/ui/run-pass/issues/issue-51345.rs deleted file mode 100644 index 887feada3c8..00000000000 --- a/src/test/ui/run-pass/issues/issue-51345.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(nll)] - -fn main() { - let mut v = Vec::new(); - - loop { v.push(break) } -} diff --git a/src/test/ui/run-pass/issues/issue-51582.rs b/src/test/ui/run-pass/issues/issue-51582.rs deleted file mode 100644 index 6c513e843eb..00000000000 --- a/src/test/ui/run-pass/issues/issue-51582.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] - -#[repr(i8)] -pub enum Enum { - VariantA, - VariantB, -} - -fn make_b() -> Enum { Enum::VariantB } - -fn main() { - assert_eq!(1, make_b() as i8); - assert_eq!(1, make_b() as u8); - assert_eq!(1, make_b() as i32); - assert_eq!(1, make_b() as u32); - assert_eq!(1, unsafe { std::intrinsics::discriminant_value(&make_b()) }); -} diff --git a/src/test/ui/run-pass/issues/issue-51655.rs b/src/test/ui/run-pass/issues/issue-51655.rs deleted file mode 100644 index 17c04a4097a..00000000000 --- a/src/test/ui/run-pass/issues/issue-51655.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -const PATH_DOT: &[u8] = &[b'.']; - -fn match_slice(element: &[u8]) { - match element { - &[] => {} - PATH_DOT => {} - _ => {} - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-51907.rs b/src/test/ui/run-pass/issues/issue-51907.rs deleted file mode 100644 index 3ac31fde31f..00000000000 --- a/src/test/ui/run-pass/issues/issue-51907.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - extern fn borrow(&self); - extern fn take(self: Box); -} - -struct Bar; -impl Foo for Bar { - extern fn borrow(&self) {} - extern fn take(self: Box) {} -} - -fn main() { - let foo: Box = Box::new(Bar); - foo.borrow(); - foo.take() -} diff --git a/src/test/ui/run-pass/issues/issue-5192.rs b/src/test/ui/run-pass/issues/issue-5192.rs deleted file mode 100644 index df9664dc234..00000000000 --- a/src/test/ui/run-pass/issues/issue-5192.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub trait EventLoop { - fn dummy(&self) { } -} - -pub struct UvEventLoop { - uvio: isize -} - -impl UvEventLoop { - pub fn new() -> UvEventLoop { - UvEventLoop { - uvio: 0 - } - } -} - -impl EventLoop for UvEventLoop { -} - -pub struct Scheduler { - event_loop: Box, -} - -impl Scheduler { - - pub fn new(event_loop: Box) -> Scheduler { - Scheduler { - event_loop: event_loop, - } - } -} - -pub fn main() { - let _sched = Scheduler::new(box UvEventLoop::new() as Box); -} diff --git a/src/test/ui/run-pass/issues/issue-52140/auxiliary/some_crate.rs b/src/test/ui/run-pass/issues/issue-52140/auxiliary/some_crate.rs deleted file mode 100644 index bf8dee0863a..00000000000 --- a/src/test/ui/run-pass/issues/issue-52140/auxiliary/some_crate.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub fn hello() { - println!("Hello, world!"); -} diff --git a/src/test/ui/run-pass/issues/issue-52140/main.rs b/src/test/ui/run-pass/issues/issue-52140/main.rs deleted file mode 100644 index 3d727e2ad1b..00000000000 --- a/src/test/ui/run-pass/issues/issue-52140/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:some_crate.rs -// compile-flags:--extern some_crate -// edition:2018 - -mod foo { - pub use some_crate; -} - -fn main() { - ::some_crate::hello(); - foo::some_crate::hello(); -} diff --git a/src/test/ui/run-pass/issues/issue-52141/auxiliary/some_crate.rs b/src/test/ui/run-pass/issues/issue-52141/auxiliary/some_crate.rs deleted file mode 100644 index bf8dee0863a..00000000000 --- a/src/test/ui/run-pass/issues/issue-52141/auxiliary/some_crate.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub fn hello() { - println!("Hello, world!"); -} diff --git a/src/test/ui/run-pass/issues/issue-52141/main.rs b/src/test/ui/run-pass/issues/issue-52141/main.rs deleted file mode 100644 index 20705dc38e1..00000000000 --- a/src/test/ui/run-pass/issues/issue-52141/main.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:some_crate.rs -// compile-flags:--extern some_crate -// edition:2018 - -use some_crate as some_name; - -mod foo { - pub use crate::some_name::*; -} - -fn main() { - ::some_crate::hello(); - some_name::hello(); - foo::hello(); -} diff --git a/src/test/ui/run-pass/issues/issue-52169.rs b/src/test/ui/run-pass/issues/issue-52169.rs deleted file mode 100644 index 19c0f51d235..00000000000 --- a/src/test/ui/run-pass/issues/issue-52169.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(macro_literal_matcher)] - -macro_rules! a { - ($i:literal) => { "right" }; - ($i:tt) => { "wrong" }; -} - -macro_rules! b { - ($i:literal) => { a!($i) }; -} - -fn main() { - assert_eq!(b!(0), "right"); -} diff --git a/src/test/ui/run-pass/issues/issue-5239-2.rs b/src/test/ui/run-pass/issues/issue-5239-2.rs deleted file mode 100644 index 2b328c5177c..00000000000 --- a/src/test/ui/run-pass/issues/issue-5239-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #5239 - - -pub fn main() { - let _f = |ref x: isize| { *x }; - let foo = 10; - assert_eq!(_f(foo), 10); -} diff --git a/src/test/ui/run-pass/issues/issue-5243.rs b/src/test/ui/run-pass/issues/issue-5243.rs deleted file mode 100644 index 708187643d8..00000000000 --- a/src/test/ui/run-pass/issues/issue-5243.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that merely having lifetime parameters is not -// enough for codegen to consider this as non-monomorphic, -// which led to various assertions and failures in turn. - -// pretty-expanded FIXME #23616 - -struct S<'a> { - v: &'a isize -} - -fn f<'lt>(_s: &'lt S<'lt>) {} - -pub fn main() { - f(& S { v: &42 }); -} diff --git a/src/test/ui/run-pass/issues/issue-52557.rs b/src/test/ui/run-pass/issues/issue-52557.rs deleted file mode 100644 index 3c987d32b90..00000000000 --- a/src/test/ui/run-pass/issues/issue-52557.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test checks for namespace pollution by private tests. -// Tests used to marked as public causing name conflicts with normal -// functions only in test builds. - -// compile-flags: --test - -mod a { - pub fn foo() -> bool { - true - } -} - -mod b { - #[test] - fn foo() { - local_name(); // ensure the local name still works - } - - #[test] - fn local_name() {} -} - -use a::*; -use b::*; - -pub fn conflict() { - let _: bool = foo(); -} diff --git a/src/test/ui/run-pass/issues/issue-52705/auxiliary/png2.rs b/src/test/ui/run-pass/issues/issue-52705/auxiliary/png2.rs deleted file mode 100644 index 48d53a2cbac..00000000000 --- a/src/test/ui/run-pass/issues/issue-52705/auxiliary/png2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -pub struct DecodingError; diff --git a/src/test/ui/run-pass/issues/issue-52705/main.rs b/src/test/ui/run-pass/issues/issue-52705/main.rs deleted file mode 100644 index 00cb5ac103a..00000000000 --- a/src/test/ui/run-pass/issues/issue-52705/main.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:png2.rs -// compile-flags:--extern png2 -// edition:2018 - -mod png { - use png2 as png_ext; - - fn foo() -> png_ext::DecodingError { unimplemented!() } -} - -fn main() { - println!("Hello, world!"); -} diff --git a/src/test/ui/run-pass/issues/issue-5280.rs b/src/test/ui/run-pass/issues/issue-5280.rs deleted file mode 100644 index f80b80c72af..00000000000 --- a/src/test/ui/run-pass/issues/issue-5280.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -type FontTableTag = u32; - -trait FontTableTagConversions { - fn tag_to_string(self); -} - -impl FontTableTagConversions for FontTableTag { - fn tag_to_string(self) { - &self; - } -} - -pub fn main() { - 5.tag_to_string(); -} diff --git a/src/test/ui/run-pass/issues/issue-5315.rs b/src/test/ui/run-pass/issues/issue-5315.rs deleted file mode 100644 index 11a6b61dc58..00000000000 --- a/src/test/ui/run-pass/issues/issue-5315.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct A(bool); - -pub fn main() { - let f = A; - f(true); -} diff --git a/src/test/ui/run-pass/issues/issue-5321-immediates-with-bare-self.rs b/src/test/ui/run-pass/issues/issue-5321-immediates-with-bare-self.rs deleted file mode 100644 index 54d45716de1..00000000000 --- a/src/test/ui/run-pass/issues/issue-5321-immediates-with-bare-self.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Fooable { - fn yes(self); -} - -impl Fooable for usize { - fn yes(self) { - for _ in 0..self { println!("yes"); } - } -} - -pub fn main() { - 2.yes(); -} diff --git a/src/test/ui/run-pass/issues/issue-53333.rs b/src/test/ui/run-pass/issues/issue-53333.rs deleted file mode 100644 index 8cb0d17cc16..00000000000 --- a/src/test/ui/run-pass/issues/issue-53333.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// edition:2018 - -fn main() { - use std; - let std = "std"; - println!("{}", std); -} diff --git a/src/test/ui/run-pass/issues/issue-5353.rs b/src/test/ui/run-pass/issues/issue-5353.rs deleted file mode 100644 index 678a42e7549..00000000000 --- a/src/test/ui/run-pass/issues/issue-5353.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -const INVALID_ENUM : u32 = 0; -const INVALID_VALUE : u32 = 1; - -fn gl_err_str(err: u32) -> String -{ - match err - { - INVALID_ENUM => { "Invalid enum".to_string() }, - INVALID_VALUE => { "Invalid value".to_string() }, - _ => { "Unknown error".to_string() } - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-5518.rs b/src/test/ui/run-pass/issues/issue-5518.rs deleted file mode 100644 index 4adcc7822e6..00000000000 --- a/src/test/ui/run-pass/issues/issue-5518.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-5518.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_5518 as other; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-5521.rs b/src/test/ui/run-pass/issues/issue-5521.rs deleted file mode 100644 index 4890156f7b8..00000000000 --- a/src/test/ui/run-pass/issues/issue-5521.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-5521.rs - - - -extern crate issue_5521 as foo; - -fn bar(a: foo::map) { - if false { - panic!(); - } else { - let _b = &(*a)[&2]; - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-5530.rs b/src/test/ui/run-pass/issues/issue-5530.rs deleted file mode 100644 index cf0a225290f..00000000000 --- a/src/test/ui/run-pass/issues/issue-5530.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum Enum { - Foo { foo: usize }, - Bar { bar: usize } -} - -fn fun1(e1: &Enum, e2: &Enum) -> usize { - match (e1, e2) { - (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0, - (&Enum::Foo { foo: _ }, &Enum::Bar { bar: _ }) => 1, - (&Enum::Bar { bar: _ }, &Enum::Bar { bar: _ }) => 2, - (&Enum::Bar { bar: _ }, &Enum::Foo { foo: _ }) => 3, - } -} - -fn fun2(e1: &Enum, e2: &Enum) -> usize { - match (e1, e2) { - (&Enum::Foo { foo: _ }, &Enum::Foo { foo: _ }) => 0, - (&Enum::Foo { foo: _ }, _ ) => 1, - (&Enum::Bar { bar: _ }, &Enum::Bar { bar: _ }) => 2, - (&Enum::Bar { bar: _ }, _ ) => 3, - } -} - -pub fn main() { - let foo = Enum::Foo { foo: 1 }; - let bar = Enum::Bar { bar: 1 }; - - assert_eq!(fun1(&foo, &foo), 0); - assert_eq!(fun1(&foo, &bar), 1); - assert_eq!(fun1(&bar, &bar), 2); - assert_eq!(fun1(&bar, &foo), 3); - - assert_eq!(fun2(&foo, &foo), 0); - assert_eq!(fun2(&foo, &bar), 1); // fun2 returns 0 - assert_eq!(fun2(&bar, &bar), 2); - assert_eq!(fun2(&bar, &foo), 3); // fun2 returns 2 -} diff --git a/src/test/ui/run-pass/issues/issue-5550.rs b/src/test/ui/run-pass/issues/issue-5550.rs deleted file mode 100644 index 3b0f19b1f8b..00000000000 --- a/src/test/ui/run-pass/issues/issue-5550.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - let s: String = "foobar".to_string(); - let mut t: &str = &s; - t = &t[0..3]; // for master: str::view(t, 0, 3) maybe -} diff --git a/src/test/ui/run-pass/issues/issue-5554.rs b/src/test/ui/run-pass/issues/issue-5554.rs deleted file mode 100644 index 8ff48c8600e..00000000000 --- a/src/test/ui/run-pass/issues/issue-5554.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::default::Default; - -pub struct X { - a: T, -} - -// reordering these bounds stops the ICE -// -// nmatsakis: This test used to have the bounds Default + PartialEq + -// Default, but having duplicate bounds became illegal. -impl Default for X { - fn default() -> X { - X { a: Default::default() } - } -} - -macro_rules! constants { - () => { - let _ : X = Default::default(); - } -} - -pub fn main() { - constants!(); -} diff --git a/src/test/ui/run-pass/issues/issue-5572.rs b/src/test/ui/run-pass/issues/issue-5572.rs deleted file mode 100644 index 418119e2fd6..00000000000 --- a/src/test/ui/run-pass/issues/issue-5572.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo(_t: T) { } - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-5666.rs b/src/test/ui/run-pass/issues/issue-5666.rs deleted file mode 100644 index c578397487e..00000000000 --- a/src/test/ui/run-pass/issues/issue-5666.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Dog { - name : String -} - -trait Barks { - fn bark(&self) -> String; -} - -impl Barks for Dog { - fn bark(&self) -> String { - return format!("woof! (I'm {})", self.name); - } -} - - -pub fn main() { - let snoopy = box Dog{name: "snoopy".to_string()}; - let bubbles = box Dog{name: "bubbles".to_string()}; - let barker = [snoopy as Box, bubbles as Box]; - - for pup in &barker { - println!("{}", pup.bark()); - } -} diff --git a/src/test/ui/run-pass/issues/issue-5688.rs b/src/test/ui/run-pass/issues/issue-5688.rs deleted file mode 100644 index fdad413776e..00000000000 --- a/src/test/ui/run-pass/issues/issue-5688.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -/* -# Corrupted initialization in the static struct - -...should print &[1, 2, 3] but instead prints something like -&[4492532864, 24]. It is pretty evident that the compiler messed up -with the representation of [isize; n] and [isize] somehow, or at least -failed to typecheck correctly. -*/ - -#[derive(Copy, Clone)] -struct X { vec: &'static [isize] } - -static V: &'static [X] = &[X { vec: &[1, 2, 3] }]; - -pub fn main() { - for &v in V { - println!("{:?}", v.vec); - } -} diff --git a/src/test/ui/run-pass/issues/issue-5708.rs b/src/test/ui/run-pass/issues/issue-5708.rs deleted file mode 100644 index 2fef9bc1973..00000000000 --- a/src/test/ui/run-pass/issues/issue-5708.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -/* -# ICE when returning struct with reference to trait - -A function which takes a reference to a trait and returns a -struct with that reference results in an ICE. - -This does not occur with concrete types, only with references -to traits. -*/ - - -// original -trait Inner { - fn print(&self); -} - -impl Inner for isize { - fn print(&self) { print!("Inner: {}\n", *self); } -} - -struct Outer<'a> { - inner: &'a (Inner+'a) -} - -impl<'a> Outer<'a> { - fn new(inner: &Inner) -> Outer { - Outer { - inner: inner - } - } -} - -pub fn main() { - let inner: isize = 5; - let outer = Outer::new(&inner as &Inner); - outer.inner.print(); -} - - -// minimal -pub trait MyTrait { - fn dummy(&self, t: T) -> T { panic!() } -} - -pub struct MyContainer<'a, T:'a> { - foos: Vec<&'a (MyTrait+'a)> , -} - -impl<'a, T> MyContainer<'a, T> { - pub fn add (&mut self, foo: &'a MyTrait) { - self.foos.push(foo); - } -} diff --git a/src/test/ui/run-pass/issues/issue-5718.rs b/src/test/ui/run-pass/issues/issue-5718.rs deleted file mode 100644 index 444d3103ada..00000000000 --- a/src/test/ui/run-pass/issues/issue-5718.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -struct Element; - -macro_rules! foo { - ($tag: expr, $string: expr) => { - if $tag == $string { - let element: Box<_> = box Element; - unsafe { - return std::mem::transmute::<_, usize>(element); - } - } - } -} - -fn bar() -> usize { - foo!("a", "b"); - 0 -} - -fn main() { - bar(); -} diff --git a/src/test/ui/run-pass/issues/issue-5741.rs b/src/test/ui/run-pass/issues/issue-5741.rs deleted file mode 100644 index f3beeff60fb..00000000000 --- a/src/test/ui/run-pass/issues/issue-5741.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(while_true)] -#![allow(unreachable_code)] - -pub fn main() { - return; - while true {}; -} diff --git a/src/test/ui/run-pass/issues/issue-5754.rs b/src/test/ui/run-pass/issues/issue-5754.rs deleted file mode 100644 index ba79c32a83d..00000000000 --- a/src/test/ui/run-pass/issues/issue-5754.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// pretty-expanded FIXME #23616 - -struct TwoDoubles { - r: f64, - i: f64 -} - -extern "C" { - fn rust_dbg_extern_identity_TwoDoubles(arg1: TwoDoubles) -> TwoDoubles; -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-5791.rs b/src/test/ui/run-pass/issues/issue-5791.rs deleted file mode 100644 index e6c9106111f..00000000000 --- a/src/test/ui/run-pass/issues/issue-5791.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -extern { - #[link_name = "malloc"] - fn malloc1(len: i32) -> *const u8; - #[link_name = "malloc"] - fn malloc2(len: i32, foo: i32) -> *const u8; -} - -pub fn main () {} diff --git a/src/test/ui/run-pass/issues/issue-5884.rs b/src/test/ui/run-pass/issues/issue-5884.rs deleted file mode 100644 index 26816f235e9..00000000000 --- a/src/test/ui/run-pass/issues/issue-5884.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub struct Foo { - a: isize, -} - -struct Bar<'a> { - a: Box>, - b: &'a Foo, -} - -fn check(a: Box) { - let _ic = Bar{ b: &*a, a: box None }; -} - -pub fn main(){} diff --git a/src/test/ui/run-pass/issues/issue-5900.rs b/src/test/ui/run-pass/issues/issue-5900.rs deleted file mode 100644 index d75291bf1f3..00000000000 --- a/src/test/ui/run-pass/issues/issue-5900.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub mod foo { - use super::Bar; - - pub struct FooStruct { bar : Bar } -} - -pub enum Bar { - Bar0 = 0 as isize -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-5917.rs b/src/test/ui/run-pass/issues/issue-5917.rs deleted file mode 100644 index 75466c01fed..00000000000 --- a/src/test/ui/run-pass/issues/issue-5917.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -struct T (&'static [isize]); -static t : T = T (&[5, 4, 3]); -pub fn main () { - let T(ref v) = t; - assert_eq!(v[0], 5); -} diff --git a/src/test/ui/run-pass/issues/issue-5950.rs b/src/test/ui/run-pass/issues/issue-5950.rs deleted file mode 100644 index 239f9680413..00000000000 --- a/src/test/ui/run-pass/issues/issue-5950.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -pub use local as local_alias; - -pub mod local { } - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-5988.rs b/src/test/ui/run-pass/issues/issue-5988.rs deleted file mode 100644 index d068195ade7..00000000000 --- a/src/test/ui/run-pass/issues/issue-5988.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait B { - fn f(&self); -} - -trait T : B { -} - -struct A; - -impl B for U { - fn f(&self) { } -} - -impl T for A { -} - -fn main() { - let a = A; - let br = &a as &B; - br.f(); -} diff --git a/src/test/ui/run-pass/issues/issue-5997.rs b/src/test/ui/run-pass/issues/issue-5997.rs deleted file mode 100644 index d888f691477..00000000000 --- a/src/test/ui/run-pass/issues/issue-5997.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn f() -> bool { - enum E { V(T) } - - struct S(T); - - true -} - -fn main() { - let b = f::(); - assert!(b); -} diff --git a/src/test/ui/run-pass/issues/issue-6117.rs b/src/test/ui/run-pass/issues/issue-6117.rs deleted file mode 100644 index fa9ef84746d..00000000000 --- a/src/test/ui/run-pass/issues/issue-6117.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Either { Left(T), Right(U) } - -pub fn main() { - match Either::Left(Box::new(17)) { - Either::Right(()) => {} - _ => {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-6128.rs b/src/test/ui/run-pass/issues/issue-6128.rs deleted file mode 100644 index d060da34723..00000000000 --- a/src/test/ui/run-pass/issues/issue-6128.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(box_syntax)] - -use std::collections::HashMap; - -trait Graph { - fn f(&self, _: Edge); - fn g(&self, _: Node); -} - -impl Graph for HashMap { - fn f(&self, _e: E) { - panic!(); - } - fn g(&self, _e: isize) { - panic!(); - } -} - -pub fn main() { - let g : Box> = box HashMap::new(); - let _g2 : Box> = g as Box>; -} diff --git a/src/test/ui/run-pass/issues/issue-6130.rs b/src/test/ui/run-pass/issues/issue-6130.rs deleted file mode 100644 index 12c2abf9c98..00000000000 --- a/src/test/ui/run-pass/issues/issue-6130.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let i: usize = 0; - assert!(i <= 0xFFFF_FFFF); - - let i: isize = 0; - assert!(i >= -0x8000_0000); - assert!(i <= 0x7FFF_FFFF); -} diff --git a/src/test/ui/run-pass/issues/issue-6153.rs b/src/test/ui/run-pass/issues/issue-6153.rs deleted file mode 100644 index e6141b0121c..00000000000 --- a/src/test/ui/run-pass/issues/issue-6153.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn swap(f: F) -> Vec where F: FnOnce(Vec) -> Vec { - let x = vec![1, 2, 3]; - f(x) -} - -pub fn main() { - let v = swap(|mut x| { x.push(4); x }); - let w = swap(|mut x| { x.push(4); x }); - assert_eq!(v, w); -} diff --git a/src/test/ui/run-pass/issues/issue-6157.rs b/src/test/ui/run-pass/issues/issue-6157.rs deleted file mode 100644 index ff4c6adc55d..00000000000 --- a/src/test/ui/run-pass/issues/issue-6157.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait OpInt { fn call(&mut self, _: isize, _: isize) -> isize; } - -impl OpInt for F where F: FnMut(isize, isize) -> isize { - fn call(&mut self, a:isize, b:isize) -> isize { - (*self)(a, b) - } -} - -fn squarei<'a>(x: isize, op: &'a mut OpInt) -> isize { op.call(x, x) } - -fn muli(x:isize, y:isize) -> isize { x * y } - -pub fn main() { - let mut f = |x, y| muli(x, y); - { - let g = &mut f; - let h = g as &mut OpInt; - squarei(3, h); - } -} diff --git a/src/test/ui/run-pass/issues/issue-6318.rs b/src/test/ui/run-pass/issues/issue-6318.rs deleted file mode 100644 index 59ca54a4318..00000000000 --- a/src/test/ui/run-pass/issues/issue-6318.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub enum Thing { - A(Box) -} - -pub trait Foo { - fn dummy(&self) { } -} - -pub struct Struct; - -impl Foo for Struct {} - -pub fn main() { - match Thing::A(box Struct as Box) { - Thing::A(_a) => 0, - }; -} diff --git a/src/test/ui/run-pass/issues/issue-6334.rs b/src/test/ui/run-pass/issues/issue-6334.rs deleted file mode 100644 index e7c6e74938f..00000000000 --- a/src/test/ui/run-pass/issues/issue-6334.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that everything still compiles and runs fine even when -// we reorder the bounds. - - -trait A { - fn a(&self) -> usize; -} - -trait B { - fn b(&self) -> usize; -} - -trait C { - fn combine(&self, t: &T) -> usize; -} - -struct Foo; - -impl A for Foo { - fn a(&self) -> usize { 1 } -} - -impl B for Foo { - fn b(&self) -> usize { 2 } -} - -struct Bar; - -impl C for Bar { - // Note below: bounds in impl decl are in reverse order. - fn combine(&self, t: &T) -> usize { - (t.a() * 100) + t.b() - } -} - -fn use_c(s: &S, t: &T) -> usize { - s.combine(t) -} - -pub fn main() { - let foo = Foo; - let bar = Bar; - let r = use_c(&bar, &foo); - assert_eq!(r, 102); -} diff --git a/src/test/ui/run-pass/issues/issue-6341.rs b/src/test/ui/run-pass/issues/issue-6341.rs deleted file mode 100644 index ca79e304b15..00000000000 --- a/src/test/ui/run-pass/issues/issue-6341.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#[derive(PartialEq)] -struct A { x: usize } - -impl Drop for A { - fn drop(&mut self) {} -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-6344-let.rs b/src/test/ui/run-pass/issues/issue-6344-let.rs deleted file mode 100644 index 83d908d597c..00000000000 --- a/src/test/ui/run-pass/issues/issue-6344-let.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -struct A { x: usize } - -impl Drop for A { - fn drop(&mut self) {} -} - -pub fn main() { - let a = A { x: 0 }; - - let A { x: ref x } = a; - println!("{}", x) -} diff --git a/src/test/ui/run-pass/issues/issue-6344-match.rs b/src/test/ui/run-pass/issues/issue-6344-match.rs deleted file mode 100644 index c427ca6526c..00000000000 --- a/src/test/ui/run-pass/issues/issue-6344-match.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -struct A { x: usize } - -impl Drop for A { - fn drop(&mut self) {} -} - -pub fn main() { - let a = A { x: 0 }; - - match a { - A { x : ref x } => { - println!("{}", x) - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-6449.rs b/src/test/ui/run-pass/issues/issue-6449.rs deleted file mode 100644 index 1987bca9330..00000000000 --- a/src/test/ui/run-pass/issues/issue-6449.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum Foo { - Bar(isize), - Baz, -} - -enum Other { - Other1(Foo), - Other2(Foo, Foo), -} - -fn main() { - match Foo::Baz { - ::Foo::Bar(3) => panic!(), - ::Foo::Bar(_) if false => panic!(), - ::Foo::Bar(..) if false => panic!(), - ::Foo::Bar(_n) => panic!(), - ::Foo::Baz => {} - } - match Foo::Bar(3) { - ::Foo::Bar(3) => {} - ::Foo::Bar(_) if false => panic!(), - ::Foo::Bar(..) if false => panic!(), - ::Foo::Bar(_n) => panic!(), - ::Foo::Baz => panic!(), - } - match Foo::Bar(4) { - ::Foo::Bar(3) => panic!(), - ::Foo::Bar(_) if false => panic!(), - ::Foo::Bar(..) if false => panic!(), - ::Foo::Bar(n) => assert_eq!(n, 4), - ::Foo::Baz => panic!(), - } - - match Other::Other1(Foo::Baz) { - ::Other::Other1(::Foo::Baz) => {} - ::Other::Other1(::Foo::Bar(_)) => {} - ::Other::Other2(::Foo::Baz, ::Foo::Bar(_)) => {} - ::Other::Other2(::Foo::Bar(..), ::Foo::Baz) => {} - ::Other::Other2(..) => {} - } -} diff --git a/src/test/ui/run-pass/issues/issue-6470.rs b/src/test/ui/run-pass/issues/issue-6470.rs deleted file mode 100644 index 152b4bbedc3..00000000000 --- a/src/test/ui/run-pass/issues/issue-6470.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// pretty-expanded FIXME #23616 -#![allow(non_snake_case)] - -pub mod Bar { - pub struct Foo { - v: isize, - } - - extern { - pub fn foo(v: *const Foo) -> Foo; - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-6557.rs b/src/test/ui/run-pass/issues/issue-6557.rs deleted file mode 100644 index 5179ddb472b..00000000000 --- a/src/test/ui/run-pass/issues/issue-6557.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_patterns)] -#![feature(box_syntax)] - -fn foo(box (_x, _y): Box<(isize, isize)>) {} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-6892.rs b/src/test/ui/run-pass/issues/issue-6892.rs deleted file mode 100644 index 173ad5833e5..00000000000 --- a/src/test/ui/run-pass/issues/issue-6892.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensures that destructors are run for expressions of the form "let _ = e;" -// where `e` is a type which requires a destructor. - - -struct Foo; -struct Bar { x: isize } -struct Baz(isize); -enum FooBar { _Foo(Foo), _Bar(usize) } - -static mut NUM_DROPS: usize = 0; - -impl Drop for Foo { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} -impl Drop for Bar { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} -impl Drop for Baz { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} -impl Drop for FooBar { - fn drop(&mut self) { - unsafe { NUM_DROPS += 1; } - } -} - -fn main() { - assert_eq!(unsafe { NUM_DROPS }, 0); - { let _x = Foo; } - assert_eq!(unsafe { NUM_DROPS }, 1); - { let _x = Bar { x: 21 }; } - assert_eq!(unsafe { NUM_DROPS }, 2); - { let _x = Baz(21); } - assert_eq!(unsafe { NUM_DROPS }, 3); - { let _x = FooBar::_Foo(Foo); } - assert_eq!(unsafe { NUM_DROPS }, 5); - { let _x = FooBar::_Bar(42); } - assert_eq!(unsafe { NUM_DROPS }, 6); - - { let _ = Foo; } - assert_eq!(unsafe { NUM_DROPS }, 7); - { let _ = Bar { x: 21 }; } - assert_eq!(unsafe { NUM_DROPS }, 8); - { let _ = Baz(21); } - assert_eq!(unsafe { NUM_DROPS }, 9); - { let _ = FooBar::_Foo(Foo); } - assert_eq!(unsafe { NUM_DROPS }, 11); - { let _ = FooBar::_Bar(42); } - assert_eq!(unsafe { NUM_DROPS }, 12); -} diff --git a/src/test/ui/run-pass/issues/issue-6898.rs b/src/test/ui/run-pass/issues/issue-6898.rs deleted file mode 100644 index b9a3a24585b..00000000000 --- a/src/test/ui/run-pass/issues/issue-6898.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::mem; - -/// Returns the size of a type -pub fn size_of() -> usize { - TypeInfo::size_of(None::) -} - -/// Returns the size of the type that `val` points to -pub fn size_of_val(val: &T) -> usize { - val.size_of_val() -} - -pub trait TypeInfo: Sized { - fn size_of(_lame_type_hint: Option) -> usize; - fn size_of_val(&self) -> usize; -} - -impl TypeInfo for T { - /// The size of the type in bytes. - fn size_of(_lame_type_hint: Option) -> usize { - mem::size_of::() - } - - /// Returns the size of the type of `self` in bytes. - fn size_of_val(&self) -> usize { - TypeInfo::size_of(None::) - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-6919.rs b/src/test/ui/run-pass/issues/issue-6919.rs deleted file mode 100644 index 94c1a1ae00a..00000000000 --- a/src/test/ui/run-pass/issues/issue-6919.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:iss.rs - -// pretty-expanded FIXME #23616 - -#![crate_id="issue-6919"] -extern crate issue6919_3; - -pub fn main() { - let _ = issue6919_3::D.k; -} diff --git a/src/test/ui/run-pass/issues/issue-6991.rs b/src/test/ui/run-pass/issues/issue-6991.rs deleted file mode 100644 index 13b738ac0e6..00000000000 --- a/src/test/ui/run-pass/issues/issue-6991.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -static x: &'static usize = &1; -static y: usize = *x; - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-7012.rs b/src/test/ui/run-pass/issues/issue-7012.rs deleted file mode 100644 index 217c0dee560..00000000000 --- a/src/test/ui/run-pass/issues/issue-7012.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] - -/* -# Comparison of static arrays - -The expected behaviour would be that test==test1, therefore 'true' -would be printed, however the below prints false. -*/ - -struct signature<'a> { pattern : &'a [u32] } - -static test1: signature<'static> = signature { - pattern: &[0x243f6a88,0x85a308d3,0x13198a2e,0x03707344,0xa4093822,0x299f31d0] -}; - -pub fn main() { - let test: &[u32] = &[0x243f6a88,0x85a308d3,0x13198a2e, - 0x03707344,0xa4093822,0x299f31d0]; - println!("{}",test==test1.pattern); -} diff --git a/src/test/ui/run-pass/issues/issue-7178.rs b/src/test/ui/run-pass/issues/issue-7178.rs deleted file mode 100644 index 3a74ed833e9..00000000000 --- a/src/test/ui/run-pass/issues/issue-7178.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-7178.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_7178 as cross_crate_self; - -pub fn main() { - let _ = cross_crate_self::Foo::new(&1); -} diff --git a/src/test/ui/run-pass/issues/issue-7222.rs b/src/test/ui/run-pass/issues/issue-7222.rs deleted file mode 100644 index 52c3e17fae6..00000000000 --- a/src/test/ui/run-pass/issues/issue-7222.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(illegal_floating_point_literal_pattern)] // FIXME #41620 - -pub fn main() { - const FOO: f64 = 10.0; - - match 0.0 { - 0.0 ..= FOO => (), - _ => () - } -} diff --git a/src/test/ui/run-pass/issues/issue-7268.rs b/src/test/ui/run-pass/issues/issue-7268.rs deleted file mode 100644 index 3a93a144ee8..00000000000 --- a/src/test/ui/run-pass/issues/issue-7268.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo(_: T) {} - -fn bar(x: &'static T) { - foo(x); -} -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-7344.rs b/src/test/ui/run-pass/issues/issue-7344.rs deleted file mode 100644 index cc160c79ae9..00000000000 --- a/src/test/ui/run-pass/issues/issue-7344.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unreachable_code)] - -fn foo() -> bool { false } - -fn bar() { - return; - !foo(); -} - -fn baz() { - return; - if "" == "" {} -} - -pub fn main() { - bar(); - baz(); -} diff --git a/src/test/ui/run-pass/issues/issue-7519-match-unit-in-arg.rs b/src/test/ui/run-pass/issues/issue-7519-match-unit-in-arg.rs deleted file mode 100644 index 3e60d24627c..00000000000 --- a/src/test/ui/run-pass/issues/issue-7519-match-unit-in-arg.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -/* -#7519 ICE pattern matching unit in function argument -*/ - -fn foo(():()) { } - -pub fn main() { - foo(()); -} diff --git a/src/test/ui/run-pass/issues/issue-7563.rs b/src/test/ui/run-pass/issues/issue-7563.rs deleted file mode 100644 index 203c9cdfa49..00000000000 --- a/src/test/ui/run-pass/issues/issue-7563.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait IDummy { - fn do_nothing(&self); -} - -#[derive(Debug)] -struct A { a: isize } -#[derive(Debug)] -struct B<'a> { b: isize, pa: &'a A } - - impl IDummy for A { - fn do_nothing(&self) { - println!("A::do_nothing() is called"); - } - } - -impl<'a> B<'a> { - fn get_pa(&self) -> &'a IDummy { self.pa as &'a IDummy } -} - -pub fn main() { - let sa = A { a: 100 }; - let sb = B { b: 200, pa: &sa }; - - println!("sa is {:?}", sa); - println!("sb is {:?}", sb); -} diff --git a/src/test/ui/run-pass/issues/issue-7575.rs b/src/test/ui/run-pass/issues/issue-7575.rs deleted file mode 100644 index e027119855e..00000000000 --- a/src/test/ui/run-pass/issues/issue-7575.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { - fn new() -> bool { false } - fn dummy(&self) { } -} - -trait Bar { - fn new(&self) -> bool { true } -} - -impl Bar for isize {} -impl Foo for isize {} - -fn main() { - assert!(1.new()); -} diff --git a/src/test/ui/run-pass/issues/issue-7607-2.rs b/src/test/ui/run-pass/issues/issue-7607-2.rs deleted file mode 100644 index 7a1f0159df9..00000000000 --- a/src/test/ui/run-pass/issues/issue-7607-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub mod a { - pub struct Foo { a: usize } -} - -pub mod b { - use a::Foo; - impl Foo { - fn bar(&self) { } - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-7660.rs b/src/test/ui/run-pass/issues/issue-7660.rs deleted file mode 100644 index 774d9706d90..00000000000 --- a/src/test/ui/run-pass/issues/issue-7660.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue 7660 -// rvalue lifetime too short when equivalent `match` works - -// pretty-expanded FIXME #23616 - -use std::collections::HashMap; - -struct A(isize, isize); - -pub fn main() { - let mut m: HashMap = HashMap::new(); - m.insert(1, A(0, 0)); - - let A(ref _a, ref _b) = m[&1]; - let (a, b) = match m[&1] { A(ref _a, ref _b) => (_a, _b) }; -} diff --git a/src/test/ui/run-pass/issues/issue-7663.rs b/src/test/ui/run-pass/issues/issue-7663.rs deleted file mode 100644 index 2c2ce9483da..00000000000 --- a/src/test/ui/run-pass/issues/issue-7663.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(unused_imports, dead_code)] - -mod test1 { - - mod foo { pub fn p() -> isize { 1 } } - mod bar { pub fn p() -> isize { 2 } } - - pub mod baz { - use test1::bar::p; - - pub fn my_main() { assert_eq!(p(), 2); } - } -} - -mod test2 { - - mod foo { pub fn p() -> isize { 1 } } - mod bar { pub fn p() -> isize { 2 } } - - pub mod baz { - use test2::bar::p; - - pub fn my_main() { assert_eq!(p(), 2); } - } -} - -fn main() { - test1::baz::my_main(); - test2::baz::my_main(); -} diff --git a/src/test/ui/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/ui/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs deleted file mode 100644 index f9dae8472a8..00000000000 --- a/src/test/ui/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -/* - -#7673 Polymorphically creating traits barely works - -*/ - -#![feature(box_syntax)] - -pub fn main() {} - -trait A { - fn dummy(&self) { } -} - -impl A for T {} - -fn owned2(a: Box) { a as Box; } -fn owned3(a: Box) { box a as Box; } diff --git a/src/test/ui/run-pass/issues/issue-7784.rs b/src/test/ui/run-pass/issues/issue-7784.rs deleted file mode 100644 index 864371cab4d..00000000000 --- a/src/test/ui/run-pass/issues/issue-7784.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -use std::ops::Add; - -fn foo + Clone>([x, y, z]: [T; 3]) -> (T, T, T) { - (x.clone(), x.clone() + y.clone(), x + y + z) -} -fn bar(a: &'static str, b: &'static str) -> [&'static str; 4] { - [a, b, b, a] -} - -fn main() { - assert_eq!(foo([1, 2, 3]), (1, 3, 6)); - - let [a, b, c, d] = bar("foo", "bar"); - assert_eq!(a, "foo"); - assert_eq!(b, "bar"); - assert_eq!(c, "bar"); - assert_eq!(d, "foo"); - - let [a, _, _, d] = bar("baz", "foo"); - assert_eq!(a, "baz"); - assert_eq!(d, "baz"); - - let out = bar("baz", "foo"); - let [a, xs.., d] = out; - assert_eq!(a, "baz"); - assert_eq!(xs, ["foo", "foo"]); - assert_eq!(d, "baz"); -} diff --git a/src/test/ui/run-pass/issues/issue-7899.rs b/src/test/ui/run-pass/issues/issue-7899.rs deleted file mode 100644 index 74a5b060822..00000000000 --- a/src/test/ui/run-pass/issues/issue-7899.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-7899.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_7899 as testcrate; - -fn main() { - let f = testcrate::V2(1.0f32, 2.0f32); -} diff --git a/src/test/ui/run-pass/issues/issue-7911.rs b/src/test/ui/run-pass/issues/issue-7911.rs deleted file mode 100644 index f2299eecb40..00000000000 --- a/src/test/ui/run-pass/issues/issue-7911.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// (Closes #7911) Test that we can use the same self expression -// with different mutability in macro in two methods - -#![allow(unused_variables)] // unused foobar_immut + foobar_mut -trait FooBar { - fn dummy(&self) { } -} -struct Bar(i32); -struct Foo { bar: Bar } - -impl FooBar for Bar {} - -trait Test { - fn get_immut(&self) -> &FooBar; - fn get_mut(&mut self) -> &mut FooBar; -} - -macro_rules! generate_test { ($type_:path, $slf:ident, $field:expr) => ( - impl Test for $type_ { - fn get_immut(&$slf) -> &FooBar { - &$field as &FooBar - } - - fn get_mut(&mut $slf) -> &mut FooBar { - &mut $field as &mut FooBar - } - } -)} - -generate_test!(Foo, self, self.bar); - -pub fn main() { - let mut foo: Foo = Foo { bar: Bar(42) }; - { let foobar_immut = foo.get_immut(); } - { let foobar_mut = foo.get_mut(); } -} diff --git a/src/test/ui/run-pass/issues/issue-8044.rs b/src/test/ui/run-pass/issues/issue-8044.rs deleted file mode 100644 index 3a3d08dc35a..00000000000 --- a/src/test/ui/run-pass/issues/issue-8044.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-8044.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_8044 as minimal; -use minimal::{BTree, leaf}; - -pub fn main() { - BTree:: { node: leaf(1) }; -} diff --git a/src/test/ui/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/src/test/ui/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs deleted file mode 100644 index 311fd129ab0..00000000000 --- a/src/test/ui/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -/* - -#8171 Self is not recognised as implementing kinds in default method implementations - -*/ - -fn require_send(_: T){} - -trait TragicallySelfIsNotSend: Send + Sized { - fn x(self) { - require_send(self); - } -} - -pub fn main(){} diff --git a/src/test/ui/run-pass/issues/issue-8248.rs b/src/test/ui/run-pass/issues/issue-8248.rs deleted file mode 100644 index 21060576f2e..00000000000 --- a/src/test/ui/run-pass/issues/issue-8248.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait A { - fn dummy(&self) { } -} -struct B; -impl A for B {} - -fn foo(_: &mut A) {} - -pub fn main() { - let mut b = B; - foo(&mut b as &mut A); -} diff --git a/src/test/ui/run-pass/issues/issue-8249.rs b/src/test/ui/run-pass/issues/issue-8249.rs deleted file mode 100644 index 9afa6f937b5..00000000000 --- a/src/test/ui/run-pass/issues/issue-8249.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait A { - fn dummy(&self) { } -} -struct B; -impl A for B {} - -struct C<'a> { - foo: &'a mut (A+'a), -} - -fn foo(a: &mut A) { - C{ foo: a }; -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/issues/issue-8259.rs b/src/test/ui/run-pass/issues/issue-8259.rs deleted file mode 100644 index a0e2caee40a..00000000000 --- a/src/test/ui/run-pass/issues/issue-8259.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// aux-build:issue-8259.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_8259 as other; -static a: other::Foo<'static> = other::Foo::A; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-8351-1.rs b/src/test/ui/run-pass/issues/issue-8351-1.rs deleted file mode 100644 index 3caecf9fb93..00000000000 --- a/src/test/ui/run-pass/issues/issue-8351-1.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { - Foo{f: isize}, - Bar, -} - -pub fn main() { - let e = E::Foo{f: 0}; - match e { - E::Foo{f: 1} => panic!(), - E::Foo{..} => (), - _ => panic!(), - } -} diff --git a/src/test/ui/run-pass/issues/issue-8351-2.rs b/src/test/ui/run-pass/issues/issue-8351-2.rs deleted file mode 100644 index da70fc415c0..00000000000 --- a/src/test/ui/run-pass/issues/issue-8351-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum E { - Foo{f: isize, b: bool}, - Bar, -} - -pub fn main() { - let e = E::Foo{f: 0, b: false}; - match e { - E::Foo{f: 1, b: true} => panic!(), - E::Foo{b: false, f: 0} => (), - _ => panic!(), - } -} diff --git a/src/test/ui/run-pass/issues/issue-8391.rs b/src/test/ui/run-pass/issues/issue-8391.rs deleted file mode 100644 index d6c85370b8e..00000000000 --- a/src/test/ui/run-pass/issues/issue-8391.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn main() { - let x = match Some(1) { - ref _y @ Some(_) => 1, - None => 2, - }; - assert_eq!(x, 1); -} diff --git a/src/test/ui/run-pass/issues/issue-8398.rs b/src/test/ui/run-pass/issues/issue-8398.rs deleted file mode 100644 index e4f5a457f41..00000000000 --- a/src/test/ui/run-pass/issues/issue-8398.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait Writer { - fn write(&mut self, b: &[u8]) -> Result<(), ()>; -} - -fn foo(a: &mut Writer) { - a.write(&[]).unwrap(); -} - -pub fn main(){} diff --git a/src/test/ui/run-pass/issues/issue-8401.rs b/src/test/ui/run-pass/issues/issue-8401.rs deleted file mode 100644 index 966f89486b7..00000000000 --- a/src/test/ui/run-pass/issues/issue-8401.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_8401.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_8401; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-8460.rs b/src/test/ui/run-pass/issues/issue-8460.rs deleted file mode 100644 index 9f0f7e2fa42..00000000000 --- a/src/test/ui/run-pass/issues/issue-8460.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support -#![feature(rustc_attrs)] - -use std::thread; - -trait Int { - fn zero() -> Self; - fn one() -> Self; -} -macro_rules! doit { - ($($t:ident)*) => ($(impl Int for $t { - fn zero() -> $t { 0 } - fn one() -> $t { 1 } - })*) -} -doit! { i8 i16 i32 i64 isize } - -macro_rules! check { - ($($e:expr),*) => { - $(assert!(thread::spawn({ - move|| { $e; } - }).join().is_err());)* - } -} - -fn main() { - check![ - isize::min_value() / -isize::one(), - i8::min_value() / -i8::one(), - i16::min_value() / -i16::one(), - i32::min_value() / -i32::one(), - i64::min_value() / -i64::one(), - 1isize / isize::zero(), - 1i8 / i8::zero(), - 1i16 / i16::zero(), - 1i32 / i32::zero(), - 1i64 / i64::zero(), - isize::min_value() % -isize::one(), - i8::min_value() % -i8::one(), - i16::min_value() % -i16::one(), - i32::min_value() % -i32::one(), - i64::min_value() % -i64::one(), - 1isize % isize::zero(), - 1i8 % i8::zero(), - 1i16 % i16::zero(), - 1i32 % i32::zero(), - 1i64 % i64::zero() - ]; -} diff --git a/src/test/ui/run-pass/issues/issue-8498.rs b/src/test/ui/run-pass/issues/issue-8498.rs deleted file mode 100644 index 334c331dba7..00000000000 --- a/src/test/ui/run-pass/issues/issue-8498.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - match &[(Box::new(5),Box::new(7))] { - ps => { - let (ref y, _) = ps[0]; - assert_eq!(**y, 5); - } - } - - match Some(&[(Box::new(5),)]) { - Some(ps) => { - let (ref y,) = ps[0]; - assert_eq!(**y, 5); - } - None => () - } - - match Some(&[(Box::new(5),Box::new(7))]) { - Some(ps) => { - let (ref y, ref z) = ps[0]; - assert_eq!(**y, 5); - assert_eq!(**z, 7); - } - None => () - } -} diff --git a/src/test/ui/run-pass/issues/issue-8506.rs b/src/test/ui/run-pass/issues/issue-8506.rs deleted file mode 100644 index 1cf054a46df..00000000000 --- a/src/test/ui/run-pass/issues/issue-8506.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_upper_case_globals)] - -#![allow(dead_code)] - -enum Either { - One, - Other(String,String) -} - -static one : Either = Either::One; - -pub fn main () { } diff --git a/src/test/ui/run-pass/issues/issue-8521.rs b/src/test/ui/run-pass/issues/issue-8521.rs deleted file mode 100644 index b70a79bed3c..00000000000 --- a/src/test/ui/run-pass/issues/issue-8521.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo1 {} - -trait A {} - -macro_rules! foo1(($t:path) => { - impl Foo1 for T {} -}); - -foo1!(A); - -trait Foo2 {} - -trait B {} - -#[allow(unused)] -struct C {} - -macro_rules! foo2(($t:path) => { - impl Foo2 for T {} -}); - -foo2!(B); - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-8578.rs b/src/test/ui/run-pass/issues/issue-8578.rs deleted file mode 100644 index 8753ee8370b..00000000000 --- a/src/test/ui/run-pass/issues/issue-8578.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] -// pretty-expanded FIXME #23616 - -pub struct UninterpretedOption_NamePart { - name_part: Option, -} - -impl<'a> UninterpretedOption_NamePart { - pub fn default_instance() -> &'static UninterpretedOption_NamePart { - static instance: UninterpretedOption_NamePart = UninterpretedOption_NamePart { - name_part: None, - }; - &instance - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-868.rs b/src/test/ui/run-pass/issues/issue-868.rs deleted file mode 100644 index a545abefb7a..00000000000 --- a/src/test/ui/run-pass/issues/issue-868.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn f(g: F) -> T where F: FnOnce() -> T { g() } - -pub fn main() { - let _x = f( | | { 10 }); - // used to be: cannot determine a type for this expression - f(| | { }); - // ditto - f( | | { ()}); - // always worked - let _: () = f(| | { }); - // empty block with no type info should compile too - let _ = f(||{}); - let _ = (||{}); -} diff --git a/src/test/ui/run-pass/issues/issue-8709.rs b/src/test/ui/run-pass/issues/issue-8709.rs deleted file mode 100644 index 3d0739caf1a..00000000000 --- a/src/test/ui/run-pass/issues/issue-8709.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! sty { - ($t:ty) => (stringify!($t)) -} - -macro_rules! spath { - ($t:path) => (stringify!($t)) -} - -fn main() { - assert_eq!(sty!(isize), "isize"); - assert_eq!(spath!(std::option), "std::option"); -} diff --git a/src/test/ui/run-pass/issues/issue-8783.rs b/src/test/ui/run-pass/issues/issue-8783.rs deleted file mode 100644 index 741411aeffb..00000000000 --- a/src/test/ui/run-pass/issues/issue-8783.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::default::Default; - -struct X { pub x: usize } -impl Default for X { - fn default() -> X { - X { x: 42 } - } -} - -struct Y { pub y: T } -impl Default for Y { - fn default() -> Y { - Y { y: Default::default() } - } -} - -fn main() { - let X { x: _ } = Default::default(); - let Y { y: X { x } } = Default::default(); -} diff --git a/src/test/ui/run-pass/issues/issue-8827.rs b/src/test/ui/run-pass/issues/issue-8827.rs deleted file mode 100644 index d854793c22a..00000000000 --- a/src/test/ui/run-pass/issues/issue-8827.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Receiver}; - -fn periodical(n: isize) -> Receiver { - let (chan, port) = channel(); - thread::spawn(move|| { - loop { - for _ in 1..n { - match chan.send(false) { - Ok(()) => {} - Err(..) => break, - } - } - match chan.send(true) { - Ok(()) => {} - Err(..) => break - } - } - }); - return port; -} - -fn integers() -> Receiver { - let (chan, port) = channel(); - thread::spawn(move|| { - let mut i = 1; - loop { - match chan.send(i) { - Ok(()) => {} - Err(..) => break, - } - i = i + 1; - } - }); - return port; -} - -fn main() { - let ints = integers(); - let threes = periodical(3); - let fives = periodical(5); - for _ in 1..100 { - match (ints.recv().unwrap(), threes.recv().unwrap(), fives.recv().unwrap()) { - (_, true, true) => println!("FizzBuzz"), - (_, true, false) => println!("Fizz"), - (_, false, true) => println!("Buzz"), - (i, false, false) => println!("{}", i) - } - } -} diff --git a/src/test/ui/run-pass/issues/issue-8851.rs b/src/test/ui/run-pass/issues/issue-8851.rs deleted file mode 100644 index 19fd51b476d..00000000000 --- a/src/test/ui/run-pass/issues/issue-8851.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// after fixing #9384 and implementing hygiene for match bindings, -// this now fails because the insertion of the 'y' into the match -// doesn't cause capture. Making this macro hygienic (as I've done) -// could very well make this test case completely pointless.... - -// pretty-expanded FIXME #23616 - -enum T { - A(isize), - B(usize) -} - -macro_rules! test { - ($id:ident, $e:expr) => ( - fn foo(t: T) -> isize { - match t { - T::A($id) => $e, - T::B($id) => $e - } - } - ) -} - -test!(y, 10 + (y as isize)); - -pub fn main() { - foo(T::A(20)); -} diff --git a/src/test/ui/run-pass/issues/issue-8860.rs b/src/test/ui/run-pass/issues/issue-8860.rs deleted file mode 100644 index c4d9cab9ff3..00000000000 --- a/src/test/ui/run-pass/issues/issue-8860.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z borrowck=compare - -static mut DROP: isize = 0; -static mut DROP_S: isize = 0; -static mut DROP_T: isize = 0; - -struct S; -impl Drop for S { - fn drop(&mut self) { - unsafe { - DROP_S += 1; - DROP += 1; - } - } -} -fn f(ref _s: S) {} - -struct T { i: isize } -impl Drop for T { - fn drop(&mut self) { - unsafe { - DROP_T += 1; - DROP += 1; - } - } -} -fn g(ref _t: T) {} - -fn do_test() { - let s = S; - f(s); - unsafe { - assert_eq!(1, DROP); - assert_eq!(1, DROP_S); - } - let t = T { i: 1 }; - g(t); - unsafe { assert_eq!(1, DROP_T); } -} - -fn main() { - do_test(); - unsafe { - assert_eq!(2, DROP); - assert_eq!(1, DROP_S); - assert_eq!(1, DROP_T); - } -} diff --git a/src/test/ui/run-pass/issues/issue-8898.rs b/src/test/ui/run-pass/issues/issue-8898.rs deleted file mode 100644 index d405a0949e8..00000000000 --- a/src/test/ui/run-pass/issues/issue-8898.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn assert_repr_eq(obj : T, expected : String) { - assert_eq!(expected, format!("{:?}", obj)); -} - -pub fn main() { - let abc = [1, 2, 3]; - let tf = [true, false]; - let x = [(), ()]; - let slice = &x[..1]; - - assert_repr_eq(&abc[..], "[1, 2, 3]".to_string()); - assert_repr_eq(&tf[..], "[true, false]".to_string()); - assert_repr_eq(&x[..], "[(), ()]".to_string()); - assert_repr_eq(slice, "[()]".to_string()); - assert_repr_eq(&x[..], "[(), ()]".to_string()); -} diff --git a/src/test/ui/run-pass/issues/issue-9047.rs b/src/test/ui/run-pass/issues/issue-9047.rs deleted file mode 100644 index 30f886f6784..00000000000 --- a/src/test/ui/run-pass/issues/issue-9047.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn decode() -> String { - 'outer: loop { - let mut ch_start: usize; - break 'outer; - } - "".to_string() -} - -pub fn main() { - println!("{}", decode()); -} diff --git a/src/test/ui/run-pass/issues/issue-9110.rs b/src/test/ui/run-pass/issues/issue-9110.rs deleted file mode 100644 index 906c7a422e7..00000000000 --- a/src/test/ui/run-pass/issues/issue-9110.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -#![allow(non_snake_case)] - -macro_rules! silly_macro { - () => ( - pub mod Qux { - pub struct Foo { x : u8 } - pub fn bar(_foo : Foo) {} - } - ); -} - -silly_macro!(); - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-9123.rs b/src/test/ui/run-pass/issues/issue-9123.rs deleted file mode 100644 index 0f41acecaaa..00000000000 --- a/src/test/ui/run-pass/issues/issue-9123.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_9123.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_9123; - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-9129.rs b/src/test/ui/run-pass/issues/issue-9129.rs deleted file mode 100644 index 21e192b23f5..00000000000 --- a/src/test/ui/run-pass/issues/issue-9129.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] -// ignore-pretty unreported - -#![feature(box_syntax)] - -pub trait bomb { fn boom(&self, _: Ident); } -pub struct S; -impl bomb for S { fn boom(&self, _: Ident) { } } - -pub struct Ident { name: usize } - -// macro_rules! int3 { () => ( unsafe { asm!( "int3" ); } ) } -macro_rules! int3 { () => ( { } ) } - -fn Ident_new() -> Ident { - int3!(); - Ident {name: 0x6789ABCD } -} - -pub fn light_fuse(fld: Box) { - int3!(); - let f = || { - int3!(); - fld.boom(Ident_new()); // *** 1 - }; - f(); -} - -pub fn main() { - let b = box S as Box; - light_fuse(b); -} diff --git a/src/test/ui/run-pass/issues/issue-9188.rs b/src/test/ui/run-pass/issues/issue-9188.rs deleted file mode 100644 index 44fe06eed49..00000000000 --- a/src/test/ui/run-pass/issues/issue-9188.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_9188.rs - - -extern crate issue_9188; - -pub fn main() { - let a = issue_9188::bar(); - let b = issue_9188::foo::(); - assert_eq!(*a, *b); -} diff --git a/src/test/ui/run-pass/issues/issue-9243.rs b/src/test/ui/run-pass/issues/issue-9243.rs deleted file mode 100644 index 957330a1925..00000000000 --- a/src/test/ui/run-pass/issues/issue-9243.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue 9243 -#![allow(non_upper_case_globals)] - -pub struct Test { - mem: isize, -} - -pub static g_test: Test = Test {mem: 0}; - -impl Drop for Test { - fn drop(&mut self) {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-9249.rs b/src/test/ui/run-pass/issues/issue-9249.rs deleted file mode 100644 index d11665c531e..00000000000 --- a/src/test/ui/run-pass/issues/issue-9249.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -static DATA:&'static [&'static str] = &["my string"]; -fn main() { } diff --git a/src/test/ui/run-pass/issues/issue-9259.rs b/src/test/ui/run-pass/issues/issue-9259.rs deleted file mode 100644 index 481014fe3f3..00000000000 --- a/src/test/ui/run-pass/issues/issue-9259.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct A<'a> { - a: &'a [String], - b: Option<&'a [String]>, -} - -pub fn main() { - let b: &[String] = &["foo".to_string()]; - let a = A { - a: &["test".to_string()], - b: Some(b), - }; - assert_eq!(a.b.as_ref().unwrap()[0], "foo"); -} diff --git a/src/test/ui/run-pass/issues/issue-9382.rs b/src/test/ui/run-pass/issues/issue-9382.rs deleted file mode 100644 index 6a4f868cdf1..00000000000 --- a/src/test/ui/run-pass/issues/issue-9382.rs +++ /dev/null @@ -1,49 +0,0 @@ -// pretty-expanded FIXME #23616 - -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -// Tests for a previous bug that occurred due to an interaction -// between struct field initialization and the auto-coercion -// from a vector to a slice. The drop glue was being invoked on -// the temporary slice with a wrong type, triggering an LLVM assert. - - -struct Thing1<'a> { - baz: &'a [Box], - bar: Box, -} - -struct Thing2<'a> { - baz: &'a [Box], - bar: u64, -} - -pub fn main() { - let _t1_fixed = Thing1 { - baz: &[], - bar: box 32, - }; - Thing1 { - baz: &Vec::new(), - bar: box 32, - }; - let _t2_fixed = Thing2 { - baz: &[], - bar: 32, - }; - Thing2 { - baz: &Vec::new(), - bar: 32, - }; -} diff --git a/src/test/ui/run-pass/issues/issue-9394-inherited-trait-calls.rs b/src/test/ui/run-pass/issues/issue-9394-inherited-trait-calls.rs deleted file mode 100644 index ca94a7b2fbd..00000000000 --- a/src/test/ui/run-pass/issues/issue-9394-inherited-trait-calls.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Base: Base2 + Base3{ - fn foo(&self) -> String; - fn foo1(&self) -> String; - fn foo2(&self) -> String{ - "base foo2".to_string() - } -} - -trait Base2: Base3{ - fn baz(&self) -> String; -} - -trait Base3{ - fn root(&self) -> String; -} - -trait Super: Base{ - fn bar(&self) -> String; -} - -struct X; - -impl Base for X { - fn foo(&self) -> String{ - "base foo".to_string() - } - fn foo1(&self) -> String{ - "base foo1".to_string() - } - -} - -impl Base2 for X { - fn baz(&self) -> String{ - "base2 baz".to_string() - } -} - -impl Base3 for X { - fn root(&self) -> String{ - "base3 root".to_string() - } -} - -impl Super for X { - fn bar(&self) -> String{ - "super bar".to_string() - } -} - -pub fn main() { - let n = X; - let s = &n as &Super; - assert_eq!(s.bar(),"super bar".to_string()); - assert_eq!(s.foo(),"base foo".to_string()); - assert_eq!(s.foo1(),"base foo1".to_string()); - assert_eq!(s.foo2(),"base foo2".to_string()); - assert_eq!(s.baz(),"base2 baz".to_string()); - assert_eq!(s.root(),"base3 root".to_string()); -} diff --git a/src/test/ui/run-pass/issues/issue-9396.rs b/src/test/ui/run-pass/issues/issue-9396.rs deleted file mode 100644 index 62a38767ddd..00000000000 --- a/src/test/ui/run-pass/issues/issue-9396.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] -// ignore-emscripten no threads support - -use std::sync::mpsc::{TryRecvError, channel}; -use std::thread; - -pub fn main() { - let (tx, rx) = channel(); - let t = thread::spawn(move||{ - thread::sleep_ms(10); - tx.send(()).unwrap(); - }); - loop { - match rx.try_recv() { - Ok(()) => break, - Err(TryRecvError::Empty) => {} - Err(TryRecvError::Disconnected) => unreachable!() - } - } - t.join(); -} diff --git a/src/test/ui/run-pass/issues/issue-9446.rs b/src/test/ui/run-pass/issues/issue-9446.rs deleted file mode 100644 index efd04a1c5ac..00000000000 --- a/src/test/ui/run-pass/issues/issue-9446.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Wrapper(String); - -impl Wrapper { - pub fn new(wrapped: String) -> Wrapper { - Wrapper(wrapped) - } - - pub fn say_hi(&self) { - let Wrapper(ref s) = *self; - println!("hello {}", *s); - } -} - -impl Drop for Wrapper { - fn drop(&mut self) {} -} - -pub fn main() { - { - // This runs without complaint. - let x = Wrapper::new("Bob".to_string()); - x.say_hi(); - } - { - // This fails to compile, circa 0.8-89-gc635fba. - // error: internal compiler error: drop_ty_immediate: non-box ty - Wrapper::new("Bob".to_string()).say_hi(); - } -} diff --git a/src/test/ui/run-pass/issues/issue-9719.rs b/src/test/ui/run-pass/issues/issue-9719.rs deleted file mode 100644 index 1e52f326c1f..00000000000 --- a/src/test/ui/run-pass/issues/issue-9719.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod a { - pub enum Enum { - A(T), - } - - pub trait X { - fn dummy(&self) { } - } - impl X for isize {} - - pub struct Z<'a>(Enum<&'a (X+'a)>); - fn foo() { let x: isize = 42; let z = Z(Enum::A(&x as &X)); let _ = z; } -} - -mod b { - trait X { - fn dummy(&self) { } - } - impl X for isize {} - struct Y<'a>{ - x:Option<&'a (X+'a)>, - } - - fn bar() { - let x: isize = 42; - let _y = Y { x: Some(&x as &X) }; - } -} - -mod c { - pub trait X { fn f(&self); } - impl X for isize { fn f(&self) {} } - pub struct Z<'a>(Option<&'a (X+'a)>); - fn main() { let x: isize = 42; let z = Z(Some(&x as &X)); let _ = z; } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue-9737.rs b/src/test/ui/run-pass/issues/issue-9737.rs deleted file mode 100644 index 304eb7808a7..00000000000 --- a/src/test/ui/run-pass/issues/issue-9737.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! f { - (v: $x:expr) => ( println!("{}", $x) ) -} - -fn main () { - let v = 5; - f!(v: 3); -} diff --git a/src/test/ui/run-pass/issues/issue-979.rs b/src/test/ui/run-pass/issues/issue-979.rs deleted file mode 100644 index a00909ffb67..00000000000 --- a/src/test/ui/run-pass/issues/issue-979.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::cell::Cell; - -struct r<'a> { - b: &'a Cell, -} - -impl<'a> Drop for r<'a> { - fn drop(&mut self) { - self.b.set(self.b.get() + 1); - } -} - -fn r(b: &Cell) -> r { - r { - b: b - } -} - -pub fn main() { - let b = &Cell::new(0); - { - let _p = Some(r(b)); - } - - assert_eq!(b.get(), 1); -} diff --git a/src/test/ui/run-pass/issues/issue-9837.rs b/src/test/ui/run-pass/issues/issue-9837.rs deleted file mode 100644 index 0a4c53ae1c5..00000000000 --- a/src/test/ui/run-pass/issues/issue-9837.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const C1: i32 = 0x12345678; -const C2: isize = C1 as i16 as isize; - -enum E { - V = C2 -} - -fn main() { - assert_eq!(C2 as u64, E::V as u64); -} diff --git a/src/test/ui/run-pass/issues/issue-9906.rs b/src/test/ui/run-pass/issues/issue-9906.rs deleted file mode 100644 index 546de0f6429..00000000000 --- a/src/test/ui/run-pass/issues/issue-9906.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-9906.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_9906 as testmod; - -pub fn main() { - testmod::foo(); - testmod::FooBar::new(1); -} diff --git a/src/test/ui/run-pass/issues/issue-9918.rs b/src/test/ui/run-pass/issues/issue-9918.rs deleted file mode 100644 index bfad636876c..00000000000 --- a/src/test/ui/run-pass/issues/issue-9918.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - assert_eq!((0 + 0u8) as char, '\0'); -} diff --git a/src/test/ui/run-pass/issues/issue-9942.rs b/src/test/ui/run-pass/issues/issue-9942.rs deleted file mode 100644 index 7c50c96e9a8..00000000000 --- a/src/test/ui/run-pass/issues/issue-9942.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - const S: usize = 23 as usize; [0; S]; () -} diff --git a/src/test/ui/run-pass/issues/issue-9951.rs b/src/test/ui/run-pass/issues/issue-9951.rs deleted file mode 100644 index 35cdafc87d0..00000000000 --- a/src/test/ui/run-pass/issues/issue-9951.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] - -trait Bar { - fn noop(&self); -} -impl Bar for u8 { - fn noop(&self) {} -} - -fn main() { - let (a, b) = (&5u8 as &Bar, &9u8 as &Bar); - let (c, d): (&Bar, &Bar) = (a, b); - - let (a, b) = (Box::new(5u8) as Box, Box::new(9u8) as Box); - let (c, d): (&Bar, &Bar) = (&*a, &*b); - - let (c, d): (&Bar, &Bar) = (&5, &9); -} diff --git a/src/test/ui/run-pass/issues/issue-9968.rs b/src/test/ui/run-pass/issues/issue-9968.rs deleted file mode 100644 index 8fe54ff0c63..00000000000 --- a/src/test/ui/run-pass/issues/issue-9968.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue-9968.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_9968 as lib; - -use lib::{Trait, Struct}; - -pub fn main() -{ - Struct::init().test(); -} diff --git a/src/test/ui/run-pass/issues/issue2170exe.rs b/src/test/ui/run-pass/issues/issue2170exe.rs deleted file mode 100644 index 84b8d421da6..00000000000 --- a/src/test/ui/run-pass/issues/issue2170exe.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue2170lib.rs -// pretty-expanded FIXME #23616 - -extern crate issue2170lib; - -pub fn main() { - // let _ = issue2170lib::rsrc(2); -} diff --git a/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs b/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs deleted file mode 100644 index f1624fd2e58..00000000000 --- a/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_lib.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -// This is a file that pulls in a separate file as a submodule, where -// that separate file has many multi-byte characters, to try to -// encourage the compiler to trip on them. - -mod issue24687_mbcs_in_comments; - -pub use issue24687_mbcs_in_comments::D; - diff --git a/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs b/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs deleted file mode 100644 index 8dc243aed7e..00000000000 --- a/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/auxiliary/issue24687_mbcs_in_comments.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::fmt; - -// This ia file with many multi-byte characters, to try to encourage -// the compiler to trip on them. The Drop implementation below will -// need to have its source location embedded into the debug info for -// the output file. - -// αααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααααα -// ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ -// γγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγγ -// δδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδδ -// εεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεεε - -// ζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζζ -// ηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηηη -// θθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθθ -// ιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιιι -// κκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκκ - -pub struct D(pub X); - -impl Drop for D { - fn drop(&mut self) { - // λλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλλ - println!("Dropping D({:?})", self.0); - } -} diff --git a/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/main.rs b/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/main.rs deleted file mode 100644 index af93c9bff0f..00000000000 --- a/src/test/ui/run-pass/issues/issue24687-embed-debuginfo/main.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue24687_lib.rs -// compile-flags:-g - -extern crate issue24687_lib as d; - -fn main() { - // Create a d, which has a destructor whose body will be codegen'ed - // into the generated code here, and thus the local debuginfo will - // need references into the original source locations from - // `importer` above. - let _d = d::D("Hi"); -} diff --git a/src/test/ui/run-pass/issues/issue28498-must-work-ex1.rs b/src/test/ui/run-pass/issues/issue28498-must-work-ex1.rs deleted file mode 100644 index 54c53465acb..00000000000 --- a/src/test/ui/run-pass/issues/issue28498-must-work-ex1.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #examples-of-code-that-must-continue-to-work - -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -fn main() { - let mut data = Vec::new(); - data.push(Concrete(0, Cell::new(None))); - data.push(Concrete(0, Cell::new(None))); - - data[0].1.set(Some(&data[1])); - data[1].1.set(Some(&data[0])); -} diff --git a/src/test/ui/run-pass/issues/issue28498-must-work-ex2.rs b/src/test/ui/run-pass/issues/issue28498-must-work-ex2.rs deleted file mode 100644 index b8667710925..00000000000 --- a/src/test/ui/run-pass/issues/issue28498-must-work-ex2.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #examples-of-code-that-must-continue-to-work - -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -struct Foo { data: Vec } - -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])); - foo.data[1].1.set(Some(&foo.data[0])); -} - diff --git a/src/test/ui/run-pass/issues/issue28498-ugeh-ex1.rs b/src/test/ui/run-pass/issues/issue28498-ugeh-ex1.rs deleted file mode 100644 index 50baa2975dd..00000000000 --- a/src/test/ui/run-pass/issues/issue28498-ugeh-ex1.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Example taken from RFC 1238 text - -// https://github.com/rust-lang/rfcs/blob/master/text/1238-nonparametric-dropck.md -// #example-of-the-unguarded-escape-hatch - -#![feature(dropck_parametricity)] -use std::cell::Cell; - -struct Concrete<'a>(u32, Cell>>); - -struct Foo { data: Vec } - -impl Drop for Foo { - // Below is the UGEH attribute - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { } -} - -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])); - foo.data[1].1.set(Some(&foo.data[0])); -} - diff --git a/src/test/ui/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs b/src/test/ui/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs deleted file mode 100644 index 0fff6507833..00000000000 --- a/src/test/ui/run-pass/issues/issue28498-ugeh-with-lifetime-param.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Demonstrate the use of the unguarded escape hatch with a lifetime param -// to assert that destructor will not access any dead data. -// -// Compare with compile-fail/issue28498-reject-lifetime-param.rs - -#![feature(dropck_parametricity)] - -#[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> { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { - // Use of `unsafe_destructor_blind_to_params` is sound, - // because destructor never accesses `self.1`. - println!("Dropping Foo({}, _)", self.0); - } -} - -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); - foo1 = Foo(1, &first_dropped); - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs b/src/test/ui/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs deleted file mode 100644 index 28645801db2..00000000000 --- a/src/test/ui/run-pass/issues/issue28498-ugeh-with-passed-to-fn.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Demonstrate the use of the unguarded escape hatch with a type param in negative position -// to assert that destructor will not access any dead data. -// -// Compare with compile-fail/issue28498-reject-lifetime-param.rs - -// 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 - -#![feature(dropck_parametricity)] - -#[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 { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { - // Use of `unsafe_destructor_blind_to_params` is sound, - // because destructor never passes a `self.1` to the callback - // (in `self.2`) despite having it available. - println!("Dropping Foo({}, _)", self.0); - } -} - -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)); - foo1 = Foo(1, &first_dropped, Box::new(callback)); - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/run-pass/issues/issue28498-ugeh-with-trait-bound.rs b/src/test/ui/run-pass/issues/issue28498-ugeh-with-trait-bound.rs deleted file mode 100644 index 7df3ceb7614..00000000000 --- a/src/test/ui/run-pass/issues/issue28498-ugeh-with-trait-bound.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] // FIXME: switch to `#[may_dangle]` below. - -// Demonstrate the use of the unguarded escape hatch with a trait bound -// to assert that destructor will not access any dead data. -// -// Compare with compile-fail/issue28498-reject-trait-bound.rs - -#![feature(dropck_parametricity)] - -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 { - #[unsafe_destructor_blind_to_params] - fn drop(&mut self) { - // Use of `unsafe_destructor_blind_to_params` is sound, - // because destructor never accesses the `Debug::fmt` method - // of `T`, despite having it available. - println!("Dropping Foo({}, _)", self.0); - } -} - -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); - foo1 = Foo(1, &first_dropped); - - println!("foo0.1: {:?} foo1.1: {:?}", foo0.1, foo1.1); -} diff --git a/src/test/ui/run-pass/issues/issue29927-1.rs b/src/test/ui/run-pass/issues/issue29927-1.rs deleted file mode 100644 index c613560aff1..00000000000 --- a/src/test/ui/run-pass/issues/issue29927-1.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(min_const_fn)] -const fn f() -> usize { - 5 -} -struct A { - field: usize, -} -fn main() { - let _ = [0; f()]; -} diff --git a/src/test/ui/run-pass/issues/issue_26873_multifile/A/B.rs b/src/test/ui/run-pass/issues/issue_26873_multifile/A/B.rs deleted file mode 100644 index cd4d9bc64ed..00000000000 --- a/src/test/ui/run-pass/issues/issue_26873_multifile/A/B.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use super::*; - -pub struct S; - diff --git a/src/test/ui/run-pass/issues/issue_26873_multifile/A/C.rs b/src/test/ui/run-pass/issues/issue_26873_multifile/A/C.rs deleted file mode 100644 index fb2567584c8..00000000000 --- a/src/test/ui/run-pass/issues/issue_26873_multifile/A/C.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use super::*; - -use super::B::S; - -pub struct T { i: i32 } - diff --git a/src/test/ui/run-pass/issues/issue_26873_multifile/A/mod.rs b/src/test/ui/run-pass/issues/issue_26873_multifile/A/mod.rs deleted file mode 100644 index c36c5b8c4c0..00000000000 --- a/src/test/ui/run-pass/issues/issue_26873_multifile/A/mod.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub mod B; -pub mod C; - -pub use self::C::T; - diff --git a/src/test/ui/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir b/src/test/ui/run-pass/issues/issue_26873_multifile/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/issues/issue_26873_multifile/mod.rs b/src/test/ui/run-pass/issues/issue_26873_multifile/mod.rs deleted file mode 100644 index 95ed215d04f..00000000000 --- a/src/test/ui/run-pass/issues/issue_26873_multifile/mod.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -mod A; - -use self::A::*; - diff --git a/src/test/ui/run-pass/issues/issue_3136_b.rs b/src/test/ui/run-pass/issues/issue_3136_b.rs deleted file mode 100644 index bf513c8391e..00000000000 --- a/src/test/ui/run-pass/issues/issue_3136_b.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_3136_a.rc - -// pretty-expanded FIXME #23616 - -extern crate issue_3136_a; -pub fn main() {} diff --git a/src/test/ui/run-pass/issues/issue_9155.rs b/src/test/ui/run-pass/issues/issue_9155.rs deleted file mode 100644 index cb73b6a201d..00000000000 --- a/src/test/ui/run-pass/issues/issue_9155.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:issue_9155.rs - -// pretty-expanded FIXME #23616 - -extern crate issue_9155; - -struct Baz; - -pub fn main() { - issue_9155::Foo::new(Baz); -} diff --git a/src/test/ui/run-pass/iterators/into-iterator-type-inference-shift.rs b/src/test/ui/run-pass/iterators/into-iterator-type-inference-shift.rs deleted file mode 100644 index 0043c1bc829..00000000000 --- a/src/test/ui/run-pass/iterators/into-iterator-type-inference-shift.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for type inference failure around shifting. In this -// case, the iteration yields an isize, but we hadn't run the full type -// propagation yet, and so we just saw a type variable, yielding an -// error. - -// pretty-expanded FIXME #23616 - -trait IntoIterator { - type Iter: Iterator; - - fn into_iter(self) -> Self::Iter; -} - -impl IntoIterator for I where I: Iterator { - type Iter = I; - - fn into_iter(self) -> I { - self - } -} - -fn desugared_for_loop_bad(byte: u8) -> u8 { - let mut result = 0; - let mut x = IntoIterator::into_iter(0..8); - let mut y = Iterator::next(&mut x); - let mut z = y.unwrap(); - byte >> z; - 1 -} - -fn main() {} diff --git a/src/test/ui/run-pass/iterators/iter-cloned-type-inference.rs b/src/test/ui/run-pass/iterators/iter-cloned-type-inference.rs deleted file mode 100644 index 7e4bd4fb31b..00000000000 --- a/src/test/ui/run-pass/iterators/iter-cloned-type-inference.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// Test to see that the element type of .cloned() can be inferred -// properly. Previously this would fail to deduce the type of `sum`. - -#![feature(iter_arith)] - -fn square_sum(v: &[i64]) -> i64 { - let sum: i64 = v.iter().cloned().sum(); - sum * sum -} - -fn main() { - assert_eq!(36, square_sum(&[1,2,3])); -} diff --git a/src/test/ui/run-pass/iterators/iter-range.rs b/src/test/ui/run-pass/iterators/iter-range.rs deleted file mode 100644 index 017ffb3f9be..00000000000 --- a/src/test/ui/run-pass/iterators/iter-range.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn range_(a: isize, b: isize, mut it: F) where F: FnMut(isize) { - assert!((a < b)); - let mut i: isize = a; - while i < b { it(i); i += 1; } -} - -pub fn main() { - let mut sum: isize = 0; - range_(0, 100, |x| sum += x ); - println!("{}", sum); -} diff --git a/src/test/ui/run-pass/iterators/iter-step-overflow-debug.rs b/src/test/ui/run-pass/iterators/iter-step-overflow-debug.rs deleted file mode 100644 index 35f4d7b0c00..00000000000 --- a/src/test/ui/run-pass/iterators/iter-step-overflow-debug.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default -// compile-flags: -C debug_assertions=yes - -use std::panic; - -fn main() { - let r = panic::catch_unwind(|| { - let mut it = u8::max_value()..; - it.next().unwrap(); // 255 - it.next().unwrap(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - let mut it = i8::max_value()..; - it.next().unwrap(); // 127 - it.next().unwrap(); - }); - assert!(r.is_err()); -} diff --git a/src/test/ui/run-pass/iterators/iter-step-overflow-ndebug.rs b/src/test/ui/run-pass/iterators/iter-step-overflow-ndebug.rs deleted file mode 100644 index 9f12d08254d..00000000000 --- a/src/test/ui/run-pass/iterators/iter-step-overflow-ndebug.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -C debug_assertions=no - -fn main() { - let mut it = u8::max_value()..; - assert_eq!(it.next().unwrap(), 255); - assert_eq!(it.next().unwrap(), u8::min_value()); - - let mut it = i8::max_value()..; - assert_eq!(it.next().unwrap(), 127); - assert_eq!(it.next().unwrap(), i8::min_value()); -} diff --git a/src/test/ui/run-pass/iterators/iter-sum-overflow-debug.rs b/src/test/ui/run-pass/iterators/iter-sum-overflow-debug.rs deleted file mode 100644 index acd70657f44..00000000000 --- a/src/test/ui/run-pass/iterators/iter-sum-overflow-debug.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default -// compile-flags: -C debug_assertions=yes - -use std::panic; - -fn main() { - let r = panic::catch_unwind(|| { - [1, i32::max_value()].iter().sum::(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - [2, i32::max_value()].iter().product::(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - [1, i32::max_value()].iter().cloned().sum::(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - [2, i32::max_value()].iter().cloned().product::(); - }); - assert!(r.is_err()); -} diff --git a/src/test/ui/run-pass/iterators/iter-sum-overflow-ndebug.rs b/src/test/ui/run-pass/iterators/iter-sum-overflow-ndebug.rs deleted file mode 100644 index 1cd8026e456..00000000000 --- a/src/test/ui/run-pass/iterators/iter-sum-overflow-ndebug.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -C debug_assertions=no - -fn main() { - assert_eq!([1i32, i32::max_value()].iter().sum::(), - 1i32.wrapping_add(i32::max_value())); - assert_eq!([2i32, i32::max_value()].iter().product::(), - 2i32.wrapping_mul(i32::max_value())); - - assert_eq!([1i32, i32::max_value()].iter().cloned().sum::(), - 1i32.wrapping_add(i32::max_value())); - assert_eq!([2i32, i32::max_value()].iter().cloned().product::(), - 2i32.wrapping_mul(i32::max_value())); -} diff --git a/src/test/ui/run-pass/iterators/iter-sum-overflow-overflow-checks.rs b/src/test/ui/run-pass/iterators/iter-sum-overflow-overflow-checks.rs deleted file mode 100644 index a4a237c57a5..00000000000 --- a/src/test/ui/run-pass/iterators/iter-sum-overflow-overflow-checks.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default -// compile-flags: -C overflow-checks - -use std::panic; - -fn main() { - let r = panic::catch_unwind(|| { - [1, i32::max_value()].iter().sum::(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - [2, i32::max_value()].iter().product::(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - [1, i32::max_value()].iter().cloned().sum::(); - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - [2, i32::max_value()].iter().cloned().product::(); - }); - assert!(r.is_err()); -} diff --git a/src/test/ui/run-pass/iterators/iter-zip.rs b/src/test/ui/run-pass/iterators/iter-zip.rs deleted file mode 100644 index f2402fe185a..00000000000 --- a/src/test/ui/run-pass/iterators/iter-zip.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that .zip() specialization preserves side effects -// in sideeffectful iterator adaptors. - -use std::cell::Cell; - -#[derive(Debug)] -struct CountClone(Cell); - -fn count_clone() -> CountClone { CountClone(Cell::new(0)) } - -impl PartialEq for CountClone { - fn eq(&self, rhs: &i32) -> bool { - self.0.get() == *rhs - } -} - -impl Clone for CountClone { - fn clone(&self) -> Self { - let ret = CountClone(self.0.clone()); - let n = self.0.get(); - self.0.set(n + 1); - ret - } -} - -fn test_zip_cloned_sideffectful() { - let xs = [count_clone(), count_clone(), count_clone(), count_clone()]; - let ys = [count_clone(), count_clone()]; - - for _ in xs.iter().cloned().zip(ys.iter().cloned()) { } - - assert_eq!(&xs, &[1, 1, 1, 0][..]); - assert_eq!(&ys, &[1, 1][..]); - - let xs = [count_clone(), count_clone()]; - let ys = [count_clone(), count_clone(), count_clone(), count_clone()]; - - for _ in xs.iter().cloned().zip(ys.iter().cloned()) { } - - assert_eq!(&xs, &[1, 1][..]); - assert_eq!(&ys, &[1, 1, 0, 0][..]); -} - -fn test_zip_map_sideffectful() { - let mut xs = [0; 6]; - let mut ys = [0; 4]; - - for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) { } - - assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]); - assert_eq!(&ys, &[1, 1, 1, 1]); - - let mut xs = [0; 4]; - let mut ys = [0; 6]; - - for _ in xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)) { } - - assert_eq!(&xs, &[1, 1, 1, 1]); - assert_eq!(&ys, &[1, 1, 1, 1, 0, 0]); -} - -fn test_zip_map_rev_sideffectful() { - let mut xs = [0; 6]; - let mut ys = [0; 4]; - - { - let mut it = xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)); - it.next_back(); - } - assert_eq!(&xs, &[0, 0, 0, 1, 1, 1]); - assert_eq!(&ys, &[0, 0, 0, 1]); - - let mut xs = [0; 6]; - let mut ys = [0; 4]; - - { - let mut it = xs.iter_mut().map(|x| *x += 1).zip(ys.iter_mut().map(|y| *y += 1)); - (&mut it).take(5).count(); - it.next_back(); - } - assert_eq!(&xs, &[1, 1, 1, 1, 1, 1]); - assert_eq!(&ys, &[1, 1, 1, 1]); -} - -fn test_zip_nested_sideffectful() { - let mut xs = [0; 6]; - let ys = [0; 4]; - - { - // test that it has the side effect nested inside enumerate - let it = xs.iter_mut().map(|x| *x = 1).enumerate().zip(&ys); - it.count(); - } - assert_eq!(&xs, &[1, 1, 1, 1, 1, 0]); -} - -fn main() { - test_zip_cloned_sideffectful(); - test_zip_map_sideffectful(); - test_zip_map_rev_sideffectful(); - test_zip_nested_sideffectful(); -} diff --git a/src/test/ui/run-pass/macros/assert-eq-macro-success.rs b/src/test/ui/run-pass/macros/assert-eq-macro-success.rs deleted file mode 100644 index a96147db4e1..00000000000 --- a/src/test/ui/run-pass/macros/assert-eq-macro-success.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Point { x : isize } - -pub fn main() { - assert_eq!(14,14); - assert_eq!("abc".to_string(),"abc".to_string()); - assert_eq!(Box::new(Point{x:34}),Box::new(Point{x:34})); - assert_eq!(&Point{x:34},&Point{x:34}); - assert_eq!(42, 42, "foo bar"); - assert_eq!(42, 42, "a {} c", "b"); - assert_eq!(42, 42, "{x}, {y}, {z}", x = 1, y = 2, z = 3); -} diff --git a/src/test/ui/run-pass/macros/assert-eq-macro-unsized.rs b/src/test/ui/run-pass/macros/assert-eq-macro-unsized.rs deleted file mode 100644 index b9e93b175a4..00000000000 --- a/src/test/ui/run-pass/macros/assert-eq-macro-unsized.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - assert_eq!([1, 2, 3][..], vec![1, 2, 3][..]); -} diff --git a/src/test/ui/run-pass/macros/assert-ne-macro-success.rs b/src/test/ui/run-pass/macros/assert-ne-macro-success.rs deleted file mode 100644 index e554607233f..00000000000 --- a/src/test/ui/run-pass/macros/assert-ne-macro-success.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Point { x : isize } - -pub fn main() { - assert_ne!(666,14); - assert_ne!("666".to_string(),"abc".to_string()); - assert_ne!(Box::new(Point{x:666}),Box::new(Point{x:34})); - assert_ne!(&Point{x:666},&Point{x:34}); - assert_ne!(666, 42, "no gods no masters"); - assert_ne!(666, 42, "6 {} 6", "6"); - assert_ne!(666, 42, "{x}, {y}, {z}", x = 6, y = 6, z = 6); -} diff --git a/src/test/ui/run-pass/macros/assert-ne-macro-unsized.rs b/src/test/ui/run-pass/macros/assert-ne-macro-unsized.rs deleted file mode 100644 index 8833eb34918..00000000000 --- a/src/test/ui/run-pass/macros/assert-ne-macro-unsized.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - assert_ne!([6, 6, 6][..], vec![1, 2, 3][..]); -} diff --git a/src/test/ui/run-pass/macros/auxiliary/macro-comma-support.rs b/src/test/ui/run-pass/macros/auxiliary/macro-comma-support.rs deleted file mode 100644 index 6eafd520a72..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro-comma-support.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -() diff --git a/src/test/ui/run-pass/macros/auxiliary/macro-include-items-expr.rs b/src/test/ui/run-pass/macros/auxiliary/macro-include-items-expr.rs deleted file mode 100644 index aea3c749930..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro-include-items-expr.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-test: this is not a test - -1 diff --git a/src/test/ui/run-pass/macros/auxiliary/macro-include-items-item.rs b/src/test/ui/run-pass/macros/auxiliary/macro-include-items-item.rs deleted file mode 100644 index da72aaef805..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro-include-items-item.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// ignore-test: this is not a test - -fn foo() { bar() } diff --git a/src/test/ui/run-pass/macros/auxiliary/macro_crate_def_only.rs b/src/test/ui/run-pass/macros/auxiliary/macro_crate_def_only.rs deleted file mode 100644 index 4f55ac4f65f..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro_crate_def_only.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[macro_export] -macro_rules! make_a_5 { - () => (5) -} diff --git a/src/test/ui/run-pass/macros/auxiliary/macro_crate_nonterminal.rs b/src/test/ui/run-pass/macros/auxiliary/macro_crate_nonterminal.rs deleted file mode 100644 index 4f75e2b5d75..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro_crate_nonterminal.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn increment(x: usize) -> usize { - x + 1 -} - -#[macro_export] -macro_rules! increment { - ($x:expr) => ($crate::increment($x)) -} - -pub fn check_local() { - assert_eq!(increment!(3), 4); -} diff --git a/src/test/ui/run-pass/macros/auxiliary/macro_export_inner_module.rs b/src/test/ui/run-pass/macros/auxiliary/macro_export_inner_module.rs deleted file mode 100644 index 84e944f69b9..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro_export_inner_module.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod inner { - #[macro_export] - macro_rules! foo { - () => (1) - } -} diff --git a/src/test/ui/run-pass/macros/auxiliary/macro_with_super_1.rs b/src/test/ui/run-pass/macros/auxiliary/macro_with_super_1.rs deleted file mode 100644 index fd2e52bb355..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/macro_with_super_1.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -#[macro_export] -macro_rules! declare { - () => ( - pub fn aaa() {} - - pub mod bbb { - use super::aaa; - - pub fn ccc() { - aaa(); - } - } - ) -} diff --git a/src/test/ui/run-pass/macros/auxiliary/two_macros.rs b/src/test/ui/run-pass/macros/auxiliary/two_macros.rs deleted file mode 100644 index 0da6ba13696..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/two_macros.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[macro_export] -macro_rules! macro_one { ($($t:tt)*) => ($($t)*) } - -#[macro_export] -macro_rules! macro_two { ($($t:tt)*) => ($($t)*) } diff --git a/src/test/ui/run-pass/macros/auxiliary/unstable-macros.rs b/src/test/ui/run-pass/macros/auxiliary/unstable-macros.rs deleted file mode 100644 index 836164a721a..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/unstable-macros.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(staged_api)] -#![stable(feature = "unit_test", since = "1.0.0")] - -#[unstable(feature = "unstable_macros", issue = "0")] -#[macro_export] -macro_rules! unstable_macro{ () => () } diff --git a/src/test/ui/run-pass/macros/auxiliary/use-macro-self.rs b/src/test/ui/run-pass/macros/auxiliary/use-macro-self.rs deleted file mode 100644 index cdc519a5fdb..00000000000 --- a/src/test/ui/run-pass/macros/auxiliary/use-macro-self.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod foobarius {} - -#[macro_export] -macro_rules! foobarius { - () => { () } -} diff --git a/src/test/ui/run-pass/macros/colorful-write-macros.rs b/src/test/ui/run-pass/macros/colorful-write-macros.rs deleted file mode 100644 index 37eaf2e8cde..00000000000 --- a/src/test/ui/run-pass/macros/colorful-write-macros.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::io::Write; -use std::fmt; - -struct Foo<'a> { - writer: &'a mut (Write+'a), - other: &'a str, -} - -struct Bar; - -impl fmt::Write for Bar { - fn write_str(&mut self, _: &str) -> fmt::Result { - Ok(()) - } -} - -fn borrowing_writer_from_struct_and_formatting_struct_field(foo: Foo) { - write!(foo.writer, "{}", foo.other); -} - -fn main() { - let mut w = Vec::new(); - write!(&mut w as &mut Write, ""); - write!(&mut w, ""); // should coerce - println!("ok"); - - let mut s = Bar; - { - use std::fmt::Write; - write!(&mut s, "test"); - } -} diff --git a/src/test/ui/run-pass/macros/conditional-debug-macro-on.rs b/src/test/ui/run-pass/macros/conditional-debug-macro-on.rs deleted file mode 100644 index 14e911f61fc..00000000000 --- a/src/test/ui/run-pass/macros/conditional-debug-macro-on.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - // exits early if println! evaluates its arguments, otherwise it - // will hit the panic. - println!("{:?}", { if true { return; } }); - - panic!(); -} diff --git a/src/test/ui/run-pass/macros/die-macro.rs b/src/test/ui/run-pass/macros/die-macro.rs deleted file mode 100644 index 65ba591404b..00000000000 --- a/src/test/ui/run-pass/macros/die-macro.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Just testing that panic!() type checks in statement or expr - - -#![allow(unreachable_code)] - -fn f() { - panic!(); - - let _x: isize = panic!(); -} - -pub fn main() { - -} diff --git a/src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.rs b/src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.rs deleted file mode 100644 index 8356eb3ecd6..00000000000 --- a/src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(trace_macros, log_syntax)] - -// make sure these macros can be used as in the various places that -// macros can occur. - -// items -trace_macros!(false); -log_syntax!(); - -fn main() { - - // statements - trace_macros!(false); - log_syntax!(); - - // expressions - (trace_macros!(false), - log_syntax!()); -} diff --git a/src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout b/src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout deleted file mode 100644 index b28b04f6431..00000000000 --- a/src/test/ui/run-pass/macros/log_syntax-trace_macros-macro-locations.stdout +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/test/ui/run-pass/macros/macro-2.rs b/src/test/ui/run-pass/macros/macro-2.rs deleted file mode 100644 index cfce7f9c8c1..00000000000 --- a/src/test/ui/run-pass/macros/macro-2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - - macro_rules! mylambda_tt { - ($x:ident, $body:expr) => ({ - fn f($x: isize) -> isize { return $body; }; - f - }) - } - - assert_eq!(mylambda_tt!(y, y * 2)(8), 16); -} diff --git a/src/test/ui/run-pass/macros/macro-at-most-once-rep.rs b/src/test/ui/run-pass/macros/macro-at-most-once-rep.rs deleted file mode 100644 index 3625e0e7efa..00000000000 --- a/src/test/ui/run-pass/macros/macro-at-most-once-rep.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// The logic for parsing Kleene operators in macros has a special case to disambiguate `?`. -// Specifically, `$(pat)?` is the ZeroOrOne operator whereas `$(pat)?+` or `$(pat)?*` are the -// ZeroOrMore and OneOrMore operators using `?` as a separator. These tests are intended to -// exercise that logic in the macro parser. -// -// Moreover, we also throw in some tests for using a separator with `?`, which is meaningless but -// included for consistency with `+` and `*`. -// -// This test focuses on non-error cases and making sure the correct number of repetitions happen. - -// edition:2018 - -#![feature(macro_at_most_once_rep)] - -macro_rules! foo { - ($($a:ident)? ; $num:expr) => { { - let mut x = 0; - - $( - x += $a; - )? - - assert_eq!(x, $num); - } } -} - -pub fn main() { - let a = 1; - - // accept 0 or 1 repetitions - foo!( ; 0); - foo!(a ; 1); -} diff --git a/src/test/ui/run-pass/macros/macro-attribute-expansion.rs b/src/test/ui/run-pass/macros/macro-attribute-expansion.rs deleted file mode 100644 index 2f4e62e0faa..00000000000 --- a/src/test/ui/run-pass/macros/macro-attribute-expansion.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! descriptions { - ($name:ident is $desc:expr) => { - // Check that we will correctly expand attributes - #[doc = $desc] - #[allow(dead_code)] - const $name : &'static str = $desc; - } -} - -// item -descriptions! { DOG is "an animal" } -descriptions! { RUST is "a language" } - -pub fn main() { -} diff --git a/src/test/ui/run-pass/macros/macro-attributes.rs b/src/test/ui/run-pass/macros/macro-attributes.rs deleted file mode 100644 index 70190d495a5..00000000000 --- a/src/test/ui/run-pass/macros/macro-attributes.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(custom_attribute)] - -macro_rules! compiles_fine { - (#[$at:meta]) => { - // test that the different types of attributes work - #[attribute] - /// Documentation! - #[$at] - - // check that the attributes are recognised by requiring this - // to be removed to avoid a compile error - #[cfg(always_remove)] - static MISTYPED: () = "foo"; - } -} - -// item -compiles_fine!(#[foo]); - -pub fn main() { - // statement - compiles_fine!(#[bar]); -} diff --git a/src/test/ui/run-pass/macros/macro-block-nonterminal.rs b/src/test/ui/run-pass/macros/macro-block-nonterminal.rs deleted file mode 100644 index 02ad360880f..00000000000 --- a/src/test/ui/run-pass/macros/macro-block-nonterminal.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! do_block{ - ($val:block) => {$val} -} - -fn main() { - let s; - do_block!({ s = "it works!"; }); - assert_eq!(s, "it works!"); -} diff --git a/src/test/ui/run-pass/macros/macro-comma-behavior.rs b/src/test/ui/run-pass/macros/macro-comma-behavior.rs deleted file mode 100644 index bfa32817b10..00000000000 --- a/src/test/ui/run-pass/macros/macro-comma-behavior.rs +++ /dev/null @@ -1,99 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ideally, any macro call with a trailing comma should behave -// identically to a call without the comma. -// -// This checks the behavior of macros with trailing commas in key -// places where regressions in behavior seem highly possible (due -// to it being e.g. a place where the addition of an argument -// causes it to go down a code path with subtly different behavior). -// -// There is a companion test in compile-fail. - -// compile-flags: --test -C debug_assertions=yes -// revisions: std core - -#![cfg_attr(core, no_std)] - -#[cfg(std)] use std::fmt; -#[cfg(core)] use core::fmt; - -// an easy mistake in the implementation of 'assert!' -// would cause this to say "explicit panic" -#[test] -#[should_panic(expected = "assertion failed")] -fn assert_1arg() { - assert!(false,); -} - -// same as 'assert_1arg' -#[test] -#[should_panic(expected = "assertion failed")] -fn debug_assert_1arg() { - debug_assert!(false,); -} - -// make sure we don't accidentally forward to `write!("text")` -#[cfg(std)] -#[test] -fn writeln_1arg() { - use fmt::Write; - - let mut s = String::new(); - writeln!(&mut s,).unwrap(); - assert_eq!(&s, "\n"); -} - -// A number of format_args-like macros have special-case treatment -// for a single message string, which is not formatted. -// -// This test ensures that the addition of a trailing comma does not -// suddenly cause these strings to get formatted when they otherwise -// would not be. This is an easy mistake to make by having such a macro -// accept ", $($tok:tt)*" instead of ", $($tok:tt)+" after its minimal -// set of arguments. -// -// (Example: Issue #48042) -#[test] -fn to_format_or_not_to_format() { - // ("{}" is the easiest string to test because if this gets - // sent to format_args!, it'll simply fail to compile. - // "{{}}" is an example of an input that could compile and - // produce an incorrect program, but testing the panics - // would be burdensome.) - let falsum = || false; - - assert!(true, "{}",); - - // assert_eq!(1, 1, "{}",); // see compile-fail - // assert_ne!(1, 2, "{}",); // see compile-fail - - debug_assert!(true, "{}",); - - // debug_assert_eq!(1, 1, "{}",); // see compile-fail - // debug_assert_ne!(1, 2, "{}",); // see compile-fail - // eprint!("{}",); // see compile-fail - // eprintln!("{}",); // see compile-fail - // format!("{}",); // see compile-fail - // format_args!("{}",); // see compile-fail - - if falsum() { panic!("{}",); } - - // print!("{}",); // see compile-fail - // println!("{}",); // see compile-fail - // unimplemented!("{}",); // see compile-fail - - if falsum() { unreachable!("{}",); } - - // write!(&mut stdout, "{}",); // see compile-fail - // writeln!(&mut stdout, "{}",); // see compile-fail -} diff --git a/src/test/ui/run-pass/macros/macro-comma-support.rs b/src/test/ui/run-pass/macros/macro-comma-support.rs deleted file mode 100644 index f674123aac7..00000000000 --- a/src/test/ui/run-pass/macros/macro-comma-support.rs +++ /dev/null @@ -1,360 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is meant to be a comprehensive test of invocations with/without -// trailing commas (or other, similar optionally-trailing separators). -// Every macro is accounted for, even those not tested in this file. -// (There will be a note indicating why). - -// std and core are both tested because they may contain separate -// implementations for some macro_rules! macros as an implementation -// detail. - -// ignore-pretty issue #37195 - -// compile-flags: --test -C debug_assertions=yes -// revisions: std core - -#![cfg_attr(core, no_std)] - -#![feature(concat_idents)] - -#[cfg(std)] use std::fmt; -#[cfg(core)] use core::fmt; - -#[test] -fn assert() { - assert!(true); - assert!(true,); - assert!(true, "hello"); - assert!(true, "hello",); - assert!(true, "hello {}", "world"); - assert!(true, "hello {}", "world",); -} - -#[test] -fn assert_eq() { - assert_eq!(1, 1); - assert_eq!(1, 1,); - assert_eq!(1, 1, "hello"); - assert_eq!(1, 1, "hello",); - assert_eq!(1, 1, "hello {}", "world"); - assert_eq!(1, 1, "hello {}", "world",); -} - -#[test] -fn assert_ne() { - assert_ne!(1, 2); - assert_ne!(1, 2,); - assert_ne!(1, 2, "hello"); - assert_ne!(1, 2, "hello",); - assert_ne!(1, 2, "hello {}", "world"); - assert_ne!(1, 2, "hello {}", "world",); -} - -#[test] -fn cfg() { - let _ = cfg!(pants); - let _ = cfg!(pants,); - let _ = cfg!(pants = "pants"); - let _ = cfg!(pants = "pants",); - let _ = cfg!(all(pants)); - let _ = cfg!(all(pants),); - let _ = cfg!(all(pants,)); - let _ = cfg!(all(pants,),); -} - -#[test] -fn column() { - let _ = column!(); -} - -// compile_error! is in a companion to this test in compile-fail - -#[test] -fn concat() { - let _ = concat!(); - let _ = concat!("hello"); - let _ = concat!("hello",); - let _ = concat!("hello", " world"); - let _ = concat!("hello", " world",); -} - -#[test] -fn concat_idents() { - fn foo() {} - fn foobar() {} - - concat_idents!(foo)(); - concat_idents!(foo,)(); - concat_idents!(foo, bar)(); - concat_idents!(foo, bar,)(); -} - -#[test] -fn debug_assert() { - debug_assert!(true); - debug_assert!(true, ); - debug_assert!(true, "hello"); - debug_assert!(true, "hello",); - debug_assert!(true, "hello {}", "world"); - debug_assert!(true, "hello {}", "world",); -} - -#[test] -fn debug_assert_eq() { - debug_assert_eq!(1, 1); - debug_assert_eq!(1, 1,); - debug_assert_eq!(1, 1, "hello"); - debug_assert_eq!(1, 1, "hello",); - debug_assert_eq!(1, 1, "hello {}", "world"); - debug_assert_eq!(1, 1, "hello {}", "world",); -} - -#[test] -fn debug_assert_ne() { - debug_assert_ne!(1, 2); - debug_assert_ne!(1, 2,); - debug_assert_ne!(1, 2, "hello"); - debug_assert_ne!(1, 2, "hello",); - debug_assert_ne!(1, 2, "hello {}", "world"); - debug_assert_ne!(1, 2, "hello {}", "world",); -} - -#[test] -fn env() { - let _ = env!("PATH"); - let _ = env!("PATH",); - let _ = env!("PATH", "not found"); - let _ = env!("PATH", "not found",); -} - -#[cfg(std)] -#[test] -fn eprint() { - eprint!("hello"); - eprint!("hello",); - eprint!("hello {}", "world"); - eprint!("hello {}", "world",); -} - -#[cfg(std)] -#[test] -fn eprintln() { - eprintln!(); - eprintln!("hello"); - eprintln!("hello",); - eprintln!("hello {}", "world"); - eprintln!("hello {}", "world",); -} - -#[test] -fn file() { - let _ = file!(); -} - -#[cfg(std)] -#[test] -fn format() { - let _ = format!("hello"); - let _ = format!("hello",); - let _ = format!("hello {}", "world"); - let _ = format!("hello {}", "world",); -} - -#[test] -fn format_args() { - let _ = format_args!("hello"); - let _ = format_args!("hello",); - let _ = format_args!("hello {}", "world"); - let _ = format_args!("hello {}", "world",); -} - -#[test] -fn include() { - let _ = include!("auxiliary/macro-comma-support.rs"); - let _ = include!("auxiliary/macro-comma-support.rs",); -} - -#[test] -fn include_bytes() { - let _ = include_bytes!("auxiliary/macro-comma-support.rs"); - let _ = include_bytes!("auxiliary/macro-comma-support.rs",); -} - -#[test] -fn include_str() { - let _ = include_str!("auxiliary/macro-comma-support.rs"); - let _ = include_str!("auxiliary/macro-comma-support.rs",); -} - -#[test] -fn line() { - let _ = line!(); -} - -#[test] -fn module_path() { - let _ = module_path!(); -} - -#[test] -fn option_env() { - let _ = option_env!("PATH"); - let _ = option_env!("PATH",); -} - -#[test] -fn panic() { - // prevent 'unreachable code' warnings - let falsum = || false; - - if falsum() { panic!(); } - if falsum() { panic!("hello"); } - if falsum() { panic!("hello",); } - if falsum() { panic!("hello {}", "world"); } - if falsum() { panic!("hello {}", "world",); } -} - -#[cfg(std)] -#[test] -fn print() { - print!("hello"); - print!("hello",); - print!("hello {}", "world"); - print!("hello {}", "world",); -} - -#[cfg(std)] -#[test] -fn println() { - println!(); - println!("hello"); - println!("hello",); - println!("hello {}", "world"); - println!("hello {}", "world",); -} - -// select! is too troublesome and unlikely to be stabilized - -// stringify! is N/A - -#[cfg(std)] -#[test] -fn thread_local() { - // this has an optional trailing *semicolon* - thread_local! { - #[allow(unused)] pub static A: () = () - } - - thread_local! { - #[allow(unused)] pub static AA: () = (); - } - - thread_local! { - #[allow(unused)] pub static AAA: () = (); - #[allow(unused)] pub static AAAA: () = () - } - - thread_local! { - #[allow(unused)] pub static AAAAG: () = (); - #[allow(unused)] pub static AAAAGH: () = (); - } -} - -#[test] -fn try() { - fn inner() -> Result<(), ()> { - try!(Ok(())); - try!(Ok(()),); - Ok(()) - } - - inner().unwrap(); -} - -#[test] -fn unimplemented() { - // prevent 'unreachable code' warnings - let falsum = || false; - - if falsum() { unimplemented!(); } - if falsum() { unimplemented!("hello"); } - if falsum() { unimplemented!("hello",); } - if falsum() { unimplemented!("hello {}", "world"); } - if falsum() { unimplemented!("hello {}", "world",); } -} - -#[test] -fn unreachable() { - // prevent 'unreachable code' warnings - let falsum = || false; - - if falsum() { unreachable!(); } - if falsum() { unreachable!("hello"); } - if falsum() { unreachable!("hello",); } - if falsum() { unreachable!("hello {}", "world"); } - if falsum() { unreachable!("hello {}", "world",); } -} - -#[cfg(std)] -#[test] -fn vec() { - let _: Vec<()> = vec![]; - let _ = vec![0]; - let _ = vec![0,]; - let _ = vec![0, 1]; - let _ = vec![0, 1,]; -} - -// give a test body access to a fmt::Formatter, which seems -// to be the easiest way to use 'write!' on core. -macro_rules! test_with_formatter { - ( - #[test] - fn $fname:ident($f:ident: &mut fmt::Formatter) $block:block - ) => { - #[test] - fn $fname() { - struct Struct; - impl fmt::Display for Struct { - fn fmt(&self, $f: &mut fmt::Formatter) -> fmt::Result { - Ok($block) - } - } - - // suppress "unused" - assert!(true, "{}", Struct); - } - }; -} - -test_with_formatter! { - #[test] - fn write(f: &mut fmt::Formatter) { - let _ = write!(f, "hello"); - let _ = write!(f, "hello",); - let _ = write!(f, "hello {}", "world"); - let _ = write!(f, "hello {}", "world",); - } -} - -test_with_formatter! { - #[test] - fn writeln(f: &mut fmt::Formatter) { - let _ = writeln!(f); - let _ = writeln!(f,); - let _ = writeln!(f, "hello"); - let _ = writeln!(f, "hello",); - let _ = writeln!(f, "hello {}", "world"); - let _ = writeln!(f, "hello {}", "world",); - } -} diff --git a/src/test/ui/run-pass/macros/macro-crate-def-only.rs b/src/test/ui/run-pass/macros/macro-crate-def-only.rs deleted file mode 100644 index 3a48d0489ce..00000000000 --- a/src/test/ui/run-pass/macros/macro-crate-def-only.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:macro_crate_def_only.rs - - -#[macro_use] #[no_link] -extern crate macro_crate_def_only; - -pub fn main() { - assert_eq!(5, make_a_5!()); -} diff --git a/src/test/ui/run-pass/macros/macro-crate-nonterminal-renamed.rs b/src/test/ui/run-pass/macros/macro-crate-nonterminal-renamed.rs deleted file mode 100644 index c2a9729ec1c..00000000000 --- a/src/test/ui/run-pass/macros/macro-crate-nonterminal-renamed.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:macro_crate_nonterminal.rs - -#[macro_use] -extern crate macro_crate_nonterminal as new_name; - -pub fn main() { - new_name::check_local(); - assert_eq!(increment!(5), 6); -} diff --git a/src/test/ui/run-pass/macros/macro-crate-nonterminal.rs b/src/test/ui/run-pass/macros/macro-crate-nonterminal.rs deleted file mode 100644 index 114d8961817..00000000000 --- a/src/test/ui/run-pass/macros/macro-crate-nonterminal.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:macro_crate_nonterminal.rs - -#[macro_use] -extern crate macro_crate_nonterminal; - -pub fn main() { - macro_crate_nonterminal::check_local(); - assert_eq!(increment!(5), 6); -} diff --git a/src/test/ui/run-pass/macros/macro-crate-use.rs b/src/test/ui/run-pass/macros/macro-crate-use.rs deleted file mode 100644 index b74d5ec91b5..00000000000 --- a/src/test/ui/run-pass/macros/macro-crate-use.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn increment(x: usize) -> usize { - x + 1 -} - -#[macro_export] -macro_rules! increment { - ($x:expr) => ({ - use $crate::increment; - increment($x) - }) -} - -fn main() { - assert_eq!(increment!(3), 4); -} diff --git a/src/test/ui/run-pass/macros/macro-deep_expansion.rs b/src/test/ui/run-pass/macros/macro-deep_expansion.rs deleted file mode 100644 index d6def354673..00000000000 --- a/src/test/ui/run-pass/macros/macro-deep_expansion.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! foo2 { - () => { - "foo" - } -} - -macro_rules! foo { - () => { - foo2!() - } -} - -fn main() { - assert_eq!(concat!(foo!(), "bar"), "foobar") -} diff --git a/src/test/ui/run-pass/macros/macro-delimiter-significance.rs b/src/test/ui/run-pass/macros/macro-delimiter-significance.rs deleted file mode 100644 index 0b6b183e6e8..00000000000 --- a/src/test/ui/run-pass/macros/macro-delimiter-significance.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - vec![1_usize, 2, 3].len(); -} diff --git a/src/test/ui/run-pass/macros/macro-doc-comments.rs b/src/test/ui/run-pass/macros/macro-doc-comments.rs deleted file mode 100644 index 2115022f17f..00000000000 --- a/src/test/ui/run-pass/macros/macro-doc-comments.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -macro_rules! doc { - ( - $(#[$outer:meta])* - mod $i:ident { - $(#![$inner:meta])* - } - ) => - ( - $(#[$outer])* - pub mod $i { - $(#![$inner])* - } - ) -} - -doc! { - /// Outer doc - mod Foo { - //! Inner doc - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/macros/macro-doc-escapes.rs b/src/test/ui/run-pass/macros/macro-doc-escapes.rs deleted file mode 100644 index 5253d960c8d..00000000000 --- a/src/test/ui/run-pass/macros/macro-doc-escapes.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// When expanding a macro, documentation attributes (including documentation comments) must be -// passed "as is" without being parsed. Otherwise, some text will be incorrectly interpreted as -// escape sequences, leading to an ICE. -// -// Related issues: #25929, #25943 - -macro_rules! homura { - (#[$x:meta]) => () -} - -homura! { - /// \madoka \x41 -} - -fn main() { } diff --git a/src/test/ui/run-pass/macros/macro-doc-raw-str-hashes.rs b/src/test/ui/run-pass/macros/macro-doc-raw-str-hashes.rs deleted file mode 100644 index b12e00eccc9..00000000000 --- a/src/test/ui/run-pass/macros/macro-doc-raw-str-hashes.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// The number of `#`s used to wrap the documentation comment should differ regarding the content. -// -// Related issue: #27489 - -macro_rules! homura { - ($x:expr, #[$y:meta]) => (assert_eq!($x, stringify!($y))) -} - -fn main() { - homura! { - r#"doc = r" Madoka""#, - /// Madoka - }; - - homura! { - r##"doc = r#" One quote mark: ["]"#"##, - /// One quote mark: ["] - }; - - homura! { - r##"doc = r#" Two quote marks: [""]"#"##, - /// Two quote marks: [""] - }; - - homura! { - r#####"doc = r####" Raw string ending sequences: ["###]"####"#####, - /// Raw string ending sequences: ["###] - }; -} diff --git a/src/test/ui/run-pass/macros/macro-export-inner-module.rs b/src/test/ui/run-pass/macros/macro-export-inner-module.rs deleted file mode 100644 index e114790f71a..00000000000 --- a/src/test/ui/run-pass/macros/macro-export-inner-module.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -//aux-build:macro_export_inner_module.rs - -#[macro_use] #[no_link] -extern crate macro_export_inner_module; - -pub fn main() { - assert_eq!(1, foo!()); -} diff --git a/src/test/ui/run-pass/macros/macro-first-set.rs b/src/test/ui/run-pass/macros/macro-first-set.rs deleted file mode 100644 index 984a31d4d52..00000000000 --- a/src/test/ui/run-pass/macros/macro-first-set.rs +++ /dev/null @@ -1,289 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![cfg_attr(stage0, feature(macro_vis_matcher))] - -//{{{ issue 40569 ============================================================== - -macro_rules! my_struct { - ($(#[$meta:meta])* $ident:ident) => { - $(#[$meta])* struct $ident; - } -} - -my_struct!(#[derive(Debug, PartialEq)] Foo40569); - -fn test_40569() { - assert_eq!(Foo40569, Foo40569); -} - -//}}} - -//{{{ issue 26444 ============================================================== - -macro_rules! foo_26444 { - ($($beginning:ident),*; $middle:ident; $($end:ident),*) => { - stringify!($($beginning,)* $middle $(,$end)*) - } -} - -fn test_26444() { - assert_eq!("a , b , c , d , e", foo_26444!(a, b; c; d, e)); - assert_eq!("f", foo_26444!(; f ;)); -} - -macro_rules! pat_26444 { - ($fname:ident $($arg:pat)* =) => {} -} - -pat_26444!(foo 1 2 5...7 =); -pat_26444!(bar Some(ref x) Ok(ref mut y) &(w, z) =); - -//}}} - -//{{{ issue 40984 ============================================================== - -macro_rules! thread_local_40984 { - () => {}; - ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr; $($rest:tt)*) => { - thread_local_40984!($($rest)*); - }; - ($(#[$attr:meta])* $vis:vis static $name:ident: $t:ty = $init:expr) => {}; -} - -thread_local_40984! { - // no docs - #[allow(unused)] - static FOO: i32 = 42; - /// docs - pub static BAR: String = String::from("bar"); - - // look at these restrictions!! - pub(crate) static BAZ: usize = 0; - pub(in foo) static QUUX: usize = 0; -} - -//}}} - -//{{{ issue 35650 ============================================================== - -macro_rules! size { - ($ty:ty) => { - std::mem::size_of::<$ty>() - }; - ($size:tt) => { - $size - }; -} - -fn test_35650() { - assert_eq!(size!(u64), 8); - assert_eq!(size!(5), 5); -} - -//}}} - -//{{{ issue 27832 ============================================================== - -macro_rules! m { - ( $i:ident ) => (); - ( $t:tt $j:tt ) => (); -} - -m!(c); -m!(t 9); -m!(0 9); -m!(struct); -m!(struct Foo); - -macro_rules! m2 { - ( $b:expr ) => (); - ( $t:tt $u:tt ) => (); -} - -m2!(3); -m2!(1 2); -m2!(_ 1); -m2!(enum Foo); - -//}}} - -//{{{ issue 39964 ============================================================== - -macro_rules! foo_39964 { - ($a:ident) => {}; - (_) => {}; -} - -foo_39964!(_); - -//}}} - -//{{{ issue 34030 ============================================================== - -macro_rules! foo_34030 { - ($($t:ident),* /) => {}; -} - -foo_34030!(a, b/); -foo_34030!(a/); -foo_34030!(/); - -//}}} - -//{{{ issue 24189 ============================================================== - -macro_rules! foo_24189 { - ( - pub enum $name:ident { - $( #[$attr:meta] )* $var:ident - } - ) => { - pub enum $name { - $( #[$attr] )* $var - } - }; -} - -foo_24189! { - pub enum Foo24189 { - #[doc = "Bar"] Baz - } -} - -macro_rules! serializable { - ( - $(#[$struct_meta:meta])* - pub struct $name:ident { - $( - $(#[$field_meta:meta])* - $field:ident: $type_:ty - ),* , - } - ) => { - $(#[$struct_meta])* - pub struct $name { - $( - $(#[$field_meta])* - $field: $type_ - ),* , - } - } -} - -serializable! { - #[allow(dead_code)] - /// This is a test - pub struct Tester { - #[allow(dead_code)] - name: String, - } -} - -macro_rules! foo_24189_c { - ( $( > )* $x:ident ) => { }; -} -foo_24189_c!( > a ); - -fn test_24189() { - let _ = Foo24189::Baz; - let _ = Tester { name: "".to_owned() }; -} - -//}}} - -//{{{ issue 50903 ============================================================== - -macro_rules! foo_50903 { - ($($lif:lifetime ,)* #) => {}; -} - -foo_50903!('a, 'b, #); -foo_50903!('a, #); -foo_50903!(#); - -//}}} - -//{{{ issue 51477 ============================================================== - -macro_rules! foo_51477 { - ($lifetime:lifetime) => { - "last token is lifetime" - }; - ($other:tt) => { - "last token is other" - }; - ($first:tt $($rest:tt)*) => { - foo_51477!($($rest)*) - }; -} - -fn test_51477() { - assert_eq!("last token is lifetime", foo_51477!('a)); - assert_eq!("last token is other", foo_51477!(@)); - assert_eq!("last token is lifetime", foo_51477!(@ {} 'a)); -} - -//}}} - -//{{{ some more tests ========================================================== - -macro_rules! test_block { - (< $($b:block)* >) => {} -} - -test_block!(<>); -test_block!(<{}>); -test_block!(<{1}{2}>); - -macro_rules! test_ty { - ($($t:ty),* $(,)*) => {} -} - -test_ty!(); -test_ty!(,); -test_ty!(u8); -test_ty!(u8,); - -macro_rules! test_path { - ($($t:path),* $(,)*) => {} -} - -test_path!(); -test_path!(,); -test_path!(::std); -test_path!(std::u8,); -test_path!(any, super, super::super::self::path, X::Z<'a, T=U>); - -macro_rules! test_meta_block { - ($($m:meta)* $b:block) => {}; -} - -test_meta_block!(windows {}); - -macro_rules! test_lifetime { - (1. $($l:lifetime)* $($b:block)*) => {}; - (2. $($b:block)* $($l:lifetime)*) => {}; -} - -test_lifetime!(1. 'a 'b {} {}); -test_lifetime!(2. {} {} 'a 'b); - -//}}} - -fn main() { - test_26444(); - test_40569(); - test_35650(); - test_24189(); - test_51477(); -} - diff --git a/src/test/ui/run-pass/macros/macro-follow.rs b/src/test/ui/run-pass/macros/macro-follow.rs deleted file mode 100644 index 2cb2e43fd65..00000000000 --- a/src/test/ui/run-pass/macros/macro-follow.rs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check the macro follow sets (see corresponding cfail test). - -// FOLLOW(pat) = {FatArrow, Comma, Eq, Or, Ident(if), Ident(in)} -macro_rules! follow_pat { - ($p:pat =>) => {}; - ($p:pat ,) => {}; - ($p:pat =) => {}; - ($p:pat |) => {}; - ($p:pat if) => {}; - ($p:pat in) => {}; -} -// FOLLOW(expr) = {FatArrow, Comma, Semicolon} -macro_rules! follow_expr { - ($e:expr =>) => {}; - ($e:expr ,) => {}; - ($e:expr ;) => {}; -} -// FOLLOW(ty) = {OpenDelim(Brace), Comma, FatArrow, Colon, Eq, Gt, Semi, Or, -// Ident(as), Ident(where), OpenDelim(Bracket), Nonterminal(Block)} -macro_rules! follow_ty { - ($t:ty {}) => {}; - ($t:ty ,) => {}; - ($t:ty =>) => {}; - ($t:ty :) => {}; - ($t:ty =) => {}; - ($t:ty >) => {}; - ($t:ty ;) => {}; - ($t:ty |) => {}; - ($t:ty as) => {}; - ($t:ty where) => {}; - ($t:ty []) => {}; - ($t:ty $b:block) => {}; -} -// FOLLOW(stmt) = FOLLOW(expr) -macro_rules! follow_stmt { - ($s:stmt =>) => {}; - ($s:stmt ,) => {}; - ($s:stmt ;) => {}; -} -// FOLLOW(path) = FOLLOW(ty) -macro_rules! follow_path { - ($p:path {}) => {}; - ($p:path ,) => {}; - ($p:path =>) => {}; - ($p:path :) => {}; - ($p:path =) => {}; - ($p:path >) => {}; - ($p:path ;) => {}; - ($p:path |) => {}; - ($p:path as) => {}; - ($p:path where) => {}; - ($p:path []) => {}; - ($p:path $b:block) => {}; -} -// FOLLOW(block) = any token -macro_rules! follow_block { - ($b:block ()) => {}; - ($b:block []) => {}; - ($b:block {}) => {}; - ($b:block ,) => {}; - ($b:block =>) => {}; - ($b:block :) => {}; - ($b:block =) => {}; - ($b:block >) => {}; - ($b:block ;) => {}; - ($b:block |) => {}; - ($b:block +) => {}; - ($b:block ident) => {}; - ($b:block $p:pat) => {}; - ($b:block $e:expr) => {}; - ($b:block $t:ty) => {}; - ($b:block $s:stmt) => {}; - ($b:block $p:path) => {}; - ($b:block $b:block) => {}; - ($b:block $i:ident) => {}; - ($b:block $t:tt) => {}; - ($b:block $i:item) => {}; - ($b:block $m:meta) => {}; -} -// FOLLOW(ident) = any token -macro_rules! follow_ident { - ($i:ident ()) => {}; - ($i:ident []) => {}; - ($i:ident {}) => {}; - ($i:ident ,) => {}; - ($i:ident =>) => {}; - ($i:ident :) => {}; - ($i:ident =) => {}; - ($i:ident >) => {}; - ($i:ident ;) => {}; - ($i:ident |) => {}; - ($i:ident +) => {}; - ($i:ident ident) => {}; - ($i:ident $p:pat) => {}; - ($i:ident $e:expr) => {}; - ($i:ident $t:ty) => {}; - ($i:ident $s:stmt) => {}; - ($i:ident $p:path) => {}; - ($i:ident $b:block) => {}; - ($i:ident $i:ident) => {}; - ($i:ident $t:tt) => {}; - ($i:ident $i:item) => {}; - ($i:ident $m:meta) => {}; -} -// FOLLOW(tt) = any token -macro_rules! follow_tt { - ($t:tt ()) => {}; - ($t:tt []) => {}; - ($t:tt {}) => {}; - ($t:tt ,) => {}; - ($t:tt =>) => {}; - ($t:tt :) => {}; - ($t:tt =) => {}; - ($t:tt >) => {}; - ($t:tt ;) => {}; - ($t:tt |) => {}; - ($t:tt +) => {}; - ($t:tt ident) => {}; - ($t:tt $p:pat) => {}; - ($t:tt $e:expr) => {}; - ($t:tt $t:ty) => {}; - ($t:tt $s:stmt) => {}; - ($t:tt $p:path) => {}; - ($t:tt $b:block) => {}; - ($t:tt $i:ident) => {}; - ($t:tt $t:tt) => {}; - ($t:tt $i:item) => {}; - ($t:tt $m:meta) => {}; -} -// FOLLOW(item) = any token -macro_rules! follow_item { - ($i:item ()) => {}; - ($i:item []) => {}; - ($i:item {}) => {}; - ($i:item ,) => {}; - ($i:item =>) => {}; - ($i:item :) => {}; - ($i:item =) => {}; - ($i:item >) => {}; - ($i:item ;) => {}; - ($i:item |) => {}; - ($i:item +) => {}; - ($i:item ident) => {}; - ($i:item $p:pat) => {}; - ($i:item $e:expr) => {}; - ($i:item $t:ty) => {}; - ($i:item $s:stmt) => {}; - ($i:item $p:path) => {}; - ($i:item $b:block) => {}; - ($i:item $i:ident) => {}; - ($i:item $t:tt) => {}; - ($i:item $i:item) => {}; - ($i:item $m:meta) => {}; -} -// FOLLOW(meta) = any token -macro_rules! follow_meta { - ($m:meta ()) => {}; - ($m:meta []) => {}; - ($m:meta {}) => {}; - ($m:meta ,) => {}; - ($m:meta =>) => {}; - ($m:meta :) => {}; - ($m:meta =) => {}; - ($m:meta >) => {}; - ($m:meta ;) => {}; - ($m:meta |) => {}; - ($m:meta +) => {}; - ($m:meta ident) => {}; - ($m:meta $p:pat) => {}; - ($m:meta $e:expr) => {}; - ($m:meta $t:ty) => {}; - ($m:meta $s:stmt) => {}; - ($m:meta $p:path) => {}; - ($m:meta $b:block) => {}; - ($m:meta $i:ident) => {}; - ($m:meta $t:tt) => {}; - ($m:meta $i:item) => {}; - ($m:meta $m:meta) => {}; -} - -fn main() {} - diff --git a/src/test/ui/run-pass/macros/macro-followed-by-seq.rs b/src/test/ui/run-pass/macros/macro-followed-by-seq.rs deleted file mode 100644 index 8b796187664..00000000000 --- a/src/test/ui/run-pass/macros/macro-followed-by-seq.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #25436: check that things which can be -// followed by any token also permit X* to come afterwards. - -macro_rules! foo { - ( $a:tt $($b:tt)* ) => { }; - ( $a:ident $($b:tt)* ) => { }; - ( $a:item $($b:tt)* ) => { }; - ( $a:block $($b:tt)* ) => { }; - ( $a:meta $($b:tt)* ) => { } -} - -fn main() { } diff --git a/src/test/ui/run-pass/macros/macro-include-items.rs b/src/test/ui/run-pass/macros/macro-include-items.rs deleted file mode 100644 index d5d459bf28d..00000000000 --- a/src/test/ui/run-pass/macros/macro-include-items.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// ignore-pretty issue #37195 - -fn bar() {} - -include!(concat!("", "", "auxiliary/", "macro-include-items-item.rs")); - -fn main() { - foo(); - assert_eq!(include!(concat!("", "auxiliary/", "macro-include-items-expr.rs")), 1_usize); -} diff --git a/src/test/ui/run-pass/macros/macro-interpolation.rs b/src/test/ui/run-pass/macros/macro-interpolation.rs deleted file mode 100644 index bc0c15bd403..00000000000 --- a/src/test/ui/run-pass/macros/macro-interpolation.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! overly_complicated { - ($fnname:ident, $arg:ident, $ty:ty, $body:block, $val:expr, $pat:pat, $res:path) => - ({ - fn $fnname($arg: $ty) -> Option<$ty> $body - match $fnname($val) { - Some($pat) => { - $res - } - _ => { panic!(); } - } - }) - -} - -pub fn main() { - assert!(overly_complicated!(f, x, Option, { return Some(x); }, - Some(8), Some(y), y) == 8) - -} diff --git a/src/test/ui/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs b/src/test/ui/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs deleted file mode 100644 index 457b7232f0a..00000000000 --- a/src/test/ui/run-pass/macros/macro-invocation-in-count-expr-fixed-array-type.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -macro_rules! four { - () => (4) -} - -fn main() { - let _x: [u16; four!()]; -} diff --git a/src/test/ui/run-pass/macros/macro-lifetime-used-with-bound.rs b/src/test/ui/run-pass/macros/macro-lifetime-used-with-bound.rs deleted file mode 100644 index eadef980377..00000000000 --- a/src/test/ui/run-pass/macros/macro-lifetime-used-with-bound.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - ($l:lifetime, $l2:lifetime) => { - fn f<$l: $l2, $l2>(arg: &$l str, arg2: &$l2 str) -> &$l str { - arg - } - } -} - -pub fn main() { - foo!('a, 'b); - let x: &'static str = f("hi", "there"); - assert_eq!("hi", x); -} diff --git a/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.rs b/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.rs deleted file mode 100644 index e7c59007702..00000000000 --- a/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![allow(unreachable_code)] - -macro_rules! x { - ($a:lifetime) => { - $a: loop { - break $a; - panic!("failed"); - } - } -} -macro_rules! br { - ($a:lifetime) => { - break $a; - } -} -macro_rules! br2 { - ($b:lifetime) => { - 'b: loop { - break $b; // this $b should refer to the outer loop. - } - } -} -fn main() { - x!('a); - 'c: loop { - br!('c); - panic!("failed"); - } - 'b: loop { - br2!('b); - panic!("failed"); - } -} diff --git a/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr b/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr deleted file mode 100644 index 729178fb8f1..00000000000 --- a/src/test/ui/run-pass/macros/macro-lifetime-used-with-labels.stderr +++ /dev/null @@ -1,11 +0,0 @@ -warning: label name `'b` shadows a label name that is already in scope - --> $DIR/macro-lifetime-used-with-labels.rs:31:9 - | -LL | 'b: loop { - | ^^ lifetime 'b already in scope -... -LL | 'b: loop { - | -- first declared here -LL | br2!('b); - | --------- in this macro invocation - diff --git a/src/test/ui/run-pass/macros/macro-lifetime-used-with-static.rs b/src/test/ui/run-pass/macros/macro-lifetime-used-with-static.rs deleted file mode 100644 index 2b37ce461cb..00000000000 --- a/src/test/ui/run-pass/macros/macro-lifetime-used-with-static.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - ($l:lifetime) => { - fn f(arg: &$l str) -> &$l str { - arg - } - } -} - -pub fn main() { - foo!('static); - let x: &'static str = f("hi"); - assert_eq!("hi", x); -} diff --git a/src/test/ui/run-pass/macros/macro-lifetime.rs b/src/test/ui/run-pass/macros/macro-lifetime.rs deleted file mode 100644 index f385d73e5bb..00000000000 --- a/src/test/ui/run-pass/macros/macro-lifetime.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - ($l:lifetime) => { - fn f<$l>(arg: &$l str) -> &$l str { - arg - } - } -} - -pub fn main() { - foo!('a); - let x: &'static str = f("hi"); - assert_eq!("hi", x); -} diff --git a/src/test/ui/run-pass/macros/macro-literal.rs b/src/test/ui/run-pass/macros/macro-literal.rs deleted file mode 100644 index ecbb47757d1..00000000000 --- a/src/test/ui/run-pass/macros/macro-literal.rs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(macro_literal_matcher)] - -macro_rules! mtester { - ($l:literal) => { - &format!("macro caught literal: {}", $l) - }; - ($e:expr) => { - &format!("macro caught expr: {}", $e) - }; -} - -macro_rules! two_negative_literals { - ($l1:literal $l2:literal) => { - &format!("macro caught literals: {}, {}", $l1, $l2) - }; -} - -macro_rules! only_expr { - ($e:expr) => { - &format!("macro caught expr: {}", $e) - }; -} - -macro_rules! mtester_dbg { - ($l:literal) => { - &format!("macro caught literal: {:?}", $l) - }; - ($e:expr) => { - &format!("macro caught expr: {:?}", $e) - }; -} - -macro_rules! catch_range { - ($s:literal ..= $e:literal) => { - &format!("macro caught literal: {} ..= {}", $s, $e) - }; - (($s:expr) ..= ($e:expr)) => { // Must use ')' before '..=' - &format!("macro caught expr: {} ..= {}", $s, $e) - }; -} - -macro_rules! pat_match { - ($s:literal ..= $e:literal) => { - match 3 { - $s ..= $e => "literal, in range", - _ => "literal, other", - } - }; - ($s:pat) => { - match 3 { - $s => "pat, single", - _ => "pat, other", - } - }; -} - -macro_rules! match_attr { - (#[$attr:meta] $e:literal) => { - "attr matched literal" - }; - (#[$attr:meta] $e:expr) => { - "attr matched expr" - }; -} - -macro_rules! match_produced_attr { - ($lit: literal) => { - // Struct with doc comment passed via $literal - #[doc = $lit] - struct LiteralProduced; - }; - ($expr: expr) => { - struct ExprProduced; - }; -} - -macro_rules! test_user { - ($s:literal, $e:literal) => { - { - let mut v = Vec::new(); - for i in $s .. $e { - v.push(i); - } - "literal" - } - }; - ($s:expr, $e: expr) => { - { - let mut v = Vec::new(); - for i in $s .. $e { - v.push(i); - } - "expr" - } - }; -} - -pub fn main() { - // Cases where 'literal' catches - assert_eq!(mtester!("str"), "macro caught literal: str"); - assert_eq!(mtester!(2), "macro caught literal: 2"); - assert_eq!(mtester!(2.2), "macro caught literal: 2.2"); - assert_eq!(mtester!(1u32), "macro caught literal: 1"); - assert_eq!(mtester!(0x32), "macro caught literal: 50"); - assert_eq!(mtester!('c'), "macro caught literal: c"); - assert_eq!(mtester!(-1.2), "macro caught literal: -1.2"); - assert_eq!(two_negative_literals!(-2 -3), "macro caught literals: -2, -3"); - assert_eq!(catch_range!(2 ..= 3), "macro caught literal: 2 ..= 3"); - assert_eq!(match_attr!(#[attr] 1), "attr matched literal"); - assert_eq!(test_user!(10, 20), "literal"); - assert_eq!(mtester!(false), "macro caught literal: false"); - assert_eq!(mtester!(true), "macro caught literal: true"); - match_produced_attr!("a"); - let _a = LiteralProduced; - assert_eq!(pat_match!(1 ..= 3), "literal, in range"); - assert_eq!(pat_match!(4 ..= 6), "literal, other"); - - // Cases where 'expr' catches - assert_eq!(mtester!((-1.2)), "macro caught expr: -1.2"); - assert_eq!(only_expr!(-1.2), "macro caught expr: -1.2"); - assert_eq!(mtester!((1 + 3)), "macro caught expr: 4"); - assert_eq!(mtester_dbg!(()), "macro caught expr: ()"); - assert_eq!(catch_range!((1 + 1) ..= (2 + 2)), "macro caught expr: 2 ..= 4"); - assert_eq!(match_attr!(#[attr] (1 + 2)), "attr matched expr"); - assert_eq!(test_user!(10, (20 + 2)), "expr"); - - match_produced_attr!((3 + 2)); - let _b = ExprProduced; - - // Cases where 'pat' matched - assert_eq!(pat_match!(3), "pat, single"); - assert_eq!(pat_match!(6), "pat, other"); -} diff --git a/src/test/ui/run-pass/macros/macro-meta-items.rs b/src/test/ui/run-pass/macros/macro-meta-items.rs deleted file mode 100644 index d19c33b2e3a..00000000000 --- a/src/test/ui/run-pass/macros/macro-meta-items.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg foo - -macro_rules! compiles_fine { - ($at:meta) => { - #[cfg($at)] - static MISTYPED: () = "foo"; - } -} -macro_rules! emit { - ($at:meta) => { - #[cfg($at)] - static MISTYPED: &'static str = "foo"; - } -} - -// item -compiles_fine!(bar); -emit!(foo); - -fn foo() { - println!("{}", MISTYPED); -} - -pub fn main() { - // statement - compiles_fine!(baz); - emit!(baz); - println!("{}", MISTYPED); -} diff --git a/src/test/ui/run-pass/macros/macro-method-issue-4621.rs b/src/test/ui/run-pass/macros/macro-method-issue-4621.rs deleted file mode 100644 index 17f6b84d108..00000000000 --- a/src/test/ui/run-pass/macros/macro-method-issue-4621.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct A; - -macro_rules! make_thirteen_method {() => (fn thirteen(&self)->isize {13})} -impl A { make_thirteen_method!(); } - -fn main() { - assert_eq!(A.thirteen(),13); -} diff --git a/src/test/ui/run-pass/macros/macro-multiple-items.rs b/src/test/ui/run-pass/macros/macro-multiple-items.rs deleted file mode 100644 index 6ebfead9761..00000000000 --- a/src/test/ui/run-pass/macros/macro-multiple-items.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! make_foo { - () => ( - struct Foo; - - impl Foo { - fn bar(&self) {} - } - ) -} - -make_foo!(); - -pub fn main() { - Foo.bar() -} diff --git a/src/test/ui/run-pass/macros/macro-named-default.rs b/src/test/ui/run-pass/macros/macro-named-default.rs deleted file mode 100644 index 1a7674ad4e6..00000000000 --- a/src/test/ui/run-pass/macros/macro-named-default.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! default { - ($($x:tt)*) => { $($x)* } -} - -default! { - struct A; -} - -impl A { - default! { - fn foo(&self) {} - } -} - -fn main() { - A.foo(); -} diff --git a/src/test/ui/run-pass/macros/macro-nested_definition_issue-31946.rs b/src/test/ui/run-pass/macros/macro-nested_definition_issue-31946.rs deleted file mode 100644 index 276aef879e0..00000000000 --- a/src/test/ui/run-pass/macros/macro-nested_definition_issue-31946.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - println!("{}", { - macro_rules! foo { - ($name:expr) => { concat!("hello ", $name) } - } - foo!("rust") - }); -} diff --git a/src/test/ui/run-pass/macros/macro-nested_expr.rs b/src/test/ui/run-pass/macros/macro-nested_expr.rs deleted file mode 100644 index 5af4649f58b..00000000000 --- a/src/test/ui/run-pass/macros/macro-nested_expr.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #42164 - -#![feature(decl_macro)] -#![allow(dead_code)] - -pub macro m($inner_str:expr) { - #[doc = $inner_str] - struct S; -} - -macro_rules! define_f { - ($name:expr) => { - #[export_name = $name] - fn f() {} - } -} - -fn main() { - define_f!(concat!("exported_", "f")); - m!(stringify!(foo)); -} - diff --git a/src/test/ui/run-pass/macros/macro-nested_stmt_macros.rs b/src/test/ui/run-pass/macros/macro-nested_stmt_macros.rs deleted file mode 100644 index 81400927d88..00000000000 --- a/src/test/ui/run-pass/macros/macro-nested_stmt_macros.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - () => { - struct Bar; - struct Baz; - } -} - -macro_rules! grault { - () => { - foo!(); - struct Xyzzy; - } -} - -fn static_assert_exists() { } - -fn main() { - grault!(); - static_assert_exists::(); - static_assert_exists::(); - static_assert_exists::(); -} diff --git a/src/test/ui/run-pass/macros/macro-nt-list.rs b/src/test/ui/run-pass/macros/macro-nt-list.rs deleted file mode 100644 index 55388ed278f..00000000000 --- a/src/test/ui/run-pass/macros/macro-nt-list.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -macro_rules! list { - ( ($($id:ident),*) ) => (()); - ( [$($id:ident),*] ) => (()); - ( {$($id:ident),*} ) => (()); -} - -macro_rules! tt_list { - ( ($($tt:tt),*) ) => (()); -} - -pub fn main() { - list!( () ); - list!( [] ); - list!( {} ); - - tt_list!( (a, b, c) ); - tt_list!( () ); -} diff --git a/src/test/ui/run-pass/macros/macro-of-higher-order.rs b/src/test/ui/run-pass/macros/macro-of-higher-order.rs deleted file mode 100644 index 9a535881197..00000000000 --- a/src/test/ui/run-pass/macros/macro-of-higher-order.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! higher_order { - (subst $lhs:tt => $rhs:tt) => ({ - macro_rules! anon { $lhs => $rhs } - anon!(1_usize, 2_usize, "foo") - }); -} - -macro_rules! outer { - ($x:expr; $fragment:ident) => { - macro_rules! inner { ($y:$fragment) => { $x + $y } } - } -} - -fn main() { - let val = higher_order!(subst ($x:expr, $y:expr, $foo:expr) => (($x + $y, $foo))); - assert_eq!(val, (3, "foo")); - - outer!(2; expr); - assert_eq!(inner!(3), 5); -} diff --git a/src/test/ui/run-pass/macros/macro-pat-follow.rs b/src/test/ui/run-pass/macros/macro-pat-follow.rs deleted file mode 100644 index 12cbfa84505..00000000000 --- a/src/test/ui/run-pass/macros/macro-pat-follow.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! pat_in { - ($p:pat in $e:expr) => {{ - let mut iter = $e.into_iter(); - while let $p = iter.next() {} - }} -} - -macro_rules! pat_if { - ($p:pat if $e:expr) => {{ - match Some(1u8) { - $p if $e => {}, - _ => {} - } - }} -} - -macro_rules! pat_bar { - ($p:pat | $p2:pat) => {{ - match Some(1u8) { - $p | $p2 => {}, - _ => {} - } - }} -} - -fn main() { - pat_in!(Some(_) in 0..10); - pat_if!(Some(x) if x > 0); - pat_bar!(Some(1u8) | None); -} diff --git a/src/test/ui/run-pass/macros/macro-pat-neg-lit.rs b/src/test/ui/run-pass/macros/macro-pat-neg-lit.rs deleted file mode 100644 index ddde5d32e39..00000000000 --- a/src/test/ui/run-pass/macros/macro-pat-neg-lit.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! enum_number { - ($name:ident { $($variant:ident = $value:expr, )* }) => { - enum $name { - $($variant = $value,)* - } - - fn foo(value: i32) -> Option<$name> { - match value { - $( $value => Some($name::$variant), )* - _ => None - } - } - } -} - -enum_number!(Change { - Down = -1, - None = 0, - Up = 1, -}); - -fn main() { - if let Some(Change::Down) = foo(-1) {} else { panic!() } -} - diff --git a/src/test/ui/run-pass/macros/macro-pat.rs b/src/test/ui/run-pass/macros/macro-pat.rs deleted file mode 100644 index 1ed0663fc5a..00000000000 --- a/src/test/ui/run-pass/macros/macro-pat.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! mypat { - () => ( - Some('y') - ) -} - -macro_rules! char_x { - () => ( - 'x' - ) -} - -macro_rules! some { - ($x:pat) => ( - Some($x) - ) -} - -macro_rules! indirect { - () => ( - some!(char_x!()) - ) -} - -macro_rules! ident_pat { - ($x:ident) => ( - $x - ) -} - -fn f(c: Option) -> usize { - match c { - Some('x') => 1, - mypat!() => 2, - _ => 3, - } -} - -pub fn main() { - assert_eq!(1, f(Some('x'))); - assert_eq!(2, f(Some('y'))); - assert_eq!(3, f(None)); - - assert_eq!(1, match Some('x') { - Some(char_x!()) => 1, - _ => 2, - }); - - assert_eq!(1, match Some('x') { - some!(char_x!()) => 1, - _ => 2, - }); - - assert_eq!(1, match Some('x') { - indirect!() => 1, - _ => 2, - }); - - assert_eq!(3, { - let ident_pat!(x) = 2; - x+1 - }); -} diff --git a/src/test/ui/run-pass/macros/macro-path.rs b/src/test/ui/run-pass/macros/macro-path.rs deleted file mode 100644 index fc874f0d0ca..00000000000 --- a/src/test/ui/run-pass/macros/macro-path.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -mod m { - pub type t = isize; -} - -macro_rules! foo { - ($p:path) => ({ - fn f() -> $p { 10 }; - f() - }) -} - -pub fn main() { - assert_eq!(foo!(m::t), 10); -} diff --git a/src/test/ui/run-pass/macros/macro-pub-matcher.rs b/src/test/ui/run-pass/macros/macro-pub-matcher.rs deleted file mode 100644 index 7d8bb430232..00000000000 --- a/src/test/ui/run-pass/macros/macro-pub-matcher.rs +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code, unused_imports)] -#![cfg_attr(stage0, feature(macro_vis_matcher))] -#![feature(crate_visibility_modifier)] - -/** -Ensure that `:vis` matches can be captured in existing positions, and passed -through without the need for reparse tricks. -*/ -macro_rules! vis_passthru { - ($vis:vis const $name:ident: $ty:ty = $e:expr;) => { $vis const $name: $ty = $e; }; - ($vis:vis enum $name:ident {}) => { $vis struct $name {} }; - ($vis:vis extern "C" fn $name:ident() {}) => { $vis extern "C" fn $name() {} }; - ($vis:vis fn $name:ident() {}) => { $vis fn $name() {} }; - ($vis:vis mod $name:ident {}) => { $vis mod $name {} }; - ($vis:vis static $name:ident: $ty:ty = $e:expr;) => { $vis static $name: $ty = $e; }; - ($vis:vis struct $name:ident;) => { $vis struct $name; }; - ($vis:vis trait $name:ident {}) => { $vis trait $name {} }; - ($vis:vis type $name:ident = $ty:ty;) => { $vis type $name = $ty; }; - ($vis:vis use $path:ident as $name:ident;) => { $vis use self::$path as $name; }; -} - -mod with_pub { - vis_passthru! { pub const A: i32 = 0; } - vis_passthru! { pub enum B {} } - vis_passthru! { pub extern "C" fn c() {} } - vis_passthru! { pub mod d {} } - vis_passthru! { pub static E: i32 = 0; } - vis_passthru! { pub struct F; } - vis_passthru! { pub trait G {} } - vis_passthru! { pub type H = i32; } - vis_passthru! { pub use A as I; } -} - -mod without_pub { - vis_passthru! { const A: i32 = 0; } - vis_passthru! { enum B {} } - vis_passthru! { extern "C" fn c() {} } - vis_passthru! { mod d {} } - vis_passthru! { static E: i32 = 0; } - vis_passthru! { struct F; } - vis_passthru! { trait G {} } - vis_passthru! { type H = i32; } - vis_passthru! { use A as I; } -} - -mod with_pub_restricted { - vis_passthru! { pub(crate) const A: i32 = 0; } - vis_passthru! { pub(crate) enum B {} } - vis_passthru! { pub(crate) extern "C" fn c() {} } - vis_passthru! { pub(crate) mod d {} } - vis_passthru! { pub(crate) static E: i32 = 0; } - vis_passthru! { pub(crate) struct F; } - vis_passthru! { pub(crate) trait G {} } - vis_passthru! { pub(crate) type H = i32; } - vis_passthru! { pub(crate) use A as I; } -} - -mod with_crate { - vis_passthru! { crate const A: i32 = 0; } - vis_passthru! { crate enum B {} } - vis_passthru! { crate extern "C" fn c() {} } - vis_passthru! { crate mod d {} } - vis_passthru! { crate static E: i32 = 0; } - vis_passthru! { crate struct F; } - vis_passthru! { crate trait G {} } - vis_passthru! { crate type H = i32; } - vis_passthru! { crate use A as I; } -} - -mod garden { - mod with_pub_restricted_path { - vis_passthru! { pub(in garden) const A: i32 = 0; } - vis_passthru! { pub(in garden) enum B {} } - vis_passthru! { pub(in garden) extern "C" fn c() {} } - vis_passthru! { pub(in garden) mod d {} } - vis_passthru! { pub(in garden) static E: i32 = 0; } - vis_passthru! { pub(in garden) struct F; } - vis_passthru! { pub(in garden) trait G {} } - vis_passthru! { pub(in garden) type H = i32; } - vis_passthru! { pub(in garden) use A as I; } - } -} - -/* -Ensure that the `:vis` matcher works in a more complex situation: parsing a -struct definition. -*/ -macro_rules! vis_parse_struct { - ($(#[$($attrs:tt)*])* $vis:vis struct $name:ident {$($body:tt)*}) => { - vis_parse_struct! { @parse_fields $(#[$($attrs)*])*, $vis, $name, $($body)* } - }; - - ($(#[$($attrs:tt)*])* $vis:vis struct $name:ident ($($body:tt)*);) => { - vis_parse_struct! { @parse_tuple $(#[$($attrs)*])*, $vis, $name, $($body)* } - }; - - (@parse_fields - $(#[$attrs:meta])*, $vis:vis, $name:ident, $($fvis:vis $fname:ident: $fty:ty),* $(,)*) => { - $(#[$attrs])* $vis struct $name { $($fvis $fname: $fty,)* } - }; - - (@parse_tuple - $(#[$attrs:meta])*, $vis:vis, $name:ident, $($fvis:vis $fty:ty),* $(,)*) => { - $(#[$attrs])* $vis struct $name ( $($fvis $fty,)* ); - }; -} - -mod test_struct { - vis_parse_struct! { pub(crate) struct A { pub a: i32, b: i32, pub(crate) c: i32 } } - vis_parse_struct! { pub struct B { a: i32, pub(crate) b: i32, pub c: i32 } } - vis_parse_struct! { struct C { pub(crate) a: i32, pub b: i32, c: i32 } } - - vis_parse_struct! { pub(crate) struct D (pub i32, i32, pub(crate) i32); } - vis_parse_struct! { pub struct E (i32, pub(crate) i32, pub i32); } - vis_parse_struct! { struct F (pub(crate) i32, pub i32, i32); } -} - -fn main() {} diff --git a/src/test/ui/run-pass/macros/macro-seq-followed-by-seq.rs b/src/test/ui/run-pass/macros/macro-seq-followed-by-seq.rs deleted file mode 100644 index 594717ffcdb..00000000000 --- a/src/test/ui/run-pass/macros/macro-seq-followed-by-seq.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test of allowing two sequences repetitions in a row, -// functionality added as byproduct of RFC amendment #1384 -// https://github.com/rust-lang/rfcs/pull/1384 - -// Old version of Rust would reject this macro definition, even though -// there are no local ambiguities (the initial `banana` and `orange` -// tokens are enough for the expander to distinguish which case is -// intended). -macro_rules! foo { - ( $(banana $a:ident)* $(orange $b:tt)* ) => { }; -} - -fn main() { - foo!( banana id1 banana id2 - orange hi orange (hello world) ); -} diff --git a/src/test/ui/run-pass/macros/macro-stability.rs b/src/test/ui/run-pass/macros/macro-stability.rs deleted file mode 100644 index a5c0cbbcde4..00000000000 --- a/src/test/ui/run-pass/macros/macro-stability.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:unstable-macros.rs - -#![feature(unstable_macros)] - -#[macro_use] extern crate unstable_macros; - -#[unstable(feature = "local_unstable", issue = "0")] -macro_rules! local_unstable { () => () } - -fn main() { - unstable_macro!(); - local_unstable!(); -} diff --git a/src/test/ui/run-pass/macros/macro-stmt.rs b/src/test/ui/run-pass/macros/macro-stmt.rs deleted file mode 100644 index 98b0dcb8336..00000000000 --- a/src/test/ui/run-pass/macros/macro-stmt.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! myfn { - ( $f:ident, ( $( $x:ident ),* ), $body:block ) => ( - fn $f( $( $x : isize),* ) -> isize $body - ) -} - -myfn!(add, (a,b), { return a+b; } ); - -pub fn main() { - - macro_rules! mylet { - ($x:ident, $val:expr) => ( - let $x = $val; - ) - } - - mylet!(y, 8*2); - assert_eq!(y, 16); - - myfn!(mult, (a,b), { a*b } ); - - assert_eq!(mult(2, add(4,4)), 16); - - macro_rules! actually_an_expr_macro { - () => ( 16 ) - } - - assert_eq!({ actually_an_expr_macro!() }, 16); - -} diff --git a/src/test/ui/run-pass/macros/macro-stmt_macro_in_expr_macro.rs b/src/test/ui/run-pass/macros/macro-stmt_macro_in_expr_macro.rs deleted file mode 100644 index 22e983dd9ce..00000000000 --- a/src/test/ui/run-pass/macros/macro-stmt_macro_in_expr_macro.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - () => { - struct Bar; - struct Baz; - } -} - -macro_rules! grault { - () => {{ - foo!(); - struct Xyzzy; - 0 - }} -} - -fn main() { - let x = grault!(); - assert_eq!(x, 0); -} diff --git a/src/test/ui/run-pass/macros/macro-tt-followed-by-seq.rs b/src/test/ui/run-pass/macros/macro-tt-followed-by-seq.rs deleted file mode 100644 index 204fdcf7049..00000000000 --- a/src/test/ui/run-pass/macros/macro-tt-followed-by-seq.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #25436: permit token-trees to be followed -// by sequences, enabling more general parsing. - -use self::Join::*; - -#[derive(Debug)] -enum Join { - Keep(A,B), - Skip(A,B), -} - -macro_rules! parse_list { - ( < $a:expr; > $($b:tt)* ) => { Keep(parse_item!($a),parse_list!($($b)*)) }; - ( $a:tt $($b:tt)* ) => { Skip(parse_item!($a), parse_list!($($b)*)) }; - ( ) => { () }; -} - -macro_rules! parse_item { - ( $x:expr ) => { $x } -} - -fn main() { - let list = parse_list!(<1;> 2 <3;> 4); - assert_eq!("Keep(1, Skip(2, Keep(3, Skip(4, ()))))", - format!("{:?}", list)); -} diff --git a/src/test/ui/run-pass/macros/macro-use-all-and-none.rs b/src/test/ui/run-pass/macros/macro-use-all-and-none.rs deleted file mode 100644 index 6e035ff7f39..00000000000 --- a/src/test/ui/run-pass/macros/macro-use-all-and-none.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:two_macros.rs - -#[macro_use] -#[macro_use()] -extern crate two_macros; - -pub fn main() { - macro_one!(); - macro_two!(); -} diff --git a/src/test/ui/run-pass/macros/macro-use-all.rs b/src/test/ui/run-pass/macros/macro-use-all.rs deleted file mode 100644 index 8bbec89ace2..00000000000 --- a/src/test/ui/run-pass/macros/macro-use-all.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:two_macros.rs - -#[macro_use] -extern crate two_macros; - -pub fn main() { - macro_one!(); - macro_two!(); -} diff --git a/src/test/ui/run-pass/macros/macro-use-both.rs b/src/test/ui/run-pass/macros/macro-use-both.rs deleted file mode 100644 index 5e5b4b778a2..00000000000 --- a/src/test/ui/run-pass/macros/macro-use-both.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:two_macros.rs - -#[macro_use(macro_one, macro_two)] -extern crate two_macros; - -pub fn main() { - macro_one!(); - macro_two!(); -} diff --git a/src/test/ui/run-pass/macros/macro-use-one.rs b/src/test/ui/run-pass/macros/macro-use-one.rs deleted file mode 100644 index bdd9cc25b63..00000000000 --- a/src/test/ui/run-pass/macros/macro-use-one.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:two_macros.rs - -#[macro_use(macro_two)] -extern crate two_macros; - -pub fn main() { - macro_two!(); -} diff --git a/src/test/ui/run-pass/macros/macro-with-attrs1.rs b/src/test/ui/run-pass/macros/macro-with-attrs1.rs deleted file mode 100644 index 4b2413d2deb..00000000000 --- a/src/test/ui/run-pass/macros/macro-with-attrs1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg foo - - -#[cfg(foo)] -macro_rules! foo { () => (1) } - -#[cfg(not(foo))] -macro_rules! foo { () => (2) } - -pub fn main() { - assert_eq!(foo!(), 1); -} diff --git a/src/test/ui/run-pass/macros/macro-with-attrs2.rs b/src/test/ui/run-pass/macros/macro-with-attrs2.rs deleted file mode 100644 index 37fc4ba6f2b..00000000000 --- a/src/test/ui/run-pass/macros/macro-with-attrs2.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[cfg(foo)] -macro_rules! foo { () => (1) } - -#[cfg(not(foo))] -macro_rules! foo { () => (2) } - -pub fn main() { - assert_eq!(foo!(), 2); -} diff --git a/src/test/ui/run-pass/macros/macro-with-braces-in-expr-position.rs b/src/test/ui/run-pass/macros/macro-with-braces-in-expr-position.rs deleted file mode 100644 index 830ec620fca..00000000000 --- a/src/test/ui/run-pass/macros/macro-with-braces-in-expr-position.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -macro_rules! expr { ($e: expr) => { $e } } - -macro_rules! spawn { - ($($code: tt)*) => { - expr!(thread::spawn(move|| {$($code)*}).join()) - } -} - -pub fn main() { - spawn! { - println!("stmt"); - }; - let _ = spawn! { - println!("expr"); - }; -} diff --git a/src/test/ui/run-pass/macros/macro_with_super_2.rs b/src/test/ui/run-pass/macros/macro_with_super_2.rs deleted file mode 100644 index 2c984f86f0b..00000000000 --- a/src/test/ui/run-pass/macros/macro_with_super_2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:macro_with_super_1.rs - -// pretty-expanded FIXME #23616 - -#[macro_use] -extern crate macro_with_super_1; - -declare!(); - -fn main() { - bbb::ccc(); -} diff --git a/src/test/ui/run-pass/macros/macros-in-extern.rs b/src/test/ui/run-pass/macros/macros-in-extern.rs deleted file mode 100644 index 2d3d2a9589c..00000000000 --- a/src/test/ui/run-pass/macros/macros-in-extern.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32 - -#![feature(decl_macro, macros_in_extern)] - -macro_rules! returns_isize( - ($ident:ident) => ( - fn $ident() -> isize; - ) -); - -macro takes_u32_returns_u32($ident:ident) { - fn $ident (arg: u32) -> u32; -} - -macro_rules! emits_nothing( - () => () -); - -fn main() { - assert_eq!(unsafe { rust_get_test_int() }, 1isize); - assert_eq!(unsafe { rust_dbg_extern_identity_u32(0xDEADBEEF) }, 0xDEADBEEFu32); -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - returns_isize!(rust_get_test_int); - takes_u32_returns_u32!(rust_dbg_extern_identity_u32); - emits_nothing!(); -} diff --git a/src/test/ui/run-pass/macros/parse-complex-macro-invoc-op.rs b/src/test/ui/run-pass/macros/parse-complex-macro-invoc-op.rs deleted file mode 100644 index f0431b92570..00000000000 --- a/src/test/ui/run-pass/macros/parse-complex-macro-invoc-op.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// Test parsing binary operators after macro invocations. - -// pretty-expanded FIXME #23616 - -#![feature(macro_rules)] - -macro_rules! id { - ($e: expr) => { $e } -} - -fn foo() { - id!(1) + 1; - id![1] - 1; - id!(1) * 1; - id![1] / 1; - id!(1) % 1; - - id!(1) & 1; - id![1] | 1; - id!(1) ^ 1; - - let mut x = 1; - id![x] = 2; - id!(x) += 1; - - id!(1f64).clone(); - - id!([1, 2, 3])[1]; - id![drop](1); - - id!(true) && true; - id![true] || true; -} - -fn main() {} diff --git a/src/test/ui/run-pass/macros/paths-in-macro-invocations.rs b/src/test/ui/run-pass/macros/paths-in-macro-invocations.rs deleted file mode 100644 index 358c97d468b..00000000000 --- a/src/test/ui/run-pass/macros/paths-in-macro-invocations.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:two_macros.rs - -extern crate two_macros; - -::two_macros::macro_one!(); -two_macros::macro_one!(); - -mod foo { pub use two_macros::macro_one as bar; } - -trait T { - foo::bar!(); - ::foo::bar!(); -} - -struct S { - x: foo::bar!(i32), - y: ::foo::bar!(i32), -} - -impl S { - foo::bar!(); - ::foo::bar!(); -} - -fn main() { - foo::bar!(); - ::foo::bar!(); - - let _ = foo::bar!(0); - let _ = ::foo::bar!(0); - - let foo::bar!(_) = 0; - let ::foo::bar!(_) = 0; -} diff --git a/src/test/ui/run-pass/macros/pub-item-inside-macro.rs b/src/test/ui/run-pass/macros/pub-item-inside-macro.rs deleted file mode 100644 index f17d0ac47b6..00000000000 --- a/src/test/ui/run-pass/macros/pub-item-inside-macro.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #14660 - -// pretty-expanded FIXME #23616 - -mod bleh { - macro_rules! foo { - () => { - pub fn bar() { } - } - } - - foo!(); -} - -fn main() { - bleh::bar(); -} diff --git a/src/test/ui/run-pass/macros/pub-method-inside-macro.rs b/src/test/ui/run-pass/macros/pub-method-inside-macro.rs deleted file mode 100644 index 3bd48c11def..00000000000 --- a/src/test/ui/run-pass/macros/pub-method-inside-macro.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #17436 - -// pretty-expanded FIXME #23616 - -mod bleh { - macro_rules! foo { - () => { - pub fn bar(&self) { } - } - } - - pub struct S; - - impl S { - foo!(); - } -} - -fn main() { - bleh::S.bar(); -} diff --git a/src/test/ui/run-pass/macros/semi-after-macro-ty.rs b/src/test/ui/run-pass/macros/semi-after-macro-ty.rs deleted file mode 100644 index 1eaa8c49222..00000000000 --- a/src/test/ui/run-pass/macros/semi-after-macro-ty.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! foo { - ($t:ty; $p:path;) => {} -} - -fn main() { - foo!(i32; i32;); -} diff --git a/src/test/ui/run-pass/macros/stmt_expr_attr_macro_parse.rs b/src/test/ui/run-pass/macros/stmt_expr_attr_macro_parse.rs deleted file mode 100644 index faf02af5387..00000000000 --- a/src/test/ui/run-pass/macros/stmt_expr_attr_macro_parse.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! m { - ($e:expr) => { - "expr includes attr" - }; - (#[$attr:meta] $e:expr) => { - "expr excludes attr" - } -} - -macro_rules! n { - (#[$attr:meta] $e:expr) => { - "expr excludes attr" - }; - ($e:expr) => { - "expr includes attr" - } -} - -fn main() { - assert_eq!(m!(#[attr] 1), "expr includes attr"); - assert_eq!(n!(#[attr] 1), "expr excludes attr"); -} diff --git a/src/test/ui/run-pass/macros/syntax-extension-cfg.rs b/src/test/ui/run-pass/macros/syntax-extension-cfg.rs deleted file mode 100644 index f3b2f1df219..00000000000 --- a/src/test/ui/run-pass/macros/syntax-extension-cfg.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: --cfg foo --cfg qux="foo" - - -pub fn main() { - // check - if ! cfg!(foo) { panic!() } - if cfg!(not(foo)) { panic!() } - - if ! cfg!(qux="foo") { panic!() } - if cfg!(not(qux="foo")) { panic!() } - - if ! cfg!(all(foo, qux="foo")) { panic!() } - if cfg!(not(all(foo, qux="foo"))) { panic!() } - if cfg!(all(not(all(foo, qux="foo")))) { panic!() } - - if cfg!(not_a_cfg) { panic!() } - if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() } - if cfg!(all(not_a_cfg, foo, qux="foo")) { panic!() } - if ! cfg!(any(not_a_cfg, foo)) { panic!() } - - if ! cfg!(not(not_a_cfg)) { panic!() } - if ! cfg!(all(not(not_a_cfg), foo, qux="foo")) { panic!() } -} diff --git a/src/test/ui/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment b/src/test/ui/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment deleted file mode 100644 index d752015a4dc..00000000000 --- a/src/test/ui/run-pass/macros/syntax-extension-source-utils-files/includeme.fragment +++ /dev/null @@ -1,7 +0,0 @@ -/* this is for run-pass/syntax-extension-source-utils.rs */ - -{ - assert!(file!().ends_with("includeme.fragment")); - assert_eq!(line!(), 5u32); - format!("victory robot {}", line!()) -} diff --git a/src/test/ui/run-pass/macros/syntax-extension-source-utils.rs b/src/test/ui/run-pass/macros/syntax-extension-source-utils.rs deleted file mode 100644 index ffa4adb0136..00000000000 --- a/src/test/ui/run-pass/macros/syntax-extension-source-utils.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012-2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// ignore-pretty issue #37195 - -pub mod m1 { - pub mod m2 { - pub fn where_am_i() -> String { - (module_path!()).to_string() - } - } -} - -macro_rules! indirect_line { () => ( line!() ) } - -pub fn main() { - assert_eq!(line!(), 27); - assert_eq!(column!(), 16); - assert_eq!(indirect_line!(), 29); - assert!((file!().ends_with("syntax-extension-source-utils.rs"))); - assert_eq!(stringify!((2*3) + 5).to_string(), "( 2 * 3 ) + 5".to_string()); - assert!(include!("syntax-extension-source-utils-files/includeme.\ - fragment").to_string() - == "victory robot 6".to_string()); - - assert!( - include_str!("syntax-extension-source-utils-files/includeme.\ - fragment").to_string() - .starts_with("/* this is for ")); - assert!( - include_bytes!("syntax-extension-source-utils-files/includeme.fragment") - [1] == (42 as u8)); // '*' - // The Windows tests are wrapped in an extra module for some reason - assert!((m1::m2::where_am_i().ends_with("m1::m2"))); - - assert_eq!((46, "( 2 * 3 ) + 5"), (line!(), stringify!((2*3) + 5))); -} diff --git a/src/test/ui/run-pass/macros/try-macro.rs b/src/test/ui/run-pass/macros/try-macro.rs deleted file mode 100644 index 4a8f55ac83c..00000000000 --- a/src/test/ui/run-pass/macros/try-macro.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::num::{ParseFloatError, ParseIntError}; - -fn main() { - assert_eq!(simple(), Ok(1)); - assert_eq!(nested(), Ok(2)); - assert_eq!(merge_ok(), Ok(3.0)); - assert_eq!(merge_int_err(), Err(Error::Int)); - assert_eq!(merge_float_err(), Err(Error::Float)); -} - -fn simple() -> Result { - Ok(try!("1".parse())) -} - -fn nested() -> Result { - Ok(try!(try!("2".parse::()).to_string().parse::())) -} - -fn merge_ok() -> Result { - Ok(try!("1".parse::()) as f32 + try!("2.0".parse::())) -} - -fn merge_int_err() -> Result { - Ok(try!("a".parse::()) as f32 + try!("2.0".parse::())) -} - -fn merge_float_err() -> Result { - Ok(try!("1".parse::()) as f32 + try!("b".parse::())) -} - -#[derive(Debug, PartialEq)] -enum Error { - Int, - Float, -} - -impl From for Error { - fn from(_: ParseIntError) -> Error { - Error::Int - } -} - -impl From for Error { - fn from(_: ParseFloatError) -> Error { - Error::Float - } -} diff --git a/src/test/ui/run-pass/macros/two-macro-use.rs b/src/test/ui/run-pass/macros/two-macro-use.rs deleted file mode 100644 index 28c18d71991..00000000000 --- a/src/test/ui/run-pass/macros/two-macro-use.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:two_macros.rs - -#[macro_use(macro_one)] -#[macro_use(macro_two)] -extern crate two_macros; - -pub fn main() { - macro_one!(); - macro_two!(); -} diff --git a/src/test/ui/run-pass/macros/type-macros-hlist.rs b/src/test/ui/run-pass/macros/type-macros-hlist.rs deleted file mode 100644 index 41d4cef07f2..00000000000 --- a/src/test/ui/run-pass/macros/type-macros-hlist.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::*; - -#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] -struct Nil; - // empty HList -#[derive(Copy, Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] -struct Cons(H, T); - // cons cell of HList - - // trait to classify valid HLists -trait HList { } -impl HList for Nil { } -impl HList for Cons { } - -// term-level macro for HLists -macro_rules! hlist({ } => { Nil } ; { $ head : expr } => { - Cons ( $ head , Nil ) } ; { - $ head : expr , $ ( $ tail : expr ) , * } => { - Cons ( $ head , hlist ! ( $ ( $ tail ) , * ) ) } ;); - -// type-level macro for HLists -macro_rules! HList({ } => { Nil } ; { $ head : ty } => { - Cons < $ head , Nil > } ; { - $ head : ty , $ ( $ tail : ty ) , * } => { - Cons < $ head , HList ! ( $ ( $ tail ) , * ) > } ;); - -// nil case for HList append -impl Add for Nil { - type - Output - = - Ys; - - fn add(self, rhs: Ys) -> Ys { rhs } -} - -// cons case for HList append -impl Add for Cons - where Xs: Add { - type - Output - = - Cons; - - fn add(self, rhs: Ys) -> Cons { Cons(self.0, self.1 + rhs) } -} - -// type macro Expr allows us to expand the + operator appropriately -macro_rules! Expr({ ( $ ( $ LHS : tt ) + ) } => { Expr ! ( $ ( $ LHS ) + ) } ; - { HList ! [ $ ( $ LHS : tt ) * ] + $ ( $ RHS : tt ) + } => { - < Expr ! ( HList ! [ $ ( $ LHS ) * ] ) as Add < Expr ! ( - $ ( $ RHS ) + ) >> :: Output } ; { - $ LHS : tt + $ ( $ RHS : tt ) + } => { - < Expr ! ( $ LHS ) as Add < Expr ! ( $ ( $ RHS ) + ) >> :: - Output } ; { $ LHS : ty } => { $ LHS } ;); - -// test demonstrating term level `xs + ys` and type level `Expr!(Xs + Ys)` -fn main() { - fn aux(xs: Xs, ys: Ys) -> Expr!(Xs + Ys) where - Xs: Add { - xs + ys - } - - let xs: HList!(& str , bool , Vec < u64 >) = - hlist!("foo" , false , vec ! [ ]); - let ys: HList!(u64 , [ u8 ; 3 ] , ( )) = - hlist!(0 , [ 0 , 1 , 2 ] , ( )); - - // demonstrate recursive expansion of Expr! - let zs: - Expr!(( - HList ! [ & str ] + HList ! [ bool ] + HList ! [ Vec < u64 > - ] ) + ( HList ! [ u64 ] + HList ! [ [ u8 ; 3 ] , ( ) ] ) + - HList ! [ ]) = aux(xs, ys); - assert_eq!(zs , hlist ! [ - "foo" , false , vec ! [ ] , 0 , [ 0 , 1 , 2 ] , ( ) ]) -} diff --git a/src/test/ui/run-pass/macros/type-macros-simple.rs b/src/test/ui/run-pass/macros/type-macros-simple.rs deleted file mode 100644 index 8f091ec192b..00000000000 --- a/src/test/ui/run-pass/macros/type-macros-simple.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -macro_rules! Tuple { - { $A:ty,$B:ty } => { ($A, $B) } -} - -fn main() { - let x: Tuple!(i32, i32) = (1, 2); -} - -fn issue_36540() { - let i32 = 0; - macro_rules! m { () => { i32 } } - struct S(m!(), T) where T: Trait; - - let x: m!() = m!(); - std::cell::Cell::::new(m!()); - impl std::ops::Index for Trait<(m!(), T)> - where T: Trait - { - type Output = m!(); - fn index(&self, i: m!()) -> &m!() { - unimplemented!() - } - } -} - -trait Trait {} -impl Trait for i32 {} diff --git a/src/test/ui/run-pass/macros/typeck-macro-interaction-issue-8852.rs b/src/test/ui/run-pass/macros/typeck-macro-interaction-issue-8852.rs deleted file mode 100644 index 31bf37ec0a9..00000000000 --- a/src/test/ui/run-pass/macros/typeck-macro-interaction-issue-8852.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum T { - A(isize), - B(f64) -} - -// after fixing #9384 and implementing hygiene for match bindings, -// this now fails because the insertion of the 'y' into the match -// doesn't cause capture. Making this macro hygienic (as I've done) -// could very well make this test case completely pointless.... - -macro_rules! test { - ($id1:ident, $id2:ident, $e:expr) => ( - fn foo(a:T, b:T) -> T { - match (a, b) { - (T::A($id1), T::A($id2)) => T::A($e), - (T::B($id1), T::B($id2)) => T::B($e), - _ => panic!() - } - } - ) -} - -test!(x,y,x + y); - -pub fn main() { - foo(T::A(1), T::A(2)); -} diff --git a/src/test/ui/run-pass/macros/use-macro-self.rs b/src/test/ui/run-pass/macros/use-macro-self.rs deleted file mode 100644 index fb816f9e78f..00000000000 --- a/src/test/ui/run-pass/macros/use-macro-self.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:use-macro-self.rs - -#[macro_use] -extern crate use_macro_self; - -use use_macro_self::foobarius::{self}; - -fn main() { - let _: () = foobarius!(); // OK, the macro returns `()` -} diff --git a/src/test/ui/run-pass/methods/auxiliary/method_self_arg1.rs b/src/test/ui/run-pass/methods/auxiliary/method_self_arg1.rs deleted file mode 100644 index 785a8b05664..00000000000 --- a/src/test/ui/run-pass/methods/auxiliary/method_self_arg1.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -#![feature(box_syntax)] - -static mut COUNT: u64 = 1; - -pub fn get_count() -> u64 { unsafe { COUNT } } - -#[derive(Copy, Clone)] -pub struct Foo; - -impl Foo { - pub fn foo(self, x: &Foo) { - unsafe { COUNT *= 2; } - // Test internal call. - Foo::bar(&self); - Foo::bar(x); - - Foo::baz(self); - Foo::baz(*x); - - Foo::qux(box self); - Foo::qux(box *x); - } - - pub fn bar(&self) { - unsafe { COUNT *= 3; } - } - - pub fn baz(self) { - unsafe { COUNT *= 5; } - } - - pub fn qux(self: Box) { - unsafe { COUNT *= 7; } - } -} diff --git a/src/test/ui/run-pass/methods/auxiliary/method_self_arg2.rs b/src/test/ui/run-pass/methods/auxiliary/method_self_arg2.rs deleted file mode 100644 index 3761d58087e..00000000000 --- a/src/test/ui/run-pass/methods/auxiliary/method_self_arg2.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type = "lib"] - -#![feature(box_syntax)] - -static mut COUNT: u64 = 1; - -pub fn get_count() -> u64 { unsafe { COUNT } } - -#[derive(Copy, Clone)] -pub struct Foo; - -impl Foo { - pub fn run_trait(self) { - unsafe { COUNT *= 17; } - // Test internal call. - Bar::foo1(&self); - Bar::foo2(self); - Bar::foo3(box self); - - Bar::bar1(&self); - Bar::bar2(self); - Bar::bar3(box self); - } -} - -pub trait Bar : Sized { - fn foo1(&self); - fn foo2(self); - fn foo3(self: Box); - - fn bar1(&self) { - unsafe { COUNT *= 7; } - } - fn bar2(self) { - unsafe { COUNT *= 11; } - } - fn bar3(self: Box) { - unsafe { COUNT *= 13; } - } -} - -impl Bar for Foo { - fn foo1(&self) { - unsafe { COUNT *= 2; } - } - - fn foo2(self) { - unsafe { COUNT *= 3; } - } - - fn foo3(self: Box) { - unsafe { COUNT *= 5; } - } -} diff --git a/src/test/ui/run-pass/methods/method-argument-inference-associated-type.rs b/src/test/ui/run-pass/methods/method-argument-inference-associated-type.rs deleted file mode 100644 index 0db38516cb9..00000000000 --- a/src/test/ui/run-pass/methods/method-argument-inference-associated-type.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct ClientMap; -pub struct ClientMap2; - -pub trait Service { - type Request; - fn call(&self, _req: Self::Request); -} - -pub struct S(T); - -impl Service for ClientMap { - type Request = S>; - fn call(&self, _req: Self::Request) {} -} - - -impl Service for ClientMap2 { - type Request = (Box,); - fn call(&self, _req: Self::Request) {} -} - - -fn main() { - ClientMap.call(S { 0: Box::new(|_msgid| ()) }); - ClientMap.call(S(Box::new(|_msgid| ()))); - ClientMap2.call((Box::new(|_msgid| ()),)); -} diff --git a/src/test/ui/run-pass/methods/method-attributes.rs b/src/test/ui/run-pass/methods/method-attributes.rs deleted file mode 100644 index b1afbd8d11c..00000000000 --- a/src/test/ui/run-pass/methods/method-attributes.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pp-exact - Make sure we print all the attributes -// pretty-expanded FIXME #23616 - -#![feature(custom_attribute)] - -#[frobable] -trait frobable { - #[frob_attr] - fn frob(&self); - #[defrob_attr] - fn defrob(&self); -} - -#[int_frobable] -impl frobable for isize { - #[frob_attr1] - fn frob(&self) { - #![frob_attr2] - } - - #[defrob_attr1] - fn defrob(&self) { - #![defrob_attr2] - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/methods/method-early-bound-lifetimes-on-self.rs b/src/test/ui/run-pass/methods/method-early-bound-lifetimes-on-self.rs deleted file mode 100644 index f98a35bb9e3..00000000000 --- a/src/test/ui/run-pass/methods/method-early-bound-lifetimes-on-self.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that we successfully handle methods where the `self` type has -// an early-bound lifetime. Issue #18208. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -use std::marker; - -struct Cursor<'a> { - m: marker::PhantomData<&'a ()> -} - -trait CursorNavigator { - fn init_cursor<'a, 'b:'a>(&'a self, cursor: &mut Cursor<'b>) -> bool; -} - -struct SimpleNavigator; - -impl CursorNavigator for SimpleNavigator { - fn init_cursor<'a, 'b: 'a>(&'a self, _cursor: &mut Cursor<'b>) -> bool { - false - } -} - -fn main() { - let mut c = Cursor { m: marker::PhantomData }; - let n = SimpleNavigator; - n.init_cursor(&mut c); -} diff --git a/src/test/ui/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs b/src/test/ui/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs deleted file mode 100644 index 7e6f0d9e27b..00000000000 --- a/src/test/ui/run-pass/methods/method-mut-self-modifies-mut-slice-lvalue.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that an `&mut self` method, when invoked on a place whose -// type is `&mut [u8]`, passes in a pointer to the place and not a -// temporary. Issue #19147. - -use std::slice; -use std::cmp; - -trait MyWriter { - fn my_write(&mut self, buf: &[u8]) -> Result<(), ()>; -} - -impl<'a> MyWriter for &'a mut [u8] { - fn my_write(&mut self, buf: &[u8]) -> Result<(), ()> { - let amt = cmp::min(self.len(), buf.len()); - self[..amt].clone_from_slice(&buf[..amt]); - - let write_len = buf.len(); - unsafe { - *self = slice::from_raw_parts_mut( - self.as_mut_ptr().add(write_len), - self.len() - write_len - ); - } - - Ok(()) - } -} - -fn main() { - let mut buf = [0; 6]; - - { - let mut writer: &mut [_] = &mut buf; - writer.my_write(&[0, 1, 2]).unwrap(); - writer.my_write(&[3, 4, 5]).unwrap(); - } - - // If `my_write` is not modifying `buf` in place, then we will - // wind up with `[3, 4, 5, 0, 0, 0]` because the first call to - // `my_write()` doesn't update the starting point for the write. - - assert_eq!(buf, [0, 1, 2, 3, 4, 5]); -} diff --git a/src/test/ui/run-pass/methods/method-normalize-bounds-issue-20604.rs b/src/test/ui/run-pass/methods/method-normalize-bounds-issue-20604.rs deleted file mode 100644 index a56e5b5170d..00000000000 --- a/src/test/ui/run-pass/methods/method-normalize-bounds-issue-20604.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// Test that we handle projection types which wind up important for -// resolving methods. This test was reduced from a larger example; the -// call to `foo()` at the end was failing to resolve because the -// winnowing stage of method resolution failed to handle an associated -// type projection. - -// pretty-expanded FIXME #23616 - -#![feature(associated_types)] - -trait Hasher { - type Output; - fn finish(&self) -> Self::Output; -} - -trait Hash { - fn hash(&self, h: &mut H); -} - -trait HashState { - type Wut: Hasher; - fn hasher(&self) -> Self::Wut; -} - -struct SipHasher; -impl Hasher for SipHasher { - type Output = u64; - fn finish(&self) -> u64 { 4 } -} - -impl Hash for isize { - fn hash(&self, h: &mut SipHasher) {} -} - -struct SipState; -impl HashState for SipState { - type Wut = SipHasher; - fn hasher(&self) -> SipHasher { SipHasher } -} - -struct Map { - s: S, -} - -impl Map - where S: HashState, - ::Wut: Hasher, -{ - fn foo(&self, k: K) where K: Hash< ::Wut> {} -} - -fn foo>(map: &Map) { - map.foo(22); -} - -fn main() {} diff --git a/src/test/ui/run-pass/methods/method-projection.rs b/src/test/ui/run-pass/methods/method-projection.rs deleted file mode 100644 index a997c8ffbfb..00000000000 --- a/src/test/ui/run-pass/methods/method-projection.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can use method notation to call methods based on a -// projection bound from a trait. Issue #20469. - -/////////////////////////////////////////////////////////////////////////// - - -trait MakeString { - fn make_string(&self) -> String; -} - -impl MakeString for isize { - fn make_string(&self) -> String { - format!("{}", *self) - } -} - -impl MakeString for usize { - fn make_string(&self) -> String { - format!("{}", *self) - } -} - -/////////////////////////////////////////////////////////////////////////// - -trait Foo { - type F: MakeString; - - fn get(&self) -> &Self::F; -} - -fn foo(f: &F) -> String { - f.get().make_string() -} - -/////////////////////////////////////////////////////////////////////////// - -struct SomeStruct { - field: isize, -} - -impl Foo for SomeStruct { - type F = isize; - - fn get(&self) -> &isize { - &self.field - } -} - -/////////////////////////////////////////////////////////////////////////// - -struct SomeOtherStruct { - field: usize, -} - -impl Foo for SomeOtherStruct { - type F = usize; - - fn get(&self) -> &usize { - &self.field - } -} - -fn main() { - let x = SomeStruct { field: 22 }; - assert_eq!(foo(&x), format!("22")); - - let x = SomeOtherStruct { field: 44 }; - assert_eq!(foo(&x), format!("44")); -} diff --git a/src/test/ui/run-pass/methods/method-recursive-blanket-impl.rs b/src/test/ui/run-pass/methods/method-recursive-blanket-impl.rs deleted file mode 100644 index d1cd974070f..00000000000 --- a/src/test/ui/run-pass/methods/method-recursive-blanket-impl.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we don't trigger on the blanket impl for all `&'a T` but -// rather keep autoderefing and trigger on the underlying impl. To -// know not to stop at the blanket, we have to recursively evaluate -// the `T:Foo` bound. - -// pretty-expanded FIXME #23616 - -use std::marker::Sized; - -// Note: this must be generic for the problem to show up -trait Foo { - fn foo(&self, a: A); -} - -impl Foo for [u8] { - fn foo(&self, a: u8) {} -} - -impl<'a, A, T> Foo for &'a T where T: Foo { - fn foo(&self, a: A) { - Foo::foo(*self, a) - } -} - -trait Bar { - fn foo(&self); -} - -struct MyType; - -impl Bar for MyType { - fn foo(&self) {} -} - -fn main() { - let mut m = MyType; - (&mut m).foo() -} diff --git a/src/test/ui/run-pass/methods/method-self-arg-aux1.rs b/src/test/ui/run-pass/methods/method-self-arg-aux1.rs deleted file mode 100644 index c56a69ae4cd..00000000000 --- a/src/test/ui/run-pass/methods/method-self-arg-aux1.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test method calls with self as an argument (cross-crate) - -#![feature(box_syntax)] - -// aux-build:method_self_arg1.rs -extern crate method_self_arg1; -use method_self_arg1::Foo; - -fn main() { - let x = Foo; - // Test external call. - Foo::bar(&x); - Foo::baz(x); - Foo::qux(box x); - - x.foo(&x); - - assert_eq!(method_self_arg1::get_count(), 2*3*3*3*5*5*5*7*7*7); -} diff --git a/src/test/ui/run-pass/methods/method-self-arg-aux2.rs b/src/test/ui/run-pass/methods/method-self-arg-aux2.rs deleted file mode 100644 index 1dffa813ceb..00000000000 --- a/src/test/ui/run-pass/methods/method-self-arg-aux2.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test method calls with self as an argument (cross-crate) - -#![feature(box_syntax)] - -// aux-build:method_self_arg2.rs -extern crate method_self_arg2; -use method_self_arg2::{Foo, Bar}; - -fn main() { - let x = Foo; - // Test external call. - Bar::foo1(&x); - Bar::foo2(x); - Bar::foo3(box x); - - Bar::bar1(&x); - Bar::bar2(x); - Bar::bar3(box x); - - x.run_trait(); - - assert_eq!(method_self_arg2::get_count(), 2*2*3*3*5*5*7*7*11*11*13*13*17); -} diff --git a/src/test/ui/run-pass/methods/method-self-arg-trait.rs b/src/test/ui/run-pass/methods/method-self-arg-trait.rs deleted file mode 100644 index 9429d69a156..00000000000 --- a/src/test/ui/run-pass/methods/method-self-arg-trait.rs +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test method calls with self as an argument - -#![feature(box_syntax)] - -static mut COUNT: u64 = 1; - -#[derive(Copy, Clone)] -struct Foo; - -trait Bar : Sized { - fn foo1(&self); - fn foo2(self); - fn foo3(self: Box); - - fn bar1(&self) { - unsafe { COUNT *= 7; } - } - fn bar2(self) { - unsafe { COUNT *= 11; } - } - fn bar3(self: Box) { - unsafe { COUNT *= 13; } - } -} - -impl Bar for Foo { - fn foo1(&self) { - unsafe { COUNT *= 2; } - } - - fn foo2(self) { - unsafe { COUNT *= 3; } - } - - fn foo3(self: Box) { - unsafe { COUNT *= 5; } - } -} - -impl Foo { - fn baz(self) { - unsafe { COUNT *= 17; } - // Test internal call. - Bar::foo1(&self); - Bar::foo2(self); - Bar::foo3(box self); - - Bar::bar1(&self); - Bar::bar2(self); - Bar::bar3(box self); - } -} - -fn main() { - let x = Foo; - // Test external call. - Bar::foo1(&x); - Bar::foo2(x); - Bar::foo3(box x); - - Bar::bar1(&x); - Bar::bar2(x); - Bar::bar3(box x); - - x.baz(); - - unsafe { assert_eq!(COUNT, 2*2*3*3*5*5*7*7*11*11*13*13*17); } -} diff --git a/src/test/ui/run-pass/methods/method-self-arg.rs b/src/test/ui/run-pass/methods/method-self-arg.rs deleted file mode 100644 index 38e8dfe3e4b..00000000000 --- a/src/test/ui/run-pass/methods/method-self-arg.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test method calls with self as an argument - -#![feature(box_syntax)] - -static mut COUNT: usize = 1; - -#[derive(Copy, Clone)] -struct Foo; - -impl Foo { - fn foo(self, x: &Foo) { - unsafe { COUNT *= 2; } - // Test internal call. - Foo::bar(&self); - Foo::bar(x); - - Foo::baz(self); - Foo::baz(*x); - - Foo::qux(box self); - Foo::qux(box *x); - } - - fn bar(&self) { - unsafe { COUNT *= 3; } - } - - fn baz(self) { - unsafe { COUNT *= 5; } - } - - fn qux(self: Box) { - unsafe { COUNT *= 7; } - } -} - -fn main() { - let x = Foo; - // Test external call. - Foo::bar(&x); - Foo::baz(x); - Foo::qux(box x); - - x.foo(&x); - - unsafe { assert_eq!(COUNT, 2*3*3*3*5*5*5*7*7*7); } -} diff --git a/src/test/ui/run-pass/methods/method-two-trait-defer-resolution-1.rs b/src/test/ui/run-pass/methods/method-two-trait-defer-resolution-1.rs deleted file mode 100644 index bb1b90ebfdf..00000000000 --- a/src/test/ui/run-pass/methods/method-two-trait-defer-resolution-1.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Test that we pick which version of `foo` to run based on the -// type that is (ultimately) inferred for `x`. - - -trait foo { - fn foo(&self) -> i32; -} - -impl foo for Vec { - fn foo(&self) -> i32 {1} -} - -impl foo for Vec { - fn foo(&self) -> i32 {2} -} - -fn call_foo_uint() -> i32 { - let mut x = Vec::new(); - let y = x.foo(); - x.push(0u32); - y -} - -fn call_foo_int() -> i32 { - let mut x = Vec::new(); - let y = x.foo(); - x.push(0i32); - y -} - -fn main() { - assert_eq!(call_foo_uint(), 1); - assert_eq!(call_foo_int(), 2); -} diff --git a/src/test/ui/run-pass/methods/method-two-trait-defer-resolution-2.rs b/src/test/ui/run-pass/methods/method-two-trait-defer-resolution-2.rs deleted file mode 100644 index 3550326327d..00000000000 --- a/src/test/ui/run-pass/methods/method-two-trait-defer-resolution-2.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that when we write `x.foo()`, we do not have to know the -// complete type of `x` in order to type-check the method call. In -// this case, we know that `x: Vec<_1>`, but we don't know what type -// `_1` is (because the call to `push` comes later). To pick between -// the impls, we would have to know `_1`, since we have to know -// whether `_1: MyCopy` or `_1 == Box`. However (and this is the -// point of the test), we don't have to pick between the two impls -- -// it is enough to know that `foo` comes from the `Foo` trait. We can -// codegen the call as `Foo::foo(&x)` and let the specific impl get -// chosen later. - -#![feature(box_syntax)] - -trait Foo { - fn foo(&self) -> isize; -} - -trait MyCopy { fn foo(&self) { } } -impl MyCopy for i32 { } - -impl Foo for Vec { - fn foo(&self) -> isize {1} -} - -impl Foo for Vec> { - fn foo(&self) -> isize {2} -} - -fn call_foo_copy() -> isize { - let mut x = Vec::new(); - let y = x.foo(); - x.push(0_i32); - y -} - -fn call_foo_other() -> isize { - let mut x: Vec<_> = Vec::new(); - let y = x.foo(); - let z: Box = box 0; - x.push(z); - y -} - -fn main() { - assert_eq!(call_foo_copy(), 1); - assert_eq!(call_foo_other(), 2); -} diff --git a/src/test/ui/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs b/src/test/ui/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs deleted file mode 100644 index 89ac0fc890c..00000000000 --- a/src/test/ui/run-pass/methods/method-two-traits-distinguished-via-where-clause.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we select between traits A and B. To do that, we must -// consider the `Sized` bound. - -// pretty-expanded FIXME #23616 - -trait A { - fn foo(self); -} - -trait B { - fn foo(self); -} - -impl A for *const T { - fn foo(self) {} -} - -impl B for *const [T] { - fn foo(self) {} -} - -fn main() { - let x: [isize; 4] = [1,2,3,4]; - let xptr = &x[..] as *const [isize]; - xptr.foo(); -} diff --git a/src/test/ui/run-pass/methods/method-where-clause.rs b/src/test/ui/run-pass/methods/method-where-clause.rs deleted file mode 100644 index 721de2bf8e1..00000000000 --- a/src/test/ui/run-pass/methods/method-where-clause.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can use method notation to call methods based on a -// where clause type, and not only type parameters. - - -trait Foo { - fn foo(&self) -> i32; -} - -impl Foo for Option -{ - fn foo(&self) -> i32 { - self.unwrap_or(22) - } -} - -impl Foo for Option -{ - fn foo(&self) -> i32 { - self.unwrap_or(22) as i32 - } -} - -fn check(x: Option) -> (i32, i32) - where Option : Foo -{ - let y: Option = None; - (x.foo(), y.foo()) -} - -fn main() { - assert_eq!(check(Some(23u32)), (23, 22)); - assert_eq!(check(Some(23)), (23, 22)); -} diff --git a/src/test/ui/run-pass/mir/auxiliary/mir_external_refs.rs b/src/test/ui/run-pass/mir/auxiliary/mir_external_refs.rs deleted file mode 100644 index 4cad98004d7..00000000000 --- a/src/test/ui/run-pass/mir/auxiliary/mir_external_refs.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub struct S(pub u8); - -impl S { - pub fn hey() -> u8 { 24 } -} - -pub trait X { - fn hoy(&self) -> u8 { 25 } -} - -impl X for S {} - -pub enum E { - U(u8) -} - -pub fn regular_fn() -> u8 { 12 } diff --git a/src/test/ui/run-pass/mir/mir-inlining/ice-issue-45493.rs b/src/test/ui/run-pass/mir/mir-inlining/ice-issue-45493.rs deleted file mode 100644 index 85323d56616..00000000000 --- a/src/test/ui/run-pass/mir/mir-inlining/ice-issue-45493.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:-Zmir-opt-level=2 - -trait Array { - type Item; -} - -fn foo() { - let _: *mut A::Item = std::ptr::null_mut(); -} - -struct Foo; -impl Array for Foo { type Item = i32; } - -fn main() { - foo::(); -} diff --git a/src/test/ui/run-pass/mir/mir-inlining/ice-issue-45885.rs b/src/test/ui/run-pass/mir/mir-inlining/ice-issue-45885.rs deleted file mode 100644 index f5401279c89..00000000000 --- a/src/test/ui/run-pass/mir/mir-inlining/ice-issue-45885.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:-Zmir-opt-level=2 - -pub enum Enum { - A, - B, -} - -trait SliceIndex { - type Output; - fn get(&self) -> &Self::Output; -} - -impl SliceIndex for usize { - type Output = Enum; - #[inline(never)] - fn get(&self) -> &Enum { - &Enum::A - } -} - -#[inline(always)] -fn index(t: &T) -> &T::Output { - t.get() -} - -fn main() { - match *index(&0) { Enum::A => true, _ => false }; -} diff --git a/src/test/ui/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs b/src/test/ui/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs deleted file mode 100644 index ff5bf4e75a3..00000000000 --- a/src/test/ui/run-pass/mir/mir-inlining/no-trait-method-issue-40473.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags:-Zmir-opt-level=2 -pub trait Foo { - fn bar(&self) -> usize { 2 } -} - -impl Foo for () { - fn bar(&self) -> usize { 3 } -} - -// Test a case where MIR would inline the default trait method -// instead of bailing out. Issue #40473. -fn main() { - let result = ().bar(); - assert_eq!(result, 3); -} diff --git a/src/test/ui/run-pass/mir/mir-typeck-normalize-fn-sig.rs b/src/test/ui/run-pass/mir/mir-typeck-normalize-fn-sig.rs deleted file mode 100644 index 3fc2ce44eaa..00000000000 --- a/src/test/ui/run-pass/mir/mir-typeck-normalize-fn-sig.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This code was creating an ICE in the MIR type checker. The reason -// is that we are reifying a reference to a function (`foo::<'x>`), -// which involves extracting its signature, but we were not -// normalizing the signature afterwards. As a result, we sometimes got -// errors around the `>::Value`, which can be -// normalized to `f64`. - -#![allow(dead_code)] - -trait Foo<'x> { - type Value; -} - -impl<'x> Foo<'x> for u32 { - type Value = f64; -} - -struct Providers<'x> { - foo: for<'y> fn(x: &'x u32, y: &'y u32) -> >::Value, -} - -fn foo<'y, 'x: 'x>(x: &'x u32, y: &'y u32) -> >::Value { - *x as f64 -} - -fn main() { - Providers { foo }; -} diff --git a/src/test/ui/run-pass/mir/mir_adt_construction.rs b/src/test/ui/run-pass/mir/mir_adt_construction.rs deleted file mode 100644 index 066edfef0ad..00000000000 --- a/src/test/ui/run-pass/mir/mir_adt_construction.rs +++ /dev/null @@ -1,102 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt; - -#[repr(C)] -enum CEnum { - Hello = 30, - World = 60 -} - -fn test1(c: CEnum) -> i32 { - let c2 = CEnum::Hello; - match (c, c2) { - (CEnum::Hello, CEnum::Hello) => 42, - (CEnum::World, CEnum::Hello) => 0, - _ => 1 - } -} - -#[repr(packed)] -struct Pakd { - a: u64, - b: u32, - c: u16, - d: u8, - e: () -} - -// It is unsafe to use #[derive(Debug)] on a packed struct because the code generated by the derive -// macro takes references to the fields instead of accessing them directly. -impl fmt::Debug for Pakd { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - // It's important that we load the fields into locals by-value here. This will do safe - // unaligned loads into the locals, then pass references to the properly-aligned locals to - // the formatting code. - let Pakd { a, b, c, d, e } = *self; - f.debug_struct("Pakd") - .field("a", &a) - .field("b", &b) - .field("c", &c) - .field("d", &d) - .field("e", &e) - .finish() - } -} - -// It is unsafe to use #[derive(PartialEq)] on a packed struct because the code generated by the -// derive macro takes references to the fields instead of accessing them directly. -impl PartialEq for Pakd { - fn eq(&self, other: &Pakd) -> bool { - self.a == other.a && - self.b == other.b && - self.c == other.c && - self.d == other.d && - self.e == other.e - } -} - -impl Drop for Pakd { - fn drop(&mut self) {} -} - -fn test2() -> Pakd { - Pakd { a: 42, b: 42, c: 42, d: 42, e: () } -} - -#[derive(PartialEq, Debug)] -struct TupleLike(u64, u32); - -fn test3() -> TupleLike { - TupleLike(42, 42) -} - -fn test4(x: fn(u64, u32) -> TupleLike) -> (TupleLike, TupleLike) { - let y = TupleLike; - (x(42, 84), y(42, 84)) -} - -fn test5(x: fn(u32) -> Option) -> (Option, Option) { - let y = Some; - (x(42), y(42)) -} - -fn main() { - assert_eq!(test1(CEnum::Hello), 42); - assert_eq!(test1(CEnum::World), 0); - assert_eq!(test2(), Pakd { a: 42, b: 42, c: 42, d: 42, e: () }); - assert_eq!(test3(), TupleLike(42, 42)); - let t4 = test4(TupleLike); - assert_eq!(t4.0, t4.1); - let t5 = test5(Some); - assert_eq!(t5.0, t5.1); -} diff --git a/src/test/ui/run-pass/mir/mir_ascription_coercion.rs b/src/test/ui/run-pass/mir/mir_ascription_coercion.rs deleted file mode 100644 index f52467e5ae8..00000000000 --- a/src/test/ui/run-pass/mir/mir_ascription_coercion.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that the result of type ascription has adjustments applied - -#![feature(type_ascription)] - -fn main() { - let x = [1, 2, 3]; - // The RHS should coerce to &[i32] - let _y : &[i32] = &x : &[i32; 3]; -} diff --git a/src/test/ui/run-pass/mir/mir_augmented_assignments.rs b/src/test/ui/run-pass/mir/mir_augmented_assignments.rs deleted file mode 100644 index dfc6a016185..00000000000 --- a/src/test/ui/run-pass/mir/mir_augmented_assignments.rs +++ /dev/null @@ -1,170 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; -use std::ops::{ - AddAssign, BitAndAssign, BitOrAssign, BitXorAssign, DivAssign, MulAssign, RemAssign, - ShlAssign, ShrAssign, SubAssign, -}; - -#[derive(Debug, PartialEq)] -struct Int(i32); - -struct Slice([i32]); - -impl Slice { - fn new(slice: &mut [i32]) -> &mut Slice { - unsafe { - mem::transmute(slice) - } - } -} - -fn main() { - main_mir(); -} - -fn main_mir() { - let mut x = Int(1); - - x += Int(2); - assert_eq!(x, Int(0b11)); - - x &= Int(0b01); - assert_eq!(x, Int(0b01)); - - x |= Int(0b10); - assert_eq!(x, Int(0b11)); - - x ^= Int(0b01); - assert_eq!(x, Int(0b10)); - - x /= Int(2); - assert_eq!(x, Int(1)); - - x *= Int(3); - assert_eq!(x, Int(3)); - - x %= Int(2); - assert_eq!(x, Int(1)); - - // overloaded RHS - x <<= 1u8; - assert_eq!(x, Int(2)); - - x <<= 1u16; - assert_eq!(x, Int(4)); - - x >>= 1u8; - assert_eq!(x, Int(2)); - - x >>= 1u16; - assert_eq!(x, Int(1)); - - x -= Int(1); - assert_eq!(x, Int(0)); - - // indexed LHS - // FIXME(mir-drop): use the vec![..] macro - let mut v = Vec::new(); - v.push(Int(1)); - v.push(Int(2)); - v[0] += Int(2); - assert_eq!(v[0], Int(3)); - - // unsized RHS - let mut array = [0, 1, 2]; - *Slice::new(&mut array) += 1; - assert_eq!(array[0], 1); - assert_eq!(array[1], 2); - assert_eq!(array[2], 3); - -} - -impl AddAssign for Int { - fn add_assign(&mut self, rhs: Int) { - self.0 += rhs.0; - } -} - -impl BitAndAssign for Int { - fn bitand_assign(&mut self, rhs: Int) { - self.0 &= rhs.0; - } -} - -impl BitOrAssign for Int { - fn bitor_assign(&mut self, rhs: Int) { - self.0 |= rhs.0; - } -} - -impl BitXorAssign for Int { - fn bitxor_assign(&mut self, rhs: Int) { - self.0 ^= rhs.0; - } -} - -impl DivAssign for Int { - fn div_assign(&mut self, rhs: Int) { - self.0 /= rhs.0; - } -} - -impl MulAssign for Int { - fn mul_assign(&mut self, rhs: Int) { - self.0 *= rhs.0; - } -} - -impl RemAssign for Int { - fn rem_assign(&mut self, rhs: Int) { - self.0 %= rhs.0; - } -} - -impl ShlAssign for Int { - fn shl_assign(&mut self, rhs: u8) { - self.0 <<= rhs; - } -} - -impl ShlAssign for Int { - fn shl_assign(&mut self, rhs: u16) { - self.0 <<= rhs; - } -} - -impl ShrAssign for Int { - fn shr_assign(&mut self, rhs: u8) { - self.0 >>= rhs; - } -} - -impl ShrAssign for Int { - fn shr_assign(&mut self, rhs: u16) { - self.0 >>= rhs; - } -} - -impl SubAssign for Int { - fn sub_assign(&mut self, rhs: Int) { - self.0 -= rhs.0; - } -} - -impl AddAssign for Slice { - fn add_assign(&mut self, rhs: i32) { - for lhs in &mut self.0 { - *lhs += rhs; - } - } -} diff --git a/src/test/ui/run-pass/mir/mir_autoderef.rs b/src/test/ui/run-pass/mir/mir_autoderef.rs deleted file mode 100644 index c2d7e6d99ee..00000000000 --- a/src/test/ui/run-pass/mir/mir_autoderef.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::{Deref, DerefMut}; - -pub struct MyRef(u32); - -impl Deref for MyRef { - type Target = u32; - fn deref(&self) -> &u32 { &self.0 } -} - -impl DerefMut for MyRef { - fn deref_mut(&mut self) -> &mut u32 { &mut self.0 } -} - - -fn deref(x: &MyRef) -> &u32 { - x -} - -fn deref_mut(x: &mut MyRef) -> &mut u32 { - x -} - -fn main() { - let mut r = MyRef(2); - assert_eq!(deref(&r) as *const _, &r.0 as *const _); - assert_eq!(deref_mut(&mut r) as *mut _, &mut r.0 as *mut _); -} diff --git a/src/test/ui/run-pass/mir/mir_boxing.rs b/src/test/ui/run-pass/mir/mir_boxing.rs deleted file mode 100644 index 31b10975a4a..00000000000 --- a/src/test/ui/run-pass/mir/mir_boxing.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn test() -> Box { - box 42 -} - -fn main() { - assert_eq!(*test(), 42); -} diff --git a/src/test/ui/run-pass/mir/mir_build_match_comparisons.rs b/src/test/ui/run-pass/mir/mir_build_match_comparisons.rs deleted file mode 100644 index 45ac6566637..00000000000 --- a/src/test/ui/run-pass/mir/mir_build_match_comparisons.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn test1(x: i8) -> i32 { - match x { - 1...10 => 0, - _ => 1, - } -} - -const U: Option = Some(10); -const S: &'static str = "hello"; - -fn test2(x: i8) -> i32 { - match Some(x) { - U => 0, - _ => 1, - } -} - -fn test3(x: &'static str) -> i32 { - match x { - S => 0, - _ => 1, - } -} - -enum Opt { - Some { v: T }, - None -} - -fn test4(x: u64) -> i32 { - let opt = Opt::Some{ v: x }; - match opt { - Opt::Some { v: 10 } => 0, - _ => 1, - } -} - - -fn main() { - assert_eq!(test1(0), 1); - assert_eq!(test1(1), 0); - assert_eq!(test1(2), 0); - assert_eq!(test1(5), 0); - assert_eq!(test1(9), 0); - assert_eq!(test1(10), 0); - assert_eq!(test1(11), 1); - assert_eq!(test1(20), 1); - assert_eq!(test2(10), 0); - assert_eq!(test2(0), 1); - assert_eq!(test2(20), 1); - assert_eq!(test3("hello"), 0); - assert_eq!(test3(""), 1); - assert_eq!(test3("world"), 1); - assert_eq!(test4(10), 0); - assert_eq!(test4(0), 1); - assert_eq!(test4(20), 1); -} diff --git a/src/test/ui/run-pass/mir/mir_call_with_associated_type.rs b/src/test/ui/run-pass/mir/mir_call_with_associated_type.rs deleted file mode 100644 index 1d960d1b716..00000000000 --- a/src/test/ui/run-pass/mir/mir_call_with_associated_type.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Trait { - type Type; -} - -impl<'a> Trait for &'a () { - type Type = u32; -} - -fn foo<'a>(t: <&'a () as Trait>::Type) -> <&'a () as Trait>::Type { - t -} - -fn main() { - assert_eq!(foo(4), 4); -} diff --git a/src/test/ui/run-pass/mir/mir_calls_to_shims.rs b/src/test/ui/run-pass/mir/mir_calls_to_shims.rs deleted file mode 100644 index d9cdec40694..00000000000 --- a/src/test/ui/run-pass/mir/mir_calls_to_shims.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default - -#![feature(fn_traits)] -#![feature(never_type)] - -use std::panic; - -fn foo(x: u32, y: u32) -> u32 { x/y } -fn foo_diverges() -> ! { panic!() } - -fn test_fn_ptr(mut t: T) - where T: Fn(u32, u32) -> u32, -{ - let as_fn = >::call; - assert_eq!(as_fn(&t, (9, 3)), 3); - let as_fn_mut = >::call_mut; - assert_eq!(as_fn_mut(&mut t, (18, 3)), 6); - let as_fn_once = >::call_once; - assert_eq!(as_fn_once(t, (24, 3)), 8); -} - -fn assert_panics(f: F) where F: FnOnce() { - let f = panic::AssertUnwindSafe(f); - let result = panic::catch_unwind(move || { - f.0() - }); - if let Ok(..) = result { - panic!("diverging function returned"); - } -} - -fn test_fn_ptr_panic(mut t: T) - where T: Fn() -> ! -{ - let as_fn = >::call; - assert_panics(|| as_fn(&t, ())); - let as_fn_mut = >::call_mut; - assert_panics(|| as_fn_mut(&mut t, ())); - let as_fn_once = >::call_once; - assert_panics(|| as_fn_once(t, ())); -} - -fn main() { - test_fn_ptr(foo); - test_fn_ptr(foo as fn(u32, u32) -> u32); - test_fn_ptr_panic(foo_diverges); - test_fn_ptr_panic(foo_diverges as fn() -> !); -} diff --git a/src/test/ui/run-pass/mir/mir_cast_fn_ret.rs b/src/test/ui/run-pass/mir/mir_cast_fn_ret.rs deleted file mode 100644 index d2d29120855..00000000000 --- a/src/test/ui/run-pass/mir/mir_cast_fn_ret.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub extern "C" fn tuple2() -> (u16, u8) { - (1, 2) -} - -pub extern "C" fn tuple3() -> (u8, u8, u8) { - (1, 2, 3) -} - -pub fn test2() -> u8 { - tuple2().1 -} - -pub fn test3() -> u8 { - tuple3().2 -} - -fn main() { - assert_eq!(test2(), 2); - assert_eq!(test3(), 3); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_array.rs b/src/test/ui/run-pass/mir/mir_codegen_array.rs deleted file mode 100644 index a0cd3c8dd12..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_array.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn into_inner() -> [u64; 1024] { - let mut x = 10 + 20; - [x; 1024] -} - -fn main(){ - let x: &[u64] = &[30; 1024]; - assert_eq!(&into_inner()[..], x); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_array_2.rs b/src/test/ui/run-pass/mir/mir_codegen_array_2.rs deleted file mode 100644 index 2734bc71b58..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_array_2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn into_inner(x: u64) -> [u64; 1024] { - [x; 2*4*8*16] -} - -fn main(){ - let x: &[u64] = &[42; 1024]; - assert_eq!(&into_inner(42)[..], x); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_call_converging.rs b/src/test/ui/run-pass/mir/mir_codegen_call_converging.rs deleted file mode 100644 index d7bce4d5be3..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_call_converging.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn converging_fn() -> u64 { - 43 -} - -fn mir() -> u64 { - let x; - loop { - x = converging_fn(); - break; - } - x -} - -fn main() { - assert_eq!(mir(), 43); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_calls.rs b/src/test/ui/run-pass/mir/mir_codegen_calls.rs deleted file mode 100644 index 33ffab40428..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_calls.rs +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(fn_traits, test)] - -extern crate test; - -fn test1(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) { - // Test passing a number of arguments including a fat pointer. - // Also returning via an out pointer - fn callee(a: isize, b: (i32, i32), c: &[i32]) -> (isize, (i32, i32), &[i32]) { - (a, b, c) - } - callee(a, b, c) -} - -fn test2(a: isize) -> isize { - // Test passing a single argument. - // Not using out pointer. - fn callee(a: isize) -> isize { - a - } - callee(a) -} - -#[derive(PartialEq, Eq, Debug)] -struct Foo; -impl Foo { - fn inherent_method(&self, a: isize) -> isize { a } -} - -fn test3(x: &Foo, a: isize) -> isize { - // Test calling inherent method - x.inherent_method(a) -} - -trait Bar { - fn extension_method(&self, a: isize) -> isize { a } -} -impl Bar for Foo {} - -fn test4(x: &Foo, a: isize) -> isize { - // Test calling extension method - x.extension_method(a) -} - -fn test5(x: &Bar, a: isize) -> isize { - // Test calling method on trait object - x.extension_method(a) -} - -fn test6(x: &T, a: isize) -> isize { - // Test calling extension method on generic callee - x.extension_method(a) -} - -trait One { - fn one() -> T; -} -impl One for isize { - fn one() -> isize { 1 } -} - -fn test7() -> isize { - // Test calling trait static method - ::one() -} - -struct Two; -impl Two { - fn two() -> isize { 2 } -} - -fn test8() -> isize { - // Test calling impl static method - Two::two() -} - -extern fn simple_extern(x: u32, y: (u32, u32)) -> u32 { - x + y.0 * y.1 -} - -fn test9() -> u32 { - simple_extern(41, (42, 43)) -} - -fn test_closure(f: &F, x: i32, y: i32) -> i32 - where F: Fn(i32, i32) -> i32 -{ - f(x, y) -} - -fn test_fn_object(f: &Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { - f(x, y) -} - -fn test_fn_impl(f: &&Fn(i32, i32) -> i32, x: i32, y: i32) -> i32 { - // This call goes through the Fn implementation for &Fn provided in - // core::ops::impls. It expands to a static Fn::call() that calls the - // Fn::call() implementation of the object shim underneath. - f(x, y) -} - -fn test_fn_direct_call(f: &F, x: i32, y: i32) -> i32 - where F: Fn(i32, i32) -> i32 -{ - f.call((x, y)) -} - -fn test_fn_const_call(f: &F) -> i32 - where F: Fn(i32, i32) -> i32 -{ - f.call((100, -1)) -} - -fn test_fn_nil_call(f: &F) -> i32 - where F: Fn() -> i32 -{ - f() -} - -fn test_fn_transmute_zst(x: ()) -> [(); 1] { - fn id(x: T) -> T {x} - - id(unsafe { - std::mem::transmute(x) - }) -} - -fn test_fn_ignored_pair() -> ((), ()) { - ((), ()) -} - -fn test_fn_ignored_pair_0() { - test_fn_ignored_pair().0 -} - -fn id(x: T) -> T { x } - -fn ignored_pair_named() -> (Foo, Foo) { - (Foo, Foo) -} - -fn test_fn_ignored_pair_named() -> (Foo, Foo) { - id(ignored_pair_named()) -} - -fn test_fn_nested_pair(x: &((f32, f32), u32)) -> (f32, f32) { - let y = *x; - let z = y.0; - (z.0, z.1) -} - -fn test_fn_const_arg_by_ref(mut a: [u64; 4]) -> u64 { - // Mutate the by-reference argument, which won't work with - // a non-immediate constant unless it's copied to the stack. - let a = test::black_box(&mut a); - a[0] += a[1]; - a[0] += a[2]; - a[0] += a[3]; - a[0] -} - -fn main() { - assert_eq!(test1(1, (2, 3), &[4, 5, 6]), (1, (2, 3), &[4, 5, 6][..])); - assert_eq!(test2(98), 98); - assert_eq!(test3(&Foo, 42), 42); - assert_eq!(test4(&Foo, 970), 970); - assert_eq!(test5(&Foo, 8576), 8576); - assert_eq!(test6(&Foo, 12367), 12367); - assert_eq!(test7(), 1); - assert_eq!(test8(), 2); - assert_eq!(test9(), 41 + 42 * 43); - - let r = 3; - let closure = |x: i32, y: i32| { r*(x + (y*2)) }; - assert_eq!(test_fn_const_call(&closure), 294); - assert_eq!(test_closure(&closure, 100, 1), 306); - let function_object = &closure as &Fn(i32, i32) -> i32; - assert_eq!(test_fn_object(function_object, 100, 2), 312); - assert_eq!(test_fn_impl(&function_object, 100, 3), 318); - assert_eq!(test_fn_direct_call(&closure, 100, 4), 324); - - assert_eq!(test_fn_nil_call(&(|| 42)), 42); - assert_eq!(test_fn_transmute_zst(()), [()]); - - assert_eq!(test_fn_ignored_pair_0(), ()); - assert_eq!(test_fn_ignored_pair_named(), (Foo, Foo)); - assert_eq!(test_fn_nested_pair(&((1.0, 2.0), 0)), (1.0, 2.0)); - - const ARRAY: [u64; 4] = [1, 2, 3, 4]; - assert_eq!(test_fn_const_arg_by_ref(ARRAY), 1 + 2 + 3 + 4); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_calls_variadic.rs b/src/test/ui/run-pass/mir/mir_codegen_calls_variadic.rs deleted file mode 100644 index ee32f2d0e0f..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_calls_variadic.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - fn rust_interesting_average(_: i64, ...) -> f64; -} - -fn test(a: i64, b: i64, c: i64, d: i64, e: i64, f: T, g: U) -> i64 { - unsafe { - rust_interesting_average(6, a, a as f64, - b, b as f64, - c, c as f64, - d, d as f64, - e, e as f64, - f, g) as i64 - } -} - -fn main(){ - assert_eq!(test(10, 20, 30, 40, 50, 60_i64, 60.0_f64), 70); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_critical_edge.rs b/src/test/ui/run-pass/mir/mir_codegen_critical_edge.rs deleted file mode 100644 index 48a5d6ab0f0..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_critical_edge.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This code produces a CFG with critical edges that, if we don't -// handle properly, will cause invalid codegen. - -#![feature(rustc_attrs)] - -enum State { - Both, - Front, - Back -} - -pub struct Foo { - state: State, - a: A, - b: B -} - -impl Foo -where A: Iterator, B: Iterator -{ - // This is the function we care about - fn next(&mut self) -> Option { - match self.state { - State::Both => match self.a.next() { - elt @ Some(..) => elt, - None => { - self.state = State::Back; - self.b.next() - } - }, - State::Front => self.a.next(), - State::Back => self.b.next(), - } - } -} - -// Make sure we actually codegen a version of the function -pub fn do_stuff(mut f: Foo>, Box>>) { - let _x = f.next(); -} - -fn main() {} diff --git a/src/test/ui/run-pass/mir/mir_codegen_spike1.rs b/src/test/ui/run-pass/mir/mir_codegen_spike1.rs deleted file mode 100644 index 0317aa0b509..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_spike1.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A simple spike test for MIR version of codegen. - -fn sum(x: i32, y: i32) -> i32 { - x + y -} - -fn main() { - let x = sum(22, 44); - assert_eq!(x, 66); - println!("sum()={:?}", x); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_switch.rs b/src/test/ui/run-pass/mir/mir_codegen_switch.rs deleted file mode 100644 index d793337925d..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_switch.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Abc { - A(u8), - B(i8), - C, - D, -} - -fn foo(x: Abc) -> i32 { - match x { - Abc::C => 3, - Abc::D => 4, - Abc::B(_) => 2, - Abc::A(_) => 1, - } -} - -fn foo2(x: Abc) -> bool { - match x { - Abc::D => true, - _ => false - } -} - -fn main() { - assert_eq!(1, foo(Abc::A(42))); - assert_eq!(2, foo(Abc::B(-100))); - assert_eq!(3, foo(Abc::C)); - assert_eq!(4, foo(Abc::D)); - - assert_eq!(false, foo2(Abc::A(1))); - assert_eq!(false, foo2(Abc::B(2))); - assert_eq!(false, foo2(Abc::C)); - assert_eq!(true, foo2(Abc::D)); -} diff --git a/src/test/ui/run-pass/mir/mir_codegen_switchint.rs b/src/test/ui/run-pass/mir/mir_codegen_switchint.rs deleted file mode 100644 index ef0a98a6e70..00000000000 --- a/src/test/ui/run-pass/mir/mir_codegen_switchint.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn foo(x: i8) -> i32 { - match x { - 1 => 0, - _ => 1, - } -} - -fn main() { - assert_eq!(foo(0), 1); - assert_eq!(foo(1), 0); -} diff --git a/src/test/ui/run-pass/mir/mir_coercion_casts.rs b/src/test/ui/run-pass/mir/mir_coercion_casts.rs deleted file mode 100644 index 3de87029e0f..00000000000 --- a/src/test/ui/run-pass/mir/mir_coercion_casts.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests the coercion casts are handled properly - -fn main() { - // This should produce only a reification of f, - // not a fn -> fn cast as well - let _ = f as fn(&()); -} - -fn f<'a>(_: &'a ()) { } diff --git a/src/test/ui/run-pass/mir/mir_coercions.rs b/src/test/ui/run-pass/mir/mir_coercions.rs deleted file mode 100644 index 79a8030e9b5..00000000000 --- a/src/test/ui/run-pass/mir/mir_coercions.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(coerce_unsized, unsize)] - -use std::ops::CoerceUnsized; -use std::marker::Unsize; - -fn identity_coercion(x: &(Fn(u32)->u32 + Send)) -> &Fn(u32)->u32 { - x -} -fn fn_coercions(f: &fn(u32) -> u32) -> - (unsafe fn(u32) -> u32, - &(Fn(u32) -> u32+Send)) -{ - (*f, f) -} - -fn simple_array_coercion(x: &[u8; 3]) -> &[u8] { x } - -fn square(a: u32) -> u32 { a * a } - -#[derive(PartialEq,Eq)] -struct PtrWrapper<'a, T: 'a+?Sized>(u32, u32, (), &'a T); -impl<'a, T: ?Sized+Unsize, U: ?Sized> - CoerceUnsized> for PtrWrapper<'a, T> {} - -struct TrivPtrWrapper<'a, T: 'a+?Sized>(&'a T); -impl<'a, T: ?Sized+Unsize, U: ?Sized> - CoerceUnsized> for TrivPtrWrapper<'a, T> {} - -fn coerce_ptr_wrapper(p: PtrWrapper<[u8; 3]>) -> PtrWrapper<[u8]> { - p -} - -fn coerce_triv_ptr_wrapper(p: TrivPtrWrapper<[u8; 3]>) -> TrivPtrWrapper<[u8]> { - p -} - -fn coerce_fat_ptr_wrapper(p: PtrWrapper u32+Send>) - -> PtrWrapper u32> { - p -} - -fn coerce_ptr_wrapper_poly<'a, T, Trait: ?Sized>(p: PtrWrapper<'a, T>) - -> PtrWrapper<'a, Trait> - where PtrWrapper<'a, T>: CoerceUnsized> -{ - p -} - -fn main() { - let a = [0,1,2]; - let square_local : fn(u32) -> u32 = square; - let (f,g) = fn_coercions(&square_local); - assert_eq!(f as usize, square as usize); - assert_eq!(g(4), 16); - assert_eq!(identity_coercion(g)(5), 25); - - assert_eq!(simple_array_coercion(&a), &a); - let w = coerce_ptr_wrapper(PtrWrapper(2,3,(),&a)); - assert!(w == PtrWrapper(2,3,(),&a) as PtrWrapper<[u8]>); - - let w = coerce_triv_ptr_wrapper(TrivPtrWrapper(&a)); - assert_eq!(&w.0, &a); - - let z = coerce_fat_ptr_wrapper(PtrWrapper(2,3,(),&square_local)); - assert_eq!((z.3)(6), 36); - - let z: PtrWrapper u32> = - coerce_ptr_wrapper_poly(PtrWrapper(2,3,(),&square_local)); - assert_eq!((z.3)(6), 36); -} diff --git a/src/test/ui/run-pass/mir/mir_constval_adts.rs b/src/test/ui/run-pass/mir/mir_constval_adts.rs deleted file mode 100644 index d35dd9c441b..00000000000 --- a/src/test/ui/run-pass/mir/mir_constval_adts.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Point { - _x: i32, - _y: i32, -} - -#[derive(PartialEq, Eq, Debug)] -struct Newtype(T); - -const STRUCT: Point = Point { _x: 42, _y: 42 }; -const TUPLE1: (i32, i32) = (42, 42); -const TUPLE2: (&'static str, &'static str) = ("hello","world"); -const PAIR_NEWTYPE: (Newtype, Newtype) = (Newtype(42), Newtype(42)); - -fn mir() -> (Point, (i32, i32), (&'static str, &'static str), (Newtype, Newtype)) { - let struct1 = STRUCT; - let tuple1 = TUPLE1; - let tuple2 = TUPLE2; - let pair_newtype = PAIR_NEWTYPE; - (struct1, tuple1, tuple2, pair_newtype) -} - -const NEWTYPE: Newtype<&'static str> = Newtype("foobar"); - -fn test_promoted_newtype_str_ref() { - let x = &NEWTYPE; - assert_eq!(x, &Newtype("foobar")); -} - -fn main(){ - assert_eq!(mir(), (STRUCT, TUPLE1, TUPLE2, PAIR_NEWTYPE)); - test_promoted_newtype_str_ref(); -} - diff --git a/src/test/ui/run-pass/mir/mir_drop_order.rs b/src/test/ui/run-pass/mir/mir_drop_order.rs deleted file mode 100644 index abc21eee636..00000000000 --- a/src/test/ui/run-pass/mir/mir_drop_order.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default - -use std::cell::RefCell; -use std::panic; - -pub struct DropLogger<'a> { - id: usize, - log: &'a panic::AssertUnwindSafe>> -} - -impl<'a> Drop for DropLogger<'a> { - fn drop(&mut self) { - self.log.0.borrow_mut().push(self.id); - } -} - -struct InjectedFailure; - -#[allow(unreachable_code)] -fn main() { - let log = panic::AssertUnwindSafe(RefCell::new(vec![])); - let d = |id| DropLogger { id: id, log: &log }; - let get = || -> Vec<_> { - let mut m = log.0.borrow_mut(); - let n = m.drain(..); - n.collect() - }; - - { - let _x = (d(0), &d(1), d(2), &d(3)); - // all borrows are extended - nothing has been dropped yet - assert_eq!(get(), vec![]); - } - // in a let-statement, extended places are dropped - // *after* the let result (tho they have the same scope - // as far as scope-based borrowck goes). - assert_eq!(get(), vec![0, 2, 3, 1]); - - let _ = std::panic::catch_unwind(|| { - (d(4), &d(5), d(6), &d(7), panic!(InjectedFailure)); - }); - - // here, the temporaries (5/7) live until the end of the - // containing statement, which is destroyed after the operands - // (4/6) on a panic. - assert_eq!(get(), vec![6, 4, 7, 5]); -} diff --git a/src/test/ui/run-pass/mir/mir_early_return_scope.rs b/src/test/ui/run-pass/mir/mir_early_return_scope.rs deleted file mode 100644 index 27b90722328..00000000000 --- a/src/test/ui/run-pass/mir/mir_early_return_scope.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -static mut DROP: bool = false; - -struct ConnWrap(Conn); -impl ::std::ops::Deref for ConnWrap { - type Target=Conn; - fn deref(&self) -> &Conn { &self.0 } -} - -struct Conn; -impl Drop for Conn { - fn drop(&mut self) { unsafe { DROP = true; } } -} - -fn inner() { - let conn = &*match Some(ConnWrap(Conn)) { - Some(val) => val, - None => return, - }; - return; -} - -fn main() { - inner(); - unsafe { - assert_eq!(DROP, true); - } -} diff --git a/src/test/ui/run-pass/mir/mir_fat_ptr.rs b/src/test/ui/run-pass/mir/mir_fat_ptr.rs deleted file mode 100644 index b3facb3b4c4..00000000000 --- a/src/test/ui/run-pass/mir/mir_fat_ptr.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// test that ordinary fat pointer operations work. - -struct Wrapper(u32, T); - -struct FatPtrContainer<'a> { - ptr: &'a [u8] -} - -fn fat_ptr_project(a: &Wrapper<[u8]>) -> &[u8] { - &a.1 -} - -fn fat_ptr_simple(a: &[u8]) -> &[u8] { - a -} - -fn fat_ptr_via_local(a: &[u8]) -> &[u8] { - let x = a; - x -} - -fn fat_ptr_from_struct(s: FatPtrContainer) -> &[u8] { - s.ptr -} - -fn fat_ptr_to_struct(a: &[u8]) -> FatPtrContainer { - FatPtrContainer { ptr: a } -} - -fn fat_ptr_store_to<'a>(a: &'a [u8], b: &mut &'a [u8]) { - *b = a; -} - -fn fat_ptr_constant() -> &'static str { - "HELLO" -} - -fn main() { - let a = Wrapper(4, [7,6,5]); - - let p = fat_ptr_project(&a); - let p = fat_ptr_simple(p); - let p = fat_ptr_via_local(p); - let p = fat_ptr_from_struct(fat_ptr_to_struct(p)); - - let mut target : &[u8] = &[42]; - fat_ptr_store_to(p, &mut target); - assert_eq!(target, &a.1); - - assert_eq!(fat_ptr_constant(), "HELLO"); -} diff --git a/src/test/ui/run-pass/mir/mir_fat_ptr_drop.rs b/src/test/ui/run-pass/mir/mir_fat_ptr_drop.rs deleted file mode 100644 index 84528b3296a..00000000000 --- a/src/test/ui/run-pass/mir/mir_fat_ptr_drop.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// test that ordinary fat pointer operations work. - -#![feature(braced_empty_structs)] -#![feature(rustc_attrs)] - -use std::sync::atomic; -use std::sync::atomic::Ordering::SeqCst; - -static COUNTER: atomic::AtomicUsize = atomic::ATOMIC_USIZE_INIT; - -struct DropMe { -} - -impl Drop for DropMe { - fn drop(&mut self) { - COUNTER.fetch_add(1, SeqCst); - } -} - -fn fat_ptr_move_then_drop(a: Box<[DropMe]>) { - let b = a; -} - -fn main() { - let a: Box<[DropMe]> = Box::new([DropMe { }]); - fat_ptr_move_then_drop(a); - assert_eq!(COUNTER.load(SeqCst), 1); -} diff --git a/src/test/ui/run-pass/mir/mir_heavy_promoted.rs b/src/test/ui/run-pass/mir/mir_heavy_promoted.rs deleted file mode 100644 index 2f788f1408d..00000000000 --- a/src/test/ui/run-pass/mir/mir_heavy_promoted.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten apparently only works in optimized mode - -const TEST_DATA: [u8; 32 * 1024 * 1024] = [42; 32 * 1024 * 1024]; - -// Check that the promoted copy of TEST_DATA doesn't -// leave an alloca from an unused temp behind, which, -// without optimizations, can still blow the stack. -fn main() { - println!("{}", TEST_DATA.len()); -} diff --git a/src/test/ui/run-pass/mir/mir_match_arm_guard.rs b/src/test/ui/run-pass/mir/mir_match_arm_guard.rs deleted file mode 100644 index b53f8535079..00000000000 --- a/src/test/ui/run-pass/mir/mir_match_arm_guard.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #30527 - We were not generating arms with guards in certain cases. - -fn match_with_guard(x: Option) -> i8 { - match x { - Some(xyz) if xyz > 100 => 0, - Some(_) => -1, - None => -2 - } -} - -fn main() { - assert_eq!(match_with_guard(Some(111)), 0); - assert_eq!(match_with_guard(Some(2)), -1); - assert_eq!(match_with_guard(None), -2); -} diff --git a/src/test/ui/run-pass/mir/mir_misc_casts.rs b/src/test/ui/run-pass/mir/mir_misc_casts.rs deleted file mode 100644 index 081814edcd1..00000000000 --- a/src/test/ui/run-pass/mir/mir_misc_casts.rs +++ /dev/null @@ -1,330 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn func(){} - -const STR: &'static str = "hello"; -const BSTR: &'static [u8; 5] = b"hello"; - -fn from_ptr() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, *const ()) { - let f = 1_usize as *const String; - let c1 = f as isize; - let c2 = f as usize; - let c3 = f as i8; - let c4 = f as i16; - let c5 = f as i32; - let c6 = f as i64; - let c7 = f as u8; - let c8 = f as u16; - let c9 = f as u32; - let c10 = f as u64; - let c11 = f as *const (); - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11) -} - -fn from_1() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1 as isize; - let c2 = 1 as usize; - let c3 = 1 as i8; - let c4 = 1 as i16; - let c5 = 1 as i32; - let c6 = 1 as i64; - let c7 = 1 as u8; - let c8 = 1 as u16; - let c9 = 1 as u32; - let c10 = 1 as u64; - let c11 = 1 as f32; - let c12 = 1 as f64; - let c13 = 1 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1usize() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_usize as isize; - let c2 = 1_usize as usize; - let c3 = 1_usize as i8; - let c4 = 1_usize as i16; - let c5 = 1_usize as i32; - let c6 = 1_usize as i64; - let c7 = 1_usize as u8; - let c8 = 1_usize as u16; - let c9 = 1_usize as u32; - let c10 = 1_usize as u64; - let c11 = 1_usize as f32; - let c12 = 1_usize as f64; - let c13 = 1_usize as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1isize() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_isize as isize; - let c2 = 1_isize as usize; - let c3 = 1_isize as i8; - let c4 = 1_isize as i16; - let c5 = 1_isize as i32; - let c6 = 1_isize as i64; - let c7 = 1_isize as u8; - let c8 = 1_isize as u16; - let c9 = 1_isize as u32; - let c10 = 1_isize as u64; - let c11 = 1_isize as f32; - let c12 = 1_isize as f64; - let c13 = 1_isize as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1u8() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_u8 as isize; - let c2 = 1_u8 as usize; - let c3 = 1_u8 as i8; - let c4 = 1_u8 as i16; - let c5 = 1_u8 as i32; - let c6 = 1_u8 as i64; - let c7 = 1_u8 as u8; - let c8 = 1_u8 as u16; - let c9 = 1_u8 as u32; - let c10 = 1_u8 as u64; - let c11 = 1_u8 as f32; - let c12 = 1_u8 as f64; - let c13 = 1_u8 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1i8() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_i8 as isize; - let c2 = 1_i8 as usize; - let c3 = 1_i8 as i8; - let c4 = 1_i8 as i16; - let c5 = 1_i8 as i32; - let c6 = 1_i8 as i64; - let c7 = 1_i8 as u8; - let c8 = 1_i8 as u16; - let c9 = 1_i8 as u32; - let c10 = 1_i8 as u64; - let c11 = 1_i8 as f32; - let c12 = 1_i8 as f64; - let c13 = 1_i8 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1u16() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_u16 as isize; - let c2 = 1_u16 as usize; - let c3 = 1_u16 as i8; - let c4 = 1_u16 as i16; - let c5 = 1_u16 as i32; - let c6 = 1_u16 as i64; - let c7 = 1_u16 as u8; - let c8 = 1_u16 as u16; - let c9 = 1_u16 as u32; - let c10 = 1_u16 as u64; - let c11 = 1_u16 as f32; - let c12 = 1_u16 as f64; - let c13 = 1_u16 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1i16() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_i16 as isize; - let c2 = 1_i16 as usize; - let c3 = 1_i16 as i8; - let c4 = 1_i16 as i16; - let c5 = 1_i16 as i32; - let c6 = 1_i16 as i64; - let c7 = 1_i16 as u8; - let c8 = 1_i16 as u16; - let c9 = 1_i16 as u32; - let c10 = 1_i16 as u64; - let c11 = 1_i16 as f32; - let c12 = 1_i16 as f64; - let c13 = 1_i16 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1u32() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_u32 as isize; - let c2 = 1_u32 as usize; - let c3 = 1_u32 as i8; - let c4 = 1_u32 as i16; - let c5 = 1_u32 as i32; - let c6 = 1_u32 as i64; - let c7 = 1_u32 as u8; - let c8 = 1_u32 as u16; - let c9 = 1_u32 as u32; - let c10 = 1_u32 as u64; - let c11 = 1_u32 as f32; - let c12 = 1_u32 as f64; - let c13 = 1_u32 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1i32() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_i32 as isize; - let c2 = 1_i32 as usize; - let c3 = 1_i32 as i8; - let c4 = 1_i32 as i16; - let c5 = 1_i32 as i32; - let c6 = 1_i32 as i64; - let c7 = 1_i32 as u8; - let c8 = 1_i32 as u16; - let c9 = 1_i32 as u32; - let c10 = 1_i32 as u64; - let c11 = 1_i32 as f32; - let c12 = 1_i32 as f64; - let c13 = 1_i32 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1u64() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_u64 as isize; - let c2 = 1_u64 as usize; - let c3 = 1_u64 as i8; - let c4 = 1_u64 as i16; - let c5 = 1_u64 as i32; - let c6 = 1_u64 as i64; - let c7 = 1_u64 as u8; - let c8 = 1_u64 as u16; - let c9 = 1_u64 as u32; - let c10 = 1_u64 as u64; - let c11 = 1_u64 as f32; - let c12 = 1_u64 as f64; - let c13 = 1_u64 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_1i64() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64, *const String) { - let c1 = 1_i64 as isize; - let c2 = 1_i64 as usize; - let c3 = 1_i64 as i8; - let c4 = 1_i64 as i16; - let c5 = 1_i64 as i32; - let c6 = 1_i64 as i64; - let c7 = 1_i64 as u8; - let c8 = 1_i64 as u16; - let c9 = 1_i64 as u32; - let c10 = 1_i64 as u64; - let c11 = 1_i64 as f32; - let c12 = 1_i64 as f64; - let c13 = 1_i64 as *const String; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13) -} - -fn from_bool() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64) { - let c1 = true as isize; - let c2 = true as usize; - let c3 = true as i8; - let c4 = true as i16; - let c5 = true as i32; - let c6 = true as i64; - let c7 = true as u8; - let c8 = true as u16; - let c9 = true as u32; - let c10 = true as u64; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10) -} - -fn from_1f32() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64) { - let c1 = 1.0_f32 as isize; - let c2 = 1.0_f32 as usize; - let c3 = 1.0_f32 as i8; - let c4 = 1.0_f32 as i16; - let c5 = 1.0_f32 as i32; - let c6 = 1.0_f32 as i64; - let c7 = 1.0_f32 as u8; - let c8 = 1.0_f32 as u16; - let c9 = 1.0_f32 as u32; - let c10 = 1.0_f32 as u64; - let c11 = 1.0_f32 as f32; - let c12 = 1.0_f32 as f64; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) -} - -fn from_1f64() --> (isize, usize, i8, i16, i32, i64, u8, u16, u32, u64, f32, f64) { - let c1 = 1.0f64 as isize; - let c2 = 1.0f64 as usize; - let c3 = 1.0f64 as i8; - let c4 = 1.0f64 as i16; - let c5 = 1.0f64 as i32; - let c6 = 1.0f64 as i64; - let c7 = 1.0f64 as u8; - let c8 = 1.0f64 as u16; - let c9 = 1.0f64 as u32; - let c10 = 1.0f64 as u64; - let c11 = 1.0f64 as f32; - let c12 = 1.0f64 as f64; - (c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12) -} - -fn other_casts() --> (*const u8, *const isize, *const u8, *const u8) { - let c1 = func as *const u8; - let c2 = c1 as *const isize; - - let r = &42u32; - let _ = r as *const u32; - - // fat-ptr -> fat-ptr -> fat-raw-ptr -> thin-ptr - let c3 = STR as &str as *const str as *const u8; - - let c4 = BSTR as *const [u8] as *const [u16] as *const u8; - (c1, c2, c3, c4) -} - -pub fn assert_eq_13(l: (isize, usize, i8, i16, i32, i64, u8, - u16, u32, u64, f32, f64, *const String), - r: (isize, usize, i8, i16, i32, i64, u8, - u16, u32, u64, f32, f64, *const String)) -> bool { - let (l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13) = l; - let (r1, r2, r3, r4, r5, r6, r7, r8, r9, r10, r11, r12, r13) = r; - l1 == r1 && l2 == r2 && l3 == r3 && l4 == r4 && l5 == r5 && l6 == r6 && l7 == r7 && - l8 == r8 && l9 == r9 && l10 == r10 && l11 == r11 && l12 == r12 && l13 == r13 -} - - -pub fn main() { - let f = 1_usize as *const String; - let t13 = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0, f); - let t12 = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1.0, 1.0); - assert_eq_13(from_1(), t13); - assert_eq_13(from_1usize(), t13); - assert_eq_13(from_1isize(), t13); - assert_eq_13(from_1u8(), t13); - assert_eq_13(from_1i8(), t13); - assert_eq_13(from_1u16(), t13); - assert_eq_13(from_1i16(), t13); - assert_eq_13(from_1u32(), t13); - assert_eq_13(from_1i32(), t13); - assert_eq_13(from_1u64(), t13); - assert_eq_13(from_1i64(), t13); - assert_eq!(from_1f32(), t12); - assert_eq!(from_1f64(), t12); - - assert_eq!(from_ptr(), (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 as *const ())); - assert_eq!(from_bool(), (1, 1, 1, 1, 1, 1, 1, 1, 1, 1)); - - assert_eq!(other_casts(), (func as *const u8, func as *const isize, - STR as *const str as *const u8, BSTR as *const [u8] as *const u8)); -} diff --git a/src/test/ui/run-pass/mir/mir_overflow_off.rs b/src/test/ui/run-pass/mir/mir_overflow_off.rs deleted file mode 100644 index 9d6624b53d0..00000000000 --- a/src/test/ui/run-pass/mir/mir_overflow_off.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z force-overflow-checks=off - -// Test that with MIR codegen, overflow checks can be -// turned off, even when they're from core::ops::*. - -use std::ops::*; - -fn main() { - assert_eq!(i8::neg(-0x80), -0x80); - - assert_eq!(u8::add(0xff, 1), 0_u8); - assert_eq!(u8::sub(0, 1), 0xff_u8); - assert_eq!(u8::mul(0xff, 2), 0xfe_u8); - assert_eq!(u8::shl(1, 9), 2_u8); - assert_eq!(u8::shr(2, 9), 1_u8); -} diff --git a/src/test/ui/run-pass/mir/mir_raw_fat_ptr.rs b/src/test/ui/run-pass/mir/mir_raw_fat_ptr.rs deleted file mode 100644 index b5ae15b2ce1..00000000000 --- a/src/test/ui/run-pass/mir/mir_raw_fat_ptr.rs +++ /dev/null @@ -1,168 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// check raw fat pointer ops in mir -// FIXME: please improve this when we get monomorphization support - -use std::mem; - -#[derive(Debug, PartialEq, Eq)] -struct ComparisonResults { - lt: bool, - le: bool, - gt: bool, - ge: bool, - eq: bool, - ne: bool -} - -const LT: ComparisonResults = ComparisonResults { - lt: true, - le: true, - gt: false, - ge: false, - eq: false, - ne: true -}; - -const EQ: ComparisonResults = ComparisonResults { - lt: false, - le: true, - gt: false, - ge: true, - eq: true, - ne: false -}; - -const GT: ComparisonResults = ComparisonResults { - lt: false, - le: false, - gt: true, - ge: true, - eq: false, - ne: true -}; - -fn compare_su8(a: *const S<[u8]>, b: *const S<[u8]>) -> ComparisonResults { - ComparisonResults { - lt: a < b, - le: a <= b, - gt: a > b, - ge: a >= b, - eq: a == b, - ne: a != b - } -} - -fn compare_au8(a: *const [u8], b: *const [u8]) -> ComparisonResults { - ComparisonResults { - lt: a < b, - le: a <= b, - gt: a > b, - ge: a >= b, - eq: a == b, - ne: a != b - } -} - -fn compare_foo<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> ComparisonResults { - ComparisonResults { - lt: a < b, - le: a <= b, - gt: a > b, - ge: a >= b, - eq: a == b, - ne: a != b - } -} - -fn simple_eq<'a>(a: *const (Foo+'a), b: *const (Foo+'a)) -> bool { - let result = a == b; - result -} - -fn assert_inorder(a: &[T], - compare: fn(T, T) -> ComparisonResults) { - for i in 0..a.len() { - for j in 0..a.len() { - let cres = compare(a[i], a[j]); - if i < j { - assert_eq!(cres, LT); - } else if i == j { - assert_eq!(cres, EQ); - } else { - assert_eq!(cres, GT); - } - } - } -} - -trait Foo { fn foo(&self) -> usize; } -impl Foo for T { - fn foo(&self) -> usize { - mem::size_of::() - } -} - -struct S(u32, T); - -fn main() { - let array = [0,1,2,3,4]; - let array2 = [5,6,7,8,9]; - - // fat ptr comparison: addr then extra - - // check ordering for arrays - let mut ptrs: Vec<*const [u8]> = vec![ - &array[0..0], &array[0..1], &array, &array[1..] - ]; - - let array_addr = &array as *const [u8] as *const u8 as usize; - let array2_addr = &array2 as *const [u8] as *const u8 as usize; - if array2_addr < array_addr { - ptrs.insert(0, &array2); - } else { - ptrs.push(&array2); - } - assert_inorder(&ptrs, compare_au8); - - let u8_ = (0u8, 1u8); - let u32_ = (4u32, 5u32); - - // check ordering for ptrs - let buf: &mut [*const Foo] = &mut [ - &u8_, &u8_.0, - &u32_, &u32_.0, - ]; - buf.sort_by(|u,v| { - let u : [*const (); 2] = unsafe { mem::transmute(*u) }; - let v : [*const (); 2] = unsafe { mem::transmute(*v) }; - u.cmp(&v) - }); - assert_inorder(buf, compare_foo); - - // check ordering for structs containing arrays - let ss: (S<[u8; 2]>, - S<[u8; 3]>, - S<[u8; 2]>) = ( - S(7, [8, 9]), - S(10, [11, 12, 13]), - S(4, [5, 6]) - ); - assert_inorder(&[ - &ss.0 as *const S<[u8]>, - &ss.1 as *const S<[u8]>, - &ss.2 as *const S<[u8]> - ], compare_su8); - - assert!(simple_eq(&0u8 as *const _, &0u8 as *const _)); - assert!(!simple_eq(&0u8 as *const _, &1u8 as *const _)); -} diff --git a/src/test/ui/run-pass/mir/mir_refs_correct.rs b/src/test/ui/run-pass/mir/mir_refs_correct.rs deleted file mode 100644 index 1166b6188c2..00000000000 --- a/src/test/ui/run-pass/mir/mir_refs_correct.rs +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:mir_external_refs.rs - -extern crate mir_external_refs as ext; - -struct S(u8); -#[derive(Debug, PartialEq, Eq)] -struct Unit; - -impl S { - fn hey() -> u8 { 42 } - fn hey2(&self) -> u8 { 44 } -} - -trait X { - fn hoy(&self) -> u8 { 43 } - fn hoy2() -> u8 { 45 } -} - -trait F { - fn f(self, other: U) -> u64; -} - -impl F for u32 { - fn f(self, other: u32) -> u64 { self as u64 + other as u64 } -} - -impl F for u32 { - fn f(self, other: u64) -> u64 { self as u64 - other } -} - -impl F for u64 { - fn f(self, other: u64) -> u64 { self * other } -} - -impl F for u64 { - fn f(self, other: u32) -> u64 { self ^ other as u64 } -} - -trait T { - fn staticmeth(i: I, o: O) -> (I, O) { (i, o) } -} - -impl T for O {} - -impl X for S {} - -enum E { - U(u8) -} - -#[derive(PartialEq, Debug, Eq)] -enum CEnum { - A = 0x321, - B = 0x123 -} - -const C: u8 = 84; -const C2: [u8; 5] = [42; 5]; -const C3: [u8; 3] = [42, 41, 40]; -const C4: fn(u8) -> S = S; - -fn regular() -> u8 { - 21 -} - -fn parametric(u: T) -> T { - u -} - -fn t1() -> fn()->u8 { - regular -} - -fn t2() -> fn(u8)->E { - E::U -} - -fn t3() -> fn(u8)->S { - S -} - -fn t4() -> fn()->u8 { - S::hey -} - -fn t5() -> fn(&S)-> u8 { - ::hoy -} - - -fn t6() -> fn()->u8{ - ext::regular_fn -} - -fn t7() -> fn(u8)->ext::E { - ext::E::U -} - -fn t8() -> fn(u8)->ext::S { - ext::S -} - -fn t9() -> fn()->u8 { - ext::S::hey -} - -fn t10() -> fn(&ext::S)->u8 { - ::hoy -} - -fn t11() -> fn(u8)->u8 { - parametric -} - -fn t12() -> u8 { - C -} - -fn t13() -> [u8; 5] { - C2 -} - -fn t13_2() -> [u8; 3] { - C3 -} - -fn t14() -> fn()-> u8 { - ::hoy2 -} - -fn t15() -> fn(&S)-> u8 { - S::hey2 -} - -fn t16() -> fn(u32, u32)->u64 { - F::f -} - -fn t17() -> fn(u32, u64)->u64 { - F::f -} - -fn t18() -> fn(u64, u64)->u64 { - F::f -} - -fn t19() -> fn(u64, u32)->u64 { - F::f -} - -fn t20() -> fn(u64, u32)->(u64, u32) { - >::staticmeth -} - -fn t21() -> Unit { - Unit -} - -fn t22() -> Option { - None -} - -fn t23() -> (CEnum, CEnum) { - (CEnum::A, CEnum::B) -} - -fn t24() -> fn(u8) -> S { - C4 -} - -fn main() { - assert_eq!(t1()(), regular()); - - assert_eq!(t2() as *mut (), E::U as *mut ()); - assert_eq!(t3() as *mut (), S as *mut ()); - - assert_eq!(t4()(), S::hey()); - let s = S(42); - assert_eq!(t5()(&s), ::hoy(&s)); - - - assert_eq!(t6()(), ext::regular_fn()); - assert_eq!(t7() as *mut (), ext::E::U as *mut ()); - assert_eq!(t8() as *mut (), ext::S as *mut ()); - - assert_eq!(t9()(), ext::S::hey()); - let sext = ext::S(6); - assert_eq!(t10()(&sext), ::hoy(&sext)); - - let p = parametric::; - assert_eq!(t11() as *mut (), p as *mut ()); - - assert_eq!(t12(), C); - assert_eq!(t13(), C2); - assert_eq!(t13_2(), C3); - - assert_eq!(t14()(), ::hoy2()); - assert_eq!(t15()(&s), S::hey2(&s)); - assert_eq!(t16()(10u32, 20u32), F::f(10u32, 20u32)); - assert_eq!(t17()(30u32, 10u64), F::f(30u32, 10u64)); - assert_eq!(t18()(50u64, 5u64), F::f(50u64, 5u64)); - assert_eq!(t19()(322u64, 2u32), F::f(322u64, 2u32)); - assert_eq!(t20()(123u64, 38u32), >::staticmeth(123, 38)); - assert_eq!(t21(), Unit); - assert_eq!(t22(), None); - assert_eq!(t23(), (CEnum::A, CEnum::B)); - assert_eq!(t24(), C4); -} diff --git a/src/test/ui/run-pass/mir/mir_small_agg_arg.rs b/src/test/ui/run-pass/mir/mir_small_agg_arg.rs deleted file mode 100644 index 48eae959b4e..00000000000 --- a/src/test/ui/run-pass/mir/mir_small_agg_arg.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo((x, y): (i8, i8)) { -} - -fn main() { - foo((0, 1)); -} diff --git a/src/test/ui/run-pass/mir/mir_struct_with_assoc_ty.rs b/src/test/ui/run-pass/mir/mir_struct_with_assoc_ty.rs deleted file mode 100644 index f94b44a1eea..00000000000 --- a/src/test/ui/run-pass/mir/mir_struct_with_assoc_ty.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::marker::PhantomData; - -pub trait DataBind { - type Data; -} - -impl DataBind for Global { - type Data = T; -} - -pub struct Global(PhantomData); - -pub struct Data { - pub offsets: as DataBind>::Data, -} - -fn create_data() -> Data { - let mut d = Data { offsets: [1, 2] }; - d.offsets[0] = 3; - d -} - - -fn main() { - let d = create_data(); - assert_eq!(d.offsets[0], 3); - assert_eq!(d.offsets[1], 2); -} diff --git a/src/test/ui/run-pass/mir/mir_temp_promotions.rs b/src/test/ui/run-pass/mir/mir_temp_promotions.rs deleted file mode 100644 index ba3e85a0dcf..00000000000 --- a/src/test/ui/run-pass/mir/mir_temp_promotions.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn test1(f: f32) -> bool { - // test that we properly promote temporaries to allocas when a temporary is assigned to - // multiple times (assignment is still happening once ∀ possible dataflows). - !(f.is_nan() || f.is_infinite()) -} - -fn main() { - assert_eq!(test1(0.0), true); -} diff --git a/src/test/ui/run-pass/mir/mir_void_return.rs b/src/test/ui/run-pass/mir/mir_void_return.rs deleted file mode 100644 index c984bfd8cb1..00000000000 --- a/src/test/ui/run-pass/mir/mir_void_return.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn mir() -> (){ - let x = 1; - let mut y = 0; - while y < x { - y += 1 - } -} - -pub fn main() { - mir(); -} diff --git a/src/test/ui/run-pass/mir/mir_void_return_2.rs b/src/test/ui/run-pass/mir/mir_void_return_2.rs deleted file mode 100644 index fbe457fdd83..00000000000 --- a/src/test/ui/run-pass/mir/mir_void_return_2.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn nil() {} - -fn mir(){ - nil() -} - -pub fn main() { - mir(); -} diff --git a/src/test/ui/run-pass/modules/auxiliary/two_macros_2.rs b/src/test/ui/run-pass/modules/auxiliary/two_macros_2.rs deleted file mode 100644 index b16cd3a4210..00000000000 --- a/src/test/ui/run-pass/modules/auxiliary/two_macros_2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -macro_rules! macro_one { ($($t:tt)*) => ($($t)*) } - -macro_rules! macro_two { ($($t:tt)*) => ($($t)*) } diff --git a/src/test/ui/run-pass/modules/mod-inside-fn.rs b/src/test/ui/run-pass/modules/mod-inside-fn.rs deleted file mode 100644 index da7a3d97c10..00000000000 --- a/src/test/ui/run-pass/modules/mod-inside-fn.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn f() -> isize { - mod m { - pub fn g() -> isize { 720 } - } - - m::g() -} - -pub fn main() { - assert_eq!(f(), 720); -} diff --git a/src/test/ui/run-pass/modules/mod-view-items.rs b/src/test/ui/run-pass/modules/mod-view-items.rs deleted file mode 100644 index ecca9c7ce95..00000000000 --- a/src/test/ui/run-pass/modules/mod-view-items.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test view items inside non-file-level mods - -// This is a regression test for an issue where we were failing to -// pretty-print such view items. If that happens again, this should -// begin failing. - -// pretty-expanded FIXME #23616 - -mod m { - pub fn f() -> Vec { Vec::new() } -} - -pub fn main() { let _x = m::f(); } diff --git a/src/test/ui/run-pass/modules/mod_dir_implicit.rs b/src/test/ui/run-pass/modules/mod_dir_implicit.rs deleted file mode 100644 index e9a1d6cfa29..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_implicit.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -mod mod_dir_implicit_aux; - -pub fn main() { - assert_eq!(mod_dir_implicit_aux::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_dir_implicit_aux/compiletest-ignore-dir b/src/test/ui/run-pass/modules/mod_dir_implicit_aux/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/modules/mod_dir_implicit_aux/mod.rs b/src/test/ui/run-pass/modules/mod_dir_implicit_aux/mod.rs deleted file mode 100644 index 8687b33cac3..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_implicit_aux/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn foo() -> isize { 10 } diff --git a/src/test/ui/run-pass/modules/mod_dir_path.rs b/src/test/ui/run-pass/modules/mod_dir_path.rs deleted file mode 100644 index d614b2fb860..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_path.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -mod mod_dir_simple { - #[path = "test.rs"] - pub mod syrup; -} - -pub fn main() { - assert_eq!(mod_dir_simple::syrup::foo(), 10); - - #[path = "auxiliary"] - mod foo { - mod two_macros_2; - } - - #[path = "auxiliary"] - mod bar { - macro_rules! m { () => { mod two_macros_2; } } - m!(); - } -} diff --git a/src/test/ui/run-pass/modules/mod_dir_path2.rs b/src/test/ui/run-pass/modules/mod_dir_path2.rs deleted file mode 100644 index 9b116d534d9..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_path2.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -#[path = "mod_dir_simple"] -mod pancakes { - #[path = "test.rs"] - pub mod syrup; -} - -pub fn main() { - assert_eq!(pancakes::syrup::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_dir_path3.rs b/src/test/ui/run-pass/modules/mod_dir_path3.rs deleted file mode 100644 index 5bdf2ca2e59..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_path3.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -#[path = "mod_dir_simple"] -mod pancakes { - pub mod test; -} - -pub fn main() { - assert_eq!(pancakes::test::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_dir_path_multi.rs b/src/test/ui/run-pass/modules/mod_dir_path_multi.rs deleted file mode 100644 index e6a22c21cbc..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_path_multi.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -#[path = "mod_dir_simple"] -mod biscuits { - pub mod test; -} - -#[path = "mod_dir_simple"] -mod gravy { - pub mod test; -} - -pub fn main() { - assert_eq!(biscuits::test::foo(), 10); - assert_eq!(gravy::test::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_dir_recursive.rs b/src/test/ui/run-pass/modules/mod_dir_recursive.rs deleted file mode 100644 index 88dc845bcb5..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_recursive.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -// Testing that the parser for each file tracks its modules -// and paths independently. The load_another_mod module should -// not try to reuse the 'mod_dir_simple' path. - -mod mod_dir_simple { - pub mod load_another_mod; -} - -pub fn main() { - assert_eq!(mod_dir_simple::load_another_mod::test::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_dir_simple.rs b/src/test/ui/run-pass/modules/mod_dir_simple.rs deleted file mode 100644 index cb45b3cadaf..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_simple.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -mod mod_dir_simple { - pub mod test; -} - -pub fn main() { - assert_eq!(mod_dir_simple::test::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_dir_simple/compiletest-ignore-dir b/src/test/ui/run-pass/modules/mod_dir_simple/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/modules/mod_dir_simple/load_another_mod.rs b/src/test/ui/run-pass/modules/mod_dir_simple/load_another_mod.rs deleted file mode 100644 index 40717782b92..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_simple/load_another_mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[path = "test.rs"] -pub mod test; diff --git a/src/test/ui/run-pass/modules/mod_dir_simple/test.rs b/src/test/ui/run-pass/modules/mod_dir_simple/test.rs deleted file mode 100644 index 8687b33cac3..00000000000 --- a/src/test/ui/run-pass/modules/mod_dir_simple/test.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn foo() -> isize { 10 } diff --git a/src/test/ui/run-pass/modules/mod_file.rs b/src/test/ui/run-pass/modules/mod_file.rs deleted file mode 100644 index 26bf83ca5a4..00000000000 --- a/src/test/ui/run-pass/modules/mod_file.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -// Testing that a plain .rs file can load modules from other source files - -mod mod_file_aux; - -pub fn main() { - assert_eq!(mod_file_aux::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/mod_file_aux.rs b/src/test/ui/run-pass/modules/mod_file_aux.rs deleted file mode 100644 index a7810a3cae1..00000000000 --- a/src/test/ui/run-pass/modules/mod_file_aux.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-test Not a test. Used by other tests - -pub fn foo() -> isize { 10 } diff --git a/src/test/ui/run-pass/modules/mod_file_with_path_attr.rs b/src/test/ui/run-pass/modules/mod_file_with_path_attr.rs deleted file mode 100644 index ede610bcfad..00000000000 --- a/src/test/ui/run-pass/modules/mod_file_with_path_attr.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty issue #37195 - -// Testing that a plain .rs file can load modules from other source files - -#[path = "mod_file_aux.rs"] -mod m; - -pub fn main() { - assert_eq!(m::foo(), 10); -} diff --git a/src/test/ui/run-pass/modules/module-polymorphism3-files/compiletest-ignore-dir b/src/test/ui/run-pass/modules/module-polymorphism3-files/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs b/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs deleted file mode 100644 index 2242daa2d80..00000000000 --- a/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f32.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub type T = f32; diff --git a/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs b/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs deleted file mode 100644 index 543d672b0ab..00000000000 --- a/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_f64.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub type T = f64; diff --git a/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs b/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs deleted file mode 100644 index 7151796c8ec..00000000000 --- a/src/test/ui/run-pass/modules/module-polymorphism3-files/float-template/inst_float.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub type T = float; diff --git a/src/test/ui/run-pass/moves/move-1-unique.rs b/src/test/ui/run-pass/moves/move-1-unique.rs deleted file mode 100644 index 1557f13b10d..00000000000 --- a/src/test/ui/run-pass/moves/move-1-unique.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -#[derive(Clone)] -struct Triple { - x: isize, - y: isize, - z: isize, -} - -fn test(x: bool, foo: Box) -> isize { - let bar = foo; - let mut y: Box; - if x { y = bar; } else { y = box Triple{x: 4, y: 5, z: 6}; } - return y.y; -} - -pub fn main() { - let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; - assert_eq!(test(true, x.clone()), 2); - assert_eq!(test(true, x.clone()), 2); - assert_eq!(test(true, x.clone()), 2); - assert_eq!(test(false, x), 5); -} diff --git a/src/test/ui/run-pass/moves/move-2-unique.rs b/src/test/ui/run-pass/moves/move-2-unique.rs deleted file mode 100644 index 270a5990496..00000000000 --- a/src/test/ui/run-pass/moves/move-2-unique.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct X { x: isize, y: isize, z: isize } - -pub fn main() { - let x: Box<_> = box X{x: 1, y: 2, z: 3}; - let y = x; - assert_eq!(y.y, 2); -} diff --git a/src/test/ui/run-pass/moves/move-2.rs b/src/test/ui/run-pass/moves/move-2.rs deleted file mode 100644 index 9207c71e083..00000000000 --- a/src/test/ui/run-pass/moves/move-2.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct X { x: isize, y: isize, z: isize } - -pub fn main() { let x: Box<_> = box X {x: 1, y: 2, z: 3}; let y = x; assert_eq!(y.y, 2); } diff --git a/src/test/ui/run-pass/moves/move-3-unique.rs b/src/test/ui/run-pass/moves/move-3-unique.rs deleted file mode 100644 index 6f86674104c..00000000000 --- a/src/test/ui/run-pass/moves/move-3-unique.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -#[derive(Clone)] -struct Triple { - x: isize, - y: isize, - z: isize, -} - -fn test(x: bool, foo: Box) -> isize { - let bar = foo; - let mut y: Box; - if x { y = bar; } else { y = box Triple {x: 4, y: 5, z: 6}; } - return y.y; -} - -pub fn main() { - let x: Box<_> = box Triple{x: 1, y: 2, z: 3}; - for _ in 0_usize..10000_usize { - assert_eq!(test(true, x.clone()), 2); - } - assert_eq!(test(false, x), 5); -} diff --git a/src/test/ui/run-pass/moves/move-4-unique.rs b/src/test/ui/run-pass/moves/move-4-unique.rs deleted file mode 100644 index 0876f37fd2d..00000000000 --- a/src/test/ui/run-pass/moves/move-4-unique.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Triple {a: isize, b: isize, c: isize} - -fn test(foo: Box) -> Box { - let foo = foo; - let bar = foo; - let baz = bar; - let quux = baz; - return quux; -} - -pub fn main() { - let x = box Triple{a: 1, b: 2, c: 3}; - let y = test(x); - assert_eq!(y.c, 3); -} diff --git a/src/test/ui/run-pass/moves/move-4.rs b/src/test/ui/run-pass/moves/move-4.rs deleted file mode 100644 index 61dcc08805b..00000000000 --- a/src/test/ui/run-pass/moves/move-4.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Triple { a: isize, b: isize, c: isize } - -fn test(foo: Box) -> Box { - let foo = foo; - let bar = foo; - let baz = bar; - let quux = baz; - return quux; -} - -pub fn main() { - let x = box Triple{a: 1, b: 2, c: 3}; - let y = test(x); - assert_eq!(y.c, 3); -} diff --git a/src/test/ui/run-pass/moves/move-arg-2-unique.rs b/src/test/ui/run-pass/moves/move-arg-2-unique.rs deleted file mode 100644 index 279b6d49358..00000000000 --- a/src/test/ui/run-pass/moves/move-arg-2-unique.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn test(foo: Box> ) { assert_eq!((*foo)[0], 10); } - -pub fn main() { - let x = box vec![10]; - // Test forgetting a local by move-in - test(x); - - // Test forgetting a temporary by move-in. - test(box vec![10]); -} diff --git a/src/test/ui/run-pass/moves/move-arg-2.rs b/src/test/ui/run-pass/moves/move-arg-2.rs deleted file mode 100644 index a813d7ec922..00000000000 --- a/src/test/ui/run-pass/moves/move-arg-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn test(foo: Box>) { assert_eq!((*foo)[0], 10); } - -pub fn main() { - let x = box vec![10]; - // Test forgetting a local by move-in - test(x); - - // Test forgetting a temporary by move-in. - test(box vec![10]); -} diff --git a/src/test/ui/run-pass/moves/move-arg.rs b/src/test/ui/run-pass/moves/move-arg.rs deleted file mode 100644 index 1fa10fe48b4..00000000000 --- a/src/test/ui/run-pass/moves/move-arg.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn test(foo: isize) { assert_eq!(foo, 10); } - -pub fn main() { let x = 10; test(x); } diff --git a/src/test/ui/run-pass/moves/move-nullary-fn.rs b/src/test/ui/run-pass/moves/move-nullary-fn.rs deleted file mode 100644 index b737c8c066c..00000000000 --- a/src/test/ui/run-pass/moves/move-nullary-fn.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #922 -// pretty-expanded FIXME #23616 - -fn f2(_thing: F) where F: FnOnce() { } - -fn f(thing: F) where F: FnOnce() { - f2(thing); -} - -pub fn main() { - f(|| {}); -} diff --git a/src/test/ui/run-pass/moves/move-out-of-field.rs b/src/test/ui/run-pass/moves/move-out-of-field.rs deleted file mode 100644 index 8c91c524f26..00000000000 --- a/src/test/ui/run-pass/moves/move-out-of-field.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::string::String; - -struct StringBuffer { - s: String, -} - -impl StringBuffer { - pub fn append(&mut self, v: &str) { - self.s.push_str(v); - } -} - -fn to_string(sb: StringBuffer) -> String { - sb.s -} - -pub fn main() { - let mut sb = StringBuffer { - s: String::new(), - }; - sb.append("Hello, "); - sb.append("World!"); - let str = to_string(sb); - assert_eq!(str, "Hello, World!"); -} diff --git a/src/test/ui/run-pass/moves/move-scalar.rs b/src/test/ui/run-pass/moves/move-scalar.rs deleted file mode 100644 index c72be92654c..00000000000 --- a/src/test/ui/run-pass/moves/move-scalar.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - - let y: isize = 42; - let mut x: isize; - x = y; - assert_eq!(x, 42); -} diff --git a/src/test/ui/run-pass/moves/moves-based-on-type-capture-clause.rs b/src/test/ui/run-pass/moves/moves-based-on-type-capture-clause.rs deleted file mode 100644 index 857bf7ff260..00000000000 --- a/src/test/ui/run-pass/moves/moves-based-on-type-capture-clause.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -pub fn main() { - let x = "Hello world!".to_string(); - thread::spawn(move|| { - println!("{}", x); - }).join(); -} diff --git a/src/test/ui/run-pass/nll/issue-47153-generic-const.rs b/src/test/ui/run-pass/nll/issue-47153-generic-const.rs deleted file mode 100644 index ac41179bcac..00000000000 --- a/src/test/ui/run-pass/nll/issue-47153-generic-const.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Regression test for #47153: constants in a generic context (such as -// a trait) used to ICE. - -#![feature(nll)] -#![allow(warnings)] - -trait Foo { - const B: bool = true; -} - -struct Bar { x: T } - -impl Bar { - const B: bool = true; -} - -fn main() { } diff --git a/src/test/ui/run-pass/nll/issue-47589.rs b/src/test/ui/run-pass/nll/issue-47589.rs deleted file mode 100644 index f960cfd7fb3..00000000000 --- a/src/test/ui/run-pass/nll/issue-47589.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] - -pub struct DescriptorSet<'a> { - pub slots: Vec> -} - -pub trait ResourcesTrait<'r>: Sized { - type DescriptorSet: 'r; -} - -pub struct Resources; - -impl<'a> ResourcesTrait<'a> for Resources { - type DescriptorSet = DescriptorSet<'a>; -} - -pub enum AttachInfo<'a, R: ResourcesTrait<'a>> { - NextDescriptorSet(Box) -} - -fn main() { - let _x = DescriptorSet {slots: Vec::new()}; -} diff --git a/src/test/ui/run-pass/nll/issue-48623-closure.rs b/src/test/ui/run-pass/nll/issue-48623-closure.rs deleted file mode 100644 index 312aa6d577a..00000000000 --- a/src/test/ui/run-pass/nll/issue-48623-closure.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] - -struct WithDrop; - -impl Drop for WithDrop { - fn drop(&mut self) {} -} - -fn reborrow_from_closure(r: &mut ()) -> &mut () { - let d = WithDrop; - (move || { d; &mut *r })() -} - -fn main() {} diff --git a/src/test/ui/run-pass/nll/issue-48623-generator.rs b/src/test/ui/run-pass/nll/issue-48623-generator.rs deleted file mode 100644 index 24b25c4db16..00000000000 --- a/src/test/ui/run-pass/nll/issue-48623-generator.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] -#![feature(generators, generator_trait)] - -struct WithDrop; - -impl Drop for WithDrop { - fn drop(&mut self) {} -} - -fn reborrow_from_generator(r: &mut ()) { - let d = WithDrop; - move || { d; yield; &mut *r }; -} - -fn main() {} diff --git a/src/test/ui/run-pass/nll/issue-50343.rs b/src/test/ui/run-pass/nll/issue-50343.rs deleted file mode 100644 index f33baa288fa..00000000000 --- a/src/test/ui/run-pass/nll/issue-50343.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] -#![deny(unused_mut)] - -fn main() { - vec![42].iter().map(|_| ()).count(); - vec![(42, 22)].iter().map(|(_x, _y)| ()).count(); -} diff --git a/src/test/ui/run-pass/nll/issue-50461-used-mut-from-moves.rs b/src/test/ui/run-pass/nll/issue-50461-used-mut-from-moves.rs deleted file mode 100644 index 3e40b527ef4..00000000000 --- a/src/test/ui/run-pass/nll/issue-50461-used-mut-from-moves.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] -#![deny(unused_mut)] - -struct Foo { - pub value: i32 -} - -fn use_foo_mut(mut foo: Foo) { - foo = foo; - println!("{}", foo.value); -} - -fn main() { - use_foo_mut(Foo { value: 413 }); -} diff --git a/src/test/ui/run-pass/nll/issue-53123-raw-pointer-cast.rs b/src/test/ui/run-pass/nll/issue-53123-raw-pointer-cast.rs deleted file mode 100644 index 781dded6272..00000000000 --- a/src/test/ui/run-pass/nll/issue-53123-raw-pointer-cast.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] -#![allow(unused_variables)] - -pub trait TryTransform { - fn try_transform(self, f: F) - where - Self: Sized, - F: FnOnce(Self); -} - -impl<'a, T> TryTransform for &'a mut T { - fn try_transform(self, f: F) - where - // The bug was that `Self: Sized` caused the lifetime of `this` to "extend" for all - // of 'a instead of only lasting as long as the binding is used (for just that line). - Self: Sized, - F: FnOnce(Self), - { - let this: *mut T = self as *mut T; - f(self); - } -} - -fn main() { -} diff --git a/src/test/ui/run-pass/nll/mutating_references.rs b/src/test/ui/run-pass/nll/mutating_references.rs deleted file mode 100644 index 1cf9e3aae90..00000000000 --- a/src/test/ui/run-pass/nll/mutating_references.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] - -struct List { - value: T, - next: Option>>, -} - -fn to_refs(mut list: &mut List) -> Vec<&mut T> { - let mut result = vec![]; - loop { - result.push(&mut list.value); - if let Some(n) = list.next.as_mut() { - list = n; - } else { - return result; - } - } -} - -fn main() { - let mut list = List { value: 1, next: None }; - let vec = to_refs(&mut list); - assert_eq!(vec![&mut 1], vec); -} diff --git a/src/test/ui/run-pass/nll/process_or_insert_default.rs b/src/test/ui/run-pass/nll/process_or_insert_default.rs deleted file mode 100644 index 57fbfb642ea..00000000000 --- a/src/test/ui/run-pass/nll/process_or_insert_default.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(nll)] - -use std::collections::HashMap; - -fn process_or_insert_default(map: &mut HashMap, key: usize) { - match map.get_mut(&key) { - Some(value) => { - process(value); - } - None => { - map.insert(key, "".to_string()); - } - } -} - -fn process(x: &str) { - assert_eq!(x, "Hello, world"); -} - -fn main() { - let map = &mut HashMap::new(); - map.insert(22, format!("Hello, world")); - map.insert(44, format!("Goodbye, world")); - process_or_insert_default(map, 22); - process_or_insert_default(map, 66); - assert_eq!(map[&66], ""); -} diff --git a/src/test/ui/run-pass/nll/rc-loop.rs b/src/test/ui/run-pass/nll/rc-loop.rs deleted file mode 100644 index 420f09707f1..00000000000 --- a/src/test/ui/run-pass/nll/rc-loop.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// A test for something that NLL enables. It sometimes happens that -// the `while let` pattern makes some borrows from a variable (in this -// case, `x`) that you need in order to compute the next value for -// `x`. The lexical checker makes this very painful. The NLL checker -// does not. - -#![feature(nll)] - -use std::rc::Rc; - -#[derive(Debug, PartialEq, Eq)] -enum Foo { - Base(usize), - Next(Rc), -} - -fn find_base(mut x: Rc) -> Rc { - while let Foo::Next(n) = &*x { - x = n.clone(); - } - x -} - -fn main() { - let chain = Rc::new(Foo::Next(Rc::new(Foo::Base(44)))); - let base = find_base(chain); - assert_eq!(&*base, &Foo::Base(44)); -} - diff --git a/src/test/ui/run-pass/non_modrs_mods/foors_mod.rs b/src/test/ui/run-pass/non_modrs_mods/foors_mod.rs deleted file mode 100644 index 7d37c6d9399..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/foors_mod.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. -// -// ignore-test: not a test, used by non_modrs_mods.rs - -pub mod inner_modrs_mod; -pub mod inner_foors_mod; diff --git a/src/test/ui/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir b/src/test/ui/run-pass/non_modrs_mods/foors_mod/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs b/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs deleted file mode 100644 index 77cab972352..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod innest; diff --git a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs b/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs deleted file mode 100644 index b61667cfd88..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_foors_mod/innest.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() {} diff --git a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs b/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs deleted file mode 100644 index b61667cfd88..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/innest.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() {} diff --git a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs b/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs deleted file mode 100644 index 77cab972352..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/foors_mod/inner_modrs_mod/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod innest; diff --git a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir b/src/test/ui/run-pass/non_modrs_mods/modrs_mod/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs b/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs deleted file mode 100644 index 77cab972352..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod innest; diff --git a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs b/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs deleted file mode 100644 index b61667cfd88..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_foors_mod/innest.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() {} diff --git a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs b/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs deleted file mode 100644 index b61667cfd88..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/innest.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() {} diff --git a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs b/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs deleted file mode 100644 index 77cab972352..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/inner_modrs_mod/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod innest; diff --git a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/mod.rs b/src/test/ui/run-pass/non_modrs_mods/modrs_mod/mod.rs deleted file mode 100644 index 9e3f10f12ed..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/modrs_mod/mod.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod inner_modrs_mod; -pub mod inner_foors_mod; diff --git a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs b/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs deleted file mode 100644 index 226e6fda0a4..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/arbitrary_name.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod inner_modrs_mod; diff --git a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir b/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/compiletest-ignore-dir deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs b/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs deleted file mode 100644 index b61667cfd88..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/innest.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub fn foo() {} diff --git a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs b/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs deleted file mode 100644 index 77cab972352..00000000000 --- a/src/test/ui/run-pass/non_modrs_mods/some_crazy_attr_mod_dir/inner_modrs_mod/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod innest; diff --git a/src/test/ui/run-pass/numbers-arithmetic/arith-0.rs b/src/test/ui/run-pass/numbers-arithmetic/arith-0.rs deleted file mode 100644 index 4d432cd5b4e..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/arith-0.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let a: isize = 10; - println!("{}", a); - assert_eq!(a * (a - 1), 90); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/arith-1.rs b/src/test/ui/run-pass/numbers-arithmetic/arith-1.rs deleted file mode 100644 index b78b359ced0..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/arith-1.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let i32_a: isize = 10; - assert_eq!(i32_a, 10); - assert_eq!(i32_a - 10, 0); - assert_eq!(i32_a / 10, 1); - assert_eq!(i32_a - 20, -10); - assert_eq!(i32_a << 10, 10240); - assert_eq!(i32_a << 16, 655360); - assert_eq!(i32_a * 16, 160); - assert_eq!(i32_a * i32_a * i32_a, 1000); - assert_eq!(i32_a * i32_a * i32_a * i32_a, 10000); - assert_eq!(i32_a * i32_a / i32_a * i32_a, 100); - assert_eq!(i32_a * (i32_a - 1) << (2 + i32_a as usize), 368640); - let i32_b: isize = 0x10101010; - assert_eq!(i32_b + 1 - 1, i32_b); - assert_eq!(i32_b << 1, i32_b << 1); - assert_eq!(i32_b >> 1, i32_b >> 1); - assert_eq!(i32_b & i32_b << 1, 0); - println!("{}", i32_b | i32_b << 1); - assert_eq!(i32_b | i32_b << 1, 0x30303030); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/arith-2.rs b/src/test/ui/run-pass/numbers-arithmetic/arith-2.rs deleted file mode 100644 index 91e207c2b2f..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/arith-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let i32_c: isize = 0x10101010; - assert_eq!(i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3), - i32_c + i32_c * 2 / 3 * 2 + (i32_c - 7 % 3)); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/arith-unsigned.rs b/src/test/ui/run-pass/numbers-arithmetic/arith-unsigned.rs deleted file mode 100644 index dc672d50d7f..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/arith-unsigned.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_comparisons)] - -// Unsigned integer operations -pub fn main() { - assert!((0u8 < 255u8)); - assert!((0u8 <= 255u8)); - assert!((255u8 > 0u8)); - assert!((255u8 >= 0u8)); - assert_eq!(250u8 / 10u8, 25u8); - assert_eq!(255u8 % 10u8, 5u8); - assert!((0u16 < 60000u16)); - assert!((0u16 <= 60000u16)); - assert!((60000u16 > 0u16)); - assert!((60000u16 >= 0u16)); - assert_eq!(60000u16 / 10u16, 6000u16); - assert_eq!(60005u16 % 10u16, 5u16); - assert!((0u32 < 4000000000u32)); - assert!((0u32 <= 4000000000u32)); - assert!((4000000000u32 > 0u32)); - assert!((4000000000u32 >= 0u32)); - assert_eq!(4000000000u32 / 10u32, 400000000u32); - assert_eq!(4000000005u32 % 10u32, 5u32); - // 64-bit numbers have some flakiness yet. Not tested - -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/div-mod.rs b/src/test/ui/run-pass/numbers-arithmetic/div-mod.rs deleted file mode 100644 index d04638f790b..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/div-mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -pub fn main() { - let x: isize = 15; - let y: isize = 5; - assert_eq!(x / 5, 3); - assert_eq!(x / 4, 3); - assert_eq!(x / 3, 5); - assert_eq!(x / y, 3); - assert_eq!(15 / y, 3); - assert_eq!(x % 5, 0); - assert_eq!(x % 4, 3); - assert_eq!(x % 3, 0); - assert_eq!(x % y, 0); - assert_eq!(15 % y, 0); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs b/src/test/ui/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs deleted file mode 100644 index 97f5f39a9e5..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float-int-invalid-const-cast.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no i128 support - -#![deny(const_err)] - -use std::{f32, f64}; - -// Forces evaluation of constants, triggering hard error -fn force(_: T) {} - -fn main() { - { const X: u16 = -1. as u16; force(X); } - { const X: u128 = -100. as u128; force(X); } - - { const X: i8 = f32::NAN as i8; force(X); } - { const X: i32 = f32::NAN as i32; force(X); } - { const X: u64 = f32::NAN as u64; force(X); } - { const X: u128 = f32::NAN as u128; force(X); } - - { const X: i8 = f32::INFINITY as i8; force(X); } - { const X: u32 = f32::INFINITY as u32; force(X); } - { const X: i128 = f32::INFINITY as i128; force(X); } - { const X: u128 = f32::INFINITY as u128; force(X); } - - { const X: u8 = f32::NEG_INFINITY as u8; force(X); } - { const X: u16 = f32::NEG_INFINITY as u16; force(X); } - { const X: i64 = f32::NEG_INFINITY as i64; force(X); } - { const X: i128 = f32::NEG_INFINITY as i128; force(X); } - - { const X: i8 = f64::NAN as i8; force(X); } - { const X: i32 = f64::NAN as i32; force(X); } - { const X: u64 = f64::NAN as u64; force(X); } - { const X: u128 = f64::NAN as u128; force(X); } - - { const X: i8 = f64::INFINITY as i8; force(X); } - { const X: u32 = f64::INFINITY as u32; force(X); } - { const X: i128 = f64::INFINITY as i128; force(X); } - { const X: u128 = f64::INFINITY as u128; force(X); } - - { const X: u8 = f64::NEG_INFINITY as u8; force(X); } - { const X: u16 = f64::NEG_INFINITY as u16; force(X); } - { const X: i64 = f64::NEG_INFINITY as i64; force(X); } - { const X: i128 = f64::NEG_INFINITY as i128; force(X); } - - { const X: u8 = 256. as u8; force(X); } - { const X: i8 = -129. as i8; force(X); } - { const X: i8 = 128. as i8; force(X); } - { const X: i32 = 2147483648. as i32; force(X); } - { const X: i32 = -2147483904. as i32; force(X); } - { const X: u32 = 4294967296. as u32; force(X); } - { const X: u128 = 1e40 as u128; force(X); } - { const X: i128 = 1e40 as i128; force(X); } -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float-literal-inference.rs b/src/test/ui/run-pass/numbers-arithmetic/float-literal-inference.rs deleted file mode 100644 index e3e724cbe77..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float-literal-inference.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S { - z: f64 -} - -pub fn main() { - let x: f32 = 4.0; - println!("{}", x); - let y: f64 = 64.0; - println!("{}", y); - let z = S { z: 1.0 }; - println!("{}", z.z); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float-nan.rs b/src/test/ui/run-pass/numbers-arithmetic/float-nan.rs deleted file mode 100644 index 7725859eec6..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float-nan.rs +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::f64; - -pub fn main() { - let nan: f64 = f64::NAN; - assert!((nan).is_nan()); - - let inf: f64 = f64::INFINITY; - let neg_inf: f64 = -f64::INFINITY; - assert_eq!(-inf, neg_inf); - - assert!( nan != nan); - assert!( nan != -nan); - assert!(-nan != -nan); - assert!(-nan != nan); - - assert!( nan != 1.); - assert!( nan != 0.); - assert!( nan != inf); - assert!( nan != -inf); - - assert!( 1. != nan); - assert!( 0. != nan); - assert!( inf != nan); - assert!(-inf != nan); - - assert!(!( nan == nan)); - assert!(!( nan == -nan)); - assert!(!( nan == 1.)); - assert!(!( nan == 0.)); - assert!(!( nan == inf)); - assert!(!( nan == -inf)); - assert!(!( 1. == nan)); - assert!(!( 0. == nan)); - assert!(!( inf == nan)); - assert!(!(-inf == nan)); - assert!(!(-nan == nan)); - assert!(!(-nan == -nan)); - - assert!(!( nan > nan)); - assert!(!( nan > -nan)); - assert!(!( nan > 0.)); - assert!(!( nan > inf)); - assert!(!( nan > -inf)); - assert!(!( 0. > nan)); - assert!(!( inf > nan)); - assert!(!(-inf > nan)); - assert!(!(-nan > nan)); - - assert!(!(nan < 0.)); - assert!(!(nan < 1.)); - assert!(!(nan < -1.)); - assert!(!(nan < inf)); - assert!(!(nan < -inf)); - assert!(!(nan < nan)); - assert!(!(nan < -nan)); - - assert!(!( 0. < nan)); - assert!(!( 1. < nan)); - assert!(!( -1. < nan)); - assert!(!( inf < nan)); - assert!(!(-inf < nan)); - assert!(!(-nan < nan)); - - assert!((nan + inf).is_nan()); - assert!((nan + -inf).is_nan()); - assert!((nan + 0.).is_nan()); - assert!((nan + 1.).is_nan()); - assert!((nan * 1.).is_nan()); - assert!((nan / 1.).is_nan()); - assert!((nan / 0.).is_nan()); - assert!((0.0/0.0f64).is_nan()); - assert!((-inf + inf).is_nan()); - assert!((inf - inf).is_nan()); - - assert!(!(-1.0f64).is_nan()); - assert!(!(0.0f64).is_nan()); - assert!(!(0.1f64).is_nan()); - assert!(!(1.0f64).is_nan()); - assert!(!(inf).is_nan()); - assert!(!(-inf).is_nan()); - assert!(!(1./-inf).is_nan()); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float-signature.rs b/src/test/ui/run-pass/numbers-arithmetic/float-signature.rs deleted file mode 100644 index 12a25aa6e8e..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float-signature.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - fn foo(n: f64) -> f64 { return n + 0.12345; } - let n: f64 = 0.1; - let m: f64 = foo(n); - println!("{}", m); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float.rs b/src/test/ui/run-pass/numbers-arithmetic/float.rs deleted file mode 100644 index 597b4630683..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let pi = 3.1415927f64; - println!("{}", -pi * (pi + 2.0 / pi) - pi * 5.0); - if pi == 5.0 || pi < 10.0 || pi <= 2.0 || pi != 22.0 / 7.0 || pi >= 10.0 - || pi > 1.0 { - println!("yes"); - } -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float2.rs b/src/test/ui/run-pass/numbers-arithmetic/float2.rs deleted file mode 100644 index 70c7c600f40..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float2.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let a = 1.5e6f64; - let b = 1.5E6f64; - let c = 1e6f64; - let d = 1E6f64; - let e = 3.0f32; - let f = 5.9f64; - let g = 1e6f32; - let h = 1.0e7f64; - let i = 1.0E7f64; - let j = 3.1e+9f64; - let k = 3.2e-10f64; - assert_eq!(a, b); - assert!((c < b)); - assert_eq!(c, d); - assert!((e < g)); - assert!((f < h)); - assert_eq!(g, 1000000.0f32); - assert_eq!(h, i); - assert!((j > k)); - assert!((k < a)); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/float_math.rs b/src/test/ui/run-pass/numbers-arithmetic/float_math.rs deleted file mode 100644 index d86ad34c9d8..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/float_math.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(core_intrinsics)] - -use std::intrinsics::{fadd_fast, fsub_fast, fmul_fast, fdiv_fast, frem_fast}; - -#[inline(never)] -pub fn test_operations(a: f64, b: f64) { - // make sure they all map to the correct operation - unsafe { - assert_eq!(fadd_fast(a, b), a + b); - assert_eq!(fsub_fast(a, b), a - b); - assert_eq!(fmul_fast(a, b), a * b); - assert_eq!(fdiv_fast(a, b), a / b); - assert_eq!(frem_fast(a, b), a % b); - } -} - -fn main() { - test_operations(1., 2.); - test_operations(10., 5.); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/floatlits.rs b/src/test/ui/run-pass/numbers-arithmetic/floatlits.rs deleted file mode 100644 index 34f52ccb33a..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/floatlits.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -pub fn main() { - let f = 4.999999999999f64; - assert!((f > 4.90f64)); - assert!((f < 5.0f64)); - let g = 4.90000000001e-10f64; - assert!((g > 5e-11f64)); - assert!((g < 5e-9f64)); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/i128-ffi.rs b/src/test/ui/run-pass/numbers-arithmetic/i128-ffi.rs deleted file mode 100644 index 747a05f6062..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/i128-ffi.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(improper_ctypes)] - -// MSVC doesn't support 128 bit integers, and other Windows -// C compilers have very inconsistent views on how the ABI -// should look like. - -// ignore-windows -// ignore-32bit - -#[link(name = "rust_test_helpers", kind = "static")] -extern "C" { - fn identity(f: u128) -> u128; - fn square(f: i128) -> i128; - fn sub(f: i128, f: i128) -> i128; -} - -fn main() { - unsafe { - let a = 0x734C_C2F2_A521; - let b = 0x33EE_0E2A_54E2_59DA_A0E7_8E41; - let b_out = identity(b); - assert_eq!(b, b_out); - let a_square = square(a); - assert_eq!(b, a_square as u128); - let k = 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; - let k_d = 0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420; - let k_out = sub(k_d, k); - assert_eq!(k, k_out); - } -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/i128.rs b/src/test/ui/run-pass/numbers-arithmetic/i128.rs deleted file mode 100644 index c3d4a638290..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/i128.rs +++ /dev/null @@ -1,121 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -// ignore-emscripten i128 doesn't work - -// compile-flags: -Z borrowck=compare - -#![feature(test)] - -extern crate test; -use test::black_box as b; - -fn main() { - let x: i128 = -1; - assert_eq!(0, !x); - let y: i128 = -2; - assert_eq!(!1, y); - let z: i128 = 0xABCD_EF; - assert_eq!(z * z, 0x734C_C2F2_A521); - assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); - assert_eq!(-z * -z, 0x734C_C2F2_A521); - assert_eq!(-z * -z * -z * -z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); - assert_eq!(-z + -z + -z + -z, -0x2AF3_7BC); - let k: i128 = -0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; - assert_eq!(k + k, -0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); - assert_eq!(0, k - k); - assert_eq!(-0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k + z); - assert_eq!(-0x1000_0000_0000_0000_0000_0000_0000_000, - k + 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!(-0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); - assert_eq!(-k, k / -1); - assert_eq!(-0x91A2_B3C4_D5E6_F8, k >> 65); - assert_eq!(-0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); - assert!(k < z); - assert!(y > k); - assert!(y < x); - assert_eq!(x as i64, -1); - assert_eq!(z as i64, 0xABCD_EF); - assert_eq!(k as i64, -0xFEDC_BA98_7654_3210); - assert_eq!(k as u128, 0xFEDC_BA98_7654_3210_0123_4567_89AB_CDF0); - assert_eq!(-k as u128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!((-z as f64) as i128, -z); - assert_eq!((-z as f32) as i128, -z); - assert_eq!((-z as f64 * 16.0) as i128, -z * 16); - assert_eq!((-z as f32 * 16.0) as i128, -z * 16); - // Same stuff as above, but blackboxed, to force use of intrinsics - let x: i128 = b(-1); - assert_eq!(0, !x); - let y: i128 = b(-2); - assert_eq!(!1, y); - let z: i128 = b(0xABCD_EF); - assert_eq!(z * z, 0x734C_C2F2_A521); - assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); - assert_eq!(-z * -z, 0x734C_C2F2_A521); - assert_eq!(-z * -z * -z * -z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); - assert_eq!(-z + -z + -z + -z, -0x2AF3_7BC); - let k: i128 = b(-0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!(k + k, -0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); - assert_eq!(0, k - k); - assert_eq!(-0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k + z); - assert_eq!(-0x1000_0000_0000_0000_0000_0000_0000_000, - k + 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!(-0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); - assert_eq!(-k, k / -1); - assert_eq!(-0x91A2_B3C4_D5E6_F8, k >> 65); - assert_eq!(-0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); - assert!(k < z); - assert!(y > k); - assert!(y < x); - assert_eq!(x as i64, -1); - assert_eq!(z as i64, 0xABCD_EF); - assert_eq!(k as i64, -0xFEDC_BA98_7654_3210); - assert_eq!(k as u128, 0xFEDC_BA98_7654_3210_0123_4567_89AB_CDF0); - assert_eq!(-k as u128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!((-z as f64) as i128, -z); - assert_eq!((-z as f32) as i128, -z); - assert_eq!((-z as f64 * 16.0) as i128, -z * 16); - assert_eq!((-z as f32 * 16.0) as i128, -z * 16); - // formatting - let j: i128 = -(1 << 67); - assert_eq!("-147573952589676412928", format!("{}", j)); - assert_eq!("fffffffffffffff80000000000000000", format!("{:x}", j)); - assert_eq!("3777777777777777777760000000000000000000000", format!("{:o}", j)); - assert_eq!("1111111111111111111111111111111111111111111111111111111111111\ - 0000000000000000000000000000000000000000000000000000000000000000000", - format!("{:b}", j)); - assert_eq!("-147573952589676412928", format!("{:?}", j)); - // common traits - assert_eq!(x, b(x.clone())); - // overflow checks - assert_eq!((-z).checked_mul(-z), Some(0x734C_C2F2_A521)); - assert_eq!((z).checked_mul(z), Some(0x734C_C2F2_A521)); - assert_eq!((k).checked_mul(k), None); - let l: i128 = b(i128::min_value()); - let o: i128 = b(17); - assert_eq!(l.checked_sub(b(2)), None); - assert_eq!(l.checked_add(l), None); - assert_eq!((-(l + 1)).checked_add(2), None); - assert_eq!(l.checked_sub(l), Some(0)); - assert_eq!(b(1u128).checked_shl(b(127)), Some(1 << 127)); - assert_eq!(o.checked_shl(b(128)), None); - - // https://github.com/rust-lang/rust/issues/41228 - assert_eq!(b(-87559967289969187895646876466835277875_i128) / - b(84285771033834995895337664386045050880_i128), - -1i128); - - // iter-arithmetic traits - assert_eq!(10i128, [1i128, 2, 3, 4].iter().sum()); - assert_eq!(24i128, [1i128, 2, 3, 4].iter().product()); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/i32-sub.rs b/src/test/ui/run-pass/numbers-arithmetic/i32-sub.rs deleted file mode 100644 index 12a0004ca48..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/i32-sub.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -pub fn main() { let mut x: i32 = -400; x = 0 - x; assert_eq!(x, 400); } diff --git a/src/test/ui/run-pass/numbers-arithmetic/i8-incr.rs b/src/test/ui/run-pass/numbers-arithmetic/i8-incr.rs deleted file mode 100644 index e9779d202b0..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/i8-incr.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -pub fn main() { - let mut x: i8 = -12; - let y: i8 = -12; - x = x + 1; - x = x - 1; - assert_eq!(x, y); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/int-abs-overflow.rs b/src/test/ui/run-pass/numbers-arithmetic/int-abs-overflow.rs deleted file mode 100644 index 92094f7b058..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/int-abs-overflow.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -Z force-overflow-checks=on -// ignore-emscripten no threads support - -use std::thread; - -fn main() { - assert!(thread::spawn(|| i8::min_value().abs()).join().is_err()); - assert!(thread::spawn(|| i16::min_value().abs()).join().is_err()); - assert!(thread::spawn(|| i32::min_value().abs()).join().is_err()); - assert!(thread::spawn(|| i64::min_value().abs()).join().is_err()); - assert!(thread::spawn(|| isize::min_value().abs()).join().is_err()); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/int.rs b/src/test/ui/run-pass/numbers-arithmetic/int.rs deleted file mode 100644 index 7d8af653833..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/int.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -// pretty-expanded FIXME #23616 - -pub fn main() { let _x: isize = 10; } diff --git a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-radix.rs b/src/test/ui/run-pass/numbers-arithmetic/integer-literal-radix.rs deleted file mode 100644 index 814d7de01a4..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-radix.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub fn main() { - let a = 0xBEEF_isize; - let b = 0o755_isize; - let c = 0b10101_isize; - let d = -0xBEEF_isize; - let e = -0o755_isize; - let f = -0b10101_isize; - - assert_eq!(a, 48879); - assert_eq!(b, 493); - assert_eq!(c, 21); - assert_eq!(d, -48879); - assert_eq!(e, -493); - assert_eq!(f, -21); - - -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs b/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs deleted file mode 100644 index 240d235c712..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-2.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo(_: *const ()) {} - -fn main() { - let a = 3; - foo(&a as *const _ as *const ()); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs b/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs deleted file mode 100644 index 7b10a049dc6..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference-3.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() { - println!("{}", std::mem::size_of_val(&1)); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs b/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs deleted file mode 100644 index ecbadb94a82..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/integer-literal-suffix-inference.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub fn main() { - fn id_i8(n: i8) -> i8 { n } - fn id_i16(n: i16) -> i16 { n } - fn id_i32(n: i32) -> i32 { n } - fn id_i64(n: i64) -> i64 { n } - - fn id_uint(n: usize) -> usize { n } - fn id_u8(n: u8) -> u8 { n } - fn id_u16(n: u16) -> u16 { n } - fn id_u32(n: u32) -> u32 { n } - fn id_u64(n: u64) -> u64 { n } - - let _i: i8 = -128; - let j = -128; - id_i8(j); - id_i8(-128); - - let _i: i16 = -32_768; - let j = -32_768; - id_i16(j); - id_i16(-32_768); - - let _i: i32 = -2_147_483_648; - let j = -2_147_483_648; - id_i32(j); - id_i32(-2_147_483_648); - - let _i: i64 = -9_223_372_036_854_775_808; - let j = -9_223_372_036_854_775_808; - id_i64(j); - id_i64(-9_223_372_036_854_775_808); - - let _i: usize = 1; - let j = 1; - id_uint(j); - id_uint(1); - - let _i: u8 = 255; - let j = 255; - id_u8(j); - id_u8(255); - - let _i: u16 = 65_535; - let j = 65_535; - id_u16(j); - id_u16(65_535); - - let _i: u32 = 4_294_967_295; - let j = 4_294_967_295; - id_u32(j); - id_u32(4_294_967_295); - - let _i: u64 = 18_446_744_073_709_551_615; - let j = 18_446_744_073_709_551_615; - id_u64(j); - id_u64(18_446_744_073_709_551_615); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs b/src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs deleted file mode 100644 index 704aca19367..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-debug.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -C debug_assertions=yes -// ignore-wasm32-bare compiled with panic=abort by default -// ignore-emscripten dies with an LLVM error - -use std::panic; - -fn main() { - macro_rules! overflow_test { - ($t:ident) => ( - let r = panic::catch_unwind(|| { - ($t::max_value()).next_power_of_two() - }); - assert!(r.is_err()); - - let r = panic::catch_unwind(|| { - (($t::max_value() >> 1) + 2).next_power_of_two() - }); - assert!(r.is_err()); - ) - } - overflow_test!(u8); - overflow_test!(u16); - overflow_test!(u32); - overflow_test!(u64); - overflow_test!(u128); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs b/src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs deleted file mode 100644 index e581f7c97cc..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/next-power-of-two-overflow-ndebug.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -C debug_assertions=no -// ignore-emscripten dies with an LLVM error - -fn main() { - for i in 129..256 { - assert_eq!((i as u8).next_power_of_two(), 0); - } - - assert_eq!(((1u16 << 15) + 1).next_power_of_two(), 0); - assert_eq!(((1u32 << 31) + 1).next_power_of_two(), 0); - assert_eq!(((1u64 << 63) + 1).next_power_of_two(), 0); - assert_eq!(((1u128 << 127) + 1).next_power_of_two(), 0); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/num-wrapping.rs b/src/test/ui/run-pass/numbers-arithmetic/num-wrapping.rs deleted file mode 100644 index 6d3653e7977..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/num-wrapping.rs +++ /dev/null @@ -1,456 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags: -C debug-assertions -// -// Test std::num::Wrapping for {uN, iN, usize, isize} - -#![feature(test)] - -extern crate test; - -use std::num::Wrapping; -use std::ops::{ - Add, Sub, Mul, Div, Rem, BitXor, BitOr, BitAnd, - AddAssign, SubAssign, MulAssign, DivAssign, RemAssign, BitXorAssign, BitOrAssign, BitAndAssign, - Shl, Shr, ShlAssign, ShrAssign -}; -use test::black_box; - -macro_rules! int_modules { - ($(($name:ident, $size:expr),)*) => ($( - mod $name { - pub const BITS: usize = $size; - pub use std::$name::*; - } - )*) -} - -int_modules! { - (i8, 8), - (i16, 16), - (i32, 32), - (i64, 64), - (u8, 8), - (u16, 16), - (u32, 32), - (u64, 64), -} - -#[cfg(target_pointer_width = "32")] -int_modules! { - (isize, 32), - (usize, 32), -} - -#[cfg(target_pointer_width = "64")] -int_modules! { - (isize, 64), - (usize, 64), -} - -fn main() { - test_ops(); - test_op_assigns(); - test_sh_ops(); - test_sh_op_assigns(); -} - -fn test_ops() { - macro_rules! op_test { - ($op:ident ($lhs:expr, $rhs:expr) == $ans:expr) => { - assert_eq!(black_box(Wrapping($lhs).$op(Wrapping($rhs))), Wrapping($ans)); - // FIXME(30524): uncomment this test when it's implemented - // assert_eq!(black_box(Wrapping($lhs).$op($rhs)), Wrapping($ans)); - } - } - - op_test!(add(i8::MAX, 1) == i8::MIN); - op_test!(add(i16::MAX, 1) == i16::MIN); - op_test!(add(i32::MAX, 1) == i32::MIN); - op_test!(add(i64::MAX, 1) == i64::MIN); - op_test!(add(isize::MAX, 1) == isize::MIN); - - op_test!(add(u8::MAX, 1) == 0); - op_test!(add(u16::MAX, 1) == 0); - op_test!(add(u32::MAX, 1) == 0); - op_test!(add(u64::MAX, 1) == 0); - op_test!(add(usize::MAX, 1) == 0); - - - op_test!(sub(i8::MIN, 1) == i8::MAX); - op_test!(sub(i16::MIN, 1) == i16::MAX); - op_test!(sub(i32::MIN, 1) == i32::MAX); - op_test!(sub(i64::MIN, 1) == i64::MAX); - op_test!(sub(isize::MIN, 1) == isize::MAX); - - op_test!(sub(0u8, 1) == u8::MAX); - op_test!(sub(0u16, 1) == u16::MAX); - op_test!(sub(0u32, 1) == u32::MAX); - op_test!(sub(0u64, 1) == u64::MAX); - op_test!(sub(0usize, 1) == usize::MAX); - - - op_test!(mul(i8::MAX, 2) == -2); - op_test!(mul(i16::MAX, 2) == -2); - op_test!(mul(i32::MAX, 2) == -2); - op_test!(mul(i64::MAX, 2) == -2); - op_test!(mul(isize::MAX, 2) == -2); - - op_test!(mul(u8::MAX, 2) == u8::MAX - 1); - op_test!(mul(u16::MAX, 2) == u16::MAX - 1); - op_test!(mul(u32::MAX, 2) == u32::MAX - 1); - op_test!(mul(u64::MAX, 2) == u64::MAX - 1); - op_test!(mul(usize::MAX, 2) == usize::MAX - 1); - - - op_test!(div(i8::MIN, -1) == i8::MIN); - op_test!(div(i16::MIN, -1) == i16::MIN); - op_test!(div(i32::MIN, -1) == i32::MIN); - op_test!(div(i64::MIN, -1) == i64::MIN); - op_test!(div(isize::MIN, -1) == isize::MIN); - - - op_test!(rem(i8::MIN, -1) == 0); - op_test!(rem(i16::MIN, -1) == 0); - op_test!(rem(i32::MIN, -1) == 0); - op_test!(rem(i64::MIN, -1) == 0); - op_test!(rem(isize::MIN, -1) == 0); - - // these are not that interesting, just testing to make sure they are implemented correctly - op_test!(bitxor(0b101010i8, 0b100110) == 0b001100); - op_test!(bitxor(0b101010i16, 0b100110) == 0b001100); - op_test!(bitxor(0b101010i32, 0b100110) == 0b001100); - op_test!(bitxor(0b101010i64, 0b100110) == 0b001100); - op_test!(bitxor(0b101010isize, 0b100110) == 0b001100); - - op_test!(bitxor(0b101010u8, 0b100110) == 0b001100); - op_test!(bitxor(0b101010u16, 0b100110) == 0b001100); - op_test!(bitxor(0b101010u32, 0b100110) == 0b001100); - op_test!(bitxor(0b101010u64, 0b100110) == 0b001100); - op_test!(bitxor(0b101010usize, 0b100110) == 0b001100); - - - op_test!(bitor(0b101010i8, 0b100110) == 0b101110); - op_test!(bitor(0b101010i16, 0b100110) == 0b101110); - op_test!(bitor(0b101010i32, 0b100110) == 0b101110); - op_test!(bitor(0b101010i64, 0b100110) == 0b101110); - op_test!(bitor(0b101010isize, 0b100110) == 0b101110); - - op_test!(bitor(0b101010u8, 0b100110) == 0b101110); - op_test!(bitor(0b101010u16, 0b100110) == 0b101110); - op_test!(bitor(0b101010u32, 0b100110) == 0b101110); - op_test!(bitor(0b101010u64, 0b100110) == 0b101110); - op_test!(bitor(0b101010usize, 0b100110) == 0b101110); - - - op_test!(bitand(0b101010i8, 0b100110) == 0b100010); - op_test!(bitand(0b101010i16, 0b100110) == 0b100010); - op_test!(bitand(0b101010i32, 0b100110) == 0b100010); - op_test!(bitand(0b101010i64, 0b100110) == 0b100010); - op_test!(bitand(0b101010isize, 0b100110) == 0b100010); - - op_test!(bitand(0b101010u8, 0b100110) == 0b100010); - op_test!(bitand(0b101010u16, 0b100110) == 0b100010); - op_test!(bitand(0b101010u32, 0b100110) == 0b100010); - op_test!(bitand(0b101010u64, 0b100110) == 0b100010); - op_test!(bitand(0b101010usize, 0b100110) == 0b100010); -} - -fn test_op_assigns() { - macro_rules! op_assign_test { - ($op:ident ($initial:expr, $rhs:expr) == $ans:expr) => { - { - let mut tmp = Wrapping($initial); - tmp = black_box(tmp); - tmp.$op(Wrapping($rhs)); - assert_eq!(black_box(tmp), Wrapping($ans)); - } - - // also test that a &Wrapping right-hand side is possible - { - let mut tmp = Wrapping($initial); - tmp = black_box(tmp); - tmp.$op(&Wrapping($rhs)); - assert_eq!(black_box(tmp), Wrapping($ans)); - } - - // FIXME(30524): Uncomment this test - /* - { - let mut tmp = Wrapping($initial); - tmp = black_box(tmp); - tmp.$op($rhs); - assert_eq!(black_box(tmp), Wrapping($ans)); - } - */ - } - } - op_assign_test!(add_assign(i8::MAX, 1) == i8::MIN); - op_assign_test!(add_assign(i16::MAX, 1) == i16::MIN); - op_assign_test!(add_assign(i32::MAX, 1) == i32::MIN); - op_assign_test!(add_assign(i64::MAX, 1) == i64::MIN); - op_assign_test!(add_assign(isize::MAX, 1) == isize::MIN); - - op_assign_test!(add_assign(u8::MAX, 1) == u8::MIN); - op_assign_test!(add_assign(u16::MAX, 1) == u16::MIN); - op_assign_test!(add_assign(u32::MAX, 1) == u32::MIN); - op_assign_test!(add_assign(u64::MAX, 1) == u64::MIN); - op_assign_test!(add_assign(usize::MAX, 1) == usize::MIN); - - - op_assign_test!(sub_assign(i8::MIN, 1) == i8::MAX); - op_assign_test!(sub_assign(i16::MIN, 1) == i16::MAX); - op_assign_test!(sub_assign(i32::MIN, 1) == i32::MAX); - op_assign_test!(sub_assign(i64::MIN, 1) == i64::MAX); - op_assign_test!(sub_assign(isize::MIN, 1) == isize::MAX); - - op_assign_test!(sub_assign(u8::MIN, 1) == u8::MAX); - op_assign_test!(sub_assign(u16::MIN, 1) == u16::MAX); - op_assign_test!(sub_assign(u32::MIN, 1) == u32::MAX); - op_assign_test!(sub_assign(u64::MIN, 1) == u64::MAX); - op_assign_test!(sub_assign(usize::MIN, 1) == usize::MAX); - - - op_assign_test!(mul_assign(i8::MAX, 2) == -2); - op_assign_test!(mul_assign(i16::MAX, 2) == -2); - op_assign_test!(mul_assign(i32::MAX, 2) == -2); - op_assign_test!(mul_assign(i64::MAX, 2) == -2); - op_assign_test!(mul_assign(isize::MAX, 2) == -2); - - op_assign_test!(mul_assign(u8::MAX, 2) == u8::MAX - 1); - op_assign_test!(mul_assign(u16::MAX, 2) == u16::MAX - 1); - op_assign_test!(mul_assign(u32::MAX, 2) == u32::MAX - 1); - op_assign_test!(mul_assign(u64::MAX, 2) == u64::MAX - 1); - op_assign_test!(mul_assign(usize::MAX, 2) == usize::MAX - 1); - - - op_assign_test!(div_assign(i8::MIN, -1) == i8::MIN); - op_assign_test!(div_assign(i16::MIN, -1) == i16::MIN); - op_assign_test!(div_assign(i32::MIN, -1) == i32::MIN); - op_assign_test!(div_assign(i64::MIN, -1) == i64::MIN); - op_assign_test!(div_assign(isize::MIN, -1) == isize::MIN); - - - op_assign_test!(rem_assign(i8::MIN, -1) == 0); - op_assign_test!(rem_assign(i16::MIN, -1) == 0); - op_assign_test!(rem_assign(i32::MIN, -1) == 0); - op_assign_test!(rem_assign(i64::MIN, -1) == 0); - op_assign_test!(rem_assign(isize::MIN, -1) == 0); - - - // these are not that interesting, just testing to make sure they are implemented correctly - op_assign_test!(bitxor_assign(0b101010i8, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010i16, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010i32, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010i64, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010isize, 0b100110) == 0b001100); - - op_assign_test!(bitxor_assign(0b101010u8, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010u16, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010u32, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010u64, 0b100110) == 0b001100); - op_assign_test!(bitxor_assign(0b101010usize, 0b100110) == 0b001100); - - - op_assign_test!(bitor_assign(0b101010i8, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010i16, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010i32, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010i64, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010isize, 0b100110) == 0b101110); - - op_assign_test!(bitor_assign(0b101010u8, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010u16, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010u32, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010u64, 0b100110) == 0b101110); - op_assign_test!(bitor_assign(0b101010usize, 0b100110) == 0b101110); - - - op_assign_test!(bitand_assign(0b101010i8, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010i16, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010i32, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010i64, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010isize, 0b100110) == 0b100010); - - op_assign_test!(bitand_assign(0b101010u8, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010u16, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010u32, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010u64, 0b100110) == 0b100010); - op_assign_test!(bitand_assign(0b101010usize, 0b100110) == 0b100010); -} - -fn test_sh_ops() { - macro_rules! sh_test { - ($op:ident ($lhs:expr, $rhs:expr) == $ans:expr) => { - assert_eq!(black_box(Wrapping($lhs).$op($rhs)), Wrapping($ans)); - } - } - // NOTE: This will break for i8 if we ever get i/u128 - macro_rules! sh_test_all { - ($t:ty) => { - sh_test!(shl(i8::MAX, (i8::BITS + 1) as $t) == -2); - sh_test!(shl(i16::MAX, (i16::BITS + 1) as $t) == -2); - sh_test!(shl(i32::MAX, (i32::BITS + 1) as $t) == -2); - sh_test!(shl(i64::MAX, (i64::BITS + 1) as $t) == -2); - sh_test!(shl(isize::MAX, (isize::BITS + 1) as $t) == -2); - - sh_test!(shl(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX - 1); - sh_test!(shl(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX - 1); - sh_test!(shl(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX - 1); - sh_test!(shl(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX - 1); - sh_test!(shl(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX - 1); - - - sh_test!(shr(i8::MAX, (i8::BITS + 1) as $t) == i8::MAX / 2); - sh_test!(shr(i16::MAX, (i16::BITS + 1) as $t) == i16::MAX / 2); - sh_test!(shr(i32::MAX, (i32::BITS + 1) as $t) == i32::MAX / 2); - sh_test!(shr(i64::MAX, (i64::BITS + 1) as $t) == i64::MAX / 2); - sh_test!(shr(isize::MAX, (isize::BITS + 1) as $t) == isize::MAX / 2); - - sh_test!(shr(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX / 2); - sh_test!(shr(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX / 2); - sh_test!(shr(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX / 2); - sh_test!(shr(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX / 2); - sh_test!(shr(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX / 2); - } - } - macro_rules! sh_test_negative_all { - ($t:ty) => { - sh_test!(shr(i8::MAX, -((i8::BITS + 1) as $t)) == -2); - sh_test!(shr(i16::MAX, -((i16::BITS + 1) as $t)) == -2); - sh_test!(shr(i32::MAX, -((i32::BITS + 1) as $t)) == -2); - sh_test!(shr(i64::MAX, -((i64::BITS + 1) as $t)) == -2); - sh_test!(shr(isize::MAX, -((isize::BITS + 1) as $t)) == -2); - - sh_test!(shr(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX - 1); - sh_test!(shr(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX - 1); - sh_test!(shr(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX - 1); - sh_test!(shr(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX - 1); - sh_test!(shr(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX - 1); - - - sh_test!(shl(i8::MAX, -((i8::BITS + 1) as $t)) == i8::MAX / 2); - sh_test!(shl(i16::MAX, -((i16::BITS + 1) as $t)) == i16::MAX / 2); - sh_test!(shl(i32::MAX, -((i32::BITS + 1) as $t)) == i32::MAX / 2); - sh_test!(shl(i64::MAX, -((i64::BITS + 1) as $t)) == i64::MAX / 2); - sh_test!(shl(isize::MAX, -((isize::BITS + 1) as $t)) == isize::MAX / 2); - - sh_test!(shl(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX / 2); - sh_test!(shl(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX / 2); - sh_test!(shl(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX / 2); - sh_test!(shl(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX / 2); - sh_test!(shl(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX / 2); - } - } - // FIXME(#23545): Uncomment the remaining tests - //sh_test_all!(i8); - //sh_test_all!(u8); - //sh_test_all!(i16); - //sh_test_all!(u16); - //sh_test_all!(i32); - //sh_test_all!(u32); - //sh_test_all!(i64); - //sh_test_all!(u64); - //sh_test_all!(isize); - sh_test_all!(usize); - - //sh_test_negative_all!(i8); - //sh_test_negative_all!(i16); - //sh_test_negative_all!(i32); - //sh_test_negative_all!(i64); - //sh_test_negative_all!(isize); -} - -fn test_sh_op_assigns() { - macro_rules! sh_assign_test { - ($op:ident ($initial:expr, $rhs:expr) == $ans:expr) => {{ - let mut tmp = Wrapping($initial); - tmp = black_box(tmp); - tmp.$op($rhs); - assert_eq!(black_box(tmp), Wrapping($ans)); - }} - } - macro_rules! sh_assign_test_all { - ($t:ty) => { - sh_assign_test!(shl_assign(i8::MAX, (i8::BITS + 1) as $t) == -2); - sh_assign_test!(shl_assign(i16::MAX, (i16::BITS + 1) as $t) == -2); - sh_assign_test!(shl_assign(i32::MAX, (i32::BITS + 1) as $t) == -2); - sh_assign_test!(shl_assign(i64::MAX, (i64::BITS + 1) as $t) == -2); - sh_assign_test!(shl_assign(isize::MAX, (isize::BITS + 1) as $t) == -2); - - sh_assign_test!(shl_assign(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX - 1); - sh_assign_test!(shl_assign(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX - 1); - sh_assign_test!(shl_assign(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX - 1); - sh_assign_test!(shl_assign(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX - 1); - sh_assign_test!(shl_assign(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX - 1); - - - sh_assign_test!(shr_assign(i8::MAX, (i8::BITS + 1) as $t) == i8::MAX / 2); - sh_assign_test!(shr_assign(i16::MAX, (i16::BITS + 1) as $t) == i16::MAX / 2); - sh_assign_test!(shr_assign(i32::MAX, (i32::BITS + 1) as $t) == i32::MAX / 2); - sh_assign_test!(shr_assign(i64::MAX, (i64::BITS + 1) as $t) == i64::MAX / 2); - sh_assign_test!(shr_assign(isize::MAX, (isize::BITS + 1) as $t) == isize::MAX / 2); - - sh_assign_test!(shr_assign(u8::MAX, (u8::BITS + 1) as $t) == u8::MAX / 2); - sh_assign_test!(shr_assign(u16::MAX, (u16::BITS + 1) as $t) == u16::MAX / 2); - sh_assign_test!(shr_assign(u32::MAX, (u32::BITS + 1) as $t) == u32::MAX / 2); - sh_assign_test!(shr_assign(u64::MAX, (u64::BITS + 1) as $t) == u64::MAX / 2); - sh_assign_test!(shr_assign(usize::MAX, (usize::BITS + 1) as $t) == usize::MAX / 2); - } - } - macro_rules! sh_assign_test_negative_all { - ($t:ty) => { - sh_assign_test!(shr_assign(i8::MAX, -((i8::BITS + 1) as $t)) == -2); - sh_assign_test!(shr_assign(i16::MAX, -((i16::BITS + 1) as $t)) == -2); - sh_assign_test!(shr_assign(i32::MAX, -((i32::BITS + 1) as $t)) == -2); - sh_assign_test!(shr_assign(i64::MAX, -((i64::BITS + 1) as $t)) == -2); - sh_assign_test!(shr_assign(isize::MAX, -((isize::BITS + 1) as $t)) == -2); - - sh_assign_test!(shr_assign(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX - 1); - sh_assign_test!(shr_assign(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX - 1); - sh_assign_test!(shr_assign(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX - 1); - sh_assign_test!(shr_assign(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX - 1); - sh_assign_test!(shr_assign(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX - 1); - - - sh_assign_test!(shl_assign(i8::MAX, -((i8::BITS + 1) as $t)) == i8::MAX / 2); - sh_assign_test!(shl_assign(i16::MAX, -((i16::BITS + 1) as $t)) == i16::MAX / 2); - sh_assign_test!(shl_assign(i32::MAX, -((i32::BITS + 1) as $t)) == i32::MAX / 2); - sh_assign_test!(shl_assign(i64::MAX, -((i64::BITS + 1) as $t)) == i64::MAX / 2); - sh_assign_test!(shl_assign(isize::MAX, -((isize::BITS + 1) as $t)) == isize::MAX / 2); - - sh_assign_test!(shl_assign(u8::MAX, -((u8::BITS + 1) as $t)) == u8::MAX / 2); - sh_assign_test!(shl_assign(u16::MAX, -((u16::BITS + 1) as $t)) == u16::MAX / 2); - sh_assign_test!(shl_assign(u32::MAX, -((u32::BITS + 1) as $t)) == u32::MAX / 2); - sh_assign_test!(shl_assign(u64::MAX, -((u64::BITS + 1) as $t)) == u64::MAX / 2); - sh_assign_test!(shl_assign(usize::MAX, -((usize::BITS + 1) as $t)) == usize::MAX / 2); - } - } - - // FIXME(#23545): Uncomment the remaining tests - //sh_assign_test_all!(i8); - //sh_assign_test_all!(u8); - //sh_assign_test_all!(i16); - //sh_assign_test_all!(u16); - //sh_assign_test_all!(i32); - //sh_assign_test_all!(u32); - //sh_assign_test_all!(i64); - //sh_assign_test_all!(u64); - //sh_assign_test_all!(isize); - sh_assign_test_all!(usize); - - //sh_assign_test_negative_all!(i8); - //sh_assign_test_negative_all!(i16); - //sh_assign_test_negative_all!(i32); - //sh_assign_test_negative_all!(i64); - //sh_assign_test_negative_all!(isize); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/numeric-method-autoexport.rs b/src/test/ui/run-pass/numbers-arithmetic/numeric-method-autoexport.rs deleted file mode 100644 index 22db67bf920..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/numeric-method-autoexport.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This file is intended to test only that methods are automatically -// reachable for each numeric type, for each exported impl, with no imports -// necessary. Testing the methods of the impls is done within the source -// file for each numeric type. - -use std::ops::Add; - -pub fn main() { -// ints - // num - assert_eq!(15_isize.add(6_isize), 21_isize); - assert_eq!(15_i8.add(6i8), 21_i8); - assert_eq!(15_i16.add(6i16), 21_i16); - assert_eq!(15_i32.add(6i32), 21_i32); - assert_eq!(15_i64.add(6i64), 21_i64); - -// uints - // num - assert_eq!(15_usize.add(6_usize), 21_usize); - assert_eq!(15_u8.add(6u8), 21_u8); - assert_eq!(15_u16.add(6u16), 21_u16); - assert_eq!(15_u32.add(6u32), 21_u32); - assert_eq!(15_u64.add(6u64), 21_u64); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/promoted_overflow_opt.rs b/src/test/ui/run-pass/numbers-arithmetic/promoted_overflow_opt.rs deleted file mode 100644 index 16042128901..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/promoted_overflow_opt.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(const_err)] - -// compile-flags: -O - -fn main() { - let x = &(0u32 - 1); - assert_eq!(*x, u32::max_value()) -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/saturating-float-casts.rs b/src/test/ui/run-pass/numbers-arithmetic/saturating-float-casts.rs deleted file mode 100644 index a822ac604fa..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/saturating-float-casts.rs +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests saturating float->int casts. See u128-as-f32.rs for the opposite direction. -// compile-flags: -Z saturating-float-casts - -#![feature(test, stmt_expr_attributes)] -#![deny(overflowing_literals)] -extern crate test; - -use std::{f32, f64}; -use std::{u8, i8, u16, i16, u32, i32, u64, i64}; -#[cfg(not(target_os="emscripten"))] -use std::{u128, i128}; -use test::black_box; - -macro_rules! test { - ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ( - // black_box disables constant evaluation to test run-time conversions: - assert_eq!(black_box::<$src_ty>($val) as $dest_ty, $expected, - "run-time {} -> {}", stringify!($src_ty), stringify!($dest_ty)); - ); - - ($fval:expr, f* -> $ity:ident, $ival:expr) => ( - test!($fval, f32 -> $ity, $ival); - test!($fval, f64 -> $ity, $ival); - ) -} - -// This macro tests const eval in addition to run-time evaluation. -// If and when saturating casts are adopted, this macro should be merged with test!() to ensure -// that run-time and const eval agree on inputs that currently trigger a const eval error. -macro_rules! test_c { - ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ({ - test!($val, $src_ty -> $dest_ty, $expected); - { - const X: $src_ty = $val; - const Y: $dest_ty = X as $dest_ty; - assert_eq!(Y, $expected, - "const eval {} -> {}", stringify!($src_ty), stringify!($dest_ty)); - } - }); - - ($fval:expr, f* -> $ity:ident, $ival:expr) => ( - test_c!($fval, f32 -> $ity, $ival); - test_c!($fval, f64 -> $ity, $ival); - ) -} - -macro_rules! common_fptoi_tests { - ($fty:ident -> $($ity:ident)+) => ({ $( - test!($fty::NAN, $fty -> $ity, 0); - test!($fty::INFINITY, $fty -> $ity, $ity::MAX); - test!($fty::NEG_INFINITY, $fty -> $ity, $ity::MIN); - // These two tests are not solely float->int tests, in particular the latter relies on - // `u128::MAX as f32` not being UB. But that's okay, since this file tests int->float - // as well, the test is just slightly misplaced. - test!($ity::MIN as $fty, $fty -> $ity, $ity::MIN); - test!($ity::MAX as $fty, $fty -> $ity, $ity::MAX); - test_c!(0., $fty -> $ity, 0); - test_c!($fty::MIN_POSITIVE, $fty -> $ity, 0); - test!(-0.9, $fty -> $ity, 0); - test_c!(1., $fty -> $ity, 1); - test_c!(42., $fty -> $ity, 42); - )+ }); - - (f* -> $($ity:ident)+) => ({ - common_fptoi_tests!(f32 -> $($ity)+); - common_fptoi_tests!(f64 -> $($ity)+); - }) -} - -macro_rules! fptoui_tests { - ($fty: ident -> $($ity: ident)+) => ({ $( - test!(-0., $fty -> $ity, 0); - test!(-$fty::MIN_POSITIVE, $fty -> $ity, 0); - test!(-0.99999994, $fty -> $ity, 0); - test!(-1., $fty -> $ity, 0); - test!(-100., $fty -> $ity, 0); - test!(#[allow(overflowing_literals)] -1e50, $fty -> $ity, 0); - test!(#[allow(overflowing_literals)] -1e130, $fty -> $ity, 0); - )+ }); - - (f* -> $($ity:ident)+) => ({ - fptoui_tests!(f32 -> $($ity)+); - fptoui_tests!(f64 -> $($ity)+); - }) -} - -pub fn main() { - common_fptoi_tests!(f* -> i8 i16 i32 i64 u8 u16 u32 u64); - fptoui_tests!(f* -> u8 u16 u32 u64); - // FIXME emscripten does not support i128 - #[cfg(not(target_os="emscripten"))] { - common_fptoi_tests!(f* -> i128 u128); - fptoui_tests!(f* -> u128); - } - - // The following tests cover edge cases for some integer types. - - // # u8 - test_c!(254., f* -> u8, 254); - test!(256., f* -> u8, 255); - - // # i8 - test_c!(-127., f* -> i8, -127); - test!(-129., f* -> i8, -128); - test_c!(126., f* -> i8, 126); - test!(128., f* -> i8, 127); - - // # i32 - // -2147483648. is i32::MIN (exactly) - test_c!(-2147483648., f* -> i32, i32::MIN); - // 2147483648. is i32::MAX rounded up - test!(2147483648., f32 -> i32, 2147483647); - // With 24 significand bits, floats with magnitude in [2^30 + 1, 2^31] are rounded to - // multiples of 2^7. Therefore, nextDown(round(i32::MAX)) is 2^31 - 128: - test_c!(2147483520., f32 -> i32, 2147483520); - // Similarly, nextUp(i32::MIN) is i32::MIN + 2^8 and nextDown(i32::MIN) is i32::MIN - 2^7 - test!(-2147483904., f* -> i32, i32::MIN); - test_c!(-2147483520., f* -> i32, -2147483520); - - // # u32 - // round(MAX) and nextUp(round(MAX)) - test_c!(4294967040., f* -> u32, 4294967040); - test!(4294967296., f* -> u32, 4294967295); - - // # u128 - #[cfg(not(target_os="emscripten"))] - { - // float->int: - test_c!(f32::MAX, f32 -> u128, 0xffffff00000000000000000000000000); - // nextDown(f32::MAX) = 2^128 - 2 * 2^104 - const SECOND_LARGEST_F32: f32 = 340282326356119256160033759537265639424.; - test_c!(SECOND_LARGEST_F32, f32 -> u128, 0xfffffe00000000000000000000000000); - } -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/shift-near-oflo.rs b/src/test/ui/run-pass/numbers-arithmetic/shift-near-oflo.rs deleted file mode 100644 index 3effc8de97f..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/shift-near-oflo.rs +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// compile-flags: -C debug-assertions - -// Check that we do *not* overflow on a number of edge cases. -// (compare with test/run-fail/overflowing-{lsh,rsh}*.rs) - -fn main() { - test_left_shift(); - test_right_shift(); -} - -pub static mut HACK: i32 = 0; - -// Work around constant-evaluation -// The point of this test is to exercise the code generated for execution at runtime, -// `id` can never be flagged as a const fn by future aggressive analyses... -// due to the modification of the static -#[inline(never)] -fn id(x: T) -> T { - unsafe { HACK += 1; } - x -} - -fn test_left_shift() { - // negative rhs can panic, but values in [0,N-1] are okay for iN - - macro_rules! tests { - ($iN:ty, $uN:ty, $max_rhs:expr, $expect_i:expr, $expect_u:expr) => { { - let x = (1 as $iN) << id(0); - assert_eq!(x, 1); - let x = (1 as $uN) << id(0); - assert_eq!(x, 1); - let x = (1 as $iN) << id($max_rhs); - assert_eq!(x, $expect_i); - let x = (1 as $uN) << id($max_rhs); - assert_eq!(x, $expect_u); - // high-order bits on LHS are silently discarded without panic. - let x = (3 as $iN) << id($max_rhs); - assert_eq!(x, $expect_i); - let x = (3 as $uN) << id($max_rhs); - assert_eq!(x, $expect_u); - } } - } - - let x = 1_i8 << id(0); - assert_eq!(x, 1); - let x = 1_u8 << id(0); - assert_eq!(x, 1); - let x = 1_i8 << id(7); - assert_eq!(x, std::i8::MIN); - let x = 1_u8 << id(7); - assert_eq!(x, 0x80); - // high-order bits on LHS are silently discarded without panic. - let x = 3_i8 << id(7); - assert_eq!(x, std::i8::MIN); - let x = 3_u8 << id(7); - assert_eq!(x, 0x80); - - // above is (approximately) expanded from: - tests!(i8, u8, 7, std::i8::MIN, 0x80_u8); - - tests!(i16, u16, 15, std::i16::MIN, 0x8000_u16); - tests!(i32, u32, 31, std::i32::MIN, 0x8000_0000_u32); - tests!(i64, u64, 63, std::i64::MIN, 0x8000_0000_0000_0000_u64); -} - -fn test_right_shift() { - // negative rhs can panic, but values in [0,N-1] are okay for iN - - macro_rules! tests { - ($iN:ty, $uN:ty, $max_rhs:expr, - $signbit_i:expr, $highbit_i:expr, $highbit_u:expr) => - { { - let x = (1 as $iN) >> id(0); - assert_eq!(x, 1); - let x = (1 as $uN) >> id(0); - assert_eq!(x, 1); - let x = ($highbit_i) >> id($max_rhs-1); - assert_eq!(x, 1); - let x = ($highbit_u) >> id($max_rhs); - assert_eq!(x, 1); - // sign-bit is carried by arithmetic right shift - let x = ($signbit_i) >> id($max_rhs); - assert_eq!(x, -1); - // low-order bits on LHS are silently discarded without panic. - let x = ($highbit_i + 1) >> id($max_rhs-1); - assert_eq!(x, 1); - let x = ($highbit_u + 1) >> id($max_rhs); - assert_eq!(x, 1); - let x = ($signbit_i + 1) >> id($max_rhs); - assert_eq!(x, -1); - } } - } - - tests!(i8, u8, 7, std::i8::MIN, 0x40_i8, 0x80_u8); - tests!(i16, u16, 15, std::i16::MIN, 0x4000_u16, 0x8000_u16); - tests!(i32, u32, 31, std::i32::MIN, 0x4000_0000_u32, 0x8000_0000_u32); - tests!(i64, u64, 63, std::i64::MIN, - 0x4000_0000_0000_0000_u64, 0x8000_0000_0000_0000_u64); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/shift-various-types.rs b/src/test/ui/run-pass/numbers-arithmetic/shift-various-types.rs deleted file mode 100644 index 1ae94255adf..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/shift-various-types.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can do shifts by any integral type. - - -struct Panolpy { - i8: i8, - i16: i16, - i32: i32, - i64: i64, - isize: isize, - - u8: u8, - u16: u16, - u32: u32, - u64: u64, - usize: usize, -} - -fn foo(p: &Panolpy) { - assert_eq!(22 >> p.i8, 11); - assert_eq!(22 >> p.i16, 11); - assert_eq!(22 >> p.i32, 11); - assert_eq!(22 >> p.i64, 11); - assert_eq!(22 >> p.isize, 11); - - assert_eq!(22 >> p.u8, 11); - assert_eq!(22 >> p.u16, 11); - assert_eq!(22 >> p.u32, 11); - assert_eq!(22 >> p.u64, 11); - assert_eq!(22 >> p.usize, 11); -} - -fn main() { - let p = Panolpy { - i8: 1, - i16: 1, - i32: 1, - i64: 1, - isize: 1, - - u8: 1, - u16: 1, - u32: 1, - u64: 1, - usize: 1, - }; - foo(&p) -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/shift.rs b/src/test/ui/run-pass/numbers-arithmetic/shift.rs deleted file mode 100644 index e9d48f1a1af..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/shift.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] -#![allow(overflowing_literals)] - -// Testing shifts for various combinations of integers -// Issue #1570 - - -pub fn main() { - test_misc(); - test_expr(); - test_const(); -} - -fn test_misc() { - assert_eq!(1 << 1 << 1 << 1 << 1 << 1, 32); -} - -fn test_expr() { - let v10 = 10 as usize; - let v4 = 4 as u8; - let v2 = 2 as u8; - assert_eq!(v10 >> v2 as usize, v2 as usize); - assert_eq!(v10 << v4 as usize, 160 as usize); - - let v10 = 10 as u8; - let v4 = 4 as usize; - let v2 = 2 as usize; - assert_eq!(v10 >> v2 as usize, v2 as u8); - assert_eq!(v10 << v4 as usize, 160 as u8); - - let v10 = 10 as isize; - let v4 = 4 as i8; - let v2 = 2 as i8; - assert_eq!(v10 >> v2 as usize, v2 as isize); - assert_eq!(v10 << v4 as usize, 160 as isize); - - let v10 = 10 as i8; - let v4 = 4 as isize; - let v2 = 2 as isize; - assert_eq!(v10 >> v2 as usize, v2 as i8); - assert_eq!(v10 << v4 as usize, 160 as i8); - - let v10 = 10 as usize; - let v4 = 4 as isize; - let v2 = 2 as isize; - assert_eq!(v10 >> v2 as usize, v2 as usize); - assert_eq!(v10 << v4 as usize, 160 as usize); -} - -fn test_const() { - static r1_1: usize = 10_usize >> 2_usize; - static r2_1: usize = 10_usize << 4_usize; - assert_eq!(r1_1, 2 as usize); - assert_eq!(r2_1, 160 as usize); - - static r1_2: u8 = 10u8 >> 2_usize; - static r2_2: u8 = 10u8 << 4_usize; - assert_eq!(r1_2, 2 as u8); - assert_eq!(r2_2, 160 as u8); - - static r1_3: isize = 10 >> 2_usize; - static r2_3: isize = 10 << 4_usize; - assert_eq!(r1_3, 2 as isize); - assert_eq!(r2_3, 160 as isize); - - static r1_4: i8 = 10i8 >> 2_usize; - static r2_4: i8 = 10i8 << 4_usize; - assert_eq!(r1_4, 2 as i8); - assert_eq!(r2_4, 160 as i8); - - static r1_5: usize = 10_usize >> 2_usize; - static r2_5: usize = 10_usize << 4_usize; - assert_eq!(r1_5, 2 as usize); - assert_eq!(r2_5, 160 as usize); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/signed-shift-const-eval.rs b/src/test/ui/run-pass/numbers-arithmetic/signed-shift-const-eval.rs deleted file mode 100644 index b0ff7a255ab..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/signed-shift-const-eval.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -enum test { thing = -5 >> 1_usize } -pub fn main() { - assert_eq!(test::thing as isize, -3); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/u128-as-f32.rs b/src/test/ui/run-pass/numbers-arithmetic/u128-as-f32.rs deleted file mode 100644 index 99dfd3ba1cf..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/u128-as-f32.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten u128 not supported - -#![feature(test)] -#![deny(overflowing_literals)] -extern crate test; - -use std::f32; -use std::u128; -use test::black_box; - -macro_rules! test { - ($val:expr, $src_ty:ident -> $dest_ty:ident, $expected:expr) => ({ - { - const X: $src_ty = $val; - const Y: $dest_ty = X as $dest_ty; - assert_eq!(Y, $expected, - "const eval {} -> {}", stringify!($src_ty), stringify!($dest_ty)); - } - // black_box disables constant evaluation to test run-time conversions: - assert_eq!(black_box::<$src_ty>($val) as $dest_ty, $expected, - "run-time {} -> {}", stringify!($src_ty), stringify!($dest_ty)); - }); -} - -pub fn main() { - // nextDown(f32::MAX) = 2^128 - 2 * 2^104 - const SECOND_LARGEST_F32: f32 = 340282326356119256160033759537265639424.; - - // f32::MAX - 0.5 ULP and smaller should be rounded down - test!(0xfffffe00000000000000000000000000, u128 -> f32, SECOND_LARGEST_F32); - test!(0xfffffe7fffffffffffffffffffffffff, u128 -> f32, SECOND_LARGEST_F32); - test!(0xfffffe80000000000000000000000000, u128 -> f32, SECOND_LARGEST_F32); - // numbers within < 0.5 ULP of f32::MAX it should be rounded to f32::MAX - test!(0xfffffe80000000000000000000000001, u128 -> f32, f32::MAX); - test!(0xfffffeffffffffffffffffffffffffff, u128 -> f32, f32::MAX); - test!(0xffffff00000000000000000000000000, u128 -> f32, f32::MAX); - test!(0xffffff00000000000000000000000001, u128 -> f32, f32::MAX); - test!(0xffffff7fffffffffffffffffffffffff, u128 -> f32, f32::MAX); - // f32::MAX + 0.5 ULP and greater should be rounded to infinity - test!(0xffffff80000000000000000000000000, u128 -> f32, f32::INFINITY); - test!(0xffffff80000000f00000000000000000, u128 -> f32, f32::INFINITY); - test!(0xffffff87ffffffffffffffff00000001, u128 -> f32, f32::INFINITY); - - // u128->f64 should not be affected by the u128->f32 checks - test!(0xffffff80000000000000000000000000, u128 -> f64, - 340282356779733661637539395458142568448.0); - test!(u128::MAX, u128 -> f64, 340282366920938463463374607431768211455.0); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/u128.rs b/src/test/ui/run-pass/numbers-arithmetic/u128.rs deleted file mode 100644 index c03d39e8416..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/u128.rs +++ /dev/null @@ -1,132 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten u128 not supported - -// compile-flags: -Z borrowck=compare - -#![feature(test)] - -extern crate test; -use test::black_box as b; - -fn main() { - let x: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFF; - assert_eq!(0, !x); - assert_eq!(0, !x); - let y: u128 = 0xFFFF_FFFF_FFFF_FFFF__FFFF_FFFF_FFFF_FFFE; - assert_eq!(!1, y); - assert_eq!(x, y | 1); - assert_eq!(0xFAFF_0000_FF8F_0000__FFFF_0000_FFFF_FFFE, - y & - 0xFAFF_0000_FF8F_0000__FFFF_0000_FFFF_FFFF); - let z: u128 = 0xABCD_EF; - assert_eq!(z * z, 0x734C_C2F2_A521); - assert_eq!(z * z * z * z, 0x33EE_0E2A_54E2_59DA_A0E7_8E41); - assert_eq!(z + z + z + z, 0x2AF3_7BC); - let k: u128 = 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210; - assert_eq!(k + k, 0x2468_ACF1_3579_BDFF_DB97_530E_CA86_420); - assert_eq!(0, k - k); - assert_eq!(0x1234_5678_9ABC_DEFF_EDCB_A987_5A86_421, k - z); - assert_eq!(0x1000_0000_0000_0000_0000_0000_0000_000, - k - 0x234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!(0x6EF5_DE4C_D3BC_2AAA_3BB4_CC5D_D6EE_8, k / 42); - assert_eq!(0, k % 42); - assert_eq!(15, z % 42); - assert_eq!(0x169D_A8020_CEC18, k % 0x3ACB_FE49_FF24_AC); - assert_eq!(0x91A2_B3C4_D5E6_F7, k >> 65); - assert_eq!(0xFDB9_7530_ECA8_6420_0000_0000_0000_0000, k << 65); - assert!(k > z); - assert!(y > k); - assert!(y < x); - assert_eq!(x as u64, !0); - assert_eq!(z as u64, 0xABCD_EF); - assert_eq!(k as u64, 0xFEDC_BA98_7654_3210); - assert_eq!(k as i128, 0x1234_5678_9ABC_DEFF_EDCB_A987_6543_210); - assert_eq!((z as f64) as u128, z); - assert_eq!((z as f32) as u128, z); - assert_eq!((z as f64 * 16.0) as u128, z * 16); - assert_eq!((z as f32 * 16.0) as u128, z * 16); - let l :u128 = 432 << 100; - assert_eq!((l as f32) as u128, l); - assert_eq!((l as f64) as u128, l); - // formatting - let j: u128 = 1 << 67; - assert_eq!("147573952589676412928", format!("{}", j)); - assert_eq!("80000000000000000", format!("{:x}", j)); - assert_eq!("20000000000000000000000", format!("{:o}", j)); - assert_eq!("10000000000000000000000000000000000000000000000000000000000000000000", - format!("{:b}", j)); - assert_eq!("340282366920938463463374607431768211455", - format!("{}", u128::max_value())); - assert_eq!("147573952589676412928", format!("{:?}", j)); - // common traits - assert_eq!(x, b(x.clone())); - // overflow checks - assert_eq!((z).checked_mul(z), Some(0x734C_C2F2_A521)); - assert_eq!((k).checked_mul(k), None); - let l: u128 = b(u128::max_value() - 10); - let o: u128 = b(17); - assert_eq!(l.checked_add(b(11)), None); - assert_eq!(l.checked_sub(l), Some(0)); - assert_eq!(o.checked_sub(b(18)), None); - assert_eq!(b(1u128).checked_shl(b(127)), Some(1 << 127)); - assert_eq!(o.checked_shl(b(128)), None); - - // Test cases for all udivmodti4 branches. - // case "0X/0X" - assert_eq!(b(0x69545bd57727c050_u128) / - b(0x3283527a3350d88c_u128), - 2u128); - // case "0X/KX" - assert_eq!(b(0x0_8003c9c50b473ae6_u128) / - b(0x1_283e8838c30fa8f4_u128), - 0u128); - // case "K0/K0" - assert_eq!(b(0xc43f42a207978720_u128 << 64) / - b(0x098e62b74c23cf1a_u128 << 64), - 20u128); - // case "KK/K0" for power-of-two D. - assert_eq!(b(0xa9008fb6c9d81e42_0e25730562a601c8_u128) / - b(1u128 << 120), - 169u128); - // case "KK/K0" with N >= D (https://github.com/rust-lang/rust/issues/41228). - assert_eq!(b(0xe4d26e59f0640328_06da5b06efe83a41_u128) / - b(0x330fcb030ea4447c_u128 << 64), - 4u128); - assert_eq!(b(3u128 << 64 | 1) / - b(3u128 << 64), - 1u128); - // case "KK/K0" with N < D. - assert_eq!(b(0x6655c9fb66ca2884_e2d1dfd470158c62_u128) / - b(0xb35b667cab7e355b_u128 << 64), - 0u128); - // case "KX/0K" for power-of-two D. - assert_eq!(b(0x3e49dd84feb2df59_7b2f97d93a253969_u128) / - b(1u128 << 4), - 0x03e49dd84feb2df5_97b2f97d93a25396_u128); - // case "KX/0K" in general. - assert_eq!(b(0x299692b3a1dae5bd_6162e6f489d2620e_u128) / - b(0x900b6f027571d6f7_u128), - 0x49e95f54b0442578_u128); - // case "KX/KK" with N >= D. - assert_eq!(b(0xc7b889180b67b07d_bc1a3c88783d35b5_u128) / - b(0x1d7e69f53160b9e2_60074771e852f244_u128), - 6u128); - // case "KX/KK" with N < D. - assert_eq!(b(0x679289ac23bb334f_36144401cf882172_u128) / - b(0x7b0b271b64865f05_f54a7b72746c062f_u128), - 0u128); - - // iter-arithmetic traits - assert_eq!(10u128, [1u128, 2, 3, 4].iter().sum()); - assert_eq!(24u128, [1u128, 2, 3, 4].iter().product()); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/u32-decr.rs b/src/test/ui/run-pass/numbers-arithmetic/u32-decr.rs deleted file mode 100644 index e86d3abefa7..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/u32-decr.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -pub fn main() { - let mut word: u32 = 200000; - word = word - 1; - assert_eq!(word, 199999); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/u8-incr-decr.rs b/src/test/ui/run-pass/numbers-arithmetic/u8-incr-decr.rs deleted file mode 100644 index 2567da479f1..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/u8-incr-decr.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -// These constants were chosen because they aren't used anywhere -// in the rest of the generated code so they're easily grep-able. - -pub fn main() { - let mut x: u8 = 19; // 0x13 - - let mut y: u8 = 35; // 0x23 - - x = x + 7; // 0x7 - - y = y - 9; // 0x9 - - assert_eq!(x, y); -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/u8-incr.rs b/src/test/ui/run-pass/numbers-arithmetic/u8-incr.rs deleted file mode 100644 index ca49efaade6..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/u8-incr.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -pub fn main() { - let mut x: u8 = 12; - let y: u8 = 12; - x = x + 1; - x = x - 1; - assert_eq!(x, y); - // x = 14; - // x = x + 1; - -} diff --git a/src/test/ui/run-pass/numbers-arithmetic/uint.rs b/src/test/ui/run-pass/numbers-arithmetic/uint.rs deleted file mode 100644 index 01ee2167c72..00000000000 --- a/src/test/ui/run-pass/numbers-arithmetic/uint.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - -// pretty-expanded FIXME #23616 - -pub fn main() { let _x: usize = 10 as usize; } diff --git a/src/test/ui/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs b/src/test/ui/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs deleted file mode 100644 index 3c8cba13ae7..00000000000 --- a/src/test/ui/run-pass/overloaded/auxiliary/overloaded_autoderef_xc.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::ops::Deref; - -struct DerefWithHelper { - pub helper: H, - pub value: Option -} - -trait Helper { - fn helper_borrow(&self) -> &T; -} - -impl Helper for Option { - fn helper_borrow(&self) -> &T { - self.as_ref().unwrap() - } -} - -impl> Deref for DerefWithHelper { - type Target = T; - - fn deref(&self) -> &T { - self.helper.helper_borrow() - } -} - -// Test cross-crate autoderef + vtable. -pub fn check(x: T, y: T) -> bool { - let d: DerefWithHelper, T> = DerefWithHelper { helper: Some(x), value: None }; - d.eq(&y) -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-autoderef-count.rs b/src/test/ui/run-pass/overloaded/overloaded-autoderef-count.rs deleted file mode 100644 index 0e07be53829..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-autoderef-count.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cell::Cell; -use std::ops::{Deref, DerefMut}; - -#[derive(PartialEq)] -struct DerefCounter { - count_imm: Cell, - count_mut: usize, - value: T -} - -impl DerefCounter { - fn new(value: T) -> DerefCounter { - DerefCounter { - count_imm: Cell::new(0), - count_mut: 0, - value: value - } - } - - fn counts(&self) -> (usize, usize) { - (self.count_imm.get(), self.count_mut) - } -} - -impl Deref for DerefCounter { - type Target = T; - - fn deref(&self) -> &T { - self.count_imm.set(self.count_imm.get() + 1); - &self.value - } -} - -impl DerefMut for DerefCounter { - fn deref_mut(&mut self) -> &mut T { - self.count_mut += 1; - &mut self.value - } -} - -#[derive(PartialEq, Debug)] -struct Point { - x: isize, - y: isize -} - -impl Point { - fn get(&self) -> (isize, isize) { - (self.x, self.y) - } -} - -pub fn main() { - let mut p = DerefCounter::new(Point {x: 0, y: 0}); - - let _ = p.x; - assert_eq!(p.counts(), (1, 0)); - - let _ = &p.x; - assert_eq!(p.counts(), (2, 0)); - - let _ = &mut p.y; - assert_eq!(p.counts(), (2, 1)); - - p.x += 3; - assert_eq!(p.counts(), (2, 2)); - - p.get(); - assert_eq!(p.counts(), (3, 2)); - - // Check the final state. - assert_eq!(*p, Point {x: 3, y: 0}); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-autoderef-indexing.rs b/src/test/ui/run-pass/overloaded/overloaded-autoderef-indexing.rs deleted file mode 100644 index f4f42add88f..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-autoderef-indexing.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::ops::Deref; - -struct DerefArray<'a, T:'a> { - inner: &'a [T] -} - -impl<'a, T> Deref for DerefArray<'a, T> { - type Target = &'a [T]; - - fn deref<'b>(&'b self) -> &'b &'a [T] { - &self.inner - } -} - -pub fn main() { - let a = &[1, 2, 3]; - assert_eq!(DerefArray {inner: a}[1], 2); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-autoderef-order.rs b/src/test/ui/run-pass/overloaded/overloaded-autoderef-order.rs deleted file mode 100644 index 1480b036542..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-autoderef-order.rs +++ /dev/null @@ -1,81 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::rc::Rc; -use std::ops::Deref; - -#[derive(Copy, Clone)] -struct DerefWrapper { - x: X, - y: Y -} - -impl DerefWrapper { - fn get_x(self) -> X { - self.x - } -} - -impl Deref for DerefWrapper { - type Target = Y; - - fn deref(&self) -> &Y { - &self.y - } -} - -mod priv_test { - use std::ops::Deref; - - #[derive(Copy, Clone)] - pub struct DerefWrapperHideX { - x: X, - pub y: Y - } - - impl DerefWrapperHideX { - pub fn new(x: X, y: Y) -> DerefWrapperHideX { - DerefWrapperHideX { - x: x, - y: y - } - } - } - - impl Deref for DerefWrapperHideX { - type Target = Y; - - fn deref(&self) -> &Y { - &self.y - } - } -} - -pub fn main() { - let nested = DerefWrapper {x: true, y: DerefWrapper {x: 0, y: 1}}; - - // Use the first field that you can find. - assert_eq!(nested.x, true); - assert_eq!((*nested).x, 0); - - // Same for methods, even though there are multiple - // candidates (at different nesting levels). - assert_eq!(nested.get_x(), true); - assert_eq!((*nested).get_x(), 0); - - // Also go through multiple levels of indirection. - assert_eq!(Rc::new(nested).x, true); - - let nested_priv = priv_test::DerefWrapperHideX::new(true, DerefWrapper {x: 0, y: 1}); - assert_eq!(nested_priv.x, 0); - assert_eq!((*nested_priv).x, 0); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-autoderef-vtable.rs b/src/test/ui/run-pass/overloaded/overloaded-autoderef-vtable.rs deleted file mode 100644 index 2ed9032f86e..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-autoderef-vtable.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::ops::Deref; - -struct DerefWithHelper { - helper: H, - value: T -} - -trait Helper { - fn helper_borrow(&self) -> &T; -} - -impl Helper for Option { - fn helper_borrow(&self) -> &T { - self.as_ref().unwrap() - } -} - -impl> Deref for DerefWithHelper { - type Target = T; - - fn deref(&self) -> &T { - self.helper.helper_borrow() - } -} - -struct Foo {x: isize} - -impl Foo { - fn foo(&self) -> isize {self.x} -} - -pub fn main() { - let x: DerefWithHelper, Foo> = - DerefWithHelper { helper: Some(Foo {x: 5}), value: Foo { x: 2 } }; - assert_eq!(x.foo(), 5); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-autoderef-xcrate.rs b/src/test/ui/run-pass/overloaded/overloaded-autoderef-xcrate.rs deleted file mode 100644 index 9408d02ba33..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-autoderef-xcrate.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:overloaded_autoderef_xc.rs - - -extern crate overloaded_autoderef_xc; - -fn main() { - assert!(overloaded_autoderef_xc::check(5, 5)); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-autoderef.rs b/src/test/ui/run-pass/overloaded/overloaded-autoderef.rs deleted file mode 100644 index 7be57400da0..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-autoderef.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(box_syntax, core)] - -use std::cell::RefCell; -use std::rc::Rc; - -#[derive(PartialEq, Debug)] -struct Point { - x: isize, - y: isize -} - -pub fn main() { - let box_5: Box<_> = box 5_usize; - let point = Rc::new(Point {x: 2, y: 4}); - assert_eq!(point.x, 2); - assert_eq!(point.y, 4); - - let i = Rc::new(RefCell::new(2)); - let i_value = *i.borrow(); - *i.borrow_mut() = 5; - assert_eq!((i_value, *i.borrow()), (2, 5)); - - let s = Rc::new("foo".to_string()); - assert_eq!(&**s, "foo"); - - let mut_s = Rc::new(RefCell::new(String::from("foo"))); - mut_s.borrow_mut().push_str("bar"); - // HACK assert_eq! would panic here because it stores the LHS and RHS in two locals. - assert_eq!(&**mut_s.borrow(), "foobar"); - assert_eq!(&**mut_s.borrow_mut(), "foobar"); - - let p = Rc::new(RefCell::new(Point {x: 1, y: 2})); - p.borrow_mut().x = 3; - p.borrow_mut().y += 3; - assert_eq!(*p.borrow(), Point {x: 3, y: 5}); - - let v = Rc::new(RefCell::new([1, 2, 3])); - v.borrow_mut()[0] = 3; - v.borrow_mut()[1] += 3; - assert_eq!((v.borrow()[0], v.borrow()[1], v.borrow()[2]), (3, 5, 3)); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-calls-object-one-arg.rs b/src/test/ui/run-pass/overloaded/overloaded-calls-object-one-arg.rs deleted file mode 100644 index d80ed4531fe..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-calls-object-one-arg.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests calls to closure arguments where the closure takes 1 argument. -// This is a bit tricky due to rust-call ABI. - - -fn foo(f: &mut FnMut(isize) -> isize) -> isize { - f(22) -} - -fn main() { - let z = foo(&mut |x| x *100); - assert_eq!(z, 2200); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-calls-object-two-args.rs b/src/test/ui/run-pass/overloaded/overloaded-calls-object-two-args.rs deleted file mode 100644 index bfc815baeaa..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-calls-object-two-args.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests calls to closure arguments where the closure takes 2 arguments. -// This is a bit tricky due to rust-call ABI. - - -fn foo(f: &mut FnMut(isize, isize) -> isize) -> isize { - f(1, 2) -} - -fn main() { - let z = foo(&mut |x, y| x * 10 + y); - assert_eq!(z, 12); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-calls-object-zero-args.rs b/src/test/ui/run-pass/overloaded/overloaded-calls-object-zero-args.rs deleted file mode 100644 index ebabaf09f57..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-calls-object-zero-args.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests calls to closure arguments where the closure takes 0 arguments. -// This is a bit tricky due to rust-call ABI. - - -fn foo(f: &mut FnMut() -> isize) -> isize { - f() -} - -fn main() { - let z = foo(&mut || 22); - assert_eq!(z, 22); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-calls-param-vtables.rs b/src/test/ui/run-pass/overloaded/overloaded-calls-param-vtables.rs deleted file mode 100644 index 6db534d3081..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-calls-param-vtables.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that nested vtables work with overloaded calls. - -// pretty-expanded FIXME #23616 - -#![feature(unboxed_closures, fn_traits)] - -use std::marker::PhantomData; -use std::ops::Fn; -use std::ops::Add; - -struct G(PhantomData); - -impl<'a, A: Add> Fn<(A,)> for G { - extern "rust-call" fn call(&self, (arg,): (A,)) -> i32 { - arg.add(1) - } -} - -impl<'a, A: Add> FnMut<(A,)> for G { - extern "rust-call" fn call_mut(&mut self, args: (A,)) -> i32 { self.call(args) } -} - -impl<'a, A: Add> FnOnce<(A,)> for G { - type Output = i32; - extern "rust-call" fn call_once(self, args: (A,)) -> i32 { self.call(args) } -} - -fn main() { - // ICE trigger - (G(PhantomData))(1); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-calls-simple.rs b/src/test/ui/run-pass/overloaded/overloaded-calls-simple.rs deleted file mode 100644 index 825263c891d..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-calls-simple.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(lang_items, unboxed_closures, fn_traits)] - -use std::ops::{Fn, FnMut, FnOnce}; - -struct S1 { - x: i32, - y: i32, -} - -impl FnMut<(i32,)> for S1 { - extern "rust-call" fn call_mut(&mut self, (z,): (i32,)) -> i32 { - self.x * self.y * z - } -} - -impl FnOnce<(i32,)> for S1 { - type Output = i32; - extern "rust-call" fn call_once(mut self, args: (i32,)) -> i32 { - self.call_mut(args) - } -} - -struct S2 { - x: i32, - y: i32, -} - -impl Fn<(i32,)> for S2 { - extern "rust-call" fn call(&self, (z,): (i32,)) -> i32 { - self.x * self.y * z - } -} - -impl FnMut<(i32,)> for S2 { - extern "rust-call" fn call_mut(&mut self, args: (i32,)) -> i32 { self.call(args) } -} - -impl FnOnce<(i32,)> for S2 { - type Output = i32; - extern "rust-call" fn call_once(self, args: (i32,)) -> i32 { self.call(args) } -} - -struct S3 { - x: i32, - y: i32, -} - -impl FnOnce<(i32,i32)> for S3 { - type Output = i32; - extern "rust-call" fn call_once(self, (z,zz): (i32,i32)) -> i32 { - self.x * self.y * z * zz - } -} - -fn main() { - let mut s = S1 { - x: 3, - y: 3, - }; - let ans = s(3); - - assert_eq!(ans, 27); - let s = S2 { - x: 3, - y: 3, - }; - let ans = s.call((3,)); - assert_eq!(ans, 27); - - let s = S3 { - x: 3, - y: 3, - }; - let ans = s(3, 1); - assert_eq!(ans, 27); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-calls-zero-args.rs b/src/test/ui/run-pass/overloaded/overloaded-calls-zero-args.rs deleted file mode 100644 index de8915493da..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-calls-zero-args.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(unboxed_closures, fn_traits)] - -use std::ops::FnMut; - -struct S { - x: i32, - y: i32, -} - -impl FnMut<()> for S { - extern "rust-call" fn call_mut(&mut self, (): ()) -> i32 { - self.x * self.y - } -} - -impl FnOnce<()> for S { - type Output = i32; - extern "rust-call" fn call_once(mut self, args: ()) -> i32 { self.call_mut(args) } -} - -fn main() { - let mut s = S { - x: 3, - y: 3, - }; - let ans = s(); - assert_eq!(ans, 9); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-deref-count.rs b/src/test/ui/run-pass/overloaded/overloaded-deref-count.rs deleted file mode 100644 index 79040afbd0e..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-deref-count.rs +++ /dev/null @@ -1,88 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::cell::Cell; -use std::ops::{Deref, DerefMut}; -use std::vec::Vec; - -struct DerefCounter { - count_imm: Cell, - count_mut: usize, - value: T -} - -impl DerefCounter { - fn new(value: T) -> DerefCounter { - DerefCounter { - count_imm: Cell::new(0), - count_mut: 0, - value: value - } - } - - fn counts(&self) -> (usize, usize) { - (self.count_imm.get(), self.count_mut) - } -} - -impl Deref for DerefCounter { - type Target = T; - - fn deref(&self) -> &T { - self.count_imm.set(self.count_imm.get() + 1); - &self.value - } -} - -impl DerefMut for DerefCounter { - fn deref_mut(&mut self) -> &mut T { - self.count_mut += 1; - &mut self.value - } -} - -pub fn main() { - let mut n = DerefCounter::new(0); - let mut v = DerefCounter::new(Vec::new()); - - let _ = *n; // Immutable deref + copy a POD. - assert_eq!(n.counts(), (1, 0)); - - let _ = (&*n, &*v); // Immutable deref + borrow. - assert_eq!(n.counts(), (2, 0)); assert_eq!(v.counts(), (1, 0)); - - let _ = (&mut *n, &mut *v); // Mutable deref + mutable borrow. - assert_eq!(n.counts(), (2, 1)); assert_eq!(v.counts(), (1, 1)); - - let mut v2 = Vec::new(); - v2.push(1); - - *n = 5; *v = v2; // Mutable deref + assignment. - assert_eq!(n.counts(), (2, 2)); assert_eq!(v.counts(), (1, 2)); - - *n -= 3; // Mutable deref + assignment with binary operation. - assert_eq!(n.counts(), (2, 3)); - - // Immutable deref used for calling a method taking &self. (The - // typechecker is smarter now about doing this.) - (*n).to_string(); - assert_eq!(n.counts(), (3, 3)); - - // Mutable deref used for calling a method taking &mut self. - (*v).push(2); - assert_eq!(v.counts(), (1, 3)); - - // Check the final states. - assert_eq!(*n, 2); - let expected: &[_] = &[1, 2]; - assert_eq!((*v), expected); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-deref.rs b/src/test/ui/run-pass/overloaded/overloaded-deref.rs deleted file mode 100644 index 779d1b2391e..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-deref.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cell::RefCell; -use std::rc::Rc; -use std::string::String; - -#[derive(PartialEq, Debug)] -struct Point { - x: isize, - y: isize -} - -pub fn main() { - assert_eq!(*Rc::new(5), 5); - assert_eq!(***Rc::new(Box::new(Box::new(5))), 5); - assert_eq!(*Rc::new(Point {x: 2, y: 4}), Point {x: 2, y: 4}); - - let i = Rc::new(RefCell::new(2)); - let i_value = *(*i).borrow(); - *(*i).borrow_mut() = 5; - assert_eq!((i_value, *(*i).borrow()), (2, 5)); - - let s = Rc::new("foo".to_string()); - assert_eq!(*s, "foo".to_string()); - assert_eq!((*s), "foo"); - - let mut_s = Rc::new(RefCell::new(String::from("foo"))); - (*(*mut_s).borrow_mut()).push_str("bar"); - // assert_eq! would panic here because it stores the LHS and RHS in two locals. - assert_eq!((*(*mut_s).borrow()), "foobar"); - assert_eq!((*(*mut_s).borrow_mut()), "foobar"); - - let p = Rc::new(RefCell::new(Point {x: 1, y: 2})); - (*(*p).borrow_mut()).x = 3; - (*(*p).borrow_mut()).y += 3; - assert_eq!(*(*p).borrow(), Point {x: 3, y: 5}); - - let v = Rc::new(RefCell::new(vec![1, 2, 3])); - (*(*v).borrow_mut())[0] = 3; - (*(*v).borrow_mut())[1] += 3; - assert_eq!(((*(*v).borrow())[0], - (*(*v).borrow())[1], - (*(*v).borrow())[2]), (3, 5, 3)); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-index-assoc-list.rs b/src/test/ui/run-pass/overloaded/overloaded-index-assoc-list.rs deleted file mode 100644 index 7c23e8e28f8..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-index-assoc-list.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test overloading of the `[]` operator. In particular test that it -// takes its argument *by reference*. - -use std::ops::Index; - -struct AssociationList { - pairs: Vec> } - -#[derive(Clone)] -struct AssociationPair { - key: K, - value: V -} - -impl AssociationList { - fn push(&mut self, key: K, value: V) { - self.pairs.push(AssociationPair {key: key, value: value}); - } -} - -impl<'a, K: PartialEq + std::fmt::Debug, V:Clone> Index<&'a K> for AssociationList { - type Output = V; - - fn index(&self, index: &K) -> &V { - for pair in &self.pairs { - if pair.key == *index { - return &pair.value - } - } - panic!("No value found for key: {:?}", index); - } -} - -pub fn main() { - let foo = "foo".to_string(); - let bar = "bar".to_string(); - - let mut list = AssociationList {pairs: Vec::new()}; - list.push(foo.clone(), 22); - list.push(bar.clone(), 44); - - assert_eq!(list[&foo], 22); - assert_eq!(list[&bar], 44); - - assert_eq!(list[&foo], 22); - assert_eq!(list[&bar], 44); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-index-autoderef.rs b/src/test/ui/run-pass/overloaded/overloaded-index-autoderef.rs deleted file mode 100644 index 024bd4e2bb7..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-index-autoderef.rs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// Test overloaded indexing combined with autoderef. - -#![feature(box_syntax, core)] - -use std::ops::{Index, IndexMut}; - -struct Foo { - x: isize, - y: isize, -} - -impl Index for Foo { - type Output = isize; - - fn index(&self, z: isize) -> &isize { - if z == 0 { - &self.x - } else { - &self.y - } - } -} - -impl IndexMut for Foo { - fn index_mut(&mut self, z: isize) -> &mut isize { - if z == 0 { - &mut self.x - } else { - &mut self.y - } - } -} - -trait Int { - fn get(self) -> isize; - fn get_from_ref(&self) -> isize; - fn inc(&mut self); -} - -impl Int for isize { - fn get(self) -> isize { self } - fn get_from_ref(&self) -> isize { *self } - fn inc(&mut self) { *self += 1; } -} - -fn main() { - let mut f: Box<_> = box Foo { - x: 1, - y: 2, - }; - - assert_eq!(f[1], 2); - - f[0] = 3; - - assert_eq!(f[0], 3); - - // Test explicit IndexMut where `f` must be autoderef: - { - let p = &mut f[1]; - *p = 4; - } - - // Test explicit Index where `f` must be autoderef: - { - let p = &f[1]; - assert_eq!(*p, 4); - } - - // Test calling methods with `&mut self`, `self, and `&self` receivers: - f[1].inc(); - assert_eq!(f[1].get(), 5); - assert_eq!(f[1].get_from_ref(), 5); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-index-in-field.rs b/src/test/ui/run-pass/overloaded/overloaded-index-in-field.rs deleted file mode 100644 index 3302a4e3a7d..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-index-in-field.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test using overloaded indexing when the "map" is stored in a -// field. This caused problems at some point. - -use std::ops::Index; - -struct Foo { - x: isize, - y: isize, -} - -struct Bar { - foo: Foo -} - -impl Index for Foo { - type Output = isize; - - fn index(&self, z: isize) -> &isize { - if z == 0 { - &self.x - } else { - &self.y - } - } -} - -trait Int { - fn get(self) -> isize; - fn get_from_ref(&self) -> isize; - fn inc(&mut self); -} - -impl Int for isize { - fn get(self) -> isize { self } - fn get_from_ref(&self) -> isize { *self } - fn inc(&mut self) { *self += 1; } -} - -fn main() { - let f = Bar { foo: Foo { - x: 1, - y: 2, - } }; - assert_eq!(f.foo[1].get(), 2); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded-index.rs b/src/test/ui/run-pass/overloaded/overloaded-index.rs deleted file mode 100644 index 8ae612764a7..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded-index.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::{Index, IndexMut}; - -struct Foo { - x: isize, - y: isize, -} - -impl Index for Foo { - type Output = isize; - - fn index(&self, z: isize) -> &isize { - if z == 0 { - &self.x - } else { - &self.y - } - } -} - -impl IndexMut for Foo { - fn index_mut(&mut self, z: isize) -> &mut isize { - if z == 0 { - &mut self.x - } else { - &mut self.y - } - } -} - -trait Int { - fn get(self) -> isize; - fn get_from_ref(&self) -> isize; - fn inc(&mut self); -} - -impl Int for isize { - fn get(self) -> isize { self } - fn get_from_ref(&self) -> isize { *self } - fn inc(&mut self) { *self += 1; } -} - -fn main() { - let mut f = Foo { - x: 1, - y: 2, - }; - assert_eq!(f[1], 2); - f[0] = 3; - assert_eq!(f[0], 3); - { - let p = &mut f[1]; - *p = 4; - } - { - let p = &f[1]; - assert_eq!(*p, 4); - } - - // Test calling methods with `&mut self`, `self, and `&self` receivers: - f[1].inc(); - assert_eq!(f[1].get(), 5); - assert_eq!(f[1].get_from_ref(), 5); -} diff --git a/src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs b/src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs deleted file mode 100644 index d092df32957..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we choose Deref or DerefMut appropriately based on mutability of ref bindings (#15609). - -use std::ops::{Deref, DerefMut}; - -struct DerefOk(T); -struct DerefMutOk(T); - -impl Deref for DerefOk { - type Target = T; - fn deref(&self) -> &Self::Target { - &self.0 - } -} - -impl DerefMut for DerefOk { - fn deref_mut(&mut self) -> &mut Self::Target { - panic!() - } -} - -impl Deref for DerefMutOk { - type Target = T; - fn deref(&self) -> &Self::Target { - panic!() - } -} - -impl DerefMut for DerefMutOk { - fn deref_mut(&mut self) -> &mut Self::Target { - &mut self.0 - } -} - -fn main() { - // Check that mutable ref binding in match picks DerefMut - let mut b = DerefMutOk(0); - match *b { - ref mut n => n, - }; - - // Check that mutable ref binding in let picks DerefMut - let mut y = DerefMutOk(1); - let ref mut z = *y; - - // Check that immutable ref binding in match picks Deref - let mut b = DerefOk(2); - match *b { - ref n => n, - }; - - // Check that immutable ref binding in let picks Deref - let mut y = DerefOk(3); - let ref z = *y; - - // Check that mixed mutable/immutable ref binding in match picks DerefMut - let mut b = DerefMutOk((0, 9)); - match *b { - (ref mut n, ref m) => (n, m), - }; - - let mut b = DerefMutOk((0, 9)); - match *b { - (ref n, ref mut m) => (n, m), - }; - - // Check that mixed mutable/immutable ref binding in let picks DerefMut - let mut y = DerefMutOk((1, 8)); - let (ref mut z, ref a) = *y; - - let mut y = DerefMutOk((1, 8)); - let (ref z, ref mut a) = *y; - - // Check that multiple immutable ref bindings in match picks Deref - let mut b = DerefOk((2, 7)); - match *b { - (ref n, ref m) => (n, m), - }; - - // Check that multiple immutable ref bindings in let picks Deref - let mut y = DerefOk((3, 6)); - let (ref z, ref a) = *y; - - // Check that multiple mutable ref bindings in match picks DerefMut - let mut b = DerefMutOk((4, 5)); - match *b { - (ref mut n, ref mut m) => (n, m), - }; - - // Check that multiple mutable ref bindings in let picks DerefMut - let mut y = DerefMutOk((5, 4)); - let (ref mut z, ref mut a) = *y; -} diff --git a/src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs b/src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs deleted file mode 100644 index 8f0b3356d07..00000000000 --- a/src/test/ui/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we choose Deref or DerefMut appropriately based on mutability of ref bindings (#15609). - -fn main() { - use std::cell::RefCell; - - struct S { - node: E, - } - - enum E { - Foo(u32), - Bar, - } - - // Check match - let x = RefCell::new(S { node: E::Foo(0) }); - - let mut b = x.borrow_mut(); - match b.node { - E::Foo(ref mut n) => *n += 1, - _ => (), - } - - // Check let - let x = RefCell::new(0); - let mut y = x.borrow_mut(); - let ref mut z = *y; - - fn foo(a: &mut RefCell>) { - if let Some(ref mut s) = *a.borrow_mut() { - s.push('a') - } - } -} diff --git a/src/test/ui/run-pass/packed/auxiliary/packed.rs b/src/test/ui/run-pass/packed/auxiliary/packed.rs deleted file mode 100644 index 828be41cd41..00000000000 --- a/src/test/ui/run-pass/packed/auxiliary/packed.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(repr_packed)] - -#[repr(packed)] -pub struct P1S5 { - a: u8, - b: u32 -} - -#[repr(packed(2))] -pub struct P2S6 { - a: u8, - b: u32, - c: u8 -} - -#[repr(C, packed(2))] -pub struct P2CS8 { - a: u8, - b: u32, - c: u8 -} diff --git a/src/test/ui/run-pass/packed/packed-struct-borrow-element.rs b/src/test/ui/run-pass/packed/packed-struct-borrow-element.rs deleted file mode 100644 index 5d5bcbd325d..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-borrow-element.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten weird assertion? - -#![feature(repr_packed)] - -#[repr(packed)] -struct Foo1 { - bar: u8, - baz: usize -} - -#[repr(packed(2))] -struct Foo2 { - bar: u8, - baz: usize -} - -#[repr(C, packed(4))] -struct Foo4C { - bar: u8, - baz: usize -} - -pub fn main() { - let foo = Foo1 { bar: 1, baz: 2 }; - let brw = unsafe { &foo.baz }; - assert_eq!(*brw, 2); - - let foo = Foo2 { bar: 1, baz: 2 }; - let brw = unsafe { &foo.baz }; - assert_eq!(*brw, 2); - - let foo = Foo4C { bar: 1, baz: 2 }; - let brw = unsafe { &foo.baz }; - assert_eq!(*brw, 2); -} diff --git a/src/test/ui/run-pass/packed/packed-struct-drop-aligned.rs b/src/test/ui/run-pass/packed/packed-struct-drop-aligned.rs deleted file mode 100644 index 8cc29797772..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-drop-aligned.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cell::Cell; -use std::mem; - -struct Aligned<'a> { - drop_count: &'a Cell -} - -#[inline(never)] -fn check_align(ptr: *const Aligned) { - assert_eq!(ptr as usize % mem::align_of::(), - 0); -} - -impl<'a> Drop for Aligned<'a> { - fn drop(&mut self) { - check_align(self); - self.drop_count.set(self.drop_count.get() + 1); - } -} - -#[repr(packed)] -struct Packed<'a>(u8, Aligned<'a>); - -fn main() { - let drop_count = &Cell::new(0); - { - let mut p = Packed(0, Aligned { drop_count }); - p.1 = Aligned { drop_count }; - assert_eq!(drop_count.get(), 1); - } - assert_eq!(drop_count.get(), 2); -} diff --git a/src/test/ui/run-pass/packed/packed-struct-generic-layout.rs b/src/test/ui/run-pass/packed/packed-struct-generic-layout.rs deleted file mode 100644 index 30f7124f243..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-generic-layout.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - - -use std::mem; - -#[repr(packed)] -struct S { - a: T, - b: u8, - c: S -} - -pub fn main() { - unsafe { - let s = S { a: 0xff_ff_ff_ffu32, b: 1, c: 0xaa_aa_aa_aa as i32 }; - let transd : [u8; 9] = mem::transmute(s); - // Don't worry about endianness, the numbers are palindromic. - assert_eq!(transd, - [0xff, 0xff, 0xff, 0xff, - 1, - 0xaa, 0xaa, 0xaa, 0xaa]); - - - let s = S { a: 1u8, b: 2u8, c: 0b10000001_10000001 as i16}; - let transd : [u8; 4] = mem::transmute(s); - // Again, no endianness problems. - assert_eq!(transd, - [1, 2, 0b10000001, 0b10000001]); - } -} diff --git a/src/test/ui/run-pass/packed/packed-struct-generic-size.rs b/src/test/ui/run-pass/packed/packed-struct-generic-size.rs deleted file mode 100644 index 6df51f45729..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-generic-size.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![allow(unused_comparisons)] - -#![feature(repr_packed)] - -use std::mem; - -#[repr(packed)] -struct P1 { - a: T, - b: u8, - c: S -} - -#[repr(packed(2))] -struct P2 { - a: T, - b: u8, - c: S -} - -#[repr(C, packed(4))] -struct P4C { - a: T, - b: u8, - c: S -} - -macro_rules! check { - ($t:ty, $align:expr, $size:expr) => ({ - assert_eq!(mem::align_of::<$t>(), $align); - assert_eq!(mem::size_of::<$t>(), $size); - }); -} - -pub fn main() { - check!(P1::, 1, 3); - check!(P1::, 1, 11); - - check!(P2::, 1, 3); - check!(P2::, 2, 12); - - check!(P4C::, 1, 3); - check!(P4C::, 4, 12); -} diff --git a/src/test/ui/run-pass/packed/packed-struct-generic-size.stderr b/src/test/ui/run-pass/packed/packed-struct-generic-size.stderr deleted file mode 100644 index f9c343b60b0..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-generic-size.stderr +++ /dev/null @@ -1,36 +0,0 @@ -warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:48:14 - | -LL | check!(P1::, 1, 3); - | ^^ try removing `::` - -warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:49:14 - | -LL | check!(P1::, 1, 11); - | ^^ try removing `::` - -warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:51:14 - | -LL | check!(P2::, 1, 3); - | ^^ try removing `::` - -warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:52:14 - | -LL | check!(P2::, 2, 12); - | ^^ try removing `::` - -warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:54:15 - | -LL | check!(P4C::, 1, 3); - | ^^ try removing `::` - -warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:55:15 - | -LL | check!(P4C::, 4, 12); - | ^^ try removing `::` - diff --git a/src/test/ui/run-pass/packed/packed-struct-layout.rs b/src/test/ui/run-pass/packed/packed-struct-layout.rs deleted file mode 100644 index 2c9216a96c2..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-layout.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; - -#[repr(packed)] -struct S4 { - a: u8, - b: [u8; 3], -} - -#[repr(packed)] -struct S5 { - a: u8, - b: u32 -} - -pub fn main() { - unsafe { - let s4 = S4 { a: 1, b: [2,3,4] }; - let transd : [u8; 4] = mem::transmute(s4); - assert_eq!(transd, [1, 2, 3, 4]); - - let s5 = S5 { a: 1, b: 0xff_00_00_ff }; - let transd : [u8; 5] = mem::transmute(s5); - // Don't worry about endianness, the u32 is palindromic. - assert_eq!(transd, [1, 0xff, 0, 0, 0xff]); - } -} diff --git a/src/test/ui/run-pass/packed/packed-struct-match.rs b/src/test/ui/run-pass/packed/packed-struct-match.rs deleted file mode 100644 index e349a4e7f54..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-match.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(repr_packed)] - -#[repr(packed)] -struct Foo1 { - bar: u8, - baz: usize -} - -#[repr(packed(2))] -struct Foo2 { - bar: u8, - baz: usize -} - -#[repr(C, packed(4))] -struct Foo4C { - bar: u8, - baz: usize -} - -pub fn main() { - let foo1 = Foo1 { bar: 1, baz: 2 }; - match foo1 { - Foo1 {bar, baz} => { - assert_eq!(bar, 1); - assert_eq!(baz, 2); - } - } - - let foo2 = Foo2 { bar: 1, baz: 2 }; - match foo2 { - Foo2 {bar, baz} => { - assert_eq!(bar, 1); - assert_eq!(baz, 2); - } - } - - let foo4 = Foo4C { bar: 1, baz: 2 }; - match foo4 { - Foo4C {bar, baz} => { - assert_eq!(bar, 1); - assert_eq!(baz, 2); - } - } -} diff --git a/src/test/ui/run-pass/packed/packed-struct-optimized-enum.rs b/src/test/ui/run-pass/packed/packed-struct-optimized-enum.rs deleted file mode 100644 index e22e8c26fe5..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-optimized-enum.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[repr(packed)] -struct Packed(T); - -impl Copy for Packed {} -impl Clone for Packed { - fn clone(&self) -> Self { *self } -} - -fn sanity_check_size(one: T) { - let two = [one, one]; - let stride = (&two[1] as *const _ as usize) - (&two[0] as *const _ as usize); - let (size, align) = (std::mem::size_of::(), std::mem::align_of::()); - assert_eq!(stride, size); - assert_eq!(size % align, 0); -} - -fn main() { - // This can fail if rustc and LLVM disagree on the size of a type. - // In this case, `Option>` was erroneously not - // marked as packed despite needing alignment `1` and containing - // its `&()` discriminant, which has alignment larger than `1`. - sanity_check_size((Some(Packed((&(), 0))), true)); - - // In #46769, `Option<(Packed<&()>, bool)>` was found to have - // pointer alignment, without actually being aligned in size. - // E.g. on 64-bit platforms, it had alignment `8` but size `9`. - type PackedRefAndBool<'a> = (Packed<&'a ()>, bool); - sanity_check_size::>(Some((Packed(&()), true))); - - // Make sure we don't pay for the enum optimization in size, - // e.g. we shouldn't need extra padding after the packed data. - assert_eq!(std::mem::align_of::>(), 1); - assert_eq!(std::mem::size_of::>(), - std::mem::size_of::()); -} diff --git a/src/test/ui/run-pass/packed/packed-struct-size-xc.rs b/src/test/ui/run-pass/packed/packed-struct-size-xc.rs deleted file mode 100644 index 5b1fb6b92c7..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-size-xc.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:packed.rs - - -extern crate packed; - -use std::mem; - -macro_rules! check { - ($t:ty, $align:expr, $size:expr) => ({ - assert_eq!(mem::align_of::<$t>(), $align); - assert_eq!(mem::size_of::<$t>(), $size); - }); -} - -pub fn main() { - check!(packed::P1S5, 1, 5); - check!(packed::P2S6, 2, 6); - check!(packed::P2CS8, 2, 8); -} diff --git a/src/test/ui/run-pass/packed/packed-struct-size.rs b/src/test/ui/run-pass/packed/packed-struct-size.rs deleted file mode 100644 index 85e7f1544a0..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-size.rs +++ /dev/null @@ -1,169 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] - -#![feature(repr_packed)] - - -use std::mem; - -#[repr(packed)] -struct P1S4 { - a: u8, - b: [u8; 3], -} - -#[repr(packed(2))] -struct P2S4 { - a: u8, - b: [u8; 3], -} - -#[repr(packed)] -struct P1S5 { - a: u8, - b: u32 -} - -#[repr(packed(2))] -struct P2S2 { - a: u8, - b: u8 -} - -#[repr(packed(2))] -struct P2S6 { - a: u8, - b: u32 -} - -#[repr(packed(2))] -struct P2S12 { - a: u32, - b: u64 -} - -#[repr(packed)] -struct P1S13 { - a: i64, - b: f32, - c: u8, -} - -#[repr(packed(2))] -struct P2S14 { - a: i64, - b: f32, - c: u8, -} - -#[repr(packed(4))] -struct P4S16 { - a: u8, - b: f32, - c: i64, - d: u16, -} - -#[repr(C, packed(4))] -struct P4CS20 { - a: u8, - b: f32, - c: i64, - d: u16, -} - -enum Foo { - Bar = 1, - Baz = 2 -} - -#[repr(packed)] -struct P1S3_Foo { - a: u8, - b: u16, - c: Foo -} - -#[repr(packed(2))] -struct P2_Foo { - a: Foo, -} - -#[repr(packed(2))] -struct P2S3_Foo { - a: u8, - b: u16, - c: Foo -} - -#[repr(packed)] -struct P1S7_Option { - a: f32, - b: u8, - c: u16, - d: Option> -} - -#[repr(packed(2))] -struct P2_Option { - a: Option> -} - -#[repr(packed(2))] -struct P2S7_Option { - a: f32, - b: u8, - c: u16, - d: Option> -} - -// Placing packed structs in statics should work -static TEST_P1S4: P1S4 = P1S4 { a: 1, b: [2, 3, 4] }; -static TEST_P1S5: P1S5 = P1S5 { a: 3, b: 67 }; -static TEST_P1S3_Foo: P1S3_Foo = P1S3_Foo { a: 1, b: 2, c: Foo::Baz }; -static TEST_P2S2: P2S2 = P2S2 { a: 1, b: 2 }; -static TEST_P2S4: P2S4 = P2S4 { a: 1, b: [2, 3, 4] }; -static TEST_P2S6: P2S6 = P2S6 { a: 1, b: 2 }; -static TEST_P2S12: P2S12 = P2S12 { a: 1, b: 2 }; -static TEST_P4S16: P4S16 = P4S16 { a: 1, b: 2.0, c: 3, d: 4 }; -static TEST_P4CS20: P4CS20 = P4CS20 { a: 1, b: 2.0, c: 3, d: 4 }; - -fn align_to(value: usize, align: usize) -> usize { - (value + (align - 1)) & !(align - 1) -} - -macro_rules! check { - ($t:ty, $align:expr, $size:expr) => ({ - assert_eq!(mem::align_of::<$t>(), $align); - assert_eq!(mem::size_of::<$t>(), $size); - }); -} - -pub fn main() { - check!(P1S4, 1, 4); - check!(P1S5, 1, 5); - check!(P1S13, 1, 13); - check!(P1S3_Foo, 1, 3 + mem::size_of::()); - check!(P1S7_Option, 1, 7 + mem::size_of::>>()); - - check!(P2S2, 1, 2); - check!(P2S4, 1, 4); - check!(P2S6, 2, 6); - check!(P2S12, 2, 12); - check!(P2S14, 2, 14); - check!(P4S16, 4, 16); - check!(P4CS20, 4, 20); - check!(P2S3_Foo, 2, align_to(3 + mem::size_of::(), 2)); - check!(P2S7_Option, 2, align_to(7 + mem::size_of::(), 2)); -} diff --git a/src/test/ui/run-pass/packed/packed-struct-vec.rs b/src/test/ui/run-pass/packed/packed-struct-vec.rs deleted file mode 100644 index d64bfe0033b..00000000000 --- a/src/test/ui/run-pass/packed/packed-struct-vec.rs +++ /dev/null @@ -1,131 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(repr_packed)] - -use std::fmt; -use std::mem; - -#[repr(packed)] -#[derive(Copy, Clone)] -struct Foo1 { - bar: u8, - baz: u64 -} - -impl PartialEq for Foo1 { - fn eq(&self, other: &Foo1) -> bool { - self.bar == other.bar && self.baz == other.baz - } -} - -impl fmt::Debug for Foo1 { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let bar = self.bar; - let baz = self.baz; - - f.debug_struct("Foo1") - .field("bar", &bar) - .field("baz", &baz) - .finish() - } -} - -#[repr(packed(2))] -#[derive(Copy, Clone)] -struct Foo2 { - bar: u8, - baz: u64 -} - -impl PartialEq for Foo2 { - fn eq(&self, other: &Foo2) -> bool { - self.bar == other.bar && self.baz == other.baz - } -} - -impl fmt::Debug for Foo2 { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let bar = self.bar; - let baz = self.baz; - - f.debug_struct("Foo2") - .field("bar", &bar) - .field("baz", &baz) - .finish() - } -} - -#[repr(C, packed(4))] -#[derive(Copy, Clone)] -struct Foo4C { - bar: u8, - baz: u64 -} - -impl PartialEq for Foo4C { - fn eq(&self, other: &Foo4C) -> bool { - self.bar == other.bar && self.baz == other.baz - } -} - -impl fmt::Debug for Foo4C { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - let bar = self.bar; - let baz = self.baz; - - f.debug_struct("Foo4C") - .field("bar", &bar) - .field("baz", &baz) - .finish() - } -} - -pub fn main() { - let foo1s = [Foo1 { bar: 1, baz: 2 }; 10]; - - assert_eq!(mem::align_of::<[Foo1; 10]>(), 1); - assert_eq!(mem::size_of::<[Foo1; 10]>(), 90); - - for i in 0..10 { - assert_eq!(foo1s[i], Foo1 { bar: 1, baz: 2}); - } - - for &foo in &foo1s { - assert_eq!(foo, Foo1 { bar: 1, baz: 2 }); - } - - let foo2s = [Foo2 { bar: 1, baz: 2 }; 10]; - - assert_eq!(mem::align_of::<[Foo2; 10]>(), 2); - assert_eq!(mem::size_of::<[Foo2; 10]>(), 100); - - for i in 0..10 { - assert_eq!(foo2s[i], Foo2 { bar: 1, baz: 2}); - } - - for &foo in &foo2s { - assert_eq!(foo, Foo2 { bar: 1, baz: 2 }); - } - - let foo4s = [Foo4C { bar: 1, baz: 2 }; 10]; - - assert_eq!(mem::align_of::<[Foo4C; 10]>(), 4); - assert_eq!(mem::size_of::<[Foo4C; 10]>(), 120); - - for i in 0..10 { - assert_eq!(foo4s[i], Foo4C { bar: 1, baz: 2}); - } - - for &foo in &foo4s { - assert_eq!(foo, Foo4C { bar: 1, baz: 2 }); - } -} diff --git a/src/test/ui/run-pass/packed/packed-tuple-struct-layout.rs b/src/test/ui/run-pass/packed/packed-tuple-struct-layout.rs deleted file mode 100644 index c709a40cabb..00000000000 --- a/src/test/ui/run-pass/packed/packed-tuple-struct-layout.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; - -#[repr(packed)] -struct S4(u8,[u8; 3]); - -#[repr(packed)] -struct S5(u8,u32); - -pub fn main() { - unsafe { - let s4 = S4(1, [2,3,4]); - let transd : [u8; 4] = mem::transmute(s4); - assert_eq!(transd, [1, 2, 3, 4]); - - let s5 = S5(1, 0xff_00_00_ff); - let transd : [u8; 5] = mem::transmute(s5); - // Don't worry about endianness, the u32 is palindromic. - assert_eq!(transd, [1, 0xff, 0, 0, 0xff]); - } -} diff --git a/src/test/ui/run-pass/packed/packed-tuple-struct-size.rs b/src/test/ui/run-pass/packed/packed-tuple-struct-size.rs deleted file mode 100644 index b4e24925f75..00000000000 --- a/src/test/ui/run-pass/packed/packed-tuple-struct-size.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#![feature(repr_packed)] - -use std::mem; - -#[repr(packed)] -struct P1S4(u8,[u8; 3]); - -#[repr(packed(2))] -struct P2S4(u8,[u8; 3]); - -#[repr(packed)] -struct P1S5(u8, u32); - -#[repr(packed(2))] -struct P2S6(u8, u32); - -#[repr(packed)] -struct P1S13(i64, f32, u8); - -#[repr(packed(2))] -struct P2S14(i64, f32, u8); - -#[repr(packed(4))] -struct P4S16(u8, f32, i64, u16); - -#[repr(C, packed(4))] -struct P4CS20(u8, f32, i64, u16); - -enum Foo { - Bar = 1, - Baz = 2 -} - -#[repr(packed)] -struct P1S3_Foo(u8, u16, Foo); - -#[repr(packed(2))] -struct P2_Foo(Foo); - -#[repr(packed(2))] -struct P2S3_Foo(u8, u16, Foo); - -#[repr(packed)] -struct P1S7_Option(f32, u8, u16, Option>); - -#[repr(packed(2))] -struct P2_Option(Option>); - -#[repr(packed(2))] -struct P2S7_Option(f32, u8, u16, Option>); - -fn align_to(value: usize, align: usize) -> usize { - (value + (align - 1)) & !(align - 1) -} - -macro_rules! check { - ($t:ty, $align:expr, $size:expr) => ({ - assert_eq!(mem::align_of::<$t>(), $align); - assert_eq!(mem::size_of::<$t>(), $size); - }); -} - -pub fn main() { - check!(P1S4, 1, 4); - check!(P1S5, 1, 5); - check!(P1S13, 1, 13); - check!(P1S3_Foo, 1, 3 + mem::size_of::()); - check!(P1S7_Option, 1, 7 + mem::size_of::>>()); - - check!(P2S4, 1, 4); - check!(P2S6, 2, 6); - check!(P2S14, 2, 14); - check!(P4S16, 4, 16); - check!(P4CS20, 4, 20); - check!(P2S3_Foo, 2, align_to(3 + mem::size_of::(), 2)); - check!(P2S7_Option, 2, align_to(7 + mem::size_of::(), 2)); -} diff --git a/src/test/ui/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs b/src/test/ui/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs deleted file mode 100644 index 5bff65d0cfa..00000000000 --- a/src/test/ui/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags:-C panic=abort -// aux-build:exit-success-if-unwind.rs -// no-prefer-dynamic -// ignore-cloudabi no processes -// ignore-emscripten no processes -// ignore-macos - -extern crate exit_success_if_unwind; - -use std::process::Command; -use std::env; - -fn main() { - let mut args = env::args_os(); - let me = args.next().unwrap(); - - if let Some(s) = args.next() { - if &*s == "foo" { - exit_success_if_unwind::bar(do_panic); - } - } - - let mut cmd = Command::new(env::args_os().next().unwrap()); - cmd.arg("foo"); - - - // ARMv6 hanges while printing the backtrace, see #41004 - if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") { - cmd.env("RUST_BACKTRACE", "0"); - } - - let s = cmd.status(); - assert!(s.unwrap().code() != Some(0)); -} - -fn do_panic() { - panic!("try to catch me"); -} diff --git a/src/test/ui/run-pass/panic-runtime/abort.rs b/src/test/ui/run-pass/panic-runtime/abort.rs deleted file mode 100644 index 2275efa188e..00000000000 --- a/src/test/ui/run-pass/panic-runtime/abort.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags:-C panic=abort -// no-prefer-dynamic -// ignore-cloudabi no processes -// ignore-emscripten no processes -// ignore-macos - -use std::process::Command; -use std::env; - -struct Bomb; - -impl Drop for Bomb { - fn drop(&mut self) { - std::process::exit(0); - } -} - -fn main() { - let mut args = env::args_os(); - let me = args.next().unwrap(); - - if let Some(s) = args.next() { - if &*s == "foo" { - - let _bomb = Bomb; - - panic!("try to catch me"); - } - } - - let mut cmd = Command::new(env::args_os().next().unwrap()); - cmd.arg("foo"); - - // ARMv6 hanges while printing the backtrace, see #41004 - if cfg!(target_arch = "arm") && cfg!(target_env = "gnu") { - cmd.env("RUST_BACKTRACE", "0"); - } - - let s = cmd.status(); - assert!(s.unwrap().code() != Some(0)); -} diff --git a/src/test/ui/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs b/src/test/ui/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs deleted file mode 100644 index 9e5fc592b1a..00000000000 --- a/src/test/ui/run-pass/panic-runtime/auxiliary/exit-success-if-unwind.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] - -struct Bomb; - -impl Drop for Bomb { - fn drop(&mut self) { - std::process::exit(0); - } -} - -pub fn bar(f: fn()) { - let _bomb = Bomb; - f(); -} diff --git a/src/test/ui/run-pass/panic-runtime/link-to-abort.rs b/src/test/ui/run-pass/panic-runtime/link-to-abort.rs deleted file mode 100644 index 5016c9591b0..00000000000 --- a/src/test/ui/run-pass/panic-runtime/link-to-abort.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags:-C panic=abort -// no-prefer-dynamic -// ignore-macos - -#![feature(panic_abort)] - -extern crate panic_abort; - -fn main() {} diff --git a/src/test/ui/run-pass/panic-runtime/link-to-unwind.rs b/src/test/ui/run-pass/panic-runtime/link-to-unwind.rs deleted file mode 100644 index 47d7aeaef26..00000000000 --- a/src/test/ui/run-pass/panic-runtime/link-to-unwind.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// no-prefer-dynamic - -#![feature(panic_unwind)] - -extern crate panic_unwind; - -fn main() { -} diff --git a/src/test/ui/run-pass/panic-runtime/lto-abort.rs b/src/test/ui/run-pass/panic-runtime/lto-abort.rs deleted file mode 100644 index 6e3dbe1d0f3..00000000000 --- a/src/test/ui/run-pass/panic-runtime/lto-abort.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags:-C lto -C panic=abort -// no-prefer-dynamic -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::process::Command; -use std::env; - -struct Bomb; - -impl Drop for Bomb { - fn drop(&mut self) { - std::process::exit(0); - } -} - -fn main() { - let mut args = env::args_os(); - let me = args.next().unwrap(); - - if let Some(s) = args.next() { - if &*s == "foo" { - - let _bomb = Bomb; - - panic!("try to catch me"); - } - } - let s = Command::new(env::args_os().next().unwrap()).arg("foo").status(); - assert!(s.unwrap().code() != Some(0)); -} diff --git a/src/test/ui/run-pass/panic-runtime/lto-unwind.rs b/src/test/ui/run-pass/panic-runtime/lto-unwind.rs deleted file mode 100644 index a0caa4e80c2..00000000000 --- a/src/test/ui/run-pass/panic-runtime/lto-unwind.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags:-C lto -C panic=unwind -// no-prefer-dynamic -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::process::Command; -use std::env; - -struct Bomb; - -impl Drop for Bomb { - fn drop(&mut self) { - println!("hurray you ran me"); - } -} - -fn main() { - let mut args = env::args_os(); - let me = args.next().unwrap(); - - if let Some(s) = args.next() { - if &*s == "foo" { - - let _bomb = Bomb; - - panic!("try to catch me"); - } - } - let s = Command::new(env::args_os().next().unwrap()).arg("foo").output(); - let s = s.unwrap(); - assert!(!s.status.success()); - assert!(String::from_utf8_lossy(&s.stdout).contains("hurray you ran me")); -} diff --git a/src/test/ui/run-pass/panics/panic-handler-chain.rs b/src/test/ui/run-pass/panics/panic-handler-chain.rs deleted file mode 100644 index c4c3dc1963e..00000000000 --- a/src/test/ui/run-pass/panics/panic-handler-chain.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// ignore-emscripten no threads support - -#![feature(std_panic)] - -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::panic; -use std::thread; - -static A: AtomicUsize = AtomicUsize::new(0); -static B: AtomicUsize = AtomicUsize::new(0); - -fn main() { - panic::set_hook(Box::new(|_| { A.fetch_add(1, Ordering::SeqCst); })); - let hook = panic::take_hook(); - panic::set_hook(Box::new(move |info| { - B.fetch_add(1, Ordering::SeqCst); - hook(info); - })); - - let _ = thread::spawn(|| { - panic!(); - }).join(); - - assert_eq!(1, A.load(Ordering::SeqCst)); - assert_eq!(1, B.load(Ordering::SeqCst)); -} diff --git a/src/test/ui/run-pass/panics/panic-handler-flail-wildly.rs b/src/test/ui/run-pass/panics/panic-handler-flail-wildly.rs deleted file mode 100644 index 5715202067e..00000000000 --- a/src/test/ui/run-pass/panics/panic-handler-flail-wildly.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// ignore-emscripten no threads support - -#![feature(std_panic)] - -use std::panic; -use std::thread; - -fn a() { - panic::set_hook(Box::new(|_| println!("hello yes this is a"))); - panic::take_hook(); - panic::set_hook(Box::new(|_| println!("hello yes this is a part 2"))); - panic::take_hook(); -} - -fn b() { - panic::take_hook(); - panic::take_hook(); - panic::take_hook(); - panic::take_hook(); - panic::take_hook(); - panic!(); -} - -fn c() { - panic::set_hook(Box::new(|_| ())); - panic::set_hook(Box::new(|_| ())); - panic::set_hook(Box::new(|_| ())); - panic::set_hook(Box::new(|_| ())); - panic::set_hook(Box::new(|_| ())); - panic::set_hook(Box::new(|_| ())); - panic!(); -} - -fn main() { - for _ in 0..10 { - let mut handles = vec![]; - for _ in 0..10 { - handles.push(thread::spawn(a)); - } - for _ in 0..10 { - handles.push(thread::spawn(b)); - } - for _ in 0..10 { - handles.push(thread::spawn(c)); - } - for handle in handles { - let _ = handle.join(); - } - } -} diff --git a/src/test/ui/run-pass/panics/panic-handler-set-twice.rs b/src/test/ui/run-pass/panics/panic-handler-set-twice.rs deleted file mode 100644 index 340333b119e..00000000000 --- a/src/test/ui/run-pass/panics/panic-handler-set-twice.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(std_panic)] - -// ignore-emscripten no threads support - -use std::sync::atomic::{AtomicUsize, Ordering}; -use std::panic; -use std::thread; - -static A: AtomicUsize = AtomicUsize::new(0); - -fn main() { - panic::set_hook(Box::new(|_| ())); - panic::set_hook(Box::new(|info| { A.fetch_add(1, Ordering::SeqCst); })); - - let _ = thread::spawn(|| { - panic!(); - }).join(); - - assert_eq!(1, A.load(Ordering::SeqCst)); -} diff --git a/src/test/ui/run-pass/panics/panic-in-dtor-drops-fields.rs b/src/test/ui/run-pass/panics/panic-in-dtor-drops-fields.rs deleted file mode 100644 index f5dd2716d2c..00000000000 --- a/src/test/ui/run-pass/panics/panic-in-dtor-drops-fields.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// ignore-emscripten no threads support - -use std::thread; - -static mut dropped: bool = false; - -struct A { - b: B, -} - -struct B { - foo: isize, -} - -impl Drop for A { - fn drop(&mut self) { - panic!() - } -} - -impl Drop for B { - fn drop(&mut self) { - unsafe { dropped = true; } - } -} - -pub fn main() { - let ret = thread::spawn(move|| { - let _a = A { b: B { foo: 3 } }; - }).join(); - assert!(ret.is_err()); - unsafe { assert!(dropped); } -} diff --git a/src/test/ui/run-pass/panics/panic-recover-propagate.rs b/src/test/ui/run-pass/panics/panic-recover-propagate.rs deleted file mode 100644 index 42571615105..00000000000 --- a/src/test/ui/run-pass/panics/panic-recover-propagate.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; -use std::panic; -use std::thread; - -static A: AtomicUsize = ATOMIC_USIZE_INIT; - -fn main() { - panic::set_hook(Box::new(|_| { - A.fetch_add(1, Ordering::SeqCst); - })); - - let result = thread::spawn(|| { - let result = panic::catch_unwind(|| { - panic!("hi there"); - }); - - panic::resume_unwind(result.unwrap_err()); - }).join(); - - let msg = *result.unwrap_err().downcast::<&'static str>().unwrap(); - assert_eq!("hi there", msg); - assert_eq!(1, A.load(Ordering::SeqCst)); -} diff --git a/src/test/ui/run-pass/panics/panic-safe.rs b/src/test/ui/run-pass/panics/panic-safe.rs deleted file mode 100644 index 0d1ce110639..00000000000 --- a/src/test/ui/run-pass/panics/panic-safe.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -use std::panic::{UnwindSafe, AssertUnwindSafe}; -use std::cell::RefCell; -use std::sync::{Mutex, RwLock, Arc}; -use std::rc::Rc; - -struct Foo { a: i32 } - -fn assert() {} - -fn main() { - assert::(); - assert::<&i32>(); - assert::<*mut i32>(); - assert::<*const i32>(); - assert::(); - assert::(); - assert::<&str>(); - assert::(); - assert::<&Foo>(); - assert::>(); - assert::(); - assert::>(); - assert::>(); - assert::>(); - assert::>(); - assert::<&Mutex>(); - assert::<&RwLock>(); - assert::>(); - assert::>(); - assert::>(); - - trait Trait: UnwindSafe {} - assert::>(); - - fn bar() { - assert::>(); - assert::>(); - } - fn baz() { - assert::>(); - assert::>(); - assert::>(); - assert::>(); - assert::<&AssertUnwindSafe>(); - assert::>>(); - assert::>>(); - } -} diff --git a/src/test/ui/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs b/src/test/ui/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs deleted file mode 100644 index 19cdede5518..00000000000 --- a/src/test/ui/run-pass/privacy/auxiliary/priv-impl-prim-ty.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait A { - fn frob(&self); -} - -impl A for isize { fn frob(&self) {} } - -pub fn frob(t: T) { - t.frob(); -} diff --git a/src/test/ui/run-pass/privacy/auxiliary/privacy_reexport.rs b/src/test/ui/run-pass/privacy/auxiliary/privacy_reexport.rs deleted file mode 100644 index fd97f210a55..00000000000 --- a/src/test/ui/run-pass/privacy/auxiliary/privacy_reexport.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub extern crate core; -pub use foo as bar; - -pub mod foo { - pub fn frob() {} -} diff --git a/src/test/ui/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs b/src/test/ui/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs deleted file mode 100644 index e4890f4fe2d..00000000000 --- a/src/test/ui/run-pass/privacy/auxiliary/pub_use_mods_xcrate.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod a { - pub use a::b::c; - - pub mod b { - pub mod c { - fn f(){} - fn g(){} - } - } -} diff --git a/src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate1.rs b/src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate1.rs deleted file mode 100644 index 41aafd64cb3..00000000000 --- a/src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate1.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo { - pub name: isize -} diff --git a/src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate2.rs b/src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate2.rs deleted file mode 100644 index d59d7f2a613..00000000000 --- a/src/test/ui/run-pass/privacy/auxiliary/pub_use_xcrate2.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -extern crate pub_use_xcrate1; - -pub use pub_use_xcrate1::Foo; diff --git a/src/test/ui/run-pass/privacy/priv-impl-prim-ty.rs b/src/test/ui/run-pass/privacy/priv-impl-prim-ty.rs deleted file mode 100644 index 2cb4dee90af..00000000000 --- a/src/test/ui/run-pass/privacy/priv-impl-prim-ty.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:priv-impl-prim-ty.rs - -// pretty-expanded FIXME #23616 - -extern crate priv_impl_prim_ty as bar; - -pub fn main() { - bar::frob(1); - -} diff --git a/src/test/ui/run-pass/privacy/privacy-ns.rs b/src/test/ui/run-pass/privacy/privacy-ns.rs deleted file mode 100644 index f11ff3f41a1..00000000000 --- a/src/test/ui/run-pass/privacy/privacy-ns.rs +++ /dev/null @@ -1,124 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - - -// Check we do the correct privacy checks when we import a name and there is an -// item with that name in both the value and type namespaces. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] -#![allow(unused_imports)] - - -// public type, private value -pub mod foo1 { - pub trait Bar { - fn dummy(&self) { } - } - pub struct Baz; - - fn Bar() { } -} - -fn test_unused1() { - use foo1::*; -} - -fn test_single1() { - use foo1::Bar; - - let _x: Box; -} - -fn test_list1() { - use foo1::{Bar,Baz}; - - let _x: Box; -} - -fn test_glob1() { - use foo1::*; - - let _x: Box; -} - -// private type, public value -pub mod foo2 { - trait Bar { - fn dummy(&self) { } - } - pub struct Baz; - - pub fn Bar() { } -} - -fn test_unused2() { - use foo2::*; -} - -fn test_single2() { - use foo2::Bar; - - Bar(); -} - -fn test_list2() { - use foo2::{Bar,Baz}; - - Bar(); -} - -fn test_glob2() { - use foo2::*; - - Bar(); -} - -// public type, public value -pub mod foo3 { - pub trait Bar { - fn dummy(&self) { } - } - pub struct Baz; - - pub fn Bar() { } -} - -fn test_unused3() { - use foo3::*; -} - -fn test_single3() { - use foo3::Bar; - - Bar(); - let _x: Box; -} - -fn test_list3() { - use foo3::{Bar,Baz}; - - Bar(); - let _x: Box; -} - -fn test_glob3() { - use foo3::*; - - Bar(); - let _x: Box; -} - -fn main() { -} diff --git a/src/test/ui/run-pass/privacy/privacy-reexport.rs b/src/test/ui/run-pass/privacy/privacy-reexport.rs deleted file mode 100644 index a12f7bb2611..00000000000 --- a/src/test/ui/run-pass/privacy/privacy-reexport.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:privacy_reexport.rs - -// pretty-expanded FIXME #23616 - -extern crate privacy_reexport; - -pub fn main() { - // Check that public extern crates are visible to outside crates - privacy_reexport::core::cell::Cell::new(0); - - privacy_reexport::bar::frob(); -} diff --git a/src/test/ui/run-pass/privacy/privacy1.rs b/src/test/ui/run-pass/privacy/privacy1.rs deleted file mode 100644 index 7c1dbb500d8..00000000000 --- a/src/test/ui/run-pass/privacy/privacy1.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub mod test2 { - // This used to generate an ICE (make sure that default functions are - // parented to their trait to find the first private thing as the trait). - - struct B; - trait A { fn foo(&self) {} } - impl A for B {} - - mod tests { - use super::A; - fn foo() { - let a = super::B; - a.foo(); - } - } -} - - -pub fn main() {} diff --git a/src/test/ui/run-pass/privacy/private-class-field.rs b/src/test/ui/run-pass/privacy/private-class-field.rs deleted file mode 100644 index 2910c462c2b..00000000000 --- a/src/test/ui/run-pass/privacy/private-class-field.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -struct cat { - meows : usize, - - how_hungry : isize, -} - -impl cat { - pub fn meow_count(&mut self) -> usize { self.meows } -} - -fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } -} - -pub fn main() { - let mut nyan : cat = cat(52, 99); - assert_eq!(nyan.meow_count(), 52); -} diff --git a/src/test/ui/run-pass/privacy/private-method.rs b/src/test/ui/run-pass/privacy/private-method.rs deleted file mode 100644 index a0f012a6059..00000000000 --- a/src/test/ui/run-pass/privacy/private-method.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct cat { - meows : usize, - - how_hungry : isize, -} - -impl cat { - pub fn play(&mut self) { - self.meows += 1_usize; - self.nap(); - } -} - -impl cat { - fn nap(&mut self) { for _ in 1_usize..10_usize { } } -} - -fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } -} - -pub fn main() { - let mut nyan : cat = cat(52_usize, 99); - nyan.play(); -} diff --git a/src/test/ui/run-pass/privacy/pub-extern-privacy.rs b/src/test/ui/run-pass/privacy/pub-extern-privacy.rs deleted file mode 100644 index a86133fb283..00000000000 --- a/src/test/ui/run-pass/privacy/pub-extern-privacy.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -// pretty-expanded FIXME #23616 - -use std::mem::transmute; - -mod a { - extern { - pub fn free(x: *const u8); - } -} - -pub fn main() { - unsafe { - a::free(transmute(0_usize)); - } -} diff --git a/src/test/ui/run-pass/privacy/pub-use-xcrate.rs b/src/test/ui/run-pass/privacy/pub-use-xcrate.rs deleted file mode 100644 index f9c2de224db..00000000000 --- a/src/test/ui/run-pass/privacy/pub-use-xcrate.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:pub_use_xcrate1.rs -// aux-build:pub_use_xcrate2.rs - -// pretty-expanded FIXME #23616 - -extern crate pub_use_xcrate2; - -use pub_use_xcrate2::Foo; - -pub fn main() { - let _foo: Foo = Foo { - name: 0 - }; -} diff --git a/src/test/ui/run-pass/privacy/pub_use_mods_xcrate_exe.rs b/src/test/ui/run-pass/privacy/pub_use_mods_xcrate_exe.rs deleted file mode 100644 index 4ca7c735308..00000000000 --- a/src/test/ui/run-pass/privacy/pub_use_mods_xcrate_exe.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:pub_use_mods_xcrate.rs - -// pretty-expanded FIXME #23616 - -#![allow(unused_imports)] - -extern crate pub_use_mods_xcrate; -use pub_use_mods_xcrate::a::c; - -pub fn main(){} diff --git a/src/test/ui/run-pass/process/process-envs.rs b/src/test/ui/run-pass/process/process-envs.rs deleted file mode 100644 index 4fb21d4dc66..00000000000 --- a/src/test/ui/run-pass/process/process-envs.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2014, 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::process::Command; -use std::env; -use std::collections::HashMap; - -#[cfg(all(unix, not(target_os="android")))] -pub fn env_cmd() -> Command { - Command::new("env") -} -#[cfg(target_os="android")] -pub fn env_cmd() -> Command { - let mut cmd = Command::new("/system/bin/sh"); - cmd.arg("-c").arg("set"); - cmd -} - -#[cfg(windows)] -pub fn env_cmd() -> Command { - let mut cmd = Command::new("cmd"); - cmd.arg("/c").arg("set"); - cmd -} - -fn main() { - // save original environment - let old_env = env::var_os("RUN_TEST_NEW_ENV"); - - env::set_var("RUN_TEST_NEW_ENV", "123"); - - // create filtered environment vector - let filtered_env : HashMap = - env::vars().filter(|&(ref k, _)| k == "PATH").collect(); - - let mut cmd = env_cmd(); - cmd.env_clear(); - cmd.envs(&filtered_env); - - // restore original environment - match old_env { - None => env::remove_var("RUN_TEST_NEW_ENV"), - Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val) - } - - let result = cmd.output().unwrap(); - let output = String::from_utf8_lossy(&result.stdout); - - assert!(!output.contains("RUN_TEST_NEW_ENV"), - "found RUN_TEST_NEW_ENV inside of:\n\n{}", output); -} diff --git a/src/test/ui/run-pass/process/process-exit.rs b/src/test/ui/run-pass/process/process-exit.rs deleted file mode 100644 index e43631e3189..00000000000 --- a/src/test/ui/run-pass/process/process-exit.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::env; -use std::process::{self, Command, Stdio}; - -fn main() { - let args: Vec = env::args().collect(); - if args.len() > 1 && args[1] == "child" { - child(); - } else { - parent(); - } -} - -fn parent() { - let args: Vec = env::args().collect(); - let status = Command::new(&args[0]).arg("child").status().unwrap(); - assert_eq!(status.code(), Some(2)); -} - -fn child() -> i32 { - process::exit(2); -} diff --git a/src/test/ui/run-pass/process/process-remove-from-env.rs b/src/test/ui/run-pass/process/process-remove-from-env.rs deleted file mode 100644 index d9c35f3e993..00000000000 --- a/src/test/ui/run-pass/process/process-remove-from-env.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::process::Command; -use std::env; - -#[cfg(all(unix, not(target_os="android")))] -pub fn env_cmd() -> Command { - Command::new("env") -} -#[cfg(target_os="android")] -pub fn env_cmd() -> Command { - let mut cmd = Command::new("/system/bin/sh"); - cmd.arg("-c").arg("set"); - cmd -} - -#[cfg(windows)] -pub fn env_cmd() -> Command { - let mut cmd = Command::new("cmd"); - cmd.arg("/c").arg("set"); - cmd -} - -fn main() { - // save original environment - let old_env = env::var_os("RUN_TEST_NEW_ENV"); - - env::set_var("RUN_TEST_NEW_ENV", "123"); - - let mut cmd = env_cmd(); - cmd.env_remove("RUN_TEST_NEW_ENV"); - - // restore original environment - match old_env { - None => env::remove_var("RUN_TEST_NEW_ENV"), - Some(val) => env::set_var("RUN_TEST_NEW_ENV", &val) - } - - let result = cmd.output().unwrap(); - let output = String::from_utf8_lossy(&result.stdout); - - assert!(!output.contains("RUN_TEST_NEW_ENV"), - "found RUN_TEST_NEW_ENV inside of:\n\n{}", output); -} diff --git a/src/test/ui/run-pass/process/process-sigpipe.rs b/src/test/ui/run-pass/process/process-sigpipe.rs deleted file mode 100644 index d1e3fba14cf..00000000000 --- a/src/test/ui/run-pass/process/process-sigpipe.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -// ignore-android since the dynamic linker sets a SIGPIPE handler (to do -// a crash report) so inheritance is moot on the entire platform - -// libstd ignores SIGPIPE, and other libraries may set signal masks. -// Make sure that these behaviors don't get inherited to children -// spawned via std::process, since they're needed for traditional UNIX -// filter behavior. This test checks that `yes | head` terminates -// (instead of running forever), and that it does not print an error -// message about a broken pipe. - -// ignore-cloudabi no subprocesses support -// ignore-emscripten no threads support - -use std::process; -use std::thread; - -#[cfg(unix)] -fn main() { - // Just in case `yes` doesn't check for EPIPE... - thread::spawn(|| { - thread::sleep_ms(5000); - process::exit(1); - }); - let output = process::Command::new("sh").arg("-c").arg("yes | head").output().unwrap(); - assert!(output.status.success()); - assert!(output.stderr.len() == 0); -} - -#[cfg(not(unix))] -fn main() { - // Not worried about signal masks on other platforms -} diff --git a/src/test/ui/run-pass/process/process-spawn-nonexistent.rs b/src/test/ui/run-pass/process/process-spawn-nonexistent.rs deleted file mode 100644 index 926e93104f3..00000000000 --- a/src/test/ui/run-pass/process/process-spawn-nonexistent.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::io::ErrorKind; -use std::process::Command; - -fn main() { - assert_eq!(Command::new("nonexistent") - .spawn() - .unwrap_err() - .kind(), - ErrorKind::NotFound); -} diff --git a/src/test/ui/run-pass/process/process-spawn-with-unicode-params.rs b/src/test/ui/run-pass/process/process-spawn-with-unicode-params.rs deleted file mode 100644 index 70ed7982508..00000000000 --- a/src/test/ui/run-pass/process/process-spawn-with-unicode-params.rs +++ /dev/null @@ -1,86 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// no-prefer-dynamic - -// The test copies itself into a subdirectory with a non-ASCII name and then -// runs it as a child process within the subdirectory. The parent process -// also adds an environment variable and an argument, both containing -// non-ASCII characters. The child process ensures all the strings are -// intact. - -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::io::prelude::*; -use std::io; -use std::fs; -use std::process::Command; -use std::env; -use std::path::Path; - -fn main() { - let my_args = env::args().collect::>(); - let my_cwd = env::current_dir().unwrap(); - let my_env = env::vars().collect::>(); - let my_path = env::current_exe().unwrap(); - let my_dir = my_path.parent().unwrap(); - let my_ext = my_path.extension().and_then(|s| s.to_str()).unwrap_or(""); - - // some non-ASCII characters - let blah = "\u{3c0}\u{42f}\u{97f3}\u{e6}\u{221e}"; - - let child_name = "child"; - let child_dir = format!("process-spawn-with-unicode-params-{}", blah); - - // parameters sent to child / expected to be received from parent - let arg = blah; - let cwd = my_dir.join(&child_dir); - let env = ("RUST_TEST_PROC_SPAWN_UNICODE".to_string(), blah.to_string()); - - // am I the parent or the child? - if my_args.len() == 1 { // parent - - let child_filestem = Path::new(child_name); - let child_filename = child_filestem.with_extension(my_ext); - let child_path = cwd.join(&child_filename); - - // make a separate directory for the child - let _ = fs::create_dir(&cwd); - fs::copy(&my_path, &child_path).unwrap(); - - // run child - let p = Command::new(&child_path) - .arg(arg) - .current_dir(&cwd) - .env(&env.0, &env.1) - .spawn().unwrap().wait_with_output().unwrap(); - - // display the output - io::stdout().write_all(&p.stdout).unwrap(); - io::stderr().write_all(&p.stderr).unwrap(); - - // make sure the child succeeded - assert!(p.status.success()); - - } else { // child - - // check working directory (don't try to compare with `cwd` here!) - assert!(my_cwd.ends_with(&child_dir)); - - // check arguments - assert_eq!(&*my_args[1], arg); - - // check environment variable - assert!(my_env.contains(&env)); - - }; -} diff --git a/src/test/ui/run-pass/process/process-status-inherits-stdin.rs b/src/test/ui/run-pass/process/process-status-inherits-stdin.rs deleted file mode 100644 index 1b09d5e52bc..00000000000 --- a/src/test/ui/run-pass/process/process-status-inherits-stdin.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi no processes -// ignore-emscripten no processes - -use std::env; -use std::io; -use std::io::Write; -use std::process::{Command, Stdio}; - -fn main() { - let mut args = env::args(); - let me = args.next().unwrap(); - let arg = args.next(); - match arg.as_ref().map(|s| &s[..]) { - None => { - let mut s = Command::new(&me) - .arg("a1") - .stdin(Stdio::piped()) - .spawn() - .unwrap(); - s.stdin.take().unwrap().write_all(b"foo\n").unwrap(); - let s = s.wait().unwrap(); - assert!(s.success()); - } - Some("a1") => { - let s = Command::new(&me).arg("a2").status().unwrap(); - assert!(s.success()); - } - Some(..) => { - let mut s = String::new(); - io::stdin().read_line(&mut s).unwrap(); - assert_eq!(s, "foo\n"); - } - } -} diff --git a/src/test/ui/run-pass/regions/regions-addr-of-interior-of-unique-box.rs b/src/test/ui/run-pass/regions/regions-addr-of-interior-of-unique-box.rs deleted file mode 100644 index 770733b8939..00000000000 --- a/src/test/ui/run-pass/regions/regions-addr-of-interior-of-unique-box.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -struct Point { - x: isize, - y: isize -} - -struct Character { - pos: Box, -} - -fn get_x(x: &Character) -> &isize { - // interesting case because the scope of this - // borrow of the unique pointer is in fact - // larger than the fn itself - return &x.pos.x; -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/regions/regions-addr-of-ret.rs b/src/test/ui/run-pass/regions/regions-addr-of-ret.rs deleted file mode 100644 index a9953edb2f5..00000000000 --- a/src/test/ui/run-pass/regions/regions-addr-of-ret.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn f(x: &isize) -> &isize { - return &*x; -} - -pub fn main() { - let three = &3; - println!("{}", *f(three)); -} diff --git a/src/test/ui/run-pass/regions/regions-assoc-type-region-bound.rs b/src/test/ui/run-pass/regions/regions-assoc-type-region-bound.rs deleted file mode 100644 index a7801136a84..00000000000 --- a/src/test/ui/run-pass/regions/regions-assoc-type-region-bound.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the compiler considers the 'a bound declared in the -// trait. Issue #20890. - -// pretty-expanded FIXME #23616 - -trait Foo<'a> { - type Value: 'a; - - fn get(&self) -> &'a Self::Value; -} - -fn takes_foo<'a,F: Foo<'a>>(f: &'a F) { - // This call would be illegal, because it results in &'a F::Value, - // and the only way we know that `F::Value : 'a` is because of the - // trait declaration. - - f.get(); -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-assoc-type-static-bound.rs b/src/test/ui/run-pass/regions/regions-assoc-type-static-bound.rs deleted file mode 100644 index b81d3056813..00000000000 --- a/src/test/ui/run-pass/regions/regions-assoc-type-static-bound.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the compiler considers the 'static bound declared in the -// trait. Issue #20890. - -// pretty-expanded FIXME #23616 - -trait Foo { - type Value: 'static; - fn dummy(&self) { } -} - -fn require_static() {} - -fn takes_foo() { - require_static::() -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-borrow-at.rs b/src/test/ui/run-pass/regions/regions-borrow-at.rs deleted file mode 100644 index 02603292d1b..00000000000 --- a/src/test/ui/run-pass/regions/regions-borrow-at.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn foo(x: &usize) -> usize { - *x -} - -pub fn main() { - let p: Box<_> = box 22; - let r = foo(&*p); - println!("r={}", r); - assert_eq!(r, 22); -} diff --git a/src/test/ui/run-pass/regions/regions-borrow-evec-fixed.rs b/src/test/ui/run-pass/regions/regions-borrow-evec-fixed.rs deleted file mode 100644 index 50336cf8cdc..00000000000 --- a/src/test/ui/run-pass/regions/regions-borrow-evec-fixed.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn foo(x: &[isize]) -> isize { - x[0] -} - -pub fn main() { - let p = &[1,2,3,4,5]; - assert_eq!(foo(p), 1); -} diff --git a/src/test/ui/run-pass/regions/regions-borrow-evec-uniq.rs b/src/test/ui/run-pass/regions/regions-borrow-evec-uniq.rs deleted file mode 100644 index 5f61ab89635..00000000000 --- a/src/test/ui/run-pass/regions/regions-borrow-evec-uniq.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn foo(x: &[isize]) -> isize { - x[0] -} - -pub fn main() { - let p = vec![1,2,3,4,5]; - let r = foo(&p); - assert_eq!(r, 1); - - let p = vec![5,4,3,2,1]; - let r = foo(&p); - assert_eq!(r, 5); -} diff --git a/src/test/ui/run-pass/regions/regions-borrow-uniq.rs b/src/test/ui/run-pass/regions/regions-borrow-uniq.rs deleted file mode 100644 index cc88528f64b..00000000000 --- a/src/test/ui/run-pass/regions/regions-borrow-uniq.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn foo(x: &usize) -> usize { - *x -} - -pub fn main() { - let p: Box<_> = box 3; - let r = foo(&*p); - assert_eq!(r, 3); -} diff --git a/src/test/ui/run-pass/regions/regions-bot.rs b/src/test/ui/run-pass/regions/regions-bot.rs deleted file mode 100644 index d3af66b4162..00000000000 --- a/src/test/ui/run-pass/regions/regions-bot.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A very limited test of the "bottom" region - - -fn produce_static() -> &'static T { panic!(); } - -fn foo(_x: &T) -> &usize { produce_static() } - -pub fn main() { -} diff --git a/src/test/ui/run-pass/regions/regions-bound-lists-feature-gate-2.rs b/src/test/ui/run-pass/regions/regions-bound-lists-feature-gate-2.rs deleted file mode 100644 index d5d2408d5d2..00000000000 --- a/src/test/ui/run-pass/regions/regions-bound-lists-feature-gate-2.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(issue_5723_bootstrap)] - -trait Foo { - fn dummy(&self) { } -} - -fn foo<'a, 'b, 'c:'a+'b, 'd>() { -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-bound-lists-feature-gate.rs b/src/test/ui/run-pass/regions/regions-bound-lists-feature-gate.rs deleted file mode 100644 index 50073f8b9f0..00000000000 --- a/src/test/ui/run-pass/regions/regions-bound-lists-feature-gate.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -#![feature(issue_5723_bootstrap)] - -trait Foo { - fn dummy(&self) { } -} - -fn foo<'a>(x: Box) { -} - -fn bar<'a, T: 'a>() { -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-close-over-type-parameter-successfully.rs b/src/test/ui/run-pass/regions/regions-close-over-type-parameter-successfully.rs deleted file mode 100644 index b2bf71f02fb..00000000000 --- a/src/test/ui/run-pass/regions/regions-close-over-type-parameter-successfully.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A test where we (successfully) close over a reference into -// an object. - -#![feature(box_syntax)] - -trait SomeTrait { fn get(&self) -> isize; } - -impl<'a> SomeTrait for &'a isize { - fn get(&self) -> isize { - **self - } -} - -fn make_object<'a,A:SomeTrait+'a>(v: A) -> Box { - box v as Box -} - -fn main() { - let i: isize = 22; - let obj = make_object(&i); - assert_eq!(22, obj.get()); -} diff --git a/src/test/ui/run-pass/regions/regions-copy-closure.rs b/src/test/ui/run-pass/regions/regions-copy-closure.rs deleted file mode 100644 index a5f0860be16..00000000000 --- a/src/test/ui/run-pass/regions/regions-copy-closure.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct closure_box<'a> { - cl: Box, -} - -fn box_it<'a>(x: Box) -> closure_box<'a> { - closure_box {cl: x} -} - -pub fn main() { - let mut i = 3; - assert_eq!(i, 3); - { - let cl = || i += 1; - let mut cl_box = box_it(Box::new(cl)); - (cl_box.cl)(); - } - assert_eq!(i, 4); -} diff --git a/src/test/ui/run-pass/regions/regions-creating-enums2.rs b/src/test/ui/run-pass/regions/regions-creating-enums2.rs deleted file mode 100644 index 84d4a261f1d..00000000000 --- a/src/test/ui/run-pass/regions/regions-creating-enums2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) -} - -fn mk_add_ok<'r>(x: &'r ast<'r>, y: &'r ast<'r>) -> ast<'r> { - ast::add(x, y) -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/regions/regions-creating-enums5.rs b/src/test/ui/run-pass/regions/regions-creating-enums5.rs deleted file mode 100644 index 24ba0c17611..00000000000 --- a/src/test/ui/run-pass/regions/regions-creating-enums5.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum ast<'a> { - num(usize), - add(&'a ast<'a>, &'a ast<'a>) -} - -fn mk_add_ok<'a>(x: &'a ast<'a>, y: &'a ast<'a>, _z: &ast) -> ast<'a> { - ast::add(x, y) -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/regions/regions-debruijn-of-object.rs b/src/test/ui/run-pass/regions/regions-debruijn-of-object.rs deleted file mode 100644 index 71464f30ef0..00000000000 --- a/src/test/ui/run-pass/regions/regions-debruijn-of-object.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct ctxt<'tcx> { - x: &'tcx i32 -} - -trait AstConv<'tcx> { - fn tcx<'a>(&'a self) -> &'a ctxt<'tcx>; -} - -fn foo(conv: &AstConv) { } - -fn bar<'tcx>(conv: &AstConv<'tcx>) { - foo(conv) -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-dependent-addr-of.rs b/src/test/ui/run-pass/regions/regions-dependent-addr-of.rs deleted file mode 100644 index 2a86d8aa4e5..00000000000 --- a/src/test/ui/run-pass/regions/regions-dependent-addr-of.rs +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test lifetimes are linked properly when we create dependent region pointers. -// Issue #3148. - -#![feature(box_patterns)] -#![feature(box_syntax)] - -struct A { - value: B -} - -struct B { - v1: isize, - v2: [isize; 3], - v3: Vec , - v4: C, - v5: Box, - v6: Option -} - -#[derive(Copy, Clone)] -struct C { - f: isize -} - -fn get_v1(a: &A) -> &isize { - // Region inferencer must deduce that &v < L2 < L1 - let foo = &a.value; // L1 - &foo.v1 // L2 -} - -fn get_v2(a: &A, i: usize) -> &isize { - let foo = &a.value; - &foo.v2[i] -} - -fn get_v3(a: &A, i: usize) -> &isize { - let foo = &a.value; - &foo.v3[i] -} - -fn get_v4(a: &A, _i: usize) -> &isize { - let foo = &a.value; - &foo.v4.f -} - -fn get_v5(a: &A, _i: usize) -> &isize { - let foo = &a.value; - &foo.v5.f -} - -fn get_v6_a(a: &A, _i: usize) -> &isize { - match a.value.v6 { - Some(ref v) => &v.f, - None => panic!() - } -} - -fn get_v6_b(a: &A, _i: usize) -> &isize { - match *a { - A { value: B { v6: Some(ref v), .. } } => &v.f, - _ => panic!() - } -} - -fn get_v6_c(a: &A, _i: usize) -> &isize { - match a { - &A { value: B { v6: Some(ref v), .. } } => &v.f, - _ => panic!() - } -} - -fn get_v5_ref(a: &A, _i: usize) -> &isize { - match &a.value { - &B {v5: box C {f: ref v}, ..} => v - } -} - -pub fn main() { - let a = A {value: B {v1: 22, - v2: [23, 24, 25], - v3: vec![26, 27, 28], - v4: C { f: 29 }, - v5: box C { f: 30 }, - v6: Some(C { f: 31 })}}; - - let p = get_v1(&a); - assert_eq!(*p, a.value.v1); - - let p = get_v2(&a, 1); - assert_eq!(*p, a.value.v2[1]); - - let p = get_v3(&a, 1); - assert_eq!(*p, a.value.v3[1]); - - let p = get_v4(&a, 1); - assert_eq!(*p, a.value.v4.f); - - let p = get_v5(&a, 1); - assert_eq!(*p, a.value.v5.f); - - let p = get_v6_a(&a, 1); - assert_eq!(*p, a.value.v6.unwrap().f); - - let p = get_v6_b(&a, 1); - assert_eq!(*p, a.value.v6.unwrap().f); - - let p = get_v6_c(&a, 1); - assert_eq!(*p, a.value.v6.unwrap().f); - - let p = get_v5_ref(&a, 1); - assert_eq!(*p, a.value.v5.f); -} diff --git a/src/test/ui/run-pass/regions/regions-dependent-autofn.rs b/src/test/ui/run-pass/regions/regions-dependent-autofn.rs deleted file mode 100644 index 19b345575c3..00000000000 --- a/src/test/ui/run-pass/regions/regions-dependent-autofn.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test lifetimes are linked properly when we autoslice a vector. -// Issue #3148. - -// pretty-expanded FIXME #23616 - -fn subslice(v: F) -> F where F: FnOnce() { v } - -fn both(v: F) -> F where F: FnOnce() { - subslice(subslice(v)) -} - -pub fn main() { - both(main); -} diff --git a/src/test/ui/run-pass/regions/regions-dependent-autoslice.rs b/src/test/ui/run-pass/regions/regions-dependent-autoslice.rs deleted file mode 100644 index 12e14ed49b9..00000000000 --- a/src/test/ui/run-pass/regions/regions-dependent-autoslice.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test lifetimes are linked properly when we autoslice a vector. -// Issue #3148. - -fn subslice1<'r>(v: &'r [usize]) -> &'r [usize] { v } - -fn both<'r>(v: &'r [usize]) -> &'r [usize] { - subslice1(subslice1(v)) -} - -pub fn main() { - let v = vec![1,2,3]; - both(&v); -} diff --git a/src/test/ui/run-pass/regions/regions-dependent-let-ref.rs b/src/test/ui/run-pass/regions/regions-dependent-let-ref.rs deleted file mode 100644 index fa0955bc351..00000000000 --- a/src/test/ui/run-pass/regions/regions-dependent-let-ref.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test lifetimes are linked properly when we take reference -// to interior. - -// pretty-expanded FIXME #23616 - -struct Foo(isize); -pub fn main() { - // Here the lifetime of the `&` should be at least the - // block, since a ref binding is created to the interior. - let &Foo(ref _x) = &Foo(3); -} diff --git a/src/test/ui/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/ui/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs deleted file mode 100644 index 77659c100ff..00000000000 --- a/src/test/ui/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to compile calls to associated fns like -// `decode()` where the bound on the `Self` parameter references a -// lifetime parameter of the trait. This example indicates why trait -// lifetime parameters must be early bound in the type of the -// associated item. - -// pretty-expanded FIXME #23616 - -use std::marker; - -pub enum Value<'v> { - A(&'v str), - B, -} - -pub trait Decoder<'v> { - fn read(&mut self) -> Value<'v>; -} - -pub trait Decodable<'v, D: Decoder<'v>> { - fn decode(d: &mut D) -> Self; -} - -impl<'v, D: Decoder<'v>> Decodable<'v, D> for () { - fn decode(d: &mut D) -> () { - match d.read() { - Value::A(..) => (), - Value::B => Decodable::decode(d), - } - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-early-bound-trait-param.rs b/src/test/ui/run-pass/regions/regions-early-bound-trait-param.rs deleted file mode 100644 index 220614c9203..00000000000 --- a/src/test/ui/run-pass/regions/regions-early-bound-trait-param.rs +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that you can use an early-bound lifetime parameter as -// on of the generic parameters in a trait. - -#![feature(box_syntax)] - -trait Trait<'a> { - fn long(&'a self) -> isize; - fn short<'b>(&'b self) -> isize; -} - -fn poly_invoke<'c, T: Trait<'c>>(x: &'c T) -> (isize, isize) { - let l = x.long(); - let s = x.short(); - (l,s) -} - -fn object_invoke1<'d>(x: &'d Trait<'d>) -> (isize, isize) { - let l = x.long(); - let s = x.short(); - (l,s) -} - -struct Struct1<'e> { - f: &'e (Trait<'e>+'e) -} - -fn field_invoke1<'f, 'g>(x: &'g Struct1<'f>) -> (isize,isize) { - let l = x.f.long(); - let s = x.f.short(); - (l,s) -} - -struct Struct2<'h, 'i:'h> { - f: &'h (Trait<'i>+'h) -} - -fn object_invoke2<'j, 'k>(x: &'k Trait<'j>) -> isize { - x.short() -} - -fn field_invoke2<'l, 'm, 'n>(x: &'n Struct2<'l,'m>) -> isize { - x.f.short() -} - -trait MakerTrait { - fn mk() -> Self; -} - -fn make_val() -> T { - MakerTrait::mk() -} - -trait RefMakerTrait<'q> { - fn mk(_: Self) -> &'q Self; -} - -fn make_ref<'r, T:RefMakerTrait<'r>>(t:T) -> &'r T { - RefMakerTrait::mk(t) -} - -impl<'s> Trait<'s> for (isize,isize) { - fn long(&'s self) -> isize { - let &(x,_) = self; - x - } - fn short<'b>(&'b self) -> isize { - let &(_,y) = self; - y - } -} - -impl<'t> MakerTrait for Box+'static> { - fn mk() -> Box+'static> { - let tup: Box<(isize, isize)> = box (4,5); - tup as Box - } -} - -enum List<'l> { - Cons(isize, &'l List<'l>), - Null -} - -impl<'l> List<'l> { - fn car<'m>(&'m self) -> isize { - match self { - &List::Cons(car, _) => car, - &List::Null => panic!(), - } - } - fn cdr<'n>(&'n self) -> &'l List<'l> { - match self { - &List::Cons(_, cdr) => cdr, - &List::Null => panic!(), - } - } -} - -impl<'t> RefMakerTrait<'t> for List<'t> { - fn mk(l:List<'t>) -> &'t List<'t> { - l.cdr() - } -} - -pub fn main() { - let t = (2,3); - let o = &t as &Trait; - let s1 = Struct1 { f: o }; - let s2 = Struct2 { f: o }; - assert_eq!(poly_invoke(&t), (2,3)); - assert_eq!(object_invoke1(&t), (2,3)); - assert_eq!(field_invoke1(&s1), (2,3)); - assert_eq!(object_invoke2(&t), 3); - assert_eq!(field_invoke2(&s2), 3); - - let m : Box = make_val(); - // assert_eq!(object_invoke1(&*m), (4,5)); - // ~~~~~~~~~~~~~~~~~~~ - // this call yields a compilation error; see compile-fail/dropck-object-cycle.rs - // for details. - assert_eq!(object_invoke2(&*m), 5); - - // The RefMakerTrait above is pretty strange (i.e. it is strange - // to consume a value of type T and return a &T). Easiest thing - // that came to my mind: consume a cell of a linked list and - // return a reference to the list it points to. - let l0 = List::Null; - let l1 = List::Cons(1, &l0); - let l2 = List::Cons(2, &l1); - let rl1 = &l1; - let r = make_ref(l2); - assert_eq!(rl1.car(), r.car()); -} diff --git a/src/test/ui/run-pass/regions/regions-early-bound-used-in-bound-method.rs b/src/test/ui/run-pass/regions/regions-early-bound-used-in-bound-method.rs deleted file mode 100644 index 718ab873a41..00000000000 --- a/src/test/ui/run-pass/regions/regions-early-bound-used-in-bound-method.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that you can use a fn lifetime parameter as part of -// the value for a type parameter in a bound. - - -trait GetRef<'a> { - fn get(&self) -> &'a isize; -} - -#[derive(Copy, Clone)] -struct Box<'a> { - t: &'a isize -} - -impl<'a> GetRef<'a> for Box<'a> { - fn get(&self) -> &'a isize { - self.t - } -} - -impl<'a> Box<'a> { - fn add<'b,G:GetRef<'b>>(&self, g2: G) -> isize { - *self.t + *g2.get() - } -} - -pub fn main() { - let b1 = Box { t: &3 }; - assert_eq!(b1.add(b1), 6); -} diff --git a/src/test/ui/run-pass/regions/regions-early-bound-used-in-bound.rs b/src/test/ui/run-pass/regions/regions-early-bound-used-in-bound.rs deleted file mode 100644 index e994303643f..00000000000 --- a/src/test/ui/run-pass/regions/regions-early-bound-used-in-bound.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that you can use a fn lifetime parameter as part of -// the value for a type parameter in a bound. - - -trait GetRef<'a, T> { - fn get(&self) -> &'a T; -} - -#[derive(Copy, Clone)] -struct Box<'a, T:'a> { - t: &'a T -} - -impl<'a,T:Clone> GetRef<'a,T> for Box<'a,T> { - fn get(&self) -> &'a T { - self.t - } -} - -fn add<'a,G:GetRef<'a, isize>>(g1: G, g2: G) -> isize { - *g1.get() + *g2.get() -} - -pub fn main() { - let b1 = Box { t: &3 }; - assert_eq!(add(b1, b1), 6); -} diff --git a/src/test/ui/run-pass/regions/regions-early-bound-used-in-type-param.rs b/src/test/ui/run-pass/regions/regions-early-bound-used-in-type-param.rs deleted file mode 100644 index fd4e46b5392..00000000000 --- a/src/test/ui/run-pass/regions/regions-early-bound-used-in-type-param.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that you can use a fn lifetime parameter as part of -// the value for a type parameter in a bound. - - -trait Get { - fn get(&self) -> T; -} - -#[derive(Copy, Clone)] -struct Box { - t: T -} - -impl Get for Box { - fn get(&self) -> T { - self.t.clone() - } -} - -fn add<'a,G:Get<&'a isize>>(g1: G, g2: G) -> isize { - *g1.get() + *g2.get() -} - -pub fn main() { - let b1 = Box { t: &3 }; - assert_eq!(add(b1, b1), 6); -} diff --git a/src/test/ui/run-pass/regions/regions-escape-into-other-fn.rs b/src/test/ui/run-pass/regions/regions-escape-into-other-fn.rs deleted file mode 100644 index 1601e73aff9..00000000000 --- a/src/test/ui/run-pass/regions/regions-escape-into-other-fn.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn foo(x: &usize) -> &usize { x } -fn bar(x: &usize) -> usize { *x } - -pub fn main() { - let p: Box<_> = box 3; - assert_eq!(bar(foo(&*p)), 3); -} diff --git a/src/test/ui/run-pass/regions/regions-expl-self.rs b/src/test/ui/run-pass/regions/regions-expl-self.rs deleted file mode 100644 index 1af6febb53a..00000000000 --- a/src/test/ui/run-pass/regions/regions-expl-self.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that you can insert an explicit lifetime in explicit self. - -// pretty-expanded FIXME #23616 - -struct Foo { - f: usize -} - -impl Foo { - pub fn foo<'a>(&'a self) {} -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-fn-subtyping-2.rs b/src/test/ui/run-pass/regions/regions-fn-subtyping-2.rs deleted file mode 100644 index a23c5005f07..00000000000 --- a/src/test/ui/run-pass/regions/regions-fn-subtyping-2.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #2263. - -// Here, `f` is a function that takes a pointer `x` and a function -// `g`, where `g` requires its argument `y` to be in the same region -// that `x` is in. -// pretty-expanded FIXME #23616 - -fn has_same_region(f: Box FnMut(&'a isize, Box)>) { - // `f` should be the type that `wants_same_region` wants, but - // right now the compiler complains that it isn't. - wants_same_region(f); -} - -fn wants_same_region(_f: Box FnMut(&'b isize, Box)>) { -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/regions/regions-fn-subtyping.rs b/src/test/ui/run-pass/regions/regions-fn-subtyping.rs deleted file mode 100644 index e561fa74346..00000000000 --- a/src/test/ui/run-pass/regions/regions-fn-subtyping.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #2263. - -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] - -// Should pass region checking. -fn ok(f: Box) { - // Here, g is a function that can accept a usize pointer with - // lifetime r, and f is a function that can accept a usize pointer - // with any lifetime. The assignment g = f should be OK (i.e., - // f's type should be a subtype of g's type), because f can be - // used in any context that expects g's type. But this currently - // fails. - let mut g: Box FnMut(&'r usize)> = Box::new(|x| { }); - g = f; -} - -// This version is the same as above, except that here, g's type is -// inferred. -fn ok_inferred(f: Box) { - let mut g: Box FnMut(&'r usize)> = Box::new(|_| {}); - g = f; -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs b/src/test/ui/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs deleted file mode 100644 index 67a77940742..00000000000 --- a/src/test/ui/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we recognize that if you have -// -// 'a : 'static -// -// then -// -// 'a : 'b - -fn test<'a,'b>(x: &'a i32) -> &'b i32 - where 'a: 'static -{ - x -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-infer-borrow-scope-addr-of.rs b/src/test/ui/run-pass/regions/regions-infer-borrow-scope-addr-of.rs deleted file mode 100644 index 6ac09930f85..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-borrow-scope-addr-of.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem::swap; - -pub fn main() { - let mut x = 4; - - for i in 0_usize..3 { - // ensure that the borrow in this alt - // does not interfere with the swap - // below. note that it would it you - // naively borrowed &x for the lifetime - // of the variable x, as we once did - match i { - i => { - let y = &x; - assert!(i < *y); - } - } - let mut y = 4; - swap(&mut y, &mut x); - } -} diff --git a/src/test/ui/run-pass/regions/regions-infer-borrow-scope-view.rs b/src/test/ui/run-pass/regions/regions-infer-borrow-scope-view.rs deleted file mode 100644 index 2ad1378de04..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-borrow-scope-view.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn view(x: &[T]) -> &[T] {x} - -pub fn main() { - let v = vec![1, 2, 3]; - let x = view(&v); - let y = view(x); - assert!((v[0] == x[0]) && (v[0] == y[0])); -} diff --git a/src/test/ui/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs b/src/test/ui/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs deleted file mode 100644 index d527f298ce0..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-borrow-scope-within-loop-ok.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn borrow(x: &T) -> &T {x} - -pub fn main() { - let x: Box<_> = box 3; - loop { - let y = borrow(&*x); - assert_eq!(*x, *y); - break; - } -} diff --git a/src/test/ui/run-pass/regions/regions-infer-borrow-scope.rs b/src/test/ui/run-pass/regions/regions-infer-borrow-scope.rs deleted file mode 100644 index f3660d8dd17..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-borrow-scope.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct Point {x: isize, y: isize} - -fn x_coord(p: &Point) -> &isize { - return &p.x; -} - -pub fn main() { - let p: Box<_> = box Point {x: 3, y: 4}; - let xc = x_coord(&*p); - assert_eq!(*xc, 3); -} diff --git a/src/test/ui/run-pass/regions/regions-infer-call-2.rs b/src/test/ui/run-pass/regions/regions-infer-call-2.rs deleted file mode 100644 index 8fcfd5f2ee5..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-call-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } - -fn with(f: F) -> T where F: FnOnce(&isize) -> T { - f(&20) -} - -fn has_one<'a>(x: &'a isize) -> isize { - with(|y| takes_two(x, y)) -} - -pub fn main() { - assert_eq!(has_one(&2), 22); -} diff --git a/src/test/ui/run-pass/regions/regions-infer-call.rs b/src/test/ui/run-pass/regions/regions-infer-call.rs deleted file mode 100644 index 42ab24705de..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-call.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn takes_two(x: &isize, y: &isize) -> isize { *x + *y } - -fn has_two<'a,'b>(x: &'a isize, y: &'b isize) -> isize { - takes_two(x, y) -} - -pub fn main() { - assert_eq!(has_two(&20, &2), 22); -} diff --git a/src/test/ui/run-pass/regions/regions-infer-contravariance-due-to-ret.rs b/src/test/ui/run-pass/regions/regions-infer-contravariance-due-to-ret.rs deleted file mode 100644 index fc152fd275a..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-contravariance-due-to-ret.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -struct boxed_int<'a> { - f: &'a isize, -} - -fn max<'r>(bi: &'r boxed_int, f: &'r isize) -> isize { - if *bi.f > *f {*bi.f} else {*f} -} - -fn with(bi: &boxed_int) -> isize { - let i = 22; - max(bi, &i) -} - -pub fn main() { - let g = 21; - let foo = boxed_int { f: &g }; - assert_eq!(with(&foo), 22); -} diff --git a/src/test/ui/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs b/src/test/ui/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs deleted file mode 100644 index f6ed97195c1..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test an edge case in region inference: the lifetime of the borrow -// of `*x` must be extended to at least 'a. - -// pretty-expanded FIXME #23616 - -fn foo<'a,'b>(x: &'a &'b mut isize) -> &'a isize { - let y = &*x; // should be inferred to have type &'a &'b mut isize... - - // ...because if we inferred, say, &'x &'b mut isize where 'x <= 'a, - // this reborrow would be illegal: - &**y -} - -pub fn main() { - /* Just want to know that it compiles. */ -} diff --git a/src/test/ui/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs b/src/test/ui/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs deleted file mode 100644 index 7af25be1d03..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -// check that the &isize here does not cause us to think that `foo` -// contains region pointers -// pretty-expanded FIXME #23616 - -struct foo(Box); - -fn take_foo(x: T) {} - -fn have_foo(f: foo) { - take_foo(f); -} - -fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-infer-static-from-proc.rs b/src/test/ui/run-pass/regions/regions-infer-static-from-proc.rs deleted file mode 100644 index 2a3cb3735ec..00000000000 --- a/src/test/ui/run-pass/regions/regions-infer-static-from-proc.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Check that the 'static bound on a proc influences lifetimes of -// region variables contained within (otherwise, region inference will -// give `x` a very short lifetime). - -// pretty-expanded FIXME #23616 - -static i: usize = 3; -fn foo(_: F) {} -fn read(_: usize) { } -pub fn main() { - let x = &i; - foo(move|| { - read(*x); - }); -} diff --git a/src/test/ui/run-pass/regions/regions-issue-21422.rs b/src/test/ui/run-pass/regions/regions-issue-21422.rs deleted file mode 100644 index 6e76793e8b9..00000000000 --- a/src/test/ui/run-pass/regions/regions-issue-21422.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #21422, which was related to failing to -// add inference constraints that the operands of a binary operator -// should outlive the binary operation itself. - -// pretty-expanded FIXME #23616 - -pub struct P<'a> { - _ptr: *const &'a u8, -} - -impl <'a> PartialEq for P<'a> { - fn eq(&self, other: &P<'a>) -> bool { - (self as *const _) == (other as *const _) - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-issue-22246.rs b/src/test/ui/run-pass/regions/regions-issue-22246.rs deleted file mode 100644 index 8a54f30133e..00000000000 --- a/src/test/ui/run-pass/regions/regions-issue-22246.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #22246 -- we should be able to deduce -// that `&'a B::Owned` implies that `B::Owned : 'a`. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -use std::ops::Deref; - -pub trait ToOwned: Sized { - type Owned: Borrow; - fn to_owned(&self) -> Self::Owned; -} - -pub trait Borrow { - fn borrow(&self) -> &Borrowed; -} - -pub struct Foo { - owned: B::Owned -} - -fn foo(this: &Foo) -> &B { - this.owned.borrow() -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-lifetime-nonfree-late-bound.rs b/src/test/ui/run-pass/regions/regions-lifetime-nonfree-late-bound.rs deleted file mode 100644 index 1a294dceab8..00000000000 --- a/src/test/ui/run-pass/regions/regions-lifetime-nonfree-late-bound.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is a regression test for the ICE from issue #10846. -// -// The original issue causing the ICE: the LUB-computations during -// type inference were encountering late-bound lifetimes, and -// asserting that such lifetimes should have already been substituted -// with a concrete lifetime. -// -// However, those encounters were occurring within the lexical scope -// of the binding for the late-bound lifetime; that is, the late-bound -// lifetimes were perfectly valid. The core problem was that the type -// folding code was over-zealously passing back all lifetimes when -// doing region-folding, when really all clients of the region-folding -// case only want to see FREE lifetime variables, not bound ones. - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { - fn explicit() { - fn test(_x: Option>) where F: FnMut(Box FnMut(&'a isize)>) {} - test(Some(box |_f: Box FnMut(&'a isize)>| {})); - } - - // The code below is shorthand for the code above (and more likely - // to represent what one encounters in practice). - fn implicit() { - fn test(_x: Option>) where F: FnMut(Box< FnMut(& isize)>) {} - test(Some(box |_f: Box< FnMut(& isize)>| {})); - } - - explicit(); - implicit(); -} diff --git a/src/test/ui/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/ui/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs deleted file mode 100644 index 758473634cb..00000000000 --- a/src/test/ui/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test verifies that temporary lifetime is correctly computed -// for static objects in enclosing scopes. - - -use std::cmp::PartialEq; - -fn f(o: &mut Option) { - assert_eq!(*o, None); -} - -pub fn main() { - mod t { - enum E {V=1, A=0} - static C: E = E::V; - } - - f::(&mut None); -} diff --git a/src/test/ui/run-pass/regions/regions-link-fn-args.rs b/src/test/ui/run-pass/regions/regions-link-fn-args.rs deleted file mode 100644 index cb52c69cbe3..00000000000 --- a/src/test/ui/run-pass/regions/regions-link-fn-args.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that region inference correctly links up the regions when a -// `ref` borrow occurs inside a fn argument. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -fn with<'a, F>(_: F) where F: FnOnce(&'a Vec) -> &'a Vec { } - -fn foo() { - with(|&ref ints| ints); -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-lub-ref-ref-rc.rs b/src/test/ui/run-pass/regions/regions-lub-ref-ref-rc.rs deleted file mode 100644 index 907746a65ee..00000000000 --- a/src/test/ui/run-pass/regions/regions-lub-ref-ref-rc.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a corner case of LUB coercion. In this case, one arm of the -// match requires a deref coercion and the other doesn't, and there -// is an extra `&` on the `rc`. We want to be sure that the lifetime -// assigned to this `&rc` value is not `'a` but something smaller. In -// other words, the type from `rc` is `&'a Rc` and the type -// from `&rc` should be `&'x &'a Rc`, where `'x` is something -// small. - -use std::rc::Rc; - -#[derive(Clone)] -enum CachedMir<'mir> { - Ref(&'mir String), - Owned(Rc), -} - -impl<'mir> CachedMir<'mir> { - fn get_ref<'a>(&'a self) -> &'a String { - match *self { - CachedMir::Ref(r) => r, - CachedMir::Owned(ref rc) => &rc, - } - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-mock-codegen.rs b/src/test/ui/run-pass/regions/regions-mock-codegen.rs deleted file mode 100644 index 6d521432849..00000000000 --- a/src/test/ui/run-pass/regions/regions-mock-codegen.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -#![feature(allocator_api)] - -use std::alloc::{Alloc, Global, Layout, handle_alloc_error}; -use std::ptr::NonNull; - -struct arena(()); - -struct Bcx<'a> { - fcx: &'a Fcx<'a> -} - -struct Fcx<'a> { - arena: &'a arena, - ccx: &'a Ccx -} - -struct Ccx { - x: isize -} - -fn alloc<'a>(_bcx : &'a arena) -> &'a Bcx<'a> { - unsafe { - let layout = Layout::new::(); - let ptr = Global.alloc(layout).unwrap_or_else(|_| handle_alloc_error(layout)); - &*(ptr.as_ptr() as *const _) - } -} - -fn h<'a>(bcx : &'a Bcx<'a>) -> &'a Bcx<'a> { - return alloc(bcx.fcx.arena); -} - -fn g(fcx : &Fcx) { - let bcx = Bcx { fcx: fcx }; - let bcx2 = h(&bcx); - unsafe { - Global.dealloc(NonNull::new_unchecked(bcx2 as *const _ as *mut _), Layout::new::()); - } -} - -fn f(ccx : &Ccx) { - let a = arena(()); - let fcx = Fcx { arena: &a, ccx: ccx }; - return g(&fcx); -} - -pub fn main() { - let ccx = Ccx { x: 0 }; - f(&ccx); -} diff --git a/src/test/ui/run-pass/regions/regions-no-bound-in-argument-cleanup.rs b/src/test/ui/run-pass/regions/regions-no-bound-in-argument-cleanup.rs deleted file mode 100644 index 0f2fa1f7c78..00000000000 --- a/src/test/ui/run-pass/regions/regions-no-bound-in-argument-cleanup.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::marker; - -pub struct Foo(marker::PhantomData); - -impl Iterator for Foo { - type Item = T; - - fn next(&mut self) -> Option { - None - } -} - -impl Drop for Foo { - fn drop(&mut self) { - self.next(); - } -} - -pub fn foo<'a>(_: Foo<&'a ()>) {} - -pub fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-no-variance-from-fn-generics.rs b/src/test/ui/run-pass/regions/regions-no-variance-from-fn-generics.rs deleted file mode 100644 index 3d0d5f2dbcf..00000000000 --- a/src/test/ui/run-pass/regions/regions-no-variance-from-fn-generics.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #12856: a lifetime formal binding introduced by a generic fn -// should not upset the variance inference for actual occurrences of -// that lifetime in type expressions. - - -pub trait HasLife<'a> { - fn dummy(&'a self) { } // just to induce a variance on 'a -} - -trait UseLife01 { - fn refs<'a, H: HasLife<'a>>(&'a self) -> H; -} - -trait UseLife02 { - fn refs<'a, T: 'a, H: HasType<&'a T>>(&'a self) -> H; -} - - -pub trait HasType -{ - fn dummy(&self, t: T) -> T { panic!() } -} - - -trait UseLife03 { - fn refs<'a, H: HasType<&'a T>>(&'a self) -> H where T: 'a; -} - - -// (The functions below were not actually a problem observed during -// fixing of #12856; they just seem like natural tests to put in to -// cover a couple more points in the testing space) - -pub fn top_refs_1<'a, H: HasLife<'a>>(_s: &'a ()) -> H { - unimplemented!() -} - -pub fn top_refs_2<'a, T: 'a, H: HasType<&'a T>>(_s: &'a ()) -> H { - unimplemented!() -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-nullary-variant.rs b/src/test/ui/run-pass/regions/regions-nullary-variant.rs deleted file mode 100644 index b24e2496350..00000000000 --- a/src/test/ui/run-pass/regions/regions-nullary-variant.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum roption<'a> { - a, b(&'a usize) -} - -fn mk(cond: bool, ptr: &usize) -> roption { - if cond {roption::a} else {roption::b(ptr)} -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-params.rs b/src/test/ui/run-pass/regions/regions-params.rs deleted file mode 100644 index b7060cb2b94..00000000000 --- a/src/test/ui/run-pass/regions/regions-params.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn region_identity(x: &usize) -> &usize { x } - -fn apply(t: T, f: F) -> T where F: FnOnce(T) -> T { f(t) } - -fn parameterized(x: &usize) -> usize { - let z = apply(x, ({|y| - region_identity(y) - })); - *z -} - -pub fn main() { - let x = 3; - assert_eq!(parameterized(&x), 3); -} diff --git a/src/test/ui/run-pass/regions/regions-reassign-let-bound-pointer.rs b/src/test/ui/run-pass/regions/regions-reassign-let-bound-pointer.rs deleted file mode 100644 index 0a30dcb721f..00000000000 --- a/src/test/ui/run-pass/regions/regions-reassign-let-bound-pointer.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that the type checker permits us to reassign `z` which -// started out with a longer lifetime and was reassigned to a shorter -// one (it should infer to be the intersection). - -// pretty-expanded FIXME #23616 - -fn foo(x: &isize) { - let a = 1; - let mut z = x; - z = &a; -} - -pub fn main() { - foo(&1); -} diff --git a/src/test/ui/run-pass/regions/regions-reassign-match-bound-pointer.rs b/src/test/ui/run-pass/regions/regions-reassign-match-bound-pointer.rs deleted file mode 100644 index 28455b1f3cf..00000000000 --- a/src/test/ui/run-pass/regions/regions-reassign-match-bound-pointer.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that the type checker permits us to reassign `z` which -// started out with a longer lifetime and was reassigned to a shorter -// one (it should infer to be the intersection). - -// pretty-expanded FIXME #23616 - -fn foo(x: &isize) { - let a = 1; - match x { - mut z => { - z = &a; - } - } -} - -pub fn main() { - foo(&1); -} diff --git a/src/test/ui/run-pass/regions/regions-refcell.rs b/src/test/ui/run-pass/regions/regions-refcell.rs deleted file mode 100644 index 0042edb65ad..00000000000 --- a/src/test/ui/run-pass/regions/regions-refcell.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is a regression test for something that only came up while -// attempting to bootstrap librustc with new destructor lifetime -// semantics. - - -use std::collections::HashMap; -use std::cell::RefCell; - -// This version does not yet work (associated type issues)... -#[cfg(cannot_use_this_yet)] -fn foo<'a>(map: RefCell>) { - let one = [1]; - assert_eq!(map.borrow().get("one"), Some(&one[..])); -} - -#[cfg(cannot_use_this_yet_either)] -// ... and this version does not work (the lifetime of `one` is -// supposed to match the lifetime `'a`) ... -fn foo<'a>(map: RefCell>) { - let one = [1]; - assert_eq!(map.borrow().get("one"), Some(&&one[..])); -} - -#[cfg(all(not(cannot_use_this_yet),not(cannot_use_this_yet_either)))] -fn foo<'a>(map: RefCell>) { - // ...so instead we walk through the trivial slice and make sure - // it contains the element we expect. - - for (i, &x) in map.borrow().get("one").unwrap().iter().enumerate() { - assert_eq!((i, x), (0, 1)); - } -} - -fn main() { - let zer = [0]; - let one = [1]; - let two = [2]; - let mut map = HashMap::new(); - map.insert("zero", &zer[..]); - map.insert("one", &one[..]); - map.insert("two", &two[..]); - let map = RefCell::new(map); - foo(map); -} diff --git a/src/test/ui/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/ui/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs deleted file mode 100644 index 86d84172629..00000000000 --- a/src/test/ui/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that this fairly specialized, but also reasonable, pattern -// typechecks. The pattern involves regions bound in closures that -// wind up related to inference variables. -// -// NB. Changes to the region implementations have broken this pattern -// a few times, but it happens to be used in the compiler so those -// changes were caught. However, those uses in the compiler could -// easily get changed or refactored away in the future. - -#![feature(box_syntax)] - -struct Ctxt<'tcx> { - x: &'tcx Vec -} - -struct Foo<'a,'tcx:'a> { - cx: &'a Ctxt<'tcx>, -} - -impl<'a,'tcx> Foo<'a,'tcx> { - fn bother(&mut self) -> isize { - self.elaborate_bounds(Box::new(|this| { - // (*) Here: type of `this` is `&'f0 Foo<&'f1, '_2>`, - // where `'f0` and `'f1` are fresh, free regions that - // result from the bound regions on the closure, and `'2` - // is a region inference variable created by the call. Due - // to the constraints on the type, we find that `'_2 : 'f1 - // + 'f2` must hold (and can be assumed by the callee). - // Region inference has to do some clever stuff to avoid - // inferring `'_2` to be `'static` in this case, because - // it is created outside the closure but then related to - // regions bound by the closure itself. See the - // `region_constraints.rs` file (and the `givens` field, in - // particular) for more details. - this.foo() - })) - } - - fn foo(&mut self) -> isize { - 22 - } - - fn elaborate_bounds( - &mut self, - mut mk_cand: Box FnMut(&mut Foo<'b, 'tcx>) -> isize>) - -> isize - { - mk_cand(self) - } -} - -fn main() { - let v = vec![]; - let cx = Ctxt { x: &v }; - let mut foo = Foo { cx: &cx }; - assert_eq!(foo.bother(), 22); // just so the code is not dead, basically -} diff --git a/src/test/ui/run-pass/regions/regions-return-interior-of-option.rs b/src/test/ui/run-pass/regions/regions-return-interior-of-option.rs deleted file mode 100644 index 6566969185c..00000000000 --- a/src/test/ui/run-pass/regions/regions-return-interior-of-option.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn get(opt: &Option) -> &T { - match *opt { - Some(ref v) => v, - None => panic!("none") - } -} - -pub fn main() { - let mut x = Some(23); - - { - let y = get(&x); - assert_eq!(*y, 23); - } - - x = Some(24); - - { - let y = get(&x); - assert_eq!(*y, 24); - } -} diff --git a/src/test/ui/run-pass/regions/regions-scope-chain-example.rs b/src/test/ui/run-pass/regions/regions-scope-chain-example.rs deleted file mode 100644 index 973f7bd5319..00000000000 --- a/src/test/ui/run-pass/regions/regions-scope-chain-example.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is an example where the older inference algorithm failed. The -// specifics of why it failed are somewhat, but not entirely, tailed -// to the algorithm. Ultimately the problem is that when computing the -// mutual supertype of both sides of the `if` it would be faced with a -// choice of tightening bounds or unifying variables and it took the -// wrong path. The new algorithm avoids this problem and hence this -// example typechecks correctly. - -// pretty-expanded FIXME #23616 - -enum ScopeChain<'a> { - Link(Scope<'a>), - End -} - -type Scope<'a> = &'a ScopeChain<'a>; - -struct OuterContext; - -struct Context<'a> { - foo: &'a OuterContext -} - -impl<'a> Context<'a> { - fn foo(&mut self, scope: Scope) { - let link = if 1 < 2 { - let l = ScopeChain::Link(scope); - self.take_scope(&l); - l - } else { - ScopeChain::Link(scope) - }; - self.take_scope(&link); - } - - fn take_scope(&mut self, x: Scope) { - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/regions/regions-self-impls.rs b/src/test/ui/run-pass/regions/regions-self-impls.rs deleted file mode 100644 index 027c7698bf8..00000000000 --- a/src/test/ui/run-pass/regions/regions-self-impls.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct Clam<'a> { - chowder: &'a isize -} - -trait get_chowder<'a> { - fn get_chowder(&self) -> &'a isize; -} - -impl<'a> get_chowder<'a> for Clam<'a> { - fn get_chowder(&self) -> &'a isize { return self.chowder; } -} - -pub fn main() { - let clam = Clam { chowder: &3 }; - println!("{}", *clam.get_chowder()); - clam.get_chowder(); -} diff --git a/src/test/ui/run-pass/regions/regions-self-in-enums.rs b/src/test/ui/run-pass/regions/regions-self-in-enums.rs deleted file mode 100644 index 5cb9ad7774c..00000000000 --- a/src/test/ui/run-pass/regions/regions-self-in-enums.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum int_wrapper<'a> { - int_wrapper_ctor(&'a isize) -} - -pub fn main() { - let x = 3; - let y = int_wrapper::int_wrapper_ctor(&x); - let mut z : &isize; - match y { - int_wrapper::int_wrapper_ctor(zz) => { z = zz; } - } - println!("{}", *z); -} diff --git a/src/test/ui/run-pass/regions/regions-simple.rs b/src/test/ui/run-pass/regions/regions-simple.rs deleted file mode 100644 index 66492b966d1..00000000000 --- a/src/test/ui/run-pass/regions/regions-simple.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let mut x: isize = 3; - let y: &mut isize = &mut x; - *y = 5; - println!("{}", *y); -} diff --git a/src/test/ui/run-pass/regions/regions-static-bound.rs b/src/test/ui/run-pass/regions/regions-static-bound.rs deleted file mode 100644 index 7a8e91ccdda..00000000000 --- a/src/test/ui/run-pass/regions/regions-static-bound.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn invariant_id<'a,'b>(t: &'b mut &'static ()) -> &'b mut &'a () - where 'a: 'static { t } -fn static_id<'a>(t: &'a ()) -> &'static () - where 'a: 'static { t } -fn static_id_indirect<'a,'b>(t: &'a ()) -> &'static () - where 'a: 'b, 'b: 'static { t } -fn ref_id<'a>(t: &'a ()) -> &'a () where 'static: 'a { t } - -static UNIT: () = (); - -fn main() -{ - let mut val : &'static () = &UNIT; - invariant_id(&mut val); - static_id(val); - static_id_indirect(val); - ref_id(val); -} diff --git a/src/test/ui/run-pass/regions/regions-static-closure.rs b/src/test/ui/run-pass/regions/regions-static-closure.rs deleted file mode 100644 index fa579a31806..00000000000 --- a/src/test/ui/run-pass/regions/regions-static-closure.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct closure_box<'a> { - cl: Box, -} - -fn box_it<'a>(x: Box) -> closure_box<'a> { - closure_box {cl: x} -} - -fn call_static_closure(mut cl: closure_box<'static>) { - (cl.cl)(); -} - -pub fn main() { - let cl_box = box_it(Box::new(|| println!("Hello, world!"))); - call_static_closure(cl_box); -} diff --git a/src/test/ui/run-pass/regions/regions-trait-object-1.rs b/src/test/ui/run-pass/regions/regions-trait-object-1.rs deleted file mode 100644 index 63bbe31d431..00000000000 --- a/src/test/ui/run-pass/regions/regions-trait-object-1.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This is a regression test for something that only came up while -// attempting to bootstrap libsyntax; it is adapted from -// `syntax::ext::tt::generic_extension`. - - -pub struct E<'a> { - pub f: &'a u8, -} -impl<'b> E<'b> { - pub fn m(&self) -> &'b u8 { self.f } -} - -pub struct P<'c> { - pub g: &'c u8, -} -pub trait M { - fn n(&self) -> u8; -} -impl<'d> M for P<'d> { - fn n(&self) -> u8 { *self.g } -} - -fn extension<'e>(x: &'e E<'e>) -> Box { - loop { - let p = P { g: x.m() }; - return Box::new(p) as Box; - } -} - -fn main() { - let w = E { f: &10 }; - let o = extension(&w); - assert_eq!(o.n(), 10); -} diff --git a/src/test/ui/run-pass/regions/regions-variance-contravariant-use-contravariant.rs b/src/test/ui/run-pass/regions/regions-variance-contravariant-use-contravariant.rs deleted file mode 100644 index ffab7dc2e41..00000000000 --- a/src/test/ui/run-pass/regions/regions-variance-contravariant-use-contravariant.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a type which is contravariant with respect to its region -// parameter compiles successfully when used in a contravariant way. -// -// Note: see compile-fail/variance-regions-*.rs for the tests that check that the -// variance inference works in the first place. - -// pretty-expanded FIXME #23616 - -struct Contravariant<'a> { - f: &'a isize -} - -fn use_<'a>(c: Contravariant<'a>) { - let x = 3; - - // 'b winds up being inferred to this call. - // Contravariant<'a> <: Contravariant<'call> is true - // if 'call <= 'a, which is true, so no error. - collapse(&x, c); - - fn collapse<'b>(x: &'b isize, c: Contravariant<'b>) { } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/regions/regions-variance-covariant-use-covariant.rs b/src/test/ui/run-pass/regions/regions-variance-covariant-use-covariant.rs deleted file mode 100644 index ea0051c6b26..00000000000 --- a/src/test/ui/run-pass/regions/regions-variance-covariant-use-covariant.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a type which is covariant with respect to its region -// parameter is successful when used in a covariant way. -// -// Note: see compile-fail/variance-regions-*.rs for the tests that -// check that the variance inference works in the first place. - -// This is covariant with respect to 'a, meaning that -// Covariant<'foo> <: Covariant<'static> because -// 'foo <= 'static -// pretty-expanded FIXME #23616 - -struct Covariant<'a> { - f: extern "Rust" fn(&'a isize) -} - -fn use_<'a>(c: Covariant<'a>) { - // OK Because Covariant<'a> <: Covariant<'static> iff 'a <= 'static - let _: Covariant<'static> = c; -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/rfcs/rfc-1014-2.rs b/src/test/ui/run-pass/rfcs/rfc-1014-2.rs deleted file mode 100644 index f0ff8561243..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1014-2.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(libc)] - -extern crate libc; - -type DWORD = u32; -type HANDLE = *mut u8; -type BOOL = i32; - -#[cfg(windows)] -extern "system" { - fn SetStdHandle(nStdHandle: DWORD, nHandle: HANDLE) -> BOOL; -} - -#[cfg(windows)] -fn close_stdout() { - const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; - unsafe { SetStdHandle(STD_OUTPUT_HANDLE, 0 as HANDLE); } -} - -#[cfg(windows)] -fn main() { - close_stdout(); - println!("hello world"); -} - -#[cfg(not(windows))] -fn main() {} diff --git a/src/test/ui/run-pass/rfcs/rfc-1014.rs b/src/test/ui/run-pass/rfcs/rfc-1014.rs deleted file mode 100644 index 35290ae8e6a..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1014.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-cloudabi stdout does not map to file descriptor 1 by default -// ignore-wasm32-bare no libc - -#![feature(libc)] - -extern crate libc; - -type DWORD = u32; -type HANDLE = *mut u8; - -#[cfg(windows)] -extern "system" { - fn GetStdHandle(which: DWORD) -> HANDLE; - fn CloseHandle(handle: HANDLE) -> i32; -} - -#[cfg(windows)] -fn close_stdout() { - const STD_OUTPUT_HANDLE: DWORD = -11i32 as DWORD; - unsafe { CloseHandle(GetStdHandle(STD_OUTPUT_HANDLE)); } -} - -#[cfg(not(windows))] -fn close_stdout() { - unsafe { libc::close(1); } -} - -fn main() { - close_stdout(); - println!("hello world"); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs b/src/test/ui/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs deleted file mode 100644 index e873b1946d9..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1789-as-cell/from-mut.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(as_cell)] - -use std::cell::Cell; - -fn main() { - let slice: &mut [i32] = &mut [1, 2, 3]; - let cell_slice: &Cell<[i32]> = Cell::from_mut(slice); - let slice_cell: &[Cell] = cell_slice.as_slice_of_cells(); - - assert_eq!(slice_cell.len(), 3); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs deleted file mode 100644 index b245b659559..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-box-dyn-error.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::error::Error; - -fn main() -> Result<(), Box> { - Ok(()) -} diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs deleted file mode 100644 index 62ad0e2489a..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-empty.rs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() {} diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs deleted file mode 100644 index bff6f9a6bca..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-exitcode.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(process_exitcode_placeholder)] - -use std::process::ExitCode; - -fn main() -> ExitCode { - ExitCode::SUCCESS -} diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs deleted file mode 100644 index 6c3f2fe4ea5..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-impl-termination.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(termination_trait_lib)] - -fn main() -> impl std::process::Termination { } diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs deleted file mode 100644 index cf63737d07f..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result-box-error_ok.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::io::Error; - -fn main() -> Result<(), Box> { - Ok(()) -} diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs deleted file mode 100644 index d61876d422a..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-result.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::io::Error; - -fn main() -> Result<(), Error> { - Ok(()) -} diff --git a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs b/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs deleted file mode 100644 index 4f60eda0d9a..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-1937-termination-trait/termination-trait-for-str.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn main() -> Result<(), &'static str> { - Ok(()) -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs deleted file mode 100644 index f0ef9ca37b3..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax, box_patterns)] - -struct Foo{} - -pub fn main() { - let b = box Foo{}; - let box f = &b; - let _: &Foo = f; - - match &&&b { - box f => { - let _: &Foo = f; - }, - _ => panic!(), - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs deleted file mode 100644 index ac245ba6ff8..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/constref.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -const CONST_REF: &[u8; 3] = b"foo"; - -trait Foo { - const CONST_REF_DEFAULT: &'static [u8; 3] = b"bar"; - const CONST_REF: &'static [u8; 3]; -} - -impl Foo for i32 { - const CONST_REF: &'static [u8; 3] = b"jjj"; -} - -impl Foo for i64 { - const CONST_REF_DEFAULT: &'static [u8; 3] = b"ggg"; - const CONST_REF: &'static [u8; 3] = b"fff"; -} - -// Check that (associated and free) const references are not mistaken for a -// non-reference pattern (in which case they would be auto-dereferenced, making -// the types mismatched). - -fn const_ref() -> bool { - let f = b"foo"; - match f { - CONST_REF => true, - _ => false, - } -} - -fn associated_const_ref() -> bool { - match (b"bar", b"jjj", b"ggg", b"fff") { - (i32::CONST_REF_DEFAULT, i32::CONST_REF, i64::CONST_REF_DEFAULT, i64::CONST_REF) => true, - _ => false, - } -} - -pub fn main() { - assert!(const_ref()); - assert!(associated_const_ref()); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs deleted file mode 100644 index 6ea3b6f99ce..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/enum.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Wrapper { - Wrap(i32), -} - -use Wrapper::Wrap; - -pub fn main() { - let Wrap(x) = &Wrap(3); - println!("{}", *x); - - let Wrap(x) = &mut Wrap(3); - println!("{}", *x); - - if let Some(x) = &Some(3) { - println!("{}", *x); - } else { - panic!(); - } - - if let Some(x) = &mut Some(3) { - println!("{}", *x); - } else { - panic!(); - } - - if let Some(x) = &mut Some(3) { - *x += 1; - } else { - panic!(); - } - - while let Some(x) = &Some(3) { - println!("{}", *x); - break; - } - while let Some(x) = &mut Some(3) { - println!("{}", *x); - break; - } - while let Some(x) = &mut Some(3) { - *x += 1; - break; - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs deleted file mode 100644 index e85d11f073d..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/for.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let mut tups = vec![(0u8, 1u8)]; - - for (n, m) in &tups { - let _: &u8 = n; - let _: &u8 = m; - } - - for (n, m) in &mut tups { - *n += 1; - *m += 2; - } - - assert_eq!(tups, vec![(1u8, 3u8)]); - - for (n, m) in tups { - println!("{} {}", m, n); - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs deleted file mode 100644 index 2aad9ccd6ef..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs +++ /dev/null @@ -1,258 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn some_or_wildcard(r: &Option, b: &i32) { - let _: &i32 = match r { - Some(a) => a, - _ => b, - }; -} - -fn none_or_wildcard(r: &Option, b: &i32) { - let _: &i32 = match r { - None => b, - _ => b, - }; -} - -fn some_or_ref_none(r: &Option, b: &i32) { - let _: &i32 = match r { - Some(a) => a, - &None => b, - }; -} - -fn ref_some_or_none(r: &Option, b: &i32) { - let _: &i32 = match r { - &Some(ref a) => a, - None => b, - }; -} - -fn some_or_self(r: &Option) { - let _: &Option = match r { - Some(n) => { - let _: &i32 = n; - r - }, - x => x, - }; -} - -fn multiple_deref(r: &&&&&Option) { - let _: i32 = match r { - Some(a) => *a, - None => 5, - }; -} - -fn match_with_or() { - // FIXME(tschottdorf): #44912. - // - // let x = &Some((3, 3)); - // let _: &i32 = match x { - // Some((x, 3)) | &Some((ref x, 5)) => x, - // _ => &5i32, - // }; -} - -fn nested_mixed() { - match (&Some(5), &Some(6)) { - (Some(a), &Some(mut b)) => { - // Here, the `a` will be `&i32`, because in the first half of the tuple - // we hit a non-reference pattern and shift into `ref` mode. - // - // In the second half of the tuple there's no non-reference pattern, - // so `b` will be `i32` (bound with `move` mode). Moreover, `b` is - // mutable. - let _: &i32 = a; - b = 7; - let _: i32 = b; - }, - _ => {}, - }; -} - -fn nested_mixed_multiple_deref_1() { - let x = (1, &Some(5)); - let y = &Some(x); - match y { - Some((a, Some(b))) => { - let _: &i32 = a; - let _: &i32 = b; - }, - _ => {}, - }; -} - -fn nested_mixed_multiple_deref_2() { - let x = &Some(5); - let y = &x; - match y { - Some(z) => { - let _: &i32 = z; - }, - _ => {}, - } -} - -fn new_mutable_reference() { - let mut x = &mut Some(5); - match &mut x { - Some(y) => { - *y = 5; - }, - None => { }, - } - - match &mut x { - Some(y) => { - println!("{}", *y); - }, - None => {}, - } -} - -fn let_implicit_ref_binding() { - struct Foo(i32); - - // Note that these rules apply to any pattern matching - // whether it be in a `match` or a `let`. - // For example, `x` here is a `ref` binding: - let Foo(x) = &Foo(3); - let _: &i32 = x; -} - -fn explicit_mut_binding() { - match &Some(5i32) { - Some(mut n) => { - n += 1; - let _ = n; - } - None => {}, - }; - - match &mut Some(5i32) { - Some(n) => { - *n += 1; - let _ = n; - } - None => {}, - }; - - match &mut &mut Some(5i32) { - Some(n) => { - let _: &mut i32 = n; - } - None => {}, - }; -} - -fn tuple_mut_and_mut_mut() { - match (Some(5i32), &Some(5i32)) { - (Some(n), Some(m)) => { - // `n` and `m` are bound as immutable references. Make new references from them to - // assert that. - let r = n; - let _ = r; - let q = m; - let _ = q; - - // Assert the types. Note that we use `n` and `m` here which would fail had they been - // moved due to the assignments above. - let _: i32 = n; - let _: &i32 = m; - } - (_, _) => {}, - }; - - match (&Some(5i32), &&Some(5i32)) { - (Some(n), Some(m)) => { - let _: &i32 = n; - let _: &i32 = m; - } - (_, _) => {}, - }; - - match &mut &mut (Some(5i32), Some(5i32)) { - (Some(n), Some(m)) => { - // Dereferenced through &mut &mut, so a mutable binding results. - let _: &mut i32 = n; - let _: &mut i32 = m; - } - (_, _) => {}, - }; - - match (&mut Some(5i32), &mut &mut Some(5i32)) { - (Some(n), Some(m)) => { - let _: &mut i32 = n; - let _: &mut i32 = m; - } - (_, _) => {}, - }; -} - -fn min_mir_embedded_type() { - // The reduced invocation that an ICE was diagnosed with (was consuming - // adjustments in wrong order). - match (0u8, &&Some(5i32)) { - (_, Some(m)) => { - let _: &i32 = m; - } - (_, _) => {}, - }; -} - -fn no_autoderef() { - // Binding. - let x = &3; - println!("{}", *x); - - // Wildcard. - let _ = &3; - - // Constant of generic type (string) - const Y: &'static str = "foo"; - assert_eq!(0, match "foo" { - Y => 0, - _ => 1, - }); - - // Reference pattern. - let &x = &3; -} - -pub fn main() { - let r: &Option = &Some(3); - let b = &4i32; - - none_or_wildcard(r, b); - some_or_wildcard(r, b); - some_or_ref_none(r, b); - ref_some_or_none(r, b); - - some_or_self(r); - multiple_deref(&&&&r); - match_with_or(); - - nested_mixed(); - nested_mixed_multiple_deref_1(); - nested_mixed_multiple_deref_2(); - - new_mutable_reference(); - explicit_mut_binding(); - tuple_mut_and_mut_mut(); - min_mir_embedded_type(); - - let_implicit_ref_binding(); - - no_autoderef(); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs deleted file mode 100644 index ac6f61b32b7..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn with_u8() { - let s = 5u8; - let r = match &s { - 4 => false, - 5 => true, - _ => false, - }; - assert!(r); -} - -// A string literal isn't mistaken for a non-ref pattern (in which case we'd -// deref `s` and mess things up). -fn with_str() { - let s: &'static str = "abc"; - match s { - "abc" => true, - _ => panic!(), - }; -} - -// Ditto with byte strings. -fn with_bytes() { - let s: &'static [u8] = b"abc"; - match s { - b"abc" => true, - _ => panic!(), - }; -} - -pub fn main() { - with_str(); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs deleted file mode 100644 index 3c8463f77ef..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/range.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let i = 5; - match &&&&i { - 1 ..= 3 => panic!(), - 3 ..= 8 => {}, - _ => panic!(), - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs deleted file mode 100644 index 7cdd35acaad..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/ref-region.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn foo<'a, 'b>(x: &'a &'b Option) -> &'a u32 { - let x: &'a &'a Option = x; - match x { - Some(r) => { - let _: &u32 = r; - r - }, - &None => panic!(), - } -} - -pub fn main() { - let x = Some(5); - foo(&&x); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs deleted file mode 100644 index c8144e09fc8..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/reset-mode.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we "reset" the mode as we pass through a `&` pattern. -// -// cc #46688 - -fn surprise(x: i32) { - assert_eq!(x, 2); -} - -fn main() { - let x = &(1, &2); - let (_, &b) = x; - surprise(b); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs deleted file mode 100644 index 90fa52bc903..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/slice.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(slice_patterns)] - -fn slice_pat() { - let sl: &[u8] = b"foo"; - - match sl { - [first, remainder..] => { - let _: &u8 = first; - assert_eq!(first, &b'f'); - assert_eq!(remainder, b"oo"); - } - [] => panic!(), - } -} - -fn slice_pat_omission() { - match &[0, 1, 2] { - [..] => {} - }; -} - -fn main() { - slice_pat(); - slice_pat_omission(); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs deleted file mode 100644 index 5e41f012137..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/struct.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug, PartialEq)] -struct Foo { - x: u8, -} - -pub fn main() { - let mut foo = Foo { - x: 1, - }; - - match &mut foo { - Foo{x: n} => { - *n += 1; - }, - }; - - assert_eq!(foo, Foo{x: 2}); - - let Foo{x: n} = &foo; - assert_eq!(*n, 2); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs deleted file mode 100644 index 072332cd9d0..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -enum Foo { - Bar(Option, (), (), Vec), - Baz, -} - -pub fn main() { - let foo = Foo::Bar(Some(1), (), (), vec![2, 3]); - - match &foo { - Foo::Baz => panic!(), - Foo::Bar(None, ..) => panic!(), - Foo::Bar(Some(n), .., v) => { - assert_eq!((*v).len(), 2); - assert_eq!(*n, 1); - } - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs b/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs deleted file mode 100644 index 830e6f5e5ba..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2005-default-binding-mode/tuple.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - let foo = (Some(1), (), (), vec![2, 3]); - - match &foo { - (Some(n), .., v) => { - assert_eq!((*v).len(), 2); - assert_eq!(*n, 1); - } - (None, (), (), ..) => panic!(), - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs deleted file mode 100644 index 0dbc5c8f969..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/enums.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![crate_type = "rlib"] -#![feature(non_exhaustive)] - -#[non_exhaustive] -pub enum NonExhaustiveEnum { - Unit, - Tuple(u32), - Struct { field: u32 } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs deleted file mode 100644 index 25764457701..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/structs.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(non_exhaustive)] - -#[non_exhaustive] -pub struct NormalStruct { - pub first_field: u16, - pub second_field: u16, -} - -#[non_exhaustive] -pub struct UnitStruct; - -#[non_exhaustive] -pub struct TupleStruct (pub u16, pub u16); diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs deleted file mode 100644 index 2975126709b..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/auxiliary/variants.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![crate_type = "rlib"] -#![feature(non_exhaustive)] - -pub enum NonExhaustiveVariants { - #[non_exhaustive] Unit, - #[non_exhaustive] Tuple(u32), - #[non_exhaustive] Struct { field: u32 } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs deleted file mode 100644 index ff8b473b43b..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:enums.rs -extern crate enums; - -// ignore-pretty issue #37199 - -use enums::NonExhaustiveEnum; - -fn main() { - let enum_unit = NonExhaustiveEnum::Unit; - - match enum_unit { - NonExhaustiveEnum::Unit => 1, - NonExhaustiveEnum::Tuple(_) => 2, - // This particular arm tests that a enum marked as non-exhaustive - // will not error if its variants are matched exhaustively. - NonExhaustiveEnum::Struct { field } => field, - _ => 0 // no error with wildcard - }; - - match enum_unit { - _ => "no error with only wildcard" - }; - - - // issue #53549 - check that variant constructors can still be called normally. - - match NonExhaustiveEnum::Unit { - NonExhaustiveEnum::Unit => {}, - _ => {} - }; - - match NonExhaustiveEnum::Tuple(2) { - NonExhaustiveEnum::Tuple(2) => {}, - _ => {} - }; - - match (NonExhaustiveEnum::Unit {}) { - NonExhaustiveEnum::Unit {} => {}, - _ => {} - }; - - match (NonExhaustiveEnum::Tuple { 0: 2 }) { - NonExhaustiveEnum::Tuple { 0: 2 } => {}, - _ => {} - }; - - match (NonExhaustiveEnum::Struct { field: 2 }) { - NonExhaustiveEnum::Struct { field: 2 } => {}, - _ => {} - }; - -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs deleted file mode 100644 index 8f0274f318d..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/enums_same_crate.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(non_exhaustive)] - -#[non_exhaustive] -pub enum NonExhaustiveEnum { - Unit, - Tuple(u32), - Struct { field: u32 } -} - -fn main() { - let enum_unit = NonExhaustiveEnum::Unit; - - match enum_unit { - NonExhaustiveEnum::Unit => "first", - NonExhaustiveEnum::Tuple(_) => "second", - NonExhaustiveEnum::Struct { .. } => "third", - }; -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs deleted file mode 100644 index 2bfdddc8eb7..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:structs.rs -extern crate structs; - -use structs::{NormalStruct, UnitStruct, TupleStruct}; - -// We only test matching here as we cannot create non-exhaustive -// structs from another crate. ie. they'll never pass in run-pass tests. - -fn match_structs(ns: NormalStruct, ts: TupleStruct, us: UnitStruct) { - let NormalStruct { first_field, second_field, .. } = ns; - - let TupleStruct { 0: first, 1: second, .. } = ts; - - let UnitStruct { .. } = us; -} - -fn main() { } diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs deleted file mode 100644 index 6c71c05709c..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(non_exhaustive)] - -#[non_exhaustive] -pub struct NormalStruct { - pub first_field: u16, - pub second_field: u16, -} - -#[non_exhaustive] -pub struct UnitStruct; - -#[non_exhaustive] -pub struct TupleStruct (pub u16, pub u16); - -fn main() { - let ns = NormalStruct { first_field: 640, second_field: 480 }; - - let NormalStruct { first_field, second_field } = ns; - - let ts = TupleStruct { 0: 340, 1: 480 }; - let ts_constructor = TupleStruct(340, 480); - - let TupleStruct { 0: first, 1: second } = ts; - let TupleStruct(first, second) = ts_constructor; - - let us = UnitStruct {}; - let us_constructor = UnitStruct; - - let UnitStruct { } = us; -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs deleted file mode 100644 index 2122534facb..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:variants.rs -extern crate variants; - -use variants::NonExhaustiveVariants; - -/* - * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for - * variants. See issue #44109 and PR 45394. - */ -// ignore-test - -fn main() { - let variant_tuple = NonExhaustiveVariants::Tuple { 0: 340 }; - let variant_struct = NonExhaustiveVariants::Struct { field: 340 }; - - match variant_struct { - NonExhaustiveVariants::Unit => "", - NonExhaustiveVariants::Struct { field, .. } => "", - NonExhaustiveVariants::Tuple(fe_tpl, ..) => "" - }; -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs b/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs deleted file mode 100644 index e339c046b18..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2008-non-exhaustive/variants_same_crate.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(non_exhaustive)] - -/* - * The initial implementation of #[non_exhaustive] (RFC 2008) does not include support for - * variants. See issue #44109 and PR 45394. - */ -// ignore-test - -pub enum NonExhaustiveVariants { - #[non_exhaustive] Unit, - #[non_exhaustive] Tuple(u32), - #[non_exhaustive] Struct { field: u32 } -} - -fn main() { - let variant_tuple = NonExhaustiveVariants::Tuple(340); - let variant_struct = NonExhaustiveVariants::Struct { field: 340 }; - - match variant_tuple { - NonExhaustiveVariants::Unit => "", - NonExhaustiveVariants::Tuple(fe_tpl) => "", - NonExhaustiveVariants::Struct { field } => "" - }; -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs b/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs deleted file mode 100644 index 71904acae72..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(crate_in_paths)] - -use crate::m::f; -use crate as root; - -mod m { - pub fn f() -> u8 { 1 } - pub fn g() -> u8 { 2 } - pub fn h() -> u8 { 3 } - - // OK, visibilities are implicitly absolute like imports - pub(in crate::m) struct S; -} - -mod n { - use crate::m::f; - use crate as root; - pub fn check() { - assert_eq!(f(), 1); - assert_eq!(crate::m::g(), 2); - assert_eq!(root::m::h(), 3); - } -} - -mod p { - use {super::f, crate::m::g, self::root::m::h}; - use crate as root; - pub fn check() { - assert_eq!(f(), 1); - assert_eq!(g(), 2); - assert_eq!(h(), 3); - } -} - -fn main() { - assert_eq!(f(), 1); - assert_eq!(crate::m::g(), 2); - assert_eq!(root::m::h(), 3); - n::check(); - p::check(); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr b/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr deleted file mode 100644 index f95237fbbea..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/crate-path-absolute.rs:12:12 - | -LL | #![feature(crate_in_paths)] - | ^^^^^^^^^^^^^^ - | - = note: #[warn(stable_features)] on by default - diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs b/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs deleted file mode 100644 index 37821777822..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(crate_in_paths)] -#![feature(crate_visibility_modifier)] - -mod m { - pub struct Z; - pub struct S1(crate (::m::Z)); // OK - pub struct S2((crate ::m::Z)); // OK - pub struct S3(crate ::m::Z); // OK - pub struct S4(crate crate::m::Z); // OK -} - -fn main() { - crate struct S; // OK (item in statement position) -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr b/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr deleted file mode 100644 index 91f918dbd2c..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.stderr +++ /dev/null @@ -1,8 +0,0 @@ -warning: the feature `crate_in_paths` has been stable since 1.30.0 and no longer requires an attribute to enable - --> $DIR/crate-path-visibility-ambiguity.rs:12:12 - | -LL | #![feature(crate_in_paths)] - | ^^^^^^^^^^^^^^ - | - = note: #[warn(stable_features)] on by default - diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs b/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs deleted file mode 100644 index a5214d796cd..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/auxiliary/xcrate.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[derive(Debug, PartialEq)] -pub struct S; - -#[derive(Debug)] -pub struct Z; - -pub trait Tr<'a> {} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs b/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs deleted file mode 100644 index b13602297a4..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate.rs -// compile-flags:--extern xcrate -// edition:2018 - -use xcrate::Z; - -fn f() { - use xcrate; - use xcrate as ycrate; - let s = xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = ycrate::Z; - assert_eq!(format!("{:?}", z), "Z"); -} - -fn main() { - let s = ::xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = Z; - assert_eq!(format!("{:?}", z), "Z"); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs b/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs deleted file mode 100644 index 0d84ccc3d32..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:xcrate.rs -// compile-flags:--extern xcrate - -#![feature(extern_in_paths)] - -use extern::xcrate::Z; - -type A = extern::xcrate::S; -type B = for<'a> extern::xcrate::Tr<'a>; - -fn f() { - use extern::xcrate; - use extern::xcrate as ycrate; - let s = xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = ycrate::Z; - assert_eq!(format!("{:?}", z), "Z"); -} - -fn main() { - let s = extern::xcrate::S; - assert_eq!(format!("{:?}", s), "S"); - let z = Z; - assert_eq!(format!("{:?}", z), "Z"); - assert_eq!(A {}, extern::xcrate::S {}); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs b/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs deleted file mode 100644 index a8fa07af14d..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/test.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that `#[test]` works with extern-absolute-paths enabled. -// -// Regression test for #47075. - -// edition:2018 -// compile-flags: --test - -#[test] -fn test() {} diff --git a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs b/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs deleted file mode 100644 index dfd9fbd2774..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2126-extern-absolute-paths/whitelisted.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// edition:2018 - -// Tests that `core` and `std` are always available. -use core::iter; -use std::io; -// FIXME(eddyb) Add a `meta` crate to the distribution. -// use meta; - -fn main() { - for _ in iter::once(()) { - io::stdout(); - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs b/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs deleted file mode 100644 index 95db3873619..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/attr.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem; - -#[r#repr(r#C, r#packed)] -struct Test { - a: bool, b: u64 -} - -#[r#derive(r#Debug)] -struct Test2(u32); - -pub fn main() { - assert_eq!(mem::size_of::(), 9); - assert_eq!("Test2(123)", format!("{:?}", Test2(123))); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs b/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs deleted file mode 100644 index 38c00f4a7e1..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/basic.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -fn r#fn(r#match: u32) -> u32 { - r#match -} - -pub fn main() { - let r#struct = 1; - assert_eq!(1, r#struct); - - let foo = 2; - assert_eq!(2, r#foo); - - let r#bar = 3; - assert_eq!(3, bar); - - assert_eq!(4, r#fn(4)); - - let r#true = false; - assert_eq!(r#true, false); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs b/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs deleted file mode 100644 index b3ea7b28362..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/items.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug, PartialEq, Eq)] -struct IntWrapper(u32); - -#[derive(Debug, Ord, PartialOrd, PartialEq, Eq, Hash, Copy, Clone, Default)] -struct HasKeywordField { - r#struct: u32, -} - -struct Generic(T); - -trait Trait { - fn r#trait(&self) -> u32; -} -impl Trait for Generic { - fn r#trait(&self) -> u32 { - self.0 - } -} - -pub fn main() { - assert_eq!(IntWrapper(1), r#IntWrapper(1)); - - match IntWrapper(2) { - r#IntWrapper(r#struct) => assert_eq!(2, r#struct), - } - - assert_eq!("HasKeywordField { struct: 3 }", format!("{:?}", HasKeywordField { r#struct: 3 })); - - assert_eq!(4, Generic(4).0); - assert_eq!(5, Generic(5).r#trait()); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs b/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs deleted file mode 100644 index ed39498526d..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2151-raw-identifiers/macros.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(decl_macro)] - -r#macro_rules! r#struct { - ($r#struct:expr) => { $r#struct } -} - -macro_rules! old_macro { - ($a:expr) => {$a} -} - -macro r#decl_macro($r#fn:expr) { - $r#fn -} - -macro passthrough($id:ident) { - $id -} - -macro_rules! test_pat_match { - (a) => { 6 }; - (r#a) => { 7 }; -} - -pub fn main() { - r#println!("{struct}", r#struct = 1); - assert_eq!(2, r#struct!(2)); - assert_eq!(3, r#old_macro!(3)); - assert_eq!(4, decl_macro!(4)); - - let r#match = 5; - assert_eq!(5, passthrough!(r#match)); - - assert_eq!("r#struct", stringify!(r#struct)); - - assert_eq!(6, test_pat_match!(a)); - assert_eq!(7, test_pat_match!(r#a)); -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs b/src/test/ui/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs deleted file mode 100644 index 29e8ab8ed1f..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(if_while_or_patterns)] - -enum E { - V(u8), - U(u8), - W, -} -use E::*; - -fn main() { - let mut e = V(10); - - if let V(x) | U(x) = e { - assert_eq!(x, 10); - } - while let V(x) | U(x) = e { - assert_eq!(x, 10); - e = W; - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2302-self-struct-ctor.rs b/src/test/ui/run-pass/rfcs/rfc-2302-self-struct-ctor.rs deleted file mode 100644 index 156e240e442..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2302-self-struct-ctor.rs +++ /dev/null @@ -1,129 +0,0 @@ -// run-pass - -#![feature(self_struct_ctor)] - -#![allow(dead_code)] - -use std::fmt::Display; - -struct ST1(i32, i32); - -impl ST1 { - fn new() -> Self { - ST1(0, 1) - } - - fn ctor() -> Self { - Self(1,2) // Self as a constructor - } - - fn pattern(self) { - match self { - Self(x, y) => println!("{} {}", x, y), // Self as a pattern - } - } -} - -struct ST2(T); // With type parameter - -impl ST2 where T: Display { - - fn ctor(v: T) -> Self { - Self(v) - } - - fn pattern(&self) { - match self { - Self(ref v) => println!("{}", v), - } - } -} - -struct ST3<'a>(&'a i32); // With lifetime parameter - -impl<'a> ST3<'a> { - - fn ctor(v: &'a i32) -> Self { - Self(v) - } - - fn pattern(self) { - let Self(ref v) = self; - println!("{}", v); - } -} - -struct ST4(usize); - -impl ST4 { - fn map(opt: Option) -> Option { - opt.map(Self) // use `Self` as a function passed somewhere - } -} - -struct ST5; // unit struct - -impl ST5 { - fn ctor() -> Self { - Self // `Self` as a unit struct value - } - - fn pattern(self) -> Self { - match self { - Self => Self, // `Self` as a unit struct value for matching - } - } -} - -struct ST6(i32); -type T = ST6; -impl T { - fn ctor() -> Self { - ST6(1) - } - - fn type_alias(self) { - let Self(_x) = match self { Self(x) => Self(x) }; - let _opt: Option = Some(0).map(Self); - } -} - -struct ST7(T1, T2); - -impl ST7 { - - fn ctor() -> Self { - Self(1, 2) - } - - fn pattern(self) -> Self { - match self { - Self(x, y) => Self(x, y), - } - } -} - -fn main() { - let v1 = ST1::ctor(); - v1.pattern(); - - let v2 = ST2::ctor(10); - v2.pattern(); - - let local = 42; - let v3 = ST3::ctor(&local); - v3.pattern(); - - let v4 = Some(1usize); - let _ = ST4::map(v4); - - let v5 = ST5::ctor(); - v5.pattern(); - - let v6 = ST6::ctor(); - v6.type_alias(); - - let v7 = ST7::::ctor(); - let r = v7.pattern(); - println!("{} {}", r.0, r.1) -} diff --git a/src/test/ui/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs b/src/test/ui/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs deleted file mode 100644 index 755e3cb8c3b..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that removed keywords are allowed as identifiers. -fn main () { - let offsetof = (); - let alignof = (); - let sizeof = (); - let pure = (); -} - -fn offsetof() {} -fn alignof() {} -fn sizeof() {} -fn pure() {} diff --git a/src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs b/src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs deleted file mode 100644 index a6b46d9c00c..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match-on-ty-in-macro.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -macro_rules! foo { - (#[$attr:meta] $x:ident) => { - #[$attr] - struct $x { - x: u32 - } - } -} - -foo! { #[derive(PartialEq, Eq)] Foo } - -const FOO: Foo = Foo { x: 0 }; - -fn main() { - let y = Foo { x: 1 }; - match y { - FOO => { } - _ => { } - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match.rs b/src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match.rs deleted file mode 100644 index 2dfe62b044a..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc1445/eq-allows-match.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -#[derive(PartialEq, Eq)] -struct Foo { - x: u32 -} - -const FOO: Foo = Foo { x: 0 }; - -fn main() { - let y = Foo { x: 1 }; - match y { - FOO => { } - _ => { } - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc1623.rs b/src/test/ui/run-pass/rfcs/rfc1623.rs deleted file mode 100644 index ddb83317fd9..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc1623.rs +++ /dev/null @@ -1,84 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -#![allow(dead_code)] - -// very simple test for a 'static static with default lifetime -static STATIC_STR: &str = "&'static str"; -const CONST_STR: &str = "&'static str"; - -// this should be the same as without default: -static EXPLICIT_STATIC_STR: &'static str = "&'static str"; -const EXPLICIT_CONST_STR: &'static str = "&'static str"; - -// a function that elides to an unbound lifetime for both in- and output -fn id_u8_slice(arg: &[u8]) -> &[u8] { - arg -} - -// one with a function, argument elided -static STATIC_SIMPLE_FN: &fn(&[u8]) -> &[u8] = &(id_u8_slice as fn(&[u8]) -> &[u8]); -const CONST_SIMPLE_FN: &fn(&[u8]) -> &[u8] = &(id_u8_slice as fn(&[u8]) -> &[u8]); - -// this should be the same as without elision -static STATIC_NON_ELIDED_fN: &for<'a> fn(&'a [u8]) -> &'a [u8] = - &(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]); -const CONST_NON_ELIDED_fN: &for<'a> fn(&'a [u8]) -> &'a [u8] = - &(id_u8_slice as for<'a> fn(&'a [u8]) -> &'a [u8]); - -// another function that elides, each to a different unbound lifetime -fn multi_args(a: &u8, b: &u8, c: &u8) {} - -static STATIC_MULTI_FN: &fn(&u8, &u8, &u8) = &(multi_args as fn(&u8, &u8, &u8)); -const CONST_MULTI_FN: &fn(&u8, &u8, &u8) = &(multi_args as fn(&u8, &u8, &u8)); - -struct Foo<'a> { - bools: &'a [bool], -} - -static STATIC_FOO: Foo = Foo { bools: &[true, false] }; -const CONST_FOO: Foo = Foo { bools: &[true, false] }; - -type Bar<'a> = Foo<'a>; - -static STATIC_BAR: Bar = Bar { bools: &[true, false] }; -const CONST_BAR: Bar = Bar { bools: &[true, false] }; - -type Baz<'a> = fn(&'a [u8]) -> Option; - -fn baz(e: &[u8]) -> Option { - e.first().map(|x| *x) -} - -static STATIC_BAZ: &Baz = &(baz as Baz); -const CONST_BAZ: &Baz = &(baz as Baz); - -static BYTES: &[u8] = &[1, 2, 3]; - -fn main() { - // make sure that the lifetime is actually elided (and not defaulted) - let x = &[1u8, 2, 3]; - STATIC_SIMPLE_FN(x); - CONST_SIMPLE_FN(x); - - STATIC_BAZ(BYTES); // neees static lifetime - CONST_BAZ(BYTES); - - // make sure this works with different lifetimes - let a = &1; - { - let b = &2; - let c = &3; - CONST_MULTI_FN(a, b, c); - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs b/src/test/ui/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs deleted file mode 100644 index 7438ba21bfc..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc1717/auxiliary/clibrary.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -#![crate_type = "staticlib"] - -#[no_mangle] -pub extern "C" fn foo(x:i32) -> i32 { x } diff --git a/src/test/ui/run-pass/rfcs/rfc1717/library-override.rs b/src/test/ui/run-pass/rfcs/rfc1717/library-override.rs deleted file mode 100644 index 6e0ff447081..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc1717/library-override.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with -// compile-flags: -lstatic=wronglibrary:rust_test_helpers - -#[link(name = "wronglibrary", kind = "dylib")] -extern "C" { - pub fn rust_dbg_extern_identity_u32(x: u32) -> u32; -} - -fn main() { - unsafe { - rust_dbg_extern_identity_u32(42); - } -} diff --git a/src/test/ui/run-pass/rfcs/rfc1857-drop-order.rs b/src/test/ui/run-pass/rfcs/rfc1857-drop-order.rs deleted file mode 100644 index 66edfd06730..00000000000 --- a/src/test/ui/run-pass/rfcs/rfc1857-drop-order.rs +++ /dev/null @@ -1,234 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare compiled with panic=abort by default - -#![allow(dead_code, unreachable_code)] - -use std::cell::RefCell; -use std::rc::Rc; -use std::panic::{self, AssertUnwindSafe, UnwindSafe}; - -// This struct is used to record the order in which elements are dropped -struct PushOnDrop { - vec: Rc>>, - val: u32 -} - -impl PushOnDrop { - fn new(val: u32, vec: Rc>>) -> PushOnDrop { - PushOnDrop { vec, val } - } -} - -impl Drop for PushOnDrop { - fn drop(&mut self) { - self.vec.borrow_mut().push(self.val) - } -} - -impl UnwindSafe for PushOnDrop { } - -// Structs -struct TestStruct { - x: PushOnDrop, - y: PushOnDrop, - z: PushOnDrop -} - -// Tuple structs -struct TestTupleStruct(PushOnDrop, PushOnDrop, PushOnDrop); - -// Enum variants -enum TestEnum { - Tuple(PushOnDrop, PushOnDrop, PushOnDrop), - Struct { x: PushOnDrop, y: PushOnDrop, z: PushOnDrop } -} - -fn test_drop_tuple() { - // Tuple fields are dropped in the same order they are declared - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let test_tuple = (PushOnDrop::new(1, dropped_fields.clone()), - PushOnDrop::new(2, dropped_fields.clone())); - drop(test_tuple); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); - - // Panic during construction means that fields are treated as local variables - // Therefore they are dropped in reverse order of initialization - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - (PushOnDrop::new(2, cloned.clone()), - PushOnDrop::new(1, cloned.clone()), - panic!("this panic is caught :D")); - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); -} - -fn test_drop_struct() { - // Struct fields are dropped in the same order they are declared - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let test_struct = TestStruct { - x: PushOnDrop::new(1, dropped_fields.clone()), - y: PushOnDrop::new(2, dropped_fields.clone()), - z: PushOnDrop::new(3, dropped_fields.clone()), - }; - drop(test_struct); - assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); - - // The same holds for tuple structs - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let test_tuple_struct = TestTupleStruct(PushOnDrop::new(1, dropped_fields.clone()), - PushOnDrop::new(2, dropped_fields.clone()), - PushOnDrop::new(3, dropped_fields.clone())); - drop(test_tuple_struct); - assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); - - // Panic during struct construction means that fields are treated as local variables - // Therefore they are dropped in reverse order of initialization - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - TestStruct { - x: PushOnDrop::new(2, cloned.clone()), - y: PushOnDrop::new(1, cloned.clone()), - z: panic!("this panic is caught :D") - }; - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); - - // Test with different initialization order - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - TestStruct { - y: PushOnDrop::new(2, cloned.clone()), - x: PushOnDrop::new(1, cloned.clone()), - z: panic!("this panic is caught :D") - }; - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); - - // The same holds for tuple structs - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - TestTupleStruct(PushOnDrop::new(2, cloned.clone()), - PushOnDrop::new(1, cloned.clone()), - panic!("this panic is caught :D")); - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); -} - -fn test_drop_enum() { - // Enum variants are dropped in the same order they are declared - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let test_struct_enum = TestEnum::Struct { - x: PushOnDrop::new(1, dropped_fields.clone()), - y: PushOnDrop::new(2, dropped_fields.clone()), - z: PushOnDrop::new(3, dropped_fields.clone()) - }; - drop(test_struct_enum); - assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); - - // The same holds for tuple enum variants - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let test_tuple_enum = TestEnum::Tuple(PushOnDrop::new(1, dropped_fields.clone()), - PushOnDrop::new(2, dropped_fields.clone()), - PushOnDrop::new(3, dropped_fields.clone())); - drop(test_tuple_enum); - assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); - - // Panic during enum construction means that fields are treated as local variables - // Therefore they are dropped in reverse order of initialization - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - TestEnum::Struct { - x: PushOnDrop::new(2, cloned.clone()), - y: PushOnDrop::new(1, cloned.clone()), - z: panic!("this panic is caught :D") - }; - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); - - // Test with different initialization order - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - TestEnum::Struct { - y: PushOnDrop::new(2, cloned.clone()), - x: PushOnDrop::new(1, cloned.clone()), - z: panic!("this panic is caught :D") - }; - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); - - // The same holds for tuple enum variants - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - TestEnum::Tuple(PushOnDrop::new(2, cloned.clone()), - PushOnDrop::new(1, cloned.clone()), - panic!("this panic is caught :D")); - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); -} - -fn test_drop_list() { - // Elements in a Vec are dropped in the same order they are pushed - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let xs = vec![PushOnDrop::new(1, dropped_fields.clone()), - PushOnDrop::new(2, dropped_fields.clone()), - PushOnDrop::new(3, dropped_fields.clone())]; - drop(xs); - assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); - - // The same holds for arrays - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let xs = [PushOnDrop::new(1, dropped_fields.clone()), - PushOnDrop::new(2, dropped_fields.clone()), - PushOnDrop::new(3, dropped_fields.clone())]; - drop(xs); - assert_eq!(*dropped_fields.borrow(), &[1, 2, 3]); - - // Panic during vec construction means that fields are treated as local variables - // Therefore they are dropped in reverse order of initialization - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - vec![ - PushOnDrop::new(2, cloned.clone()), - PushOnDrop::new(1, cloned.clone()), - panic!("this panic is caught :D") - ]; - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); - - // The same holds for arrays - let dropped_fields = Rc::new(RefCell::new(Vec::new())); - let cloned = AssertUnwindSafe(dropped_fields.clone()); - panic::catch_unwind(|| { - [ - PushOnDrop::new(2, cloned.clone()), - PushOnDrop::new(1, cloned.clone()), - panic!("this panic is caught :D") - ]; - }).err().unwrap(); - assert_eq!(*dropped_fields.borrow(), &[1, 2]); -} - -fn main() { - test_drop_tuple(); - test_drop_struct(); - test_drop_enum(); - test_drop_list(); -} diff --git a/src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs b/src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs deleted file mode 100644 index c609f0dd83e..00000000000 --- a/src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_struct.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(arbitrary_self_types)] - -use std::rc::Rc; - -struct Foo(String); - -impl Foo { - unsafe fn foo(self: *const Self) -> *const str { - (*self).0.as_ref() - } - - fn complicated_1(self: *const Rc) -> &'static str { - "Foo::complicated_1" - } - - unsafe fn complicated_2(self: Rc<*const Self>) -> *const str { - (**self).0.as_ref() - } -} - -fn main() { - let foo = Foo("abc123".into()); - assert_eq!("abc123", unsafe { &*(&foo as *const Foo).foo() }); - assert_eq!("Foo::complicated_1", std::ptr::null::>().complicated_1()); - let rc = Rc::new(&foo as *const Foo); - assert_eq!("abc123", unsafe { &*rc.complicated_2()}); -} diff --git a/src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs b/src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs deleted file mode 100644 index 86b3c86564b..00000000000 --- a/src/test/ui/run-pass/self/arbitrary_self_types_raw_pointer_trait.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(arbitrary_self_types)] - -use std::ptr; - -trait Foo { - fn foo(self: *const Self) -> &'static str; - - unsafe fn bar(self: *const Self) -> i64; - - unsafe fn complicated(self: *const *const Self) -> i64 where Self: Sized { - (*self).bar() - } -} - -impl Foo for i32 { - fn foo(self: *const Self) -> &'static str { - "I'm an i32!" - } - - unsafe fn bar(self: *const Self) -> i64 { - *self as i64 - } -} - -impl Foo for u32 { - fn foo(self: *const Self) -> &'static str { - "I'm a u32!" - } - - unsafe fn bar(self: *const Self) -> i64 { - *self as i64 - } -} - -fn main() { - let null_i32 = ptr::null::() as *const Foo; - let null_u32 = ptr::null::() as *const Foo; - - assert_eq!("I'm an i32!", null_i32.foo()); - assert_eq!("I'm a u32!", null_u32.foo()); - - let valid_i32 = 5i32; - let valid_i32_thin = &valid_i32 as *const i32; - assert_eq!("I'm an i32!", valid_i32_thin.foo()); - assert_eq!(5, unsafe { valid_i32_thin.bar() }); - assert_eq!(5, unsafe { (&valid_i32_thin as *const *const i32).complicated() }); - let valid_i32_fat = valid_i32_thin as *const Foo; - assert_eq!("I'm an i32!", valid_i32_fat.foo()); - assert_eq!(5, unsafe { valid_i32_fat.bar() }); - - let valid_u32 = 18u32; - let valid_u32_thin = &valid_u32 as *const u32; - assert_eq!("I'm a u32!", valid_u32_thin.foo()); - assert_eq!(18, unsafe { valid_u32_thin.bar() }); - assert_eq!(18, unsafe { (&valid_u32_thin as *const *const u32).complicated() }); - let valid_u32_fat = valid_u32_thin as *const Foo; - assert_eq!("I'm a u32!", valid_u32_fat.foo()); - assert_eq!(18, unsafe { valid_u32_fat.bar() }); - -} diff --git a/src/test/ui/run-pass/self/arbitrary_self_types_silly.rs b/src/test/ui/run-pass/self/arbitrary_self_types_silly.rs deleted file mode 100644 index 9fb023403ec..00000000000 --- a/src/test/ui/run-pass/self/arbitrary_self_types_silly.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(arbitrary_self_types)] - -struct Foo; -struct Bar; - -impl std::ops::Deref for Bar { - type Target = Foo; - - fn deref(&self) -> &Foo { - &Foo - } -} - -impl Foo { - fn bar(self: Bar) -> i32 { 3 } -} - -fn main() { - assert_eq!(3, Bar.bar()); -} diff --git a/src/test/ui/run-pass/self/arbitrary_self_types_struct.rs b/src/test/ui/run-pass/self/arbitrary_self_types_struct.rs deleted file mode 100644 index bc526701b6c..00000000000 --- a/src/test/ui/run-pass/self/arbitrary_self_types_struct.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(arbitrary_self_types)] - -use std::rc::Rc; - -struct Foo { - x: i32, - y: i32, -} - -impl Foo { - fn x(self: &Rc) -> i32 { - self.x - } - - fn y(self: Rc) -> i32 { - self.y - } -} - -fn main() { - let foo = Rc::new(Foo {x: 3, y: 4}); - assert_eq!(3, foo.x()); - assert_eq!(4, foo.y()); -} diff --git a/src/test/ui/run-pass/self/arbitrary_self_types_trait.rs b/src/test/ui/run-pass/self/arbitrary_self_types_trait.rs deleted file mode 100644 index bd06573c99b..00000000000 --- a/src/test/ui/run-pass/self/arbitrary_self_types_trait.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(arbitrary_self_types)] - -use std::rc::Rc; - -trait Trait { - fn trait_method<'a>(self: &'a Box>) -> &'a [i32]; -} - -impl Trait for Vec { - fn trait_method<'a>(self: &'a Box>) -> &'a [i32] { - &***self - } -} - -fn main() { - let v = vec![1,2,3]; - - assert_eq!(&[1,2,3], Box::new(Rc::new(v)).trait_method()); -} diff --git a/src/test/ui/run-pass/self/arbitrary_self_types_unsized_struct.rs b/src/test/ui/run-pass/self/arbitrary_self_types_unsized_struct.rs deleted file mode 100644 index e75e848db24..00000000000 --- a/src/test/ui/run-pass/self/arbitrary_self_types_unsized_struct.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(arbitrary_self_types)] - -use std::rc::Rc; - -struct Foo(T); - -impl Foo<[u8]> { - fn len(self: Rc) -> usize { - self.0.len() - } -} - -fn main() { - let rc = Rc::new(Foo([1u8,2,3])) as Rc>; - assert_eq!(3, rc.len()); -} diff --git a/src/test/ui/run-pass/self/auxiliary/explicit_self_xcrate.rs b/src/test/ui/run-pass/self/auxiliary/explicit_self_xcrate.rs deleted file mode 100644 index dafa66d9286..00000000000 --- a/src/test/ui/run-pass/self/auxiliary/explicit_self_xcrate.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait Foo { - #[inline(always)] - fn f(&self); -} - -pub struct Bar { - pub x: String -} - -impl Foo for Bar { - #[inline(always)] - fn f(&self) { - println!("{}", (*self).x); - } -} diff --git a/src/test/ui/run-pass/self/builtin-superkinds-self-type.rs b/src/test/ui/run-pass/self/builtin-superkinds-self-type.rs deleted file mode 100644 index a7754e06892..00000000000 --- a/src/test/ui/run-pass/self/builtin-superkinds-self-type.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests the ability for the Self type in default methods to use -// capabilities granted by builtin kinds as supertraits. - - -use std::sync::mpsc::{Sender, channel}; - -trait Foo : Send + Sized + 'static { - fn foo(self, tx: Sender) { - tx.send(self).unwrap(); - } -} - -impl Foo for T { } - -pub fn main() { - let (tx, rx) = channel(); - 1193182.foo(tx); - assert_eq!(rx.recv().unwrap(), 1193182); -} diff --git a/src/test/ui/run-pass/self/by-value-self-in-mut-slot.rs b/src/test/ui/run-pass/self/by-value-self-in-mut-slot.rs deleted file mode 100644 index d7f9ac6cc76..00000000000 --- a/src/test/ui/run-pass/self/by-value-self-in-mut-slot.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct X { - a: isize -} - -trait Changer { - fn change(self) -> Self; -} - -impl Changer for X { - fn change(mut self) -> X { - self.a = 55; - self - } -} - -pub fn main() { - let x = X { a: 32 }; - let new_x = x.change(); - assert_eq!(new_x.a, 55); -} diff --git a/src/test/ui/run-pass/self/explicit-self-closures.rs b/src/test/ui/run-pass/self/explicit-self-closures.rs deleted file mode 100644 index 0144433010f..00000000000 --- a/src/test/ui/run-pass/self/explicit-self-closures.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test to make sure that explicit self params work inside closures - -// pretty-expanded FIXME #23616 - -struct Box { - x: usize -} - -impl Box { - pub fn set_many(&mut self, xs: &[usize]) { - for x in xs { self.x = *x; } - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/self/explicit-self-generic.rs b/src/test/ui/run-pass/self/explicit-self-generic.rs deleted file mode 100644 index cf1546810a4..00000000000 --- a/src/test/ui/run-pass/self/explicit-self-generic.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -#[derive(Copy, Clone)] -struct LM { resize_at: usize, size: usize } - -enum HashMap { - HashMap_(LM, Vec<(K,V)>) -} - -fn linear_map() -> HashMap { - HashMap::HashMap_(LM{ - resize_at: 32, - size: 0}, Vec::new()) -} - -impl HashMap { - pub fn len(&mut self) -> usize { - match *self { - HashMap::HashMap_(ref l, _) => l.size - } - } -} - -pub fn main() { - let mut m: Box<_> = box linear_map::<(),()>(); - assert_eq!(m.len(), 0); -} diff --git a/src/test/ui/run-pass/self/explicit-self-objects-uniq.rs b/src/test/ui/run-pass/self/explicit-self-objects-uniq.rs deleted file mode 100644 index 373325aca06..00000000000 --- a/src/test/ui/run-pass/self/explicit-self-objects-uniq.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -trait Foo { - fn f(self: Box); -} - -struct S { - x: isize -} - -impl Foo for S { - fn f(self: Box) { - assert_eq!(self.x, 3); - } -} - -pub fn main() { - let x = box S { x: 3 }; - let y = x as Box; - y.f(); -} diff --git a/src/test/ui/run-pass/self/explicit-self.rs b/src/test/ui/run-pass/self/explicit-self.rs deleted file mode 100644 index 862d02bda0c..00000000000 --- a/src/test/ui/run-pass/self/explicit-self.rs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_upper_case_globals)] - -#![feature(box_syntax)] - -static tau: f64 = 2.0*3.14159265358979323; - -struct Point {x: f64, y: f64} -struct Size {w: f64, h: f64} -enum shape { - circle(Point, f64), - rectangle(Point, Size) -} - - -fn compute_area(shape: &shape) -> f64 { - match *shape { - shape::circle(_, radius) => 0.5 * tau * radius * radius, - shape::rectangle(_, ref size) => size.w * size.h - } -} - -impl shape { - // self is in the implicit self region - pub fn select<'r, T>(&self, threshold: f64, a: &'r T, b: &'r T) - -> &'r T { - if compute_area(self) > threshold {a} else {b} - } -} - -fn select_based_on_unit_circle<'r, T>( - threshold: f64, a: &'r T, b: &'r T) -> &'r T { - - let shape = &shape::circle(Point{x: 0.0, y: 0.0}, 1.0); - shape.select(threshold, a, b) -} - -#[derive(Clone)] -struct thing { - x: A -} - -#[derive(Clone)] -struct A { - a: isize -} - -fn thing(x: A) -> thing { - thing { - x: x - } -} - -impl thing { - pub fn bar(self: Box) -> isize { self.x.a } - pub fn quux(&self) -> isize { self.x.a } - pub fn baz<'a>(&'a self) -> &'a A { &self.x } - pub fn spam(self) -> isize { self.x.a } -} - -trait Nus { fn f(&self); } -impl Nus for thing { fn f(&self) {} } - -pub fn main() { - let y: Box<_> = box thing(A {a: 10}); - assert_eq!(y.clone().bar(), 10); - assert_eq!(y.quux(), 10); - - let z = thing(A {a: 11}); - assert_eq!(z.spam(), 11); -} diff --git a/src/test/ui/run-pass/self/explicit_self_xcrate_exe.rs b/src/test/ui/run-pass/self/explicit_self_xcrate_exe.rs deleted file mode 100644 index 3847bb4c661..00000000000 --- a/src/test/ui/run-pass/self/explicit_self_xcrate_exe.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:explicit_self_xcrate.rs - -// pretty-expanded FIXME #23616 - -extern crate explicit_self_xcrate; -use explicit_self_xcrate::{Foo, Bar}; - -pub fn main() { - let x = Bar { x: "hello".to_string() }; - x.f(); -} diff --git a/src/test/ui/run-pass/self/move-self.rs b/src/test/ui/run-pass/self/move-self.rs deleted file mode 100644 index d414a11edf4..00000000000 --- a/src/test/ui/run-pass/self/move-self.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S { - x: String -} - -impl S { - pub fn foo(self) { - self.bar(); - } - - pub fn bar(self) { - println!("{}", self.x); - } -} - -pub fn main() { - let x = S { x: "Hello!".to_string() }; - x.foo(); -} diff --git a/src/test/ui/run-pass/self/object-safety-sized-self-by-value-self.rs b/src/test/ui/run-pass/self/object-safety-sized-self-by-value-self.rs deleted file mode 100644 index 2ea1dcb221e..00000000000 --- a/src/test/ui/run-pass/self/object-safety-sized-self-by-value-self.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that a trait is still object-safe (and usable) if it has -// methods with by-value self so long as they require `Self : Sized`. - - -trait Counter { - fn tick(&mut self) -> u32; - fn get(self) -> u32 where Self : Sized; -} - -struct CCounter { - c: u32 -} - -impl Counter for CCounter { - fn tick(&mut self) -> u32 { self.c += 1; self.c } - fn get(self) -> u32 where Self : Sized { self.c } -} - -fn tick1(mut c: C) -> u32 { - tick2(&mut c); - c.get() -} - -fn tick2(c: &mut Counter) { - tick3(c); -} - -fn tick3(c: &mut C) { - c.tick(); - c.tick(); -} - -fn main() { - let mut c = CCounter { c: 0 }; - let value = tick1(c); - assert_eq!(value, 2); -} diff --git a/src/test/ui/run-pass/self/object-safety-sized-self-generic-method.rs b/src/test/ui/run-pass/self/object-safety-sized-self-generic-method.rs deleted file mode 100644 index 5f8ae3ce495..00000000000 --- a/src/test/ui/run-pass/self/object-safety-sized-self-generic-method.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that a trait is still object-safe (and usable) if it has -// generic methods so long as they require `Self : Sized`. - - -trait Counter { - fn tick(&mut self) -> u32; - fn with(&self, f: F) where Self : Sized; -} - -struct CCounter { - c: u32 -} - -impl Counter for CCounter { - fn tick(&mut self) -> u32 { self.c += 1; self.c } - fn with(&self, f: F) { f(self.c); } -} - -fn tick1(c: &mut C) { - tick2(c); - c.with(|i| ()); -} - -fn tick2(c: &mut Counter) { - tick3(c); -} - -fn tick3(c: &mut C) { - c.tick(); - c.tick(); -} - -fn main() { - let mut c = CCounter { c: 0 }; - tick1(&mut c); - assert_eq!(c.tick(), 3); -} diff --git a/src/test/ui/run-pass/self/object-safety-sized-self-return-Self.rs b/src/test/ui/run-pass/self/object-safety-sized-self-return-Self.rs deleted file mode 100644 index 09e28473fa7..00000000000 --- a/src/test/ui/run-pass/self/object-safety-sized-self-return-Self.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that a trait is still object-safe (and usable) if it has -// methods that return `Self` so long as they require `Self : Sized`. - - -trait Counter { - fn new() -> Self where Self : Sized; - fn tick(&mut self) -> u32; -} - -struct CCounter { - c: u32 -} - -impl Counter for CCounter { - fn new() -> CCounter { CCounter { c: 0 } } - fn tick(&mut self) -> u32 { self.c += 1; self.c } -} - -fn preticked() -> C { - let mut c: C = Counter::new(); - tick(&mut c); - c -} - -fn tick(c: &mut Counter) { - tick_generic(c); -} - -fn tick_generic(c: &mut C) { - c.tick(); - c.tick(); -} - -fn main() { - let mut c = preticked::(); - tick(&mut c); - assert_eq!(c.tick(), 5); -} diff --git a/src/test/ui/run-pass/self/self-impl.rs b/src/test/ui/run-pass/self/self-impl.rs deleted file mode 100644 index c0a7eee437c..00000000000 --- a/src/test/ui/run-pass/self/self-impl.rs +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can use `Self` types in impls in the expected way. - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -struct Foo; - -// Test uses on inherent impl. -impl Foo { - fn foo(_x: Self, _y: &Self, _z: Box) -> Self { - Foo - } - - fn baz() { - // Test that Self cannot be shadowed. - type Foo = i32; - // There is no empty method on i32. - Self::empty(); - - let _: Self = Foo; - } - - fn empty() {} -} - -// Test uses when implementing a trait and with a type parameter. -pub struct Baz { - pub f: X, -} - -trait SuperBar { - type SuperQux; -} - -trait Bar: SuperBar { - type Qux; - - fn bar(x: Self, y: &Self, z: Box, _: Self::SuperQux) -> Self; - fn dummy(&self, x: X) { } -} - -impl SuperBar for Box> { - type SuperQux = bool; -} - -impl Bar for Box> { - type Qux = i32; - - fn bar(_x: Self, _y: &Self, _z: Box, _: Self::SuperQux) -> Self { - let _: Self::Qux = 42; - let _: >::Qux = 42; - - let _: Self::SuperQux = true; - let _: ::SuperQux = true; - - box Baz { f: 42 } - } -} - -fn main() { - let _: Foo = Foo::foo(Foo, &Foo, box Foo); - let _: Box> = Bar::bar(box Baz { f: 42 }, - &box Baz { f: 42 }, - box box Baz { f: 42 }, - true); -} diff --git a/src/test/ui/run-pass/self/self-in-mut-slot-default-method.rs b/src/test/ui/run-pass/self/self-in-mut-slot-default-method.rs deleted file mode 100644 index 058ad2ef64e..00000000000 --- a/src/test/ui/run-pass/self/self-in-mut-slot-default-method.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct X { - a: isize -} - -trait Changer : Sized { - fn change(mut self) -> Self { - self.set_to(55); - self - } - - fn change_again(mut self: Box) -> Box { - self.set_to(45); - self - } - - fn set_to(&mut self, a: isize); -} - -impl Changer for X { - fn set_to(&mut self, a: isize) { - self.a = a; - } -} - -pub fn main() { - let x = X { a: 32 }; - let new_x = x.change(); - assert_eq!(new_x.a, 55); - - let x: Box<_> = box new_x; - let new_x = x.change_again(); - assert_eq!(new_x.a, 45); -} diff --git a/src/test/ui/run-pass/self/self-in-mut-slot-immediate-value.rs b/src/test/ui/run-pass/self/self-in-mut-slot-immediate-value.rs deleted file mode 100644 index d32f1e13804..00000000000 --- a/src/test/ui/run-pass/self/self-in-mut-slot-immediate-value.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Assert that `mut self` on an immediate value doesn't -// allow mutating the original - issue #10615. - - -#[derive(Copy, Clone)] -struct Value { - n: isize -} - -impl Value { - fn squared(mut self) -> Value { - self.n *= self.n; - self - } -} - -pub fn main() { - let x = Value { n: 3 }; - let y = x.squared(); - assert_eq!(x.n, 3); - assert_eq!(y.n, 9); -} diff --git a/src/test/ui/run-pass/self/self-in-typedefs.rs b/src/test/ui/run-pass/self/self-in-typedefs.rs deleted file mode 100644 index 92eccb47e18..00000000000 --- a/src/test/ui/run-pass/self/self-in-typedefs.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unions_with_drop_fields)] - -#![feature(self_in_typedefs)] -#![feature(untagged_unions)] - -#![allow(dead_code)] - -enum A<'a, T: 'a> -where - Self: Send, T: PartialEq -{ - Foo(&'a Self), - Bar(T), -} - -struct B<'a, T: 'a> -where - Self: Send, T: PartialEq -{ - foo: &'a Self, - bar: T, -} - -union C<'a, T: 'a> -where - Self: Send, T: PartialEq -{ - foo: &'a Self, - bar: T, -} - -fn main() {} diff --git a/src/test/ui/run-pass/self/self-re-assign.rs b/src/test/ui/run-pass/self/self-re-assign.rs deleted file mode 100644 index 982cc6675fa..00000000000 --- a/src/test/ui/run-pass/self/self-re-assign.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensure assigning an owned or managed variable to itself works. In particular, -// that we do not glue_drop before we glue_take (#3290). - -#![feature(box_syntax)] - -use std::rc::Rc; - -pub fn main() { - let mut x: Box<_> = box 3; - x = x; - assert_eq!(*x, 3); - - let mut x = Rc::new(3); - x = x; - assert_eq!(*x, 3); -} diff --git a/src/test/ui/run-pass/self/self-shadowing-import.rs b/src/test/ui/run-pass/self/self-shadowing-import.rs deleted file mode 100644 index fbf965df06b..00000000000 --- a/src/test/ui/run-pass/self/self-shadowing-import.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod a { - pub mod b { - pub mod a { - pub fn foo() -> isize { return 1; } - } - } -} - -mod c { - use a::b::a; - pub fn bar() { assert_eq!(a::foo(), 1); } -} - -pub fn main() { c::bar(); } diff --git a/src/test/ui/run-pass/self/self-type-param.rs b/src/test/ui/run-pass/self/self-type-param.rs deleted file mode 100644 index 13e28e62e5e..00000000000 --- a/src/test/ui/run-pass/self/self-type-param.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait MyTrait { - fn f(&self) -> Self; -} - -struct S { - x: isize -} - -impl MyTrait for S { - fn f(&self) -> S { - S { x: 3 } - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/self/string-self-append.rs b/src/test/ui/run-pass/self/string-self-append.rs deleted file mode 100644 index 54729856a6a..00000000000 --- a/src/test/ui/run-pass/self/string-self-append.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub fn main() { - // Make sure we properly handle repeated self-appends. - let mut a: String = "A".to_string(); - let mut i = 20; - let mut expected_len = 1; - while i > 0 { - println!("{}", a.len()); - assert_eq!(a.len(), expected_len); - a = format!("{}{}", a, a); - i -= 1; - expected_len *= 2; - } -} diff --git a/src/test/ui/run-pass/self/ufcs-explicit-self.rs b/src/test/ui/run-pass/self/ufcs-explicit-self.rs deleted file mode 100644 index df86065904d..00000000000 --- a/src/test/ui/run-pass/self/ufcs-explicit-self.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -#[derive(Copy, Clone)] -struct Foo { - f: isize, -} - -impl Foo { - fn foo(self: Foo, x: isize) -> isize { - self.f + x - } - fn bar(self: &Foo, x: isize) -> isize { - self.f + x - } - fn baz(self: Box, x: isize) -> isize { - self.f + x - } -} - -#[derive(Copy, Clone)] -struct Bar { - f: T, -} - -impl Bar { - fn foo(self: Bar, x: isize) -> isize { - x - } - fn bar<'a>(self: &'a Bar, x: isize) -> isize { - x - } - fn baz(self: Bar, x: isize) -> isize { - x - } -} - -fn main() { - let foo: Box<_> = box Foo { - f: 1, - }; - println!("{} {} {}", foo.foo(2), foo.bar(2), foo.baz(2)); - let bar: Box<_> = box Bar { - f: 1, - }; - println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2)); - let bar: Box> = bar; - println!("{} {} {}", bar.foo(2), bar.bar(2), bar.baz(2)); -} diff --git a/src/test/ui/run-pass/self/uniq-self-in-mut-slot.rs b/src/test/ui/run-pass/self/uniq-self-in-mut-slot.rs deleted file mode 100644 index 46d51d48547..00000000000 --- a/src/test/ui/run-pass/self/uniq-self-in-mut-slot.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct X { - a: isize -} - -trait Changer { - fn change(self: Box) -> Box; -} - -impl Changer for X { - fn change(mut self: Box) -> Box { - self.a = 55; - self - } -} - -pub fn main() { - let x: Box<_> = box X { a: 32 }; - let new_x = x.change(); - assert_eq!(new_x.a, 55); -} diff --git a/src/test/ui/run-pass/self/where-for-self.rs b/src/test/ui/run-pass/self/where-for-self.rs deleted file mode 100644 index 147ab0be74a..00000000000 --- a/src/test/ui/run-pass/self/where-for-self.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can quantify lifetimes outside a constraint (i.e., including -// the self type) in a where clause. - - -static mut COUNT: u32 = 1; - -trait Bar<'a> { - fn bar(&self); -} - -trait Baz<'a> -{ - fn baz(&self); -} - -impl<'a, 'b> Bar<'b> for &'a u32 { - fn bar(&self) { - unsafe { COUNT *= 2; } - } -} - -impl<'a, 'b> Baz<'b> for &'a u32 { - fn baz(&self) { - unsafe { COUNT *= 3; } - } -} - -// Test we can use the syntax for HRL including the self type. -fn foo1(x: &T) - where for<'a, 'b> &'a T: Bar<'b> -{ - x.bar() -} - -// Test we can quantify multiple bounds (i.e., the precedence is sensible). -fn foo2(x: &T) - where for<'a, 'b> &'a T: Bar<'b> + Baz<'b> -{ - x.baz(); - x.bar() -} - -fn main() { - let x = 42; - foo1(&x); - foo2(&x); - unsafe { - assert_eq!(COUNT, 12); - } -} diff --git a/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs b/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs deleted file mode 100644 index 72f1f73a81b..00000000000 --- a/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp-extern-lib.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[no_mangle] -pub extern "C" fn foo() -> usize { - 1234 -} diff --git a/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs b/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs deleted file mode 100644 index c57d161d8f5..00000000000 --- a/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_cci_lib.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#[inline] -pub fn cci_fn() -> usize { - 1200 -} - -pub const CCI_CONST: usize = 34; diff --git a/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_lib.rs b/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_lib.rs deleted file mode 100644 index 6f48978a000..00000000000 --- a/src/test/ui/run-pass/sepcomp/auxiliary/sepcomp_lib.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -C codegen-units=3 --crate-type=rlib,dylib -g - -pub mod a { - pub fn one() -> usize { - 1 - } -} - -pub mod b { - pub fn two() -> usize { - 2 - } -} - -pub mod c { - use a::one; - use b::two; - pub fn three() -> usize { - one() + two() - } -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-cci.rs b/src/test/ui/run-pass/sepcomp/sepcomp-cci.rs deleted file mode 100644 index beeece32337..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-cci.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-bitrig -// compile-flags: -C codegen-units=3 -// aux-build:sepcomp_cci_lib.rs - -// Test accessing cross-crate inlined items from multiple compilation units. - - -extern crate sepcomp_cci_lib; -use sepcomp_cci_lib::{cci_fn, CCI_CONST}; - -fn call1() -> usize { - cci_fn() + CCI_CONST -} - -mod a { - use sepcomp_cci_lib::{cci_fn, CCI_CONST}; - pub fn call2() -> usize { - cci_fn() + CCI_CONST - } -} - -mod b { - use sepcomp_cci_lib::{cci_fn, CCI_CONST}; - pub fn call3() -> usize { - cci_fn() + CCI_CONST - } -} - -fn main() { - assert_eq!(call1(), 1234); - assert_eq!(a::call2(), 1234); - assert_eq!(b::call3(), 1234); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-extern.rs b/src/test/ui/run-pass/sepcomp/sepcomp-extern.rs deleted file mode 100644 index ae392febc27..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-extern.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-bitrig -// compile-flags: -C codegen-units=3 -// aux-build:sepcomp-extern-lib.rs - -// Test accessing external items from multiple compilation units. - -extern crate sepcomp_extern_lib; - -extern { - fn foo() -> usize; -} - -fn call1() -> usize { - unsafe { foo() } -} - -mod a { - pub fn call2() -> usize { - unsafe { ::foo() } - } -} - -mod b { - pub fn call3() -> usize { - unsafe { ::foo() } - } -} - -fn main() { - assert_eq!(call1(), 1234); - assert_eq!(a::call2(), 1234); - assert_eq!(b::call3(), 1234); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-fns-backwards.rs b/src/test/ui/run-pass/sepcomp/sepcomp-fns-backwards.rs deleted file mode 100644 index 96993d3a7be..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-fns-backwards.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-bitrig -// compile-flags: -C codegen-units=3 - -// Test references to items that haven't been codegened yet. - -// Generate some code in the first compilation unit before declaring any -// modules. This ensures that the first module doesn't go into the same -// compilation unit as the top-level module. - -fn pad() -> usize { 0 } - -mod b { - pub fn three() -> usize { - ::one() + ::a::two() - } -} - -mod a { - pub fn two() -> usize { - ::one() + ::one() - } -} - -fn one() -> usize { - 1 -} - -fn main() { - assert_eq!(one(), 1); - assert_eq!(a::two(), 2); - assert_eq!(b::three(), 3); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-fns.rs b/src/test/ui/run-pass/sepcomp/sepcomp-fns.rs deleted file mode 100644 index 3d917cb70e3..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-fns.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-bitrig -// compile-flags: -C codegen-units=3 - -// Test basic separate compilation functionality. The functions should be able -// to call each other even though they will be placed in different compilation -// units. - -// Generate some code in the first compilation unit before declaring any -// modules. This ensures that the first module doesn't go into the same -// compilation unit as the top-level module. - -fn one() -> usize { 1 } - -mod a { - pub fn two() -> usize { - ::one() + ::one() - } -} - -mod b { - pub fn three() -> usize { - ::one() + ::a::two() - } -} - -fn main() { - assert_eq!(one(), 1); - assert_eq!(a::two(), 2); - assert_eq!(b::three(), 3); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-lib-lto.rs b/src/test/ui/run-pass/sepcomp/sepcomp-lib-lto.rs deleted file mode 100644 index 03b837cdcf4..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-lib-lto.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Check that we can use `-C lto` when linking against libraries that were -// separately compiled. - -// aux-build:sepcomp_lib.rs -// compile-flags: -C lto -g -// no-prefer-dynamic - -extern crate sepcomp_lib; -use sepcomp_lib::a::one; -use sepcomp_lib::b::two; -use sepcomp_lib::c::three; - -fn main() { - assert_eq!(one(), 1); - assert_eq!(two(), 2); - assert_eq!(three(), 3); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-lib.rs b/src/test/ui/run-pass/sepcomp/sepcomp-lib.rs deleted file mode 100644 index 11ad12611e1..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-lib.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:sepcomp_lib.rs - -// Test linking against a library built with -C codegen-units > 1 - - -extern crate sepcomp_lib; -use sepcomp_lib::a::one; -use sepcomp_lib::b::two; -use sepcomp_lib::c::three; - -fn main() { - assert_eq!(one(), 1); - assert_eq!(two(), 2); - assert_eq!(three(), 3); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-statics.rs b/src/test/ui/run-pass/sepcomp/sepcomp-statics.rs deleted file mode 100644 index 7022a5eee71..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-statics.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-bitrig -// compile-flags: -C codegen-units=3 - -// Test references to static items across compilation units. - - -fn pad() -> usize { 0 } - -const ONE: usize = 1; - -mod b { - // Separate compilation always switches to the LLVM module with the fewest - // instructions. Make sure we have some instructions in this module so - // that `a` and `b` don't go into the same compilation unit. - fn pad() -> usize { 0 } - - pub static THREE: usize = ::ONE + ::a::TWO; -} - -mod a { - fn pad() -> usize { 0 } - - pub const TWO: usize = ::ONE + ::ONE; -} - -fn main() { - assert_eq!(ONE, 1); - assert_eq!(a::TWO, 2); - assert_eq!(b::THREE, 3); -} diff --git a/src/test/ui/run-pass/sepcomp/sepcomp-unwind.rs b/src/test/ui/run-pass/sepcomp/sepcomp-unwind.rs deleted file mode 100644 index 15b07653224..00000000000 --- a/src/test/ui/run-pass/sepcomp/sepcomp-unwind.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-bitrig -// compile-flags: -C codegen-units=3 -// ignore-emscripten no threads support - -// Test unwinding through multiple compilation units. - -// According to acrichto, in the distant past `ld -r` (which is used during -// linking when codegen-units > 1) was known to produce object files with -// damaged unwinding tables. This may be related to GNU binutils bug #6893 -// ("Partial linking results in corrupt .eh_frame_hdr"), but I'm not certain. -// In any case, this test should let us know if enabling parallel codegen ever -// breaks unwinding. - - -use std::thread; - -fn pad() -> usize { 0 } - -mod a { - pub fn f() { - panic!(); - } -} - -mod b { - pub fn g() { - ::a::f(); - } -} - -fn main() { - thread::spawn(move|| { ::b::g() }).join().unwrap_err(); -} diff --git a/src/test/ui/run-pass/simd/simd-generics.rs b/src/test/ui/run-pass/simd/simd-generics.rs deleted file mode 100644 index b69b6f0a4cd..00000000000 --- a/src/test/ui/run-pass/simd/simd-generics.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - -#![feature(repr_simd, platform_intrinsics)] - -use std::ops; - -#[repr(simd)] -#[derive(Copy, Clone)] -struct f32x4(f32, f32, f32, f32); - -extern "platform-intrinsic" { - fn simd_add(x: T, y: T) -> T; -} - -fn add>(lhs: T, rhs: T) -> T { - lhs + rhs -} - -impl ops::Add for f32x4 { - type Output = f32x4; - - fn add(self, rhs: f32x4) -> f32x4 { - unsafe {simd_add(self, rhs)} - } -} - -pub fn main() { - let lr = f32x4(1.0f32, 2.0f32, 3.0f32, 4.0f32); - - // lame-o - let f32x4(x, y, z, w) = add(lr, lr); - assert_eq!(x, 2.0f32); - assert_eq!(y, 4.0f32); - assert_eq!(z, 6.0f32); - assert_eq!(w, 8.0f32); -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-float-math.rs b/src/test/ui/run-pass/simd/simd-intrinsic-float-math.rs deleted file mode 100644 index 216855db747..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-float-math.rs +++ /dev/null @@ -1,113 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten -// ignore-android - -// FIXME: this test fails on arm-android because the NDK version 14 is too old. -// It needs at least version 18. We disable it on all android build bots because -// there is no way in compile-test to disable it for an (arch,os) pair. - -// Test that the simd floating-point math intrinsics produce correct results. - -#![feature(repr_simd, platform_intrinsics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct f32x4(pub f32, pub f32, pub f32, pub f32); - -extern "platform-intrinsic" { - fn simd_fsqrt(x: T) -> T; - fn simd_fabs(x: T) -> T; - fn simd_fsin(x: T) -> T; - fn simd_fcos(x: T) -> T; - fn simd_ceil(x: T) -> T; - fn simd_fexp(x: T) -> T; - fn simd_fexp2(x: T) -> T; - fn simd_floor(x: T) -> T; - fn simd_fma(x: T, y: T, z: T) -> T; - fn simd_flog(x: T) -> T; - fn simd_flog10(x: T) -> T; - fn simd_flog2(x: T) -> T; - fn simd_fpow(x: T, y: T) -> T; - fn simd_fpowi(x: T, y: i32) -> T; -} - -macro_rules! assert_approx_eq_f32 { - ($a:expr, $b:expr) => ({ - let (a, b) = (&$a, &$b); - assert!((*a - *b).abs() < 1.0e-6, - "{} is not approximately equal to {}", *a, *b); - }) -} -macro_rules! assert_approx_eq { - ($a:expr, $b:expr) => ({ - let a = $a; - let b = $b; - assert_approx_eq_f32!(a.0, b.0); - assert_approx_eq_f32!(a.1, b.1); - assert_approx_eq_f32!(a.2, b.2); - assert_approx_eq_f32!(a.3, b.3); - }) -} - -fn main() { - let x = f32x4(1.0, 1.0, 1.0, 1.0); - let y = f32x4(-1.0, -1.0, -1.0, -1.0); - let z = f32x4(0.0, 0.0, 0.0, 0.0); - - let h = f32x4(0.5, 0.5, 0.5, 0.5); - - unsafe { - let r = simd_fabs(y); - assert_approx_eq!(x, r); - - let r = simd_fcos(z); - assert_approx_eq!(x, r); - - let r = simd_ceil(h); - assert_approx_eq!(x, r); - - let r = simd_fexp(z); - assert_approx_eq!(x, r); - - let r = simd_fexp2(z); - assert_approx_eq!(x, r); - - let r = simd_floor(h); - assert_approx_eq!(z, r); - - let r = simd_fma(x, h, h); - assert_approx_eq!(x, r); - - let r = simd_fsqrt(x); - assert_approx_eq!(x, r); - - let r = simd_flog(x); - assert_approx_eq!(z, r); - - let r = simd_flog2(x); - assert_approx_eq!(z, r); - - let r = simd_flog10(x); - assert_approx_eq!(z, r); - - let r = simd_fpow(h, x); - assert_approx_eq!(h, r); - - let r = simd_fpowi(h, 1); - assert_approx_eq!(h, r); - - let r = simd_fsin(z); - assert_approx_eq!(z, r); - } -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-float-minmax.rs b/src/test/ui/run-pass/simd/simd-intrinsic-float-minmax.rs deleted file mode 100644 index a146b4b2f70..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-float-minmax.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten -// min-llvm-version 7.0 -// error-pattern: panicked - -// Test that the simd_f{min,max} intrinsics produce the correct results. - -#![feature(repr_simd, platform_intrinsics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct f32x4(pub f32, pub f32, pub f32, pub f32); - -extern "platform-intrinsic" { - fn simd_fmin(x: T, y: T) -> T; - fn simd_fmax(x: T, y: T) -> T; -} - -fn main() { - let x = f32x4(1.0, 2.0, 3.0, 4.0); - let y = f32x4(2.0, 1.0, 4.0, 3.0); - - #[cfg(not(any(target_arch = "mips", target_arch = "mips64")))] - let nan = ::std::f32::NAN; - // MIPS hardware treats f32::NAN as SNAN. Clear the signaling bit. - // See https://github.com/rust-lang/rust/issues/52746. - #[cfg(any(target_arch = "mips", target_arch = "mips64"))] - let nan = f32::from_bits(::std::f32::NAN.to_bits() - 1); - - let n = f32x4(nan, nan, nan, nan); - - unsafe { - let min0 = simd_fmin(x, y); - let min1 = simd_fmin(y, x); - assert_eq!(min0, min1); - let e = f32x4(1.0, 1.0, 3.0, 3.0); - assert_eq!(min0, e); - let minn = simd_fmin(x, n); - assert_eq!(minn, x); - let minn = simd_fmin(y, n); - assert_eq!(minn, y); - - let max0 = simd_fmax(x, y); - let max1 = simd_fmax(y, x); - assert_eq!(max0, max1); - let e = f32x4(2.0, 2.0, 4.0, 4.0); - assert_eq!(max0, e); - let maxn = simd_fmax(x, n); - assert_eq!(maxn, x); - let maxn = simd_fmax(y, n); - assert_eq!(maxn, y); - } -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-arithmetic.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-arithmetic.rs deleted file mode 100644 index c1094336c29..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-arithmetic.rs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// ignore-emscripten FIXME(#45351) hits an LLVM assert - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(simd)] -#[derive(Copy, Clone)] -struct i32x4(pub i32, pub i32, pub i32, pub i32); - -#[repr(simd)] -#[derive(Copy, Clone)] -struct u32x4(pub u32, pub u32, pub u32, pub u32); - -#[repr(simd)] -#[derive(Copy, Clone)] -struct f32x4(pub f32, pub f32, pub f32, pub f32); - -macro_rules! all_eq { - ($a: expr, $b: expr) => {{ - let a = $a; - let b = $b; - assert!(a.0 == b.0 && a.1 == b.1 && a.2 == b.2 && a.3 == b.3); - }} -} - -extern "platform-intrinsic" { - fn simd_add(x: T, y: T) -> T; - fn simd_sub(x: T, y: T) -> T; - fn simd_mul(x: T, y: T) -> T; - fn simd_div(x: T, y: T) -> T; - fn simd_rem(x: T, y: T) -> T; - fn simd_shl(x: T, y: T) -> T; - fn simd_shr(x: T, y: T) -> T; - fn simd_and(x: T, y: T) -> T; - fn simd_or(x: T, y: T) -> T; - fn simd_xor(x: T, y: T) -> T; -} - -fn main() { - let x1 = i32x4(1, 2, 3, 4); - let y1 = u32x4(1, 2, 3, 4); - let z1 = f32x4(1.0, 2.0, 3.0, 4.0); - let x2 = i32x4(2, 3, 4, 5); - let y2 = u32x4(2, 3, 4, 5); - let z2 = f32x4(2.0, 3.0, 4.0, 5.0); - - unsafe { - all_eq!(simd_add(x1, x2), i32x4(3, 5, 7, 9)); - all_eq!(simd_add(x2, x1), i32x4(3, 5, 7, 9)); - all_eq!(simd_add(y1, y2), u32x4(3, 5, 7, 9)); - all_eq!(simd_add(y2, y1), u32x4(3, 5, 7, 9)); - all_eq!(simd_add(z1, z2), f32x4(3.0, 5.0, 7.0, 9.0)); - all_eq!(simd_add(z2, z1), f32x4(3.0, 5.0, 7.0, 9.0)); - - all_eq!(simd_mul(x1, x2), i32x4(2, 6, 12, 20)); - all_eq!(simd_mul(x2, x1), i32x4(2, 6, 12, 20)); - all_eq!(simd_mul(y1, y2), u32x4(2, 6, 12, 20)); - all_eq!(simd_mul(y2, y1), u32x4(2, 6, 12, 20)); - all_eq!(simd_mul(z1, z2), f32x4(2.0, 6.0, 12.0, 20.0)); - all_eq!(simd_mul(z2, z1), f32x4(2.0, 6.0, 12.0, 20.0)); - - all_eq!(simd_sub(x2, x1), i32x4(1, 1, 1, 1)); - all_eq!(simd_sub(x1, x2), i32x4(-1, -1, -1, -1)); - all_eq!(simd_sub(y2, y1), u32x4(1, 1, 1, 1)); - all_eq!(simd_sub(y1, y2), u32x4(!0, !0, !0, !0)); - all_eq!(simd_sub(z2, z1), f32x4(1.0, 1.0, 1.0, 1.0)); - all_eq!(simd_sub(z1, z2), f32x4(-1.0, -1.0, -1.0, -1.0)); - - all_eq!(simd_div(x1, x1), i32x4(1, 1, 1, 1)); - all_eq!(simd_div(i32x4(2, 4, 6, 8), i32x4(2, 2, 2, 2)), x1); - all_eq!(simd_div(y1, y1), u32x4(1, 1, 1, 1)); - all_eq!(simd_div(u32x4(2, 4, 6, 8), u32x4(2, 2, 2, 2)), y1); - all_eq!(simd_div(z1, z1), f32x4(1.0, 1.0, 1.0, 1.0)); - all_eq!(simd_div(z1, z2), f32x4(1.0/2.0, 2.0/3.0, 3.0/4.0, 4.0/5.0)); - all_eq!(simd_div(z2, z1), f32x4(2.0/1.0, 3.0/2.0, 4.0/3.0, 5.0/4.0)); - - all_eq!(simd_rem(x1, x1), i32x4(0, 0, 0, 0)); - all_eq!(simd_rem(x2, x1), i32x4(0, 1, 1, 1)); - all_eq!(simd_rem(y1, y1), u32x4(0, 0, 0, 0)); - all_eq!(simd_rem(y2, y1), u32x4(0, 1, 1, 1)); - all_eq!(simd_rem(z1, z1), f32x4(0.0, 0.0, 0.0, 0.0)); - all_eq!(simd_rem(z1, z2), z1); - all_eq!(simd_rem(z2, z1), f32x4(0.0, 1.0, 1.0, 1.0)); - - all_eq!(simd_shl(x1, x2), i32x4(1 << 2, 2 << 3, 3 << 4, 4 << 5)); - all_eq!(simd_shl(x2, x1), i32x4(2 << 1, 3 << 2, 4 << 3, 5 << 4)); - all_eq!(simd_shl(y1, y2), u32x4(1 << 2, 2 << 3, 3 << 4, 4 << 5)); - all_eq!(simd_shl(y2, y1), u32x4(2 << 1, 3 << 2, 4 << 3, 5 << 4)); - - // test right-shift by assuming left-shift is correct - all_eq!(simd_shr(simd_shl(x1, x2), x2), x1); - all_eq!(simd_shr(simd_shl(x2, x1), x1), x2); - all_eq!(simd_shr(simd_shl(y1, y2), y2), y1); - all_eq!(simd_shr(simd_shl(y2, y1), y1), y2); - - // ensure we get logical vs. arithmetic shifts correct - let (a, b, c, d) = (-12, -123, -1234, -12345); - all_eq!(simd_shr(i32x4(a, b, c, d), x1), i32x4(a >> 1, b >> 2, c >> 3, d >> 4)); - all_eq!(simd_shr(u32x4(a as u32, b as u32, c as u32, d as u32), y1), - u32x4((a as u32) >> 1, (b as u32) >> 2, (c as u32) >> 3, (d as u32) >> 4)); - - all_eq!(simd_and(x1, x2), i32x4(0, 2, 0, 4)); - all_eq!(simd_and(x2, x1), i32x4(0, 2, 0, 4)); - all_eq!(simd_and(y1, y2), u32x4(0, 2, 0, 4)); - all_eq!(simd_and(y2, y1), u32x4(0, 2, 0, 4)); - - all_eq!(simd_or(x1, x2), i32x4(3, 3, 7, 5)); - all_eq!(simd_or(x2, x1), i32x4(3, 3, 7, 5)); - all_eq!(simd_or(y1, y2), u32x4(3, 3, 7, 5)); - all_eq!(simd_or(y2, y1), u32x4(3, 3, 7, 5)); - - all_eq!(simd_xor(x1, x2), i32x4(3, 1, 7, 1)); - all_eq!(simd_xor(x2, x1), i32x4(3, 1, 7, 1)); - all_eq!(simd_xor(y1, y2), u32x4(3, 1, 7, 1)); - all_eq!(simd_xor(y2, y1), u32x4(3, 1, 7, 1)); - - } -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-cast.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-cast.rs deleted file mode 100644 index e24a141e6e0..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-cast.rs +++ /dev/null @@ -1,130 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten FIXME(#45351) hits an LLVM assert - -#![feature(repr_simd, platform_intrinsics, concat_idents, test)] -#![allow(non_camel_case_types)] - -extern crate test; - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct i8x4(i8, i8, i8, i8); - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct u32x4(u32, u32, u32, u32); -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct u8x4(u8, u8, u8, u8); - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct f32x4(f32, f32, f32, f32); - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct f64x4(f64, f64, f64, f64); - - -extern "platform-intrinsic" { - fn simd_cast(x: T) -> U; -} - -const A: i32 = -1234567; -const B: i32 = 12345678; -const C: i32 = -123456789; -const D: i32 = 1234567890; - -trait Foo { - fn is_float() -> bool { false } - fn in_range(x: i32) -> bool; -} -impl Foo for i32 { - fn in_range(_: i32) -> bool { true } -} -impl Foo for i8 { - fn in_range(x: i32) -> bool { -128 <= x && x < 128 } -} -impl Foo for u32 { - fn in_range(x: i32) -> bool { 0 <= x } -} -impl Foo for u8 { - fn in_range(x: i32) -> bool { 0 <= x && x < 128 } -} -impl Foo for f32 { - fn is_float() -> bool { true } - fn in_range(_: i32) -> bool { true } -} -impl Foo for f64 { - fn is_float() -> bool { true } - fn in_range(_: i32) -> bool { true } -} - -fn main() { - macro_rules! test { - ($from: ident, $to: ident) => {{ - // force the casts to actually happen, or else LLVM/rustc - // may fold them and get slightly different results. - let (a, b, c, d) = test::black_box((A as $from, B as $from, C as $from, D as $from)); - // the SIMD vectors are all FOOx4, so we can concat_idents - // so we don't have to pass in the extra args to the macro - let mut from = simd_cast(concat_idents!($from, x4)(a, b, c, d)); - let mut to = concat_idents!($to, x4)(a as $to, - b as $to, - c as $to, - d as $to); - // assist type inference, it needs to know what `from` is - // for the `if` statements. - to == from; - - // there are platform differences for some out of range - // casts, so we just normalize such things: it's OK for - // "invalid" calculations to result in nonsense answers. - // (E.g. negative float to unsigned integer goes through a - // library routine on the default i686 platforms, and the - // implementation of that routine differs on e.g. Linux - // vs. macOS, resulting in different answers.) - if $from::is_float() { - if !$to::in_range(A) { from.0 = 0 as $to; to.0 = 0 as $to; } - if !$to::in_range(B) { from.1 = 0 as $to; to.1 = 0 as $to; } - if !$to::in_range(C) { from.2 = 0 as $to; to.2 = 0 as $to; } - if !$to::in_range(D) { from.3 = 0 as $to; to.3 = 0 as $to; } - } - - assert!(to == from, - "{} -> {} ({:?} != {:?})", stringify!($from), stringify!($to), - from, to); - }} - } - macro_rules! tests { - (: $($to: ident),*) => { () }; - // repeating the list twice is easier than writing a cartesian - // product macro - ($from: ident $(, $from_: ident)*: $($to: ident),*) => { - fn $from() { unsafe { $( test!($from, $to); )* } } - tests!($($from_),*: $($to),*) - }; - ($($types: ident),*) => {{ - tests!($($types),* : $($types),*); - $($types();)* - }} - } - - // test various combinations, including truncation, - // signed/unsigned extension, and floating point casts. - tests!(i32, i8, u32, u8, f32); - tests!(i32, u32, f32, f64) -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-comparison.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-comparison.rs deleted file mode 100644 index 0c36d88dafd..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-comparison.rs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten FIXME(#45351) hits an LLVM assert - -#![feature(repr_simd, platform_intrinsics, concat_idents)] -#![allow(non_camel_case_types)] - -use std::f32::NAN; - -#[repr(simd)] -#[derive(Copy, Clone)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -#[derive(Copy, Clone)] -struct u32x4(pub u32, pub u32, pub u32, pub u32); -#[repr(simd)] -#[derive(Copy, Clone)] -struct f32x4(pub f32, pub f32, pub f32, pub f32); - -extern "platform-intrinsic" { - fn simd_eq(x: T, y: T) -> U; - fn simd_ne(x: T, y: T) -> U; - fn simd_lt(x: T, y: T) -> U; - fn simd_le(x: T, y: T) -> U; - fn simd_gt(x: T, y: T) -> U; - fn simd_ge(x: T, y: T) -> U; -} - -macro_rules! cmp { - ($method: ident($lhs: expr, $rhs: expr)) => {{ - let lhs = $lhs; - let rhs = $rhs; - let e: u32x4 = concat_idents!(simd_, $method)($lhs, $rhs); - // assume the scalar version is correct/the behaviour we want. - assert!((e.0 != 0) == lhs.0 .$method(&rhs.0)); - assert!((e.1 != 0) == lhs.1 .$method(&rhs.1)); - assert!((e.2 != 0) == lhs.2 .$method(&rhs.2)); - assert!((e.3 != 0) == lhs.3 .$method(&rhs.3)); - }} -} -macro_rules! tests { - ($($lhs: ident, $rhs: ident;)*) => {{ - $( - (|| { - cmp!(eq($lhs, $rhs)); - cmp!(ne($lhs, $rhs)); - - // test both directions - cmp!(lt($lhs, $rhs)); - cmp!(lt($rhs, $lhs)); - - cmp!(le($lhs, $rhs)); - cmp!(le($rhs, $lhs)); - - cmp!(gt($lhs, $rhs)); - cmp!(gt($rhs, $lhs)); - - cmp!(ge($lhs, $rhs)); - cmp!(ge($rhs, $lhs)); - })(); - )* - }} -} -fn main() { - // 13 vs. -100 tests that we get signed vs. unsigned comparisons - // correct (i32: 13 > -100, u32: 13 < -100). let i1 = i32x4(10, -11, 12, 13); - let i1 = i32x4(10, -11, 12, 13); - let i2 = i32x4(5, -5, 20, -100); - let i3 = i32x4(10, -11, 20, -100); - - let u1 = u32x4(10, !11+1, 12, 13); - let u2 = u32x4(5, !5+1, 20, !100+1); - let u3 = u32x4(10, !11+1, 20, !100+1); - - let f1 = f32x4(10.0, -11.0, 12.0, 13.0); - let f2 = f32x4(5.0, -5.0, 20.0, -100.0); - let f3 = f32x4(10.0, -11.0, 20.0, -100.0); - - unsafe { - tests! { - i1, i1; - u1, u1; - f1, f1; - - i1, i2; - u1, u2; - f1, f2; - - i1, i3; - u1, u3; - f1, f3; - } - } - - // NAN comparisons are special: - // -11 (*) 13 - // -5 -100 (*) - let f4 = f32x4(NAN, f1.1, NAN, f2.3); - - unsafe { - tests! { - f1, f4; - f2, f4; - f4, f4; - } - } -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-elements.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-elements.rs deleted file mode 100644 index 0dd1cae18f1..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-elements.rs +++ /dev/null @@ -1,135 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten FIXME(#45351) hits an LLVM assert - -#![feature(repr_simd, platform_intrinsics)] - -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x2(i32, i32); -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x3(i32, i32, i32); -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x4(i32, i32, i32, i32); -#[repr(simd)] -#[derive(Copy, Clone, Debug, PartialEq)] -#[allow(non_camel_case_types)] -struct i32x8(i32, i32, i32, i32, - i32, i32, i32, i32); - -extern "platform-intrinsic" { - fn simd_insert(x: T, idx: u32, y: E) -> T; - fn simd_extract(x: T, idx: u32) -> E; - - fn simd_shuffle2(x: T, y: T, idx: [u32; 2]) -> U; - fn simd_shuffle3(x: T, y: T, idx: [u32; 3]) -> U; - fn simd_shuffle4(x: T, y: T, idx: [u32; 4]) -> U; - fn simd_shuffle8(x: T, y: T, idx: [u32; 8]) -> U; -} - -macro_rules! all_eq { - ($a: expr, $b: expr) => {{ - let a = $a; - let b = $b; - // type inference works better with the concrete type on the - // left, but humans work better with the expected on the - // right. - assert!(b == a, - "{:?} != {:?}", a, b); - }} -} - -fn main() { - let x2 = i32x2(20, 21); - let x3 = i32x3(30, 31, 32); - let x4 = i32x4(40, 41, 42, 43); - let x8 = i32x8(80, 81, 82, 83, 84, 85, 86, 87); - unsafe { - all_eq!(simd_insert(x2, 0, 100), i32x2(100, 21)); - all_eq!(simd_insert(x2, 1, 100), i32x2(20, 100)); - - all_eq!(simd_insert(x3, 0, 100), i32x3(100, 31, 32)); - all_eq!(simd_insert(x3, 1, 100), i32x3(30, 100, 32)); - all_eq!(simd_insert(x3, 2, 100), i32x3(30, 31, 100)); - - all_eq!(simd_insert(x4, 0, 100), i32x4(100, 41, 42, 43)); - all_eq!(simd_insert(x4, 1, 100), i32x4(40, 100, 42, 43)); - all_eq!(simd_insert(x4, 2, 100), i32x4(40, 41, 100, 43)); - all_eq!(simd_insert(x4, 3, 100), i32x4(40, 41, 42, 100)); - - all_eq!(simd_insert(x8, 0, 100), i32x8(100, 81, 82, 83, 84, 85, 86, 87)); - all_eq!(simd_insert(x8, 1, 100), i32x8(80, 100, 82, 83, 84, 85, 86, 87)); - all_eq!(simd_insert(x8, 2, 100), i32x8(80, 81, 100, 83, 84, 85, 86, 87)); - all_eq!(simd_insert(x8, 3, 100), i32x8(80, 81, 82, 100, 84, 85, 86, 87)); - all_eq!(simd_insert(x8, 4, 100), i32x8(80, 81, 82, 83, 100, 85, 86, 87)); - all_eq!(simd_insert(x8, 5, 100), i32x8(80, 81, 82, 83, 84, 100, 86, 87)); - all_eq!(simd_insert(x8, 6, 100), i32x8(80, 81, 82, 83, 84, 85, 100, 87)); - all_eq!(simd_insert(x8, 7, 100), i32x8(80, 81, 82, 83, 84, 85, 86, 100)); - - all_eq!(simd_extract(x2, 0), 20); - all_eq!(simd_extract(x2, 1), 21); - - all_eq!(simd_extract(x3, 0), 30); - all_eq!(simd_extract(x3, 1), 31); - all_eq!(simd_extract(x3, 2), 32); - - all_eq!(simd_extract(x4, 0), 40); - all_eq!(simd_extract(x4, 1), 41); - all_eq!(simd_extract(x4, 2), 42); - all_eq!(simd_extract(x4, 3), 43); - - all_eq!(simd_extract(x8, 0), 80); - all_eq!(simd_extract(x8, 1), 81); - all_eq!(simd_extract(x8, 2), 82); - all_eq!(simd_extract(x8, 3), 83); - all_eq!(simd_extract(x8, 4), 84); - all_eq!(simd_extract(x8, 5), 85); - all_eq!(simd_extract(x8, 6), 86); - all_eq!(simd_extract(x8, 7), 87); - } - - let y2 = i32x2(120, 121); - let y3 = i32x3(130, 131, 132); - let y4 = i32x4(140, 141, 142, 143); - let y8 = i32x8(180, 181, 182, 183, 184, 185, 186, 187); - unsafe { - all_eq!(simd_shuffle2(x2, y2, [3, 0]), i32x2(121, 20)); - all_eq!(simd_shuffle3(x2, y2, [3, 0, 1]), i32x3(121, 20, 21)); - all_eq!(simd_shuffle4(x2, y2, [3, 0, 1, 2]), i32x4(121, 20, 21, 120)); - all_eq!(simd_shuffle8(x2, y2, [3, 0, 1, 2, 1, 2, 3, 0]), - i32x8(121, 20, 21, 120, 21, 120, 121, 20)); - - all_eq!(simd_shuffle2(x3, y3, [4, 2]), i32x2(131, 32)); - all_eq!(simd_shuffle3(x3, y3, [4, 2, 3]), i32x3(131, 32, 130)); - all_eq!(simd_shuffle4(x3, y3, [4, 2, 3, 0]), i32x4(131, 32, 130, 30)); - all_eq!(simd_shuffle8(x3, y3, [4, 2, 3, 0, 1, 5, 5, 1]), - i32x8(131, 32, 130, 30, 31, 132, 132, 31)); - - all_eq!(simd_shuffle2(x4, y4, [7, 2]), i32x2(143, 42)); - all_eq!(simd_shuffle3(x4, y4, [7, 2, 5]), i32x3(143, 42, 141)); - all_eq!(simd_shuffle4(x4, y4, [7, 2, 5, 0]), i32x4(143, 42, 141, 40)); - all_eq!(simd_shuffle8(x4, y4, [7, 2, 5, 0, 3, 6, 4, 1]), - i32x8(143, 42, 141, 40, 43, 142, 140, 41)); - - all_eq!(simd_shuffle2(x8, y8, [11, 5]), i32x2(183, 85)); - all_eq!(simd_shuffle3(x8, y8, [11, 5, 15]), i32x3(183, 85, 187)); - all_eq!(simd_shuffle4(x8, y8, [11, 5, 15, 0]), i32x4(183, 85, 187, 80)); - all_eq!(simd_shuffle8(x8, y8, [11, 5, 15, 0, 3, 8, 12, 1]), - i32x8(183, 85, 187, 80, 83, 180, 184, 81)); - } - -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-gather.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-gather.rs deleted file mode 100644 index 5f6a72a8e1e..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-gather.rs +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten -// min-llvm-version 6.0 - -// Test that the simd_{gather,scatter} intrinsics produce the correct results. - -#![feature(repr_simd, platform_intrinsics)] -#![allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct x4(pub T, pub T, pub T, pub T); - -extern "platform-intrinsic" { - fn simd_gather(x: T, y: U, z: V) -> T; - fn simd_scatter(x: T, y: U, z: V) -> (); -} - -fn main() { - let mut x = [0_f32, 1., 2., 3., 4., 5., 6., 7.]; - - let default = x4(-3_f32, -3., -3., -3.); - let s_strided = x4(0_f32, 2., -3., 6.); - let mask = x4(-1_i32, -1, 0, -1); - - // reading from *const - unsafe { - let pointer = &x[0] as *const f32; - let pointers = x4( - pointer.offset(0) as *const f32, - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ); - - let r_strided = simd_gather(default, pointers, mask); - - assert_eq!(r_strided, s_strided); - } - - // reading from *mut - unsafe { - let pointer = &mut x[0] as *mut f32; - let pointers = x4( - pointer.offset(0) as *mut f32, - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ); - - let r_strided = simd_gather(default, pointers, mask); - - assert_eq!(r_strided, s_strided); - } - - // writing to *mut - unsafe { - let pointer = &mut x[0] as *mut f32; - let pointers = x4( - pointer.offset(0) as *mut f32, - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ); - - let values = x4(42_f32, 43_f32, 44_f32, 45_f32); - simd_scatter(values, pointers, mask); - - assert_eq!(x, [42., 1., 43., 3., 4., 5., 45., 7.]); - } - - // test modifying array of *const f32 - let mut y = [ - &x[0] as *const f32, - &x[1] as *const f32, - &x[2] as *const f32, - &x[3] as *const f32, - &x[4] as *const f32, - &x[5] as *const f32, - &x[6] as *const f32, - &x[7] as *const f32 - ]; - - let default = x4(y[0], y[0], y[0], y[0]); - let s_strided = x4(y[0], y[2], y[0], y[6]); - - // reading from *const - unsafe { - let pointer = &y[0] as *const *const f32; - let pointers = x4( - pointer.offset(0) as *const *const f32, - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ); - - let r_strided = simd_gather(default, pointers, mask); - - assert_eq!(r_strided, s_strided); - } - - // reading from *mut - unsafe { - let pointer = &mut y[0] as *mut *const f32; - let pointers = x4( - pointer.offset(0) as *mut *const f32, - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ); - - let r_strided = simd_gather(default, pointers, mask); - - assert_eq!(r_strided, s_strided); - } - - // writing to *mut - unsafe { - let pointer = &mut y[0] as *mut *const f32; - let pointers = x4( - pointer.offset(0) as *mut *const f32, - pointer.offset(2), - pointer.offset(4), - pointer.offset(6) - ); - - let values = x4(y[7], y[6], y[5], y[1]); - simd_scatter(values, pointers, mask); - - let s = [ - &x[7] as *const f32, - &x[1] as *const f32, - &x[6] as *const f32, - &x[3] as *const f32, - &x[4] as *const f32, - &x[5] as *const f32, - &x[1] as *const f32, - &x[7] as *const f32 - ]; - assert_eq!(y, s); - } -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-reduction.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-reduction.rs deleted file mode 100644 index 822101558ce..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-reduction.rs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// ignore-emscripten - -// Test that the simd_reduce_{op} intrinsics produce the correct results. - -#![feature(repr_simd, platform_intrinsics)] -#[allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone)] -struct i32x4(pub i32, pub i32, pub i32, pub i32); - -#[repr(simd)] -#[derive(Copy, Clone)] -struct u32x4(pub u32, pub u32, pub u32, pub u32); - -#[repr(simd)] -#[derive(Copy, Clone)] -struct f32x4(pub f32, pub f32, pub f32, pub f32); - -#[repr(simd)] -#[derive(Copy, Clone)] -struct b8x4(pub i8, pub i8, pub i8, pub i8); - -#[repr(simd)] -#[derive(Copy, Clone)] -struct b8x16( - pub i8, pub i8, pub i8, pub i8, - pub i8, pub i8, pub i8, pub i8, - pub i8, pub i8, pub i8, pub i8, - pub i8, pub i8, pub i8, pub i8 -); - -extern "platform-intrinsic" { - fn simd_reduce_add_unordered(x: T) -> U; - fn simd_reduce_mul_unordered(x: T) -> U; - fn simd_reduce_add_ordered(x: T, acc: U) -> U; - fn simd_reduce_mul_ordered(x: T, acc: U) -> U; - fn simd_reduce_min(x: T) -> U; - fn simd_reduce_max(x: T) -> U; - fn simd_reduce_min_nanless(x: T) -> U; - fn simd_reduce_max_nanless(x: T) -> U; - fn simd_reduce_and(x: T) -> U; - fn simd_reduce_or(x: T) -> U; - fn simd_reduce_xor(x: T) -> U; - fn simd_reduce_all(x: T) -> bool; - fn simd_reduce_any(x: T) -> bool; -} - -fn main() { - unsafe { - let x = i32x4(1, -2, 3, 4); - let r: i32 = simd_reduce_add_unordered(x); - assert_eq!(r, 6_i32); - let r: i32 = simd_reduce_mul_unordered(x); - assert_eq!(r, -24_i32); - let r: i32 = simd_reduce_add_ordered(x, -1); - assert_eq!(r, 5_i32); - let r: i32 = simd_reduce_mul_ordered(x, -1); - assert_eq!(r, 24_i32); - - let r: i32 = simd_reduce_min(x); - assert_eq!(r, -2_i32); - let r: i32 = simd_reduce_max(x); - assert_eq!(r, 4_i32); - - let x = i32x4(-1, -1, -1, -1); - let r: i32 = simd_reduce_and(x); - assert_eq!(r, -1_i32); - let r: i32 = simd_reduce_or(x); - assert_eq!(r, -1_i32); - let r: i32 = simd_reduce_xor(x); - assert_eq!(r, 0_i32); - - let x = i32x4(-1, -1, 0, -1); - let r: i32 = simd_reduce_and(x); - assert_eq!(r, 0_i32); - let r: i32 = simd_reduce_or(x); - assert_eq!(r, -1_i32); - let r: i32 = simd_reduce_xor(x); - assert_eq!(r, -1_i32); - } - - unsafe { - let x = u32x4(1, 2, 3, 4); - let r: u32 = simd_reduce_add_unordered(x); - assert_eq!(r, 10_u32); - let r: u32 = simd_reduce_mul_unordered(x); - assert_eq!(r, 24_u32); - let r: u32 = simd_reduce_add_ordered(x, 1); - assert_eq!(r, 11_u32); - let r: u32 = simd_reduce_mul_ordered(x, 2); - assert_eq!(r, 48_u32); - - let r: u32 = simd_reduce_min(x); - assert_eq!(r, 1_u32); - let r: u32 = simd_reduce_max(x); - assert_eq!(r, 4_u32); - - let t = u32::max_value(); - let x = u32x4(t, t, t, t); - let r: u32 = simd_reduce_and(x); - assert_eq!(r, t); - let r: u32 = simd_reduce_or(x); - assert_eq!(r, t); - let r: u32 = simd_reduce_xor(x); - assert_eq!(r, 0_u32); - - let x = u32x4(t, t, 0, t); - let r: u32 = simd_reduce_and(x); - assert_eq!(r, 0_u32); - let r: u32 = simd_reduce_or(x); - assert_eq!(r, t); - let r: u32 = simd_reduce_xor(x); - assert_eq!(r, t); - } - - unsafe { - let x = f32x4(1., -2., 3., 4.); - let r: f32 = simd_reduce_add_unordered(x); - assert_eq!(r, 6_f32); - let r: f32 = simd_reduce_mul_unordered(x); - assert_eq!(r, -24_f32); - // FIXME: only works correctly for accumulator, 0: - // https://bugs.llvm.org/show_bug.cgi?id=36734 - let r: f32 = simd_reduce_add_ordered(x, 0.); - assert_eq!(r, 6_f32); - // FIXME: only works correctly for accumulator, 1: - // https://bugs.llvm.org/show_bug.cgi?id=36734 - let r: f32 = simd_reduce_mul_ordered(x, 1.); - assert_eq!(r, -24_f32); - - let r: f32 = simd_reduce_min(x); - assert_eq!(r, -2_f32); - let r: f32 = simd_reduce_max(x); - assert_eq!(r, 4_f32); - let r: f32 = simd_reduce_min_nanless(x); - assert_eq!(r, -2_f32); - let r: f32 = simd_reduce_max_nanless(x); - assert_eq!(r, 4_f32); - } - - unsafe { - let x = b8x4(!0, !0, !0, !0); - let r: bool = simd_reduce_all(x); - assert_eq!(r, true); - let r: bool = simd_reduce_any(x); - assert_eq!(r, true); - - let x = b8x4(!0, !0, 0, !0); - let r: bool = simd_reduce_all(x); - assert_eq!(r, false); - let r: bool = simd_reduce_any(x); - assert_eq!(r, true); - - let x = b8x4(0, 0, 0, 0); - let r: bool = simd_reduce_all(x); - assert_eq!(r, false); - let r: bool = simd_reduce_any(x); - assert_eq!(r, false); - } -} diff --git a/src/test/ui/run-pass/simd/simd-intrinsic-generic-select.rs b/src/test/ui/run-pass/simd/simd-intrinsic-generic-select.rs deleted file mode 100644 index 590a2990270..00000000000 --- a/src/test/ui/run-pass/simd/simd-intrinsic-generic-select.rs +++ /dev/null @@ -1,149 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// ignore-emscripten - -// Test that the simd_select intrinsics produces correct results. - -#![feature(repr_simd, platform_intrinsics)] -#[allow(non_camel_case_types)] - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct i32x4(pub i32, pub i32, pub i32, pub i32); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct u32x4(pub u32, pub u32, pub u32, pub u32); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct f32x4(pub f32, pub f32, pub f32, pub f32); - -#[repr(simd)] -#[derive(Copy, Clone, PartialEq, Debug)] -struct b8x4(pub i8, pub i8, pub i8, pub i8); - -extern "platform-intrinsic" { - fn simd_select(x: T, a: U, b: U) -> U; -} - -fn main() { - let m0 = b8x4(!0, !0, !0, !0); - let m1 = b8x4(0, 0, 0, 0); - let m2 = b8x4(!0, !0, 0, 0); - let m3 = b8x4(0, 0, !0, !0); - let m4 = b8x4(!0, 0, !0, 0); - - unsafe { - let a = i32x4(1, -2, 3, 4); - let b = i32x4(5, 6, -7, 8); - - let r: i32x4 = simd_select(m0, a, b); - let e = a; - assert_eq!(r, e); - - let r: i32x4 = simd_select(m1, a, b); - let e = b; - assert_eq!(r, e); - - let r: i32x4 = simd_select(m2, a, b); - let e = i32x4(1, -2, -7, 8); - assert_eq!(r, e); - - let r: i32x4 = simd_select(m3, a, b); - let e = i32x4(5, 6, 3, 4); - assert_eq!(r, e); - - let r: i32x4 = simd_select(m4, a, b); - let e = i32x4(1, 6, 3, 8); - assert_eq!(r, e); - } - - unsafe { - let a = u32x4(1, 2, 3, 4); - let b = u32x4(5, 6, 7, 8); - - let r: u32x4 = simd_select(m0, a, b); - let e = a; - assert_eq!(r, e); - - let r: u32x4 = simd_select(m1, a, b); - let e = b; - assert_eq!(r, e); - - let r: u32x4 = simd_select(m2, a, b); - let e = u32x4(1, 2, 7, 8); - assert_eq!(r, e); - - let r: u32x4 = simd_select(m3, a, b); - let e = u32x4(5, 6, 3, 4); - assert_eq!(r, e); - - let r: u32x4 = simd_select(m4, a, b); - let e = u32x4(1, 6, 3, 8); - assert_eq!(r, e); - } - - unsafe { - let a = f32x4(1., 2., 3., 4.); - let b = f32x4(5., 6., 7., 8.); - - let r: f32x4 = simd_select(m0, a, b); - let e = a; - assert_eq!(r, e); - - let r: f32x4 = simd_select(m1, a, b); - let e = b; - assert_eq!(r, e); - - let r: f32x4 = simd_select(m2, a, b); - let e = f32x4(1., 2., 7., 8.); - assert_eq!(r, e); - - let r: f32x4 = simd_select(m3, a, b); - let e = f32x4(5., 6., 3., 4.); - assert_eq!(r, e); - - let r: f32x4 = simd_select(m4, a, b); - let e = f32x4(1., 6., 3., 8.); - assert_eq!(r, e); - } - - unsafe { - let t = !0 as i8; - let f = 0 as i8; - let a = b8x4(t, f, t, f); - let b = b8x4(f, f, f, t); - - let r: b8x4 = simd_select(m0, a, b); - let e = a; - assert_eq!(r, e); - - let r: b8x4 = simd_select(m1, a, b); - let e = b; - assert_eq!(r, e); - - let r: b8x4 = simd_select(m2, a, b); - let e = b8x4(t, f, f, t); - assert_eq!(r, e); - - let r: b8x4 = simd_select(m3, a, b); - let e = b8x4(f, f, t, f); - assert_eq!(r, e); - - let r: b8x4 = simd_select(m4, a, b); - let e = b8x4(t, f, t, t); - assert_eq!(r, e); - } -} diff --git a/src/test/ui/run-pass/simd/simd-size-align.rs b/src/test/ui/run-pass/simd/simd-size-align.rs deleted file mode 100644 index 6a1189ef2db..00000000000 --- a/src/test/ui/run-pass/simd/simd-size-align.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - - -#![feature(repr_simd)] -#![allow(non_camel_case_types)] - -use std::mem; - -/// `T` should satisfy `size_of T (mod min_align_of T) === 0` to be stored at `Vec` properly -/// Please consult the issue #20460 -fn check() { - assert_eq!(mem::size_of::() % mem::min_align_of::(), 0) -} - -fn main() { - check::(); - check::(); - check::(); - check::(); - check::(); - check::(); - check::(); - - check::(); - check::(); - check::(); - check::(); - check::(); - check::(); - check::(); - - check::(); - check::(); - check::(); - check::(); - check::(); - check::(); - check::(); -} - -#[repr(simd)] struct u8x2(u8, u8); -#[repr(simd)] struct u8x3(u8, u8, u8); -#[repr(simd)] struct u8x4(u8, u8, u8, u8); -#[repr(simd)] struct u8x5(u8, u8, u8, u8, u8); -#[repr(simd)] struct u8x6(u8, u8, u8, u8, u8, u8); -#[repr(simd)] struct u8x7(u8, u8, u8, u8, u8, u8, u8); -#[repr(simd)] struct u8x8(u8, u8, u8, u8, u8, u8, u8, u8); - -#[repr(simd)] struct i16x2(i16, i16); -#[repr(simd)] struct i16x3(i16, i16, i16); -#[repr(simd)] struct i16x4(i16, i16, i16, i16); -#[repr(simd)] struct i16x5(i16, i16, i16, i16, i16); -#[repr(simd)] struct i16x6(i16, i16, i16, i16, i16, i16); -#[repr(simd)] struct i16x7(i16, i16, i16, i16, i16, i16, i16); -#[repr(simd)] struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -#[repr(simd)] struct f32x2(f32, f32); -#[repr(simd)] struct f32x3(f32, f32, f32); -#[repr(simd)] struct f32x4(f32, f32, f32, f32); -#[repr(simd)] struct f32x5(f32, f32, f32, f32, f32); -#[repr(simd)] struct f32x6(f32, f32, f32, f32, f32, f32); -#[repr(simd)] struct f32x7(f32, f32, f32, f32, f32, f32, f32); -#[repr(simd)] struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32); diff --git a/src/test/ui/run-pass/simd/simd-target-feature-mixup.rs b/src/test/ui/run-pass/simd/simd-target-feature-mixup.rs deleted file mode 100644 index 7ac91592d81..00000000000 --- a/src/test/ui/run-pass/simd/simd-target-feature-mixup.rs +++ /dev/null @@ -1,193 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![allow(overflowing_literals)] - -// ignore-emscripten - -#![feature(repr_simd, target_feature, cfg_target_feature)] -#![feature(avx512_target_feature)] - -use std::process::{Command, ExitStatus}; -use std::env; - -fn main() { - if let Some(level) = env::args().nth(1) { - return test::main(&level) - } - - let me = env::current_exe().unwrap(); - for level in ["sse", "avx", "avx512"].iter() { - let status = Command::new(&me).arg(level).status().unwrap(); - if status.success() { - println!("success with {}", level); - continue - } - - // We don't actually know if our computer has the requisite target features - // for the test below. Testing for that will get added to libstd later so - // for now just assume sigill means this is a machine that can't run this test. - if is_sigill(status) { - println!("sigill with {}, assuming spurious", level); - continue - } - panic!("invalid status at {}: {}", level, status); - } -} - -#[cfg(unix)] -fn is_sigill(status: ExitStatus) -> bool { - use std::os::unix::prelude::*; - status.signal() == Some(4) -} - -#[cfg(windows)] -fn is_sigill(status: ExitStatus) -> bool { - status.code() == Some(0xc000001d) -} - -#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] -#[allow(nonstandard_style)] -mod test { - // An SSE type - #[repr(simd)] - #[derive(PartialEq, Debug, Clone, Copy)] - struct __m128i(u64, u64); - - // An AVX type - #[repr(simd)] - #[derive(PartialEq, Debug, Clone, Copy)] - struct __m256i(u64, u64, u64, u64); - - // An AVX-512 type - #[repr(simd)] - #[derive(PartialEq, Debug, Clone, Copy)] - struct __m512i(u64, u64, u64, u64, u64, u64, u64, u64); - - pub fn main(level: &str) { - unsafe { - main_normal(level); - main_sse(level); - if level == "sse" { - return - } - main_avx(level); - if level == "avx" { - return - } - main_avx512(level); - } - } - - macro_rules! mains { - ($( - $(#[$attr:meta])* - unsafe fn $main:ident(level: &str) { - ... - } - )*) => ($( - $(#[$attr])* - unsafe fn $main(level: &str) { - let m128 = __m128i(1, 2); - let m256 = __m256i(3, 4, 5, 6); - let m512 = __m512i(7, 8, 9, 10, 11, 12, 13, 14); - assert_eq!(id_sse_128(m128), m128); - assert_eq!(id_sse_256(m256), m256); - assert_eq!(id_sse_512(m512), m512); - - if level == "sse" { - return - } - assert_eq!(id_avx_128(m128), m128); - assert_eq!(id_avx_256(m256), m256); - assert_eq!(id_avx_512(m512), m512); - - if level == "avx" { - return - } - assert_eq!(id_avx512_128(m128), m128); - assert_eq!(id_avx512_256(m256), m256); - assert_eq!(id_avx512_512(m512), m512); - } - )*) - } - - mains! { - unsafe fn main_normal(level: &str) { ... } - #[target_feature(enable = "sse2")] - unsafe fn main_sse(level: &str) { ... } - #[target_feature(enable = "avx")] - unsafe fn main_avx(level: &str) { ... } - #[target_feature(enable = "avx512bw")] - unsafe fn main_avx512(level: &str) { ... } - } - - - #[target_feature(enable = "sse2")] - unsafe fn id_sse_128(a: __m128i) -> __m128i { - assert_eq!(a, __m128i(1, 2)); - a.clone() - } - - #[target_feature(enable = "sse2")] - unsafe fn id_sse_256(a: __m256i) -> __m256i { - assert_eq!(a, __m256i(3, 4, 5, 6)); - a.clone() - } - - #[target_feature(enable = "sse2")] - unsafe fn id_sse_512(a: __m512i) -> __m512i { - assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14)); - a.clone() - } - - #[target_feature(enable = "avx")] - unsafe fn id_avx_128(a: __m128i) -> __m128i { - assert_eq!(a, __m128i(1, 2)); - a.clone() - } - - #[target_feature(enable = "avx")] - unsafe fn id_avx_256(a: __m256i) -> __m256i { - assert_eq!(a, __m256i(3, 4, 5, 6)); - a.clone() - } - - #[target_feature(enable = "avx")] - unsafe fn id_avx_512(a: __m512i) -> __m512i { - assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14)); - a.clone() - } - - #[target_feature(enable = "avx512bw")] - unsafe fn id_avx512_128(a: __m128i) -> __m128i { - assert_eq!(a, __m128i(1, 2)); - a.clone() - } - - #[target_feature(enable = "avx512bw")] - unsafe fn id_avx512_256(a: __m256i) -> __m256i { - assert_eq!(a, __m256i(3, 4, 5, 6)); - a.clone() - } - - #[target_feature(enable = "avx512bw")] - unsafe fn id_avx512_512(a: __m512i) -> __m512i { - assert_eq!(a, __m512i(7, 8, 9, 10, 11, 12, 13, 14)); - a.clone() - } -} - -#[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))] -mod test { - pub fn main(level: &str) {} -} diff --git a/src/test/ui/run-pass/simd/simd-type.rs b/src/test/ui/run-pass/simd/simd-type.rs deleted file mode 100644 index a1a655eec86..00000000000 --- a/src/test/ui/run-pass/simd/simd-type.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -#![feature(repr_simd)] - -#[repr(simd)] -struct RGBA { - r: f32, - g: f32, - b: f32, - a: f32 -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/simd/simd-upgraded.rs b/src/test/ui/run-pass/simd/simd-upgraded.rs deleted file mode 100644 index e255c4d47a7..00000000000 --- a/src/test/ui/run-pass/simd/simd-upgraded.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] -#![allow(non_camel_case_types)] - -// Test that removed LLVM SIMD intrinsics continue -// to work via the "AutoUpgrade" mechanism. - -#![feature(cfg_target_feature, repr_simd)] -#![feature(platform_intrinsics, stmt_expr_attributes)] - -#[repr(simd)] -#[derive(PartialEq, Debug)] -struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16); - -fn main() { - #[cfg(target_feature = "sse2")] unsafe { - extern "platform-intrinsic" { - fn x86_mm_min_epi16(x: i16x8, y: i16x8) -> i16x8; - } - assert_eq!(x86_mm_min_epi16(i16x8(0, 1, 2, 3, 4, 5, 6, 7), - i16x8(7, 6, 5, 4, 3, 2, 1, 0)), - i16x8(0, 1, 2, 3, 3, 2, 1, 0)); - }; -} diff --git a/src/test/ui/run-pass/specialization/README.md b/src/test/ui/run-pass/specialization/README.md deleted file mode 100644 index 1373a2cf81b..00000000000 --- a/src/test/ui/run-pass/specialization/README.md +++ /dev/null @@ -1,37 +0,0 @@ -Tests that specialization is working correctly: - -- Dispatch - - [On methods](specialization-basics.rs), includes: - - Specialization via adding a trait bound - - Including both remote and local traits - - Specialization via pure structure (e.g. `(T, U)` vs `(T, T)`) - - Specialization via concrete types vs unknown types - - In top level of the trait reference - - Embedded within another type (`Vec` vs `Vec`) - - [Specialization based on super trait relationships](specialization-super-traits.rs) - - [On assoc fns](specialization-assoc-fns.rs) - - [Ensure that impl order doesn't matter](specialization-out-of-order.rs) - -- Item inheritance - - [Correct default cascading for methods](specialization-default-methods.rs) - - Inheritance works across impls with varying generics - - [With projections](specialization-translate-projections.rs) - - [With projections that involve input types](specialization-translate-projections-with-params.rs) - -- Normalization issues - - [Non-default assoc types can be projected](specialization-projection.rs) - - Including non-specialized cases - - Including specialized cases - - [Specialized Impls can happen on projections](specialization-on-projection.rs) - - [Projections and aliases play well together](specialization-projection-alias.rs) - - [Projections involving specialization allowed in the trait ref for impls, and overlap can still be determined](specialization-overlap-projection.rs) - - Only works for the simple case where the most specialized impl directly - provides a non-`default` associated type - -- Across crates - - [For traits defined in upstream crate](specialization-allowed-cross-crate.rs) - - [Full method dispatch tests, drawing from upstream crate](specialization-cross-crate.rs) - - Including *additional* local specializations - - [Full method dispatch tests, *without* turning on specialization in local crate](specialization-cross-crate-no-gate.rs) - - [Test that defaults cascade correctly from upstream crates](specialization-cross-crate-defaults.rs) - - Including *additional* local use of defaults diff --git a/src/test/ui/run-pass/specialization/assoc-ty-graph-cycle.rs b/src/test/ui/run-pass/specialization/assoc-ty-graph-cycle.rs deleted file mode 100644 index f484e98640f..00000000000 --- a/src/test/ui/run-pass/specialization/assoc-ty-graph-cycle.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Make sure we don't crash with a cycle error during coherence. - -#![feature(specialization)] - -trait Trait { - type Assoc; -} - -impl Trait for Vec { - default type Assoc = (); -} - -impl Trait for Vec { - type Assoc = u8; -} - -impl Trait for String { - type Assoc = (); -} - -impl Trait< as Trait>::Assoc> for String {} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/auxiliary/cross_crates_defaults.rs b/src/test/ui/run-pass/specialization/auxiliary/cross_crates_defaults.rs deleted file mode 100644 index b62d80b589f..00000000000 --- a/src/test/ui/run-pass/specialization/auxiliary/cross_crates_defaults.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -#![feature(specialization)] - -// First, test only use of explicit `default` items: - -pub trait Foo { - fn foo(&self) -> bool; -} - -impl Foo for T { - default fn foo(&self) -> bool { false } -} - -impl Foo for i32 {} - -impl Foo for i64 { - fn foo(&self) -> bool { true } -} - -// Next, test mixture of explicit `default` and provided methods: - -pub trait Bar { - fn bar(&self) -> i32 { 0 } -} - -impl Bar for T {} // use the provided method - -impl Bar for i32 { - fn bar(&self) -> i32 { 1 } -} -impl<'a> Bar for &'a str {} - -impl Bar for Vec { - default fn bar(&self) -> i32 { 2 } -} -impl Bar for Vec {} -impl Bar for Vec { - fn bar(&self) -> i32 { 3 } -} diff --git a/src/test/ui/run-pass/specialization/auxiliary/go_trait.rs b/src/test/ui/run-pass/specialization/auxiliary/go_trait.rs deleted file mode 100644 index 044bb606b40..00000000000 --- a/src/test/ui/run-pass/specialization/auxiliary/go_trait.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(specialization)] - -// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. - -pub trait Go { - fn go(&self, arg: isize); -} - -pub fn go(this: &G, arg: isize) { - this.go(arg) -} - -pub trait GoMut { - fn go_mut(&mut self, arg: isize); -} - -pub fn go_mut(this: &mut G, arg: isize) { - this.go_mut(arg) -} - -pub trait GoOnce { - fn go_once(self, arg: isize); -} - -pub fn go_once(this: G, arg: isize) { - this.go_once(arg) -} - -impl GoMut for G - where G : Go -{ - default fn go_mut(&mut self, arg: isize) { - go(&*self, arg) - } -} - -impl GoOnce for G - where G : GoMut -{ - default fn go_once(mut self, arg: isize) { - go_mut(&mut self, arg) - } -} diff --git a/src/test/ui/run-pass/specialization/auxiliary/specialization_cross_crate.rs b/src/test/ui/run-pass/specialization/auxiliary/specialization_cross_crate.rs deleted file mode 100644 index 1d235336de8..00000000000 --- a/src/test/ui/run-pass/specialization/auxiliary/specialization_cross_crate.rs +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(specialization)] - -pub trait Foo { - fn foo(&self) -> &'static str; -} - -impl Foo for T { - default fn foo(&self) -> &'static str { - "generic" - } -} - -impl Foo for T { - default fn foo(&self) -> &'static str { - "generic Clone" - } -} - -impl Foo for (T, U) where T: Clone, U: Clone { - default fn foo(&self) -> &'static str { - "generic pair" - } -} - -impl Foo for (T, T) { - default fn foo(&self) -> &'static str { - "generic uniform pair" - } -} - -impl Foo for (u8, u32) { - default fn foo(&self) -> &'static str { - "(u8, u32)" - } -} - -impl Foo for (u8, u8) { - default fn foo(&self) -> &'static str { - "(u8, u8)" - } -} - -impl Foo for Vec { - default fn foo(&self) -> &'static str { - "generic Vec" - } -} - -impl Foo for Vec { - fn foo(&self) -> &'static str { - "Vec" - } -} - -impl Foo for String { - fn foo(&self) -> &'static str { - "String" - } -} - -impl Foo for i32 { - fn foo(&self) -> &'static str { - "i32" - } -} - -pub trait MyMarker {} -impl Foo for T { - default fn foo(&self) -> &'static str { - "generic Clone + MyMarker" - } -} diff --git a/src/test/ui/run-pass/specialization/cross-crate-defaults.rs b/src/test/ui/run-pass/specialization/cross-crate-defaults.rs deleted file mode 100644 index ee978755cbd..00000000000 --- a/src/test/ui/run-pass/specialization/cross-crate-defaults.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:cross_crates_defaults.rs - -#![feature(specialization)] - -extern crate cross_crates_defaults; - -use cross_crates_defaults::*; - -struct LocalDefault; -struct LocalOverride; - -impl Foo for LocalDefault {} - -impl Foo for LocalOverride { - fn foo(&self) -> bool { true } -} - -fn test_foo() { - assert!(!0i8.foo()); - assert!(!0i32.foo()); - assert!(0i64.foo()); - - assert!(!LocalDefault.foo()); - assert!(LocalOverride.foo()); -} - -fn test_bar() { - assert!(0u8.bar() == 0); - assert!(0i32.bar() == 1); - assert!("hello".bar() == 0); - assert!(vec![()].bar() == 2); - assert!(vec![0i32].bar() == 2); - assert!(vec![0i64].bar() == 3); -} - -fn main() { - test_foo(); - test_bar(); -} diff --git a/src/test/ui/run-pass/specialization/defaultimpl/allowed-cross-crate.rs b/src/test/ui/run-pass/specialization/defaultimpl/allowed-cross-crate.rs deleted file mode 100644 index 4a481beffd2..00000000000 --- a/src/test/ui/run-pass/specialization/defaultimpl/allowed-cross-crate.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:go_trait.rs - -#![feature(specialization)] - -extern crate go_trait; - -use go_trait::{Go,GoMut}; -use std::fmt::Debug; -use std::default::Default; - -struct MyThingy; - -impl Go for MyThingy { - fn go(&self, arg: isize) { } -} - -impl GoMut for MyThingy { - fn go_mut(&mut self, arg: isize) { } -} - -fn main() { } diff --git a/src/test/ui/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs b/src/test/ui/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs deleted file mode 100644 index dd060f8ef40..00000000000 --- a/src/test/ui/run-pass/specialization/defaultimpl/auxiliary/go_trait.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(specialization)] - -// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. - -pub trait Go { - fn go(&self, arg: isize); -} - -pub fn go(this: &G, arg: isize) { - this.go(arg) -} - -pub trait GoMut { - fn go_mut(&mut self, arg: isize); -} - -pub fn go_mut(this: &mut G, arg: isize) { - this.go_mut(arg) -} - -pub trait GoOnce { - fn go_once(self, arg: isize); -} - -pub fn go_once(this: G, arg: isize) { - this.go_once(arg) -} - -default impl GoMut for G - where G : Go -{ - fn go_mut(&mut self, arg: isize) { - go(&*self, arg) - } -} - -default impl GoOnce for G - where G : GoMut -{ - fn go_once(mut self, arg: isize) { - go_mut(&mut self, arg) - } -} diff --git a/src/test/ui/run-pass/specialization/defaultimpl/out-of-order.rs b/src/test/ui/run-pass/specialization/defaultimpl/out-of-order.rs deleted file mode 100644 index e78b0657944..00000000000 --- a/src/test/ui/run-pass/specialization/defaultimpl/out-of-order.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that you can list the more specific impl before the more general one. - -#![feature(specialization)] - -trait Foo { - type Out; -} - -impl Foo for bool { - type Out = (); -} - -default impl Foo for T { - type Out = bool; -} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/defaultimpl/overlap-projection.rs b/src/test/ui/run-pass/specialization/defaultimpl/overlap-projection.rs deleted file mode 100644 index 00381bb09c9..00000000000 --- a/src/test/ui/run-pass/specialization/defaultimpl/overlap-projection.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that impls on projected self types can resolve overlap, even when the -// projections involve specialization, so long as the associated type is -// provided by the most specialized impl. - -#![feature(specialization)] - -trait Assoc { - type Output; -} - -default impl Assoc for T { - type Output = bool; -} - -impl Assoc for u8 { type Output = u8; } -impl Assoc for u16 { type Output = u16; } - -trait Foo {} -impl Foo for u32 {} -impl Foo for ::Output {} -impl Foo for ::Output {} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/defaultimpl/projection.rs b/src/test/ui/run-pass/specialization/defaultimpl/projection.rs deleted file mode 100644 index 989f4f286f2..00000000000 --- a/src/test/ui/run-pass/specialization/defaultimpl/projection.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Make sure we *can* project non-defaulted associated types -// cf compile-fail/specialization-default-projection.rs - -// First, do so without any use of specialization - -trait Foo { - type Assoc; -} - -impl Foo for T { - type Assoc = (); -} - -fn generic_foo() -> ::Assoc { - () -} - -// Next, allow for one layer of specialization - -trait Bar { - type Assoc; -} - -default impl Bar for T { - type Assoc = (); -} - -impl Bar for T { - type Assoc = u8; -} - -fn generic_bar_clone() -> ::Assoc { - 0u8 -} - -fn main() { -} diff --git a/src/test/ui/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs b/src/test/ui/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs deleted file mode 100644 index 440b8d748a4..00000000000 --- a/src/test/ui/run-pass/specialization/defaultimpl/specialization-trait-item-not-implemented.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Tests that we can combine a default impl that supplies one method with a -// full impl that supplies the other, and they can invoke one another. - -#![feature(specialization)] - -trait Foo { - fn foo_one(&self) -> &'static str; - fn foo_two(&self) -> &'static str; - fn foo_three(&self) -> &'static str; -} - -struct MyStruct; - -default impl Foo for T { - fn foo_one(&self) -> &'static str { - self.foo_three() - } -} - -impl Foo for MyStruct { - fn foo_two(&self) -> &'static str { - self.foo_one() - } - - fn foo_three(&self) -> &'static str { - "generic" - } -} - -fn main() { - assert!(MyStruct.foo_two() == "generic"); -} diff --git a/src/test/ui/run-pass/specialization/specialization-allowed-cross-crate.rs b/src/test/ui/run-pass/specialization/specialization-allowed-cross-crate.rs deleted file mode 100644 index 4a481beffd2..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-allowed-cross-crate.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:go_trait.rs - -#![feature(specialization)] - -extern crate go_trait; - -use go_trait::{Go,GoMut}; -use std::fmt::Debug; -use std::default::Default; - -struct MyThingy; - -impl Go for MyThingy { - fn go(&self, arg: isize) { } -} - -impl GoMut for MyThingy { - fn go_mut(&mut self, arg: isize) { } -} - -fn main() { } diff --git a/src/test/ui/run-pass/specialization/specialization-assoc-fns.rs b/src/test/ui/run-pass/specialization/specialization-assoc-fns.rs deleted file mode 100644 index e6db162a70b..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-assoc-fns.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that non-method associated functions can be specialized - -#![feature(specialization)] - -trait Foo { - fn mk() -> Self; -} - -impl Foo for T { - default fn mk() -> T { - T::default() - } -} - -impl Foo for Vec { - fn mk() -> Vec { - vec![0] - } -} - -fn main() { - let v1: Vec = Foo::mk(); - let v2: Vec = Foo::mk(); - - assert!(v1.len() == 0); - assert!(v2.len() == 1); -} diff --git a/src/test/ui/run-pass/specialization/specialization-basics.rs b/src/test/ui/run-pass/specialization/specialization-basics.rs deleted file mode 100644 index 7638b91c3bc..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-basics.rs +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Tests a variety of basic specialization scenarios and method -// dispatch for them. - -trait Foo { - fn foo(&self) -> &'static str; -} - -impl Foo for T { - default fn foo(&self) -> &'static str { - "generic" - } -} - -impl Foo for T { - default fn foo(&self) -> &'static str { - "generic Clone" - } -} - -impl Foo for (T, U) where T: Clone, U: Clone { - default fn foo(&self) -> &'static str { - "generic pair" - } -} - -impl Foo for (T, T) { - default fn foo(&self) -> &'static str { - "generic uniform pair" - } -} - -impl Foo for (u8, u32) { - default fn foo(&self) -> &'static str { - "(u8, u32)" - } -} - -impl Foo for (u8, u8) { - default fn foo(&self) -> &'static str { - "(u8, u8)" - } -} - -impl Foo for Vec { - default fn foo(&self) -> &'static str { - "generic Vec" - } -} - -impl Foo for Vec { - fn foo(&self) -> &'static str { - "Vec" - } -} - -impl Foo for String { - fn foo(&self) -> &'static str { - "String" - } -} - -impl Foo for i32 { - fn foo(&self) -> &'static str { - "i32" - } -} - -struct NotClone; - -trait MyMarker {} -impl Foo for T { - default fn foo(&self) -> &'static str { - "generic Clone + MyMarker" - } -} - -#[derive(Clone)] -struct MarkedAndClone; -impl MyMarker for MarkedAndClone {} - -fn main() { - assert!(NotClone.foo() == "generic"); - assert!(0u8.foo() == "generic Clone"); - assert!(vec![NotClone].foo() == "generic"); - assert!(vec![0u8].foo() == "generic Vec"); - assert!(vec![0i32].foo() == "Vec"); - assert!(0i32.foo() == "i32"); - assert!(String::new().foo() == "String"); - assert!(((), 0).foo() == "generic pair"); - assert!(((), ()).foo() == "generic uniform pair"); - assert!((0u8, 0u32).foo() == "(u8, u32)"); - assert!((0u8, 0u8).foo() == "(u8, u8)"); - assert!(MarkedAndClone.foo() == "generic Clone + MyMarker"); -} diff --git a/src/test/ui/run-pass/specialization/specialization-cross-crate-no-gate.rs b/src/test/ui/run-pass/specialization/specialization-cross-crate-no-gate.rs deleted file mode 100644 index 0427a9a429a..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-cross-crate-no-gate.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that specialization works even if only the upstream crate enables it - -// aux-build:specialization_cross_crate.rs - -extern crate specialization_cross_crate; - -use specialization_cross_crate::*; - -fn main() { - assert!(0u8.foo() == "generic Clone"); - assert!(vec![0u8].foo() == "generic Vec"); - assert!(vec![0i32].foo() == "Vec"); - assert!(0i32.foo() == "i32"); - assert!(String::new().foo() == "String"); - assert!(((), 0).foo() == "generic pair"); - assert!(((), ()).foo() == "generic uniform pair"); - assert!((0u8, 0u32).foo() == "(u8, u32)"); - assert!((0u8, 0u8).foo() == "(u8, u8)"); -} diff --git a/src/test/ui/run-pass/specialization/specialization-cross-crate.rs b/src/test/ui/run-pass/specialization/specialization-cross-crate.rs deleted file mode 100644 index 9520c0c0d61..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-cross-crate.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:specialization_cross_crate.rs - -#![feature(specialization)] - -extern crate specialization_cross_crate; - -use specialization_cross_crate::*; - -struct NotClone; - -#[derive(Clone)] -struct MarkedAndClone; -impl MyMarker for MarkedAndClone {} - -struct MyType(T); -impl Foo for MyType { - default fn foo(&self) -> &'static str { - "generic MyType" - } -} - -impl Foo for MyType { - fn foo(&self) -> &'static str { - "MyType" - } -} - -struct MyOtherType; -impl Foo for MyOtherType {} - -fn main() { - assert!(NotClone.foo() == "generic"); - assert!(0u8.foo() == "generic Clone"); - assert!(vec![NotClone].foo() == "generic"); - assert!(vec![0u8].foo() == "generic Vec"); - assert!(vec![0i32].foo() == "Vec"); - assert!(0i32.foo() == "i32"); - assert!(String::new().foo() == "String"); - assert!(((), 0).foo() == "generic pair"); - assert!(((), ()).foo() == "generic uniform pair"); - assert!((0u8, 0u32).foo() == "(u8, u32)"); - assert!((0u8, 0u8).foo() == "(u8, u8)"); - assert!(MarkedAndClone.foo() == "generic Clone + MyMarker"); - - assert!(MyType(()).foo() == "generic MyType"); - assert!(MyType(0u8).foo() == "MyType"); - assert!(MyOtherType.foo() == "generic"); -} diff --git a/src/test/ui/run-pass/specialization/specialization-default-methods.rs b/src/test/ui/run-pass/specialization/specialization-default-methods.rs deleted file mode 100644 index e384687f866..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-default-methods.rs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Test that default methods are cascaded correctly - -// First, test only use of explicit `default` items: - -trait Foo { - fn foo(&self) -> bool; -} - -// Specialization tree for Foo: -// -// T -// / \ -// i32 i64 - -impl Foo for T { - default fn foo(&self) -> bool { false } -} - -impl Foo for i32 {} - -impl Foo for i64 { - fn foo(&self) -> bool { true } -} - -fn test_foo() { - assert!(!0i8.foo()); - assert!(!0i32.foo()); - assert!(0i64.foo()); -} - -// Next, test mixture of explicit `default` and provided methods: - -trait Bar { - fn bar(&self) -> i32 { 0 } -} - -// Specialization tree for Bar. -// Uses of $ designate that method is provided -// -// $Bar (the trait) -// | -// T -// /|\ -// / | \ -// / | \ -// / | \ -// / | \ -// / | \ -// $i32 &str $Vec -// /\ -// / \ -// Vec $Vec - -// use the provided method -impl Bar for T {} - -impl Bar for i32 { - fn bar(&self) -> i32 { 1 } -} -impl<'a> Bar for &'a str {} - -impl Bar for Vec { - default fn bar(&self) -> i32 { 2 } -} -impl Bar for Vec {} -impl Bar for Vec { - fn bar(&self) -> i32 { 3 } -} - -fn test_bar() { - assert!(0u8.bar() == 0); - assert!(0i32.bar() == 1); - assert!("hello".bar() == 0); - assert!(vec![()].bar() == 2); - assert!(vec![0i32].bar() == 2); - assert!(vec![0i64].bar() == 3); -} - -fn main() { - test_foo(); - test_bar(); -} diff --git a/src/test/ui/run-pass/specialization/specialization-on-projection.rs b/src/test/ui/run-pass/specialization/specialization-on-projection.rs deleted file mode 100644 index 39af761fd48..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-on-projection.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Ensure that specialization works for impls defined directly on a projection - -trait Foo {} - -trait Assoc { - type Item; -} - -impl Foo for T {} - -struct Struct; - -impl Assoc for Struct { - type Item = u8; -} - -impl Foo for Struct {} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/specialization-out-of-order.rs b/src/test/ui/run-pass/specialization/specialization-out-of-order.rs deleted file mode 100644 index 1bc2a5f9af7..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-out-of-order.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that you can list the more specific impl before the more general one. - -#![feature(specialization)] - -trait Foo { - type Out; -} - -impl Foo for bool { - type Out = (); -} - -impl Foo for T { - default type Out = bool; -} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/specialization-overlap-projection.rs b/src/test/ui/run-pass/specialization/specialization-overlap-projection.rs deleted file mode 100644 index 4223f8144c1..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-overlap-projection.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Test that impls on projected self types can resolve overlap, even when the -// projections involve specialization, so long as the associated type is -// provided by the most specialized impl. - -#![feature(specialization)] - -trait Assoc { - type Output; -} - -impl Assoc for T { - default type Output = bool; -} - -impl Assoc for u8 { type Output = u8; } -impl Assoc for u16 { type Output = u16; } - -trait Foo {} -impl Foo for u32 {} -impl Foo for ::Output {} -impl Foo for ::Output {} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/specialization-projection-alias.rs b/src/test/ui/run-pass/specialization/specialization-projection-alias.rs deleted file mode 100644 index f2f10765344..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-projection-alias.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Regression test for ICE when combining specialized associated types and type -// aliases - -trait Id_ { - type Out; -} - -type Id = ::Out; - -impl Id_ for T { - default type Out = T; -} - -fn test_proection() { - let x: Id = panic!(); -} - -fn main() { - -} diff --git a/src/test/ui/run-pass/specialization/specialization-projection.rs b/src/test/ui/run-pass/specialization/specialization-projection.rs deleted file mode 100644 index 2bed94ccbc1..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-projection.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Make sure we *can* project non-defaulted associated types -// cf compile-fail/specialization-default-projection.rs - -// First, do so without any use of specialization - -trait Foo { - type Assoc; -} - -impl Foo for T { - type Assoc = (); -} - -fn generic_foo() -> ::Assoc { - () -} - -// Next, allow for one layer of specialization - -trait Bar { - type Assoc; -} - -impl Bar for T { - default type Assoc = (); -} - -impl Bar for T { - type Assoc = u8; -} - -fn generic_bar_clone() -> ::Assoc { - 0u8 -} - -fn main() { -} diff --git a/src/test/ui/run-pass/specialization/specialization-super-traits.rs b/src/test/ui/run-pass/specialization/specialization-super-traits.rs deleted file mode 100644 index d7c340f890d..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-super-traits.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -// Test that you can specialize via an explicit trait hierarchy - -// FIXME: this doesn't work yet... - -trait Parent {} -trait Child: Parent {} - -trait Foo {} - -impl Foo for T {} -impl Foo for T {} - -fn main() {} diff --git a/src/test/ui/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs b/src/test/ui/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs deleted file mode 100644 index 1ead57e8adc..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-translate-projections-with-lifetimes.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(specialization)] - -trait Iterator { - fn next(&self); -} - -trait WithAssoc { - type Item; -} - -impl<'a> WithAssoc for &'a () { - type Item = &'a u32; -} - -struct Cloned(I); - -impl<'a, I, T: 'a> Iterator for Cloned - where I: WithAssoc, T: Clone -{ - fn next(&self) {} -} - -impl<'a, I, T: 'a> Iterator for Cloned - where I: WithAssoc, T: Copy -{ - -} - -fn main() { - Cloned(&()).next(); -} diff --git a/src/test/ui/run-pass/specialization/specialization-translate-projections-with-params.rs b/src/test/ui/run-pass/specialization/specialization-translate-projections-with-params.rs deleted file mode 100644 index ba823c43557..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-translate-projections-with-params.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Ensure that provided items are inherited properly even when impls vary in -// type parameters *and* rely on projections, and the type parameters are input -// types on the trait. - -#![feature(specialization)] - -trait Trait { - fn convert(&self) -> T; -} -trait WithAssoc { - type Item; - fn as_item(&self) -> &Self::Item; -} - -impl Trait for T where T: WithAssoc, U: Clone { - fn convert(&self) -> U { - self.as_item().clone() - } -} - -impl WithAssoc for u8 { - type Item = u8; - fn as_item(&self) -> &u8 { self } -} - -impl Trait for u8 {} - -fn main() { - assert!(3u8.convert() == 3u8); -} diff --git a/src/test/ui/run-pass/specialization/specialization-translate-projections.rs b/src/test/ui/run-pass/specialization/specialization-translate-projections.rs deleted file mode 100644 index 796485017c5..00000000000 --- a/src/test/ui/run-pass/specialization/specialization-translate-projections.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// Ensure that provided items are inherited properly even when impls vary in -// type parameters *and* rely on projections. - -#![feature(specialization)] - -use std::convert::Into; - -trait Trait { - fn to_u8(&self) -> u8; -} -trait WithAssoc { - type Item; - fn to_item(&self) -> Self::Item; -} - -impl Trait for T where T: WithAssoc, U: Into { - fn to_u8(&self) -> u8 { - self.to_item().into() - } -} - -impl WithAssoc for u8 { - type Item = u8; - fn to_item(&self) -> u8 { *self } -} - -impl Trait for u8 {} - -fn main() { - assert!(3u8.to_u8() == 3u8); -} diff --git a/src/test/ui/run-pass/statics/auxiliary/static-function-pointer-aux.rs b/src/test/ui/run-pass/statics/auxiliary/static-function-pointer-aux.rs deleted file mode 100644 index 2ccdb4e0864..00000000000 --- a/src/test/ui/run-pass/statics/auxiliary/static-function-pointer-aux.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub fn f(x: isize) -> isize { -x } - -pub static F: fn(isize) -> isize = f; -pub static mut MutF: fn(isize) -> isize = f; diff --git a/src/test/ui/run-pass/statics/auxiliary/static-methods-crate.rs b/src/test/ui/run-pass/statics/auxiliary/static-methods-crate.rs deleted file mode 100644 index b8fd59bf703..00000000000 --- a/src/test/ui/run-pass/statics/auxiliary/static-methods-crate.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="static_methods_crate"] -#![crate_type = "lib"] - -pub trait read: Sized { - fn readMaybe(s: String) -> Option; -} - -impl read for isize { - fn readMaybe(s: String) -> Option { - s.parse().ok() - } -} - -impl read for bool { - fn readMaybe(s: String) -> Option { - match &*s { - "true" => Some(true), - "false" => Some(false), - _ => None - } - } -} - -pub fn read(s: String) -> T { - match read::readMaybe(s) { - Some(x) => x, - _ => panic!("read panicked!") - } -} diff --git a/src/test/ui/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs b/src/test/ui/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs deleted file mode 100644 index 2193e12bceb..00000000000 --- a/src/test/ui/run-pass/statics/auxiliary/static_fn_inline_xc_aux.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub mod num { - pub trait Num2 { - fn from_int2(n: isize) -> Self; - } -} - -pub mod f64 { - impl ::num::Num2 for f64 { - #[inline] - fn from_int2(n: isize) -> f64 { return n as f64; } - } -} diff --git a/src/test/ui/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs b/src/test/ui/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs deleted file mode 100644 index 44e875fbe3c..00000000000 --- a/src/test/ui/run-pass/statics/auxiliary/static_fn_trait_xc_aux.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod num { - pub trait Num2 { - fn from_int2(n: isize) -> Self; - } -} - -pub mod f64 { - impl ::num::Num2 for f64 { - fn from_int2(n: isize) -> f64 { return n as f64; } - } -} diff --git a/src/test/ui/run-pass/statics/auxiliary/static_mut_xc.rs b/src/test/ui/run-pass/statics/auxiliary/static_mut_xc.rs deleted file mode 100644 index 9d677e3dc46..00000000000 --- a/src/test/ui/run-pass/statics/auxiliary/static_mut_xc.rs +++ /dev/null @@ -1,11 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub static mut a: isize = 3; diff --git a/src/test/ui/run-pass/statics/static-fn-inline-xc.rs b/src/test/ui/run-pass/statics/static-fn-inline-xc.rs deleted file mode 100644 index a30c3dba3c3..00000000000 --- a/src/test/ui/run-pass/statics/static-fn-inline-xc.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:static_fn_inline_xc_aux.rs - -// pretty-expanded FIXME #23616 - -extern crate static_fn_inline_xc_aux as mycore; - -use mycore::num; - -pub fn main() { - let _1: f64 = num::Num2::from_int2(1); -} diff --git a/src/test/ui/run-pass/statics/static-fn-trait-xc.rs b/src/test/ui/run-pass/statics/static-fn-trait-xc.rs deleted file mode 100644 index da6108c7852..00000000000 --- a/src/test/ui/run-pass/statics/static-fn-trait-xc.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:static_fn_trait_xc_aux.rs - -// pretty-expanded FIXME #23616 - -extern crate static_fn_trait_xc_aux as mycore; - -use mycore::num; - -pub fn main() { - let _1: f64 = num::Num2::from_int2(1); -} diff --git a/src/test/ui/run-pass/statics/static-function-pointer-xc.rs b/src/test/ui/run-pass/statics/static-function-pointer-xc.rs deleted file mode 100644 index 19231ca5134..00000000000 --- a/src/test/ui/run-pass/statics/static-function-pointer-xc.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:static-function-pointer-aux.rs - -extern crate static_function_pointer_aux as aux; - -fn f(x: isize) -> isize { x } - -pub fn main() { - assert_eq!(aux::F(42), -42); - unsafe { - assert_eq!(aux::MutF(42), -42); - aux::MutF = f; - assert_eq!(aux::MutF(42), 42); - aux::MutF = aux::f; - assert_eq!(aux::MutF(42), -42); - } -} diff --git a/src/test/ui/run-pass/statics/static-function-pointer.rs b/src/test/ui/run-pass/statics/static-function-pointer.rs deleted file mode 100644 index e923ee7308e..00000000000 --- a/src/test/ui/run-pass/statics/static-function-pointer.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -fn f(x: isize) -> isize { x } -fn g(x: isize) -> isize { 2 * x } - -static F: fn(isize) -> isize = f; -static mut G: fn(isize) -> isize = f; - -pub fn main() { - assert_eq!(F(42), 42); - unsafe { - assert_eq!(G(42), 42); - G = g; - assert_eq!(G(42), 84); - } -} diff --git a/src/test/ui/run-pass/statics/static-impl.rs b/src/test/ui/run-pass/statics/static-impl.rs deleted file mode 100644 index b1cbd5de0b9..00000000000 --- a/src/test/ui/run-pass/statics/static-impl.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - - -pub trait plus { - fn plus(&self) -> isize; -} - -mod a { - use plus; - impl plus for usize { fn plus(&self) -> isize { *self as isize + 20 } } -} - -mod b { - use plus; - impl plus for String { fn plus(&self) -> isize { 200 } } -} - -trait uint_utils { - fn str(&self) -> String; - fn multi(&self, f: F) where F: FnMut(usize); -} - -impl uint_utils for usize { - fn str(&self) -> String { - self.to_string() - } - fn multi(&self, mut f: F) where F: FnMut(usize) { - let mut c = 0_usize; - while c < *self { f(c); c += 1_usize; } - } -} - -trait vec_utils { - fn length_(&self, ) -> usize; - fn iter_(&self, f: F) where F: FnMut(&T); - fn map_(&self, f: F) -> Vec where F: FnMut(&T) -> U; -} - -impl vec_utils for Vec { - fn length_(&self) -> usize { self.len() } - fn iter_(&self, mut f: F) where F: FnMut(&T) { for x in self { f(x); } } - fn map_(&self, mut f: F) -> Vec where F: FnMut(&T) -> U { - let mut r = Vec::new(); - for elt in self { - r.push(f(elt)); - } - r - } -} - -pub fn main() { - assert_eq!(10_usize.plus(), 30); - assert_eq!(("hi".to_string()).plus(), 200); - - assert_eq!((vec![1]).length_().str(), "1".to_string()); - let vect = vec![3, 4].map_(|a| *a + 4); - assert_eq!(vect[0], 7); - let vect = (vec![3, 4]).map_::(|a| *a as usize + 4_usize); - assert_eq!(vect[0], 7_usize); - let mut x = 0_usize; - 10_usize.multi(|_n| x += 2_usize ); - assert_eq!(x, 20_usize); -} diff --git a/src/test/ui/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs b/src/test/ui/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs deleted file mode 100644 index e70984df37e..00000000000 --- a/src/test/ui/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Deserializer { - fn read_int(&self) -> isize; -} - -trait Deserializable { - fn deserialize(d: &D) -> Self; -} - -impl Deserializable for isize { - fn deserialize(d: &D) -> isize { - return d.read_int(); - } -} - -struct FromThinAir { dummy: () } - -impl Deserializer for FromThinAir { - fn read_int(&self) -> isize { 22 } -} - -pub fn main() { - let d = FromThinAir { dummy: () }; - let i: isize = Deserializable::deserialize(&d); - assert_eq!(i, 22); -} diff --git a/src/test/ui/run-pass/statics/static-method-xcrate.rs b/src/test/ui/run-pass/statics/static-method-xcrate.rs deleted file mode 100644 index f9bae7f3a3b..00000000000 --- a/src/test/ui/run-pass/statics/static-method-xcrate.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:static-methods-crate.rs - -extern crate static_methods_crate; - -use static_methods_crate::read; - -pub fn main() { - let result: isize = read("5".to_string()); - assert_eq!(result, 5); - assert_eq!(read::readMaybe("false".to_string()), Some(false)); - assert_eq!(read::readMaybe("foo".to_string()), None::); -} diff --git a/src/test/ui/run-pass/statics/static-methods-in-traits.rs b/src/test/ui/run-pass/statics/static-methods-in-traits.rs deleted file mode 100644 index cdf2168f7dc..00000000000 --- a/src/test/ui/run-pass/statics/static-methods-in-traits.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod a { - pub trait Foo { - fn foo() -> Self; - } - - impl Foo for isize { - fn foo() -> isize { - 3 - } - } - - impl Foo for usize { - fn foo() -> usize { - 5 - } - } -} - -pub fn main() { - let x: isize = a::Foo::foo(); - let y: usize = a::Foo::foo(); - assert_eq!(x, 3); - assert_eq!(y, 5); -} diff --git a/src/test/ui/run-pass/statics/static-methods-in-traits2.rs b/src/test/ui/run-pass/statics/static-methods-in-traits2.rs deleted file mode 100644 index 7e50cc58618..00000000000 --- a/src/test/ui/run-pass/statics/static-methods-in-traits2.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait Number: NumConv { - fn from(n: T) -> Self; -} - -impl Number for f64 { - fn from(n: T) -> f64 { n.to_float() } -} - -pub trait NumConv { - fn to_float(&self) -> f64; -} - -impl NumConv for f64 { - fn to_float(&self) -> f64 { *self } -} - -pub fn main() { - let _: f64 = Number::from(0.0f64); -} diff --git a/src/test/ui/run-pass/statics/static-mut-foreign.rs b/src/test/ui/run-pass/statics/static-mut-foreign.rs deleted file mode 100644 index d9e43ddea71..00000000000 --- a/src/test/ui/run-pass/statics/static-mut-foreign.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Constants (static variables) can be used to match in patterns, but mutable -// statics cannot. This ensures that there's some form of error if this is -// attempted. - -// ignore-wasm32-bare no libc to test ffi with - -#![feature(libc)] - -extern crate libc; - -#[link(name = "rust_test_helpers", kind = "static")] -extern { - static mut rust_dbg_static_mut: libc::c_int; - pub fn rust_dbg_static_mut_check_four(); -} - -unsafe fn static_bound(_: &'static libc::c_int) {} - -fn static_bound_set(a: &'static mut libc::c_int) { - *a = 3; -} - -unsafe fn run() { - assert_eq!(rust_dbg_static_mut, 3); - rust_dbg_static_mut = 4; - assert_eq!(rust_dbg_static_mut, 4); - rust_dbg_static_mut_check_four(); - rust_dbg_static_mut += 1; - assert_eq!(rust_dbg_static_mut, 5); - rust_dbg_static_mut *= 3; - assert_eq!(rust_dbg_static_mut, 15); - rust_dbg_static_mut = -3; - assert_eq!(rust_dbg_static_mut, -3); - static_bound(&rust_dbg_static_mut); - static_bound_set(&mut rust_dbg_static_mut); -} - -pub fn main() { - unsafe { run() } -} diff --git a/src/test/ui/run-pass/statics/static-mut-xc.rs b/src/test/ui/run-pass/statics/static-mut-xc.rs deleted file mode 100644 index 1e8f5f34ea6..00000000000 --- a/src/test/ui/run-pass/statics/static-mut-xc.rs +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Constants (static variables) can be used to match in patterns, but mutable -// statics cannot. This ensures that there's some form of error if this is -// attempted. - -// aux-build:static_mut_xc.rs - - -extern crate static_mut_xc; - -unsafe fn static_bound(_: &'static isize) {} - -fn static_bound_set(a: &'static mut isize) { - *a = 3; -} - -unsafe fn run() { - assert_eq!(static_mut_xc::a, 3); - static_mut_xc::a = 4; - assert_eq!(static_mut_xc::a, 4); - static_mut_xc::a += 1; - assert_eq!(static_mut_xc::a, 5); - static_mut_xc::a *= 3; - assert_eq!(static_mut_xc::a, 15); - static_mut_xc::a = -3; - assert_eq!(static_mut_xc::a, -3); - static_bound(&static_mut_xc::a); - static_bound_set(&mut static_mut_xc::a); -} - -pub fn main() { - unsafe { run() } -} - -pub mod inner { - pub static mut a: isize = 4; -} diff --git a/src/test/ui/run-pass/statics/static-recursive.rs b/src/test/ui/run-pass/statics/static-recursive.rs deleted file mode 100644 index 606604e5f6f..00000000000 --- a/src/test/ui/run-pass/statics/static-recursive.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -static mut S: *const u8 = unsafe { &S as *const *const u8 as *const u8 }; - -struct StaticDoubleLinked { - prev: &'static StaticDoubleLinked, - next: &'static StaticDoubleLinked, - data: i32, - head: bool -} - -static L1: StaticDoubleLinked = StaticDoubleLinked{prev: &L3, next: &L2, data: 1, head: true}; -static L2: StaticDoubleLinked = StaticDoubleLinked{prev: &L1, next: &L3, data: 2, head: false}; -static L3: StaticDoubleLinked = StaticDoubleLinked{prev: &L2, next: &L1, data: 3, head: false}; - - -pub fn main() { - unsafe { assert_eq!(S, *(S as *const *const u8)); } - - let mut test_vec = Vec::new(); - let mut cur = &L1; - loop { - test_vec.push(cur.data); - cur = cur.next; - if cur.head { break } - } - assert_eq!(&test_vec, &[1,2,3]); - - let mut test_vec = Vec::new(); - let mut cur = &L1; - loop { - cur = cur.prev; - test_vec.push(cur.data); - if cur.head { break } - } - assert_eq!(&test_vec, &[3,2,1]); -} diff --git a/src/test/ui/run-pass/structs-enums/align-struct.rs b/src/test/ui/run-pass/structs-enums/align-struct.rs deleted file mode 100644 index 122734e817a..00000000000 --- a/src/test/ui/run-pass/structs-enums/align-struct.rs +++ /dev/null @@ -1,255 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] -#![feature(repr_packed)] - -use std::mem; - -// Raising alignment -#[repr(align(16))] -#[derive(Clone, Copy, Debug)] -struct Align16(i32); - -// Lowering has no effect -#[repr(align(1))] -struct Align1(i32); - -// Multiple attributes take the max -#[repr(align(4))] -#[repr(align(16))] -#[repr(align(8))] -struct AlignMany(i32); - -// Raising alignment may not alter size. -#[repr(align(8))] -#[allow(dead_code)] -struct Align8Many { - a: i32, - b: i32, - c: i32, - d: u8, -} - -enum Enum { - #[allow(dead_code)] - A(i32), - B(Align16) -} - -// Nested alignment - use `#[repr(C)]` to suppress field reordering for sizeof test -#[repr(C)] -struct Nested { - a: i32, - b: i32, - c: Align16, - d: i8, -} - -#[repr(packed)] -struct Packed(i32); - -#[repr(align(16))] -struct AlignContainsPacked { - a: Packed, - b: Packed, -} - -#[repr(C, packed(4))] -struct Packed4C { - a: u32, - b: u64, -} - -#[repr(align(16))] -struct AlignContainsPacked4C { - a: Packed4C, - b: u64, -} - -// The align limit was originally smaller (2^15). -// Check that it works with big numbers. -#[repr(align(0x10000))] -struct AlignLarge { - stuff: [u8; 0x10000], -} - -union UnionContainsAlign { - a: Align16, - b: f32 -} - -impl Align16 { - // return aligned type - pub fn new(i: i32) -> Align16 { - Align16(i) - } - // pass aligned type - pub fn consume(a: Align16) -> i32 { - a.0 - } -} - -const CONST_ALIGN16: Align16 = Align16(7); -static STATIC_ALIGN16: Align16 = Align16(8); - -// Check the actual address is aligned -fn is_aligned_to(p: &T, align: usize) -> bool { - let addr = p as *const T as usize; - (addr & (align - 1)) == 0 -} - -pub fn main() { - // check alignment and size by type and value - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::size_of::(), 16); - - let a = Align16(7); - assert_eq!(a.0, 7); - assert_eq!(mem::align_of_val(&a), 16); - assert_eq!(mem::size_of_val(&a), 16); - - assert!(is_aligned_to(&a, 16)); - - // lowering should have no effect - assert_eq!(mem::align_of::(), 4); - assert_eq!(mem::size_of::(), 4); - let a = Align1(7); - assert_eq!(a.0, 7); - assert_eq!(mem::align_of_val(&a), 4); - assert_eq!(mem::size_of_val(&a), 4); - assert!(is_aligned_to(&a, 4)); - - // when multiple attributes are specified the max should be used - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::size_of::(), 16); - let a = AlignMany(7); - assert_eq!(a.0, 7); - assert_eq!(mem::align_of_val(&a), 16); - assert_eq!(mem::size_of_val(&a), 16); - assert!(is_aligned_to(&a, 16)); - - // raising alignment should not reduce size - assert_eq!(mem::align_of::(), 8); - assert_eq!(mem::size_of::(), 16); - let a = Align8Many { a: 1, b: 2, c: 3, d: 4 }; - assert_eq!(a.a, 1); - assert_eq!(mem::align_of_val(&a), 8); - assert_eq!(mem::size_of_val(&a), 16); - assert!(is_aligned_to(&a, 8)); - - // return type - let a = Align16::new(1); - assert_eq!(mem::align_of_val(&a), 16); - assert_eq!(mem::size_of_val(&a), 16); - assert_eq!(a.0, 1); - assert!(is_aligned_to(&a, 16)); - assert_eq!(Align16::consume(a), 1); - - // check const alignment, size and value - assert_eq!(mem::align_of_val(&CONST_ALIGN16), 16); - assert_eq!(mem::size_of_val(&CONST_ALIGN16), 16); - assert_eq!(CONST_ALIGN16.0, 7); - assert!(is_aligned_to(&CONST_ALIGN16, 16)); - - // check global static alignment, size and value - assert_eq!(mem::align_of_val(&STATIC_ALIGN16), 16); - assert_eq!(mem::size_of_val(&STATIC_ALIGN16), 16); - assert_eq!(STATIC_ALIGN16.0, 8); - assert!(is_aligned_to(&STATIC_ALIGN16, 16)); - - // Note that the size of Nested may change if struct field re-ordering is enabled - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::size_of::(), 48); - let a = Nested{ a: 1, b: 2, c: Align16(3), d: 4}; - assert_eq!(mem::align_of_val(&a), 16); - assert_eq!(mem::align_of_val(&a.b), 4); - assert_eq!(mem::align_of_val(&a.c), 16); - assert_eq!(mem::size_of_val(&a), 48); - assert!(is_aligned_to(&a, 16)); - // check the correct fields are indexed - assert_eq!(a.a, 1); - assert_eq!(a.b, 2); - assert_eq!(a.c.0, 3); - assert_eq!(a.d, 4); - - // enum should be aligned to max alignment - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::align_of_val(&Enum::B(Align16(0))), 16); - let e = Enum::B(Align16(15)); - match e { - Enum::B(ref a) => { - assert_eq!(a.0, 15); - assert_eq!(mem::align_of_val(a), 16); - assert_eq!(mem::size_of_val(a), 16); - }, - _ => () - } - assert!(is_aligned_to(&e, 16)); - - // check union alignment - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::size_of::(), 16); - let u = UnionContainsAlign { a: Align16(10) }; - unsafe { - assert_eq!(mem::align_of_val(&u.a), 16); - assert_eq!(mem::size_of_val(&u.a), 16); - assert_eq!(u.a.0, 10); - let UnionContainsAlign { a } = u; - assert_eq!(a.0, 10); - } - - // arrays of aligned elements should also be aligned - assert_eq!(mem::align_of::<[Align16;2]>(), 16); - assert_eq!(mem::size_of::<[Align16;2]>(), 32); - - let a = [Align16(0), Align16(1)]; - assert_eq!(mem::align_of_val(&a[0]), 16); - assert_eq!(mem::align_of_val(&a[1]), 16); - assert!(is_aligned_to(&a, 16)); - - // check heap value is aligned - assert_eq!(mem::align_of_val(Box::new(Align16(0)).as_ref()), 16); - - // check heap array is aligned - let a = vec!(Align16(0), Align16(1)); - assert_eq!(mem::align_of_val(&a[0]), 16); - assert_eq!(mem::align_of_val(&a[1]), 16); - - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::size_of::(), 16); - let a = AlignContainsPacked { a: Packed(1), b: Packed(2) }; - assert_eq!(mem::align_of_val(&a), 16); - assert_eq!(mem::align_of_val(&a.a), 1); - assert_eq!(mem::align_of_val(&a.b), 1); - assert_eq!(mem::size_of_val(&a), 16); - assert!(is_aligned_to(&a, 16)); - - assert_eq!(mem::align_of::(), 16); - assert_eq!(mem::size_of::(), 32); - let a = AlignContainsPacked4C { a: Packed4C{ a: 1, b: 2 }, b: 3 }; - assert_eq!(mem::align_of_val(&a), 16); - assert_eq!(mem::align_of_val(&a.a), 4); - assert_eq!(mem::align_of_val(&a.b), mem::align_of::()); - assert_eq!(mem::size_of_val(&a), 32); - assert!(is_aligned_to(&a, 16)); - - let mut large = box AlignLarge { - stuff: [0; 0x10000], - }; - large.stuff[0] = 132; - *large.stuff.last_mut().unwrap() = 102; - assert_eq!(large.stuff[0], 132); - assert_eq!(large.stuff.last(), Some(&102)); - assert_eq!(mem::align_of::(), 0x10000); - assert_eq!(mem::align_of_val(&*large), 0x10000); - assert!(is_aligned_to(&*large, 0x10000)); -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class.rs deleted file mode 100644 index 08a13fd8bcc..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod kitties { - pub struct cat { - meows : usize, - - pub how_hungry : isize, - } - - pub fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_2.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_2.rs deleted file mode 100644 index 7d147832f09..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_2.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod kitties { - pub struct cat { - meows : usize, - - pub how_hungry : isize, - - } - - impl cat { - pub fn speak(&self) {} - } - - pub fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_3.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_3.rs deleted file mode 100644 index ec1bf108dcb..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_3.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod kitties { - pub struct cat { - meows : usize, - - pub how_hungry : isize, - } - - impl cat { - pub fn speak(&mut self) { self.meows += 1; } - pub fn meow_count(&mut self) -> usize { self.meows } - } - - pub fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_4.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_4.rs deleted file mode 100644 index 300cc31632e..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_4.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod kitties { - pub struct cat { - meows : usize, - - pub how_hungry : isize, - pub name : String, - } - - impl cat { - pub fn speak(&mut self) { self.meow(); } - - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } else { - println!("Not hungry!"); - return false; - } - } - } - - impl cat { - pub fn meow(&mut self) { - println!("Meow"); - self.meows += 1; - if self.meows % 5 == 0 { - self.how_hungry += 1; - } - } - } - - pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_6.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_6.rs deleted file mode 100644 index c902a6c7dca..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_6.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod kitties { - - pub struct cat { - info : Vec , - meows : usize, - - pub how_hungry : isize, - } - - impl cat { - pub fn speak(&mut self, stuff: Vec ) { - self.meows += stuff.len(); - } - - pub fn meow_count(&mut self) -> usize { self.meows } - } - - pub fn cat(in_x : usize, in_y : isize, in_info: Vec ) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - info: in_info - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_cast.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_cast.rs deleted file mode 100644 index f54a39d61ef..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_cast.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod kitty { - use std::fmt; - - pub struct cat { - meows : usize, - pub how_hungry : isize, - pub name : String, - } - - impl fmt::Display for cat { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.name) - } - } - - impl cat { - fn meow(&mut self) { - println!("Meow"); - self.meows += 1; - if self.meows % 5 == 0 { - self.how_hungry += 1; - } - } - - } - - impl cat { - pub fn speak(&mut self) { self.meow(); } - - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } - else { - println!("Not hungry!"); - return false; - } - } - } - - pub fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_trait.rs b/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_trait.rs deleted file mode 100644 index 7ca3d7c4ac9..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/cci_class_trait.rs +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub mod animals { - pub trait noisy { - fn speak(&mut self); - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/empty-struct.rs b/src/test/ui/run-pass/structs-enums/auxiliary/empty-struct.rs deleted file mode 100644 index 734e57a774d..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/empty-struct.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct XEmpty1 {} -pub struct XEmpty2; -pub struct XEmpty7(); - -pub enum XE { - XEmpty3 {}, - XEmpty4, - XEmpty6(), -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs b/src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs deleted file mode 100644 index b7bde4a74a5..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enum_emulate_flat.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub use Foo::*; - -pub enum Foo { - A, - B(isize), - C { a: isize }, -} - -impl Foo { - pub fn foo() {} -} - -pub mod nest { - pub use self::Bar::*; - - pub enum Bar { - D, - E(isize), - F { a: isize }, - } - - impl Bar { - pub fn foo() {} - } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enums.rs b/src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enums.rs deleted file mode 100644 index 3bf39b788db..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/namespaced_enums.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub enum Foo { - A, - B(isize), - C { a: isize }, -} - -impl Foo { - pub fn foo() {} - pub fn bar(&self) {} -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs b/src/test/ui/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs deleted file mode 100644 index be3414b7ad2..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/newtype_struct_xc.rs +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub struct Au(pub isize); diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs b/src/test/ui/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs deleted file mode 100644 index 26941b726d4..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/struct_destructuring_cross_crate.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_type="lib"] - -pub struct S { - pub x: isize, - pub y: isize, -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs b/src/test/ui/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs deleted file mode 100644 index 201f028b6b6..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/struct_variant_xc_aux.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![crate_name="struct_variant_xc_aux"] -#![crate_type = "lib"] - -#[derive(Copy, Clone)] -pub enum Enum { - Variant(u8), - StructVariant { arg: u8 } -} diff --git a/src/test/ui/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs b/src/test/ui/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs deleted file mode 100644 index 334f7829bd1..00000000000 --- a/src/test/ui/run-pass/structs-enums/auxiliary/xcrate_struct_aliases.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct S { - pub x: isize, - pub y: isize, -} - -pub type S2 = S; diff --git a/src/test/ui/run-pass/structs-enums/borrow-tuple-fields.rs b/src/test/ui/run-pass/structs-enums/borrow-tuple-fields.rs deleted file mode 100644 index c7f9c481579..00000000000 --- a/src/test/ui/run-pass/structs-enums/borrow-tuple-fields.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo(isize, isize); - -fn main() { - let x = (1, 2); - let a = &x.0; - let b = &x.0; - assert_eq!(*a, 1); - assert_eq!(*b, 1); - - let mut x = (1, 2); - { - let a = &x.0; - let b = &mut x.1; - *b = 5; - assert_eq!(*a, 1); - } - assert_eq!(x.0, 1); - assert_eq!(x.1, 5); - - - let x = Foo(1, 2); - let a = &x.0; - let b = &x.0; - assert_eq!(*a, 1); - assert_eq!(*b, 1); - - let mut x = Foo(1, 2); - { - let a = &x.0; - let b = &mut x.1; - *b = 5; - assert_eq!(*a, 1); - } - assert_eq!(x.0, 1); - assert_eq!(x.1, 5); -} diff --git a/src/test/ui/run-pass/structs-enums/class-attributes-1.rs b/src/test/ui/run-pass/structs-enums/class-attributes-1.rs deleted file mode 100644 index c5926bc1586..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-attributes-1.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pp-exact - Make sure we actually print the attributes -#![feature(custom_attribute)] - -struct cat { - name: String, -} - -impl Drop for cat { - #[cat_dropper] - fn drop(&mut self) { println!("{} landed on hir feet" , self . name); } -} - - -#[cat_maker] -fn cat(name: String) -> cat { cat{name: name,} } - -pub fn main() { let _kitty = cat("Spotty".to_string()); } diff --git a/src/test/ui/run-pass/structs-enums/class-attributes-2.rs b/src/test/ui/run-pass/structs-enums/class-attributes-2.rs deleted file mode 100644 index f9d88de145a..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-attributes-2.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#![feature(custom_attribute)] - -struct cat { - name: String, -} - -impl Drop for cat { - #[cat_dropper] - /** - Actually, cats don't always land on their feet when you drop them. - */ - fn drop(&mut self) { - println!("{} landed on hir feet", self.name); - } -} - -#[cat_maker] -/** -Maybe it should technically be a kitten_maker. -*/ -fn cat(name: String) -> cat { - cat { - name: name - } -} - -pub fn main() { - let _kitty = cat("Spotty".to_string()); -} diff --git a/src/test/ui/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs b/src/test/ui/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs deleted file mode 100644 index c28244a9f90..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-cast-to-trait-cross-crate-2.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_class_cast.rs - -#![feature(box_syntax)] - -extern crate cci_class_cast; - -use std::string::ToString; -use cci_class_cast::kitty::cat; - -fn print_out(thing: Box, expected: String) { - let actual = (*thing).to_string(); - println!("{}", actual); - assert_eq!(actual.to_string(), expected); -} - -pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; - print_out(nyan, "nyan".to_string()); -} diff --git a/src/test/ui/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs b/src/test/ui/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs deleted file mode 100644 index e2efc146c4b..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-cast-to-trait-multiple-types.rs +++ /dev/null @@ -1,103 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -trait noisy { - fn speak(&mut self) -> isize; -} - -struct dog { - barks: usize, - - volume: isize, -} - -impl dog { - fn bark(&mut self) -> isize { - println!("Woof {} {}", self.barks, self.volume); - self.barks += 1_usize; - if self.barks % 3_usize == 0_usize { - self.volume += 1; - } - if self.barks % 10_usize == 0_usize { - self.volume -= 2; - } - println!("Grrr {} {}", self.barks, self.volume); - self.volume - } -} - -impl noisy for dog { - fn speak(&mut self) -> isize { - self.bark() - } -} - -fn dog() -> dog { - dog { - volume: 0, - barks: 0_usize - } -} - -#[derive(Clone)] -struct cat { - meows: usize, - - how_hungry: isize, - name: String, -} - -impl noisy for cat { - fn speak(&mut self) -> isize { - self.meow() as isize - } -} - -impl cat { - pub fn meow_count(&self) -> usize { - self.meows - } -} - -impl cat { - fn meow(&mut self) -> usize { - println!("Meow"); - self.meows += 1_usize; - if self.meows % 5_usize == 0_usize { - self.how_hungry += 1; - } - self.meows - } -} - -fn cat(in_x: usize, in_y: isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } -} - - -fn annoy_neighbors(critter: &mut noisy) { - for _i in 0_usize..10 { critter.speak(); } -} - -pub fn main() { - let mut nyan: cat = cat(0_usize, 2, "nyan".to_string()); - let mut whitefang: dog = dog(); - annoy_neighbors(&mut nyan); - annoy_neighbors(&mut whitefang); - assert_eq!(nyan.meow_count(), 10_usize); - assert_eq!(whitefang.volume, 1); -} diff --git a/src/test/ui/run-pass/structs-enums/class-cast-to-trait.rs b/src/test/ui/run-pass/structs-enums/class-cast-to-trait.rs deleted file mode 100644 index 695318d0ee7..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-cast-to-trait.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// ignore-freebsd FIXME fails on BSD - - -trait noisy { - fn speak(&mut self); -} - -struct cat { - meows: usize, - how_hungry: isize, - name: String, -} - -impl noisy for cat { - fn speak(&mut self) { self.meow(); } -} - -impl cat { - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } - else { - println!("Not hungry!"); - return false; - } - } -} - -impl cat { - fn meow(&mut self) { - println!("Meow"); - self.meows += 1; - if self.meows % 5 == 0 { - self.how_hungry += 1; - } - } -} - -fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } -} - - -pub fn main() { - let mut nyan = cat(0, 2, "nyan".to_string()); - let mut nyan: &mut noisy = &mut nyan; - nyan.speak(); -} diff --git a/src/test/ui/run-pass/structs-enums/class-dtor.rs b/src/test/ui/run-pass/structs-enums/class-dtor.rs deleted file mode 100644 index 13559906795..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-dtor.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct cat { - done : extern fn(usize), - meows : usize, -} - -impl Drop for cat { - fn drop(&mut self) { - (self.done)(self.meows); - } -} - -fn cat(done: extern fn(usize)) -> cat { - cat { - meows: 0, - done: done - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/class-exports.rs b/src/test/ui/run-pass/structs-enums/class-exports.rs deleted file mode 100644 index b4bce42e647..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-exports.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -/* Test that exporting a class also exports its - public fields and methods */ - -use kitty::cat; - -mod kitty { - pub struct cat { - meows: usize, - name: String, - } - - impl cat { - pub fn get_name(&self) -> String { self.name.clone() } - } - - pub fn cat(in_name: String) -> cat { - cat { - name: in_name, - meows: 0 - } - } -} - -pub fn main() { - assert_eq!(cat("Spreckles".to_string()).get_name(), - "Spreckles".to_string()); -} diff --git a/src/test/ui/run-pass/structs-enums/class-impl-very-parameterized-trait.rs b/src/test/ui/run-pass/structs-enums/class-impl-very-parameterized-trait.rs deleted file mode 100644 index 6ceaab93e79..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-impl-very-parameterized-trait.rs +++ /dev/null @@ -1,116 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::cmp; - -#[derive(Copy, Clone, Debug)] -enum cat_type { tuxedo, tabby, tortoiseshell } - -impl cmp::PartialEq for cat_type { - fn eq(&self, other: &cat_type) -> bool { - ((*self) as usize) == ((*other) as usize) - } - fn ne(&self, other: &cat_type) -> bool { !(*self).eq(other) } -} - -// Very silly -- this just returns the value of the name field -// for any isize value that's less than the meows field - -// ok: T should be in scope when resolving the trait ref for map -struct cat { - // Yes, you can have negative meows - meows : isize, - - how_hungry : isize, - name : T, -} - -impl cat { - pub fn speak(&mut self) { self.meow(); } - - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } else { - println!("Not hungry!"); - return false; - } - } - fn len(&self) -> usize { self.meows as usize } - fn is_empty(&self) -> bool { self.meows == 0 } - fn clear(&mut self) {} - fn contains_key(&self, k: &isize) -> bool { *k <= self.meows } - - fn find(&self, k: &isize) -> Option<&T> { - if *k <= self.meows { - Some(&self.name) - } else { - None - } - } - fn insert(&mut self, k: isize, _: T) -> bool { - self.meows += k; - true - } - - fn find_mut(&mut self, _k: &isize) -> Option<&mut T> { panic!() } - - fn remove(&mut self, k: &isize) -> bool { - if self.find(k).is_some() { - self.meows -= *k; true - } else { - false - } - } - - fn pop(&mut self, _k: &isize) -> Option { panic!() } - - fn swap(&mut self, _k: isize, _v: T) -> Option { panic!() } -} - -impl cat { - pub fn get(&self, k: &isize) -> &T { - match self.find(k) { - Some(v) => { v } - None => { panic!("epic fail"); } - } - } - - pub fn new(in_x: isize, in_y: isize, in_name: T) -> cat { - cat{meows: in_x, how_hungry: in_y, name: in_name } - } -} - -impl cat { - fn meow(&mut self) { - self.meows += 1; - println!("Meow {}", self.meows); - if self.meows % 5 == 0 { - self.how_hungry += 1; - } - } -} - -pub fn main() { - let mut nyan: cat = cat::new(0, 2, "nyan".to_string()); - for _ in 1_usize..5 { nyan.speak(); } - assert_eq!(*nyan.find(&1).unwrap(), "nyan".to_string()); - assert_eq!(nyan.find(&10), None); - let mut spotty: cat = cat::new(2, 57, cat_type::tuxedo); - for _ in 0_usize..6 { spotty.speak(); } - assert_eq!(spotty.len(), 8); - assert!((spotty.contains_key(&2))); - assert_eq!(spotty.get(&3), &cat_type::tuxedo); -} diff --git a/src/test/ui/run-pass/structs-enums/class-implement-trait-cross-crate.rs b/src/test/ui/run-pass/structs-enums/class-implement-trait-cross-crate.rs deleted file mode 100644 index 4f319cf8ea4..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-implement-trait-cross-crate.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// aux-build:cci_class_trait.rs -extern crate cci_class_trait; -use cci_class_trait::animals::noisy; - -struct cat { - meows: usize, - - how_hungry : isize, - name : String, -} - -impl cat { - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } - else { - println!("Not hungry!"); - return false; - } - } -} - -impl noisy for cat { - fn speak(&mut self) { self.meow(); } -} - -impl cat { - fn meow(&mut self) { - println!("Meow"); - self.meows += 1_usize; - if self.meows % 5_usize == 0_usize { - self.how_hungry += 1; - } - } -} - -fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } -} - - -pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); - nyan.eat(); - assert!((!nyan.eat())); - for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); -} diff --git a/src/test/ui/run-pass/structs-enums/class-implement-traits.rs b/src/test/ui/run-pass/structs-enums/class-implement-traits.rs deleted file mode 100644 index e582940c1e4..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-implement-traits.rs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -trait noisy { - fn speak(&mut self); -} - -#[derive(Clone)] -struct cat { - meows : usize, - - how_hungry : isize, - name : String, -} - -impl cat { - fn meow(&mut self) { - println!("Meow"); - self.meows += 1_usize; - if self.meows % 5_usize == 0_usize { - self.how_hungry += 1; - } - } -} - -impl cat { - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } else { - println!("Not hungry!"); - return false; - } - } -} - -impl noisy for cat { - fn speak(&mut self) { self.meow(); } -} - -fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name.clone() - } -} - - -fn make_speak(mut c: C) { - c.speak(); -} - -pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); - nyan.eat(); - assert!((!nyan.eat())); - for _ in 1_usize..10_usize { - make_speak(nyan.clone()); - } -} diff --git a/src/test/ui/run-pass/structs-enums/class-method-cross-crate.rs b/src/test/ui/run-pass/structs-enums/class-method-cross-crate.rs deleted file mode 100644 index 010f735beee..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-method-cross-crate.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_class_2.rs - -extern crate cci_class_2; -use cci_class_2::kitties::cat; - -pub fn main() { - let nyan : cat = cat(52, 99); - let kitty = cat(1000, 2); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); - nyan.speak(); -} diff --git a/src/test/ui/run-pass/structs-enums/class-methods-cross-crate.rs b/src/test/ui/run-pass/structs-enums/class-methods-cross-crate.rs deleted file mode 100644 index ca4a783b70a..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-methods-cross-crate.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_class_3.rs - -extern crate cci_class_3; -use cci_class_3::kitties::cat; - -pub fn main() { - let mut nyan : cat = cat(52, 99); - let kitty = cat(1000, 2); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); - nyan.speak(); - assert_eq!(nyan.meow_count(), 53); -} diff --git a/src/test/ui/run-pass/structs-enums/class-methods.rs b/src/test/ui/run-pass/structs-enums/class-methods.rs deleted file mode 100644 index 8cc6025dc43..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-methods.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -struct cat { - meows : usize, - - how_hungry : isize, -} - -impl cat { - pub fn speak(&mut self) { self.meows += 1; } - pub fn meow_count(&mut self) -> usize { self.meows } -} - -fn cat(in_x: usize, in_y: isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } -} - -pub fn main() { - let mut nyan: cat = cat(52, 99); - let kitty = cat(1000, 2); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); - nyan.speak(); - assert_eq!(nyan.meow_count(), 53); -} diff --git a/src/test/ui/run-pass/structs-enums/class-poly-methods-cross-crate.rs b/src/test/ui/run-pass/structs-enums/class-poly-methods-cross-crate.rs deleted file mode 100644 index 7ee98125148..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-poly-methods-cross-crate.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_class_6.rs - -extern crate cci_class_6; -use cci_class_6::kitties::cat; - -pub fn main() { - let mut nyan : cat = cat::(52_usize, 99, vec!['p']); - let mut kitty = cat(1000_usize, 2, vec!["tabby".to_string()]); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); - nyan.speak(vec![1_usize,2_usize,3_usize]); - assert_eq!(nyan.meow_count(), 55_usize); - kitty.speak(vec!["meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string()]); - assert_eq!(kitty.meow_count(), 1004_usize); -} diff --git a/src/test/ui/run-pass/structs-enums/class-poly-methods.rs b/src/test/ui/run-pass/structs-enums/class-poly-methods.rs deleted file mode 100644 index e32ba9d0239..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-poly-methods.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -struct cat { - info : Vec , - meows : usize, - - how_hungry : isize, -} - -impl cat { - pub fn speak(&mut self, stuff: Vec ) { - self.meows += stuff.len(); - } - pub fn meow_count(&mut self) -> usize { self.meows } -} - -fn cat(in_x : usize, in_y : isize, in_info: Vec ) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - info: in_info - } -} - -pub fn main() { - let mut nyan : cat = cat::(52, 99, vec![9]); - let mut kitty = cat(1000, 2, vec!["tabby".to_string()]); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); - nyan.speak(vec![1,2,3]); - assert_eq!(nyan.meow_count(), 55); - kitty.speak(vec!["meow".to_string(), "mew".to_string(), "purr".to_string(), "chirp".to_string()]); - assert_eq!(kitty.meow_count(), 1004); -} diff --git a/src/test/ui/run-pass/structs-enums/class-separate-impl.rs b/src/test/ui/run-pass/structs-enums/class-separate-impl.rs deleted file mode 100644 index a1c9afaa634..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-separate-impl.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#![feature(box_syntax)] - -use std::fmt; - -struct cat { - meows : usize, - - how_hungry : isize, - name : String, -} - -impl cat { - pub fn speak(&mut self) { self.meow(); } - - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } - else { - println!("Not hungry!"); - return false; - } - } -} - -impl cat { - fn meow(&mut self) { - println!("Meow"); - self.meows += 1; - if self.meows % 5 == 0 { - self.how_hungry += 1; - } - } -} - -fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } -} - -impl fmt::Display for cat { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "{}", self.name) - } -} - -fn print_out(thing: Box, expected: String) { - let actual = (*thing).to_string(); - println!("{}", actual); - assert_eq!(actual.to_string(), expected); -} - -pub fn main() { - let nyan: Box = box cat(0, 2, "nyan".to_string()) as Box; - print_out(nyan, "nyan".to_string()); -} diff --git a/src/test/ui/run-pass/structs-enums/class-str-field.rs b/src/test/ui/run-pass/structs-enums/class-str-field.rs deleted file mode 100644 index 5ad60dfd6d9..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-str-field.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -struct cat { - - name : String, - -} - -fn cat(in_name: String) -> cat { - cat { - name: in_name - } -} - -pub fn main() { - let _nyan = cat("nyan".to_string()); -} diff --git a/src/test/ui/run-pass/structs-enums/class-typarams.rs b/src/test/ui/run-pass/structs-enums/class-typarams.rs deleted file mode 100644 index d3b4083f843..00000000000 --- a/src/test/ui/run-pass/structs-enums/class-typarams.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -use std::marker::PhantomData; - -struct cat { - meows : usize, - how_hungry : isize, - m: PhantomData -} - -impl cat { - pub fn speak(&mut self) { self.meows += 1; } - pub fn meow_count(&mut self) -> usize { self.meows } -} - -fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - m: PhantomData - } -} - - -pub fn main() { - let _nyan : cat = cat::(52, 99); - // let mut kitty = cat(1000, 2); -} diff --git a/src/test/ui/run-pass/structs-enums/classes-cross-crate.rs b/src/test/ui/run-pass/structs-enums/classes-cross-crate.rs deleted file mode 100644 index c9cc609e8a1..00000000000 --- a/src/test/ui/run-pass/structs-enums/classes-cross-crate.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_class_4.rs - -extern crate cci_class_4; -use cci_class_4::kitties::cat; - -pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); - nyan.eat(); - assert!((!nyan.eat())); - for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); -} diff --git a/src/test/ui/run-pass/structs-enums/classes-self-referential.rs b/src/test/ui/run-pass/structs-enums/classes-self-referential.rs deleted file mode 100644 index 49016d14b9d..00000000000 --- a/src/test/ui/run-pass/structs-enums/classes-self-referential.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -// pretty-expanded FIXME #23616 - -struct kitten { - cat: Option, -} - -fn kitten(cat: Option) -> kitten { - kitten { - cat: cat - } -} - -type cat = Box; - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/classes-simple-cross-crate.rs b/src/test/ui/run-pass/structs-enums/classes-simple-cross-crate.rs deleted file mode 100644 index c90ae80036f..00000000000 --- a/src/test/ui/run-pass/structs-enums/classes-simple-cross-crate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:cci_class.rs - -extern crate cci_class; -use cci_class::kitties::cat; - -pub fn main() { - let nyan : cat = cat(52, 99); - let kitty = cat(1000, 2); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); -} diff --git a/src/test/ui/run-pass/structs-enums/classes-simple-method.rs b/src/test/ui/run-pass/structs-enums/classes-simple-method.rs deleted file mode 100644 index 6eaf8939dcc..00000000000 --- a/src/test/ui/run-pass/structs-enums/classes-simple-method.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct cat { - meows : usize, - - how_hungry : isize, -} - -impl cat { - pub fn speak(&mut self) {} -} - -fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } -} - -pub fn main() { - let mut nyan : cat = cat(52, 99); - let kitty = cat(1000, 2); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); - nyan.speak(); -} diff --git a/src/test/ui/run-pass/structs-enums/classes-simple.rs b/src/test/ui/run-pass/structs-enums/classes-simple.rs deleted file mode 100644 index 771943802aa..00000000000 --- a/src/test/ui/run-pass/structs-enums/classes-simple.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct cat { - meows : usize, - - how_hungry : isize, -} - -fn cat(in_x : usize, in_y : isize) -> cat { - cat { - meows: in_x, - how_hungry: in_y - } -} - -pub fn main() { - let nyan : cat = cat(52, 99); - let kitty = cat(1000, 2); - assert_eq!(nyan.how_hungry, 99); - assert_eq!(kitty.how_hungry, 2); -} diff --git a/src/test/ui/run-pass/structs-enums/classes.rs b/src/test/ui/run-pass/structs-enums/classes.rs deleted file mode 100644 index f40fe3e8186..00000000000 --- a/src/test/ui/run-pass/structs-enums/classes.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct cat { - meows : usize, - - how_hungry : isize, - name : String, -} - -impl cat { - pub fn speak(&mut self) { self.meow(); } - - pub fn eat(&mut self) -> bool { - if self.how_hungry > 0 { - println!("OM NOM NOM"); - self.how_hungry -= 2; - return true; - } else { - println!("Not hungry!"); - return false; - } - } -} - -impl cat { - fn meow(&mut self) { - println!("Meow"); - self.meows += 1_usize; - if self.meows % 5_usize == 0_usize { - self.how_hungry += 1; - } - } -} - -fn cat(in_x : usize, in_y : isize, in_name: String) -> cat { - cat { - meows: in_x, - how_hungry: in_y, - name: in_name - } -} - -pub fn main() { - let mut nyan = cat(0_usize, 2, "nyan".to_string()); - nyan.eat(); - assert!((!nyan.eat())); - for _ in 1_usize..10_usize { nyan.speak(); }; - assert!((nyan.eat())); -} diff --git a/src/test/ui/run-pass/structs-enums/codegen-tag-static-padding.rs b/src/test/ui/run-pass/structs-enums/codegen-tag-static-padding.rs deleted file mode 100644 index 3d75786654d..00000000000 --- a/src/test/ui/run-pass/structs-enums/codegen-tag-static-padding.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Issue #13186 - -// For simplicity of explanations assuming code is compiled for x86_64 -// Linux ABI. - -// Size of TestOption is 16, and alignment of TestOption is 8. -// Size of u8 is 1, and alignment of u8 is 1. -// So size of Request is 24, and alignment of Request must be 8: -// the maximum alignment of its fields. -// Last 7 bytes of Request struct are not occupied by any fields. - - - -enum TestOption { - TestNone, - TestSome(T), -} - -pub struct Request { - foo: TestOption, - bar: u8, -} - -fn default_instance() -> &'static Request { - static instance: Request = Request { - // LLVM does not allow to specify alignment of expressions, thus - // alignment of `foo` in constant is 1, not 8. - foo: TestOption::TestNone, - bar: 17, - // Space after last field is not occupied by any data, but it is - // reserved to make struct aligned properly. If compiler does - // not insert padding after last field when emitting constant, - // size of struct may be not equal to size of struct, and - // compiler crashes in internal assertion check. - }; - &instance -} - -fn non_default_instance() -> &'static Request { - static instance: Request = Request { - foo: TestOption::TestSome(0x1020304050607080), - bar: 19, - }; - &instance -} - -pub fn main() { - match default_instance() { - &Request { foo: TestOption::TestNone, bar: 17 } => {}, - _ => panic!(), - }; - match non_default_instance() { - &Request { foo: TestOption::TestSome(0x1020304050607080), bar: 19 } => {}, - _ => panic!(), - }; -} diff --git a/src/test/ui/run-pass/structs-enums/compare-generic-enums.rs b/src/test/ui/run-pass/structs-enums/compare-generic-enums.rs deleted file mode 100644 index 60d6cd2746b..00000000000 --- a/src/test/ui/run-pass/structs-enums/compare-generic-enums.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -type an_int = isize; - -fn cmp(x: Option, y: Option) -> bool { - x == y -} - -pub fn main() { - assert!(!cmp(Some(3), None)); - assert!(!cmp(Some(3), Some(4))); - assert!(cmp(Some(3), Some(3))); - assert!(cmp(None, None)); -} diff --git a/src/test/ui/run-pass/structs-enums/discrim-explicit-23030.rs b/src/test/ui/run-pass/structs-enums/discrim-explicit-23030.rs deleted file mode 100644 index 73053131865..00000000000 --- a/src/test/ui/run-pass/structs-enums/discrim-explicit-23030.rs +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue 23030: Workaround overflowing discriminant -// with explicit assignments. - -// See also compile-fail/overflow-discrim.rs, which shows what -// happens if you leave the OhNo explicit cases out here. - -use std::{i8,u8,i16,u16,i32,u32,i64,u64,isize,usize}; - -fn f_i8() { - #[repr(i8)] - enum A { - Ok = i8::MAX - 1, - Ok2, - OhNo = i8::MIN, - NotTheEnd = -1, - Zero, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); - let z = (A::NotTheEnd, A::Zero).1 as i8; - assert_eq!(z, 0); -} - -fn f_u8() { - #[repr(u8)] - enum A { - Ok = u8::MAX - 1, - Ok2, - OhNo = u8::MIN, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); -} - -fn f_i16() { - #[repr(i16)] - enum A { - Ok = i16::MAX - 1, - Ok2, - OhNo = i16::MIN, - NotTheEnd = -1, - Zero, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); - let z = (A::NotTheEnd, A::Zero).1 as i16; - assert_eq!(z, 0); -} - -fn f_u16() { - #[repr(u16)] - enum A { - Ok = u16::MAX - 1, - Ok2, - OhNo = u16::MIN, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); -} - -fn f_i32() { - #[repr(i32)] - enum A { - Ok = i32::MAX - 1, - Ok2, - OhNo = i32::MIN, - NotTheEnd = -1, - Zero, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); - let z = (A::NotTheEnd, A::Zero).1 as i32; - assert_eq!(z, 0); -} - -fn f_u32() { - #[repr(u32)] - enum A { - Ok = u32::MAX - 1, - Ok2, - OhNo = u32::MIN, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); -} - -fn f_i64() { - #[repr(i64)] - enum A { - Ok = i64::MAX - 1, - Ok2, - OhNo = i64::MIN, - NotTheEnd = -1, - Zero, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); - let z = (A::NotTheEnd, A::Zero).1 as i64; - assert_eq!(z, 0); -} - -fn f_u64() { - #[repr(u64)] - enum A { - Ok = u64::MAX - 1, - Ok2, - OhNo = u64::MIN, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); -} - -fn f_isize() { - #[repr(isize)] - enum A { - Ok = isize::MAX - 1, - Ok2, - OhNo = isize::MIN, - NotTheEnd = -1, - Zero, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); - let z = (A::NotTheEnd, A::Zero).1 as isize; - assert_eq!(z, 0); -} - -fn f_usize() { - #[repr(usize)] - enum A { - Ok = usize::MAX - 1, - Ok2, - OhNo = usize::MIN, - } - - let _x = (A::Ok, A::Ok2, A::OhNo); -} - -fn main() { - f_i8(); f_u8(); - f_i16(); f_u16(); - f_i32(); f_u32(); - f_i64(); f_u64(); - - f_isize(); f_usize(); -} diff --git a/src/test/ui/run-pass/structs-enums/empty-struct-braces.rs b/src/test/ui/run-pass/structs-enums/empty-struct-braces.rs deleted file mode 100644 index 7deb90cc3e8..00000000000 --- a/src/test/ui/run-pass/structs-enums/empty-struct-braces.rs +++ /dev/null @@ -1,222 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Empty struct defined with braces add names into type namespace -// Empty struct defined without braces add names into both type and value namespaces - -// aux-build:empty-struct.rs - -extern crate empty_struct; -use empty_struct::*; - -struct Empty1 {} -struct Empty2; -struct Empty7(); - -#[derive(PartialEq, Eq)] -struct Empty3 {} - -const Empty3: Empty3 = Empty3 {}; - -enum E { - Empty4 {}, - Empty5, - Empty6(), -} - -fn local() { - let e1: Empty1 = Empty1 {}; - let e2: Empty2 = Empty2 {}; - let e2: Empty2 = Empty2; - let e3: Empty3 = Empty3 {}; - let e3: Empty3 = Empty3; - let e4: E = E::Empty4 {}; - let e5: E = E::Empty5 {}; - let e5: E = E::Empty5; - let e6: E = E::Empty6 {}; - let e6: E = E::Empty6(); - let ctor6: fn() -> E = E::Empty6; - let e7: Empty7 = Empty7 {}; - let e7: Empty7 = Empty7(); - let ctor7: fn() -> Empty7 = Empty7; - - match e1 { - Empty1 {} => {} - } - match e2 { - Empty2 {} => {} - } - match e3 { - Empty3 {} => {} - } - match e4 { - E::Empty4 {} => {} - _ => {} - } - match e5 { - E::Empty5 {} => {} - _ => {} - } - match e6 { - E::Empty6 {} => {} - _ => {} - } - match e7 { - Empty7 {} => {} - } - - match e1 { - Empty1 { .. } => {} - } - match e2 { - Empty2 { .. } => {} - } - match e3 { - Empty3 { .. } => {} - } - match e4 { - E::Empty4 { .. } => {} - _ => {} - } - match e5 { - E::Empty5 { .. } => {} - _ => {} - } - match e6 { - E::Empty6 { .. } => {} - _ => {} - } - match e7 { - Empty7 { .. } => {} - } - - match e2 { - Empty2 => {} - } - match e3 { - Empty3 => {} - } - match e5 { - E::Empty5 => {} - _ => {} - } - match e6 { - E::Empty6() => {} - _ => {} - } - match e6 { - E::Empty6(..) => {} - _ => {} - } - match e7 { - Empty7() => {} - } - match e7 { - Empty7(..) => {} - } - - let e11: Empty1 = Empty1 { ..e1 }; - let e22: Empty2 = Empty2 { ..e2 }; - let e33: Empty3 = Empty3 { ..e3 }; - let e77: Empty7 = Empty7 { ..e7 }; -} - -fn xcrate() { - let e1: XEmpty1 = XEmpty1 {}; - let e2: XEmpty2 = XEmpty2 {}; - let e2: XEmpty2 = XEmpty2; - let e3: XE = XE::XEmpty3 {}; - let e4: XE = XE::XEmpty4 {}; - let e4: XE = XE::XEmpty4; - let e6: XE = XE::XEmpty6 {}; - let e6: XE = XE::XEmpty6(); - let ctor6: fn() -> XE = XE::XEmpty6; - let e7: XEmpty7 = XEmpty7 {}; - let e7: XEmpty7 = XEmpty7(); - let ctor7: fn() -> XEmpty7 = XEmpty7; - - match e1 { - XEmpty1 {} => {} - } - match e2 { - XEmpty2 {} => {} - } - match e3 { - XE::XEmpty3 {} => {} - _ => {} - } - match e4 { - XE::XEmpty4 {} => {} - _ => {} - } - match e6 { - XE::XEmpty6 {} => {} - _ => {} - } - match e7 { - XEmpty7 {} => {} - } - - match e1 { - XEmpty1 { .. } => {} - } - match e2 { - XEmpty2 { .. } => {} - } - match e3 { - XE::XEmpty3 { .. } => {} - _ => {} - } - match e4 { - XE::XEmpty4 { .. } => {} - _ => {} - } - match e6 { - XE::XEmpty6 { .. } => {} - _ => {} - } - match e7 { - XEmpty7 { .. } => {} - } - - match e2 { - XEmpty2 => {} - } - match e4 { - XE::XEmpty4 => {} - _ => {} - } - match e6 { - XE::XEmpty6() => {} - _ => {} - } - match e6 { - XE::XEmpty6(..) => {} - _ => {} - } - match e7 { - XEmpty7() => {} - } - match e7 { - XEmpty7(..) => {} - } - - let e11: XEmpty1 = XEmpty1 { ..e1 }; - let e22: XEmpty2 = XEmpty2 { ..e2 }; - let e77: XEmpty7 = XEmpty7 { ..e7 }; -} - -fn main() { - local(); - xcrate(); -} diff --git a/src/test/ui/run-pass/structs-enums/empty-tag.rs b/src/test/ui/run-pass/structs-enums/empty-tag.rs deleted file mode 100644 index eab02fd5741..00000000000 --- a/src/test/ui/run-pass/structs-enums/empty-tag.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#[derive(Copy, Clone, Debug)] -enum chan { chan_t, } - -impl PartialEq for chan { - fn eq(&self, other: &chan) -> bool { - ((*self) as usize) == ((*other) as usize) - } - fn ne(&self, other: &chan) -> bool { !(*self).eq(other) } -} - -fn wrapper3(i: chan) { - assert_eq!(i, chan::chan_t); -} - -pub fn main() { - let wrapped = {||wrapper3(chan::chan_t)}; - wrapped(); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-alignment.rs b/src/test/ui/run-pass/structs-enums/enum-alignment.rs deleted file mode 100644 index 862025ea934..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-alignment.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -use std::mem; - -fn addr_of(ptr: &T) -> usize { - ptr as *const T as usize -} - -fn is_aligned(ptr: &T) -> bool { - unsafe { - let addr: usize = mem::transmute(ptr); - (addr % mem::min_align_of::()) == 0 - } -} - -pub fn main() { - let x = Some(0u64); - match x { - None => panic!(), - Some(ref y) => assert!(is_aligned(y)) - } -} diff --git a/src/test/ui/run-pass/structs-enums/enum-clike-ffi-as-int.rs b/src/test/ui/run-pass/structs-enums/enum-clike-ffi-as-int.rs deleted file mode 100644 index 838db705817..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-clike-ffi-as-int.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -/*! - * C-like enums have to be represented as LLVM ints, not wrapped in a - * struct, because it's important for the FFI that they interoperate - * with C integers/enums, and the ABI can treat structs differently. - * For example, on i686-linux-gnu, a struct return value is passed by - * storing to a hidden out parameter, whereas an integer would be - * returned in a register. - * - * This test just checks that the ABIs for the enum and the plain - * integer are compatible, rather than actually calling C code. - * The unused parameter to `foo` is to increase the likelihood of - * crashing if something goes wrong here. - */ - -#[repr(u32)] -enum Foo { - A = 0, - B = 23 -} - -#[inline(never)] -extern "C" fn foo(_x: usize) -> Foo { Foo::B } - -pub fn main() { - unsafe { - let f: extern "C" fn(usize) -> u32 = - ::std::mem::transmute(foo as extern "C" fn(usize) -> Foo); - assert_eq!(f(0xDEADBEEF), Foo::B as u32); - } -} diff --git a/src/test/ui/run-pass/structs-enums/enum-discr.rs b/src/test/ui/run-pass/structs-enums/enum-discr.rs deleted file mode 100644 index 0962f41f78d..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-discr.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -enum Animal { - Cat = 0, - Dog = 1, - Horse = 2, - Snake = 3, -} - -enum Hero { - Batman = -1, - Superman = -2, - Ironman = -3, - Spiderman = -4 -} - -pub fn main() { - let pet: Animal = Animal::Snake; - let hero: Hero = Hero::Superman; - assert_eq!(pet as usize, 3); - assert_eq!(hero as isize, -2); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-discrim-autosizing.rs b/src/test/ui/run-pass/structs-enums/enum-discrim-autosizing.rs deleted file mode 100644 index 55bf80138b9..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-discrim-autosizing.rs +++ /dev/null @@ -1,62 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -use std::mem::size_of; - -enum Ei8 { - Ai8 = -1, - Bi8 = 0 -} - -enum Eu8 { - Au8 = 0, - Bu8 = 0x80 -} - -enum Ei16 { - Ai16 = -1, - Bi16 = 0x80 -} - -enum Eu16 { - Au16 = 0, - Bu16 = 0x8000 -} - -enum Ei32 { - Ai32 = -1, - Bi32 = 0x8000 -} - -enum Eu32 { - Au32 = 0, - Bu32 = 0x8000_0000 -} - -enum Ei64 { - Ai64 = -1, - Bi64 = 0x8000_0000 -} - -pub fn main() { - assert_eq!(size_of::(), 1); - assert_eq!(size_of::(), 1); - assert_eq!(size_of::(), 2); - assert_eq!(size_of::(), 2); - assert_eq!(size_of::(), 4); - assert_eq!(size_of::(), 4); - #[cfg(target_pointer_width = "64")] - assert_eq!(size_of::(), 8); - #[cfg(target_pointer_width = "32")] - assert_eq!(size_of::(), 4); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-discrim-manual-sizing.rs b/src/test/ui/run-pass/structs-enums/enum-discrim-manual-sizing.rs deleted file mode 100644 index b4f8b5427e0..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-discrim-manual-sizing.rs +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem::{size_of, align_of}; - -#[repr(i8)] -enum Ei8 { - Ai8 = 0, - Bi8 = 1 -} - -#[repr(u8)] -enum Eu8 { - Au8 = 0, - Bu8 = 1 -} - -#[repr(i16)] -enum Ei16 { - Ai16 = 0, - Bi16 = 1 -} - -#[repr(u16)] -enum Eu16 { - Au16 = 0, - Bu16 = 1 -} - -#[repr(i32)] -enum Ei32 { - Ai32 = 0, - Bi32 = 1 -} - -#[repr(u32)] -enum Eu32 { - Au32 = 0, - Bu32 = 1 -} - -#[repr(i64)] -enum Ei64 { - Ai64 = 0, - Bi64 = 1 -} - -#[repr(u64)] -enum Eu64 { - Au64 = 0, - Bu64 = 1 -} - -#[repr(isize)] -enum Eint { - Aint = 0, - Bint = 1 -} - -#[repr(usize)] -enum Euint { - Auint = 0, - Buint = 1 -} - -#[repr(u8)] -enum Eu8NonCLike { - _None, - _Some(T), -} - -#[repr(i64)] -enum Ei64NonCLike { - _None, - _Some(T), -} - -#[repr(u64)] -enum Eu64NonCLike { - _None, - _Some(T), -} - -pub fn main() { - assert_eq!(size_of::(), 1); - assert_eq!(size_of::(), 1); - assert_eq!(size_of::(), 2); - assert_eq!(size_of::(), 2); - assert_eq!(size_of::(), 4); - assert_eq!(size_of::(), 4); - assert_eq!(size_of::(), 8); - assert_eq!(size_of::(), 8); - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::(), size_of::()); - assert_eq!(size_of::>(), 1); - assert_eq!(size_of::>(), 8); - assert_eq!(size_of::>(), 8); - let u8_expected_size = round_up(9, align_of::>()); - assert_eq!(size_of::>(), u8_expected_size); - let array_expected_size = round_up(28, align_of::>()); - assert_eq!(size_of::>(), array_expected_size); - assert_eq!(size_of::>(), 32); - - assert_eq!(align_of::(), align_of::()); - assert_eq!(align_of::>(), align_of::()); -} - -// Rounds x up to the next multiple of a -fn round_up(x: usize, a: usize) -> usize { - ((x + (a - 1)) / a) * a -} diff --git a/src/test/ui/run-pass/structs-enums/enum-discrim-range-overflow.rs b/src/test/ui/run-pass/structs-enums/enum-discrim-range-overflow.rs deleted file mode 100644 index 731cb003776..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-discrim-range-overflow.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] - -// pretty-expanded FIXME #23616 - -pub enum E64 { - H64 = 0x7FFF_FFFF_FFFF_FFFF, - L64 = 0x8000_0000_0000_0000 -} -pub enum E32 { - H32 = 0x7FFF_FFFF, - L32 = 0x8000_0000 -} - -pub fn f(e64: E64, e32: E32) -> (bool,bool) { - (match e64 { - E64::H64 => true, - E64::L64 => false - }, - match e32 { - E32::H32 => true, - E32::L32 => false - }) -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/structs-enums/enum-discrim-width-stuff.rs b/src/test/ui/run-pass/structs-enums/enum-discrim-width-stuff.rs deleted file mode 100644 index 6b38de6f6b3..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-discrim-width-stuff.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(overflowing_literals)] -#![allow(dead_code)] - -macro_rules! check { - ($m:ident, $t:ty, $v:expr) => {{ - mod $m { - use std::mem::size_of; - #[derive(Copy, Clone, Debug)] - enum E { - V = $v, - A = 0 - } - static C: E = E::V; - pub fn check() { - assert_eq!(size_of::(), size_of::<$t>()); - assert_eq!(E::V as $t, $v as $t); - assert_eq!(C as $t, $v as $t); - assert_eq!(format!("{:?}", E::V), "V".to_string()); - assert_eq!(format!("{:?}", C), "V".to_string()); - } - } - $m::check(); - }} -} - -pub fn main() { - check!(a, u8, 0x17); - check!(b, u8, 0xe8); - check!(c, u16, 0x1727); - check!(d, u16, 0xe8d8); - check!(e, u32, 0x17273747); - check!(f, u32, 0xe8d8c8b8); - - check!(z, i8, 0x17); - check!(y, i8, -0x17); - check!(x, i16, 0x1727); - check!(w, i16, -0x1727); - check!(v, i32, 0x17273747); - check!(u, i32, -0x17273747); - - enum Simple { A, B } - assert_eq!(::std::mem::size_of::(), 1); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-disr-val-pretty.rs b/src/test/ui/run-pass/structs-enums/enum-disr-val-pretty.rs deleted file mode 100644 index 5c02bf28884..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-disr-val-pretty.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -// pp-exact - - -enum color { red = 1, green, blue, imaginary = -1, } - -pub fn main() { - test_color(color::red, 1, "red".to_string()); - test_color(color::green, 2, "green".to_string()); - test_color(color::blue, 3, "blue".to_string()); - test_color(color::imaginary, -1, "imaginary".to_string()); -} - -fn test_color(color: color, val: isize, _name: String) { - assert_eq!(color as isize , val); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-export-inheritance.rs b/src/test/ui/run-pass/structs-enums/enum-export-inheritance.rs deleted file mode 100644 index 050479d28dc..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-export-inheritance.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod a { - pub enum Foo { - Bar, - Baz, - Boo - } -} - -pub fn main() { - let _x = a::Foo::Bar; -} diff --git a/src/test/ui/run-pass/structs-enums/enum-layout-optimization.rs b/src/test/ui/run-pass/structs-enums/enum-layout-optimization.rs deleted file mode 100644 index fcc5cc07996..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-layout-optimization.rs +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we will do various size optimizations to enum layout, but -// *not* if `#[repr(u8)]` or `#[repr(C)]` is passed. See also #40029. - -#![allow(dead_code)] - -use std::mem; - -enum Nullable { - Alive(T), - Dropped, -} - -#[repr(u8)] -enum NullableU8 { - Alive(T), - Dropped, -} - -#[repr(C)] -enum NullableC { - Alive(T), - Dropped, -} - -struct StructNewtype(T); - -#[repr(C)] -struct StructNewtypeC(T); - -enum EnumNewtype { Variant(T) } - -#[repr(u8)] -enum EnumNewtypeU8 { Variant(T) } - -#[repr(C)] -enum EnumNewtypeC { Variant(T) } - -fn main() { - assert!(mem::size_of::>() == mem::size_of::>>()); - assert!(mem::size_of::>() < mem::size_of::>>()); - assert!(mem::size_of::>() < mem::size_of::>>()); - - assert!(mem::size_of::() == mem::size_of::>()); - assert!(mem::size_of::() == mem::size_of::>()); - - assert!(mem::size_of::() == mem::size_of::>()); - assert!(mem::size_of::() < mem::size_of::>()); - assert!(mem::size_of::() < mem::size_of::>()); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs b/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs deleted file mode 100644 index 14eac687ecf..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c-and-int.rs +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test deserializes an enum in-place by transmuting to a union that -// should have the same layout, and manipulating the tag and payloads -// independently. This verifies that `repr(some_int)` has a stable representation, -// and that we don't miscompile these kinds of manipulations. - -use std::time::Duration; -use std::mem; - -#[repr(C, u8)] -#[derive(Copy, Clone, Eq, PartialEq, Debug)] -enum MyEnum { - A(u32), // Single primitive value - B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal - C, // Empty - D(Option), // Contains an enum - E(Duration), // Contains a struct -} - -#[repr(C)] -struct MyEnumRepr { - tag: MyEnumTag, - payload: MyEnumPayload, -} - -#[repr(C)] -#[allow(non_snake_case)] -union MyEnumPayload { - A: MyEnumVariantA, - B: MyEnumVariantB, - D: MyEnumVariantD, - E: MyEnumVariantE, -} - -#[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); - -fn main() { - let result: Vec> = vec![ - Ok(MyEnum::A(17)), - Ok(MyEnum::B { x: 206, y: 1145 }), - Ok(MyEnum::C), - Err(()), - Ok(MyEnum::D(Some(407))), - Ok(MyEnum::D(None)), - Ok(MyEnum::E(Duration::from_secs(100))), - Err(()), - ]; - - // Binary serialized version of the above (little-endian) - let input: Vec = vec![ - 0, 17, 0, 0, 0, - 1, 206, 121, 4, - 2, - 8, /* invalid tag value */ - 3, 0, 151, 1, 0, 0, - 3, 1, - 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, /* incomplete value */ - ]; - - let mut output = vec![]; - let mut buf = &input[..]; - - unsafe { - // This should be safe, because we don't match on it unless it's fully formed, - // and it doesn't have a destructor. - let mut dest: MyEnum = mem::uninitialized(); - while buf.len() > 0 { - match parse_my_enum(&mut dest, &mut buf) { - Ok(()) => output.push(Ok(dest)), - Err(()) => output.push(Err(())), - } - } - } - - assert_eq!(output, result); -} - -fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { - unsafe { - // Should be correct to do this transmute. - let dest: &'a mut MyEnumRepr = mem::transmute(dest); - let tag = read_u8(buf)?; - - dest.tag = match tag { - 0 => MyEnumTag::A, - 1 => MyEnumTag::B, - 2 => MyEnumTag::C, - 3 => MyEnumTag::D, - 4 => MyEnumTag::E, - _ => return Err(()), - }; - - match dest.tag { - MyEnumTag::A => { - dest.payload.A.0 = read_u32_le(buf)?; - } - MyEnumTag::B => { - dest.payload.B.x = read_u8(buf)?; - dest.payload.B.y = read_u16_le(buf)? as i16; - } - MyEnumTag::C => { - /* do nothing */ - } - MyEnumTag::D => { - let is_some = read_u8(buf)? == 0; - if is_some { - dest.payload.D.0 = Some(read_u32_le(buf)?); - } else { - dest.payload.D.0 = None; - } - } - MyEnumTag::E => { - let secs = read_u64_le(buf)?; - let nanos = read_u32_le(buf)?; - dest.payload.E.0 = Duration::new(secs, nanos); - } - } - Ok(()) - } -} - - - -// reader helpers - -fn read_u64_le(buf: &mut &[u8]) -> Result { - if buf.len() < 8 { return Err(()) } - let val = (buf[0] as u64) << 0 - | (buf[1] as u64) << 8 - | (buf[2] as u64) << 16 - | (buf[3] as u64) << 24 - | (buf[4] as u64) << 32 - | (buf[5] as u64) << 40 - | (buf[6] as u64) << 48 - | (buf[7] as u64) << 56; - *buf = &buf[8..]; - Ok(val) -} - -fn read_u32_le(buf: &mut &[u8]) -> Result { - if buf.len() < 4 { return Err(()) } - let val = (buf[0] as u32) << 0 - | (buf[1] as u32) << 8 - | (buf[2] as u32) << 16 - | (buf[3] as u32) << 24; - *buf = &buf[4..]; - Ok(val) -} - -fn read_u16_le(buf: &mut &[u8]) -> Result { - if buf.len() < 2 { return Err(()) } - let val = (buf[0] as u16) << 0 - | (buf[1] as u16) << 8; - *buf = &buf[2..]; - Ok(val) -} - -fn read_u8(buf: &mut &[u8]) -> Result { - if buf.len() < 1 { return Err(()) } - let val = buf[0]; - *buf = &buf[1..]; - Ok(val) -} diff --git a/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c.rs b/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c.rs deleted file mode 100644 index 80c4339af9d..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-c.rs +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test deserializes an enum in-place by transmuting to a union that -// should have the same layout, and manipulating the tag and payloads -// independently. This verifies that `repr(some_int)` has a stable representation, -// and that we don't miscompile these kinds of manipulations. - -use std::time::Duration; -use std::mem; - -#[repr(C)] -#[derive(Copy, Clone, Eq, PartialEq, Debug)] -enum MyEnum { - A(u32), // Single primitive value - B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal - C, // Empty - D(Option), // Contains an enum - E(Duration), // Contains a struct -} - -#[repr(C)] -struct MyEnumRepr { - tag: MyEnumTag, - payload: MyEnumPayload, -} - -#[repr(C)] -#[allow(non_snake_case)] -union MyEnumPayload { - A: MyEnumVariantA, - B: MyEnumVariantB, - D: MyEnumVariantD, - E: MyEnumVariantE, -} - -#[repr(C)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(u32); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB {x: u8, y: i16 } -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(Option); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(Duration); - -fn main() { - let result: Vec> = vec![ - Ok(MyEnum::A(17)), - Ok(MyEnum::B { x: 206, y: 1145 }), - Ok(MyEnum::C), - Err(()), - Ok(MyEnum::D(Some(407))), - Ok(MyEnum::D(None)), - Ok(MyEnum::E(Duration::from_secs(100))), - Err(()), - ]; - - // Binary serialized version of the above (little-endian) - let input: Vec = vec![ - 0, 17, 0, 0, 0, - 1, 206, 121, 4, - 2, - 8, /* invalid tag value */ - 3, 0, 151, 1, 0, 0, - 3, 1, - 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, /* incomplete value */ - ]; - - let mut output = vec![]; - let mut buf = &input[..]; - - unsafe { - // This should be safe, because we don't match on it unless it's fully formed, - // and it doesn't have a destructor. - let mut dest: MyEnum = mem::uninitialized(); - while buf.len() > 0 { - match parse_my_enum(&mut dest, &mut buf) { - Ok(()) => output.push(Ok(dest)), - Err(()) => output.push(Err(())), - } - } - } - - assert_eq!(output, result); -} - -fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { - unsafe { - // Should be correct to do this transmute. - let dest: &'a mut MyEnumRepr = mem::transmute(dest); - let tag = read_u8(buf)?; - - dest.tag = match tag { - 0 => MyEnumTag::A, - 1 => MyEnumTag::B, - 2 => MyEnumTag::C, - 3 => MyEnumTag::D, - 4 => MyEnumTag::E, - _ => return Err(()), - }; - - match dest.tag { - MyEnumTag::A => { - dest.payload.A.0 = read_u32_le(buf)?; - } - MyEnumTag::B => { - dest.payload.B.x = read_u8(buf)?; - dest.payload.B.y = read_u16_le(buf)? as i16; - } - MyEnumTag::C => { - /* do nothing */ - } - MyEnumTag::D => { - let is_some = read_u8(buf)? == 0; - if is_some { - dest.payload.D.0 = Some(read_u32_le(buf)?); - } else { - dest.payload.D.0 = None; - } - } - MyEnumTag::E => { - let secs = read_u64_le(buf)?; - let nanos = read_u32_le(buf)?; - dest.payload.E.0 = Duration::new(secs, nanos); - } - } - Ok(()) - } -} - - - -// reader helpers - -fn read_u64_le(buf: &mut &[u8]) -> Result { - if buf.len() < 8 { return Err(()) } - let val = (buf[0] as u64) << 0 - | (buf[1] as u64) << 8 - | (buf[2] as u64) << 16 - | (buf[3] as u64) << 24 - | (buf[4] as u64) << 32 - | (buf[5] as u64) << 40 - | (buf[6] as u64) << 48 - | (buf[7] as u64) << 56; - *buf = &buf[8..]; - Ok(val) -} - -fn read_u32_le(buf: &mut &[u8]) -> Result { - if buf.len() < 4 { return Err(()) } - let val = (buf[0] as u32) << 0 - | (buf[1] as u32) << 8 - | (buf[2] as u32) << 16 - | (buf[3] as u32) << 24; - *buf = &buf[4..]; - Ok(val) -} - -fn read_u16_le(buf: &mut &[u8]) -> Result { - if buf.len() < 2 { return Err(()) } - let val = (buf[0] as u16) << 0 - | (buf[1] as u16) << 8; - *buf = &buf[2..]; - Ok(val) -} - -fn read_u8(buf: &mut &[u8]) -> Result { - if buf.len() < 1 { return Err(()) } - let val = buf[0]; - *buf = &buf[1..]; - Ok(val) -} diff --git a/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-int.rs b/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-int.rs deleted file mode 100644 index 4c1fe8db1cd..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-non-c-like-repr-int.rs +++ /dev/null @@ -1,174 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// This test deserializes an enum in-place by transmuting to a union that -// should have the same layout, and manipulating the tag and payloads -// independently. This verifies that `repr(some_int)` has a stable representation, -// and that we don't miscompile these kinds of manipulations. - -use std::time::Duration; -use std::mem; - -#[repr(u8)] -#[derive(Copy, Clone, Eq, PartialEq, Debug)] -enum MyEnum { - A(u32), // Single primitive value - B { x: u8, y: i16 }, // Composite, and the offset of `y` depends on tag being internal - C, // Empty - D(Option), // Contains an enum - E(Duration), // Contains a struct -} - -#[allow(non_snake_case)] -#[repr(C)] -union MyEnumRepr { - A: MyEnumVariantA, - B: MyEnumVariantB, - C: MyEnumVariantC, - D: MyEnumVariantD, - E: MyEnumVariantE, -} - -#[repr(u8)] #[derive(Copy, Clone)] enum MyEnumTag { A, B, C, D, E } -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantA(MyEnumTag, u32); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantB { tag: MyEnumTag, x: u8, y: i16 } -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantC(MyEnumTag); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantD(MyEnumTag, Option); -#[repr(C)] #[derive(Copy, Clone)] struct MyEnumVariantE(MyEnumTag, Duration); - -fn main() { - let result: Vec> = vec![ - Ok(MyEnum::A(17)), - Ok(MyEnum::B { x: 206, y: 1145 }), - Ok(MyEnum::C), - Err(()), - Ok(MyEnum::D(Some(407))), - Ok(MyEnum::D(None)), - Ok(MyEnum::E(Duration::from_secs(100))), - Err(()), - ]; - - // Binary serialized version of the above (little-endian) - let input: Vec = vec![ - 0, 17, 0, 0, 0, - 1, 206, 121, 4, - 2, - 8, /* invalid tag value */ - 3, 0, 151, 1, 0, 0, - 3, 1, - 4, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, /* incomplete value */ - ]; - - let mut output = vec![]; - let mut buf = &input[..]; - - unsafe { - // This should be safe, because we don't match on it unless it's fully formed, - // and it doesn't have a destructor. - let mut dest: MyEnum = mem::uninitialized(); - while buf.len() > 0 { - match parse_my_enum(&mut dest, &mut buf) { - Ok(()) => output.push(Ok(dest)), - Err(()) => output.push(Err(())), - } - } - } - - assert_eq!(output, result); -} - -fn parse_my_enum<'a>(dest: &'a mut MyEnum, buf: &mut &[u8]) -> Result<(), ()> { - unsafe { - // Should be correct to do this transmute. - let dest: &'a mut MyEnumRepr = mem::transmute(dest); - let tag = read_u8(buf)?; - - dest.A.0 = match tag { - 0 => MyEnumTag::A, - 1 => MyEnumTag::B, - 2 => MyEnumTag::C, - 3 => MyEnumTag::D, - 4 => MyEnumTag::E, - _ => return Err(()), - }; - - match dest.B.tag { - MyEnumTag::A => { - dest.A.1 = read_u32_le(buf)?; - } - MyEnumTag::B => { - dest.B.x = read_u8(buf)?; - dest.B.y = read_u16_le(buf)? as i16; - } - MyEnumTag::C => { - /* do nothing */ - } - MyEnumTag::D => { - let is_some = read_u8(buf)? == 0; - if is_some { - dest.D.1 = Some(read_u32_le(buf)?); - } else { - dest.D.1 = None; - } - } - MyEnumTag::E => { - let secs = read_u64_le(buf)?; - let nanos = read_u32_le(buf)?; - dest.E.1 = Duration::new(secs, nanos); - } - } - Ok(()) - } -} - - - -// reader helpers - -fn read_u64_le(buf: &mut &[u8]) -> Result { - if buf.len() < 8 { return Err(()) } - let val = (buf[0] as u64) << 0 - | (buf[1] as u64) << 8 - | (buf[2] as u64) << 16 - | (buf[3] as u64) << 24 - | (buf[4] as u64) << 32 - | (buf[5] as u64) << 40 - | (buf[6] as u64) << 48 - | (buf[7] as u64) << 56; - *buf = &buf[8..]; - Ok(val) -} - -fn read_u32_le(buf: &mut &[u8]) -> Result { - if buf.len() < 4 { return Err(()) } - let val = (buf[0] as u32) << 0 - | (buf[1] as u32) << 8 - | (buf[2] as u32) << 16 - | (buf[3] as u32) << 24; - *buf = &buf[4..]; - Ok(val) -} - -fn read_u16_le(buf: &mut &[u8]) -> Result { - if buf.len() < 2 { return Err(()) } - let val = (buf[0] as u16) << 0 - | (buf[1] as u16) << 8; - *buf = &buf[2..]; - Ok(val) -} - -fn read_u8(buf: &mut &[u8]) -> Result { - if buf.len() < 1 { return Err(()) } - let val = buf[0]; - *buf = &buf[1..]; - Ok(val) -} diff --git a/src/test/ui/run-pass/structs-enums/enum-null-pointer-opt.rs b/src/test/ui/run-pass/structs-enums/enum-null-pointer-opt.rs deleted file mode 100644 index f5f90c62b88..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-null-pointer-opt.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem::size_of; -use std::num::NonZeroUsize; -use std::ptr::NonNull; -use std::rc::Rc; -use std::sync::Arc; - -trait Trait { fn dummy(&self) { } } -trait Mirror { type Image; } -impl Mirror for T { type Image = T; } -struct ParamTypeStruct(T); -struct AssocTypeStruct(::Image); - -fn main() { - // Functions - assert_eq!(size_of::(), size_of::>()); - assert_eq!(size_of::(), size_of::>()); - - // Slices - &str / &[T] / &mut [T] - assert_eq!(size_of::<&str>(), size_of::>()); - assert_eq!(size_of::<&[isize]>(), size_of::>()); - assert_eq!(size_of::<&mut [isize]>(), size_of::>()); - - // Traits - Box / &Trait / &mut Trait - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::<&Trait>(), size_of::>()); - assert_eq!(size_of::<&mut Trait>(), size_of::>()); - - // Pointers - Box - assert_eq!(size_of::>(), size_of::>>()); - - // The optimization can't apply to raw pointers - assert!(size_of::>() != size_of::<*const isize>()); - assert!(Some(0 as *const isize).is_some()); // Can't collapse None to null - - struct Foo { - _a: Box - } - struct Bar(Box); - - // Should apply through structs - assert_eq!(size_of::(), size_of::>()); - assert_eq!(size_of::(), size_of::>()); - // and tuples - assert_eq!(size_of::<(u8, Box)>(), size_of::)>>()); - // and fixed-size arrays - assert_eq!(size_of::<[Box; 1]>(), size_of::; 1]>>()); - - // Should apply to NonZero - assert_eq!(size_of::(), size_of::>()); - assert_eq!(size_of::>(), size_of::>>()); - - // Should apply to types that use NonZero internally - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::>(), size_of::>>()); - assert_eq!(size_of::>(), size_of::>>()); - - // Should apply to types that have NonZero transitively - assert_eq!(size_of::(), size_of::>()); - - // Should apply to types where the pointer is substituted - assert_eq!(size_of::<&u8>(), size_of::>>()); - assert_eq!(size_of::<&u8>(), size_of::>>()); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs b/src/test/ui/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs deleted file mode 100644 index 21d48112841..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-nullable-const-null-with-fields.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::result::Result; -use std::result::Result::Ok; - -static C: Result<(), Box> = Ok(()); - -// This is because of yet another bad assertion (ICE) about the null side of a nullable enum. -// So we won't actually compile if the bug is present, but we check the value in main anyway. - -pub fn main() { - assert!(C.is_ok()); -} diff --git a/src/test/ui/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs b/src/test/ui/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs deleted file mode 100644 index 431d105f01f..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-nullable-simplifycfg-misopt.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -/*! - * This is a regression test for a bug in LLVM, fixed in upstream r179587, - * where the switch instructions generated for destructuring enums - * represented with nullable pointers could be misoptimized in some cases. - */ - -enum List { Nil, Cons(X, Box>) } -pub fn main() { - match List::Cons(10, box List::Nil) { - List::Cons(10, _) => {} - List::Nil => {} - _ => panic!() - } -} diff --git a/src/test/ui/run-pass/structs-enums/enum-univariant-repr.rs b/src/test/ui/run-pass/structs-enums/enum-univariant-repr.rs deleted file mode 100644 index 7f78da64b67..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-univariant-repr.rs +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::mem; - -// Univariant C-like enum -#[repr(i32)] -enum Univariant { - X = 17 -} - -#[repr(u16)] -enum UnivariantWithoutDescr { - Y -} - -#[repr(u8)] -enum UnivariantWithData { - Z(u8), -} - -pub fn main() { - { - assert_eq!(4, mem::size_of::()); - assert_eq!(17, Univariant::X as i32); - - let enums: &[Univariant] = - &[Univariant::X, Univariant::X, Univariant::X]; - let ints: &[i32] = unsafe { mem::transmute(enums) }; - // check it has the same memory layout as i32 - assert_eq!(&[17, 17, 17], ints); - } - - { - assert_eq!(2, mem::size_of::()); - let descr = UnivariantWithoutDescr::Y as u16; - - let enums: &[UnivariantWithoutDescr] = - &[UnivariantWithoutDescr::Y, UnivariantWithoutDescr::Y, UnivariantWithoutDescr::Y]; - let ints: &[u16] = unsafe { mem::transmute(enums) }; - // check it has the same memory layout as u16 - assert_eq!(&[descr, descr, descr], ints); - } - - { - assert_eq!(2, mem::size_of::()); - - match UnivariantWithData::Z(4) { - UnivariantWithData::Z(x) => assert_eq!(x, 4), - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/enum-variants.rs b/src/test/ui/run-pass/structs-enums/enum-variants.rs deleted file mode 100644 index 1eff9ad413d..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-variants.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] - -enum Animal { - Dog (String, f64), - Cat { name: String, weight: f64 } -} - -pub fn main() { - let mut a: Animal = Animal::Dog("Cocoa".to_string(), 37.2); - a = Animal::Cat{ name: "Spotty".to_string(), weight: 2.7 }; - // permuting the fields should work too - let _c = Animal::Cat { weight: 3.1, name: "Spreckles".to_string() }; -} diff --git a/src/test/ui/run-pass/structs-enums/enum-vec-initializer.rs b/src/test/ui/run-pass/structs-enums/enum-vec-initializer.rs deleted file mode 100644 index 9a2abdbb706..00000000000 --- a/src/test/ui/run-pass/structs-enums/enum-vec-initializer.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Flopsy { - Bunny = 2 -} - -const BAR:usize = Flopsy::Bunny as usize; -const BAR2:usize = BAR; - -pub fn main() { - let _v = [0; Flopsy::Bunny as usize]; - let _v = [0; BAR]; - let _v = [0; BAR2]; - const BAR3:usize = BAR2; - let _v = [0; BAR3]; -} diff --git a/src/test/ui/run-pass/structs-enums/export-abstract-tag.rs b/src/test/ui/run-pass/structs-enums/export-abstract-tag.rs deleted file mode 100644 index 6de6e1847fe..00000000000 --- a/src/test/ui/run-pass/structs-enums/export-abstract-tag.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// We can export tags without exporting the variants to create a simple -// sort of ADT. - -// pretty-expanded FIXME #23616 - -mod foo { - pub enum t { t1, } - - pub fn f() -> t { return t::t1; } -} - -pub fn main() { let _v: foo::t = foo::f(); } diff --git a/src/test/ui/run-pass/structs-enums/export-tag-variant.rs b/src/test/ui/run-pass/structs-enums/export-tag-variant.rs deleted file mode 100644 index 700ad4fbe7e..00000000000 --- a/src/test/ui/run-pass/structs-enums/export-tag-variant.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -// pretty-expanded FIXME #23616 - -mod foo { - pub enum t { t1, } -} - -pub fn main() { let _v = foo::t::t1; } diff --git a/src/test/ui/run-pass/structs-enums/expr-if-struct.rs b/src/test/ui/run-pass/structs-enums/expr-if-struct.rs deleted file mode 100644 index 25777fba274..00000000000 --- a/src/test/ui/run-pass/structs-enums/expr-if-struct.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - - -// Tests for if as expressions returning nominal types - -#[derive(Copy, Clone)] -struct I { i: isize } - -fn test_rec() { - let rs = if true { I {i: 100} } else { I {i: 101} }; - assert_eq!(rs.i, 100); -} - -#[derive(Copy, Clone, Debug)] -enum mood { happy, sad, } - -impl PartialEq for mood { - fn eq(&self, other: &mood) -> bool { - ((*self) as usize) == ((*other) as usize) - } - fn ne(&self, other: &mood) -> bool { !(*self).eq(other) } -} - -fn test_tag() { - let rs = if true { mood::happy } else { mood::sad }; - assert_eq!(rs, mood::happy); -} - -pub fn main() { test_rec(); test_tag(); } diff --git a/src/test/ui/run-pass/structs-enums/expr-match-struct.rs b/src/test/ui/run-pass/structs-enums/expr-match-struct.rs deleted file mode 100644 index 7c18eff1c46..00000000000 --- a/src/test/ui/run-pass/structs-enums/expr-match-struct.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - - -// Tests for match as expressions resulting in struct types -#[derive(Copy, Clone)] -struct R { i: isize } - -fn test_rec() { - let rs = match true { true => R {i: 100}, _ => panic!() }; - assert_eq!(rs.i, 100); -} - -#[derive(Copy, Clone, Debug)] -enum mood { happy, sad, } - -impl PartialEq for mood { - fn eq(&self, other: &mood) -> bool { - ((*self) as usize) == ((*other) as usize) - } - fn ne(&self, other: &mood) -> bool { !(*self).eq(other) } -} - -fn test_tag() { - let rs = match true { true => { mood::happy } false => { mood::sad } }; - assert_eq!(rs, mood::happy); -} - -pub fn main() { test_rec(); test_tag(); } diff --git a/src/test/ui/run-pass/structs-enums/field-destruction-order.rs b/src/test/ui/run-pass/structs-enums/field-destruction-order.rs deleted file mode 100644 index 5b9d1530321..00000000000 --- a/src/test/ui/run-pass/structs-enums/field-destruction-order.rs +++ /dev/null @@ -1,56 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// In theory, it doesn't matter what order destructors are run in for rust -// because we have explicit ownership of values meaning that there's no need to -// run one before another. With unsafe code, however, there may be a safe -// interface which relies on fields having their destructors run in a particular -// order. At the time of this writing, std::rt::sched::Scheduler is an example -// of a structure which contains unsafe handles to FFI-like types, and the -// destruction order of the fields matters in the sense that some handles need -// to get destroyed before others. -// -// In C++, destruction order happens bottom-to-top in order of field -// declarations, but we currently run them top-to-bottom. I don't think the -// order really matters that much as long as we define what it is. - - -struct A; -struct B; -struct C { - a: A, - b: B, -} - -static mut hit: bool = false; - -impl Drop for A { - fn drop(&mut self) { - unsafe { - assert!(!hit); - hit = true; - } - } -} - -impl Drop for B { - fn drop(&mut self) { - unsafe { - assert!(hit); - } - } -} - -pub fn main() { - let _c = C { a: A, b: B }; -} diff --git a/src/test/ui/run-pass/structs-enums/foreign-struct.rs b/src/test/ui/run-pass/structs-enums/foreign-struct.rs deleted file mode 100644 index 1e4955bd5ec..00000000000 --- a/src/test/ui/run-pass/structs-enums/foreign-struct.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Passing enums by value - -// pretty-expanded FIXME #23616 - -pub enum void { } - -mod bindgen { - use super::void; - - extern { - pub fn printf(v: void); - } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/structs-enums/functional-struct-upd.rs b/src/test/ui/run-pass/structs-enums/functional-struct-upd.rs deleted file mode 100644 index 6fe028c5145..00000000000 --- a/src/test/ui/run-pass/structs-enums/functional-struct-upd.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct Foo { - x: isize, - y: isize -} - -pub fn main() { - let a = Foo { x: 1, y: 2 }; - let c = Foo { x: 4, .. a}; - println!("{:?}", c); -} diff --git a/src/test/ui/run-pass/structs-enums/ivec-tag.rs b/src/test/ui/run-pass/structs-enums/ivec-tag.rs deleted file mode 100644 index fb7585f9989..00000000000 --- a/src/test/ui/run-pass/structs-enums/ivec-tag.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -fn producer(tx: &Sender>) { - tx.send( - vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - 13]).unwrap(); -} - -pub fn main() { - let (tx, rx) = channel::>(); - let prod = thread::spawn(move|| { - producer(&tx) - }); - - let _data: Vec = rx.recv().unwrap(); - prod.join(); -} diff --git a/src/test/ui/run-pass/structs-enums/module-qualified-struct-destructure.rs b/src/test/ui/run-pass/structs-enums/module-qualified-struct-destructure.rs deleted file mode 100644 index 8334dc532e0..00000000000 --- a/src/test/ui/run-pass/structs-enums/module-qualified-struct-destructure.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod m { - pub struct S { - pub x: isize, - pub y: isize - } -} - -pub fn main() { - let x = m::S { x: 1, y: 2 }; - let m::S { x: _a, y: _b } = x; -} diff --git a/src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs b/src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs deleted file mode 100644 index 1f57c9dd473..00000000000 --- a/src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat-xc.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// aux-build:namespaced_enum_emulate_flat.rs - -// pretty-expanded FIXME #23616 - -extern crate namespaced_enum_emulate_flat; - -use namespaced_enum_emulate_flat::{Foo, A, B, C}; -use namespaced_enum_emulate_flat::nest::{Bar, D, E, F}; - -fn _f(f: Foo) { - match f { - A | B(_) | C { .. } => {} - } -} - -fn _f2(f: Bar) { - match f { - D | E(_) | F { .. } => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat.rs b/src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat.rs deleted file mode 100644 index 1185519dac6..00000000000 --- a/src/test/ui/run-pass/structs-enums/namespaced-enum-emulate-flat.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub use Foo::*; -use nest::{Bar, D, E, F}; - -pub enum Foo { - A, - B(isize), - C { a: isize }, -} - -impl Foo { - pub fn foo() {} -} - -fn _f(f: Foo) { - match f { - A | B(_) | C { .. } => {} - } -} - -mod nest { - pub use self::Bar::*; - - pub enum Bar { - D, - E(isize), - F { a: isize }, - } - - impl Bar { - pub fn foo() {} - } -} - -fn _f2(f: Bar) { - match f { - D | E(_) | F { .. } => {} - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs b/src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs deleted file mode 100644 index aff4125ef17..00000000000 --- a/src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import-xcrate.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:namespaced_enums.rs - -// pretty-expanded FIXME #23616 - -extern crate namespaced_enums; - -fn _f(f: namespaced_enums::Foo) { - use namespaced_enums::Foo::*; - - match f { - A | B(_) | C { .. } => {} - } -} - -mod m { - pub use namespaced_enums::Foo::*; -} - -fn _f2(f: namespaced_enums::Foo) { - match f { - m::A | m::B(_) | m::C { .. } => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import.rs b/src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import.rs deleted file mode 100644 index 85af2f0d9d6..00000000000 --- a/src/test/ui/run-pass/structs-enums/namespaced-enum-glob-import.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod m2 { - pub enum Foo { - A, - B(isize), - C { a: isize }, - } - - impl Foo { - pub fn foo() {} - } -} - -mod m { - pub use m2::Foo::*; -} - -fn _f(f: m2::Foo) { - use m2::Foo::*; - - match f { - A | B(_) | C { .. } => {} - } -} - -fn _f2(f: m2::Foo) { - match f { - m::A | m::B(_) | m::C { .. } => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/namespaced-enums-xcrate.rs b/src/test/ui/run-pass/structs-enums/namespaced-enums-xcrate.rs deleted file mode 100644 index d107a9386c3..00000000000 --- a/src/test/ui/run-pass/structs-enums/namespaced-enums-xcrate.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:namespaced_enums.rs - -// pretty-expanded FIXME #23616 - -extern crate namespaced_enums; - -use namespaced_enums::Foo; - -fn _foo (f: Foo) { - match f { - Foo::A | Foo::B(_) | Foo::C { .. } => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/namespaced-enums.rs b/src/test/ui/run-pass/structs-enums/namespaced-enums.rs deleted file mode 100644 index 05a4c190712..00000000000 --- a/src/test/ui/run-pass/structs-enums/namespaced-enums.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Foo { - A, - B(isize), - C { a: isize }, -} - -fn _foo (f: Foo) { - match f { - Foo::A | Foo::B(_) | Foo::C { .. } => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/nested-enum-same-names.rs b/src/test/ui/run-pass/structs-enums/nested-enum-same-names.rs deleted file mode 100644 index 6e294b27abf..00000000000 --- a/src/test/ui/run-pass/structs-enums/nested-enum-same-names.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -/* - -#7770 ICE with sibling methods containing same-name-enum containing - same-name-member - -If you have two methods in an impl block, each containing an enum -(with the same name), each containing at least one value with the same -name, rustc gives the same LLVM symbol for the two of them and fails, -as it does not include the method name in the symbol name. - -*/ - -pub struct Foo; -impl Foo { - pub fn foo() { - enum Panic { Common }; - } - pub fn bar() { - enum Panic { Common }; - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/newtype-struct-drop-run.rs b/src/test/ui/run-pass/structs-enums/newtype-struct-drop-run.rs deleted file mode 100644 index 2221deeb5ae..00000000000 --- a/src/test/ui/run-pass/structs-enums/newtype-struct-drop-run.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Make sure the destructor is run for newtype structs. - -use std::cell::Cell; - -struct Foo<'a>(&'a Cell); - -impl<'a> Drop for Foo<'a> { - fn drop(&mut self) { - let Foo(i) = *self; - i.set(23); - } -} - -pub fn main() { - let y = &Cell::new(32); - { - let _x = Foo(y); - } - assert_eq!(y.get(), 23); -} diff --git a/src/test/ui/run-pass/structs-enums/newtype-struct-with-dtor.rs b/src/test/ui/run-pass/structs-enums/newtype-struct-with-dtor.rs deleted file mode 100644 index 6bdf69478ae..00000000000 --- a/src/test/ui/run-pass/structs-enums/newtype-struct-with-dtor.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub struct Fd(u32); - -fn foo(a: u32) {} - -impl Drop for Fd { - fn drop(&mut self) { - unsafe { - let Fd(s) = *self; - foo(s); - } - } -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/structs-enums/newtype-struct-xc-2.rs b/src/test/ui/run-pass/structs-enums/newtype-struct-xc-2.rs deleted file mode 100644 index d83552b063c..00000000000 --- a/src/test/ui/run-pass/structs-enums/newtype-struct-xc-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:newtype_struct_xc.rs - -// pretty-expanded FIXME #23616 - -extern crate newtype_struct_xc; -use newtype_struct_xc::Au; - -fn f() -> Au { - Au(2) -} - -pub fn main() { - let _ = f(); -} diff --git a/src/test/ui/run-pass/structs-enums/newtype-struct-xc.rs b/src/test/ui/run-pass/structs-enums/newtype-struct-xc.rs deleted file mode 100644 index d88ddd7298c..00000000000 --- a/src/test/ui/run-pass/structs-enums/newtype-struct-xc.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:newtype_struct_xc.rs - -// pretty-expanded FIXME #23616 - -extern crate newtype_struct_xc; - -pub fn main() { - let _ = newtype_struct_xc::Au(2); -} diff --git a/src/test/ui/run-pass/structs-enums/nonzero-enum.rs b/src/test/ui/run-pass/structs-enums/nonzero-enum.rs deleted file mode 100644 index 7a6afec4e6d..00000000000 --- a/src/test/ui/run-pass/structs-enums/nonzero-enum.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem::size_of; - -enum E { - A = 1, - B = 2, - C = 3, -} - -struct S { - a: u16, - b: u8, - e: E, -} - -fn main() { - assert_eq!(size_of::(), 1); - assert_eq!(size_of::>(), 1); - assert_eq!(size_of::>(), 1); - assert_eq!(size_of::>(), size_of::()); - let enone = None::; - let esome = Some(E::A); - if let Some(..) = enone { - panic!(); - } - if let None = esome { - panic!(); - } -} diff --git a/src/test/ui/run-pass/structs-enums/numeric-fields.rs b/src/test/ui/run-pass/structs-enums/numeric-fields.rs deleted file mode 100644 index e311722d651..00000000000 --- a/src/test/ui/run-pass/structs-enums/numeric-fields.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S(u8, u16); - -fn main() { - let s = S{1: 10, 0: 11}; - match s { - S{0: a, 1: b, ..} => { - assert_eq!(a, 11); - assert_eq!(b, 10); - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs b/src/test/ui/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs deleted file mode 100644 index 86d8af174ac..00000000000 --- a/src/test/ui/run-pass/structs-enums/object-lifetime-default-from-ref-struct.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the lifetime of the enclosing `&` is used for the object -// lifetime bound. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -use std::fmt::Display; - -trait Test { - fn foo(&self) { } -} - -struct Ref<'a,T:'a+?Sized> { - r: &'a T -} - -struct Ref2<'a,'b,T:'a+'b+?Sized> { - a: &'a T, - b: &'b T -} - -struct SomeStruct<'a> { - t: Ref<'a,Test>, - u: Ref<'a,Test+'a>, -} - -fn a<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { - ss.t = t; -} - -fn b<'a>(t: Ref<'a,Test>, mut ss: SomeStruct<'a>) { - ss.u = t; -} - -fn c<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { - ss.t = t; -} - -fn d<'a>(t: Ref<'a,Test+'a>, mut ss: SomeStruct<'a>) { - ss.u = t; -} - -fn e<'a>(_: Ref<'a, Display+'static>) {} -fn g<'a, 'b>(_: Ref2<'a, 'b, Display+'static>) {} - - -fn main() { - // Inside a function body, we can just infer all - // lifetimes, to allow Ref<'tmp, Display+'static> - // and Ref2<'tmp, 'tmp, Display+'static>. - let x = &0 as &(Display+'static); - let r: Ref = Ref { r: x }; - let r2: Ref2 = Ref2 { a: x, b: x }; - e(r); - g(r2); -} diff --git a/src/test/ui/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs b/src/test/ui/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs deleted file mode 100644 index cd88f7a42d0..00000000000 --- a/src/test/ui/run-pass/structs-enums/object-lifetime-default-from-rptr-struct.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the lifetime from the enclosing `&` is "inherited" -// through the `MyBox` struct. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -trait Test { - fn foo(&self) { } -} - -struct SomeStruct<'a> { - t: &'a MyBox, - u: &'a MyBox, -} - -struct MyBox { - b: Box -} - -fn a<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { - ss.t = t; -} - -fn b<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { - ss.u = t; -} - -// see also compile-fail/object-lifetime-default-from-rptr-box-error.rs - -fn d<'a>(t: &'a MyBox, mut ss: SomeStruct<'a>) { - ss.u = t; -} - -fn main() { -} diff --git a/src/test/ui/run-pass/structs-enums/rec-align-u32.rs b/src/test/ui/run-pass/structs-enums/rec-align-u32.rs deleted file mode 100644 index e2c960b89cb..00000000000 --- a/src/test/ui/run-pass/structs-enums/rec-align-u32.rs +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #2303 - -#![feature(intrinsics)] - -use std::mem; - -mod rusti { - extern "rust-intrinsic" { - pub fn pref_align_of() -> usize; - pub fn min_align_of() -> usize; - } -} - -// This is the type with the questionable alignment -#[derive(Debug)] -struct Inner { - c64: u32 -} - -// This is the type that contains the type with the -// questionable alignment, for testing -#[derive(Debug)] -struct Outer { - c8: u8, - t: Inner -} - -mod m { - pub fn align() -> usize { 4 } - pub fn size() -> usize { 8 } -} - -pub fn main() { - unsafe { - let x = Outer {c8: 22, t: Inner {c64: 44}}; - - // Send it through the shape code - let y = format!("{:?}", x); - - println!("align inner = {:?}", rusti::min_align_of::()); - println!("size outer = {:?}", mem::size_of::()); - println!("y = {:?}", y); - - // per clang/gcc the alignment of `inner` is 4 on x86. - assert_eq!(rusti::min_align_of::(), m::align()); - - // per clang/gcc the size of `outer` should be 12 - // because `inner`s alignment was 4. - assert_eq!(mem::size_of::(), m::size()); - - assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); - } -} diff --git a/src/test/ui/run-pass/structs-enums/rec-align-u64.rs b/src/test/ui/run-pass/structs-enums/rec-align-u64.rs deleted file mode 100644 index 6fe3aefaef5..00000000000 --- a/src/test/ui/run-pass/structs-enums/rec-align-u64.rs +++ /dev/null @@ -1,109 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare seems unimportant to test - -// Issue #2303 - -#![feature(intrinsics)] - -use std::mem; - -mod rusti { - extern "rust-intrinsic" { - pub fn pref_align_of() -> usize; - pub fn min_align_of() -> usize; - } -} - -// This is the type with the questionable alignment -#[derive(Debug)] -struct Inner { - c64: u64 -} - -// This is the type that contains the type with the -// questionable alignment, for testing -#[derive(Debug)] -struct Outer { - c8: u8, - t: Inner -} - - -#[cfg(any(target_os = "android", - target_os = "cloudabi", - target_os = "dragonfly", - target_os = "emscripten", - target_os = "freebsd", - target_os = "linux", - target_os = "macos", - target_os = "netbsd", - target_os = "openbsd", - target_os = "solaris"))] -mod m { - #[cfg(target_arch = "x86")] - pub mod m { - pub fn align() -> usize { 4 } - pub fn size() -> usize { 12 } - } - - #[cfg(not(target_arch = "x86"))] - pub mod m { - pub fn align() -> usize { 8 } - pub fn size() -> usize { 16 } - } -} - -#[cfg(target_os = "bitrig")] -mod m { - #[cfg(target_arch = "x86_64")] - pub mod m { - pub fn align() -> usize { 8 } - pub fn size() -> usize { 16 } - } -} - -#[cfg(target_os = "windows")] -mod m { - #[cfg(target_arch = "x86")] - pub mod m { - pub fn align() -> usize { 8 } - pub fn size() -> usize { 16 } - } - - #[cfg(target_arch = "x86_64")] - pub mod m { - pub fn align() -> usize { 8 } - pub fn size() -> usize { 16 } - } -} - -pub fn main() { - unsafe { - let x = Outer {c8: 22, t: Inner {c64: 44}}; - - let y = format!("{:?}", x); - - println!("align inner = {:?}", rusti::min_align_of::()); - println!("size outer = {:?}", mem::size_of::()); - println!("y = {:?}", y); - - // per clang/gcc the alignment of `Inner` is 4 on x86. - assert_eq!(rusti::min_align_of::(), m::m::align()); - - // per clang/gcc the size of `Outer` should be 12 - // because `Inner`s alignment was 4. - assert_eq!(mem::size_of::(), m::m::size()); - - assert_eq!(y, "Outer { c8: 22, t: Inner { c64: 44 } }".to_string()); - } -} diff --git a/src/test/ui/run-pass/structs-enums/rec-auto.rs b/src/test/ui/run-pass/structs-enums/rec-auto.rs deleted file mode 100644 index db9a97bd036..00000000000 --- a/src/test/ui/run-pass/structs-enums/rec-auto.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -// Issue #50. - -struct X { foo: String, bar: String } - -pub fn main() { - let x = X {foo: "hello".to_string(), bar: "world".to_string()}; - println!("{}", x.foo.clone()); - println!("{}", x.bar.clone()); -} diff --git a/src/test/ui/run-pass/structs-enums/rec-extend.rs b/src/test/ui/run-pass/structs-enums/rec-extend.rs deleted file mode 100644 index c20ff37222c..00000000000 --- a/src/test/ui/run-pass/structs-enums/rec-extend.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - - - -struct Point {x: isize, y: isize} - -pub fn main() { - let origin: Point = Point {x: 0, y: 0}; - let right: Point = Point {x: origin.x + 10,.. origin}; - let up: Point = Point {y: origin.y + 10,.. origin}; - assert_eq!(origin.x, 0); - assert_eq!(origin.y, 0); - assert_eq!(right.x, 10); - assert_eq!(right.y, 0); - assert_eq!(up.x, 0); - assert_eq!(up.y, 10); -} diff --git a/src/test/ui/run-pass/structs-enums/rec-tup.rs b/src/test/ui/run-pass/structs-enums/rec-tup.rs deleted file mode 100644 index ae8819cb5b8..00000000000 --- a/src/test/ui/run-pass/structs-enums/rec-tup.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -#[derive(Copy, Clone)] -struct Point {x: isize, y: isize} - -type rect = (Point, Point); - -fn fst(r: rect) -> Point { let (fst, _) = r; return fst; } -fn snd(r: rect) -> Point { let (_, snd) = r; return snd; } - -fn f(r: rect, x1: isize, y1: isize, x2: isize, y2: isize) { - assert_eq!(fst(r).x, x1); - assert_eq!(fst(r).y, y1); - assert_eq!(snd(r).x, x2); - assert_eq!(snd(r).y, y2); -} - -pub fn main() { - let r: rect = (Point {x: 10, y: 20}, Point {x: 11, y: 22}); - assert_eq!(fst(r).x, 10); - assert_eq!(fst(r).y, 20); - assert_eq!(snd(r).x, 11); - assert_eq!(snd(r).y, 22); - let r2 = r; - let x: isize = fst(r2).x; - assert_eq!(x, 10); - f(r, 10, 20, 11, 22); - f(r2, 10, 20, 11, 22); -} diff --git a/src/test/ui/run-pass/structs-enums/rec.rs b/src/test/ui/run-pass/structs-enums/rec.rs deleted file mode 100644 index c8e8f81e085..00000000000 --- a/src/test/ui/run-pass/structs-enums/rec.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#[derive(Copy, Clone)] -struct Rect {x: isize, y: isize, w: isize, h: isize} - -fn f(r: Rect, x: isize, y: isize, w: isize, h: isize) { - assert_eq!(r.x, x); - assert_eq!(r.y, y); - assert_eq!(r.w, w); - assert_eq!(r.h, h); -} - -pub fn main() { - let r: Rect = Rect {x: 10, y: 20, w: 100, h: 200}; - assert_eq!(r.x, 10); - assert_eq!(r.y, 20); - assert_eq!(r.w, 100); - assert_eq!(r.h, 200); - let r2: Rect = r; - let x: isize = r2.x; - assert_eq!(x, 10); - f(r, 10, 20, 100, 200); - f(r2, 10, 20, 100, 200); -} diff --git a/src/test/ui/run-pass/structs-enums/record-pat.rs b/src/test/ui/run-pass/structs-enums/record-pat.rs deleted file mode 100644 index 966749b8354..00000000000 --- a/src/test/ui/run-pass/structs-enums/record-pat.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_shorthand_field_patterns)] - -enum t1 { a(isize), b(usize), } -struct T2 {x: t1, y: isize} -enum t3 { c(T2, usize), } - -fn m(input: t3) -> isize { - match input { - t3::c(T2 {x: t1::a(m), ..}, _) => { return m; } - t3::c(T2 {x: t1::b(m), y: y}, z) => { return ((m + z) as isize) + y; } - } -} - -pub fn main() { - assert_eq!(m(t3::c(T2 {x: t1::a(10), y: 5}, 4)), 10); - assert_eq!(m(t3::c(T2 {x: t1::b(10), y: 5}, 4)), 19); -} diff --git a/src/test/ui/run-pass/structs-enums/resource-in-struct.rs b/src/test/ui/run-pass/structs-enums/resource-in-struct.rs deleted file mode 100644 index e8ac8ed749c..00000000000 --- a/src/test/ui/run-pass/structs-enums/resource-in-struct.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Ensures that class dtors run if the object is inside an enum -// variant - -use std::cell::Cell; - -type closable<'a> = &'a Cell; - -struct close_res<'a> { - i: closable<'a>, - -} - -impl<'a> Drop for close_res<'a> { - fn drop(&mut self) { - self.i.set(false); - } -} - -fn close_res(i: closable) -> close_res { - close_res { - i: i - } -} - -enum option { none, some(T), } - -fn sink(_res: option) { } - -pub fn main() { - let c = &Cell::new(true); - sink(option::none); - sink(option::some(close_res(c))); - assert!(!c.get()); -} diff --git a/src/test/ui/run-pass/structs-enums/simple-generic-tag.rs b/src/test/ui/run-pass/structs-enums/simple-generic-tag.rs deleted file mode 100644 index be73224c7ec..00000000000 --- a/src/test/ui/run-pass/structs-enums/simple-generic-tag.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - -// pretty-expanded FIXME #23616 - -enum clam { a(T), } - -pub fn main() { } diff --git a/src/test/ui/run-pass/structs-enums/simple-match-generic-tag.rs b/src/test/ui/run-pass/structs-enums/simple-match-generic-tag.rs deleted file mode 100644 index 7093ba5138d..00000000000 --- a/src/test/ui/run-pass/structs-enums/simple-match-generic-tag.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -enum opt { none, some(T) } - -pub fn main() { - let x = opt::none::; - match x { - opt::none:: => { println!("hello world"); } - opt::some(_) => { } - } -} diff --git a/src/test/ui/run-pass/structs-enums/small-enum-range-edge.rs b/src/test/ui/run-pass/structs-enums/small-enum-range-edge.rs deleted file mode 100644 index 5b2a3ca3caf..00000000000 --- a/src/test/ui/run-pass/structs-enums/small-enum-range-edge.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// Tests the range assertion wraparound case when reading discriminants. - -#[repr(u8)] -#[derive(Copy, Clone)] -enum Eu { Lu = 0, Hu = 255 } - -static CLu: Eu = Eu::Lu; -static CHu: Eu = Eu::Hu; - -#[repr(i8)] -#[derive(Copy, Clone)] -enum Es { Ls = -128, Hs = 127 } - -static CLs: Es = Es::Ls; -static CHs: Es = Es::Hs; - -pub fn main() { - assert_eq!((Eu::Hu as u8).wrapping_add(1), Eu::Lu as u8); - assert_eq!((Es::Hs as i8).wrapping_add(1), Es::Ls as i8); - assert_eq!(CLu as u8, Eu::Lu as u8); - assert_eq!(CHu as u8, Eu::Hu as u8); - assert_eq!(CLs as i8, Es::Ls as i8); - assert_eq!(CHs as i8, Es::Hs as i8); -} diff --git a/src/test/ui/run-pass/structs-enums/small-enums-with-fields.rs b/src/test/ui/run-pass/structs-enums/small-enums-with-fields.rs deleted file mode 100644 index 9e4d4395695..00000000000 --- a/src/test/ui/run-pass/structs-enums/small-enums-with-fields.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::mem::size_of; - -#[derive(PartialEq, Debug)] -enum Either { Left(T), Right(U) } - -macro_rules! check { - ($t:ty, $sz:expr, $($e:expr, $s:expr),*) => {{ - assert_eq!(size_of::<$t>(), $sz); - $({ - static S: $t = $e; - let v: $t = $e; - assert_eq!(S, v); - assert_eq!(format!("{:?}", v), $s); - assert_eq!(format!("{:?}", S), $s); - });* - }} -} - -pub fn main() { - check!(Option, 2, - None, "None", - Some(129), "Some(129)"); - check!(Option, 4, - None, "None", - Some(-20000), "Some(-20000)"); - check!(Either, 2, - Either::Left(132), "Left(132)", - Either::Right(-32), "Right(-32)"); - check!(Either, 4, - Either::Left(132), "Left(132)", - Either::Right(-20000), "Right(-20000)"); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-aliases-xcrate.rs b/src/test/ui/run-pass/structs-enums/struct-aliases-xcrate.rs deleted file mode 100644 index b20173574cc..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-aliases-xcrate.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -// aux-build:xcrate_struct_aliases.rs - -extern crate xcrate_struct_aliases; - -use xcrate_struct_aliases::{S, S2}; - -fn main() { - let s = S2 { - x: 1, - y: 2, - }; - match s { - S2 { - x: x, - y: y - } => { - assert_eq!(x, 1); - assert_eq!(y, 2); - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/struct-aliases.rs b/src/test/ui/run-pass/structs-enums/struct-aliases.rs deleted file mode 100644 index 610c512628c..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-aliases.rs +++ /dev/null @@ -1,74 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -use std::mem; - -struct S { - x: isize, - y: isize, -} - -type S2 = S; - -struct S3 { - x: U, - y: V -} - -type S4 = S3; - -fn main() { - let s = S2 { - x: 1, - y: 2, - }; - match s { - S2 { - x: x, - y: y - } => { - assert_eq!(x, 1); - assert_eq!(y, 2); - } - } - // check that generics can be specified from the pattern - let s = S4 { - x: 4, - y: 'a' - }; - match s { - S4:: { - x: x, - y: y - } => { - assert_eq!(x, 4); - assert_eq!(y, 'a'); - assert_eq!(mem::size_of_val(&x), 1); - } - }; - // check that generics can be specified from the constructor - let s = S4:: { - x: 5, - y: 'b' - }; - match s { - S4 { - x: x, - y: y - } => { - assert_eq!(x, 5); - assert_eq!(y, 'b'); - assert_eq!(mem::size_of_val(&x), 2); - } - }; -} diff --git a/src/test/ui/run-pass/structs-enums/struct-destructuring-cross-crate.rs b/src/test/ui/run-pass/structs-enums/struct-destructuring-cross-crate.rs deleted file mode 100644 index cd746f986f1..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-destructuring-cross-crate.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:struct_destructuring_cross_crate.rs - - -extern crate struct_destructuring_cross_crate; - -pub fn main() { - let x = struct_destructuring_cross_crate::S { x: 1, y: 2 }; - let struct_destructuring_cross_crate::S { x: a, y: b } = x; - assert_eq!(a, 1); - assert_eq!(b, 2); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-field-shorthand.rs b/src/test/ui/run-pass/structs-enums/struct-field-shorthand.rs deleted file mode 100644 index 1f06cd889a4..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-field-shorthand.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - x: i32, - y: bool, - z: i32 -} - -struct Bar { - x: i32 -} - -pub fn main() { - let (x, y, z) = (1, true, 2); - let a = Foo { x, y: y, z }; - assert_eq!(a.x, x); - assert_eq!(a.y, y); - assert_eq!(a.z, z); - - let b = Bar { x, }; - assert_eq!(b.x, x); - - let c = Foo { z, y, x }; - assert_eq!(c.x, x); - assert_eq!(c.y, y); - assert_eq!(c.z, z); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-like-variant-construct.rs b/src/test/ui/run-pass/structs-enums/struct-like-variant-construct.rs deleted file mode 100644 index a970c1b0d78..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-like-variant-construct.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Foo { - Bar { - a: isize, - b: isize - }, - Baz { - c: f64, - d: f64 - } -} - -pub fn main() { - let _x = Foo::Bar { a: 2, b: 3 }; -} diff --git a/src/test/ui/run-pass/structs-enums/struct-like-variant-match.rs b/src/test/ui/run-pass/structs-enums/struct-like-variant-match.rs deleted file mode 100644 index 93539b45e23..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-like-variant-match.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -enum Foo { - Bar { - x: isize, - y: isize - }, - Baz { - x: f64, - y: f64 - } -} - -fn f(x: &Foo) { - match *x { - Foo::Baz { x: x, y: y } => { - assert_eq!(x, 1.0); - assert_eq!(y, 2.0); - } - Foo::Bar { y: y, x: x } => { - assert_eq!(x, 1); - assert_eq!(y, 2); - } - } -} - -pub fn main() { - let x = Foo::Bar { x: 1, y: 2 }; - f(&x); - let y = Foo::Baz { x: 1.0, y: 2.0 }; - f(&y); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-lit-functional-no-fields.rs b/src/test/ui/run-pass/structs-enums/struct-lit-functional-no-fields.rs deleted file mode 100644 index fc28c837adf..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-lit-functional-no-fields.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug,PartialEq,Clone)] -struct Foo { - bar: T, - baz: T -} - -pub fn main() { - let foo = Foo { - bar: 0, - baz: 1 - }; - - let foo_ = foo.clone(); - let foo = Foo { ..foo }; - assert_eq!(foo, foo_); - - let foo = Foo { - bar: "one".to_string(), - baz: "two".to_string() - }; - - let foo_ = foo.clone(); - let foo = Foo { ..foo }; - assert_eq!(foo, foo_); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-literal-dtor.rs b/src/test/ui/run-pass/structs-enums/struct-literal-dtor.rs deleted file mode 100644 index 032fcecb490..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-literal-dtor.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -struct foo { - x: String, -} - -impl Drop for foo { - fn drop(&mut self) { - println!("{}", self.x); - } -} - -pub fn main() { - let _z = foo { - x: "Hello".to_string() - }; -} diff --git a/src/test/ui/run-pass/structs-enums/struct-new-as-field-name.rs b/src/test/ui/run-pass/structs-enums/struct-new-as-field-name.rs deleted file mode 100644 index 8f2bcbcf620..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-new-as-field-name.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo { - new: isize, -} - -pub fn main() { - let foo = Foo{ new: 3 }; - assert_eq!(foo.new, 3); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-1.rs b/src/test/ui/run-pass/structs-enums/struct-order-of-eval-1.rs deleted file mode 100644 index 1e674cb8970..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-1.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct S { f0: String, f1: isize } - -pub fn main() { - let s = "Hello, world!".to_string(); - let s = S { - f0: s.to_string(), - ..S { - f0: s, - f1: 23 - } - }; - assert_eq!(s.f0, "Hello, world!"); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-2.rs b/src/test/ui/run-pass/structs-enums/struct-order-of-eval-2.rs deleted file mode 100644 index c054f31beae..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-2.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct S { - f0: String, - f1: String, -} - -pub fn main() { - let s = "Hello, world!".to_string(); - let s = S { - f1: s.to_string(), - f0: s - }; - assert_eq!(s.f0, "Hello, world!"); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-3.rs b/src/test/ui/run-pass/structs-enums/struct-order-of-eval-3.rs deleted file mode 100644 index 30f8a0dfe57..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-3.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Checks that functional-record-update order-of-eval is as expected -// even when no Drop-implementations are involved. - -use std::sync::atomic::{Ordering, AtomicUsize}; - -struct W { wrapped: u32 } -struct S { f0: W, _f1: i32 } - -pub fn main() { - const VAL: u32 = 0x89AB_CDEF; - let w = W { wrapped: VAL }; - let s = S { - f0: { event(0x01); W { wrapped: w.wrapped + 1 } }, - ..S { - f0: { event(0x02); w}, - _f1: 23 - } - }; - assert_eq!(s.f0.wrapped, VAL + 1); - let actual = event_log(); - let expect = 0x01_02; - assert!(expect == actual, - "expect: 0x{:x} actual: 0x{:x}", expect, actual); -} - -static LOG: AtomicUsize = AtomicUsize::new(0); - -fn event_log() -> usize { - LOG.load(Ordering::SeqCst) -} - -fn event(tag: u8) { - let old_log = LOG.load(Ordering::SeqCst); - let new_log = (old_log << 8) + tag as usize; - LOG.store(new_log, Ordering::SeqCst); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-4.rs b/src/test/ui/run-pass/structs-enums/struct-order-of-eval-4.rs deleted file mode 100644 index 8a436890f92..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-order-of-eval-4.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Checks that struct-literal expression order-of-eval is as expected -// even when no Drop-implementations are involved. - -use std::sync::atomic::{Ordering, AtomicUsize}; - -struct W { wrapped: u32 } -struct S { f0: W, _f1: i32 } - -pub fn main() { - const VAL: u32 = 0x89AB_CDEF; - let w = W { wrapped: VAL }; - let s = S { - _f1: { event(0x01); 23 }, - f0: { event(0x02); w }, - }; - assert_eq!(s.f0.wrapped, VAL); - let actual = event_log(); - let expect = 0x01_02; - assert!(expect == actual, - "expect: 0x{:x} actual: 0x{:x}", expect, actual); -} - -static LOG: AtomicUsize = AtomicUsize::new(0); - -fn event_log() -> usize { - LOG.load(Ordering::SeqCst) -} - -fn event(tag: u8) { - let old_log = LOG.load(Ordering::SeqCst); - let new_log = (old_log << 8) + tag as usize; - LOG.store(new_log, Ordering::SeqCst); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-partial-move-1.rs b/src/test/ui/run-pass/structs-enums/struct-partial-move-1.rs deleted file mode 100644 index 546bd699777..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-partial-move-1.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -pub struct Partial { x: T, y: T } - -#[derive(PartialEq, Debug)] -struct S { val: isize } -impl S { fn new(v: isize) -> S { S { val: v } } } -impl Drop for S { fn drop(&mut self) { } } - -pub fn f((b1, b2): (T, T), mut f: F) -> Partial where F: FnMut(T) -> T { - let p = Partial { x: b1, y: b2 }; - - // Move of `p` is legal even though we are also moving `p.y`; the - // `..p` moves all fields *except* `p.y` in this context. - Partial { y: f(p.y), ..p } -} - -pub fn main() { - let p = f((S::new(3), S::new(4)), |S { val: z }| S::new(z+1)); - assert_eq!(p, Partial { x: S::new(3), y: S::new(5) }); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-partial-move-2.rs b/src/test/ui/run-pass/structs-enums/struct-partial-move-2.rs deleted file mode 100644 index c8a9527cc96..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-partial-move-2.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -pub struct Partial { x: T, y: T } - -#[derive(PartialEq, Debug)] -struct S { val: isize } -impl S { fn new(v: isize) -> S { S { val: v } } } -impl Drop for S { fn drop(&mut self) { } } - -pub type Two = (Partial, Partial); - -pub fn f((b1, b2): (T, T), (b3, b4): (T, T), mut f: F) -> Two where F: FnMut(T) -> T { - let p = Partial { x: b1, y: b2 }; - let q = Partial { x: b3, y: b4 }; - - // Move of `q` is legal even though we have already moved `q.y`; - // the `..q` moves all fields *except* `q.y` in this context. - // Likewise, the move of `p.x` is legal for similar reasons. - (Partial { x: f(q.y), ..p }, Partial { y: f(p.x), ..q }) -} - -pub fn main() { - let two = f((S::new(1), S::new(3)), - (S::new(5), S::new(7)), - |S { val: z }| S::new(z+1)); - assert_eq!(two, (Partial { x: S::new(8), y: S::new(3) }, - Partial { x: S::new(5), y: S::new(2) })); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-path-associated-type.rs b/src/test/ui/run-pass/structs-enums/struct-path-associated-type.rs deleted file mode 100644 index 868be134121..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-path-associated-type.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct S { - a: T, - b: U, -} - -trait Tr { - type A; -} -impl Tr for u8 { - type A = S; -} - -fn f>>() { - let s = T::A { a: 0, b: 1 }; - match s { - T::A { a, b } => { - assert_eq!(a, 0); - assert_eq!(b, 1); - } - } -} - -fn main() { - f::(); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-path-self.rs b/src/test/ui/run-pass/structs-enums/struct-path-self.rs deleted file mode 100644 index 9163569f9c1..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-path-self.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::Add; - -struct S { - a: T, - b: U, -} - -trait Tr { - fn f(&self) -> Self; -} - -impl, U: Default> Tr for S { - fn f(&self) -> Self { - let s = Self { a: Default::default(), b: Default::default() }; - match s { - Self { a, b } => Self { a: a + 1, b: b } - } - } -} - -impl> S { - fn g(&self) -> Self { - let s = Self { a: Default::default(), b: Default::default() }; - match s { - Self { a, b } => Self { a: a, b: b + 1 } - } - } -} - -impl S { - fn new() -> Self { - Self { a: 0, b: 1 } - } -} - -fn main() { - let s0 = S::new(); - let s1 = s0.f(); - assert_eq!(s1.a, 1); - assert_eq!(s1.b, 0); - let s2 = s0.g(); - assert_eq!(s2.a, 0); - assert_eq!(s2.b, 1); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-pattern-matching.rs b/src/test/ui/run-pass/structs-enums/struct-pattern-matching.rs deleted file mode 100644 index c6f769706a6..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-pattern-matching.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_shorthand_field_patterns)] - -struct Foo { - x: isize, - y: isize, -} - -pub fn main() { - let a = Foo { x: 1, y: 2 }; - match a { - Foo { x: x, y: y } => println!("yes, {}, {}", x, y) - } - - match a { - Foo { .. } => () - } -} diff --git a/src/test/ui/run-pass/structs-enums/struct-return.rs b/src/test/ui/run-pass/structs-enums/struct-return.rs deleted file mode 100644 index a2b380c7e18..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-return.rs +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-wasm32-bare no libc to test ffi with - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct Quad { a: u64, b: u64, c: u64, d: u64 } - -#[repr(C)] -#[derive(Copy, Clone)] -pub struct Floats { a: f64, b: u8, c: f64 } - -mod rustrt { - use super::{Floats, Quad}; - - #[link(name = "rust_test_helpers", kind = "static")] - extern { - pub fn rust_dbg_abi_1(q: Quad) -> Quad; - pub fn rust_dbg_abi_2(f: Floats) -> Floats; - } -} - -fn test1() { - unsafe { - let q = Quad { a: 0xaaaa_aaaa_aaaa_aaaa, - b: 0xbbbb_bbbb_bbbb_bbbb, - c: 0xcccc_cccc_cccc_cccc, - d: 0xdddd_dddd_dddd_dddd }; - let qq = rustrt::rust_dbg_abi_1(q); - println!("a: {:x}", qq.a as usize); - println!("b: {:x}", qq.b as usize); - println!("c: {:x}", qq.c as usize); - println!("d: {:x}", qq.d as usize); - assert_eq!(qq.a, q.c + 1); - assert_eq!(qq.b, q.d - 1); - assert_eq!(qq.c, q.a + 1); - assert_eq!(qq.d, q.b - 1); - } -} - -#[cfg(target_pointer_width = "64")] -fn test2() { - unsafe { - let f = Floats { a: 1.234567890e-15_f64, - b: 0b_1010_1010, - c: 1.0987654321e-15_f64 }; - let ff = rustrt::rust_dbg_abi_2(f); - println!("a: {}", ff.a as f64); - println!("b: {}", ff.b as usize); - println!("c: {}", ff.c as f64); - assert_eq!(ff.a, f.c + 1.0f64); - assert_eq!(ff.b, 0xff); - assert_eq!(ff.c, f.a - 1.0f64); - } -} - -#[cfg(target_pointer_width = "32")] -fn test2() { -} - -pub fn main() { - test1(); - test2(); -} diff --git a/src/test/ui/run-pass/structs-enums/struct-variant-field-visibility.rs b/src/test/ui/run-pass/structs-enums/struct-variant-field-visibility.rs deleted file mode 100644 index 4b7854145f0..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct-variant-field-visibility.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -mod foo { - pub enum Foo { - Bar { a: isize } - } -} - -fn f(f: foo::Foo) { - match f { - foo::Foo::Bar { a: _a } => {} - } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/struct_variant_xc.rs b/src/test/ui/run-pass/structs-enums/struct_variant_xc.rs deleted file mode 100644 index 82881f6b348..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct_variant_xc.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:struct_variant_xc_aux.rs -// pretty-expanded FIXME #23616 - -extern crate struct_variant_xc_aux; - -use struct_variant_xc_aux::Enum::StructVariant; - -pub fn main() { - let _ = StructVariant { arg: 1 }; -} diff --git a/src/test/ui/run-pass/structs-enums/struct_variant_xc_match.rs b/src/test/ui/run-pass/structs-enums/struct_variant_xc_match.rs deleted file mode 100644 index 55b3b1018e9..00000000000 --- a/src/test/ui/run-pass/structs-enums/struct_variant_xc_match.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:struct_variant_xc_aux.rs - -extern crate struct_variant_xc_aux; - -use struct_variant_xc_aux::Enum::{StructVariant, Variant}; - -pub fn main() { - let arg = match (StructVariant { arg: 42 }) { - Variant(_) => unreachable!(), - StructVariant { arg } => arg - }; - assert_eq!(arg, 42); -} diff --git a/src/test/ui/run-pass/structs-enums/tag-align-dyn-u64.rs b/src/test/ui/run-pass/structs-enums/tag-align-dyn-u64.rs deleted file mode 100644 index a7f7841fac8..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-align-dyn-u64.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -use std::mem; - -enum Tag { - Tag2(A) -} - -struct Rec { - c8: u8, - t: Tag -} - -fn mk_rec() -> Rec { - return Rec { c8:0, t:Tag::Tag2(0) }; -} - -fn is_u64_aligned(u: &Tag) -> bool { - let p: usize = unsafe { mem::transmute(u) }; - let u64_align = std::mem::min_align_of::(); - return (p & (u64_align - 1)) == 0; -} - -pub fn main() { - let x = mk_rec(); - assert!(is_u64_aligned(&x.t)); -} diff --git a/src/test/ui/run-pass/structs-enums/tag-align-dyn-variants.rs b/src/test/ui/run-pass/structs-enums/tag-align-dyn-variants.rs deleted file mode 100644 index cbba62d156b..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-align-dyn-variants.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] -#![allow(non_snake_case)] - -use std::mem; - -enum Tag { - VarA(A), - VarB(B), -} - -struct Rec { - chA: u8, - tA: Tag, - chB: u8, - tB: Tag, -} - -fn mk_rec(a: A, b: B) -> Rec { - Rec { chA:0, tA:Tag::VarA(a), chB:1, tB:Tag::VarB(b) } -} - -fn is_aligned(amnt: usize, u: &A) -> bool { - let p: usize = unsafe { mem::transmute(u) }; - return (p & (amnt-1)) == 0; -} - -fn variant_data_is_aligned(amnt: usize, u: &Tag) -> bool { - match u { - &Tag::VarA(ref a) => is_aligned(amnt, a), - &Tag::VarB(ref b) => is_aligned(amnt, b) - } -} - -pub fn main() { - let u64_align = std::mem::min_align_of::(); - let x = mk_rec(22u64, 23u64); - assert!(is_aligned(u64_align, &x.tA)); - assert!(variant_data_is_aligned(u64_align, &x.tA)); - assert!(is_aligned(u64_align, &x.tB)); - assert!(variant_data_is_aligned(u64_align, &x.tB)); - - let x = mk_rec(22u64, 23u32); - assert!(is_aligned(u64_align, &x.tA)); - assert!(variant_data_is_aligned(u64_align, &x.tA)); - assert!(is_aligned(u64_align, &x.tB)); - assert!(variant_data_is_aligned(4, &x.tB)); - - let x = mk_rec(22u32, 23u64); - assert!(is_aligned(u64_align, &x.tA)); - assert!(variant_data_is_aligned(4, &x.tA)); - assert!(is_aligned(u64_align, &x.tB)); - assert!(variant_data_is_aligned(u64_align, &x.tB)); - - let x = mk_rec(22u32, 23u32); - assert!(is_aligned(4, &x.tA)); - assert!(variant_data_is_aligned(4, &x.tA)); - assert!(is_aligned(4, &x.tB)); - assert!(variant_data_is_aligned(4, &x.tB)); - - let x = mk_rec(22f64, 23f64); - assert!(is_aligned(u64_align, &x.tA)); - assert!(variant_data_is_aligned(u64_align, &x.tA)); - assert!(is_aligned(u64_align, &x.tB)); - assert!(variant_data_is_aligned(u64_align, &x.tB)); -} diff --git a/src/test/ui/run-pass/structs-enums/tag-align-shape.rs b/src/test/ui/run-pass/structs-enums/tag-align-shape.rs deleted file mode 100644 index 1aff17f77d4..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-align-shape.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#[derive(Debug)] -enum a_tag { - a_tag_var(u64) -} - -#[derive(Debug)] -struct t_rec { - c8: u8, - t: a_tag -} - -pub fn main() { - let x = t_rec {c8: 22, t: a_tag::a_tag_var(44)}; - let y = format!("{:?}", x); - println!("y = {:?}", y); - assert_eq!(y, "t_rec { c8: 22, t: a_tag_var(44) }".to_string()); -} diff --git a/src/test/ui/run-pass/structs-enums/tag-align-u64.rs b/src/test/ui/run-pass/structs-enums/tag-align-u64.rs deleted file mode 100644 index 9f6349a23ad..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-align-u64.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(deprecated)] - -use std::mem; - -enum Tag { - TagInner(u64) -} - -struct Rec { - c8: u8, - t: Tag -} - -fn mk_rec() -> Rec { - return Rec { c8:0, t:Tag::TagInner(0) }; -} - -fn is_u64_aligned(u: &Tag) -> bool { - let p: usize = unsafe { mem::transmute(u) }; - let u64_align = std::mem::min_align_of::(); - return (p & (u64_align - 1)) == 0; -} - -pub fn main() { - let x = mk_rec(); - assert!(is_u64_aligned(&x.t)); -} diff --git a/src/test/ui/run-pass/structs-enums/tag-disr-val-shape.rs b/src/test/ui/run-pass/structs-enums/tag-disr-val-shape.rs deleted file mode 100644 index bfc3213a040..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-disr-val-shape.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#[derive(Debug)] -enum color { - red = 0xff0000, - green = 0x00ff00, - blue = 0x0000ff, - black = 0x000000, - white = 0xFFFFFF, -} - -pub fn main() { - let act = format!("{:?}", color::red); - println!("{}", act); - assert_eq!("red".to_string(), act); - assert_eq!("green".to_string(), format!("{:?}", color::green)); - assert_eq!("white".to_string(), format!("{:?}", color::white)); -} diff --git a/src/test/ui/run-pass/structs-enums/tag-exports.rs b/src/test/ui/run-pass/structs-enums/tag-exports.rs deleted file mode 100644 index d0eea7bdcd2..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-exports.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -use alder::*; - -mod alder { - pub enum burnside { couch, davis } - pub enum everett { flanders, glisan, hoyt } - pub enum irving { johnson, kearney, lovejoy } - pub enum marshall { northrup, overton } -} - -pub fn main() { - let _pettygrove: burnside = burnside::couch; - let _quimby: everett = everett::flanders; - let _raleigh: irving = irving::johnson; - let _savier: marshall; -} diff --git a/src/test/ui/run-pass/structs-enums/tag-in-block.rs b/src/test/ui/run-pass/structs-enums/tag-in-block.rs deleted file mode 100644 index db9b2c3b60c..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-in-block.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - -// pretty-expanded FIXME #23616 - -fn foo() { - fn zed(_z: bar) { } - enum bar { nil, } - fn baz() { zed(bar::nil); } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs b/src/test/ui/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs deleted file mode 100644 index 085d0bc1fdc..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum color { - red = 1, - blue = 2, -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/tag-variant-disr-val.rs b/src/test/ui/run-pass/structs-enums/tag-variant-disr-val.rs deleted file mode 100644 index 9f82faad158..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag-variant-disr-val.rs +++ /dev/null @@ -1,76 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use color::{red, green, blue, black, white, imaginary, purple, orange}; - -#[derive(Copy, Clone)] -enum color { - red = 0xff0000, - green = 0x00ff00, - blue = 0x0000ff, - black = 0x000000, - white = 0xFFFFFF, - imaginary = -1, - purple = 1 << 1, - orange = 8 >> 1 -} - -impl PartialEq for color { - fn eq(&self, other: &color) -> bool { - ((*self) as usize) == ((*other) as usize) - } - fn ne(&self, other: &color) -> bool { !(*self).eq(other) } -} - -pub fn main() { - test_color(red, 0xff0000, "red".to_string()); - test_color(green, 0x00ff00, "green".to_string()); - test_color(blue, 0x0000ff, "blue".to_string()); - test_color(black, 0x000000, "black".to_string()); - test_color(white, 0xFFFFFF, "white".to_string()); - test_color(imaginary, -1, "imaginary".to_string()); - test_color(purple, 2, "purple".to_string()); - test_color(orange, 4, "orange".to_string()); -} - -fn test_color(color: color, val: isize, name: String) { - //assert_eq!(unsafe::transmute(color), val); - assert_eq!(color as isize, val); - assert_eq!(get_color_alt(color), name); - assert_eq!(get_color_if(color), name); -} - -fn get_color_alt(color: color) -> String { - match color { - red => {"red".to_string()} - green => {"green".to_string()} - blue => {"blue".to_string()} - black => {"black".to_string()} - white => {"white".to_string()} - imaginary => {"imaginary".to_string()} - purple => {"purple".to_string()} - orange => {"orange".to_string()} - } -} - -fn get_color_if(color: color) -> String { - if color == red {"red".to_string()} - else if color == green {"green".to_string()} - else if color == blue {"blue".to_string()} - else if color == black {"black".to_string()} - else if color == white {"white".to_string()} - else if color == imaginary {"imaginary".to_string()} - else if color == purple {"purple".to_string()} - else if color == orange {"orange".to_string()} - else {"unknown".to_string()} -} diff --git a/src/test/ui/run-pass/structs-enums/tag.rs b/src/test/ui/run-pass/structs-enums/tag.rs deleted file mode 100644 index bd28320ffb6..00000000000 --- a/src/test/ui/run-pass/structs-enums/tag.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -enum colour { red(isize, isize), green, } - -impl PartialEq for colour { - fn eq(&self, other: &colour) -> bool { - match *self { - colour::red(a0, b0) => { - match (*other) { - colour::red(a1, b1) => a0 == a1 && b0 == b1, - colour::green => false, - } - } - colour::green => { - match (*other) { - colour::red(..) => false, - colour::green => true - } - } - } - } - fn ne(&self, other: &colour) -> bool { !(*self).eq(other) } -} - -fn f() { let x = colour::red(1, 2); let y = colour::green; assert!((x != y)); } - -pub fn main() { f(); } diff --git a/src/test/ui/run-pass/structs-enums/tuple-struct-construct.rs b/src/test/ui/run-pass/structs-enums/tuple-struct-construct.rs deleted file mode 100644 index 58bed9d6b93..00000000000 --- a/src/test/ui/run-pass/structs-enums/tuple-struct-construct.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(Debug)] -struct Foo(isize, isize); - -pub fn main() { - let x = Foo(1, 2); - println!("{:?}", x); -} diff --git a/src/test/ui/run-pass/structs-enums/tuple-struct-constructor-pointer.rs b/src/test/ui/run-pass/structs-enums/tuple-struct-constructor-pointer.rs deleted file mode 100644 index a4b5e41fdf5..00000000000 --- a/src/test/ui/run-pass/structs-enums/tuple-struct-constructor-pointer.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#[derive(PartialEq, Debug)] -struct Foo(isize); -#[derive(PartialEq, Debug)] -struct Bar(isize, isize); - -pub fn main() { - let f: fn(isize) -> Foo = Foo; - let g: fn(isize, isize) -> Bar = Bar; - assert_eq!(f(42), Foo(42)); - assert_eq!(g(4, 7), Bar(4, 7)); -} diff --git a/src/test/ui/run-pass/structs-enums/tuple-struct-destructuring.rs b/src/test/ui/run-pass/structs-enums/tuple-struct-destructuring.rs deleted file mode 100644 index cf2940e796f..00000000000 --- a/src/test/ui/run-pass/structs-enums/tuple-struct-destructuring.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo(isize, isize); - -pub fn main() { - let x = Foo(1, 2); - let Foo(y, z) = x; - println!("{} {}", y, z); - assert_eq!(y, 1); - assert_eq!(z, 2); -} diff --git a/src/test/ui/run-pass/structs-enums/tuple-struct-matching.rs b/src/test/ui/run-pass/structs-enums/tuple-struct-matching.rs deleted file mode 100644 index 95ade509c0e..00000000000 --- a/src/test/ui/run-pass/structs-enums/tuple-struct-matching.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo(isize, isize); - -pub fn main() { - let x = Foo(1, 2); - match x { - Foo(a, b) => { - assert_eq!(a, 1); - assert_eq!(b, 2); - println!("{} {}", a, b); - } - } -} diff --git a/src/test/ui/run-pass/structs-enums/tuple-struct-trivial.rs b/src/test/ui/run-pass/structs-enums/tuple-struct-trivial.rs deleted file mode 100644 index d77d9c7e163..00000000000 --- a/src/test/ui/run-pass/structs-enums/tuple-struct-trivial.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Foo(isize, isize, isize); - -pub fn main() { -} diff --git a/src/test/ui/run-pass/structs-enums/uninstantiable-struct.rs b/src/test/ui/run-pass/structs-enums/uninstantiable-struct.rs deleted file mode 100644 index 8706333c743..00000000000 --- a/src/test/ui/run-pass/structs-enums/uninstantiable-struct.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub struct Z(&'static Z); - -pub fn main() {} diff --git a/src/test/ui/run-pass/structs-enums/unit-like-struct-drop-run.rs b/src/test/ui/run-pass/structs-enums/unit-like-struct-drop-run.rs deleted file mode 100644 index 1e1605b7be6..00000000000 --- a/src/test/ui/run-pass/structs-enums/unit-like-struct-drop-run.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -// Make sure the destructor is run for unit-like structs. - - -#![feature(alloc)] - -use std::thread; - -struct Foo; - -impl Drop for Foo { - fn drop(&mut self) { - panic!("This panic should happen."); - } -} - -pub fn main() { - let x = thread::spawn(move|| { - let _b = Foo; - }).join(); - - let s = x.unwrap_err().downcast::<&'static str>().unwrap(); - assert_eq!(&**s, "This panic should happen."); -} diff --git a/src/test/ui/run-pass/structs-enums/unit-like-struct.rs b/src/test/ui/run-pass/structs-enums/unit-like-struct.rs deleted file mode 100644 index 1a2a4fbbf5f..00000000000 --- a/src/test/ui/run-pass/structs-enums/unit-like-struct.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo; - -pub fn main() { - let x: Foo = Foo; - match x { - Foo => { println!("hi"); } - } -} diff --git a/src/test/ui/run-pass/structs-enums/variant-structs-trivial.rs b/src/test/ui/run-pass/structs-enums/variant-structs-trivial.rs deleted file mode 100644 index 9cef1c83476..00000000000 --- a/src/test/ui/run-pass/structs-enums/variant-structs-trivial.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -enum Foo { - Bar { x: isize }, - Baz { y: isize } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/thinlto/all-crates.rs b/src/test/ui/run-pass/thinlto/all-crates.rs deleted file mode 100644 index c10b5cc96d6..00000000000 --- a/src/test/ui/run-pass/thinlto/all-crates.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags: -Clto=thin -// no-prefer-dynamic - -fn main() { - println!("hello!"); -} diff --git a/src/test/ui/run-pass/thinlto/auxiliary/dylib.rs b/src/test/ui/run-pass/thinlto/auxiliary/dylib.rs deleted file mode 100644 index cdb3f49cae8..00000000000 --- a/src/test/ui/run-pass/thinlto/auxiliary/dylib.rs +++ /dev/null @@ -1,16 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// compile-flags: -Z thinlto -C codegen-units=8 - -#[inline] -pub fn foo(b: u8) { - b.to_string(); -} diff --git a/src/test/ui/run-pass/thinlto/auxiliary/msvc-imp-present.rs b/src/test/ui/run-pass/thinlto/auxiliary/msvc-imp-present.rs deleted file mode 100644 index eff7802a245..00000000000 --- a/src/test/ui/run-pass/thinlto/auxiliary/msvc-imp-present.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic -// compile-flags: -Z thinlto -C codegen-units=8 -C prefer-dynamic - -#![crate_type = "rlib"] -#![crate_type = "dylib"] - -pub static A: u32 = 43; - -pub mod a { - pub static A: u32 = 43; -} diff --git a/src/test/ui/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs b/src/test/ui/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs deleted file mode 100644 index ccbb0e7a718..00000000000 --- a/src/test/ui/run-pass/thinlto/auxiliary/thin-lto-inlines-aux.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// no-prefer-dynamic - -#![crate_type = "rlib"] - -pub fn bar() -> u32 { - 3 -} diff --git a/src/test/ui/run-pass/thinlto/dylib-works.rs b/src/test/ui/run-pass/thinlto/dylib-works.rs deleted file mode 100644 index fc8c0db2e26..00000000000 --- a/src/test/ui/run-pass/thinlto/dylib-works.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:dylib.rs - -extern crate dylib; - -fn main() { - dylib::foo(1); -} diff --git a/src/test/ui/run-pass/thinlto/msvc-imp-present.rs b/src/test/ui/run-pass/thinlto/msvc-imp-present.rs deleted file mode 100644 index 47fc00c79a7..00000000000 --- a/src/test/ui/run-pass/thinlto/msvc-imp-present.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:msvc-imp-present.rs -// compile-flags: -Z thinlto -C codegen-units=8 -// no-prefer-dynamic - -// On MSVC we have a "hack" where we emit symbols that look like `_imp_$name` -// for all exported statics. This is done because we apply `dllimport` to all -// imported constants and this allows everything to actually link correctly. -// -// The ThinLTO passes aggressively remove symbols if they can, and this test -// asserts that the ThinLTO passes don't remove these compiler-generated -// `_imp_*` symbols. The external library that we link in here is compiled with -// ThinLTO and multiple codegen units and has a few exported constants. Note -// that we also namely compile the library as both a dylib and an rlib, but we -// link the rlib to ensure that we assert those generated symbols exist. - -extern crate msvc_imp_present as bar; - -fn main() { - println!("{}", bar::A); -} diff --git a/src/test/ui/run-pass/thinlto/thin-lto-inlines.rs b/src/test/ui/run-pass/thinlto/thin-lto-inlines.rs deleted file mode 100644 index 68b9ab76985..00000000000 --- a/src/test/ui/run-pass/thinlto/thin-lto-inlines.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags: -Z thinlto -C codegen-units=8 -O -// ignore-emscripten can't inspect instructions on emscripten - -// We want to assert here that ThinLTO will inline across codegen units. There's -// not really a great way to do that in general so we sort of hack around it by -// praying two functions go into separate codegen units and then assuming that -// if inlining *doesn't* happen the first byte of the functions will differ. - -pub fn foo() -> u32 { - bar::bar() -} - -mod bar { - pub fn bar() -> u32 { - 3 - } -} - -fn main() { - println!("{} {}", foo(), bar::bar()); - - unsafe { - let foo = foo as usize as *const u8; - let bar = bar::bar as usize as *const u8; - - assert_eq!(*foo, *bar); - } -} diff --git a/src/test/ui/run-pass/thinlto/thin-lto-inlines2.rs b/src/test/ui/run-pass/thinlto/thin-lto-inlines2.rs deleted file mode 100644 index 84809b09785..00000000000 --- a/src/test/ui/run-pass/thinlto/thin-lto-inlines2.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags: -C codegen-units=8 -O -C lto=thin -// aux-build:thin-lto-inlines-aux.rs -// no-prefer-dynamic -// ignore-emscripten can't inspect instructions on emscripten - -// We want to assert here that ThinLTO will inline across codegen units. There's -// not really a great way to do that in general so we sort of hack around it by -// praying two functions go into separate codegen units and then assuming that -// if inlining *doesn't* happen the first byte of the functions will differ. - -extern crate thin_lto_inlines_aux as bar; - -pub fn foo() -> u32 { - bar::bar() -} - -fn main() { - println!("{} {}", foo(), bar::bar()); - - unsafe { - let foo = foo as usize as *const u8; - let bar = bar::bar as usize as *const u8; - - assert_eq!(*foo, *bar); - } -} - diff --git a/src/test/ui/run-pass/thinlto/weak-works.rs b/src/test/ui/run-pass/thinlto/weak-works.rs deleted file mode 100644 index 51516ae87ab..00000000000 --- a/src/test/ui/run-pass/thinlto/weak-works.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// compile-flags: -C codegen-units=8 -Z thinlto -// ignore-windows - -#![feature(linkage)] - -pub mod foo { - #[linkage = "weak"] - #[no_mangle] - pub extern "C" fn FOO() -> i32 { - 0 - } -} - -mod bar { - extern "C" { - fn FOO() -> i32; - } - - pub fn bar() -> i32 { - unsafe { FOO() } - } -} - -fn main() { - bar::bar(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs b/src/test/ui/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs deleted file mode 100644 index e9457886be8..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/auxiliary/thread-local-extern-static.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(cfg_target_thread_local, const_fn, thread_local)] -#![crate_type = "lib"] - -#[cfg(target_thread_local)] -use std::cell::Cell; - -#[no_mangle] -#[cfg(target_thread_local)] -#[thread_local] -pub static FOO: Cell = Cell::new(3); diff --git a/src/test/ui/run-pass/threads-sendsync/comm.rs b/src/test/ui/run-pass/threads-sendsync/comm.rs deleted file mode 100644 index 7a8e27ca20b..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/comm.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -pub fn main() { - let (tx, rx) = channel(); - let t = thread::spawn(move|| { child(&tx) }); - let y = rx.recv().unwrap(); - println!("received"); - println!("{}", y); - assert_eq!(y, 10); - t.join(); -} - -fn child(c: &Sender) { - println!("sending"); - c.send(10).unwrap(); - println!("value sent"); -} diff --git a/src/test/ui/run-pass/threads-sendsync/send-is-not-static-par-for.rs b/src/test/ui/run-pass/threads-sendsync/send-is-not-static-par-for.rs deleted file mode 100644 index 00a7acfa94f..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/send-is-not-static-par-for.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::thread; -use std::sync::Mutex; - -fn par_for(iter: I, f: F) - where I: Iterator, - I::Item: Send, - F: Fn(I::Item) + Sync -{ - for item in iter { - f(item) - } -} - -fn sum(x: &[i32]) { - let sum_lengths = Mutex::new(0); - par_for(x.windows(4), |x| { - *sum_lengths.lock().unwrap() += x.len() - }); - - assert_eq!(*sum_lengths.lock().unwrap(), (x.len() - 3) * 4); -} - -fn main() { - let mut elements = [0; 20]; - - // iterators over references into this stack frame - par_for(elements.iter_mut().enumerate(), |(i, x)| { - *x = i as i32 - }); - - sum(&elements) -} diff --git a/src/test/ui/run-pass/threads-sendsync/send-resource.rs b/src/test/ui/run-pass/threads-sendsync/send-resource.rs deleted file mode 100644 index be671084c84..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/send-resource.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::channel; - -struct test { - f: isize, -} - -impl Drop for test { - fn drop(&mut self) {} -} - -fn test(f: isize) -> test { - test { - f: f - } -} - -pub fn main() { - let (tx, rx) = channel(); - - let t = thread::spawn(move|| { - let (tx2, rx2) = channel(); - tx.send(tx2).unwrap(); - - let _r = rx2.recv().unwrap(); - }); - - rx.recv().unwrap().send(test(42)).unwrap(); - - t.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/send-type-inference.rs b/src/test/ui/run-pass/threads-sendsync/send-type-inference.rs deleted file mode 100644 index e1aaf6d220e..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/send-type-inference.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::sync::mpsc::{channel, Sender}; - -// tests that ctrl's type gets inferred properly -struct Command { - key: K, - val: V -} - -fn cache_server(mut tx: Sender>>) { - let (tx1, _rx) = channel(); - tx.send(tx1); -} -pub fn main() { } diff --git a/src/test/ui/run-pass/threads-sendsync/send_str_hashmap.rs b/src/test/ui/run-pass/threads-sendsync/send_str_hashmap.rs deleted file mode 100644 index 9c165a2b83d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/send_str_hashmap.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::HashMap; -use std::borrow::Cow; - -use std::borrow::Cow::Borrowed as B; -use std::borrow::Cow::Owned as O; - -type SendStr = Cow<'static, str>; - -fn main() { - let mut map: HashMap = HashMap::new(); - assert!(map.insert(B("foo"), 42).is_none()); - assert!(map.insert(O("foo".to_string()), 42).is_some()); - assert!(map.insert(B("foo"), 42).is_some()); - assert!(map.insert(O("foo".to_string()), 42).is_some()); - - assert!(map.insert(B("foo"), 43).is_some()); - assert!(map.insert(O("foo".to_string()), 44).is_some()); - assert!(map.insert(B("foo"), 45).is_some()); - assert!(map.insert(O("foo".to_string()), 46).is_some()); - - let v = 46; - - assert_eq!(map.get(&O("foo".to_string())), Some(&v)); - assert_eq!(map.get(&B("foo")), Some(&v)); - - let (a, b, c, d) = (50, 51, 52, 53); - - assert!(map.insert(B("abc"), a).is_none()); - assert!(map.insert(O("bcd".to_string()), b).is_none()); - assert!(map.insert(B("cde"), c).is_none()); - assert!(map.insert(O("def".to_string()), d).is_none()); - - assert!(map.insert(B("abc"), a).is_some()); - assert!(map.insert(O("bcd".to_string()), b).is_some()); - assert!(map.insert(B("cde"), c).is_some()); - assert!(map.insert(O("def".to_string()), d).is_some()); - - assert!(map.insert(O("abc".to_string()), a).is_some()); - assert!(map.insert(B("bcd"), b).is_some()); - assert!(map.insert(O("cde".to_string()), c).is_some()); - assert!(map.insert(B("def"), d).is_some()); - - assert_eq!(map.get("abc"), Some(&a)); - assert_eq!(map.get("bcd"), Some(&b)); - assert_eq!(map.get("cde"), Some(&c)); - assert_eq!(map.get("def"), Some(&d)); - - assert_eq!(map.get(&B("abc")), Some(&a)); - assert_eq!(map.get(&B("bcd")), Some(&b)); - assert_eq!(map.get(&B("cde")), Some(&c)); - assert_eq!(map.get(&B("def")), Some(&d)); -} diff --git a/src/test/ui/run-pass/threads-sendsync/send_str_treemap.rs b/src/test/ui/run-pass/threads-sendsync/send_str_treemap.rs deleted file mode 100644 index 94fa7d94a18..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/send_str_treemap.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::BTreeMap; -use std::borrow::Cow; - -use std::borrow::Cow::{Owned as O, Borrowed as B}; - -type SendStr = Cow<'static, str>; - -fn main() { - let mut map: BTreeMap = BTreeMap::new(); - assert!(map.insert(B("foo"), 42).is_none()); - assert!(map.insert(O("foo".to_string()), 42).is_some()); - assert!(map.insert(B("foo"), 42).is_some()); - assert!(map.insert(O("foo".to_string()), 42).is_some()); - - assert!(map.insert(B("foo"), 43).is_some()); - assert!(map.insert(O("foo".to_string()), 44).is_some()); - assert!(map.insert(B("foo"), 45).is_some()); - assert!(map.insert(O("foo".to_string()), 46).is_some()); - - let v = 46; - - assert_eq!(map.get(&O("foo".to_string())), Some(&v)); - assert_eq!(map.get(&B("foo")), Some(&v)); - - let (a, b, c, d) = (50, 51, 52, 53); - - assert!(map.insert(B("abc"), a).is_none()); - assert!(map.insert(O("bcd".to_string()), b).is_none()); - assert!(map.insert(B("cde"), c).is_none()); - assert!(map.insert(O("def".to_string()), d).is_none()); - - assert!(map.insert(B("abc"), a).is_some()); - assert!(map.insert(O("bcd".to_string()), b).is_some()); - assert!(map.insert(B("cde"), c).is_some()); - assert!(map.insert(O("def".to_string()), d).is_some()); - - assert!(map.insert(O("abc".to_string()), a).is_some()); - assert!(map.insert(B("bcd"), b).is_some()); - assert!(map.insert(O("cde".to_string()), c).is_some()); - assert!(map.insert(B("def"), d).is_some()); - - assert_eq!(map.get(&B("abc")), Some(&a)); - assert_eq!(map.get(&B("bcd")), Some(&b)); - assert_eq!(map.get(&B("cde")), Some(&c)); - assert_eq!(map.get(&B("def")), Some(&d)); - - assert_eq!(map.get(&O("abc".to_string())), Some(&a)); - assert_eq!(map.get(&O("bcd".to_string())), Some(&b)); - assert_eq!(map.get(&O("cde".to_string())), Some(&c)); - assert_eq!(map.get(&O("def".to_string())), Some(&d)); - - assert!(map.remove(&B("foo")).is_some()); - assert_eq!(map.into_iter().map(|(k, v)| format!("{}{}", k, v)) - .collect::>() - .concat(), - "abc50bcd51cde52def53".to_string()); -} diff --git a/src/test/ui/run-pass/threads-sendsync/sendable-class.rs b/src/test/ui/run-pass/threads-sendsync/sendable-class.rs deleted file mode 100644 index 2e82a278f3d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sendable-class.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Test that a class with only sendable fields can be sent - -// pretty-expanded FIXME #23616 - -use std::sync::mpsc::channel; - -struct foo { - i: isize, - j: char, -} - -fn foo(i:isize, j: char) -> foo { - foo { - i: i, - j: j - } -} - -pub fn main() { - let (tx, rx) = channel(); - tx.send(foo(42, 'c')); -} diff --git a/src/test/ui/run-pass/threads-sendsync/sendfn-is-a-block.rs b/src/test/ui/run-pass/threads-sendsync/sendfn-is-a-block.rs deleted file mode 100644 index 55144a7d386..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sendfn-is-a-block.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -fn test(f: F) -> usize where F: FnOnce(usize) -> usize { - return f(22); -} - -pub fn main() { - let y = test(|x| 4 * x); - assert_eq!(y, 88); -} diff --git a/src/test/ui/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs b/src/test/ui/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs deleted file mode 100644 index 24d54b8a0b6..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sendfn-spawn-with-fn-arg.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(box_syntax)] - -use std::thread; - -pub fn main() { test05(); } - -fn test05_start(f: F) { - f(22); -} - -fn test05() { - let three: Box<_> = box 3; - let fn_to_send = move|n:isize| { - println!("{}", *three + n); // will copy x into the closure - assert_eq!(*three, 3); - }; - thread::spawn(move|| { - test05_start(fn_to_send); - }).join().ok().unwrap(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/spawn-fn.rs b/src/test/ui/run-pass/threads-sendsync/spawn-fn.rs deleted file mode 100644 index 39fbba04361..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/spawn-fn.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -fn x(s: String, n: isize) { - println!("{}", s); - println!("{}", n); -} - -pub fn main() { - let t1 = thread::spawn(|| x("hello from first spawned fn".to_string(), 65) ); - let t2 = thread::spawn(|| x("hello from second spawned fn".to_string(), 66) ); - let t3 = thread::spawn(|| x("hello from third spawned fn".to_string(), 67) ); - let mut i = 30; - while i > 0 { - i = i - 1; - println!("parent sleeping"); - thread::yield_now(); - } - t1.join(); - t2.join(); - t3.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/spawn-types.rs b/src/test/ui/run-pass/threads-sendsync/spawn-types.rs deleted file mode 100644 index f7abb984b68..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/spawn-types.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// ignore-emscripten no threads support - -/* - Make sure we can spawn tasks that take different types of - parameters. This is based on a test case for #520 provided by Rob - Arnold. - */ - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -type ctx = Sender; - -fn iotask(_tx: &ctx, ip: String) { - assert_eq!(ip, "localhost".to_string()); -} - -pub fn main() { - let (tx, _rx) = channel::(); - let t = thread::spawn(move|| iotask(&tx, "localhost".to_string()) ); - t.join().ok().unwrap(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/spawn.rs b/src/test/ui/run-pass/threads-sendsync/spawn.rs deleted file mode 100644 index 7aa459a895b..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/spawn.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -pub fn main() { - thread::spawn(move|| child(10)).join().ok().unwrap(); -} - -fn child(i: isize) { println!("{}", i); assert_eq!(i, 10); } diff --git a/src/test/ui/run-pass/threads-sendsync/spawn2.rs b/src/test/ui/run-pass/threads-sendsync/spawn2.rs deleted file mode 100644 index 549360b851c..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/spawn2.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -pub fn main() { - let t = thread::spawn(move|| child((10, 20, 30, 40, 50, 60, 70, 80, 90)) ); - t.join().ok().unwrap(); // forget Err value, since it doesn't implement Debug -} - -fn child(args: (isize, isize, isize, isize, isize, isize, isize, isize, isize)) { - let (i1, i2, i3, i4, i5, i6, i7, i8, i9) = args; - println!("{}", i1); - println!("{}", i2); - println!("{}", i3); - println!("{}", i4); - println!("{}", i5); - println!("{}", i6); - println!("{}", i7); - println!("{}", i8); - println!("{}", i9); - assert_eq!(i1, 10); - assert_eq!(i2, 20); - assert_eq!(i3, 30); - assert_eq!(i4, 40); - assert_eq!(i5, 50); - assert_eq!(i6, 60); - assert_eq!(i7, 70); - assert_eq!(i8, 80); - assert_eq!(i9, 90); -} diff --git a/src/test/ui/run-pass/threads-sendsync/spawning-with-debug.rs b/src/test/ui/run-pass/threads-sendsync/spawning-with-debug.rs deleted file mode 100644 index e582cff43ab..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/spawning-with-debug.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-windows -// exec-env:RUST_LOG=debug -// ignore-emscripten no threads support - -// regression test for issue #10405, make sure we don't call println! too soon. - -use std::thread::Builder; - -pub fn main() { - let mut t = Builder::new(); - t.spawn(move|| ()); -} diff --git a/src/test/ui/run-pass/threads-sendsync/std-sync-right-kind-impls.rs b/src/test/ui/run-pass/threads-sendsync/std-sync-right-kind-impls.rs deleted file mode 100644 index e5658683a8e..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/std-sync-right-kind-impls.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -use std::sync; - -fn assert_both() {} - -fn main() { - assert_both::>(); - assert_both::(); - assert_both::>(); - assert_both::(); - assert_both::>(); - assert_both::>(); - assert_both::(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/sync-send-atomics.rs b/src/test/ui/run-pass/threads-sendsync/sync-send-atomics.rs deleted file mode 100644 index 53b19db5d48..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sync-send-atomics.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// pretty-expanded FIXME #23616 - -use std::sync::atomic::*; - -trait SendSync: Send + Sync {} - -impl SendSync for AtomicBool {} -impl SendSync for AtomicIsize {} -impl SendSync for AtomicUsize {} -impl SendSync for AtomicPtr {} - -fn main() {} diff --git a/src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs b/src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs deleted file mode 100644 index 93f1bc48b0d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sync-send-in-std.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// ignore-cloudabi networking not available -// ignore-wasm32-bare networking not available - -use std::net::ToSocketAddrs; - -fn is_sync(_: T) where T: Sync {} -fn is_send(_: T) where T: Send {} - -macro_rules! all_sync_send { - ($ctor:expr, $($iter:ident),+) => ({ - $( - let mut x = $ctor; - is_sync(x.$iter()); - let mut y = $ctor; - is_send(y.$iter()); - )+ - }) -} - -fn main() { - all_sync_send!("localhost:80".to_socket_addrs().unwrap(), next); -} diff --git a/src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs b/src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs deleted file mode 100644 index b62f6c4cc6d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcollections.rs +++ /dev/null @@ -1,80 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(warnings)] -#![feature(drain, collections_bound, btree_range)] - -use std::collections::BinaryHeap; -use std::collections::{BTreeMap, BTreeSet}; -use std::collections::LinkedList; -use std::collections::VecDeque; -use std::collections::HashMap; -use std::collections::HashSet; - -use std::mem; -use std::ops::Bound::Included; - -fn is_sync(_: T) where T: Sync {} -fn is_send(_: T) where T: Send {} - -macro_rules! all_sync_send { - ($ctor:expr, $($iter:ident),+) => ({ - $( - let mut x = $ctor; - is_sync(x.$iter()); - let mut y = $ctor; - is_send(y.$iter()); - )+ - }) -} - -macro_rules! is_sync_send { - ($ctor:expr, $iter:ident($($param:expr),+)) => ({ - let mut x = $ctor; - is_sync(x.$iter($( $param ),+)); - let mut y = $ctor; - is_send(y.$iter($( $param ),+)); - }) -} - -fn main() { - // The iterator "generator" list should exhaust what corresponding - // implementations have where `Sync` and `Send` semantics apply. - all_sync_send!(BinaryHeap::::new(), iter, drain, into_iter); - - all_sync_send!(BTreeMap::::new(), iter, iter_mut, into_iter, keys, values); - is_sync_send!(BTreeMap::::new(), range((Included(&0), Included(&9)))); - is_sync_send!(BTreeMap::::new(), range_mut((Included(&0), Included(&9)))); - - all_sync_send!(BTreeSet::::new(), iter, into_iter); - is_sync_send!(BTreeSet::::new(), range((Included(&0), Included(&9)))); - is_sync_send!(BTreeSet::::new(), difference(&BTreeSet::::new())); - is_sync_send!(BTreeSet::::new(), symmetric_difference(&BTreeSet::::new())); - is_sync_send!(BTreeSet::::new(), intersection(&BTreeSet::::new())); - is_sync_send!(BTreeSet::::new(), union(&BTreeSet::::new())); - - all_sync_send!(HashMap::::new(), iter, iter_mut, drain, into_iter, keys, values); - all_sync_send!(HashSet::::new(), iter, drain, into_iter); - is_sync_send!(HashSet::::new(), difference(&HashSet::::new())); - is_sync_send!(HashSet::::new(), symmetric_difference(&HashSet::::new())); - is_sync_send!(HashSet::::new(), intersection(&HashSet::::new())); - is_sync_send!(HashSet::::new(), union(&HashSet::::new())); - - all_sync_send!(LinkedList::::new(), iter, iter_mut, into_iter); - - all_sync_send!(VecDeque::::new(), iter, iter_mut, into_iter); - is_sync_send!(VecDeque::::new(), drain(..)); - - all_sync_send!(Vec::::new(), into_iter); - is_sync_send!(Vec::::new(), drain(..)); - is_sync_send!(String::new(), drain(..)); -} diff --git a/src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs b/src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs deleted file mode 100644 index e95014d829d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/sync-send-iterators-in-libcore.rs +++ /dev/null @@ -1,117 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(warnings)] -#![feature(iter_empty)] -#![feature(iter_once)] -#![feature(str_escape)] - -use std::iter::{empty, once, repeat}; - -fn is_sync(_: T) where T: Sync {} -fn is_send(_: T) where T: Send {} - -macro_rules! all_sync_send { - ($ctor:expr, $iter:ident) => ({ - let mut x = $ctor; - is_sync(x.$iter()); - let mut y = $ctor; - is_send(y.$iter()); - }); - ($ctor:expr, $iter:ident($($param:expr),+)) => ({ - let mut x = $ctor; - is_sync(x.$iter($( $param ),+)); - let mut y = $ctor; - is_send(y.$iter($( $param ),+)); - }); - ($ctor:expr, $iter:ident, $($rest:tt)*) => ({ - all_sync_send!($ctor, $iter); - all_sync_send!($ctor, $($rest)*); - }); - ($ctor:expr, $iter:ident($($param:expr),+), $($rest:tt)*) => ({ - all_sync_send!($ctor, $iter($( $param ),+)); - all_sync_send!($ctor, $($rest)*); - }); -} - -macro_rules! all_sync_send_mutable_ref { - ($ctor:expr, $($iter:ident),+) => ({ - $( - let mut x = $ctor; - is_sync((&mut x).$iter()); - let mut y = $ctor; - is_send((&mut y).$iter()); - )+ - }) -} - -macro_rules! is_sync_send { - ($ctor:expr) => ({ - let x = $ctor; - is_sync(x); - let y = $ctor; - is_send(y); - }) -} - -fn main() { - // for char.rs - all_sync_send!("Я", escape_debug, escape_default, escape_unicode); - - // for iter.rs - all_sync_send_mutable_ref!([1], iter); - - // Bytes implements DoubleEndedIterator - all_sync_send!("a".bytes(), rev); - - let a = [1]; - let b = [2]; - all_sync_send!(a.iter(), - cloned, - cycle, - chain([2].iter()), - zip([2].iter()), - map(|_| 1), - filter(|_| true), - filter_map(|_| Some(1)), - enumerate, - peekable, - skip_while(|_| true), - take_while(|_| true), - skip(1), - take(1), - scan(1, |_, _| Some(1)), - flat_map(|_| b.iter()), - fuse, - inspect(|_| ())); - - is_sync_send!((1..).step_by(2)); - is_sync_send!((1..2).step_by(2)); - is_sync_send!((1..2)); - is_sync_send!((1..)); - is_sync_send!(repeat(1)); - is_sync_send!(empty::()); - is_sync_send!(once(1)); - - // for option.rs - // FIXME - - // for result.rs - // FIXME - - // for slice.rs - // FIXME - - // for str/mod.rs - // FIXME -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-0.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-0.rs deleted file mode 100644 index 1626b23fdc2..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-0.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -pub fn main() { test05(); } - -fn test05_start(tx : &Sender) { - tx.send(10).unwrap(); - println!("sent 10"); - tx.send(20).unwrap(); - println!("sent 20"); - tx.send(30).unwrap(); - println!("sent 30"); -} - -fn test05() { - let (tx, rx) = channel(); - let t = thread::spawn(move|| { test05_start(&tx) }); - let mut value: isize = rx.recv().unwrap(); - println!("{}", value); - value = rx.recv().unwrap(); - println!("{}", value); - value = rx.recv().unwrap(); - println!("{}", value); - assert_eq!(value, 30); - t.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-1.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-1.rs deleted file mode 100644 index 975789e8cd2..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-1.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -pub fn main() { test00(); } - -fn start() { println!("Started / Finished task."); } - -fn test00() { - thread::spawn(move|| start() ).join(); - println!("Completing."); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-10.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-10.rs deleted file mode 100644 index cbb22520093..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-10.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -fn start(tx: &Sender>) { - let (tx2, rx) = channel(); - tx.send(tx2).unwrap(); - - let mut a; - let mut b; - a = rx.recv().unwrap(); - assert_eq!(a, "A".to_string()); - println!("{}", a); - b = rx.recv().unwrap(); - assert_eq!(b, "B".to_string()); - println!("{}", b); -} - -pub fn main() { - let (tx, rx) = channel(); - let child = thread::spawn(move|| { start(&tx) }); - - let mut c = rx.recv().unwrap(); - c.send("A".to_string()).unwrap(); - c.send("B".to_string()).unwrap(); - thread::yield_now(); - - child.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-11.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-11.rs deleted file mode 100644 index 28710116dc3..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-11.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 -// ignore-emscripten no threads support - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -fn start(tx: &Sender>) { - let (tx2, _rx) = channel(); - tx.send(tx2).unwrap(); -} - -pub fn main() { - let (tx, rx) = channel(); - let child = thread::spawn(move|| { - start(&tx) - }); - let _tx = rx.recv().unwrap(); - child.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-12.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-12.rs deleted file mode 100644 index e6195bf011b..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-12.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -pub fn main() { test00(); } - -fn start(_task_number: isize) { println!("Started / Finished task."); } - -fn test00() { - let i: isize = 0; - let mut result = thread::spawn(move|| { - start(i) - }); - - // Sleep long enough for the thread to finish. - let mut i = 0_usize; - while i < 10000 { - thread::yield_now(); - i += 1; - } - - // Try joining threads that have already finished. - result.join(); - - println!("Joined task."); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-13.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-13.rs deleted file mode 100644 index 2276fd8031f..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-13.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -fn start(tx: &Sender, start: isize, number_of_messages: isize) { - let mut i: isize = 0; - while i< number_of_messages { tx.send(start + i).unwrap(); i += 1; } -} - -pub fn main() { - println!("Check that we don't deadlock."); - let (tx, rx) = channel(); - let _ = thread::spawn(move|| { start(&tx, 0, 10) }).join(); - println!("Joined task"); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-14.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-14.rs deleted file mode 100644 index f6a96a84eb6..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-14.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -pub fn main() { - let (tx, rx) = channel(); - - // Spawn 10 threads each sending us back one isize. - let mut i = 10; - while (i > 0) { - println!("{}", i); - let tx = tx.clone(); - thread::spawn({let i = i; move|| { child(i, &tx) }}); - i = i - 1; - } - - // Spawned threads are likely killed before they get a chance to send - // anything back, so we deadlock here. - - i = 10; - while (i > 0) { - println!("{}", i); - rx.recv().unwrap(); - i = i - 1; - } - - println!("main thread exiting"); -} - -fn child(x: isize, tx: &Sender) { - println!("{}", x); - tx.send(x).unwrap(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-15.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-15.rs deleted file mode 100644 index 0398b55720d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-15.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support -// pretty-expanded FIXME #23616 - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -fn start(tx: &Sender, i0: isize) { - let mut i = i0; - while i > 0 { - tx.send(0).unwrap(); - i = i - 1; - } -} - -pub fn main() { - // Spawn a thread that sends us back messages. The parent thread - // is likely to terminate before the child completes, so from - // the child's point of view the receiver may die. We should - // drop messages on the floor in this case, and not crash! - let (tx, rx) = channel(); - let t = thread::spawn(move|| { - start(&tx, 10) - }); - rx.recv(); - t.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-16.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-16.rs deleted file mode 100644 index d98766f9194..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-16.rs +++ /dev/null @@ -1,119 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -use std::sync::mpsc::channel; -use std::cmp; - -// Tests of ports and channels on various types -fn test_rec() { - struct R {val0: isize, val1: u8, val2: char} - - let (tx, rx) = channel(); - let r0: R = R {val0: 0, val1: 1, val2: '2'}; - tx.send(r0).unwrap(); - let mut r1: R; - r1 = rx.recv().unwrap(); - assert_eq!(r1.val0, 0); - assert_eq!(r1.val1, 1); - assert_eq!(r1.val2, '2'); -} - -fn test_vec() { - let (tx, rx) = channel(); - let v0: Vec = vec![0, 1, 2]; - tx.send(v0).unwrap(); - let v1 = rx.recv().unwrap(); - assert_eq!(v1[0], 0); - assert_eq!(v1[1], 1); - assert_eq!(v1[2], 2); -} - -fn test_str() { - let (tx, rx) = channel(); - let s0 = "test".to_string(); - tx.send(s0).unwrap(); - let s1 = rx.recv().unwrap(); - assert_eq!(s1.as_bytes()[0], 't' as u8); - assert_eq!(s1.as_bytes()[1], 'e' as u8); - assert_eq!(s1.as_bytes()[2], 's' as u8); - assert_eq!(s1.as_bytes()[3], 't' as u8); -} - -#[derive(Debug)] -enum t { - tag1, - tag2(isize), - tag3(isize, u8, char) -} - -impl cmp::PartialEq for t { - fn eq(&self, other: &t) -> bool { - match *self { - t::tag1 => { - match (*other) { - t::tag1 => true, - _ => false - } - } - t::tag2(e0a) => { - match (*other) { - t::tag2(e0b) => e0a == e0b, - _ => false - } - } - t::tag3(e0a, e1a, e2a) => { - match (*other) { - t::tag3(e0b, e1b, e2b) => - e0a == e0b && e1a == e1b && e2a == e2b, - _ => false - } - } - } - } - fn ne(&self, other: &t) -> bool { !(*self).eq(other) } -} - -fn test_tag() { - let (tx, rx) = channel(); - tx.send(t::tag1).unwrap(); - tx.send(t::tag2(10)).unwrap(); - tx.send(t::tag3(10, 11, 'A')).unwrap(); - let mut t1: t; - t1 = rx.recv().unwrap(); - assert_eq!(t1, t::tag1); - t1 = rx.recv().unwrap(); - assert_eq!(t1, t::tag2(10)); - t1 = rx.recv().unwrap(); - assert_eq!(t1, t::tag3(10, 11, 'A')); -} - -fn test_chan() { - let (tx1, rx1) = channel(); - let (tx2, rx2) = channel(); - tx1.send(tx2).unwrap(); - let tx2 = rx1.recv().unwrap(); - // Does the transmitted channel still work? - - tx2.send(10).unwrap(); - let mut i: isize; - i = rx2.recv().unwrap(); - assert_eq!(i, 10); -} - -pub fn main() { - test_rec(); - test_vec(); - test_str(); - test_tag(); - test_chan(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-17.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-17.rs deleted file mode 100644 index 53a233da820..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-17.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support -// pretty-expanded FIXME #23616 - -// Issue #922 - -// This test is specifically about spawning temporary closures. - -use std::thread; - -fn f() { -} - -pub fn main() { - thread::spawn(move|| f() ).join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-3.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-3.rs deleted file mode 100644 index d18ed1c567c..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-3.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -pub fn main() { println!("===== WITHOUT THREADS ====="); test00(); } - -fn test00_start(ch: &Sender, message: isize, count: isize) { - println!("Starting test00_start"); - let mut i: isize = 0; - while i < count { - println!("Sending Message"); - ch.send(message + 0).unwrap(); - i = i + 1; - } - println!("Ending test00_start"); -} - -fn test00() { - let number_of_tasks: isize = 16; - let number_of_messages: isize = 4; - - println!("Creating tasks"); - - let (tx, rx) = channel(); - - let mut i: isize = 0; - - // Create and spawn threads... - let mut results = Vec::new(); - while i < number_of_tasks { - let tx = tx.clone(); - results.push(thread::spawn({ - let i = i; - move|| { - test00_start(&tx, i, number_of_messages) - } - })); - i = i + 1; - } - - // Read from spawned threads... - let mut sum = 0; - for _r in &results { - i = 0; - while i < number_of_messages { - let value = rx.recv().unwrap(); - sum += value; - i = i + 1; - } - } - - // Join spawned threads... - for r in results { r.join(); } - - println!("Completed: Final number is: "); - println!("{}", sum); - // assert (sum == (((number_of_threads * (number_of_threads - 1)) / 2) * - // number_of_messages)); - assert_eq!(sum, 480); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-4.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-4.rs deleted file mode 100644 index 47cbf8ec98a..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-4.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::sync::mpsc::channel; - -pub fn main() { test00(); } - -fn test00() { - let mut r: isize = 0; - let mut sum: isize = 0; - let (tx, rx) = channel(); - tx.send(1).unwrap(); - tx.send(2).unwrap(); - tx.send(3).unwrap(); - tx.send(4).unwrap(); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - tx.send(5).unwrap(); - tx.send(6).unwrap(); - tx.send(7).unwrap(); - tx.send(8).unwrap(); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - r = rx.recv().unwrap(); - sum += r; - println!("{}", r); - assert_eq!(sum, 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-5.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-5.rs deleted file mode 100644 index 29f5a5d3f27..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-5.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::sync::mpsc::channel; - -pub fn main() { test00(); } - -fn test00() { - let _r: isize = 0; - let mut sum: isize = 0; - let (tx, rx) = channel(); - let number_of_messages: isize = 1000; - let mut i: isize = 0; - while i < number_of_messages { tx.send(i + 0).unwrap(); i += 1; } - i = 0; - while i < number_of_messages { sum += rx.recv().unwrap(); i += 1; } - assert_eq!(sum, number_of_messages * (number_of_messages - 1) / 2); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-6.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-6.rs deleted file mode 100644 index 83eb36728ef..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-6.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::sync::mpsc::channel; - -pub fn main() { test00(); } - -fn test00() { - let mut r: isize = 0; - let mut sum: isize = 0; - let (tx, rx) = channel(); - let mut tx0 = tx.clone(); - let mut tx1 = tx.clone(); - let mut tx2 = tx.clone(); - let mut tx3 = tx.clone(); - let number_of_messages: isize = 1000; - let mut i: isize = 0; - while i < number_of_messages { - tx0.send(i + 0).unwrap(); - tx1.send(i + 0).unwrap(); - tx2.send(i + 0).unwrap(); - tx3.send(i + 0).unwrap(); - i += 1; - } - i = 0; - while i < number_of_messages { - r = rx.recv().unwrap(); - sum += r; - r = rx.recv().unwrap(); - sum += r; - r = rx.recv().unwrap(); - sum += r; - r = rx.recv().unwrap(); - sum += r; - i += 1; - } - assert_eq!(sum, 1998000); - // assert (sum == 4 * ((number_of_messages * - // (number_of_messages - 1)) / 2)); - -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-7.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-7.rs deleted file mode 100644 index 6bf1bad07c1..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-7.rs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -pub fn main() { test00(); } - -fn test00_start(c: &Sender, start: isize, - number_of_messages: isize) { - let mut i: isize = 0; - while i < number_of_messages { c.send(start + i).unwrap(); i += 1; } -} - -fn test00() { - let mut r: isize = 0; - let mut sum: isize = 0; - let (tx, rx) = channel(); - let number_of_messages: isize = 10; - - let tx2 = tx.clone(); - let t1 = thread::spawn(move|| { - test00_start(&tx2, number_of_messages * 0, number_of_messages); - }); - let tx2 = tx.clone(); - let t2 = thread::spawn(move|| { - test00_start(&tx2, number_of_messages * 1, number_of_messages); - }); - let tx2 = tx.clone(); - let t3 = thread::spawn(move|| { - test00_start(&tx2, number_of_messages * 2, number_of_messages); - }); - let tx2 = tx.clone(); - let t4 = thread::spawn(move|| { - test00_start(&tx2, number_of_messages * 3, number_of_messages); - }); - - let mut i: isize = 0; - while i < number_of_messages { - r = rx.recv().unwrap(); - sum += r; - r = rx.recv().unwrap(); - sum += r; - r = rx.recv().unwrap(); - sum += r; - r = rx.recv().unwrap(); - sum += r; - i += 1; - } - - assert_eq!(sum, number_of_messages * 4 * (number_of_messages * 4 - 1) / 2); - - t1.join(); - t2.join(); - t3.join(); - t4.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-9.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-9.rs deleted file mode 100644 index f23a1594507..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-9.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; -use std::sync::mpsc::{channel, Sender}; - -pub fn main() { test00(); } - -fn test00_start(c: &Sender, number_of_messages: isize) { - let mut i: isize = 0; - while i < number_of_messages { c.send(i + 0).unwrap(); i += 1; } -} - -fn test00() { - let r: isize = 0; - let mut sum: isize = 0; - let (tx, rx) = channel(); - let number_of_messages: isize = 10; - - let result = thread::spawn(move|| { - test00_start(&tx, number_of_messages); - }); - - let mut i: isize = 0; - while i < number_of_messages { - sum += rx.recv().unwrap(); - println!("{}", r); - i += 1; - } - - result.join(); - - assert_eq!(sum, number_of_messages * (number_of_messages - 1) / 2); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-comm-chan-nil.rs b/src/test/ui/run-pass/threads-sendsync/task-comm-chan-nil.rs deleted file mode 100644 index d13415a68ca..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-comm-chan-nil.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::sync::mpsc::channel; - -// rustboot can't transmit nils across channels because they don't have -// any size, but rustc currently can because they do have size. Whether -// or not this is desirable I don't know, but here's a regression test. -pub fn main() { - let (tx, rx) = channel(); - tx.send(()).unwrap(); - let n: () = rx.recv().unwrap(); - assert_eq!(n, ()); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-life-0.rs b/src/test/ui/run-pass/threads-sendsync/task-life-0.rs deleted file mode 100644 index 8ec7c871c68..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-life-0.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support -// pretty-expanded FIXME #23616 - -use std::thread; - -pub fn main() { - thread::spawn(move|| child("Hello".to_string()) ).join(); -} - -fn child(_s: String) { - -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-spawn-move-and-copy.rs b/src/test/ui/run-pass/threads-sendsync/task-spawn-move-and-copy.rs deleted file mode 100644 index 65e2236f2e1..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-spawn-move-and-copy.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(box_syntax)] - -use std::thread; -use std::sync::mpsc::channel; - -pub fn main() { - let (tx, rx) = channel::(); - - let x: Box = box 1; - let x_in_parent = &(*x) as *const isize as usize; - - let t = thread::spawn(move || { - let x_in_child = &(*x) as *const isize as usize; - tx.send(x_in_child).unwrap(); - }); - - let x_in_child = rx.recv().unwrap(); - assert_eq!(x_in_parent, x_in_child); - - t.join(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/task-stderr.rs b/src/test/ui/run-pass/threads-sendsync/task-stderr.rs deleted file mode 100644 index e72809b68b0..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/task-stderr.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(box_syntax, set_stdio)] - -use std::io::prelude::*; -use std::io; -use std::str; -use std::sync::{Arc, Mutex}; -use std::thread; - -struct Sink(Arc>>); -impl Write for Sink { - fn write(&mut self, data: &[u8]) -> io::Result { - Write::write(&mut *self.0.lock().unwrap(), data) - } - fn flush(&mut self) -> io::Result<()> { Ok(()) } -} - -fn main() { - let data = Arc::new(Mutex::new(Vec::new())); - let sink = Sink(data.clone()); - let res = thread::Builder::new().spawn(move|| -> () { - io::set_panic(Some(Box::new(sink))); - panic!("Hello, world!") - }).unwrap().join(); - assert!(res.is_err()); - - let output = data.lock().unwrap(); - let output = str::from_utf8(&output).unwrap(); - assert!(output.contains("Hello, world!")); -} diff --git a/src/test/ui/run-pass/threads-sendsync/thread-local-extern-static.rs b/src/test/ui/run-pass/threads-sendsync/thread-local-extern-static.rs deleted file mode 100644 index 01c0235c55d..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/thread-local-extern-static.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-windows -// aux-build:thread-local-extern-static.rs - -#![feature(cfg_target_thread_local, thread_local)] - -#[cfg(target_thread_local)] -extern crate thread_local_extern_static; - -#[cfg(target_thread_local)] -use std::cell::Cell; - -#[cfg(target_thread_local)] -extern { - #[thread_local] - static FOO: Cell; -} - -#[cfg(target_thread_local)] -fn main() { - unsafe { - assert_eq!(FOO.get(), 3); - } -} - -#[cfg(not(target_thread_local))] -fn main() {} diff --git a/src/test/ui/run-pass/threads-sendsync/thread-local-syntax.rs b/src/test/ui/run-pass/threads-sendsync/thread-local-syntax.rs deleted file mode 100644 index 522a736ce5a..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/thread-local-syntax.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![deny(missing_docs)] -//! this tests the syntax of `thread_local!` - -mod foo { - mod bar { - thread_local! { - // no docs - #[allow(unused)] - static FOO: i32 = 42; - /// docs - pub static BAR: String = String::from("bar"); - - // look at these restrictions!! - pub(crate) static BAZ: usize = 0; - pub(in foo) static QUUX: usize = 0; - } - thread_local!(static SPLOK: u32 = 0); - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/threads-sendsync/threads.rs b/src/test/ui/run-pass/threads-sendsync/threads.rs deleted file mode 100644 index 7be239e29fb..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/threads.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -use std::thread; - -pub fn main() { - let mut i = 10; - while i > 0 { - thread::spawn({let i = i; move|| child(i)}).join(); - i = i - 1; - } - println!("main thread exiting"); -} - -fn child(x: isize) { println!("{}", x); } diff --git a/src/test/ui/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs b/src/test/ui/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs deleted file mode 100644 index e60a2c8a011..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/tls-dtors-are-run-in-a-static-binary.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// no-prefer-dynamic -// ignore-emscripten no threads support - -static mut HIT: bool = false; - -struct Foo; - -impl Drop for Foo { - fn drop(&mut self) { - unsafe { HIT = true; } - } -} - -thread_local!(static FOO: Foo = Foo); - -fn main() { - std::thread::spawn(|| { - FOO.with(|_| {}); - }).join().unwrap(); - assert!(unsafe { HIT }); -} diff --git a/src/test/ui/run-pass/threads-sendsync/tls-init-on-init.rs b/src/test/ui/run-pass/threads-sendsync/tls-init-on-init.rs deleted file mode 100644 index 5b6afe78482..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/tls-init-on-init.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// ignore-emscripten no threads support - -#![feature(thread_local_try_with)] - -use std::thread; -use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; - -struct Foo { cnt: usize } - -thread_local!(static FOO: Foo = Foo::init()); - -static CNT: AtomicUsize = ATOMIC_USIZE_INIT; - -impl Foo { - fn init() -> Foo { - let cnt = CNT.fetch_add(1, Ordering::SeqCst); - if cnt == 0 { - FOO.with(|_| {}); - } - Foo { cnt: cnt } - } -} - -impl Drop for Foo { - fn drop(&mut self) { - if self.cnt == 1 { - FOO.with(|foo| assert_eq!(foo.cnt, 0)); - } else { - assert_eq!(self.cnt, 0); - if FOO.try_with(|_| ()).is_ok() { - panic!("should not be in valid state"); - } - } - } -} - -fn main() { - thread::spawn(|| { - FOO.with(|_| {}); - }).join().unwrap(); -} diff --git a/src/test/ui/run-pass/threads-sendsync/tls-try-with.rs b/src/test/ui/run-pass/threads-sendsync/tls-try-with.rs deleted file mode 100644 index f1fcef8e4b9..00000000000 --- a/src/test/ui/run-pass/threads-sendsync/tls-try-with.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(stable_features)] - -// ignore-emscripten no threads support - -#![feature(thread_local_try_with)] - -use std::thread; - -static mut DROP_RUN: bool = false; - -struct Foo; - -thread_local!(static FOO: Foo = Foo {}); - -impl Drop for Foo { - fn drop(&mut self) { - assert!(FOO.try_with(|_| panic!("`try_with` closure run")).is_err()); - unsafe { DROP_RUN = true; } - } -} - -fn main() { - thread::spawn(|| { - assert_eq!(FOO.try_with(|_| { - 132 - }).expect("`try_with` failed"), 132); - }).join().unwrap(); - assert!(unsafe { DROP_RUN }); -} diff --git a/src/test/ui/run-pass/traits/anon-trait-static-method.rs b/src/test/ui/run-pass/traits/anon-trait-static-method.rs deleted file mode 100644 index 94779e7c5da..00000000000 --- a/src/test/ui/run-pass/traits/anon-trait-static-method.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -struct Foo { - x: isize -} - -impl Foo { - pub fn new() -> Foo { - Foo { x: 3 } - } -} - -pub fn main() { - let x = Foo::new(); - println!("{}", x.x); -} diff --git a/src/test/ui/run-pass/traits/anon_trait_static_method_exe.rs b/src/test/ui/run-pass/traits/anon_trait_static_method_exe.rs deleted file mode 100644 index 958c1094e4f..00000000000 --- a/src/test/ui/run-pass/traits/anon_trait_static_method_exe.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// aux-build:anon_trait_static_method_lib.rs - -extern crate anon_trait_static_method_lib; -use anon_trait_static_method_lib::Foo; - -pub fn main() { - let x = Foo::new(); - println!("{}", x.x); -} diff --git a/src/test/ui/run-pass/traits/assignability-trait.rs b/src/test/ui/run-pass/traits/assignability-trait.rs deleted file mode 100644 index f90c7b95dcf..00000000000 --- a/src/test/ui/run-pass/traits/assignability-trait.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012-4 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Tests that type assignability is used to search for instances when -// making method calls, but only if there aren't any matches without -// it. - -trait iterable { - fn iterate(&self, blk: F) -> bool where F: FnMut(&A) -> bool; -} - -impl<'a,A> iterable for &'a [A] { - fn iterate(&self, f: F) -> bool where F: FnMut(&A) -> bool { - self.iter().all(f) - } -} - -impl iterable for Vec { - fn iterate(&self, f: F) -> bool where F: FnMut(&A) -> bool { - self.iter().all(f) - } -} - -fn length>(x: T) -> usize { - let mut len = 0; - x.iterate(|_y| { - len += 1; - true - }); - return len; -} - -pub fn main() { - let x: Vec = vec![0,1,2,3]; - // Call a method - x.iterate(|y| { assert_eq!(x[*y as usize], *y); true }); - // Call a parameterized function - assert_eq!(length(x.clone()), x.len()); - // Call a parameterized function, with type arguments that require - // a borrow - assert_eq!(length::(&*x), x.len()); - - // Now try it with a type that *needs* to be borrowed - let z = [0,1,2,3]; - // Call a parameterized function - assert_eq!(length::(&z), z.len()); -} diff --git a/src/test/ui/run-pass/traits/astconv-cycle-between-trait-and-type.rs b/src/test/ui/run-pass/traits/astconv-cycle-between-trait-and-type.rs deleted file mode 100644 index 0eabded7627..00000000000 --- a/src/test/ui/run-pass/traits/astconv-cycle-between-trait-and-type.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to successfully compile a setup where a trait -// (`Trait1`) references a struct (`SomeType`) which in turn -// carries a predicate that references the trait (`u32 : Trait1`, -// substituted). - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -trait Trait1 : Trait2> { - fn dumb(&self) { } -} - -trait Trait2 { - fn dumber(&self, _: A) { } -} - -struct SomeType - where A : Trait1 -{ - a: A -} - -impl Trait1 for u32 { } - -impl Trait2> for u32 { } - -fn main() { } diff --git a/src/test/ui/run-pass/traits/augmented-assignments-trait.rs b/src/test/ui/run-pass/traits/augmented-assignments-trait.rs deleted file mode 100644 index af308a6efed..00000000000 --- a/src/test/ui/run-pass/traits/augmented-assignments-trait.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::AddAssign; - -struct Int(i32); - -impl AddAssign for Int { - fn add_assign(&mut self, _: Int) { - unimplemented!() - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/traits/auto-traits.rs b/src/test/ui/run-pass/traits/auto-traits.rs deleted file mode 100644 index 79c2108ba83..00000000000 --- a/src/test/ui/run-pass/traits/auto-traits.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(optin_builtin_traits)] - -auto trait Auto {} -unsafe auto trait AutoUnsafe {} - -impl !Auto for bool {} -impl !AutoUnsafe for bool {} - -struct AutoBool(bool); - -impl Auto for AutoBool {} -unsafe impl AutoUnsafe for AutoBool {} - -fn take_auto(_: T) {} -fn take_auto_unsafe(_: T) {} - -fn main() { - // Parse inside functions. - auto trait AutoInner {} - unsafe auto trait AutoUnsafeInner {} - - take_auto(0); - take_auto(AutoBool(true)); - take_auto_unsafe(0); - take_auto_unsafe(AutoBool(true)); - - /// Auto traits are allowed in trait object bounds. - let _: &(Send + Auto) = &0; -} diff --git a/src/test/ui/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs b/src/test/ui/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs deleted file mode 100644 index 9d93d9689e7..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/anon_trait_static_method_lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Foo { - pub x: isize -} - -impl Foo { - pub fn new() -> Foo { - Foo { x: 3 } - } -} diff --git a/src/test/ui/run-pass/traits/auxiliary/go_trait.rs b/src/test/ui/run-pass/traits/auxiliary/go_trait.rs deleted file mode 100644 index 044bb606b40..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/go_trait.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -#![feature(specialization)] - -// Common code used for tests that model the Fn/FnMut/FnOnce hierarchy. - -pub trait Go { - fn go(&self, arg: isize); -} - -pub fn go(this: &G, arg: isize) { - this.go(arg) -} - -pub trait GoMut { - fn go_mut(&mut self, arg: isize); -} - -pub fn go_mut(this: &mut G, arg: isize) { - this.go_mut(arg) -} - -pub trait GoOnce { - fn go_once(self, arg: isize); -} - -pub fn go_once(this: G, arg: isize) { - this.go_once(arg) -} - -impl GoMut for G - where G : Go -{ - default fn go_mut(&mut self, arg: isize) { - go(&*self, arg) - } -} - -impl GoOnce for G - where G : GoMut -{ - default fn go_once(mut self, arg: isize) { - go_mut(&mut self, arg) - } -} diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs b/src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs deleted file mode 100644 index c1168a912dc..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub struct Something { pub x: isize } - -pub trait A { - fn f(&self) -> isize; - fn g(&self) -> isize { 10 } - fn h(&self) -> isize { 11 } - fn lurr(x: &Self, y: &Self) -> isize { x.g() + y.h() } -} - - -impl A for isize { - fn f(&self) -> isize { 10 } -} - -impl A for Something { - fn f(&self) -> isize { 10 } -} - -pub trait B { - fn thing(&self, x: T, y: U) -> (T, U) { (x, y) } - fn staticthing(_z: &Self, x: T, y: U) -> (T, U) { (x, y) } -} - -impl B for isize { } -impl B for bool { } - - - -pub trait TestEquality { - fn test_eq(&self, rhs: &Self) -> bool; - fn test_neq(&self, rhs: &Self) -> bool { - !self.test_eq(rhs) - } -} - -impl TestEquality for isize { - fn test_eq(&self, rhs: &isize) -> bool { - *self == *rhs - } -} diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs b/src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs deleted file mode 100644 index 7443ef9c0f3..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_default_method_xc_aux_2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// aux-build:trait_default_method_xc_aux.rs - -extern crate trait_default_method_xc_aux as aux; -use aux::A; - -pub struct a_struct { pub x: isize } - -impl A for a_struct { - fn f(&self) -> isize { 10 } -} - -// This function will need to get inlined, and badness may result. -pub fn welp(x: A) -> A { - let a = a_struct { x: 0 }; - a.g(); - x -} diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs b/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs deleted file mode 100644 index af0128d9676..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_2_aux.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait Foo { fn f(&self) -> isize; } -pub trait Bar { fn g(&self) -> isize; } -pub trait Baz { fn h(&self) -> isize; } - -pub struct A { pub x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } -impl Baz for A { fn h(&self) -> isize { 30 } } diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs b/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs deleted file mode 100644 index 6be1f8c45f4..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_auto_xc_aux.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait Foo { fn f(&self) -> isize; } -pub trait Bar { fn g(&self) -> isize; } -pub trait Baz { fn h(&self) -> isize; } - -pub trait Quux: Foo + Bar + Baz { } - -impl Quux for T { } diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs b/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs deleted file mode 100644 index 1bfada612eb..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_inheritance_overloading_xc.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::cmp::PartialEq; -use std::ops::{Add, Sub, Mul}; - -pub trait MyNum : Add + Sub + Mul + PartialEq + Clone { -} - -#[derive(Clone, Debug)] -pub struct MyInt { - pub val: isize -} - -impl Add for MyInt { - type Output = MyInt; - - fn add(self, other: MyInt) -> MyInt { mi(self.val + other.val) } -} - -impl Sub for MyInt { - type Output = MyInt; - - fn sub(self, other: MyInt) -> MyInt { mi(self.val - other.val) } -} - -impl Mul for MyInt { - type Output = MyInt; - - fn mul(self, other: MyInt) -> MyInt { mi(self.val * other.val) } -} - -impl PartialEq for MyInt { - fn eq(&self, other: &MyInt) -> bool { self.val == other.val } - - fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } -} - -impl MyNum for MyInt {} - -fn mi(v: isize) -> MyInt { MyInt { val: v } } diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_safety_lib.rs b/src/test/ui/run-pass/traits/auxiliary/trait_safety_lib.rs deleted file mode 100644 index 585a756fd07..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_safety_lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Simple smoke test that unsafe traits can be compiled etc. - -pub unsafe trait Foo { - fn foo(&self) -> isize; -} - -unsafe impl Foo for isize { - fn foo(&self) -> isize { *self } -} diff --git a/src/test/ui/run-pass/traits/auxiliary/trait_xc_call_aux.rs b/src/test/ui/run-pass/traits/auxiliary/trait_xc_call_aux.rs deleted file mode 100644 index 9eeb815c5de..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/trait_xc_call_aux.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - - -pub trait Foo { - fn f(&self) -> isize; -} - -pub struct A { - pub x: isize -} - -impl Foo for A { - fn f(&self) -> isize { 10 } -} diff --git a/src/test/ui/run-pass/traits/auxiliary/traitimpl.rs b/src/test/ui/run-pass/traits/auxiliary/traitimpl.rs deleted file mode 100644 index 22e79cc6284..00000000000 --- a/src/test/ui/run-pass/traits/auxiliary/traitimpl.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// Test inherent trait impls work cross-crait. - -pub trait Bar<'a> : 'a {} - -impl<'a> Bar<'a> { - pub fn bar(&self) {} -} diff --git a/src/test/ui/run-pass/traits/conservative_impl_trait.rs b/src/test/ui/run-pass/traits/conservative_impl_trait.rs deleted file mode 100644 index b6abeb916a9..00000000000 --- a/src/test/ui/run-pass/traits/conservative_impl_trait.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// #39665 - -fn batches(n: &u32) -> impl Iterator { - std::iter::once(n) -} - -fn main() {} diff --git a/src/test/ui/run-pass/traits/cycle-trait-type-trait.rs b/src/test/ui/run-pass/traits/cycle-trait-type-trait.rs deleted file mode 100644 index c1958398005..00000000000 --- a/src/test/ui/run-pass/traits/cycle-trait-type-trait.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a case where a supertrait references a type that references -// the original trait. This poses no problem at the moment. - -// pretty-expanded FIXME #23616 - -trait Chromosome: Get> { -} - -trait Get { - fn get(&self) -> A; -} - -struct Struct { c: C } - -impl Chromosome for i32 { } - -impl Get> for i32 { - fn get(&self) -> Struct { - Struct { c: *self } - } -} - -fn main() { } diff --git a/src/test/ui/run-pass/traits/default-method-supertrait-vtable.rs b/src/test/ui/run-pass/traits/default-method-supertrait-vtable.rs deleted file mode 100644 index 57eb410c9ad..00000000000 --- a/src/test/ui/run-pass/traits/default-method-supertrait-vtable.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -// Tests that we can call a function bounded over a supertrait from -// a default method - -fn require_y(x: T) -> isize { x.y() } - -trait Y { - fn y(self) -> isize; -} - - -trait Z: Y + Sized { - fn x(self) -> isize { - require_y(self) - } -} - -impl Y for isize { - fn y(self) -> isize { self } -} - -impl Z for isize {} - -pub fn main() { - assert_eq!(12.x(), 12); -} diff --git a/src/test/ui/run-pass/traits/dyn-trait.rs b/src/test/ui/run-pass/traits/dyn-trait.rs deleted file mode 100644 index 0ef6b9fd147..00000000000 --- a/src/test/ui/run-pass/traits/dyn-trait.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-pretty `dyn ::foo` parses differently in the current edition - -use std::fmt::Display; - -static BYTE: u8 = 33; - -fn main() { - let x: &(dyn 'static + Display) = &BYTE; - let y: Box = Box::new(BYTE); - let _: &dyn (Display) = &BYTE; - let _: &dyn (::std::fmt::Display) = &BYTE; - let xstr = format!("{}", x); - let ystr = format!("{}", y); - assert_eq!(xstr, "33"); - assert_eq!(ystr, "33"); -} diff --git a/src/test/ui/run-pass/traits/fmt-pointer-trait.rs b/src/test/ui/run-pass/traits/fmt-pointer-trait.rs deleted file mode 100644 index 66ec8fc44a4..00000000000 --- a/src/test/ui/run-pass/traits/fmt-pointer-trait.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ptr; -use std::rc::Rc; -use std::sync::Arc; - -fn main() { - let p: *const u8 = ptr::null(); - let rc = Rc::new(1usize); - let arc = Arc::new(1usize); - let b = Box::new("hi"); - - let _ = format!("{:p}{:p}{:p}", - rc, arc, b); - - if cfg!(target_pointer_width = "32") { - assert_eq!(format!("{:#p}", p), - "0x00000000"); - } else { - assert_eq!(format!("{:#p}", p), - "0x0000000000000000"); - } - assert_eq!(format!("{:p}", p), - "0x0"); -} diff --git a/src/test/ui/run-pass/traits/impl-implicit-trait.rs b/src/test/ui/run-pass/traits/impl-implicit-trait.rs deleted file mode 100644 index 76cfaf2c68e..00000000000 --- a/src/test/ui/run-pass/traits/impl-implicit-trait.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -enum option_ { - none_, - some_(T), -} - -impl option_ { - pub fn foo(&self) -> bool { true } -} - -enum option__ { - none__, - some__(isize) -} - -impl option__ { - pub fn foo(&self) -> bool { true } -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/traits/impl-inherent-prefer-over-trait.rs b/src/test/ui/run-pass/traits/impl-inherent-prefer-over-trait.rs deleted file mode 100644 index 505209ff3ae..00000000000 --- a/src/test/ui/run-pass/traits/impl-inherent-prefer-over-trait.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo; - -trait Trait { - fn bar(&self); -} - -// Inherent impls should be preferred over trait ones. -impl Foo { - fn bar(&self) {} -} - -impl Trait { - fn baz(_: &Foo) {} -} - -impl Trait for Foo { - fn bar(&self) { panic!("wrong method called!") } -} - -fn main() { - Foo.bar(); - Foo::bar(&Foo); - ::bar(&Foo); - - // Should work even if Trait::baz doesn't exist. - // N.B: `::bar` would be ambiguous. - ::baz(&Foo); -} diff --git a/src/test/ui/run-pass/traits/infer-from-object-trait-issue-26952.rs b/src/test/ui/run-pass/traits/infer-from-object-trait-issue-26952.rs deleted file mode 100644 index d53619d0c9d..00000000000 --- a/src/test/ui/run-pass/traits/infer-from-object-trait-issue-26952.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that when we match a trait reference like `Foo: Foo<_#0t>`, -// we unify with `_#0t` with `A`. In this code, if we failed to do -// that, then you get an unconstrained type-variable in `call`. -// -// Also serves as a regression test for issue #26952, though the test -// was derived from another reported regression with the same cause. - -use std::marker::PhantomData; - -trait Trait { fn foo(&self); } - -struct Type { a: PhantomData } - -fn as_trait(t: &Type) -> &Trait { loop { } } - -fn want+?Sized>(t: &T) { } - -fn call(p: Type) { - let q = as_trait(&p); - want(q); // parameter A to `want` *would* be unconstrained -} - -fn main() { } diff --git a/src/test/ui/run-pass/traits/inherent-trait-method-order.rs b/src/test/ui/run-pass/traits/inherent-trait-method-order.rs deleted file mode 100644 index 6b6dd5dcbbd..00000000000 --- a/src/test/ui/run-pass/traits/inherent-trait-method-order.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -struct Foo; - -impl Foo { - #[allow(dead_code)] - fn foo(self) { - panic!("wrong method!") - } -} - -trait Trait { - fn foo(self); -} - -impl<'a,'b,'c> Trait for &'a &'b &'c Foo { - fn foo(self) { - // ok - } -} - -fn main() { - let x = &(&(&Foo)); - x.foo(); -} diff --git a/src/test/ui/run-pass/traits/kindck-owned-trait-contains-1.rs b/src/test/ui/run-pass/traits/kindck-owned-trait-contains-1.rs deleted file mode 100644 index 55cdeff8c9b..00000000000 --- a/src/test/ui/run-pass/traits/kindck-owned-trait-contains-1.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] -#![allow(non_camel_case_types)] - -#![feature(box_syntax)] - -trait repeat { fn get(&self) -> A; } - -impl repeat for Box { - fn get(&self) -> A { - (**self).clone() - } -} - -fn repeater(v: Box) -> Box+'static> { - box v as Box+'static> // No -} - -pub fn main() { - let x = 3; - let y = repeater(box x); - assert_eq!(x, y.get()); -} diff --git a/src/test/ui/run-pass/traits/multiple-trait-bounds.rs b/src/test/ui/run-pass/traits/multiple-trait-bounds.rs deleted file mode 100644 index b49d2449167..00000000000 --- a/src/test/ui/run-pass/traits/multiple-trait-bounds.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn f(_: T) { -} - -pub fn main() { - f(3); -} diff --git a/src/test/ui/run-pass/traits/object-one-type-two-traits.rs b/src/test/ui/run-pass/traits/object-one-type-two-traits.rs deleted file mode 100644 index 5a468e0d644..00000000000 --- a/src/test/ui/run-pass/traits/object-one-type-two-traits.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Testing creating two vtables with the same self type, but different -// traits. - -#![feature(box_syntax)] - -use std::any::Any; - -trait Wrap { - fn get(&self) -> isize; - fn wrap(self: Box) -> Box; -} - -impl Wrap for isize { - fn get(&self) -> isize { - *self - } - fn wrap(self: Box) -> Box { - self as Box - } -} - -fn is(x: &Any) -> bool { - x.is::() -} - -fn main() { - let x = box 22isize as Box; - println!("x={}", x.get()); - let y = x.wrap(); -} diff --git a/src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs b/src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs deleted file mode 100644 index d9a051ee02e..00000000000 --- a/src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(overlapping_marker_traits)] -#![feature(optin_builtin_traits)] - -// Overlapping negative impls for `MyStruct` are permitted: -struct MyStruct; -impl !Send for MyStruct {} -impl !Send for MyStruct {} - -fn main() { -} diff --git a/src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits.rs b/src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits.rs deleted file mode 100644 index 3f165daf65c..00000000000 --- a/src/test/ui/run-pass/traits/overlap-permitted-for-marker-traits.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests for RFC 1268: we allow overlapping impls of marker traits, -// that is, traits without items. In this case, a type `T` is -// `MyMarker` if it is either `Debug` or `Display`. - -#![feature(overlapping_marker_traits)] -#![feature(optin_builtin_traits)] - -use std::fmt::{Debug, Display}; - -trait MyMarker {} - -impl MyMarker for T {} -impl MyMarker for T {} - -fn foo(t: T) -> T { - t -} - -fn main() { - // Debug && Display: - assert_eq!(1, foo(1)); - assert_eq!(2.0, foo(2.0)); - - // Debug && !Display: - assert_eq!(vec![1], foo(vec![1])); -} diff --git a/src/test/ui/run-pass/traits/parameterized-trait-with-bounds.rs b/src/test/ui/run-pass/traits/parameterized-trait-with-bounds.rs deleted file mode 100644 index d98f8006609..00000000000 --- a/src/test/ui/run-pass/traits/parameterized-trait-with-bounds.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - - -trait A { fn get(self) -> T; } -trait B { fn get(self) -> (T,U); } -trait C<'a, U> { fn get(self) -> &'a U; } - -mod foo { - pub trait D<'a, T> { fn get(self) -> &'a T; } -} - -fn foo1(_: &(A + Send)) {} -fn foo2(_: Box + Send + Sync>) {} -fn foo3(_: Box + 'static>) {} -fn foo4<'a, T>(_: Box + 'static + Send>) {} -fn foo5<'a, T>(_: Box + 'static + Send>) {} - -pub fn main() {} diff --git a/src/test/ui/run-pass/traits/supertrait-default-generics.rs b/src/test/ui/run-pass/traits/supertrait-default-generics.rs deleted file mode 100644 index c3c37d6b9c0..00000000000 --- a/src/test/ui/run-pass/traits/supertrait-default-generics.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// There is some other borrowck bug, so we make the stuff not mut. - - -use std::ops::Add; - -trait Positioned { - fn SetX(&mut self, _: S); - fn X(&self) -> S; -} - -trait Movable>: Positioned { - fn translate(&mut self, dx: S) { - let x = self.X() + dx; - self.SetX(x); - } -} - -struct Point { x: S, y: S } - -impl Positioned for Point { - fn SetX(&mut self, x: S) { - self.x = x; - } - fn X(&self) -> S { - self.x.clone() - } -} - -impl> Movable for Point {} - -pub fn main() { - let mut p = Point{ x: 1, y: 2}; - p.translate(3); - assert_eq!(p.X(), 4); -} diff --git a/src/test/ui/run-pass/traits/syntax-trait-polarity.rs b/src/test/ui/run-pass/traits/syntax-trait-polarity.rs deleted file mode 100644 index 89b49b11f01..00000000000 --- a/src/test/ui/run-pass/traits/syntax-trait-polarity.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(optin_builtin_traits)] - -struct TestType; - -impl TestType {} - -trait TestTrait {} - -impl !Send for TestType {} - -struct TestType2(T); - -impl TestType2 {} - -impl !Send for TestType2 {} - -fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-bounds-basic.rs b/src/test/ui/run-pass/traits/trait-bounds-basic.rs deleted file mode 100644 index 1a2621f7679..00000000000 --- a/src/test/ui/run-pass/traits/trait-bounds-basic.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unconditional_recursion)] - -// pretty-expanded FIXME #23616 - -trait Foo { -} - -fn b(_x: Box) { -} - -fn c(x: Box) { - e(x); -} - -fn d(x: Box) { - e(x); -} - -fn e(x: Box) { - e(x); -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs b/src/test/ui/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs deleted file mode 100644 index 4ccb48915fc..00000000000 --- a/src/test/ui/run-pass/traits/trait-bounds-impl-comparison-duplicates.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that type parameter bounds on an implementation need not match the -// trait exactly, as long as the implementation doesn't demand *more* bounds -// than the trait. - -// pretty-expanded FIXME #23616 - -trait A { - fn foo(&self); -} - -impl A for isize { - fn foo(&self) {} // Ord implies Eq, so this is ok. -} - -fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-bounds-in-arc.rs b/src/test/ui/run-pass/traits/trait-bounds-in-arc.rs deleted file mode 100644 index 35210be3478..00000000000 --- a/src/test/ui/run-pass/traits/trait-bounds-in-arc.rs +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that a heterogeneous list of existential types can be put inside an Arc -// and shared between threads as long as all types fulfill Send. - -// ignore-emscripten no threads support - -#![feature(box_syntax)] - -use std::sync::Arc; -use std::sync::mpsc::channel; -use std::thread; - -trait Pet { - fn name(&self, blk: Box); - fn num_legs(&self) -> usize; - fn of_good_pedigree(&self) -> bool; -} - -struct Catte { - num_whiskers: usize, - name: String, -} - -struct Dogge { - bark_decibels: usize, - tricks_known: usize, - name: String, -} - -struct Goldfyshe { - swim_speed: usize, - name: String, -} - -impl Pet for Catte { - fn name(&self, mut blk: Box) { blk(&self.name) } - fn num_legs(&self) -> usize { 4 } - fn of_good_pedigree(&self) -> bool { self.num_whiskers >= 4 } -} -impl Pet for Dogge { - fn name(&self, mut blk: Box) { blk(&self.name) } - fn num_legs(&self) -> usize { 4 } - fn of_good_pedigree(&self) -> bool { - self.bark_decibels < 70 || self.tricks_known > 20 - } -} -impl Pet for Goldfyshe { - fn name(&self, mut blk: Box) { blk(&self.name) } - fn num_legs(&self) -> usize { 0 } - fn of_good_pedigree(&self) -> bool { self.swim_speed >= 500 } -} - -pub fn main() { - let catte = Catte { num_whiskers: 7, name: "alonzo_church".to_string() }; - let dogge1 = Dogge { - bark_decibels: 100, - tricks_known: 42, - name: "alan_turing".to_string(), - }; - let dogge2 = Dogge { - bark_decibels: 55, - tricks_known: 11, - name: "albert_einstein".to_string(), - }; - let fishe = Goldfyshe { - swim_speed: 998, - name: "alec_guinness".to_string(), - }; - let arc = Arc::new(vec![box catte as Box, - box dogge1 as Box, - box fishe as Box, - box dogge2 as Box]); - let (tx1, rx1) = channel(); - let arc1 = arc.clone(); - let t1 = thread::spawn(move|| { check_legs(arc1); tx1.send(()); }); - let (tx2, rx2) = channel(); - let arc2 = arc.clone(); - let t2 = thread::spawn(move|| { check_names(arc2); tx2.send(()); }); - let (tx3, rx3) = channel(); - let arc3 = arc.clone(); - let t3 = thread::spawn(move|| { check_pedigree(arc3); tx3.send(()); }); - rx1.recv(); - rx2.recv(); - rx3.recv(); - t1.join(); - t2.join(); - t3.join(); -} - -fn check_legs(arc: Arc>>) { - let mut legs = 0; - for pet in arc.iter() { - legs += pet.num_legs(); - } - assert!(legs == 12); -} -fn check_names(arc: Arc>>) { - for pet in arc.iter() { - pet.name(Box::new(|name| { - assert!(name.as_bytes()[0] == 'a' as u8 && name.as_bytes()[1] == 'l' as u8); - })) - } -} -fn check_pedigree(arc: Arc>>) { - for pet in arc.iter() { - assert!(pet.of_good_pedigree()); - } -} diff --git a/src/test/ui/run-pass/traits/trait-bounds-on-structs-and-enums.rs b/src/test/ui/run-pass/traits/trait-bounds-on-structs-and-enums.rs deleted file mode 100644 index 1b32c51aa85..00000000000 --- a/src/test/ui/run-pass/traits/trait-bounds-on-structs-and-enums.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait U {} -trait T { fn get(self) -> X; } - -trait S2 { - fn m(x: Box+'static>) {} -} - -struct St { - f: Box+'static>, -} - -impl St { - fn blah() {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-bounds-recursion.rs b/src/test/ui/run-pass/traits/trait-bounds-recursion.rs deleted file mode 100644 index 3cdd7311332..00000000000 --- a/src/test/ui/run-pass/traits/trait-bounds-recursion.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait I { fn i(&self) -> Self; } - -trait A { - fn id(x:T) -> T { x.i() } -} - -trait J { fn j(&self) -> T; } - -trait B> { - fn id(x:T) -> T { x.j() } -} - -trait C { - fn id>(x:T) -> T { x.j() } -} - -pub fn main() { } diff --git a/src/test/ui/run-pass/traits/trait-bounds.rs b/src/test/ui/run-pass/traits/trait-bounds.rs deleted file mode 100644 index 3c433b58a3a..00000000000 --- a/src/test/ui/run-pass/traits/trait-bounds.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_snake_case)] - -trait connection { - fn read(&self) -> isize; -} - -trait connection_factory { - fn create(&self) -> C; -} - -type my_connection = (); -type my_connection_factory = (); - -impl connection for () { - fn read(&self) -> isize { 43 } -} - -impl connection_factory for my_connection_factory { - fn create(&self) -> my_connection { () } -} - -pub fn main() { - let factory = (); - let connection = factory.create(); - let result = connection.read(); - assert_eq!(result, 43); -} diff --git a/src/test/ui/run-pass/traits/trait-cache-issue-18209.rs b/src/test/ui/run-pass/traits/trait-cache-issue-18209.rs deleted file mode 100644 index 14452b009cf..00000000000 --- a/src/test/ui/run-pass/traits/trait-cache-issue-18209.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the cache results from the default method do not pollute -// the cache for the later call in `load()`. -// -// See issue #18209. - -// pretty-expanded FIXME #23616 - -pub trait Foo { - fn load_from() -> Box; - fn load() -> Box { - Foo::load_from() - } -} - -pub fn load() -> Box { - Foo::load() -} - -fn main() { } diff --git a/src/test/ui/run-pass/traits/trait-coercion-generic.rs b/src/test/ui/run-pass/traits/trait-coercion-generic.rs deleted file mode 100644 index 2b64bb005e9..00000000000 --- a/src/test/ui/run-pass/traits/trait-coercion-generic.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Trait { - fn f(&self, x: T); -} - -#[derive(Copy, Clone)] -struct Struct { - x: isize, - y: isize, -} - -impl Trait<&'static str> for Struct { - fn f(&self, x: &'static str) { - println!("Hi, {}!", x); - } -} - -pub fn main() { - let a = Struct { x: 1, y: 2 }; - let b: Box> = Box::new(a); - b.f("Mary"); - let c: &Trait<&'static str> = &a; - c.f("Joe"); -} diff --git a/src/test/ui/run-pass/traits/trait-coercion.rs b/src/test/ui/run-pass/traits/trait-coercion.rs deleted file mode 100644 index 18fc122439b..00000000000 --- a/src/test/ui/run-pass/traits/trait-coercion.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::io::{self, Write}; - -trait Trait { - fn f(&self); -} - -#[derive(Copy, Clone)] -struct Struct { - x: isize, - y: isize, -} - -impl Trait for Struct { - fn f(&self) { - println!("Hi!"); - } -} - -fn foo(mut a: Box) {} - -pub fn main() { - let a = Struct { x: 1, y: 2 }; - let b: Box = Box::new(a); - b.f(); - let c: &Trait = &a; - c.f(); - - let out = io::stdout(); - foo(Box::new(out)); -} diff --git a/src/test/ui/run-pass/traits/trait-composition-trivial.rs b/src/test/ui/run-pass/traits/trait-composition-trivial.rs deleted file mode 100644 index c491beda270..00000000000 --- a/src/test/ui/run-pass/traits/trait-composition-trivial.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Foo { - fn foo(&self); -} - -trait Bar : Foo { - fn bar(&self); -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-copy-guessing.rs b/src/test/ui/run-pass/traits/trait-copy-guessing.rs deleted file mode 100644 index 2d2ea50a1fd..00000000000 --- a/src/test/ui/run-pass/traits/trait-copy-guessing.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// "guessing" in trait selection can affect `copy_or_move`. Check that this -// is correctly handled. I am not sure what is the "correct" behaviour, -// but we should at least not ICE. - -use std::mem; - -struct U([u8; 1337]); - -struct S<'a,T:'a>(&'a T); -impl<'a, T> Clone for S<'a, T> { fn clone(&self) -> Self { S(self.0) } } -/// This impl triggers inference "guessing" - S<_>: Copy => _ = U -impl<'a> Copy for S<'a, Option> {} - -fn assert_impls_fnR>(_: &T){} - -fn main() { - let n = None; - let e = S(&n); - let f = || { - // S being copy is critical for this to work - drop(e); - mem::size_of_val(e.0) - }; - assert_impls_fn(&f); - assert_eq!(f(), 1337+1); - - assert_eq!((|| { - // S being Copy is not critical here, but - // we check it anyway. - let n = None; - let e = S(&n); - let ret = mem::size_of_val(e.0); - drop(e); - ret - })(), 1337+1); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-bound-subst.rs b/src/test/ui/run-pass/traits/trait-default-method-bound-subst.rs deleted file mode 100644 index 9a0e53340f6..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-bound-subst.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait A { - fn g(&self, x: T, y: U) -> (T, U) { (x, y) } -} - -impl A for i32 { } -impl A for u32 { } - -fn f>(i: V, j: T, k: U) -> (T, U) { - i.g(j, k) -} - -pub fn main () { - assert_eq!(f(0, 1, 2), (1, 2)); - assert_eq!(f(0, 1, 2), (1, 2)); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-bound-subst2.rs b/src/test/ui/run-pass/traits/trait-default-method-bound-subst2.rs deleted file mode 100644 index 9139a26d295..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-bound-subst2.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait A { - fn g(&self, x: T) -> T { x } -} - -impl A for isize { } - -fn f>(i: V, j: T) -> T { - i.g(j) -} - -pub fn main () { - assert_eq!(f(0, 2), 2); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-bound-subst3.rs b/src/test/ui/run-pass/traits/trait-default-method-bound-subst3.rs deleted file mode 100644 index f7445372fbe..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-bound-subst3.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait A { - fn g(&self, x: T, y: T) -> (T, T) { (x, y) } -} - -impl A for isize { } - -fn f(i: V, j: T, k: T) -> (T, T) { - i.g(j, k) -} - -pub fn main () { - assert_eq!(f(0, 1, 2), (1, 2)); - assert_eq!(f(0, 1u8, 2u8), (1u8, 2u8)); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-bound-subst4.rs b/src/test/ui/run-pass/traits/trait-default-method-bound-subst4.rs deleted file mode 100644 index 70c440c7665..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-bound-subst4.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait A { - fn g(&self, x: usize) -> usize { x } - fn h(&self, x: T) { } -} - -impl A for isize { } - -fn f>(i: V, j: usize) -> usize { - i.g(j) -} - -pub fn main () { - assert_eq!(f::(0, 2), 2); - assert_eq!(f::(0, 2), 2); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-bound.rs b/src/test/ui/run-pass/traits/trait-default-method-bound.rs deleted file mode 100644 index 6291be02110..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-bound.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait A { - fn g(&self) -> isize { 10 } -} - -impl A for isize { } - -fn f(i: T) { - assert_eq!(i.g(), 10); -} - -pub fn main () { - f(0); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-xc-2.rs b/src/test/ui/run-pass/traits/trait-default-method-xc-2.rs deleted file mode 100644 index c0e27fa8757..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-xc-2.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:trait_default_method_xc_aux.rs -// aux-build:trait_default_method_xc_aux_2.rs - - - -extern crate trait_default_method_xc_aux as aux; -extern crate trait_default_method_xc_aux_2 as aux2; -use aux::A; -use aux2::{a_struct, welp}; - - -pub fn main () { - - let a = a_struct { x: 0 }; - let b = a_struct { x: 1 }; - - assert_eq!(0.g(), 10); - assert_eq!(a.g(), 10); - assert_eq!(a.h(), 11); - assert_eq!(b.g(), 10); - assert_eq!(b.h(), 11); - assert_eq!(A::lurr(&a, &b), 21); - - welp(&0); -} diff --git a/src/test/ui/run-pass/traits/trait-default-method-xc.rs b/src/test/ui/run-pass/traits/trait-default-method-xc.rs deleted file mode 100644 index 426b3e2ad79..00000000000 --- a/src/test/ui/run-pass/traits/trait-default-method-xc.rs +++ /dev/null @@ -1,90 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// aux-build:trait_default_method_xc_aux.rs - - -extern crate trait_default_method_xc_aux as aux; -use aux::{A, TestEquality, Something}; -use aux::B; - -fn f(i: T) { - assert_eq!(i.g(), 10); -} - -fn welp(i: isize, _x: &T) -> isize { - i.g() -} - -mod stuff { - pub struct thing { pub x: isize } -} - -impl A for stuff::thing { - fn f(&self) -> isize { 10 } -} - -fn g>(i: V, j: T, k: U) -> (T, U) { - i.thing(j, k) -} - -fn eq(lhs: &T, rhs: &T) -> bool { - lhs.test_eq(rhs) -} -fn neq(lhs: &T, rhs: &T) -> bool { - lhs.test_neq(rhs) -} - - -impl TestEquality for stuff::thing { - fn test_eq(&self, rhs: &stuff::thing) -> bool { - //self.x.test_eq(&rhs.x) - eq(&self.x, &rhs.x) - } -} - - -pub fn main() { - // Some tests of random things - f(0); - - assert_eq!(A::lurr(&0, &1), 21); - - let a = stuff::thing { x: 0 }; - let b = stuff::thing { x: 1 }; - let c = Something { x: 1 }; - - assert_eq!(0.g(), 10); - assert_eq!(a.g(), 10); - assert_eq!(a.h(), 11); - assert_eq!(c.h(), 11); - - assert_eq!(0.thing(3.14f64, 1), (3.14f64, 1)); - assert_eq!(B::staticthing(&0, 3.14f64, 1), (3.14f64, 1)); - assert_eq!(B::::staticthing::(&0, 3.14, 1), (3.14, 1)); - - assert_eq!(g(0, 3.14f64, 1), (3.14f64, 1)); - assert_eq!(g(false, 3.14f64, 1), (3.14, 1)); - - - // Trying out a real one - assert!(12.test_neq(&10)); - assert!(!10.test_neq(&10)); - assert!(a.test_neq(&b)); - assert!(!a.test_neq(&a)); - - assert!(neq(&12, &10)); - assert!(!neq(&10, &10)); - assert!(neq(&a, &b)); - assert!(!neq(&a, &a)); -} diff --git a/src/test/ui/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs b/src/test/ui/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs deleted file mode 100644 index 753141bcf21..00000000000 --- a/src/test/ui/run-pass/traits/trait-false-ambiguity-where-clause-builtin-bound.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we do not error out because of a (False) ambiguity -// between the builtin rules for Sized and the where clause. Issue -// #20959. - -// pretty-expanded FIXME #23616 - -fn foo(x: Option) - where Option : Sized -{ - let _y = x; -} - -fn main() { - foo(Some(22)); -} diff --git a/src/test/ui/run-pass/traits/trait-generic.rs b/src/test/ui/run-pass/traits/trait-generic.rs deleted file mode 100644 index a230ad03de8..00000000000 --- a/src/test/ui/run-pass/traits/trait-generic.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - - -trait to_str { - fn to_string_(&self) -> String; -} -impl to_str for isize { - fn to_string_(&self) -> String { self.to_string() } -} -impl to_str for String { - fn to_string_(&self) -> String { self.clone() } -} -impl to_str for () { - fn to_string_(&self) -> String { "()".to_string() } -} - -trait map { - fn map(&self, f: F) -> Vec where F: FnMut(&T) -> U; -} -impl map for Vec { - fn map(&self, mut f: F) -> Vec where F: FnMut(&T) -> U { - let mut r = Vec::new(); - for i in self { - r.push(f(i)); - } - r - } -} - -fn foo>(x: T) -> Vec { - x.map(|_e| "hi".to_string() ) -} -fn bar>(x: T) -> Vec { - x.map(|_e| _e.to_string_() ) -} - -pub fn main() { - assert_eq!(foo(vec![1]), ["hi".to_string()]); - assert_eq!(bar:: >(vec![4, 5]), ["4".to_string(), "5".to_string()]); - assert_eq!(bar:: >(vec!["x".to_string(), "y".to_string()]), - ["x".to_string(), "y".to_string()]); - assert_eq!(bar::<(), Vec<()>>(vec![()]), ["()".to_string()]); -} diff --git a/src/test/ui/run-pass/traits/trait-impl-2.rs b/src/test/ui/run-pass/traits/trait-impl-2.rs deleted file mode 100644 index 8fadb09377f..00000000000 --- a/src/test/ui/run-pass/traits/trait-impl-2.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// pretty-expanded FIXME #23616 - -pub mod Foo { - pub trait Trait { - fn foo(&self); - } -} - -mod Bar { - impl<'a> ::Foo::Trait+'a { - fn bar(&self) { self.foo() } - } -} - -fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-impl.rs b/src/test/ui/run-pass/traits/trait-impl.rs deleted file mode 100644 index 1ba76676092..00000000000 --- a/src/test/ui/run-pass/traits/trait-impl.rs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test calling methods on an impl for a bare trait. - -// aux-build:traitimpl.rs - -extern crate traitimpl; -use traitimpl::Bar; - -static mut COUNT: usize = 1; - -trait T { - fn t(&self) {} -} - -impl<'a> T+'a { - fn foo(&self) { - unsafe { COUNT *= 2; } - } - fn bar() { - unsafe { COUNT *= 3; } - } -} - -impl T for isize {} - -struct Foo; -impl<'a> Bar<'a> for Foo {} - -fn main() { - let x: &T = &42; - - x.foo(); - T::foo(x); - T::bar(); - - unsafe { assert_eq!(COUNT, 12); } - - // Cross-crait case - let x: &Bar = &Foo; - x.bar(); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-auto-xc-2.rs b/src/test/ui/run-pass/traits/trait-inheritance-auto-xc-2.rs deleted file mode 100644 index 273a3f48332..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-auto-xc-2.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:trait_inheritance_auto_xc_2_aux.rs - - -extern crate trait_inheritance_auto_xc_2_aux as aux; - -// aux defines impls of Foo, Bar and Baz for A -use aux::{Foo, Bar, Baz, A}; - -// We want to extend all Foo, Bar, Bazes to Quuxes -pub trait Quux: Foo + Bar + Baz { } -impl Quux for T { } - -fn f(a: &T) { - assert_eq!(a.f(), 10); - assert_eq!(a.g(), 20); - assert_eq!(a.h(), 30); -} - -pub fn main() { - let a = &A { x: 3 }; - f(a); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-auto-xc.rs b/src/test/ui/run-pass/traits/trait-inheritance-auto-xc.rs deleted file mode 100644 index d6b3d900a09..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-auto-xc.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:trait_inheritance_auto_xc_aux.rs - - -extern crate trait_inheritance_auto_xc_aux as aux; - -use aux::{Foo, Bar, Baz, Quux}; - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } -impl Baz for A { fn h(&self) -> isize { 30 } } - -fn f(a: &T) { - assert_eq!(a.f(), 10); - assert_eq!(a.g(), 20); - assert_eq!(a.h(), 30); -} - -pub fn main() { - let a = &A { x: 3 }; - f(a); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-auto.rs b/src/test/ui/run-pass/traits/trait-inheritance-auto.rs deleted file mode 100644 index 698f8ac23dd..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-auto.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Testing that this impl turns A into a Quux, because -// A is already a Foo Bar Baz - -impl Quux for T { } - -trait Foo { fn f(&self) -> isize; } -trait Bar { fn g(&self) -> isize; } -trait Baz { fn h(&self) -> isize; } - -trait Quux: Foo + Bar + Baz { } - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } -impl Baz for A { fn h(&self) -> isize { 30 } } - -fn f(a: &T) { - assert_eq!(a.f(), 10); - assert_eq!(a.g(), 20); - assert_eq!(a.h(), 30); -} - -pub fn main() { - let a = &A { x: 3 }; - f(a); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited.rs b/src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited.rs deleted file mode 100644 index 566d59f460e..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { fn f(&self) -> isize; } -trait Bar : Foo { fn g(&self) -> isize; } - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } - -// Call a function on Foo, given a T: Bar -fn gg(a: &T) -> isize { - a.f() -} - -pub fn main() { - let a = &A { x: 3 }; - assert_eq!(gg(a), 10); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited2.rs b/src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited2.rs deleted file mode 100644 index a769da5e2cb..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-call-bound-inherited2.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { fn f(&self) -> isize; } -trait Bar : Foo { fn g(&self) -> isize; } -trait Baz : Bar { fn h(&self) -> isize; } - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } -impl Baz for A { fn h(&self) -> isize { 30 } } - -// Call a function on Foo, given a T: Baz, -// which is inherited via Bar -fn gg(a: &T) -> isize { - a.f() -} - -pub fn main() { - let a = &A { x: 3 }; - assert_eq!(gg(a), 10); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs b/src/test/ui/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs deleted file mode 100644 index 00d74ca0781..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Testing that we can cast to a subtrait and call subtrait -// methods. Not testing supertrait methods - - -trait Foo { - fn f(&self) -> isize; -} - -trait Bar : Foo { - fn g(&self) -> isize; -} - -struct A { - x: isize -} - -impl Foo for A { - fn f(&self) -> isize { 10 } -} - -impl Bar for A { - fn g(&self) -> isize { 20 } -} - -pub fn main() { - let a = &A { x: 3 }; - let afoo = a as &Foo; - let abar = a as &Bar; - assert_eq!(afoo.f(), 10); - assert_eq!(abar.g(), 20); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-cast.rs b/src/test/ui/run-pass/traits/trait-inheritance-cast.rs deleted file mode 100644 index f2d1cb0cb3d..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-cast.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Testing that supertrait methods can be called on subtrait object types - - -trait Foo { - fn f(&self) -> isize; -} - -trait Bar : Foo { - fn g(&self) -> isize; -} - -struct A { - x: isize -} - -impl Foo for A { - fn f(&self) -> isize { 10 } -} - -impl Bar for A { - fn g(&self) -> isize { 20 } -} - -pub fn main() { - let a = &A { x: 3 }; - let afoo = a as &Foo; - let abar = a as &Bar; - assert_eq!(afoo.f(), 10); - assert_eq!(abar.g(), 20); - assert_eq!(abar.f(), 10); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs b/src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs deleted file mode 100644 index 2d4756cf925..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call-xc.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:trait_xc_call_aux.rs - - -extern crate trait_xc_call_aux as aux; - -use aux::Foo; - -trait Bar : Foo { - fn g(&self) -> isize; -} - -impl Bar for aux::A { - fn g(&self) -> isize { self.f() } -} - -pub fn main() { - let a = &aux::A { x: 3 }; - assert_eq!(a.g(), 10); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call.rs b/src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call.rs deleted file mode 100644 index 3a57fc525b2..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-cross-trait-call.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { fn f(&self) -> isize; } -trait Bar : Foo { fn g(&self) -> isize; } - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } - -impl Bar for A { - // Testing that this impl can call the impl of Foo - fn g(&self) -> isize { self.f() } -} - -pub fn main() { - let a = &A { x: 3 }; - assert_eq!(a.g(), 10); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-diamond.rs b/src/test/ui/run-pass/traits/trait-inheritance-diamond.rs deleted file mode 100644 index bf66d50d159..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-diamond.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// B and C both require A, so D does as well, twice, but that's just fine - - -trait A { fn a(&self) -> isize; } -trait B: A { fn b(&self) -> isize; } -trait C: A { fn c(&self) -> isize; } -trait D: B + C { fn d(&self) -> isize; } - -struct S { bogus: () } - -impl A for S { fn a(&self) -> isize { 10 } } -impl B for S { fn b(&self) -> isize { 20 } } -impl C for S { fn c(&self) -> isize { 30 } } -impl D for S { fn d(&self) -> isize { 40 } } - -fn f(x: &T) { - assert_eq!(x.a(), 10); - assert_eq!(x.b(), 20); - assert_eq!(x.c(), 30); - assert_eq!(x.d(), 40); -} - -pub fn main() { - let value = &S { bogus: () }; - f(value); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-multiple-inheritors.rs b/src/test/ui/run-pass/traits/trait-inheritance-multiple-inheritors.rs deleted file mode 100644 index b9a9795c6c0..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-multiple-inheritors.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait A { fn a(&self) -> isize; } -trait B: A { fn b(&self) -> isize; } -trait C: A { fn c(&self) -> isize; } - -struct S { bogus: () } - -impl A for S { fn a(&self) -> isize { 10 } } -impl B for S { fn b(&self) -> isize { 20 } } -impl C for S { fn c(&self) -> isize { 30 } } - -// Both B and C inherit from A -fn f(x: &T) { - assert_eq!(x.a(), 10); - assert_eq!(x.b(), 20); - assert_eq!(x.c(), 30); -} - -pub fn main() { - f(&S { bogus: () }) -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-multiple-params.rs b/src/test/ui/run-pass/traits/trait-inheritance-multiple-params.rs deleted file mode 100644 index 5e6aa85498c..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-multiple-params.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait A { fn a(&self) -> isize; } -trait B: A { fn b(&self) -> isize; } -trait C: A { fn c(&self) -> isize; } - -struct S { bogus: () } - -impl A for S { fn a(&self) -> isize { 10 } } -impl B for S { fn b(&self) -> isize { 20 } } -impl C for S { fn c(&self) -> isize { 30 } } - -// Multiple type params, multiple levels of inheritance -fn f(x: &X, y: &Y, z: &Z) { - assert_eq!(x.a(), 10); - assert_eq!(y.a(), 10); - assert_eq!(y.b(), 20); - assert_eq!(z.a(), 10); - assert_eq!(z.c(), 30); -} - -pub fn main() { - let s = &S { bogus: () }; - f(s, s, s); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-num.rs b/src/test/ui/run-pass/traits/trait-inheritance-num.rs deleted file mode 100644 index 9d4c9f431dd..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-num.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait NumExt: PartialEq + PartialOrd {} - -pub trait FloatExt: NumExt {} - -fn greater_than_one(n: &T) -> bool { loop {} } -fn greater_than_one_float(n: &T) -> bool { loop {} } - -pub fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-num0.rs b/src/test/ui/run-pass/traits/trait-inheritance-num0.rs deleted file mode 100644 index 0d57dee49a1..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-num0.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Extending Num and using inherited static methods - -// pretty-expanded FIXME #23616 - -use std::cmp::PartialOrd; - -pub trait NumCast: Sized { - fn from(i: i32) -> Option; -} - -pub trait Num { - fn from_int(i: isize) -> Self; - fn gt(&self, other: &Self) -> bool; -} - -pub trait NumExt: NumCast + PartialOrd { } - -fn greater_than_one(n: &T) -> bool { - n.gt(&NumCast::from(1).unwrap()) -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-num1.rs b/src/test/ui/run-pass/traits/trait-inheritance-num1.rs deleted file mode 100644 index e2a4f4154f9..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-num1.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait NumCast: Sized { - fn from(i: i32) -> Option; -} - -pub trait NumExt: NumCast + PartialOrd { } - -fn greater_than_one(n: &T) -> bool { - *n > NumCast::from(1).unwrap() -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-num2.rs b/src/test/ui/run-pass/traits/trait-inheritance-num2.rs deleted file mode 100644 index 0b9e18c1d27..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-num2.rs +++ /dev/null @@ -1,96 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A more complex example of numeric extensions - -pub trait TypeExt {} - -impl TypeExt for u8 {} -impl TypeExt for u16 {} -impl TypeExt for u32 {} -impl TypeExt for u64 {} -impl TypeExt for usize {} - -impl TypeExt for i8 {} -impl TypeExt for i16 {} -impl TypeExt for i32 {} -impl TypeExt for i64 {} -impl TypeExt for isize {} - -impl TypeExt for f32 {} -impl TypeExt for f64 {} - - -pub trait NumExt: TypeExt + PartialEq + PartialOrd {} - -impl NumExt for u8 {} -impl NumExt for u16 {} -impl NumExt for u32 {} -impl NumExt for u64 {} -impl NumExt for usize {} - -impl NumExt for i8 {} -impl NumExt for i16 {} -impl NumExt for i32 {} -impl NumExt for i64 {} -impl NumExt for isize {} - -impl NumExt for f32 {} -impl NumExt for f64 {} - - -pub trait UnSignedExt: NumExt {} - -impl UnSignedExt for u8 {} -impl UnSignedExt for u16 {} -impl UnSignedExt for u32 {} -impl UnSignedExt for u64 {} -impl UnSignedExt for usize {} - - -pub trait SignedExt: NumExt {} - -impl SignedExt for i8 {} -impl SignedExt for i16 {} -impl SignedExt for i32 {} -impl SignedExt for i64 {} -impl SignedExt for isize {} - -impl SignedExt for f32 {} -impl SignedExt for f64 {} - - -pub trait IntegerExt: NumExt {} - -impl IntegerExt for u8 {} -impl IntegerExt for u16 {} -impl IntegerExt for u32 {} -impl IntegerExt for u64 {} -impl IntegerExt for usize {} - -impl IntegerExt for i8 {} -impl IntegerExt for i16 {} -impl IntegerExt for i32 {} -impl IntegerExt for i64 {} -impl IntegerExt for isize {} - - -pub trait FloatExt: NumExt {} - -impl FloatExt for f32 {} -impl FloatExt for f64 {} - - -fn test_float_ext(n: T) { println!("{}", n < n) } - -pub fn main() { - test_float_ext(1f32); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-num3.rs b/src/test/ui/run-pass/traits/trait-inheritance-num3.rs deleted file mode 100644 index c86b2127a6d..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-num3.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait NumCast: Sized { - fn from(i: i32) -> Option; -} - -pub trait NumExt: PartialEq + PartialOrd + NumCast {} - -impl NumExt for f32 {} -impl NumCast for f32 { - fn from(i: i32) -> Option { Some(i as f32) } -} - -fn num_eq_one(n: T) { - println!("{}", n == NumCast::from(1).unwrap()) -} - -pub fn main() { - num_eq_one(1f32); // you need to actually use the function to trigger the ICE -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-num5.rs b/src/test/ui/run-pass/traits/trait-inheritance-num5.rs deleted file mode 100644 index ff64f393341..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-num5.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -pub trait NumCast: Sized { - fn from(i: i32) -> Option; -} - -pub trait NumExt: PartialEq + NumCast {} - -impl NumExt for f32 {} -impl NumExt for isize {} - -impl NumCast for f32 { - fn from(i: i32) -> Option { Some(i as f32) } -} -impl NumCast for isize { - fn from(i: i32) -> Option { Some(i as isize) } -} - -fn num_eq_one() -> T { - NumCast::from(1).unwrap() -} - -pub fn main() { - num_eq_one::(); // you need to actually use the function to trigger the ICE -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-overloading-simple.rs b/src/test/ui/run-pass/traits/trait-inheritance-overloading-simple.rs deleted file mode 100644 index ff2f6b2d825..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-overloading-simple.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cmp::PartialEq; - -trait MyNum : PartialEq { } - -#[derive(Debug)] -struct MyInt { val: isize } - -impl PartialEq for MyInt { - fn eq(&self, other: &MyInt) -> bool { self.val == other.val } - fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } -} - -impl MyNum for MyInt {} - -fn f(x: T, y: T) -> bool { - return x == y; -} - -fn mi(v: isize) -> MyInt { MyInt { val: v } } - -pub fn main() { - let (x, y, z) = (mi(3), mi(5), mi(3)); - assert!(x != y); - assert_eq!(x, z); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-overloading-xc-exe.rs b/src/test/ui/run-pass/traits/trait-inheritance-overloading-xc-exe.rs deleted file mode 100644 index ff8009b1c78..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-overloading-xc-exe.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:trait_inheritance_overloading_xc.rs - - -extern crate trait_inheritance_overloading_xc; -use trait_inheritance_overloading_xc::{MyNum, MyInt}; - -fn f(x: T, y: T) -> (T, T, T) { - return (x.clone() + y.clone(), x.clone() - y.clone(), x * y); -} - -fn mi(v: isize) -> MyInt { MyInt { val: v } } - -pub fn main() { - let (x, y) = (mi(3), mi(5)); - let (a, b, c) = f(x, y); - assert_eq!(a, mi(8)); - assert_eq!(b, mi(-2)); - assert_eq!(c, mi(15)); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-overloading.rs b/src/test/ui/run-pass/traits/trait-inheritance-overloading.rs deleted file mode 100644 index 5c15ff579e3..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-overloading.rs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cmp::PartialEq; -use std::ops::{Add, Sub, Mul}; - -trait MyNum : Add + Sub + Mul + PartialEq + Clone { } - -#[derive(Clone, Debug)] -struct MyInt { val: isize } - -impl Add for MyInt { - type Output = MyInt; - - fn add(self, other: MyInt) -> MyInt { mi(self.val + other.val) } -} - -impl Sub for MyInt { - type Output = MyInt; - - fn sub(self, other: MyInt) -> MyInt { mi(self.val - other.val) } -} - -impl Mul for MyInt { - type Output = MyInt; - - fn mul(self, other: MyInt) -> MyInt { mi(self.val * other.val) } -} - -impl PartialEq for MyInt { - fn eq(&self, other: &MyInt) -> bool { self.val == other.val } - fn ne(&self, other: &MyInt) -> bool { !self.eq(other) } -} - -impl MyNum for MyInt {} - -fn f(x: T, y: T) -> (T, T, T) { - return (x.clone() + y.clone(), x.clone() - y.clone(), x * y); -} - -fn mi(v: isize) -> MyInt { MyInt { val: v } } - -pub fn main() { - let (x, y) = (mi(3), mi(5)); - let (a, b, c) = f(x, y); - assert_eq!(a, mi(8)); - assert_eq!(b, mi(-2)); - assert_eq!(c, mi(15)); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-self-in-supertype.rs b/src/test/ui/run-pass/traits/trait-inheritance-self-in-supertype.rs deleted file mode 100644 index 4274b548429..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-self-in-supertype.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test for issue #4183: use of Self in supertraits. - -pub static FUZZY_EPSILON: f64 = 0.1; - -pub trait FuzzyEq { - fn fuzzy_eq(&self, other: &Self) -> bool; - fn fuzzy_eq_eps(&self, other: &Self, epsilon: &Eps) -> bool; -} - -trait Float: Sized+FuzzyEq { - fn two_pi() -> Self; -} - -impl FuzzyEq for f32 { - fn fuzzy_eq(&self, other: &f32) -> bool { - self.fuzzy_eq_eps(other, &(FUZZY_EPSILON as f32)) - } - - fn fuzzy_eq_eps(&self, other: &f32, epsilon: &f32) -> bool { - (*self - *other).abs() < *epsilon - } -} - -impl Float for f32 { - fn two_pi() -> f32 { 6.28318530717958647692528676655900576_f32 } -} - -impl FuzzyEq for f64 { - fn fuzzy_eq(&self, other: &f64) -> bool { - self.fuzzy_eq_eps(other, &(FUZZY_EPSILON as f64)) - } - - fn fuzzy_eq_eps(&self, other: &f64, epsilon: &f64) -> bool { - (*self - *other).abs() < *epsilon - } -} - -impl Float for f64 { - fn two_pi() -> f64 { 6.28318530717958647692528676655900576_f64 } -} - -fn compare(f1: F) -> bool { - let f2 = Float::two_pi(); - f1.fuzzy_eq(&f2) -} - -pub fn main() { - assert!(compare::(6.28318530717958647692528676655900576)); - assert!(compare::(6.29)); - assert!(compare::(6.3)); - assert!(compare::(6.19)); - assert!(!compare::(7.28318530717958647692528676655900576)); - assert!(!compare::(6.18)); - - assert!(compare::(6.28318530717958647692528676655900576)); - assert!(compare::(6.29)); - assert!(compare::(6.3)); - assert!(compare::(6.19)); - assert!(!compare::(7.28318530717958647692528676655900576)); - assert!(!compare::(6.18)); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-self.rs b/src/test/ui/run-pass/traits/trait-inheritance-self.rs deleted file mode 100644 index f66273dd901..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-self.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - fn f(&self, x: &T); -} - -trait Bar : Sized + Foo { - fn g(&self); -} - -struct S { - x: isize -} - -impl Foo for S { - fn f(&self, x: &S) { - println!("{}", x.x); - } -} - -impl Bar for S { - fn g(&self) { - self.f(self); - } -} - -pub fn main() { - let s = S { x: 1 }; - s.g(); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-simple.rs b/src/test/ui/run-pass/traits/trait-inheritance-simple.rs deleted file mode 100644 index 379a98cdebe..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-simple.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { fn f(&self) -> isize; } -trait Bar : Foo { fn g(&self) -> isize; } - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } - -fn ff(a: &T) -> isize { - a.f() -} - -fn gg(a: &T) -> isize { - a.g() -} - -pub fn main() { - let a = &A { x: 3 }; - assert_eq!(ff(a), 10); - assert_eq!(gg(a), 20); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-static.rs b/src/test/ui/run-pass/traits/trait-inheritance-static.rs deleted file mode 100644 index 561c0582ebc..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-static.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub trait MyNum { - fn from_int(_: isize) -> Self; -} - -pub trait NumExt: MyNum { } - -struct S { v: isize } - -impl MyNum for S { - fn from_int(i: isize) -> S { - S { - v: i - } - } -} - -impl NumExt for S { } - -fn greater_than_one() -> T { MyNum::from_int(1) } - -pub fn main() { - let v: S = greater_than_one(); - assert_eq!(v.v, 1); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-static2.rs b/src/test/ui/run-pass/traits/trait-inheritance-static2.rs deleted file mode 100644 index b98b7a1e2d9..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-static2.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -pub trait MyEq {} - -pub trait MyNum { - fn from_int(_: isize) -> Self; -} - -pub trait NumExt: MyEq + MyNum { } - -struct S { v: isize } - -impl MyEq for S { } - -impl MyNum for S { - fn from_int(i: isize) -> S { - S { - v: i - } - } -} - -impl NumExt for S { } - -fn greater_than_one() -> T { MyNum::from_int(1) } - -pub fn main() { - let v: S = greater_than_one(); - assert_eq!(v.v, 1); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-subst.rs b/src/test/ui/run-pass/traits/trait-inheritance-subst.rs deleted file mode 100644 index 02f417eb8fc..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-subst.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub trait Add { - fn add(&self, rhs: &RHS) -> Result; -} - -trait MyNum : Sized + Add { } - -struct MyInt { val: isize } - -impl Add for MyInt { - fn add(&self, other: &MyInt) -> MyInt { mi(self.val + other.val) } -} - -impl MyNum for MyInt {} - -fn f(x: T, y: T) -> T { - return x.add(&y); -} - -fn mi(v: isize) -> MyInt { MyInt { val: v } } - -pub fn main() { - let (x, y) = (mi(3), mi(5)); - let z = f(x, y); - assert_eq!(z.val, 8) -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-subst2.rs b/src/test/ui/run-pass/traits/trait-inheritance-subst2.rs deleted file mode 100644 index 3efe3e64edf..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-subst2.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Panda { - fn chomp(&self, bamboo: &T) -> T; -} - -trait Add: Panda { - fn add(&self, rhs: &RHS) -> Result; -} - -trait MyNum : Sized + Add { } - -struct MyInt { val: isize } - -impl Panda for MyInt { - fn chomp(&self, bamboo: &MyInt) -> MyInt { - mi(self.val + bamboo.val) - } -} - -impl Add for MyInt { - fn add(&self, other: &MyInt) -> MyInt { self.chomp(other) } -} - -impl MyNum for MyInt {} - -fn f(x: T, y: T) -> T { - return x.add(&y).chomp(&y); -} - -fn mi(v: isize) -> MyInt { MyInt { val: v } } - -pub fn main() { - let (x, y) = (mi(3), mi(5)); - let z = f(x, y); - assert_eq!(z.val, 13); -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance-visibility.rs b/src/test/ui/run-pass/traits/trait-inheritance-visibility.rs deleted file mode 100644 index ea3e88f2f9a..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance-visibility.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -mod traits { - pub trait Foo { fn f(&self) -> isize; } - - impl Foo for isize { fn f(&self) -> isize { 10 } } -} - -trait Quux: traits::Foo { } -impl Quux for T { } - -// Foo is not in scope but because Quux is we can still access -// Foo's methods on a Quux bound typaram -fn f(x: &T) { - assert_eq!(x.f(), 10); -} - -pub fn main() { - f(&0) -} diff --git a/src/test/ui/run-pass/traits/trait-inheritance2.rs b/src/test/ui/run-pass/traits/trait-inheritance2.rs deleted file mode 100644 index 01088d65537..00000000000 --- a/src/test/ui/run-pass/traits/trait-inheritance2.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -trait Foo { fn f(&self) -> isize; } -trait Bar { fn g(&self) -> isize; } -trait Baz { fn h(&self) -> isize; } - -trait Quux: Foo + Bar + Baz { } - -struct A { x: isize } - -impl Foo for A { fn f(&self) -> isize { 10 } } -impl Bar for A { fn g(&self) -> isize { 20 } } -impl Baz for A { fn h(&self) -> isize { 30 } } -impl Quux for A {} - -fn f(a: &T) { - assert_eq!(a.f(), 10); - assert_eq!(a.g(), 20); - assert_eq!(a.h(), 30); -} - -pub fn main() { - let a = &A { x: 3 }; - f(a); -} diff --git a/src/test/ui/run-pass/traits/trait-item-inside-macro.rs b/src/test/ui/run-pass/traits/trait-item-inside-macro.rs deleted file mode 100644 index a61afbba55f..00000000000 --- a/src/test/ui/run-pass/traits/trait-item-inside-macro.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #34183 - -macro_rules! foo { - () => { - fn foo() { } - } -} - -macro_rules! bar { - () => { - fn bar(); - } -} - -trait Bleh { - foo!(); - bar!(); -} - -struct Test; - -impl Bleh for Test { - fn bar() {} -} - -fn main() { - Test::bar(); - Test::foo(); -} diff --git a/src/test/ui/run-pass/traits/trait-object-auto-dedup.rs b/src/test/ui/run-pass/traits/trait-object-auto-dedup.rs deleted file mode 100644 index c33482e8a71..00000000000 --- a/src/test/ui/run-pass/traits/trait-object-auto-dedup.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that duplicate auto trait bounds in trait objects don't create new types. -#[allow(unused_assignments)] - -use std::marker::Send as SendAlias; - -// A dummy trait for the non-auto trait. -trait Trait {} - -// A dummy struct to implement Trait, Send, and . -struct Struct; - -impl Trait for Struct {} - -// These three functions should be equivalent. -fn takes_dyn_trait_send(_: Box) {} -fn takes_dyn_trait_send_send(_: Box) {} -fn takes_dyn_trait_send_sendalias(_: Box) {} - -impl dyn Trait + Send + Send { - fn do_nothing(&self) {} -} - -fn main() { - // 1. Moving into a variable with more Sends and back. - let mut dyn_trait_send = Box::new(Struct) as Box; - let dyn_trait_send_send: Box = dyn_trait_send; - dyn_trait_send = dyn_trait_send_send; - - // 2. Calling methods with different number of Sends. - let dyn_trait_send = Box::new(Struct) as Box; - takes_dyn_trait_send_send(dyn_trait_send); - - let dyn_trait_send_send = Box::new(Struct) as Box; - takes_dyn_trait_send(dyn_trait_send_send); - - // 3. Aliases to the trait are transparent. - let dyn_trait_send = Box::new(Struct) as Box; - takes_dyn_trait_send_sendalias(dyn_trait_send); - - // 4. Calling an impl that duplicates an auto trait. - let dyn_trait_send = Box::new(Struct) as Box; - dyn_trait_send.do_nothing(); -} diff --git a/src/test/ui/run-pass/traits/trait-object-exclusion.rs b/src/test/ui/run-pass/traits/trait-object-exclusion.rs deleted file mode 100644 index a48c7876967..00000000000 --- a/src/test/ui/run-pass/traits/trait-object-exclusion.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Future: 'static { - // The requirement for Self: Sized must prevent instantiation of - // Future::forget in vtables, otherwise there's an infinite type - // recursion through as Future>::forget. - fn forget(self) where Self: Sized { - Box::new(Map(self)) as Box; - } -} - -struct Map(A); -impl Future for Map {} - -pub struct Promise; -impl Future for Promise {} - -fn main() { - Promise.forget(); -} diff --git a/src/test/ui/run-pass/traits/trait-object-generics.rs b/src/test/ui/run-pass/traits/trait-object-generics.rs deleted file mode 100644 index b76717a28ff..00000000000 --- a/src/test/ui/run-pass/traits/trait-object-generics.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// test for #8664 - -#![feature(box_syntax)] - -use std::marker; - -pub trait Trait2 { - fn doit(&self) -> A; -} - -pub struct Impl { - m1: marker::PhantomData<(A1,A2,A3)>, - /* - * With A2 we get the ICE: - * task failed at 'index out of bounds: the len is 1 but the index is 1', - * src/librustc/middle/subst.rs:58 - */ - t: Box+'static> -} - -impl Impl { - pub fn step(&self) { - self.t.doit(); - } -} - -// test for #8601 - -enum Type { Constant(T) } - -trait Trait { - fn method(&self, _: Type<(K,V)>) -> isize; -} - -impl Trait for () { - fn method(&self, _x: Type<(u8,V)>) -> isize { 0 } -} - -pub fn main() { - let a = box () as Box>; - assert_eq!(a.method(Type::Constant((1, 2))), 0); -} diff --git a/src/test/ui/run-pass/traits/trait-object-lifetime-first.rs b/src/test/ui/run-pass/traits/trait-object-lifetime-first.rs deleted file mode 100644 index 20df809c4ff..00000000000 --- a/src/test/ui/run-pass/traits/trait-object-lifetime-first.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::fmt::Display; - -static BYTE: u8 = 33; - -fn main() { - let x: &('static + Display) = &BYTE; - let y: Box<'static + Display> = Box::new(BYTE); - let xstr = format!("{}", x); - let ystr = format!("{}", y); - assert_eq!(xstr, "33"); - assert_eq!(ystr, "33"); -} diff --git a/src/test/ui/run-pass/traits/trait-object-with-lifetime-bound.rs b/src/test/ui/run-pass/traits/trait-object-with-lifetime-bound.rs deleted file mode 100644 index ffe66606461..00000000000 --- a/src/test/ui/run-pass/traits/trait-object-with-lifetime-bound.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Uncovered during work on new scoping rules for safe destructors -// as an important use case to support properly. - - -pub struct E<'a> { - pub f: &'a u8, -} -impl<'b> E<'b> { - pub fn m(&self) -> &'b u8 { self.f } -} - -pub struct P<'c> { - pub g: &'c u8, -} -pub trait M { - fn n(&self) -> u8; -} -impl<'d> M for P<'d> { - fn n(&self) -> u8 { *self.g } -} - -fn extension<'e>(x: &'e E<'e>) -> Box { - loop { - let p = P { g: x.m() }; - return Box::new(p) as Box; - } -} - -fn main() { - let w = E { f: &10 }; - let o = extension(&w); - assert_eq!(o.n(), 10); -} diff --git a/src/test/ui/run-pass/traits/trait-region-pointer-simple.rs b/src/test/ui/run-pass/traits/trait-region-pointer-simple.rs deleted file mode 100644 index 8f021d5b25a..00000000000 --- a/src/test/ui/run-pass/traits/trait-region-pointer-simple.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Foo { - fn f(&self) -> isize; -} - -struct A { - x: isize -} - -impl Foo for A { - fn f(&self) -> isize { - println!("Today's number is {}", self.x); - return self.x; - } -} - -pub fn main() { - let a = A { x: 3 }; - let b = (&a) as &Foo; - assert_eq!(b.f(), 3); -} diff --git a/src/test/ui/run-pass/traits/trait-safety-ok-cc.rs b/src/test/ui/run-pass/traits/trait-safety-ok-cc.rs deleted file mode 100644 index d1b3dfec45e..00000000000 --- a/src/test/ui/run-pass/traits/trait-safety-ok-cc.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:trait_safety_lib.rs - -// Simple smoke test that unsafe traits can be compiled across crates. - - -extern crate trait_safety_lib as lib; - -use lib::Foo; - -struct Bar { x: isize } -unsafe impl Foo for Bar { - fn foo(&self) -> isize { self.x } -} - -fn take_foo(f: &F) -> isize { f.foo() } - -fn main() { - let x: isize = 22; - assert_eq!(22, take_foo(&x)); - - let x: Bar = Bar { x: 23 }; - assert_eq!(23, take_foo(&x)); -} diff --git a/src/test/ui/run-pass/traits/trait-safety-ok.rs b/src/test/ui/run-pass/traits/trait-safety-ok.rs deleted file mode 100644 index 2787d56164a..00000000000 --- a/src/test/ui/run-pass/traits/trait-safety-ok.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Simple smoke test that unsafe traits can be compiled etc. - - -unsafe trait Foo { - fn foo(&self) -> isize; -} - -unsafe impl Foo for isize { - fn foo(&self) -> isize { *self } -} - -fn take_foo(f: &F) -> isize { f.foo() } - -fn main() { - let x: isize = 22; - assert_eq!(22, take_foo(&x)); -} diff --git a/src/test/ui/run-pass/traits/trait-static-method-overwriting.rs b/src/test/ui/run-pass/traits/trait-static-method-overwriting.rs deleted file mode 100644 index 25307e822ff..00000000000 --- a/src/test/ui/run-pass/traits/trait-static-method-overwriting.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -mod base { - pub trait HasNew { - fn new() -> Self; - } - - pub struct Foo { - dummy: (), - } - - impl ::base::HasNew for Foo { - fn new() -> Foo { - println!("Foo"); - Foo { dummy: () } - } - } - - pub struct Bar { - dummy: (), - } - - impl ::base::HasNew for Bar { - fn new() -> Bar { - println!("Bar"); - Bar { dummy: () } - } - } -} - -pub fn main() { - let _f: base::Foo = base::HasNew::new(); - let _b: base::Bar = base::HasNew::new(); -} diff --git a/src/test/ui/run-pass/traits/trait-to-str.rs b/src/test/ui/run-pass/traits/trait-to-str.rs deleted file mode 100644 index 3fbb7aadde4..00000000000 --- a/src/test/ui/run-pass/traits/trait-to-str.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - - -trait to_str { - fn to_string_(&self) -> String; -} - -impl to_str for isize { - fn to_string_(&self) -> String { self.to_string() } -} - -impl to_str for Vec { - fn to_string_(&self) -> String { - format!("[{}]", - self.iter() - .map(|e| e.to_string_()) - .collect::>() - .join(", ")) - } -} - -pub fn main() { - assert_eq!(1.to_string_(), "1".to_string()); - assert_eq!((vec![2, 3, 4]).to_string_(), "[2, 3, 4]".to_string()); - - fn indirect(x: T) -> String { - format!("{}!", x.to_string_()) - } - assert_eq!(indirect(vec![10, 20]), "[10, 20]!".to_string()); - - fn indirect2(x: T) -> String { - indirect(x) - } - assert_eq!(indirect2(vec![1]), "[1]!".to_string()); -} diff --git a/src/test/ui/run-pass/traits/trait-where-clause-vs-impl.rs b/src/test/ui/run-pass/traits/trait-where-clause-vs-impl.rs deleted file mode 100644 index 3a732aabbf7..00000000000 --- a/src/test/ui/run-pass/traits/trait-where-clause-vs-impl.rs +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that when there is a conditional (but blanket) impl and a -// where clause, we don't get confused in trait resolution. -// -// Issue #18453. - -// pretty-expanded FIXME #23616 - -use std::rc::Rc; - -pub trait Foo { - fn foo(&mut self, msg: M); -} - -pub trait Bar { - fn dummy(&self) -> M; -} - -impl> Foo for F { - fn foo(&mut self, msg: M) { - } -} - -pub struct Both { - inner: Rc<(M, F)>, -} - -impl> Clone for Both { - fn clone(&self) -> Both { - Both { inner: self.inner.clone() } - } -} - -fn repro1>(_both: Both) { -} - -fn repro2>(msg: M, foo: F) { - let both = Both { inner: Rc::new((msg, foo)) }; - repro1(both.clone()); // <--- This clone causes problem -} - -pub fn main() { -} diff --git a/src/test/ui/run-pass/traits/trait-with-bounds-default.rs b/src/test/ui/run-pass/traits/trait-with-bounds-default.rs deleted file mode 100644 index 97fc58d4e54..00000000000 --- a/src/test/ui/run-pass/traits/trait-with-bounds-default.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -pub trait Clone2 { - /// Returns a copy of the value. The contents of boxes - /// are copied to maintain uniqueness, while the contents of - /// managed pointers are not copied. - fn clone(&self) -> Self; -} - -trait Getter { - fn do_get(&self) -> T; - - fn do_get2(&self) -> (T, T) { - let x = self.do_get(); - (x.clone(), x.clone()) - } - -} - -impl Getter for isize { - fn do_get(&self) -> isize { *self } -} - -impl Getter for Option { - fn do_get(&self) -> T { self.as_ref().unwrap().clone() } -} - - -pub fn main() { - assert_eq!(3.do_get2(), (3, 3)); - assert_eq!(Some("hi".to_string()).do_get2(), ("hi".to_string(), "hi".to_string())); -} diff --git a/src/test/ui/run-pass/traits/traits-assoc-type-in-supertrait.rs b/src/test/ui/run-pass/traits/traits-assoc-type-in-supertrait.rs deleted file mode 100644 index 2da40300818..00000000000 --- a/src/test/ui/run-pass/traits/traits-assoc-type-in-supertrait.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test case where an associated type is referenced from within the -// supertrait definition. Issue #20220. - - -use std::vec::IntoIter; - -pub trait Foo: Iterator::Key> { - type Key; -} - -impl Foo for IntoIter { - type Key = i32; -} - -fn sum_foo>(f: F) -> i32 { - f.fold(0, |a,b| a + b) -} - -fn main() { - let x = sum_foo(vec![11, 10, 1].into_iter()); - assert_eq!(x, 22); -} diff --git a/src/test/ui/run-pass/traits/traits-conditional-dispatch.rs b/src/test/ui/run-pass/traits/traits-conditional-dispatch.rs deleted file mode 100644 index e24249ec184..00000000000 --- a/src/test/ui/run-pass/traits/traits-conditional-dispatch.rs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to resolve conditional dispatch. Here, the -// blanket impl for T:Copy coexists with an impl for Box, because -// Box does not impl Copy. - -#![feature(box_syntax)] - -trait Get { - fn get(&self) -> Self; -} - -trait MyCopy { fn copy(&self) -> Self; } -impl MyCopy for u16 { fn copy(&self) -> Self { *self } } -impl MyCopy for u32 { fn copy(&self) -> Self { *self } } -impl MyCopy for i32 { fn copy(&self) -> Self { *self } } -impl MyCopy for Option { fn copy(&self) -> Self { *self } } - -impl Get for T { - fn get(&self) -> T { self.copy() } -} - -impl Get for Box { - fn get(&self) -> Box { box get_it(&**self) } -} - -fn get_it(t: &T) -> T { - (*t).get() -} - -fn main() { - assert_eq!(get_it(&1_u32), 1_u32); - assert_eq!(get_it(&1_u16), 1_u16); - assert_eq!(get_it(&Some(1_u16)), Some(1_u16)); - assert_eq!(get_it(&Box::new(1)), Box::new(1)); -} diff --git a/src/test/ui/run-pass/traits/traits-conditional-model-fn.rs b/src/test/ui/run-pass/traits/traits-conditional-model-fn.rs deleted file mode 100644 index cc5ce571a4e..00000000000 --- a/src/test/ui/run-pass/traits/traits-conditional-model-fn.rs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A model for how the `Fn` traits could work. You can implement at -// most one of `Go`, `GoMut`, or `GoOnce`, and then the others follow -// automatically. - -// aux-build:go_trait.rs - - -extern crate go_trait; - -use go_trait::{Go, GoMut, GoOnce, go, go_mut, go_once}; - -use std::rc::Rc; -use std::cell::Cell; - -/////////////////////////////////////////////////////////////////////////// - -struct SomeGoableThing { - counter: Rc> -} - -impl Go for SomeGoableThing { - fn go(&self, arg: isize) { - self.counter.set(self.counter.get() + arg); - } -} - -/////////////////////////////////////////////////////////////////////////// - -struct SomeGoOnceableThing { - counter: Rc> -} - -impl GoOnce for SomeGoOnceableThing { - fn go_once(self, arg: isize) { - self.counter.set(self.counter.get() + arg); - } -} - -/////////////////////////////////////////////////////////////////////////// - -fn main() { - let counter = Rc::new(Cell::new(0)); - let mut x = SomeGoableThing { counter: counter.clone() }; - - go(&x, 10); - assert_eq!(counter.get(), 10); - - go_mut(&mut x, 100); - assert_eq!(counter.get(), 110); - - go_once(x, 1_000); - assert_eq!(counter.get(), 1_110); - - let x = SomeGoOnceableThing { counter: counter.clone() }; - - go_once(x, 10_000); - assert_eq!(counter.get(), 11_110); -} diff --git a/src/test/ui/run-pass/traits/traits-default-method-macro.rs b/src/test/ui/run-pass/traits/traits-default-method-macro.rs deleted file mode 100644 index 12d057f207d..00000000000 --- a/src/test/ui/run-pass/traits/traits-default-method-macro.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait Foo { - fn bar(&self) -> String { - format!("test") - } -} - -enum Baz { - Quux -} - -impl Foo for Baz { -} - -pub fn main() { - let q = Baz::Quux; - assert_eq!(q.bar(), "test".to_string()); -} diff --git a/src/test/ui/run-pass/traits/traits-default-method-mut.rs b/src/test/ui/run-pass/traits/traits-default-method-mut.rs deleted file mode 100644 index 7cfdae9e652..00000000000 --- a/src/test/ui/run-pass/traits/traits-default-method-mut.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![allow(unused_variables)] - -trait Foo { - fn foo(&self, mut v: isize) { v = 1; } -} - -pub fn main() {} diff --git a/src/test/ui/run-pass/traits/traits-default-method-self.rs b/src/test/ui/run-pass/traits/traits-default-method-self.rs deleted file mode 100644 index e5cea5ca9a5..00000000000 --- a/src/test/ui/run-pass/traits/traits-default-method-self.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait Cat { - fn meow(&self) -> bool; - fn scratch(&self) -> bool { self.purr() } - fn purr(&self) -> bool { true } -} - -impl Cat for isize { - fn meow(&self) -> bool { - self.scratch() - } -} - -pub fn main() { - assert!(5.meow()); -} diff --git a/src/test/ui/run-pass/traits/traits-default-method-trivial.rs b/src/test/ui/run-pass/traits/traits-default-method-trivial.rs deleted file mode 100644 index 314fbcfb40e..00000000000 --- a/src/test/ui/run-pass/traits/traits-default-method-trivial.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -trait Cat { - fn meow(&self) -> bool; - fn scratch(&self) -> bool; - fn purr(&self) -> bool { true } -} - -impl Cat for isize { - fn meow(&self) -> bool { - self.scratch() - } - fn scratch(&self) -> bool { - self.purr() - } -} - -pub fn main() { - assert!(5.meow()); -} diff --git a/src/test/ui/run-pass/traits/traits-elaborate-type-region.rs b/src/test/ui/run-pass/traits/traits-elaborate-type-region.rs deleted file mode 100644 index c2689794b2f..00000000000 --- a/src/test/ui/run-pass/traits/traits-elaborate-type-region.rs +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(dead_code)] - -// Test that we elaborate `Type: 'region` constraints and infer various important things. - -trait Master<'a, T: ?Sized> { - fn foo() where T: 'a; -} - -// [U]: 'a => U: 'a -impl<'a, U> Master<'a, [U]> for () { - fn foo() where U: 'a { } -} - -// &'b U: 'a => 'b: 'a, U: 'a -impl<'a, 'b, U> Master<'a, &'b U> for () { - fn foo() where 'b: 'a, U: 'a { } -} - -// &'b [U]: 'a => 'b: 'a, U: 'a -impl<'a, 'b, U> Master<'a, &'b [U]> for () { - fn foo() where 'b: 'a, U: 'a { } -} - -// Foo<'b>: 'a => 'b: 'a -struct Foo<'a> { x: &'a () } -impl<'a, 'b> Master<'a, Foo<'b>> for () { - fn foo() where 'b: 'a { } -} - -// Bar<'b, T>: 'a => 'b: 'a, T: 'a -struct Bar<'a, T: 'a> { x: &'a T } -impl<'a, 'b, T> Master<'a, Bar<'b, T>> for () { - fn foo() where 'b: 'a, T: 'a { } -} - -// fn(T): 'a => T: 'a -impl<'a, T> Master<'a, fn(T)> for () { - fn foo() where T: 'a { } -} - -// fn() -> T: 'a => T: 'a -impl<'a, T> Master<'a, fn() -> T> for () { - fn foo() where T: 'a { } -} - -fn main() { - println!("Hello, world!"); -} diff --git a/src/test/ui/run-pass/traits/traits-impl-object-overlap-issue-23853.rs b/src/test/ui/run-pass/traits/traits-impl-object-overlap-issue-23853.rs deleted file mode 100644 index f33b5841d85..00000000000 --- a/src/test/ui/run-pass/traits/traits-impl-object-overlap-issue-23853.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to compile the case where both a blanket impl -// and the object type itself supply the required trait obligation. -// In this case, the blanket impl for `Foo` applies to any type, -// including `Bar`, but the object type `Bar` also implicitly supplies -// this context. - -trait Foo { fn dummy(&self) { } } - -trait Bar: Foo { } - -impl Foo for T { } - -fn want_foo() { } - -fn main() { - want_foo::(); -} diff --git a/src/test/ui/run-pass/traits/traits-issue-22019.rs b/src/test/ui/run-pass/traits/traits-issue-22019.rs deleted file mode 100644 index a5da604aeb1..00000000000 --- a/src/test/ui/run-pass/traits/traits-issue-22019.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test an issue where global caching was causing free regions from -// distinct scopes to be compared (`'g` and `'h`). The only important -// thing is that compilation succeeds here. - -// pretty-expanded FIXME #23616 - -#![allow(missing_copy_implementations)] -#![allow(unused_variables)] - -use std::borrow::ToOwned; - -pub struct CFGNode; - -pub type Node<'a> = &'a CFGNode; - -pub trait GraphWalk<'c, N> { - /// Returns all the nodes in this graph. - fn nodes(&'c self) where [N]:ToOwned>; -} - -impl<'g> GraphWalk<'g, Node<'g>> for u32 -{ - fn nodes(&'g self) where [Node<'g>]:ToOwned>> - { loop { } } -} - -impl<'h> GraphWalk<'h, Node<'h>> for u64 -{ - fn nodes(&'h self) where [Node<'h>]:ToOwned>> - { loop { } } -} - -fn main() { } diff --git a/src/test/ui/run-pass/traits/traits-issue-22110.rs b/src/test/ui/run-pass/traits/traits-issue-22110.rs deleted file mode 100644 index 02a2589a4e8..00000000000 --- a/src/test/ui/run-pass/traits/traits-issue-22110.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test an issue where we reported ambiguity between the where-clause -// and the blanket impl. The only important thing is that compilation -// succeeds here. Issue #22110. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] - -trait Foo { - fn foo(&self, a: A); -} - -impl Foo for F { - fn foo(&self, _: A) { } -} - -fn baz Foo<(&'a A,)>>(_: F) { } - -fn components(t: fn(&A)) - where fn(&A) : for<'a> Foo<(&'a A,)>, -{ - baz(t) -} - -fn main() { -} diff --git a/src/test/ui/run-pass/traits/traits-issue-22655.rs b/src/test/ui/run-pass/traits/traits-issue-22655.rs deleted file mode 100644 index 0e80d20ad45..00000000000 --- a/src/test/ui/run-pass/traits/traits-issue-22655.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Regression test for issue #22655: This test should not lead to -// infinite recursion. - -// pretty-expanded FIXME #23616 - -unsafe impl Send for Unique { } - -pub struct Unique { - pointer: *const T, -} - -pub struct Node { - vals: V, - edges: Unique>, -} - -fn is_send() {} - -fn main() { - is_send::>(); -} diff --git a/src/test/ui/run-pass/traits/traits-issue-23003.rs b/src/test/ui/run-pass/traits/traits-issue-23003.rs deleted file mode 100644 index e77b038fc47..00000000000 --- a/src/test/ui/run-pass/traits/traits-issue-23003.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test stack overflow triggered by evaluating the implications. To be -// WF, the type `Receipt` would require that `::Cancel` be WF. This normalizes to `Receipt` -// again, leading to an infinite cycle. Issue #23003. - -// pretty-expanded FIXME #23616 - -#![allow(dead_code)] -#![allow(unused_variables)] - -use std::marker::PhantomData; - -trait Async { - type Cancel; -} - -struct Receipt { - marker: PhantomData, -} - -struct Complete { - core: Option<()>, -} - -impl Async for Complete { - type Cancel = Receipt; -} - -fn foo(r: Receipt) { } - -fn main() { } diff --git a/src/test/ui/run-pass/traits/traits-issue-26339.rs b/src/test/ui/run-pass/traits/traits-issue-26339.rs deleted file mode 100644 index 3176b5cb7f9..00000000000 --- a/src/test/ui/run-pass/traits/traits-issue-26339.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the right implementation is called through a trait -// object when supertraits include multiple references to the -// same trait, with different type parameters. - -trait A: PartialEq + PartialEq { } - -struct Foo; -struct Bar; - -struct Aimpl; - -impl PartialEq for Aimpl { - fn eq(&self, _rhs: &Foo) -> bool { - true - } -} - -impl PartialEq for Aimpl { - fn eq(&self, _rhs: &Bar) -> bool { - false - } -} - -impl A for Aimpl { } - -fn main() { - let a = &Aimpl as &A; - - assert!(*a == Foo); -} diff --git a/src/test/ui/run-pass/traits/traits-multidispatch-infer-convert-target.rs b/src/test/ui/run-pass/traits/traits-multidispatch-infer-convert-target.rs deleted file mode 100644 index 22404849be6..00000000000 --- a/src/test/ui/run-pass/traits/traits-multidispatch-infer-convert-target.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can infer the Target based on the Self or vice versa. - - -use std::mem; - -trait Convert { - fn convert(&self) -> Target; -} - -impl Convert for i16 { - fn convert(&self) -> u32 { - *self as u32 - } -} - -impl Convert for u32 { - fn convert(&self) -> i16 { - *self as i16 - } -} - -fn test(_: T, _: U, t_size: usize, u_size: usize) -where T : Convert -{ - assert_eq!(mem::size_of::(), t_size); - assert_eq!(mem::size_of::(), u_size); -} - -fn main() { - use std::default::Default; - // T = i16, U = u32 - test(22_i16, Default::default(), 2, 4); - - // T = u32, U = i16 - test(22_u32, Default::default(), 4, 2); -} diff --git a/src/test/ui/run-pass/traits/traits-negative-impls.rs b/src/test/ui/run-pass/traits/traits-negative-impls.rs deleted file mode 100644 index 96c86f147ce..00000000000 --- a/src/test/ui/run-pass/traits/traits-negative-impls.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(optin_builtin_traits)] - -use std::marker::Send; - -pub struct WaitToken; -impl !Send for WaitToken {} - -pub struct Test(T); -unsafe impl Send for Test {} - -pub fn spawn(_: F) -> () where F: FnOnce(), F: Send + 'static {} - -fn main() { - let wt = Test(WaitToken); - spawn(move || { - let x = wt; - println!("Hello, World!"); - }); -} diff --git a/src/test/ui/run-pass/traits/traits-repeated-supertrait.rs b/src/test/ui/run-pass/traits/traits-repeated-supertrait.rs deleted file mode 100644 index 4e70669ec96..00000000000 --- a/src/test/ui/run-pass/traits/traits-repeated-supertrait.rs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test a case of a trait which extends the same supertrait twice, but -// with difference type parameters. Test that we can invoke the -// various methods in various ways successfully. -// See also `compile-fail/trait-repeated-supertrait-ambig.rs`. - - -trait CompareTo { - fn same_as(&self, t: T) -> bool; -} - -trait CompareToInts : CompareTo + CompareTo { -} - -impl CompareTo for i64 { - fn same_as(&self, t: i64) -> bool { *self == t } -} - -impl CompareTo for i64 { - fn same_as(&self, t: u64) -> bool { *self == (t as i64) } -} - -impl CompareToInts for i64 { } - -fn with_obj(c: &CompareToInts) -> bool { - c.same_as(22_i64) && c.same_as(22_u64) -} - -fn with_trait(c: &C) -> bool { - c.same_as(22_i64) && c.same_as(22_u64) -} - -fn with_ufcs1(c: &C) -> bool { - CompareToInts::same_as(c, 22_i64) && CompareToInts::same_as(c, 22_u64) -} - -fn with_ufcs2(c: &C) -> bool { - CompareTo::same_as(c, 22_i64) && CompareTo::same_as(c, 22_u64) -} - -fn main() { - assert_eq!(22_i64.same_as(22_i64), true); - assert_eq!(22_i64.same_as(22_u64), true); - assert_eq!(with_trait(&22), true); - assert_eq!(with_obj(&22), true); - assert_eq!(with_ufcs1(&22), true); - assert_eq!(with_ufcs2(&22), true); -} diff --git a/src/test/ui/run-pass/traits/ufcs-trait-object.rs b/src/test/ui/run-pass/traits/ufcs-trait-object.rs deleted file mode 100644 index 06d3c5e9329..00000000000 --- a/src/test/ui/run-pass/traits/ufcs-trait-object.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that when you use ufcs form to invoke a trait method (on a -// trait object) everything works fine. - - -trait Foo { - fn test(&self) -> i32; -} - -impl Foo for i32 { - fn test(&self) -> i32 { *self } -} - -fn main() { - let a: &Foo = &22; - assert_eq!(Foo::test(a), 22); -} diff --git a/src/test/ui/run-pass/traits/use-trait-before-def.rs b/src/test/ui/run-pass/traits/use-trait-before-def.rs deleted file mode 100644 index 4f107fb8242..00000000000 --- a/src/test/ui/run-pass/traits/use-trait-before-def.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Issue #1761 - -// pretty-expanded FIXME #23616 - -impl foo for isize { fn foo(&self) -> isize { 10 } } -trait foo { fn foo(&self) -> isize; } -pub fn main() {} diff --git a/src/test/ui/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs b/src/test/ui/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs deleted file mode 100644 index dc9798a2101..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/auxiliary/unboxed-closures-cross-crate.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -use std::ops::Add; - -#[inline] -pub fn has_closures() -> usize { - let x = 1; - let mut f = move || x; - let y = 1; - let g = || y; - f() + g() -} - -pub fn has_generic_closures + Copy>(x: T, y: T) -> T { - let mut f = move || x; - let g = || y; - f() + g() -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-all-traits.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-all-traits.rs deleted file mode 100644 index f317b835d10..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-all-traits.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(lang_items)] - -fn a isize>(f: F) -> isize { - f(1, 2) -} - -fn b isize>(mut f: F) -> isize { - f(3, 4) -} - -fn c isize>(f: F) -> isize { - f(5, 6) -} - -fn main() { - let z: isize = 7; - assert_eq!(a(move |x: isize, y| x + y + z), 10); - assert_eq!(b(move |x: isize, y| x + y + z), 14); - assert_eq!(c(move |x: isize, y| x + y + z), 18); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs deleted file mode 100644 index eebd30a01f9..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that you can supply `&F` where `F: FnMut()`. - -#![feature(lang_items)] - -fn a i32>(mut f: F) -> i32 { - f() -} - -fn b(f: &mut FnMut() -> i32) -> i32 { - a(f) -} - -fn c i32>(f: &mut F) -> i32 { - a(f) -} - -fn main() { - let z: isize = 7; - - let x = b(&mut || 22); - assert_eq!(x, 22); - - let x = c(&mut || 22); - assert_eq!(x, 22); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs deleted file mode 100644 index 52a10869610..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that you can supply `&F` where `F: Fn()`. - -#![feature(lang_items)] - -fn a i32>(f: F) -> i32 { - f() -} - -fn b(f: &Fn() -> i32) -> i32 { - a(f) -} - -fn c i32>(f: &F) -> i32 { - a(f) -} - -fn main() { - let z: isize = 7; - - let x = b(&|| 22); - assert_eq!(x, 22); - - let x = c(&|| 22); - assert_eq!(x, 22); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-boxed.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-boxed.rs deleted file mode 100644 index b0c40700bb3..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-boxed.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::ops::FnMut; - - fn make_adder(x: i32) -> Boxi32+'static> { - (box move |y: i32| -> i32 { x + y }) as - Boxi32+'static> -} - -pub fn main() { - let mut adder = make_adder(3); - let z = adder(2); - println!("{}", z); - assert_eq!(z, 5); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-by-ref.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-by-ref.rs deleted file mode 100644 index 564986bbbca..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-by-ref.rs +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test by-ref capture of environment in unboxed closure types - -fn call_fn(f: F) { - f() -} - -fn call_fn_mut(mut f: F) { - f() -} - -fn call_fn_once(f: F) { - f() -} - -fn main() { - let mut x = 0_usize; - let y = 2_usize; - - call_fn(|| assert_eq!(x, 0)); - call_fn_mut(|| x += y); - call_fn_once(|| x += y); - assert_eq!(x, y * 2); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs deleted file mode 100644 index b178f0af909..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the call operator autoderefs when calling a bounded type parameter. - -use std::ops::FnMut; - -fn call_with_2(x: &fn(isize) -> isize) -> isize -{ - x(2) // look ma, no `*` -} - -fn subtract_22(x: isize) -> isize { x - 22 } - -pub fn main() { - let subtract_22: fn(isize) -> isize = subtract_22; - let z = call_with_2(&subtract_22); - assert_eq!(z, -20); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs deleted file mode 100644 index ef1187a3ffb..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-autoderef.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the call operator autoderefs when calling a bounded type parameter. - -use std::ops::FnMut; - -fn call_with_2(x: &mut F) -> isize - where F : FnMut(isize) -> isize -{ - x(2) // look ma, no `*` -} - -pub fn main() { - let z = call_with_2(&mut |x| x - 22); - assert_eq!(z, -20); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs deleted file mode 100644 index 1e2495926b9..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object-autoderef.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the call operator autoderefs when calling to an object type. - -use std::ops::FnMut; - -fn make_adder(x: isize) -> Boxisize + 'static> { - Box::new(move |y| { x + y }) -} - -pub fn main() { - let mut adder = make_adder(3); - let z = adder(2); - println!("{}", z); - assert_eq!(z, 5); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs deleted file mode 100644 index e40541a2754..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-call-sugar-object.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::FnMut; - -fn make_adder(x: isize) -> Boxisize + 'static> { - Box::new(move |y| { x + y }) -} - -pub fn main() { - let mut adder = make_adder(3); - let z = (*adder)(2); - println!("{}", z); - assert_eq!(z, 5); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs deleted file mode 100644 index dc6903db326..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we mutate a counter on the stack only when we expect to. - -fn call(f: F) where F : FnOnce() { - f(); -} - -fn main() { - let y = vec![format!("Hello"), format!("World")]; - let mut counter = 22_u32; - - call(|| { - // Move `y`, but do not move `counter`, even though it is read - // by value (note that it is also mutated). - for item in y { - let v = counter; - counter += v; - } - }); - assert_eq!(counter, 88); - - call(move || { - // this mutates a moved copy, and hence doesn't affect original - counter += 1; - }); - assert_eq!(counter, 88); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs deleted file mode 100644 index 620d935b3b8..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-cross-crate.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// Test that unboxed closures work with cross-crate inlining -// Acts as a regression test for #16790, #18378 and #18543 - -// aux-build:unboxed-closures-cross-crate.rs - -extern crate unboxed_closures_cross_crate as ubcc; - -fn main() { - assert_eq!(ubcc::has_closures(), 2_usize); - assert_eq!(ubcc::has_generic_closures(2_usize, 3_usize), 5_usize); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs deleted file mode 100644 index 1f84db7f720..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let mut unboxed = || {}; - unboxed(); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-drop.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-drop.rs deleted file mode 100644 index 02edd01ac18..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-drop.rs +++ /dev/null @@ -1,125 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// A battery of tests to ensure destructors of unboxed closure environments -// run at the right times. - -static mut DROP_COUNT: usize = 0; - -fn drop_count() -> usize { - unsafe { - DROP_COUNT - } -} - -struct Droppable { - x: isize, -} - -impl Droppable { - fn new() -> Droppable { - Droppable { - x: 1 - } - } -} - -impl Drop for Droppable { - fn drop(&mut self) { - unsafe { - DROP_COUNT += 1 - } - } -} - -fn a isize>(f: F) -> isize { - f(1, 2) -} - -fn b isize>(mut f: F) -> isize { - f(3, 4) -} - -fn c isize>(f: F) -> isize { - f(5, 6) -} - -fn test_fn() { - { - a(move |a: isize, b| { a + b }); - } - assert_eq!(drop_count(), 0); - - { - let z = &Droppable::new(); - a(move |a: isize, b| { z; a + b }); - assert_eq!(drop_count(), 0); - } - assert_eq!(drop_count(), 1); - - { - let z = &Droppable::new(); - let zz = &Droppable::new(); - a(move |a: isize, b| { z; zz; a + b }); - assert_eq!(drop_count(), 1); - } - assert_eq!(drop_count(), 3); -} - -fn test_fn_mut() { - { - b(move |a: isize, b| { a + b }); - } - assert_eq!(drop_count(), 3); - - { - let z = &Droppable::new(); - b(move |a: isize, b| { z; a + b }); - assert_eq!(drop_count(), 3); - } - assert_eq!(drop_count(), 4); - - { - let z = &Droppable::new(); - let zz = &Droppable::new(); - b(move |a: isize, b| { z; zz; a + b }); - assert_eq!(drop_count(), 4); - } - assert_eq!(drop_count(), 6); -} - -fn test_fn_once() { - { - c(move |a: isize, b| { a + b }); - } - assert_eq!(drop_count(), 6); - - { - let z = Droppable::new(); - c(move |a: isize, b| { z; a + b }); - assert_eq!(drop_count(), 7); - } - assert_eq!(drop_count(), 7); - - { - let z = Droppable::new(); - let zz = Droppable::new(); - c(move |a: isize, b| { z; zz; a + b }); - assert_eq!(drop_count(), 9); - } - assert_eq!(drop_count(), 9); -} - -fn main() { - test_fn(); - test_fn_mut(); - test_fn_once(); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs deleted file mode 100644 index f6f83c33f15..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn-hr.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Checks that higher-ranked extern fn pointers implement the full range of Fn traits. - -fn square(x: &isize) -> isize { (*x) * (*x) } - -fn call_itisize>(f: &F, x: isize) -> isize { - (*f)(&x) -} - -fn call_it_boxed(f: &Fn(&isize) -> isize, x: isize) -> isize { - f(&x) -} - -fn call_it_mutisize>(f: &mut F, x: isize) -> isize { - (*f)(&x) -} - -fn call_it_onceisize>(f: F, x: isize) -> isize { - f(&x) -} - -fn main() { - let x = call_it(&square, 22); - let x1 = call_it_boxed(&square, 22); - let y = call_it_mut(&mut square, 22); - let z = call_it_once(square, 22); - assert_eq!(x, square(&22)); - assert_eq!(x1, square(&22)); - assert_eq!(y, square(&22)); - assert_eq!(z, square(&22)); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs deleted file mode 100644 index 480a6daac81..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-extern-fn.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Checks that extern fn pointers implement the full range of Fn traits. - -use std::ops::{Fn,FnMut,FnOnce}; - -fn square(x: isize) -> isize { x * x } - -fn call_itisize>(f: &F, x: isize) -> isize { - f(x) -} - -fn call_it_mutisize>(f: &mut F, x: isize) -> isize { - f(x) -} - -fn call_it_onceisize>(f: F, x: isize) -> isize { - f(x) -} - -fn main() { - let x = call_it(&square, 22); - let y = call_it_mut(&mut square, 22); - let z = call_it_once(square, 22); - assert_eq!(x, square(22)); - assert_eq!(y, square(22)); - assert_eq!(z, square(22)); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs deleted file mode 100644 index 5f2e05995cc..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-fn-as-fnmut-and-fnonce.rs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Checks that the Fn trait hierarchy rules permit -// any Fn trait to be used where Fn is implemented. - -#![feature(unboxed_closures, fn_traits)] - -use std::ops::{Fn,FnMut,FnOnce}; - -struct S; - -impl Fn<(i32,)> for S { - extern "rust-call" fn call(&self, (x,): (i32,)) -> i32 { - x * x - } -} - -impl FnMut<(i32,)> for S { - extern "rust-call" fn call_mut(&mut self, args: (i32,)) -> i32 { self.call(args) } -} - -impl FnOnce<(i32,)> for S { - type Output = i32; - extern "rust-call" fn call_once(self, args: (i32,)) -> i32 { self.call(args) } -} - -fn call_iti32>(f: &F, x: i32) -> i32 { - f(x) -} - -fn call_it_muti32>(f: &mut F, x: i32) -> i32 { - f(x) -} - -fn call_it_oncei32>(f: F, x: i32) -> i32 { - f(x) -} - -fn main() { - let x = call_it(&S, 22); - let y = call_it_mut(&mut S, 22); - let z = call_it_once(S, 22); - assert_eq!(x, y); - assert_eq!(y, z); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs deleted file mode 100644 index 592994cae6e..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-fnmut-as-fnonce.rs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Checks that the Fn trait hierarchy rules permit -// FnMut or FnOnce to be used where FnMut is implemented. - -#![feature(unboxed_closures, fn_traits)] - -struct S; - -impl FnMut<(i32,)> for S { - extern "rust-call" fn call_mut(&mut self, (x,): (i32,)) -> i32 { - x * x - } -} - -impl FnOnce<(i32,)> for S { - type Output = i32; - - extern "rust-call" fn call_once(mut self, args: (i32,)) -> i32 { self.call_mut(args) } -} - -fn call_it_muti32>(f: &mut F, x: i32) -> i32 { - f(x) -} - -fn call_it_oncei32>(f: F, x: i32) -> i32 { - f(x) -} - -fn main() { - let y = call_it_mut(&mut S, 22); - let z = call_it_once(S, 22); - assert_eq!(y, z); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-generic.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-generic.rs deleted file mode 100644 index 9120b71c6d7..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-generic.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::FnMut; - -fn call_iti32>(y: i32, mut f: F) -> i32 { - f(2, y) -} - -pub fn main() { - let f = |x: i32, y: i32| -> i32 { x + y }; - let z = call_it(3, f); - println!("{}", z); - assert_eq!(z, 5); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs deleted file mode 100644 index b9219404b46..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-bound.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer that the type of `x` is `isize` based -// on the expected type from the object. - -// pretty-expanded FIXME #23616 - -pub trait ToPrimitive { - fn to_int(&self) {} -} - -impl ToPrimitive for isize {} -impl ToPrimitive for i32 {} -impl ToPrimitive for usize {} - -fn doit(val: T, f: &F) - where F : Fn(T) -{ - f(val) -} - -pub fn main() { - doit(0, &|x /*: isize*/ | { x.to_int(); }); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs deleted file mode 100644 index 08e41627a9b..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-from-expected-object-type.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer that the type of `x` is `isize` based -// on the expected type from the object. - -// pretty-expanded FIXME #23616 - -pub trait ToPrimitive { - fn to_int(&self) {} -} - -impl ToPrimitive for isize {} -impl ToPrimitive for i32 {} -impl ToPrimitive for usize {} - -fn doit(val: T, f: &Fn(T)) { f(val) } - -pub fn main() { - doit(0, &|x /*: isize*/ | { x.to_int(); }); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs deleted file mode 100644 index 06c704dfda1..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-arg-types-w-bound-regs-from-expected-bound.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer that the type of `x` is `isize` based -// on the expected type from the object. - -// pretty-expanded FIXME #23616 - -pub trait ToPrimitive { - fn to_int(&self) {} -} - -impl ToPrimitive for isize {} -impl ToPrimitive for i32 {} -impl ToPrimitive for usize {} - -fn doit(val: T, f: &F) - where F : Fn(&T) -{ - f(&val) -} - -pub fn main() { - doit(0, &|x /*: isize*/ | { x.to_int(); }); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs deleted file mode 100644 index 2d0fd046610..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-explicit-call-early.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(fn_traits)] - -fn main() { - let mut zero = || 0; - let x = zero.call_mut(()); - assert_eq!(x, 0); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs deleted file mode 100644 index 3ddde9a16af..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-calling-fnmut.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer a suitable kind for this closure -// that is just called (`FnMut`). - -fn main() { - let mut counter = 0; - - { - // Here this must be inferred to FnMut so that it can mutate counter: - let mut tick1 = || counter += 1; - - // In turn, tick2 must be inferred to FnMut so that it can call tick1: - let mut tick2 = || { tick1(); tick1(); }; - - tick2(); - } - - assert_eq!(counter, 2); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs deleted file mode 100644 index 48645efce67..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut-move.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer a suitable kind for this `move` -// closure that is just called (`FnMut`). - -fn main() { - let mut counter = 0; - - let v = { - let mut tick = move || { counter += 1; counter }; - tick(); - tick() - }; - - assert_eq!(counter, 0); - assert_eq!(v, 2); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs deleted file mode 100644 index 80ca969c529..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnmut.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer a suitable kind for this closure -// that is just called (`FnMut`). - -fn main() { - let mut counter = 0; - - { - let mut tick = || counter += 1; - tick(); - tick(); - } - - assert_eq!(counter, 2); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs deleted file mode 100644 index ff8cd4a5eff..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce-move.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer a suitable kind for this `move` -// closure that is just called (`FnOnce`). - -use std::mem; - -struct DropMe<'a>(&'a mut i32); - -impl<'a> Drop for DropMe<'a> { - fn drop(&mut self) { - *self.0 += 1; - } -} - -fn main() { - let mut counter = 0; - - { - let drop_me = DropMe(&mut counter); - let tick = move || mem::drop(drop_me); - tick(); - } - - assert_eq!(counter, 1); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs deleted file mode 100644 index 698a389ef65..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-fnonce.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we are able to infer a suitable kind for this closure -// that is just called (`FnOnce`). - -use std::mem; - -struct DropMe<'a>(&'a mut i32); - -impl<'a> Drop for DropMe<'a> { - fn drop(&mut self) { - *self.0 += 1; - } -} - -fn main() { - let mut counter = 0; - - { - let drop_me = DropMe(&mut counter); - let tick = || mem::drop(drop_me); - tick(); - } - - assert_eq!(counter, 1); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs deleted file mode 100644 index 362d53126c2..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-kind.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that we can infer the "kind" of an unboxed closure based on -// the expected type. - -// Test by-ref capture of environment in unboxed closure types - -fn call_fn(f: F) { - f() -} - -fn call_fn_mut(mut f: F) { - f() -} - -fn call_fn_once(f: F) { - f() -} - -fn main() { - let mut x = 0_usize; - let y = 2_usize; - - call_fn(|| assert_eq!(x, 0)); - call_fn_mut(|| x += y); - call_fn_once(|| x += y); - assert_eq!(x, y * 2); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs deleted file mode 100644 index c150e8915c6..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-recursive-fn.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(fn_traits, unboxed_closures)] - -use std::marker::PhantomData; - -// Test that we are able to infer a suitable kind for a "recursive" -// closure. As far as I can tell, coding up a recursive closure -// requires the good ol' [Y Combinator]. -// -// [Y Combinator]: http://en.wikipedia.org/wiki/Fixed-point_combinator#Y_combinator - -struct YCombinator { - func: F, - marker: PhantomData<(A,R)>, -} - -impl YCombinator { - fn new(f: F) -> YCombinator { - YCombinator { func: f, marker: PhantomData } - } -} - -impl R, A) -> R> Fn<(A,)> for YCombinator { - extern "rust-call" fn call(&self, (arg,): (A,)) -> R { - (self.func)(self, arg) - } -} - -impl R, A) -> R> FnMut<(A,)> for YCombinator { - extern "rust-call" fn call_mut(&mut self, args: (A,)) -> R { self.call(args) } -} - -impl R, A) -> R> FnOnce<(A,)> for YCombinator { - type Output = R; - extern "rust-call" fn call_once(self, args: (A,)) -> R { self.call(args) } -} - -fn main() { - let factorial = |recur: &Fn(u32) -> u32, arg: u32| -> u32 { - if arg == 0 {1} else {arg * recur(arg-1)} - }; - let factorial: YCombinator<_,u32,u32> = YCombinator::new(factorial); - let r = factorial(10); - assert_eq!(3628800, r); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs deleted file mode 100644 index 5bf634defda..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-infer-upvar.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that the type variable in the type(`Vec<_>`) of a closed over -// variable does not interfere with type inference. - -fn f(mut f: F) { - f(); -} - -fn main() { - let mut v: Vec<_> = vec![]; - f(|| v.push(0)); - assert_eq!(v, [0]); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs deleted file mode 100644 index e610e90fb97..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-manual-impl.rs +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(unboxed_closures, fn_traits)] - -struct S; - -impl FnMut<(i32,)> for S { - extern "rust-call" fn call_mut(&mut self, (x,): (i32,)) -> i32 { - x * x - } -} - -impl FnOnce<(i32,)> for S { - type Output = i32; - - extern "rust-call" fn call_once(mut self, args: (i32,)) -> i32 { self.call_mut(args) } -} - -fn call_iti32>(mut f: F, x: i32) -> i32 { - f(x) + 3 -} - -fn call_box(f: &mut FnMut(i32) -> i32, x: i32) -> i32 { - f(x) + 3 -} - -fn main() { - let x = call_it(S, 1); - let y = call_box(&mut S, 1); - assert_eq!(x, 4); - assert_eq!(y, 4); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs deleted file mode 100644 index 6f15133eaee..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-monomorphization.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that unboxed closures in contexts with free type parameters -// monomorphize correctly (issue #16791) - -fn main(){ - fn bar<'a, T:Clone+'a> (t: T) -> BoxT + 'a> { - Box::new(move || t.clone()) - } - - let mut f = bar(42_u32); - assert_eq!(f(), 42); - - let mut f = bar("forty-two"); - assert_eq!(f(), "forty-two"); - - let x = 42_u32; - let mut f = bar(&x); - assert_eq!(f(), &x); - - #[derive(Clone, Copy, Debug, PartialEq)] - struct Foo(usize, &'static str); - - let x = Foo(42, "forty-two"); - let mut f = bar(x); - assert_eq!(f(), x); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs deleted file mode 100644 index ef3114ff394..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-from-projection-issue-30046.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused)] - -fn foo(f: F) - where F: FnOnce() -{ -} - -fn main() { - // Test that this closure is inferred to `FnOnce` - // because it moves from `y.as.0`: - let x = Some(vec![1, 2, 3]); - foo(|| { - match x { - Some(y) => { } - None => { } - } - }); - - // Test that this closure is inferred to `FnOnce` - // because it moves from `y.0`: - let y = (vec![1, 2, 3], 0); - foo(|| { - let x = y.0; - }); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs deleted file mode 100644 index 3b1e4a1d554..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-mutable.rs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![deny(unused_mut)] - -// Test that mutating a mutable upvar in a capture-by-value unboxed -// closure does not ice (issue #18238) and marks the upvar as used -// mutably so we do not get a spurious warning about it not needing to -// be declared mutable (issue #18336 and #18769) - -fn set(x: &mut usize) { *x = 42; } - -fn main() { - { - let mut x = 0_usize; - move || x += 1; - } - { - let mut x = 0_usize; - move || x += 1; - } - { - let mut x = 0_usize; - move || set(&mut x); - } - { - let mut x = 0_usize; - move || set(&mut x); - } -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs deleted file mode 100644 index b20377ec94f..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-move-some-upvars-in-by-ref-closure.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2015 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that in a by-ref once closure we move some variables even as -// we capture others by mutable reference. - -fn call(f: F) where F : FnOnce() { - f(); -} - -fn main() { - let mut x = vec![format!("Hello")]; - let y = vec![format!("World")]; - call(|| { - // Here: `x` must be captured with a mutable reference in - // order for us to append on it, and `y` must be captured by - // value. - for item in y { - x.push(item); - } - }); - assert_eq!(x.len(), 2); - assert_eq!(&*x[0], "Hello"); - assert_eq!(&*x[1], "World"); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-prelude.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-prelude.rs deleted file mode 100644 index f6997da7c07..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-prelude.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Tests that the re-exports of `FnOnce` et al from the prelude work. - -// pretty-expanded FIXME #23616 - -fn main() { - let task: Box isize> = Box::new(|x| x); - task(0); - - let mut task: Box isize> = Box::new(|x| x); - task(0); - - call(|x| x, 22); -} - -fn call isize>(f: F, x: isize) -> isize { - f(x) -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-simple.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-simple.rs deleted file mode 100644 index b7230ed5d82..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-simple.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::ops::FnMut; - -pub fn main() { - let mut f = |x: isize, y: isize| -> isize { x + y }; - let z = f(1, 2); - assert_eq!(z, 3); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs deleted file mode 100644 index 253a5354cdd..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-single-word-env.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Ensures that single-word environments work right in unboxed closures. -// These take a different path in codegen. - -fn a isize>(f: F) -> isize { - f(1, 2) -} - -fn b isize>(mut f: F) -> isize { - f(3, 4) -} - -fn c isize>(f: F) -> isize { - f(5, 6) -} - -fn main() { - let z = 10; - assert_eq!(a(move |x: isize, y| x + y + z), 13); - assert_eq!(b(move |x: isize, y| x + y + z), 17); - assert_eq!(c(move |x: isize, y| x + y + z), 21); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs deleted file mode 100644 index 5526d372706..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-static-call-fn-once.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let onetime = |x| x; - onetime(0); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs deleted file mode 100644 index 16f123d62fc..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-sugar-object.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test unboxed closure sugar used in object types. - -#![allow(dead_code)] - -struct Foo { - t: T, u: U -} - -trait Getter { - fn get(&self, arg: A) -> R; -} - -struct Identity; -impl Getter for Identity { - fn get(&self, arg: X) -> X { - arg - } -} - -fn main() { - let x: &Getter<(i32,), (i32,)> = &Identity; - let (y,) = x.get((22,)); - assert_eq!(y, 22); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs deleted file mode 100644 index dbf4a1c5f7e..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-unique-type-id.rs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// This code used to produce the following ICE: -// -// error: internal compiler error: get_unique_type_id_of_type() - -// unexpected type: closure, -// Closure(syntax::ast::DefId{krate: 0, node: 66}, -// ReScope(63)) -// -// This is a regression test for issue #17021. -// -// compile-flags: -g - -use std::ptr; - -pub fn replace_map<'a, T, F>(src: &mut T, prod: F) where F: FnOnce(T) -> T { - unsafe { *src = prod(ptr::read(src as *mut T as *const T)); } -} - -pub fn main() { - let mut a = 7; - let b = &mut a; - replace_map(b, |x: usize| x * 2); - assert_eq!(*b, 14); -} diff --git a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-zero-args.rs b/src/test/ui/run-pass/unboxed-closures/unboxed-closures-zero-args.rs deleted file mode 100644 index ae9124c9fc1..00000000000 --- a/src/test/ui/run-pass/unboxed-closures/unboxed-closures-zero-args.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn main() { - let mut zero = || {}; - let () = zero(); -} diff --git a/src/test/ui/run-pass/uniform-paths/basic-nested.rs b/src/test/ui/run-pass/uniform-paths/basic-nested.rs deleted file mode 100644 index 1aaa1e70726..00000000000 --- a/src/test/ui/run-pass/uniform-paths/basic-nested.rs +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// edition:2018 - -#![feature(decl_macro, uniform_paths)] - -// This test is similar to `basic.rs`, but nested in modules. - -mod foo { - // Test that ambiguity errors are not emitted between `self::test` and - // `::test`, assuming the latter (crate) is not in `extern_prelude`. - mod test { - pub struct Foo(pub ()); - } - pub use test::Foo; - - // Test that qualified paths can refer to both the external crate and local item. - mod std { - pub struct io(pub ()); - } - pub use ::std::io as std_io; - pub use self::std::io as local_io; -} - -// Test that we can refer to the external crate unqualified -// (when there isn't a local item with the same name). -use std::io; - -mod bar { - // Also test the unqualified external crate import in a nested module, - // to show that the above import doesn't resolve through a local `std` - // item, e.g. the automatically injected `extern crate std;`, which in - // the Rust 2018 should no longer be visible through `crate::std`. - pub use std::io; - - // Also test that items named `std` in other namespaces don't - // cause ambiguity errors for the import from `std` above. - pub fn std() {} - pub macro std() {} -} - - -fn main() { - foo::Foo(()); - foo::std_io::stdout(); - foo::local_io(()); - io::stdout(); - bar::io::stdout(); - bar::std(); - bar::std!(); - - { - // Test that having `io` in a module scope and a non-module - // scope is allowed, when both resolve to the same definition. - use std::io; - use io::stdout; - stdout(); - } -} diff --git a/src/test/ui/run-pass/uniform-paths/basic.rs b/src/test/ui/run-pass/uniform-paths/basic.rs deleted file mode 100644 index 7d997fe493a..00000000000 --- a/src/test/ui/run-pass/uniform-paths/basic.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// edition:2018 - -#![feature(uniform_paths)] - -// Test that ambiguity errors are not emitted between `self::test` and -// `::test`, assuming the latter (crate) is not in `extern_prelude`. -mod test { - pub struct Foo(pub ()); -} -use test::Foo; - -// Test that qualified paths can refer to both the external crate and local item. -mod std { - pub struct io(pub ()); -} -use ::std::io as std_io; -use self::std::io as local_io; - -fn main() { - Foo(()); - std_io::stdout(); - local_io(()); - - { - // Test that having `std_io` in a module scope and a non-module - // scope is allowed, when both resolve to the same definition. - use ::std::io as std_io; - use std_io::stdout; - stdout(); - } -} diff --git a/src/test/ui/run-pass/uniform-paths/macros-nested.rs b/src/test/ui/run-pass/uniform-paths/macros-nested.rs deleted file mode 100644 index 373734345fc..00000000000 --- a/src/test/ui/run-pass/uniform-paths/macros-nested.rs +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// edition:2018 - -#![feature(uniform_paths)] - -// This test is similar to `macros.rs`, but nested in modules. - -mod foo { - // Test that ambiguity errors are not emitted between `self::test` and - // `::test`, assuming the latter (crate) is not in `extern_prelude`. - macro_rules! m1 { - () => { - mod test { - pub struct Foo(pub ()); - } - } - } - pub use test::Foo; - m1!(); - - // Test that qualified paths can refer to both the external crate and local item. - macro_rules! m2 { - () => { - mod std { - pub struct io(pub ()); - } - } - } - pub use ::std::io as std_io; - pub use self::std::io as local_io; - m2!(); -} - -// Test that we can refer to the external crate unqualified -// (when there isn't a local item with the same name). -use std::io; - -mod bar { - // Also test the unqualified external crate import in a nested module, - // to show that the above import doesn't resolve through a local `std` - // item, e.g. the automatically injected `extern crate std;`, which in - // the Rust 2018 should no longer be visible through `crate::std`. - pub use std::io; -} - - -fn main() { - foo::Foo(()); - foo::std_io::stdout(); - foo::local_io(()); - io::stdout(); - bar::io::stdout(); -} diff --git a/src/test/ui/run-pass/uniform-paths/macros.rs b/src/test/ui/run-pass/uniform-paths/macros.rs deleted file mode 100644 index 20984eb13dd..00000000000 --- a/src/test/ui/run-pass/uniform-paths/macros.rs +++ /dev/null @@ -1,48 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// edition:2018 - -#![feature(uniform_paths)] - -// This test is similar to `basic.rs`, but with macros defining local items. - -// Test that ambiguity errors are not emitted between `self::test` and -// `::test`, assuming the latter (crate) is not in `extern_prelude`. -macro_rules! m1 { - () => { - mod test { - pub struct Foo(pub ()); - } - } -} -use test::Foo; -m1!(); - -// Test that qualified paths can refer to both the external crate and local item. -macro_rules! m2 { - () => { - mod std { - pub struct io(pub ()); - } - } -} -use ::std::io as std_io; -use self::std::io as local_io; -m2!(); - -fn main() { - Foo(()); - std_io::stdout(); - local_io(()); -} diff --git a/src/test/ui/run-pass/uniform-paths/same-crate.rs b/src/test/ui/run-pass/uniform-paths/same-crate.rs deleted file mode 100644 index bb15d6d53ac..00000000000 --- a/src/test/ui/run-pass/uniform-paths/same-crate.rs +++ /dev/null @@ -1,111 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// edition:2018 - -#![feature(uniform_paths)] - -pub const A: usize = 0; - -pub mod foo { - pub const B: usize = 1; - - pub mod bar { - pub const C: usize = 2; - - pub enum E { - V1(usize), - V2(String), - } - - pub fn test() -> String { - format!("{} {} {}", crate::A, crate::foo::B, C) - } - - pub fn test_use() -> String { - use crate::A; - use crate::foo::B; - - format!("{} {} {}", A, B, C) - } - - pub fn test_enum() -> String { - use E::*; - match E::V1(10) { - V1(i) => { format!("V1: {}", i) } - V2(s) => { format!("V2: {}", s) } - } - } - } - - pub fn test() -> String { - format!("{} {} {}", crate::A, B, bar::C) - } - - pub fn test_use() -> String { - use crate::A; - use bar::C; - - format!("{} {} {}", A, B, C) - } - - pub fn test_enum() -> String { - use bar::E::*; - match bar::E::V1(10) { - V1(i) => { format!("V1: {}", i) } - V2(s) => { format!("V2: {}", s) } - } - } -} - -pub fn test() -> String { - format!("{} {} {}", A, foo::B, foo::bar::C) -} - -pub fn test_use() -> String { - use foo::B; - use foo::bar::C; - - format!("{} {} {}", A, B, C) -} - -pub fn test_enum() -> String { - use foo::bar::E::*; - match foo::bar::E::V1(10) { - V1(i) => { format!("V1: {}", i) } - V2(s) => { format!("V2: {}", s) } - } -} - -fn main() { - let output = [ - test(), - foo::test(), - foo::bar::test(), - test_use(), - foo::test_use(), - foo::bar::test_use(), - test_enum(), - foo::test_enum(), - foo::bar::test_enum(), - ].join("\n"); - assert_eq!(output, "\ -0 1 2 -0 1 2 -0 1 2 -0 1 2 -0 1 2 -0 1 2 -V1: 10 -V1: 10 -V1: 10"); -} diff --git a/src/test/ui/run-pass/union/auxiliary/union.rs b/src/test/ui/run-pass/union/auxiliary/union.rs deleted file mode 100644 index 2c4945622ab..00000000000 --- a/src/test/ui/run-pass/union/auxiliary/union.rs +++ /dev/null @@ -1,14 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub union U { - pub a: u8, - pub b: u16, -} diff --git a/src/test/ui/run-pass/union/union-align.rs b/src/test/ui/run-pass/union/union-align.rs deleted file mode 100644 index 02f447c626f..00000000000 --- a/src/test/ui/run-pass/union/union-align.rs +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2017 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(untagged_unions)] - -use std::mem::{size_of, size_of_val, align_of, align_of_val}; - -#[repr(align(16))] -pub union U16 { - a: u8, - b: u32 -} - -fn main() { - assert_eq!(align_of::(), 16); - assert_eq!(size_of::(), 16); - let u = U16 { a: 10 }; - unsafe { - assert_eq!(align_of_val(&u.a), 1); - assert_eq!(size_of_val(&u.a), 1); - assert_eq!(u.a, 10); - } - - let u = U16 { b: 11 }; - unsafe { - assert_eq!(align_of_val(&u.b), 4); - assert_eq!(size_of_val(&u.b), 4); - assert_eq!(u.b, 11); - } - - hybrid::check_hybrid(); -} - -mod hybrid { - use std::mem::{size_of, align_of}; - - #[repr(align(16))] - struct S1 { - a: u16, - b: u8, - } - - #[repr(align(32))] - union U { - s: S1, - c: u16, - } - - #[repr(align(64))] - struct S2 { - d: u8, - u: U, - } - - pub fn check_hybrid() { - assert_eq!(align_of::(), 16); - assert_eq!(size_of::(), 16); - assert_eq!(align_of::(), 32); - assert_eq!(size_of::(), 32); - assert_eq!(align_of::(), 64); - assert_eq!(size_of::(), 64); - } -} diff --git a/src/test/ui/run-pass/union/union-backcomp.rs b/src/test/ui/run-pass/union/union-backcomp.rs deleted file mode 100644 index 23d51d39c2e..00000000000 --- a/src/test/ui/run-pass/union/union-backcomp.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! union { - () => (struct S;) -} - -union!(); - -fn union() {} - -fn main() { - union(); - - let union = 10; - - union; - - union as u8; - - union U { - a: u8, - } -} diff --git a/src/test/ui/run-pass/union/union-basic.rs b/src/test/ui/run-pass/union/union-basic.rs deleted file mode 100644 index bfbac1a6bf2..00000000000 --- a/src/test/ui/run-pass/union/union-basic.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -// aux-build:union.rs - -extern crate union; -use std::mem::{size_of, align_of, zeroed}; - -union U { - a: u8, - b: u16 -} - -fn local() { - assert_eq!(size_of::(), 2); - assert_eq!(align_of::(), 2); - - let u = U { a: 10 }; - unsafe { - assert_eq!(u.a, 10); - let U { a } = u; - assert_eq!(a, 10); - } - - let mut w = U { b: 0 }; - unsafe { - assert_eq!(w.a, 0); - assert_eq!(w.b, 0); - w.a = 1; - assert_eq!(w.a, 1); - assert_eq!(w.b.to_le(), 1); - } -} - -fn xcrate() { - assert_eq!(size_of::(), 2); - assert_eq!(align_of::(), 2); - - let u = union::U { a: 10 }; - unsafe { - assert_eq!(u.a, 10); - let union::U { a } = u; - assert_eq!(a, 10); - } - - let mut w = union::U { b: 0 }; - unsafe { - assert_eq!(w.a, 0); - assert_eq!(w.b, 0); - w.a = 1; - assert_eq!(w.a, 1); - assert_eq!(w.b.to_le(), 1); - } -} - -fn main() { - local(); - xcrate(); -} diff --git a/src/test/ui/run-pass/union/union-c-interop.rs b/src/test/ui/run-pass/union/union-c-interop.rs deleted file mode 100644 index 976ab845cd1..00000000000 --- a/src/test/ui/run-pass/union/union-c-interop.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -// ignore-wasm32-bare no libc to test ffi with - -#[derive(Clone, Copy)] -#[repr(C)] -struct LARGE_INTEGER_U { - LowPart: u32, - HighPart: u32, -} - -#[derive(Clone, Copy)] -#[repr(C)] -union LARGE_INTEGER { - __unnamed__: LARGE_INTEGER_U, - u: LARGE_INTEGER_U, - QuadPart: u64, -} - -#[link(name = "rust_test_helpers", kind = "static")] -extern "C" { - fn increment_all_parts(_: LARGE_INTEGER) -> LARGE_INTEGER; -} - -fn main() { - unsafe { - let mut li = LARGE_INTEGER { QuadPart: 0 }; - let li_c = increment_all_parts(li); - li.__unnamed__.LowPart += 1; - li.__unnamed__.HighPart += 1; - li.u.LowPart += 1; - li.u.HighPart += 1; - li.QuadPart += 1; - assert_eq!(li.QuadPart, li_c.QuadPart); - } -} diff --git a/src/test/ui/run-pass/union/union-const-codegen.rs b/src/test/ui/run-pass/union/union-const-codegen.rs deleted file mode 100644 index aa583e6cead..00000000000 --- a/src/test/ui/run-pass/union/union-const-codegen.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -union U { - a: u64, - b: u64, -} - -const C: U = U { b: 10 }; - -fn main() { - unsafe { - let a = C.a; - let b = C.b; - assert_eq!(a, 10); - assert_eq!(b, 10); - } -} diff --git a/src/test/ui/run-pass/union/union-const-eval-field.rs b/src/test/ui/run-pass/union/union-const-eval-field.rs deleted file mode 100644 index c8eda7545d9..00000000000 --- a/src/test/ui/run-pass/union/union-const-eval-field.rs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(const_fn)] - -type Field1 = (i32, u32); -type Field2 = f32; -type Field3 = i64; - -union DummyUnion { - field1: Field1, - field2: Field2, - field3: Field3, -} - -const FLOAT1_AS_I32: i32 = 1065353216; -const UNION: DummyUnion = DummyUnion { field1: (FLOAT1_AS_I32, 0) }; - -const fn read_field1() -> Field1 { - const FIELD1: Field1 = unsafe { UNION.field1 }; - FIELD1 -} - -const fn read_field2() -> Field2 { - const FIELD2: Field2 = unsafe { UNION.field2 }; - FIELD2 -} - -const fn read_field3() -> Field3 { - const FIELD3: Field3 = unsafe { UNION.field3 }; - FIELD3 -} - -fn main() { - let foo = FLOAT1_AS_I32; - assert_eq!(read_field1().0, foo); - assert_eq!(read_field1().0, FLOAT1_AS_I32); - - let foo = 1.0; - assert_eq!(read_field2(), foo); - assert_eq!(read_field2(), 1.0); - - assert_eq!(read_field3(), unsafe { UNION.field3 }); - let foo = unsafe { UNION.field3 }; - assert_eq!(read_field3(), foo); -} diff --git a/src/test/ui/run-pass/union/union-derive.rs b/src/test/ui/run-pass/union/union-derive.rs deleted file mode 100644 index 248595ee7ac..00000000000 --- a/src/test/ui/run-pass/union/union-derive.rs +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unions_with_drop_fields)] - -// Some traits can be derived for unions. - -#![feature(untagged_unions)] - -#[derive( - Copy, - Clone, - Eq, -)] -union U { - a: u8, - b: u16, -} - -impl PartialEq for U { fn eq(&self, rhs: &Self) -> bool { true } } - -#[derive( - Clone, - Copy, - Eq -)] -union W { - a: T, -} - -impl PartialEq for W { fn eq(&self, rhs: &Self) -> bool { true } } - -fn main() { - let u = U { b: 0 }; - let u1 = u; - let u2 = u.clone(); - assert!(u1 == u2); - - let w = W { a: 0 }; - let w1 = w.clone(); - assert!(w == w1); -} diff --git a/src/test/ui/run-pass/union/union-drop-assign.rs b/src/test/ui/run-pass/union/union-drop-assign.rs deleted file mode 100644 index 2884cf16b96..00000000000 --- a/src/test/ui/run-pass/union/union-drop-assign.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unions_with_drop_fields)] - -// Drop works for union itself. - -#![feature(untagged_unions)] - -struct S; - -union U { - a: S -} - -impl Drop for S { - fn drop(&mut self) { - unsafe { CHECK += 10; } - } -} - -impl Drop for U { - fn drop(&mut self) { - unsafe { CHECK += 1; } - } -} - -static mut CHECK: u8 = 0; - -fn main() { - unsafe { - let mut u = U { a: S }; - assert_eq!(CHECK, 0); - u = U { a: S }; - assert_eq!(CHECK, 1); // union itself is assigned, union is dropped, field is not dropped - u.a = S; - assert_eq!(CHECK, 11); // union field is assigned, field is dropped - } -} diff --git a/src/test/ui/run-pass/union/union-drop.rs b/src/test/ui/run-pass/union/union-drop.rs deleted file mode 100644 index ba5c20b6dc3..00000000000 --- a/src/test/ui/run-pass/union/union-drop.rs +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unions_with_drop_fields)] - -// Drop works for union itself. - -#![feature(untagged_unions)] - -struct S; - -union U { - a: u8 -} - -union W { - a: S, -} - -union Y { - a: S, -} - -impl Drop for S { - fn drop(&mut self) { - unsafe { CHECK += 10; } - } -} - -impl Drop for U { - fn drop(&mut self) { - unsafe { CHECK += 1; } - } -} - -impl Drop for W { - fn drop(&mut self) { - unsafe { CHECK += 1; } - } -} - -static mut CHECK: u8 = 0; - -fn main() { - unsafe { - assert_eq!(CHECK, 0); - { - let u = U { a: 1 }; - } - assert_eq!(CHECK, 1); // 1, dtor of U is called - { - let w = W { a: S }; - } - assert_eq!(CHECK, 2); // 2, not 11, dtor of S is not called - { - let y = Y { a: S }; - } - assert_eq!(CHECK, 2); // 2, not 12, dtor of S is not called - } -} diff --git a/src/test/ui/run-pass/union/union-generic.rs b/src/test/ui/run-pass/union/union-generic.rs deleted file mode 100644 index dcea56c288f..00000000000 --- a/src/test/ui/run-pass/union/union-generic.rs +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unions_with_drop_fields)] - -#![feature(untagged_unions)] - -union MaybeItem { - elem: T::Item, - none: (), -} - -union U { - a: A, - b: B, -} - -unsafe fn union_transmute(a: A) -> B { - U { a: a }.b -} - -fn main() { - unsafe { - let u = U::> { a: String::from("abcd") }; - - assert_eq!(u.b.len(), 4); - assert_eq!(u.b[0], b'a'); - - let b = union_transmute::<(u8, u8), u16>((1, 1)); - assert_eq!(b, (1 << 8) + 1); - - let v: Vec = vec![1, 2, 3]; - let mut i = v.iter(); - i.next(); - let mi = MaybeItem::> { elem: i.next().unwrap() }; - assert_eq!(*mi.elem, 2); - } -} diff --git a/src/test/ui/run-pass/union/union-inherent-method.rs b/src/test/ui/run-pass/union/union-inherent-method.rs deleted file mode 100644 index d9300b5b9f5..00000000000 --- a/src/test/ui/run-pass/union/union-inherent-method.rs +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -union U { - a: u8, -} - -impl U { - fn method(&self) -> u8 { unsafe { self.a } } -} - -fn main() { - let u = U { a: 10 }; - assert_eq!(u.method(), 10); -} diff --git a/src/test/ui/run-pass/union/union-macro.rs b/src/test/ui/run-pass/union/union-macro.rs deleted file mode 100644 index f4ffa2edbde..00000000000 --- a/src/test/ui/run-pass/union/union-macro.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -macro_rules! duplicate { - ($i: item) => { - mod m1 { - $i - } - mod m2 { - $i - } - } -} - -duplicate! { - pub union U { - pub a: u8 - } -} - -fn main() { - let u1 = m1::U { a: 0 }; - let u2 = m2::U { a: 0 }; -} diff --git a/src/test/ui/run-pass/union/union-nodrop.rs b/src/test/ui/run-pass/union/union-nodrop.rs deleted file mode 100644 index 4f2456e43ba..00000000000 --- a/src/test/ui/run-pass/union/union-nodrop.rs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(core_intrinsics)] -#![feature(untagged_unions)] - -#![allow(unions_with_drop_fields)] -#![allow(dead_code)] - -use std::intrinsics::needs_drop; - -struct NeedDrop; - -impl Drop for NeedDrop { - fn drop(&mut self) {} -} - -// Constant expressios allow `NoDrop` to go out of scope, -// unlike a value of the interior type implementing `Drop`. -static X: () = (NoDrop { inner: NeedDrop }, ()).1; - -// A union that scrubs the drop glue from its inner type -union NoDrop {inner: T} - -// Copy currently can't be implemented on drop-containing unions, -// this may change later -// https://github.com/rust-lang/rust/pull/38934#issuecomment-271219289 - -// // We should be able to implement Copy for NoDrop -// impl Copy for NoDrop {} -// impl Clone for NoDrop {fn clone(&self) -> Self { *self }} - -// // We should be able to implement Copy for things using NoDrop -// #[derive(Copy, Clone)] -struct Foo { - x: NoDrop> -} - -struct Baz { - x: NoDrop>, - y: Box, -} - -union ActuallyDrop {inner: T} - -impl Drop for ActuallyDrop { - fn drop(&mut self) {} -} - -fn main() { - unsafe { - // NoDrop should not make needs_drop true - assert!(!needs_drop::()); - assert!(!needs_drop::>()); - assert!(!needs_drop::>>()); - // presence of other drop types should still work - assert!(needs_drop::()); - // drop impl on union itself should work - assert!(needs_drop::>()); - assert!(needs_drop::>>()); - } -} diff --git a/src/test/ui/run-pass/union/union-overwrite.rs b/src/test/ui/run-pass/union/union-overwrite.rs deleted file mode 100644 index b4d0850a504..00000000000 --- a/src/test/ui/run-pass/union/union-overwrite.rs +++ /dev/null @@ -1,83 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unions_with_drop_fields)] - -#![feature(untagged_unions)] - -#[repr(C)] -struct Pair(T, U); -#[repr(C)] -struct Triple(T, T, T); - -#[repr(C)] -union U { - a: Pair, - b: B, -} - -#[repr(C)] -union W { - a: A, - b: B, -} - -#[cfg(target_endian = "little")] -unsafe fn check() { - let mut u = U:: { b: 0xDE_DE }; - u.a.0 = 0xBE; - assert_eq!(u.b, 0xDE_BE); - - let mut u = U:: { b: 0xDEAD_DEAD }; - u.a.0 = 0xBEEF; - assert_eq!(u.b, 0xDEAD_BEEF); - - let mut u = U:: { b: 0xDEADBEEF_DEADBEEF }; - u.a.0 = 0xBAADF00D; - assert_eq!(u.b, 0xDEADBEEF_BAADF00D); - - let mut w = W::, u8>, u32> { b: 0xDEAD_DEAD }; - w.a.0 = Triple(0, 0, 0); - assert_eq!(w.b, 0xDE00_0000); - - let mut w = W::>, u32> { b: 0xDEAD_DEAD }; - w.a.1 = Triple(0, 0, 0); - assert_eq!(w.b, 0x0000_00AD); -} - -#[cfg(target_endian = "big")] -unsafe fn check() { - let mut u = U:: { b: 0xDE_DE }; - u.a.0 = 0xBE; - assert_eq!(u.b, 0xBE_DE); - - let mut u = U:: { b: 0xDEAD_DEAD }; - u.a.0 = 0xBEEF; - assert_eq!(u.b, 0xBEEF_DEAD); - - let mut u = U:: { b: 0xDEADBEEF_DEADBEEF }; - u.a.0 = 0xBAADF00D; - assert_eq!(u.b, 0xBAADF00D_DEADBEEF); - - let mut w = W::, u8>, u32> { b: 0xDEAD_DEAD }; - w.a.0 = Triple(0, 0, 0); - assert_eq!(w.b, 0x0000_00AD); - - let mut w = W::>, u32> { b: 0xDEAD_DEAD }; - w.a.1 = Triple(0, 0, 0); - assert_eq!(w.b, 0xDE00_0000); -} - -fn main() { - unsafe { - check(); - } -} diff --git a/src/test/ui/run-pass/union/union-packed.rs b/src/test/ui/run-pass/union/union-packed.rs deleted file mode 100644 index c167a40507a..00000000000 --- a/src/test/ui/run-pass/union/union-packed.rs +++ /dev/null @@ -1,181 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_snake_case)] - -#![feature(untagged_unions)] -#![feature(repr_packed)] - -use std::mem::{size_of, size_of_val, align_of, align_of_val}; - -struct S { - a: u16, - b: [u8; 3], -} - -#[repr(packed)] -struct Sp1 { - a: u16, - b: [u8; 3], -} - -#[repr(packed(2))] -struct Sp2 { - a: u16, - b: [u8; 3], -} - -union U { - a: u16, - b: [u8; 3], -} - -#[repr(packed)] -union Up1 { - a: u16, - b: [u8; 3], -} - -#[repr(packed(2))] -union Up2 { - a: u16, - b: [u8; 3], -} - -#[repr(C, packed(4))] -union Up4c { - a: u16, - b: [u8; 3], -} - -const CS: S = S { a: 0, b: [0, 0, 0] }; -const CSP1: Sp1 = Sp1 { a: 0, b: [0, 0, 0] }; -const CSP2: Sp2 = Sp2 { a: 0, b: [0, 0, 0] }; -const CU: U = U { b: [0, 0, 0] }; -const CUP1: Up1 = Up1 { b: [0, 0, 0] }; -const CUP2: Up2 = Up2 { b: [0, 0, 0] }; -const CUP4C: Up4c = Up4c { b: [0, 0, 0] }; - -fn main() { - let s = S { a: 0, b: [0, 0, 0] }; - assert_eq!(size_of::(), 6); - assert_eq!(size_of_val(&s), 6); - assert_eq!(size_of_val(&CS), 6); - assert_eq!(align_of::(), 2); - assert_eq!(align_of_val(&s), 2); - assert_eq!(align_of_val(&CS), 2); - - let sp1 = Sp1 { a: 0, b: [0, 0, 0] }; - assert_eq!(size_of::(), 5); - assert_eq!(size_of_val(&sp1), 5); - assert_eq!(size_of_val(&CSP1), 5); - assert_eq!(align_of::(), 1); - assert_eq!(align_of_val(&sp1), 1); - assert_eq!(align_of_val(&CSP1), 1); - - let sp2 = Sp2 { a: 0, b: [0, 0, 0] }; - assert_eq!(size_of::(), 6); - assert_eq!(size_of_val(&sp2), 6); - assert_eq!(size_of_val(&CSP2), 6); - assert_eq!(align_of::(), 2); - assert_eq!(align_of_val(&sp2), 2); - assert_eq!(align_of_val(&CSP2), 2); - - let u = U { b: [0, 0, 0] }; - assert_eq!(size_of::(), 4); - assert_eq!(size_of_val(&u), 4); - assert_eq!(size_of_val(&CU), 4); - assert_eq!(align_of::(), 2); - assert_eq!(align_of_val(&u), 2); - assert_eq!(align_of_val(&CU), 2); - - let Up1 = Up1 { b: [0, 0, 0] }; - assert_eq!(size_of::(), 3); - assert_eq!(size_of_val(&Up1), 3); - assert_eq!(size_of_val(&CUP1), 3); - assert_eq!(align_of::(), 1); - assert_eq!(align_of_val(&Up1), 1); - assert_eq!(align_of_val(&CUP1), 1); - - let up2 = Up2 { b: [0, 0, 0] }; - assert_eq!(size_of::(), 4); - assert_eq!(size_of_val(&up2), 4); - assert_eq!(size_of_val(&CUP2), 4); - assert_eq!(align_of::(), 2); - assert_eq!(align_of_val(&up2), 2); - assert_eq!(align_of_val(&CUP2), 2); - - let up4c = Up4c { b: [0, 0, 0] }; - assert_eq!(size_of::(), 4); - assert_eq!(size_of_val(&up4c), 4); - assert_eq!(size_of_val(&CUP4C), 4); - assert_eq!(align_of::(), 2); - assert_eq!(align_of_val(&up4c), 2); - assert_eq!(align_of_val(&CUP4C), 2); - - hybrid::check_hybrid(); -} - -mod hybrid { - use std::mem::{size_of, align_of}; - - #[repr(packed)] - struct S1 { - a: u16, - b: u8, - } - - #[repr(packed)] - union U { - s: S1, - c: u16, - } - - #[repr(packed)] - struct S2 { - d: u8, - u: U, - } - - #[repr(C, packed(2))] - struct S1C { - a: u16, - b: u8, - } - - #[repr(C, packed(2))] - union UC { - s: S1, - c: u16, - } - - #[repr(C, packed(2))] - struct S2C { - d: u8, - u: UC, - } - - pub fn check_hybrid() { - assert_eq!(align_of::(), 1); - assert_eq!(size_of::(), 3); - assert_eq!(align_of::(), 1); - assert_eq!(size_of::(), 3); - assert_eq!(align_of::(), 1); - assert_eq!(size_of::(), 4); - - assert_eq!(align_of::(), 2); - assert_eq!(size_of::(), 4); - assert_eq!(align_of::(), 2); - assert_eq!(size_of::(), 4); - assert_eq!(align_of::(), 2); - assert_eq!(size_of::(), 6); - } -} diff --git a/src/test/ui/run-pass/union/union-pat-refutability.rs b/src/test/ui/run-pass/union/union-pat-refutability.rs deleted file mode 100644 index 2c481160fda..00000000000 --- a/src/test/ui/run-pass/union/union-pat-refutability.rs +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(illegal_floating_point_literal_pattern)] - -#[repr(u32)] -enum Tag { I, F } - -#[repr(C)] -union U { - i: i32, - f: f32, -} - -#[repr(C)] -struct Value { - tag: Tag, - u: U, -} - -fn is_zero(v: Value) -> bool { - unsafe { - match v { - Value { tag: Tag::I, u: U { i: 0 } } => true, - Value { tag: Tag::F, u: U { f: 0.0 } } => true, - _ => false, - } - } -} - -union W { - a: u8, - b: u8, -} - -fn refut(w: W) { - unsafe { - match w { - W { a: 10 } => { - panic!(); - } - W { b } => { - assert_eq!(b, 11); - } - } - } -} - -fn main() { - let v = Value { tag: Tag::I, u: U { i: 1 } }; - assert_eq!(is_zero(v), false); - - let w = W { a: 11 }; - refut(w); -} diff --git a/src/test/ui/run-pass/union/union-trait-impl.rs b/src/test/ui/run-pass/union/union-trait-impl.rs deleted file mode 100644 index 6e732f24b25..00000000000 --- a/src/test/ui/run-pass/union/union-trait-impl.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -use std::fmt; - -union U { - a: u8 -} - -impl fmt::Display for U { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - unsafe { write!(f, "Oh hai {}", self.a) } - } -} - -fn main() { - assert_eq!(U { a: 2 }.to_string(), "Oh hai 2"); -} diff --git a/src/test/ui/run-pass/union/union-transmute.rs b/src/test/ui/run-pass/union/union-transmute.rs deleted file mode 100644 index 1fc20bef9e0..00000000000 --- a/src/test/ui/run-pass/union/union-transmute.rs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -extern crate core; -use core::f32; - -union U { - a: (u8, u8), - b: u16, -} - -union W { - a: u32, - b: f32, -} - -fn main() { - unsafe { - let mut u = U { a: (1, 1) }; - assert_eq!(u.b, (1 << 8) + 1); - u.b = (2 << 8) + 2; - assert_eq!(u.a, (2, 2)); - - let mut w = W { a: 0b0_11111111_00000000000000000000000 }; - assert_eq!(w.b, f32::INFINITY); - w.b = f32::NEG_INFINITY; - assert_eq!(w.a, 0b1_11111111_00000000000000000000000); - } -} diff --git a/src/test/ui/run-pass/union/union-with-drop-fields-lint.rs b/src/test/ui/run-pass/union/union-with-drop-fields-lint.rs deleted file mode 100644 index 5f1ac7b51ee..00000000000 --- a/src/test/ui/run-pass/union/union-with-drop-fields-lint.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(untagged_unions)] -#![allow(dead_code)] -#![allow(unions_with_drop_fields)] - -union U { - a: u8, // OK -} - -union W { - a: String, // OK - b: String, // OK -} - -struct S(String); - -// `S` doesn't implement `Drop` trait, but still has non-trivial destructor -union Y { - a: S, // OK -} - -// We don't know if `T` is trivially-destructable or not until trans -union J { - a: T, // OK -} - -union H { - a: T, // OK -} - -fn main() {} diff --git a/src/test/ui/run-pass/unique/unique-assign-copy.rs b/src/test/ui/run-pass/unique/unique-assign-copy.rs deleted file mode 100644 index e25de1025fa..00000000000 --- a/src/test/ui/run-pass/unique/unique-assign-copy.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut i: Box<_> = box 1; - // Should be a copy - let mut j; - j = i.clone(); - *i = 2; - *j = 3; - assert_eq!(*i, 2); - assert_eq!(*j, 3); -} diff --git a/src/test/ui/run-pass/unique/unique-assign-drop.rs b/src/test/ui/run-pass/unique/unique-assign-drop.rs deleted file mode 100644 index dd931480196..00000000000 --- a/src/test/ui/run-pass/unique/unique-assign-drop.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 1; - let mut j: Box<_> = box 2; - // Should drop the previous value of j - j = i; - assert_eq!(*j, 1); -} diff --git a/src/test/ui/run-pass/unique/unique-assign-generic.rs b/src/test/ui/run-pass/unique/unique-assign-generic.rs deleted file mode 100644 index ebbe6927261..00000000000 --- a/src/test/ui/run-pass/unique/unique-assign-generic.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f(t: T) -> T { - let t1 = t; - t1 -} - -pub fn main() { - let t = f::>(box 100); - assert_eq!(t, box 100); -} diff --git a/src/test/ui/run-pass/unique/unique-assign.rs b/src/test/ui/run-pass/unique/unique-assign.rs deleted file mode 100644 index 206503f87ce..00000000000 --- a/src/test/ui/run-pass/unique/unique-assign.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut i: Box<_>; - i = box 1; - assert_eq!(*i, 1); -} diff --git a/src/test/ui/run-pass/unique/unique-autoderef-field.rs b/src/test/ui/run-pass/unique/unique-autoderef-field.rs deleted file mode 100644 index 449bf418651..00000000000 --- a/src/test/ui/run-pass/unique/unique-autoderef-field.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct J { j: isize } - -pub fn main() { - let i: Box<_> = box J { - j: 100 - }; - assert_eq!(i.j, 100); -} diff --git a/src/test/ui/run-pass/unique/unique-autoderef-index.rs b/src/test/ui/run-pass/unique/unique-autoderef-index.rs deleted file mode 100644 index de7c2f7826e..00000000000 --- a/src/test/ui/run-pass/unique/unique-autoderef-index.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box vec![100]; - assert_eq!((*i)[0], 100); -} diff --git a/src/test/ui/run-pass/unique/unique-cmp.rs b/src/test/ui/run-pass/unique/unique-cmp.rs deleted file mode 100644 index b11b1a8cdbc..00000000000 --- a/src/test/ui/run-pass/unique/unique-cmp.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 100; - assert_eq!(i, box 100); - assert!(i < box 101); - assert!(i <= box 100); - assert!(i > box 99); - assert!(i >= box 99); -} diff --git a/src/test/ui/run-pass/unique/unique-containing-tag.rs b/src/test/ui/run-pass/unique/unique-containing-tag.rs deleted file mode 100644 index d849c1d3298..00000000000 --- a/src/test/ui/run-pass/unique/unique-containing-tag.rs +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { - enum t { t1(isize), t2(isize), } - - let _x: Box<_> = box t::t1(10); - - /*alt *x { - t1(a) { - assert_eq!(a, 10); - } - _ { panic!(); } - }*/ - - /*alt x { - box t1(a) { - assert_eq!(a, 10); - } - _ { panic!(); } - }*/ -} diff --git a/src/test/ui/run-pass/unique/unique-create.rs b/src/test/ui/run-pass/unique/unique-create.rs deleted file mode 100644 index 5c7488b1120..00000000000 --- a/src/test/ui/run-pass/unique/unique-create.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { - let _: Box<_> = box 100; -} - -fn vec() { - vec![0]; -} diff --git a/src/test/ui/run-pass/unique/unique-decl-init-copy.rs b/src/test/ui/run-pass/unique/unique-decl-init-copy.rs deleted file mode 100644 index 1ec57a8b8b5..00000000000 --- a/src/test/ui/run-pass/unique/unique-decl-init-copy.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut i: Box<_> = box 1; - // Should be a copy - let mut j = i.clone(); - *i = 2; - *j = 3; - assert_eq!(*i, 2); - assert_eq!(*j, 3); -} diff --git a/src/test/ui/run-pass/unique/unique-decl-init.rs b/src/test/ui/run-pass/unique/unique-decl-init.rs deleted file mode 100644 index 85190b5142f..00000000000 --- a/src/test/ui/run-pass/unique/unique-decl-init.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 1; - let j = i; - assert_eq!(*j, 1); -} diff --git a/src/test/ui/run-pass/unique/unique-decl-move.rs b/src/test/ui/run-pass/unique/unique-decl-move.rs deleted file mode 100644 index 8e08ae43bae..00000000000 --- a/src/test/ui/run-pass/unique/unique-decl-move.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 100; - let j = i; - assert_eq!(*j, 100); -} diff --git a/src/test/ui/run-pass/unique/unique-decl.rs b/src/test/ui/run-pass/unique/unique-decl.rs deleted file mode 100644 index 37b8b94b15a..00000000000 --- a/src/test/ui/run-pass/unique/unique-decl.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - - -pub fn main() { - let _: Box; -} - -fn f(_i: Box) -> Box { - panic!(); -} diff --git a/src/test/ui/run-pass/unique/unique-deref.rs b/src/test/ui/run-pass/unique/unique-deref.rs deleted file mode 100644 index db2e5509c1a..00000000000 --- a/src/test/ui/run-pass/unique/unique-deref.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 100; - assert_eq!(*i, 100); -} diff --git a/src/test/ui/run-pass/unique/unique-destructure.rs b/src/test/ui/run-pass/unique/unique-destructure.rs deleted file mode 100644 index 782f151459e..00000000000 --- a/src/test/ui/run-pass/unique/unique-destructure.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_patterns)] -#![feature(box_syntax)] - -struct Foo { a: isize, b: isize } - -pub fn main() { - let box Foo{a, b} = box Foo{a: 100, b: 200}; - assert_eq!(a + b, 300); -} diff --git a/src/test/ui/run-pass/unique/unique-drop-complex.rs b/src/test/ui/run-pass/unique/unique-drop-complex.rs deleted file mode 100644 index 747b1662652..00000000000 --- a/src/test/ui/run-pass/unique/unique-drop-complex.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { - let _x: Box<_> = box vec![0,0,0,0,0]; -} diff --git a/src/test/ui/run-pass/unique/unique-ffi-symbols.rs b/src/test/ui/run-pass/unique/unique-ffi-symbols.rs deleted file mode 100644 index 761b2ffe30b..00000000000 --- a/src/test/ui/run-pass/unique/unique-ffi-symbols.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2016 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// We used to have a __rust_abi shim that resulted in duplicated symbols -// whenever the item path wasn't enough to disambiguate between them. -fn main() { - let a = { - extern fn good() -> i32 { return 0; } - good as extern fn() -> i32 - }; - let b = { - extern fn good() -> i32 { return 5; } - good as extern fn() -> i32 - }; - - assert!(a != b); - assert_eq!((a(), b()), (0, 5)); -} diff --git a/src/test/ui/run-pass/unique/unique-fn-arg-move.rs b/src/test/ui/run-pass/unique/unique-fn-arg-move.rs deleted file mode 100644 index 703c2bee84d..00000000000 --- a/src/test/ui/run-pass/unique/unique-fn-arg-move.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f(i: Box) { - assert_eq!(*i, 100); -} - -pub fn main() { - let i = box 100; - f(i); -} diff --git a/src/test/ui/run-pass/unique/unique-fn-arg-mut.rs b/src/test/ui/run-pass/unique/unique-fn-arg-mut.rs deleted file mode 100644 index b495fb30a9c..00000000000 --- a/src/test/ui/run-pass/unique/unique-fn-arg-mut.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f(i: &mut Box) { - *i = box 200; -} - -pub fn main() { - let mut i = box 100; - f(&mut i); - assert_eq!(*i, 200); -} diff --git a/src/test/ui/run-pass/unique/unique-fn-arg.rs b/src/test/ui/run-pass/unique/unique-fn-arg.rs deleted file mode 100644 index ef10e17d9d2..00000000000 --- a/src/test/ui/run-pass/unique/unique-fn-arg.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f(i: Box) { - assert_eq!(*i, 100); -} - -pub fn main() { - f(box 100); - let i = box 100; - f(i); -} diff --git a/src/test/ui/run-pass/unique/unique-fn-ret.rs b/src/test/ui/run-pass/unique/unique-fn-ret.rs deleted file mode 100644 index b4757a4b4d6..00000000000 --- a/src/test/ui/run-pass/unique/unique-fn-ret.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -fn f() -> Box { - box 100 -} - -pub fn main() { - assert_eq!(f(), box 100); -} diff --git a/src/test/ui/run-pass/unique/unique-generic-assign.rs b/src/test/ui/run-pass/unique/unique-generic-assign.rs deleted file mode 100644 index 571a5620cd8..00000000000 --- a/src/test/ui/run-pass/unique/unique-generic-assign.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #976 - - -// pretty-expanded FIXME #23616 - -fn f(x: Box) { - let _x2 = x; -} -pub fn main() { } diff --git a/src/test/ui/run-pass/unique/unique-in-tag.rs b/src/test/ui/run-pass/unique/unique-in-tag.rs deleted file mode 100644 index 31fe43dae99..00000000000 --- a/src/test/ui/run-pass/unique/unique-in-tag.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#![feature(box_syntax)] - -fn test1() { - enum bar { u(Box), w(isize), } - - let x = bar::u(box 10); - assert!(match x { - bar::u(a) => { - println!("{}", a); - *a - } - _ => { 66 } - } == 10); -} - -pub fn main() { - test1(); -} diff --git a/src/test/ui/run-pass/unique/unique-in-vec-copy.rs b/src/test/ui/run-pass/unique/unique-in-vec-copy.rs deleted file mode 100644 index 62b183d62b4..00000000000 --- a/src/test/ui/run-pass/unique/unique-in-vec-copy.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut a: Vec> = vec![box 10]; - let b = a.clone(); - - assert_eq!(*a[0], 10); - assert_eq!(*b[0], 10); - - // This should only modify the value in a, not b - *a[0] = 20; - - assert_eq!(*a[0], 20); - assert_eq!(*b[0], 10); -} diff --git a/src/test/ui/run-pass/unique/unique-in-vec.rs b/src/test/ui/run-pass/unique/unique-in-vec.rs deleted file mode 100644 index 681c0c190e4..00000000000 --- a/src/test/ui/run-pass/unique/unique-in-vec.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let vect : Vec> = vec![box 100]; - assert_eq!(vect[0], box 100); -} diff --git a/src/test/ui/run-pass/unique/unique-init.rs b/src/test/ui/run-pass/unique/unique-init.rs deleted file mode 100644 index 9b7c2a99c99..00000000000 --- a/src/test/ui/run-pass/unique/unique-init.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub fn main() { - let _i: Box<_> = box 100; -} diff --git a/src/test/ui/run-pass/unique/unique-kinds.rs b/src/test/ui/run-pass/unique/unique-kinds.rs deleted file mode 100644 index 33b014db37b..00000000000 --- a/src/test/ui/run-pass/unique/unique-kinds.rs +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::cmp::PartialEq; -use std::fmt::Debug; - -fn sendable() { - - fn f(i: T, j: T) { - assert_eq!(i, j); - } - - fn g(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = box 100; - let j: Box<_> = box 100; - f(i, j); - let i: Box<_> = box 100; - let j: Box<_> = box 101; - g(i, j); -} - -fn copyable() { - - fn f(i: T, j: T) { - assert_eq!(i, j); - } - - fn g(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = box 100; - let j: Box<_> = box 100; - f(i, j); - let i: Box<_> = box 100; - let j: Box<_> = box 101; - g(i, j); -} - -fn noncopyable() { - - fn f(i: T, j: T) { - assert_eq!(i, j); - } - - fn g(i: T, j: T) { - assert!(i != j); - } - - let i: Box<_> = box 100; - let j: Box<_> = box 100; - f(i, j); - let i: Box<_> = box 100; - let j: Box<_> = box 101; - g(i, j); -} - -pub fn main() { - sendable(); - copyable(); - noncopyable(); -} diff --git a/src/test/ui/run-pass/unique/unique-log.rs b/src/test/ui/run-pass/unique/unique-log.rs deleted file mode 100644 index f8b5f5562fc..00000000000 --- a/src/test/ui/run-pass/unique/unique-log.rs +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 100; - println!("{}", i); -} diff --git a/src/test/ui/run-pass/unique/unique-match-discrim.rs b/src/test/ui/run-pass/unique/unique-match-discrim.rs deleted file mode 100644 index 43004e8673a..00000000000 --- a/src/test/ui/run-pass/unique/unique-match-discrim.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #961 - -// pretty-expanded FIXME #23616 - -fn altsimple() { - match Box::new(true) { - _ => { } - } -} -pub fn main() { } diff --git a/src/test/ui/run-pass/unique/unique-move-drop.rs b/src/test/ui/run-pass/unique/unique-move-drop.rs deleted file mode 100644 index 53f3c9b6c5c..00000000000 --- a/src/test/ui/run-pass/unique/unique-move-drop.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![allow(unused_variables)] -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 100; - let j: Box<_> = box 200; - let j = i; - assert_eq!(*j, 100); -} diff --git a/src/test/ui/run-pass/unique/unique-move-temp.rs b/src/test/ui/run-pass/unique/unique-move-temp.rs deleted file mode 100644 index a68fe021d09..00000000000 --- a/src/test/ui/run-pass/unique/unique-move-temp.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut i: Box<_>; - i = box 100; - assert_eq!(*i, 100); -} diff --git a/src/test/ui/run-pass/unique/unique-move.rs b/src/test/ui/run-pass/unique/unique-move.rs deleted file mode 100644 index 4dba48a5ea0..00000000000 --- a/src/test/ui/run-pass/unique/unique-move.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let i: Box<_> = box 100; - let mut j; - j = i; - assert_eq!(*j, 100); -} diff --git a/src/test/ui/run-pass/unique/unique-mutable.rs b/src/test/ui/run-pass/unique/unique-mutable.rs deleted file mode 100644 index fcae9323c38..00000000000 --- a/src/test/ui/run-pass/unique/unique-mutable.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -pub fn main() { - let mut i: Box<_> = box 0; - *i = 1; - assert_eq!(*i, 1); -} diff --git a/src/test/ui/run-pass/unique/unique-object-move.rs b/src/test/ui/run-pass/unique/unique-object-move.rs deleted file mode 100644 index d85b22f5dc9..00000000000 --- a/src/test/ui/run-pass/unique/unique-object-move.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Issue #5192 - -// pretty-expanded FIXME #23616 - -#![feature(box_syntax)] - -pub trait EventLoop { fn foo(&self) {} } - -pub struct UvEventLoop { - uvio: isize -} - -impl EventLoop for UvEventLoop { } - -pub fn main() { - let loop_: Box = box UvEventLoop { uvio: 0 } as Box; - let _loop2_ = loop_; -} diff --git a/src/test/ui/run-pass/unique/unique-pat-2.rs b/src/test/ui/run-pass/unique/unique-pat-2.rs deleted file mode 100644 index 3796be68369..00000000000 --- a/src/test/ui/run-pass/unique/unique-pat-2.rs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] -#![allow(non_shorthand_field_patterns)] - -#![feature(box_patterns)] -#![feature(box_syntax)] - -struct Foo {a: isize, b: usize} - -enum bar { u(Box), w(isize), } - -pub fn main() { - assert!(match bar::u(box Foo{a: 10, b: 40}) { - bar::u(box Foo{a: a, b: b}) => { a + (b as isize) } - _ => { 66 } - } == 50); -} diff --git a/src/test/ui/run-pass/unique/unique-pat-3.rs b/src/test/ui/run-pass/unique/unique-pat-3.rs deleted file mode 100644 index 2ed984c3a37..00000000000 --- a/src/test/ui/run-pass/unique/unique-pat-3.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_camel_case_types)] - -#![feature(box_syntax)] - -enum bar { u(Box), w(isize), } - -pub fn main() { - assert!(match bar::u(box 10) { - bar::u(a) => { - println!("{}", a); - *a - } - _ => { 66 } - } == 10); -} diff --git a/src/test/ui/run-pass/unique/unique-pat.rs b/src/test/ui/run-pass/unique/unique-pat.rs deleted file mode 100644 index c83989def33..00000000000 --- a/src/test/ui/run-pass/unique/unique-pat.rs +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(box_patterns)] -#![feature(box_syntax)] - -fn simple() { - match box true { - box true => { } - _ => { panic!(); } - } -} - -pub fn main() { - simple(); -} diff --git a/src/test/ui/run-pass/unique/unique-rec.rs b/src/test/ui/run-pass/unique/unique-rec.rs deleted file mode 100644 index 0169be9d139..00000000000 --- a/src/test/ui/run-pass/unique/unique-rec.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -struct X { x: isize } - -pub fn main() { - let x: Box<_> = box X {x: 1}; - let bar = x; - assert_eq!(bar.x, 1); -} diff --git a/src/test/ui/run-pass/unique/unique-send-2.rs b/src/test/ui/run-pass/unique/unique-send-2.rs deleted file mode 100644 index 285772b9541..00000000000 --- a/src/test/ui/run-pass/unique/unique-send-2.rs +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// ignore-emscripten no threads support - -#![feature(box_syntax)] - -use std::sync::mpsc::{channel, Sender}; -use std::thread; - -fn child(tx: &Sender>, i: usize) { - tx.send(box i).unwrap(); -} - -pub fn main() { - let (tx, rx) = channel(); - let n = 100; - let mut expected = 0; - let ts = (0..n).map(|i| { - expected += i; - let tx = tx.clone(); - thread::spawn(move|| { - child(&tx, i) - }) - }).collect::>(); - - let mut actual = 0; - for _ in 0..n { - let j = rx.recv().unwrap(); - actual += *j; - } - - assert_eq!(expected, actual); - - for t in ts { t.join(); } -} diff --git a/src/test/ui/run-pass/unique/unique-send.rs b/src/test/ui/run-pass/unique/unique-send.rs deleted file mode 100644 index d7382749861..00000000000 --- a/src/test/ui/run-pass/unique/unique-send.rs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::sync::mpsc::channel; - -pub fn main() { - let (tx, rx) = channel::>(); - tx.send(box 100).unwrap(); - let v = rx.recv().unwrap(); - assert_eq!(v, box 100); -} diff --git a/src/test/ui/run-pass/unique/unique-swap.rs b/src/test/ui/run-pass/unique/unique-swap.rs deleted file mode 100644 index 16090fa1b28..00000000000 --- a/src/test/ui/run-pass/unique/unique-swap.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![feature(box_syntax)] - -use std::mem::swap; - -pub fn main() { - let mut i: Box<_> = box 100; - let mut j: Box<_> = box 200; - swap(&mut i, &mut j); - assert_eq!(i, box 200); - assert_eq!(j, box 100); -} diff --git a/src/test/ui/run-pass/unsized-locals/reference-unsized-locals.rs b/src/test/ui/run-pass/unsized-locals/reference-unsized-locals.rs deleted file mode 100644 index 8b96c30940f..00000000000 --- a/src/test/ui/run-pass/unsized-locals/reference-unsized-locals.rs +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(unsized_locals)] - -fn main() { - let foo: Box<[u8]> = Box::new(*b"foo"); - let foo: [u8] = *foo; - assert_eq!(&foo, b"foo" as &[u8]); -} diff --git a/src/test/ui/run-pass/unsized-locals/simple-unsized-locals.rs b/src/test/ui/run-pass/unsized-locals/simple-unsized-locals.rs deleted file mode 100644 index 9643afaee62..00000000000 --- a/src/test/ui/run-pass/unsized-locals/simple-unsized-locals.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(unsized_locals)] - -fn main() { - let foo: Box<[u8]> = Box::new(*b"foo"); - let _foo: [u8] = *foo; -} diff --git a/src/test/ui/run-pass/unsized-locals/unsized-exprs.rs b/src/test/ui/run-pass/unsized-locals/unsized-exprs.rs deleted file mode 100644 index 06919a07c75..00000000000 --- a/src/test/ui/run-pass/unsized-locals/unsized-exprs.rs +++ /dev/null @@ -1,47 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(unsized_tuple_coercion, unsized_locals)] - -struct A(X); - -fn udrop(_x: T) {} -fn foo() -> Box<[u8]> { - Box::new(*b"foo") -} -fn tfoo() -> Box<(i32, [u8])> { - Box::new((42, *b"foo")) -} -fn afoo() -> Box> { - Box::new(A(*b"foo")) -} - -impl std::ops::Add for A<[u8]> { - type Output = (); - fn add(self, _rhs: i32) -> Self::Output {} -} - -fn main() { - udrop::<[u8]>(loop { - break *foo(); - }); - udrop::<[u8]>(if true { - *foo() - } else { - *foo() - }); - udrop::<[u8]>({*foo()}); - #[allow(unused_parens)] - udrop::<[u8]>((*foo())); - udrop::<[u8]>((*tfoo()).1); - *afoo() + 42; -} diff --git a/src/test/ui/run-pass/unsized-locals/unsized-parameters.rs b/src/test/ui/run-pass/unsized-locals/unsized-parameters.rs deleted file mode 100644 index 82036c5797d..00000000000 --- a/src/test/ui/run-pass/unsized-locals/unsized-parameters.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2018 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass - -#![feature(unsized_locals)] - -pub fn f0(_f: dyn FnOnce()) {} -pub fn f1(_s: str) {} -pub fn f2((_x, _y): (i32, [i32])) {} - -fn main() { - let foo = "foo".to_string().into_boxed_str(); - f1(*foo); -} diff --git a/src/test/ui/run-pass/where-clauses/auxiliary/where_clauses_xc.rs b/src/test/ui/run-pass/where-clauses/auxiliary/where_clauses_xc.rs deleted file mode 100644 index 4549bd719c6..00000000000 --- a/src/test/ui/run-pass/where-clauses/auxiliary/where_clauses_xc.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -pub trait Equal { - fn equal(&self, other: &Self) -> bool; - fn equals(&self, this: &T, that: &T, x: &U, y: &U) -> bool - where T: Eq, U: Eq; -} - -impl Equal for T where T: Eq { - fn equal(&self, other: &T) -> bool { - self == other - } - fn equals(&self, this: &U, other: &U, x: &X, y: &X) -> bool - where U: Eq, X: Eq { - this == other && x == y - } -} - -pub fn equal(x: &T, y: &T) -> bool where T: Eq { - x == y -} diff --git a/src/test/ui/run-pass/where-clauses/where-clause-bounds-inconsistency.rs b/src/test/ui/run-pass/where-clauses/where-clause-bounds-inconsistency.rs deleted file mode 100644 index 752f8f2252e..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clause-bounds-inconsistency.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Bound { - fn dummy(&self) { } -} - -trait Trait { - fn a(&self, _: T) where T: Bound; - fn b(&self, _: T) where T: Bound; - fn c(&self, _: T); - fn d(&self, _: T); -} - -impl Trait for bool { - fn a(&self, _: T) {} - //^~ This gets rejected but should be accepted - fn b(&self, _: T) where T: Bound {} - fn c(&self, _: T) {} - fn d(&self, _: T) where T: Bound {} -} - -fn main() {} diff --git a/src/test/ui/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs b/src/test/ui/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs deleted file mode 100644 index 4d5a676943a..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clause-early-bound-lifetimes.rs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -// pretty-expanded FIXME #23616 - -trait TheTrait { fn dummy(&self) { } } - -impl TheTrait for &'static isize { } - -fn foo<'a,T>(_: &'a T) where &'a T : TheTrait { } - -fn bar(_: &'static T) where &'static T : TheTrait { } - -fn main() { - static x: isize = 1; - foo(&x); - bar(&x); -} diff --git a/src/test/ui/run-pass/where-clauses/where-clause-method-substituion.rs b/src/test/ui/run-pass/where-clauses/where-clause-method-substituion.rs deleted file mode 100644 index 3afccab07b7..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clause-method-substituion.rs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -trait Foo { fn dummy(&self, arg: T) { } } - -trait Bar { - fn method(&self) where A: Foo; -} - -struct S; -struct X; - -impl Foo for X {} - -impl Bar for i32 { - fn method(&self) where X: Foo { - } -} - -fn main() { - 1.method::(); -} diff --git a/src/test/ui/run-pass/where-clauses/where-clause-region-outlives.rs b/src/test/ui/run-pass/where-clauses/where-clause-region-outlives.rs deleted file mode 100644 index 445a090d601..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clause-region-outlives.rs +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct A<'a, 'b> where 'a : 'b { x: &'a isize, y: &'b isize } - -fn main() { - let x = 1; - let y = 1; - let a = A { x: &x, y: &y }; -} diff --git a/src/test/ui/run-pass/where-clauses/where-clauses-cross-crate.rs b/src/test/ui/run-pass/where-clauses/where-clauses-cross-crate.rs deleted file mode 100644 index 0343656061b..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clauses-cross-crate.rs +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// aux-build:where_clauses_xc.rs - -extern crate where_clauses_xc; - -use where_clauses_xc::{Equal, equal}; - -fn main() { - println!("{}", equal(&1, &2)); - println!("{}", equal(&1, &1)); - println!("{}", "hello".equal(&"hello")); - println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); -} diff --git a/src/test/ui/run-pass/where-clauses/where-clauses-lifetimes.rs b/src/test/ui/run-pass/where-clauses/where-clauses-lifetimes.rs deleted file mode 100644 index 22b1acb2a60..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clauses-lifetimes.rs +++ /dev/null @@ -1,18 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -fn foo<'a, I>(mut it: I) where I: Iterator {} - -fn main() { - foo([1, 2].iter()); -} diff --git a/src/test/ui/run-pass/where-clauses/where-clauses-method.rs b/src/test/ui/run-pass/where-clauses/where-clauses-method.rs deleted file mode 100644 index c9930128bbe..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clauses-method.rs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// Test that a where clause attached to a method allows us to add -// additional constraints to a parameter out of scope. - -struct Foo { - value: T -} - -impl Foo { - fn equals(&self, u: &Foo) -> bool where T : Eq { - self.value == u.value - } -} - -fn main() { - let x = Foo { value: 1 }; - let y = Foo { value: 2 }; - println!("{}", x.equals(&x)); - println!("{}", x.equals(&y)); -} diff --git a/src/test/ui/run-pass/where-clauses/where-clauses-unboxed-closures.rs b/src/test/ui/run-pass/where-clauses/where-clauses-unboxed-closures.rs deleted file mode 100644 index c3cfbbda4ea..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clauses-unboxed-closures.rs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -// pretty-expanded FIXME #23616 - -struct Bencher; - -// ICE -fn warm_up<'a, F>(f: F) where F: Fn(&'a mut Bencher) { -} - -fn main() { - // ICE trigger - warm_up(|b: &mut Bencher| () ); - - // OK - warm_up(|b| () ); -} diff --git a/src/test/ui/run-pass/where-clauses/where-clauses.rs b/src/test/ui/run-pass/where-clauses/where-clauses.rs deleted file mode 100644 index 8f1cf098c30..00000000000 --- a/src/test/ui/run-pass/where-clauses/where-clauses.rs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2014 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -trait Equal { - fn equal(&self, other: &Self) -> bool; - fn equals(&self, this: &T, that: &T, x: &U, y: &U) -> bool - where T: Eq, U: Eq; -} - -impl Equal for T where T: Eq { - fn equal(&self, other: &T) -> bool { - self == other - } - fn equals(&self, this: &U, other: &U, x: &X, y: &X) -> bool - where U: Eq, X: Eq { - this == other && x == y - } -} - -fn equal(x: &T, y: &T) -> bool where T: Eq { - x == y -} - -fn main() { - println!("{}", equal(&1, &2)); - println!("{}", equal(&1, &1)); - println!("{}", "hello".equal(&"hello")); - println!("{}", "hello".equals::(&1, &1, &"foo", &"bar")); -} diff --git a/src/test/ui/run-pass/zero-sized/zero-size-type-destructors.rs b/src/test/ui/run-pass/zero-sized/zero-size-type-destructors.rs deleted file mode 100644 index 02f8639e832..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-size-type-destructors.rs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(non_upper_case_globals)] - -static mut destructions : isize = 3; - -pub fn foo() { - struct Foo; - - impl Drop for Foo { - fn drop(&mut self) { - unsafe { destructions -= 1 }; - } - }; - - let _x = [Foo, Foo, Foo]; -} - -pub fn main() { - foo(); - assert_eq!(unsafe { destructions }, 0); -} diff --git a/src/test/ui/run-pass/zero-sized/zero-sized-binary-heap-push.rs b/src/test/ui/run-pass/zero-sized/zero-sized-binary-heap-push.rs deleted file mode 100644 index 4ab329f166a..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-sized-binary-heap-push.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::BinaryHeap; -use std::iter::Iterator; - -fn main() { - const N: usize = 8; - - for len in 0..N { - let mut tester = BinaryHeap::with_capacity(len); - assert_eq!(tester.len(), 0); - assert!(tester.capacity() >= len); - for bit in 0..len { - tester.push(()); - } - assert_eq!(tester.len(), len); - assert_eq!(tester.iter().count(), len); - tester.clear(); - } -} diff --git a/src/test/ui/run-pass/zero-sized/zero-sized-btreemap-insert.rs b/src/test/ui/run-pass/zero-sized/zero-sized-btreemap-insert.rs deleted file mode 100644 index 5e406152d93..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-sized-btreemap-insert.rs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::cmp::{Ord, Ordering, PartialOrd}; -use std::collections::BTreeMap; -use std::iter::Iterator; - -#[derive(Eq, Hash, Debug, Ord, PartialEq, PartialOrd)] -struct Zst; - -fn main() { - const N: usize = 8; - - for len in 0..N { - let mut tester = BTreeMap::new(); - assert_eq!(tester.len(), 0); - for bit in 0..len { - tester.insert(Zst, ()); - } - assert_eq!(tester.len(), if len == 0 { 0 } else { 1 }); - assert_eq!(tester.iter().count(), if len == 0 { 0 } else { 1 }); - assert_eq!(tester.get(&Zst).is_some(), len > 0); - tester.clear(); - } -} diff --git a/src/test/ui/run-pass/zero-sized/zero-sized-linkedlist-push.rs b/src/test/ui/run-pass/zero-sized/zero-sized-linkedlist-push.rs deleted file mode 100644 index 7b0b2f3c3c5..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-sized-linkedlist-push.rs +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::LinkedList; -use std::iter::Iterator; - -fn main() { - const N: usize = 8; - - // Test that for all possible sequences of push_front / push_back, - // we end up with a LinkedList of the correct size - - for len in 0..N { - let mut tester = LinkedList::new(); - assert_eq!(tester.len(), 0); - assert_eq!(tester.front(), None); - for case in 0..(1 << len) { - assert_eq!(tester.len(), 0); - for bit in 0..len { - if case & (1 << bit) != 0 { - tester.push_front(()); - } else { - tester.push_back(()); - } - } - assert_eq!(tester.len(), len); - assert_eq!(tester.iter().count(), len); - tester.clear(); - } - } -} diff --git a/src/test/ui/run-pass/zero-sized/zero-sized-tuple-struct.rs b/src/test/ui/run-pass/zero-sized/zero-sized-tuple-struct.rs deleted file mode 100644 index 2ea51779063..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-sized-tuple-struct.rs +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2012 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -#![allow(unused_assignments)] - -// Make sure that the constructor args are codegened for zero-sized tuple structs - -struct Foo(()); - -fn main() { - let mut a = 1; - Foo({ a = 2 }); - assert_eq!(a, 2); -} diff --git a/src/test/ui/run-pass/zero-sized/zero-sized-vec-deque-push.rs b/src/test/ui/run-pass/zero-sized/zero-sized-vec-deque-push.rs deleted file mode 100644 index 2fc51f3409f..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-sized-vec-deque-push.rs +++ /dev/null @@ -1,42 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::collections::VecDeque; -use std::iter::Iterator; - -fn main() { - const N: usize = 8; - - // Zero sized type - struct Zst; - - // Test that for all possible sequences of push_front / push_back, - // we end up with a deque of the correct size - - for len in 0..N { - let mut tester = VecDeque::with_capacity(len); - assert_eq!(tester.len(), 0); - assert!(tester.capacity() >= len); - for case in 0..(1 << len) { - assert_eq!(tester.len(), 0); - for bit in 0..len { - if case & (1 << bit) != 0 { - tester.push_front(Zst); - } else { - tester.push_back(Zst); - } - } - assert_eq!(tester.len(), len); - assert_eq!(tester.iter().count(), len); - tester.clear(); - } - } -} diff --git a/src/test/ui/run-pass/zero-sized/zero-sized-vec-push.rs b/src/test/ui/run-pass/zero-sized/zero-sized-vec-push.rs deleted file mode 100644 index dd8b717761b..00000000000 --- a/src/test/ui/run-pass/zero-sized/zero-sized-vec-push.rs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT -// file at the top-level directory of this distribution and at -// http://rust-lang.org/COPYRIGHT. -// -// Licensed under the Apache License, Version 2.0 or the MIT license -// , at your -// option. This file may not be copied, modified, or distributed -// except according to those terms. - -// run-pass -use std::iter::Iterator; -use std::vec::Vec; - -fn main() { - const N: usize = 8; - - for len in 0..N { - let mut tester = Vec::with_capacity(len); - assert_eq!(tester.len(), 0); - assert!(tester.capacity() >= len); - for bit in 0..len { - tester.push(()); - } - assert_eq!(tester.len(), len); - assert_eq!(tester.iter().count(), len); - tester.clear(); - } -} -- cgit 1.4.1-3-g733a5 From c9d9cc6e4441bb10ce2ca313fda68e7f05d7bc46 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Tue, 25 Sep 2018 23:51:35 +0200 Subject: Add `#![allow(..)]` as necessary to get re-migrated run-pass tests compiling with clean stderr again. Most were added mechanically. --- .../array-slice-vec/array_const_index-1.rs | 1 + .../array-slice-vec/check-static-mut-slices.rs | 1 + src/test/run-pass/array-slice-vec/evec-slice.rs | 1 + src/test/run-pass/array-slice-vec/slice.rs | 1 + src/test/run-pass/array-slice-vec/vec-late-init.rs | 1 + .../array-slice-vec/vec-macro-with-brackets.rs | 1 + .../vec-matching-legal-tail-element-borrow.rs | 1 + .../associated-const-range-match-patterns.rs | 1 + .../associated-types/associated-types-cc.rs | 1 + ...sociated-types-duplicate-binding-in-env-hrtb.rs | 1 + .../associated-types-duplicate-binding-in-env.rs | 1 + .../associated-types-impl-redirect.rs | 3 ++ .../associated-types-issue-21212.rs | 1 + .../associated-types-nested-projections.rs | 1 + ...associated-types-normalize-in-bounds-binding.rs | 1 + .../associated-types-normalize-in-bounds-ufcs.rs | 1 + .../associated-types-normalize-in-bounds.rs | 1 + ...ciated-types-projection-bound-in-supertraits.rs | 1 + .../associated-types-projection-in-object-type.rs | 2 + .../associated-types-projection-in-supertrait.rs | 1 + .../associated-types-projection-in-where-clause.rs | 2 + .../associated-types-region-erasure-issue-20582.rs | 1 + .../associated-types-sugar-path.rs | 3 ++ ...associated-types-where-clause-impl-ambiguity.rs | 2 + .../autoderef-and-borrow-method-receiver.rs | 1 + .../binding/bind-field-short-with-modifiers.rs | 2 + src/test/run-pass/binding/fat-arrow-match.rs | 1 + .../binding/func-arg-incomplete-pattern.rs | 1 + src/test/run-pass/binding/if-let.rs | 1 + .../binding/inconsistent-lifetime-mismatch.rs | 1 + src/test/run-pass/binding/match-arm-statics.rs | 1 + src/test/run-pass/binding/match-bot-2.rs | 1 + src/test/run-pass/binding/match-enum-struct-0.rs | 1 + src/test/run-pass/binding/match-enum-struct-1.rs | 1 + src/test/run-pass/binding/match-join.rs | 1 + src/test/run-pass/binding/match-naked-record.rs | 1 + src/test/run-pass/binding/match-path.rs | 1 + .../binding/match-pattern-no-type-params.rs | 1 + src/test/run-pass/binding/match-pattern-simple.rs | 1 + src/test/run-pass/binding/match-phi.rs | 2 + src/test/run-pass/binding/match-str.rs | 1 + src/test/run-pass/binding/match-tag.rs | 1 + src/test/run-pass/binding/mut-in-ident-patterns.rs | 2 + .../run-pass/binding/nested-exhaustive-match.rs | 1 + src/test/run-pass/binding/nested-pattern.rs | 1 + .../binding/optional_comma_in_match_arm.rs | 1 + src/test/run-pass/binding/use-uninit-match.rs | 1 + src/test/run-pass/binding/use-uninit-match2.rs | 2 + .../borrowck/borrowck-assignment-to-static-mut.rs | 1 + .../borrowck-borrow-of-mut-base-ptr-safe.rs | 3 ++ .../borrowck/borrowck-field-sensitivity.rs | 2 + src/test/run-pass/borrowck/borrowck-lend-args.rs | 1 + .../borrowck-macro-interaction-issue-6304.rs | 2 + .../borrowck-multiple-borrows-interior-boxes.rs | 2 + src/test/run-pass/borrowck/borrowck-pat-enum.rs | 1 + .../borrowck/borrowck-static-item-in-fn.rs | 1 + .../run-pass/borrowck/borrowck-trait-lifetime.rs | 1 + .../run-pass/borrowck/borrowck-uniq-via-ref.rs | 1 + src/test/run-pass/cfg/cfg-match-arm.rs | 1 + src/test/run-pass/cfg/cfg_stmt_expr.rs | 3 ++ src/test/run-pass/cfg/conditional-compile.rs | 1 + .../run-pass/coerce/coerce-overloaded-autoderef.rs | 1 + .../run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs | 1 + .../run-pass/coerce/coerce-reborrow-imm-vec-arg.rs | 1 + src/test/run-pass/coerce/coerce-unsize-subtype.rs | 1 + src/test/run-pass/coherence/coherence-blanket.rs | 1 + .../coherence/coherence-covered-type-parameter.rs | 1 + .../run-pass/coherence/coherence-impl-in-fn.rs | 1 + .../coherence/coherence-iterator-vec-any-elem.rs | 1 + .../run-pass/coherence/coherence-iterator-vec.rs | 1 + .../coherence/coherence-multidispatch-tuple.rs | 1 + .../coherence/coherence-negative-impls-safe.rs | 1 + src/test/run-pass/coherence/coherence_copy_like.rs | 1 + .../run-pass/consts/const-adt-align-mismatch.rs | 1 + .../consts/const-block-item-macro-codegen.rs | 1 + src/test/run-pass/consts/const-block-item.rs | 1 + src/test/run-pass/consts/const-bound.rs | 1 + src/test/run-pass/consts/const-enum-byref-self.rs | 1 + src/test/run-pass/consts/const-enum-byref.rs | 1 + src/test/run-pass/consts/const-enum-cast.rs | 1 + src/test/run-pass/consts/const-enum-ptr.rs | 1 + src/test/run-pass/consts/const-enum-struct.rs | 1 + src/test/run-pass/consts/const-enum-struct2.rs | 1 + src/test/run-pass/consts/const-enum-structlike.rs | 1 + src/test/run-pass/consts/const-enum-tuple.rs | 1 + src/test/run-pass/consts/const-enum-tuple2.rs | 1 + src/test/run-pass/consts/const-enum-tuplestruct.rs | 1 + .../run-pass/consts/const-enum-tuplestruct2.rs | 1 + src/test/run-pass/consts/const-err.rs | 1 + .../run-pass/consts/const-fields-and-indexing.rs | 1 + src/test/run-pass/consts/const-fn-const-eval.rs | 1 + .../run-pass/consts/const-fn-stability-calls.rs | 2 + .../run-pass/consts/const-index-feature-gate.rs | 1 + src/test/run-pass/consts/const-nullary-enum.rs | 1 + src/test/run-pass/consts/const-pattern-variant.rs | 1 + src/test/run-pass/consts/const-rec-and-tup.rs | 1 + .../run-pass/consts/const-region-ptrs-noncopy.rs | 1 + src/test/run-pass/consts/const-size_of-align_of.rs | 1 + src/test/run-pass/consts/const-str-ptr.rs | 1 + src/test/run-pass/consts/const-struct-offsets.rs | 1 + src/test/run-pass/consts/const-trait-to-trait.rs | 2 + src/test/run-pass/consts/const-unsafe-fn.rs | 1 + .../cross-crate/static-array-across-crate.rs | 1 + .../cross-crate/xcrate-trait-lifetime-param.rs | 1 + src/test/run-pass/ctfe/assoc-const.rs | 1 + .../ctfe/const-block-non-item-statement-3.rs | 1 + .../ctfe/const-block-non-item-statement.rs | 1 + .../run-pass/ctfe/const-fn-destructuring-arg.rs | 1 + src/test/run-pass/ctfe/ice-48279.rs | 2 + src/test/run-pass/ctfe/issue-37550.rs | 2 + src/test/run-pass/ctfe/match-const-fn-structs.rs | 1 + src/test/run-pass/ctfe/mozjs-error.rs | 1 + src/test/run-pass/deriving/deriving-clone-array.rs | 1 + src/test/run-pass/deriving/deriving-clone-enum.rs | 1 + .../deriving/deriving-clone-generic-enum.rs | 1 + src/test/run-pass/deriving/deriving-hash.rs | 2 + .../run-pass/deriving/deriving-meta-multiple.rs | 2 + src/test/run-pass/deriving/deriving-meta.rs | 2 + src/test/run-pass/deriving/deriving-show-2.rs | 1 + src/test/run-pass/deriving/deriving-show.rs | 1 + .../deriving/deriving-via-extension-c-enum.rs | 1 + .../deriving/deriving-via-extension-enum.rs | 1 + .../deriving/deriving-via-extension-hash-enum.rs | 1 + .../deriving/deriving-via-extension-hash-struct.rs | 1 + ...iving-via-extension-struct-like-enum-variant.rs | 1 + src/test/run-pass/drop/drop-struct-as-object.rs | 1 + src/test/run-pass/drop/drop-trait-enum.rs | 3 ++ src/test/run-pass/drop/drop-trait-generic.rs | 1 + src/test/run-pass/drop/drop-trait.rs | 1 + src/test/run-pass/drop/drop-uninhabited-enum.rs | 2 + src/test/run-pass/drop/dynamic-drop.rs | 2 + src/test/run-pass/drop/no-drop-flag-size.rs | 1 + .../dynamically-sized-types/dst-coerce-rc.rs | 1 + .../dynamically-sized-types/dst-coercions.rs | 1 + .../dynamically-sized-types/dst-field-align.rs | 1 + .../run-pass/dynamically-sized-types/dst-index.rs | 1 + src/test/run-pass/extern/extern-1.rs | 1 + src/test/run-pass/extern/extern-call-deep2.rs | 1 + src/test/run-pass/extern/extern-call-scrub.rs | 1 + src/test/run-pass/extern/extern-mod-abi.rs | 1 + .../extern/extern-prelude-no-speculative.rs | 1 + .../run-pass/extern/extern-types-inherent-impl.rs | 1 + .../run-pass/extern/extern-types-pointer-cast.rs | 1 + .../run-pass/extern/extern-types-thin-pointer.rs | 1 + .../run-pass/extern/extern-types-trait-impl.rs | 1 + src/test/run-pass/for-loop-while/break-value.rs | 1 + .../run-pass/for-loop-while/for-loop-goofiness.rs | 1 + .../run-pass/for-loop-while/for-loop-no-std.rs | 1 + .../run-pass/for-loop-while/label_break_value.rs | 2 + .../liveness-assign-imm-local-after-loop.rs | 2 + .../for-loop-while/liveness-move-in-loop.rs | 1 + .../run-pass/for-loop-while/loop-break-value.rs | 1 + src/test/run-pass/for-loop-while/loop-diverges.rs | 1 + src/test/run-pass/for-loop-while/while-label.rs | 1 + .../for-loop-while/while-loop-constraints-2.rs | 1 + .../run-pass/foreign/foreign-mod-unused-const.rs | 1 + src/test/run-pass/foreign/foreign2.rs | 1 + .../expect-infer-supply-two-infers.rs | 2 + .../closure-expected-type/issue-38714.rs | 2 + .../run-pass/functions-closures/closure-reform.rs | 1 + .../closure_to_fn_coercion-expected-types.rs | 1 + .../run-pass/functions-closures/fn-coerce-field.rs | 1 + .../functions-closures/fn-item-type-cast.rs | 2 + .../functions-closures/fn-item-type-coerce.rs | 1 + .../parallel-codegen-closures.rs | 2 + src/test/run-pass/generator/issue-52398.rs | 1 + src/test/run-pass/generator/match-bindings.rs | 1 + .../generator/too-live-local-in-immovable-gen.rs | 1 + src/test/run-pass/generator/yield-in-args-rev.rs | 1 + src/test/run-pass/generator/yield-subtype.rs | 2 + src/test/run-pass/generics/generic-fn.rs | 2 + src/test/run-pass/generics/generic-tag-match.rs | 1 + src/test/run-pass/generics/generic-tag.rs | 1 + src/test/run-pass/generics/generic-type-synonym.rs | 1 + src/test/run-pass/generics/generic-unique.rs | 1 + .../hrtb-binder-levels-in-object-types.rs | 2 + .../hrtb-debruijn-object-types-in-closures.rs | 1 + .../hrtb-precedence-of-plus-where-clause.rs | 2 + .../hrtb-precedence-of-plus.rs | 1 + .../hrtb-resolve-lifetime.rs | 1 + .../hrtb-trait-object-passed-to-closure.rs | 1 + .../higher-rank-trait-bounds/hrtb-type-outlives.rs | 2 + src/test/run-pass/hygiene/hygiene-dodging-1.rs | 1 + .../run-pass/hygiene/hygienic-labels-in-let.rs | 2 + .../run-pass/hygiene/hygienic-labels-in-let.stderr | 56 +++++++++++----------- src/test/run-pass/hygiene/hygienic-labels.rs | 1 + src/test/run-pass/hygiene/hygienic-labels.stderr | 56 +++++++++++----------- src/test/run-pass/hygiene/issue-44128.rs | 1 + src/test/run-pass/hygiene/legacy_interaction.rs | 1 + src/test/run-pass/impl-trait/nesting.rs | 1 + src/test/run-pass/imports/import-glob-0.rs | 1 + src/test/run-pass/imports/import-glob-1.rs | 2 + src/test/run-pass/imports/import-prefix-macro.rs | 1 + src/test/run-pass/imports/import-rename.rs | 1 + .../intrinsics/intrinsic-move-val-cleanups.rs | 2 + src/test/run-pass/issues/issue-10025.rs | 1 + src/test/run-pass/issues/issue-10028.rs | 1 + src/test/run-pass/issues/issue-10228.rs | 2 + src/test/run-pass/issues/issue-10392.rs | 1 + src/test/run-pass/issues/issue-10396.rs | 1 + src/test/run-pass/issues/issue-10763.rs | 1 + src/test/run-pass/issues/issue-10802.rs | 1 + src/test/run-pass/issues/issue-10806.rs | 1 + src/test/run-pass/issues/issue-10902.rs | 1 + src/test/run-pass/issues/issue-11085.rs | 1 + src/test/run-pass/issues/issue-1112.rs | 1 + src/test/run-pass/issues/issue-11612.rs | 1 + src/test/run-pass/issues/issue-11677.rs | 1 + src/test/run-pass/issues/issue-11709.rs | 1 + src/test/run-pass/issues/issue-11869.rs | 1 + src/test/run-pass/issues/issue-1251.rs | 2 + src/test/run-pass/issues/issue-12612.rs | 1 + src/test/run-pass/issues/issue-12729.rs | 1 + src/test/run-pass/issues/issue-12909.rs | 1 + src/test/run-pass/issues/issue-13204.rs | 1 + src/test/run-pass/issues/issue-13214.rs | 1 + src/test/run-pass/issues/issue-13304.rs | 1 + src/test/run-pass/issues/issue-13405.rs | 2 + src/test/run-pass/issues/issue-13494.rs | 1 + src/test/run-pass/issues/issue-13507-2.rs | 1 + src/test/run-pass/issues/issue-13763.rs | 1 + src/test/run-pass/issues/issue-13808.rs | 2 + src/test/run-pass/issues/issue-13837.rs | 1 + src/test/run-pass/issues/issue-13902.rs | 1 + src/test/run-pass/issues/issue-14330.rs | 1 + src/test/run-pass/issues/issue-14456.rs | 1 + src/test/run-pass/issues/issue-1451.rs | 1 + src/test/run-pass/issues/issue-14821.rs | 2 + src/test/run-pass/issues/issue-14865.rs | 1 + src/test/run-pass/issues/issue-14919.rs | 2 + src/test/run-pass/issues/issue-15063.rs | 2 + src/test/run-pass/issues/issue-15221.rs | 1 + src/test/run-pass/issues/issue-15261.rs | 1 + src/test/run-pass/issues/issue-15487.rs | 1 + src/test/run-pass/issues/issue-15689-2.rs | 1 + src/test/run-pass/issues/issue-15730.rs | 2 + src/test/run-pass/issues/issue-15735.rs | 1 + src/test/run-pass/issues/issue-15763.rs | 1 + src/test/run-pass/issues/issue-15793.rs | 1 + src/test/run-pass/issues/issue-16441.rs | 1 + src/test/run-pass/issues/issue-16452.rs | 1 + src/test/run-pass/issues/issue-16560.rs | 1 + src/test/run-pass/issues/issue-16596.rs | 1 + src/test/run-pass/issues/issue-16597.rs | 1 + src/test/run-pass/issues/issue-16602-3.rs | 2 + src/test/run-pass/issues/issue-16668.rs | 1 + src/test/run-pass/issues/issue-16783.rs | 1 + src/test/run-pass/issues/issue-16819.rs | 1 + src/test/run-pass/issues/issue-1701.rs | 1 + src/test/run-pass/issues/issue-17074.rs | 1 + src/test/run-pass/issues/issue-17121.rs | 1 + src/test/run-pass/issues/issue-17216.rs | 1 + src/test/run-pass/issues/issue-17336.rs | 1 + .../run-pass/issues/issue-17718-borrow-interior.rs | 1 + .../issues/issue-17718-const-destructors.rs | 1 + .../issues/issue-17718-static-unsafe-interior.rs | 3 ++ src/test/run-pass/issues/issue-17718.rs | 1 + src/test/run-pass/issues/issue-17732.rs | 1 + src/test/run-pass/issues/issue-17746.rs | 1 + src/test/run-pass/issues/issue-17756.rs | 1 + src/test/run-pass/issues/issue-17771.rs | 1 + src/test/run-pass/issues/issue-17816.rs | 1 + src/test/run-pass/issues/issue-17904.rs | 1 + src/test/run-pass/issues/issue-18083.rs | 2 + src/test/run-pass/issues/issue-18110.rs | 1 + src/test/run-pass/issues/issue-1821.rs | 1 + src/test/run-pass/issues/issue-18353.rs | 1 + src/test/run-pass/issues/issue-18446.rs | 1 + src/test/run-pass/issues/issue-1866.rs | 1 + src/test/run-pass/issues/issue-18738.rs | 1 + src/test/run-pass/issues/issue-18906.rs | 1 + src/test/run-pass/issues/issue-18988.rs | 1 + src/test/run-pass/issues/issue-19001.rs | 1 + src/test/run-pass/issues/issue-19037.rs | 1 + src/test/run-pass/issues/issue-19097.rs | 1 + src/test/run-pass/issues/issue-19102.rs | 1 + src/test/run-pass/issues/issue-19127.rs | 1 + src/test/run-pass/issues/issue-19129-2.rs | 1 + src/test/run-pass/issues/issue-19340-1.rs | 1 + src/test/run-pass/issues/issue-19340-2.rs | 1 + src/test/run-pass/issues/issue-19404.rs | 2 + src/test/run-pass/issues/issue-19499.rs | 2 + src/test/run-pass/issues/issue-19631.rs | 1 + src/test/run-pass/issues/issue-19632.rs | 1 + src/test/run-pass/issues/issue-19850.rs | 1 + src/test/run-pass/issues/issue-20186.rs | 2 + src/test/run-pass/issues/issue-20313.rs | 1 + src/test/run-pass/issues/issue-20343.rs | 1 + src/test/run-pass/issues/issue-20389.rs | 1 + src/test/run-pass/issues/issue-20414.rs | 1 + src/test/run-pass/issues/issue-20427.rs | 3 ++ src/test/run-pass/issues/issue-20454.rs | 1 + src/test/run-pass/issues/issue-20616.rs | 1 + src/test/run-pass/issues/issue-2063-resource.rs | 1 + src/test/run-pass/issues/issue-20644.rs | 2 + src/test/run-pass/issues/issue-20763-1.rs | 1 + src/test/run-pass/issues/issue-20763-2.rs | 1 + src/test/run-pass/issues/issue-20953.rs | 2 + src/test/run-pass/issues/issue-21033.rs | 2 + src/test/run-pass/issues/issue-21058.rs | 1 + src/test/run-pass/issues/issue-21174.rs | 2 + src/test/run-pass/issues/issue-21245.rs | 1 + src/test/run-pass/issues/issue-21402.rs | 1 + src/test/run-pass/issues/issue-21475.rs | 1 + src/test/run-pass/issues/issue-21486.rs | 1 + src/test/run-pass/issues/issue-21520.rs | 1 + src/test/run-pass/issues/issue-21562.rs | 1 + src/test/run-pass/issues/issue-21622.rs | 2 + src/test/run-pass/issues/issue-21726.rs | 1 + src/test/run-pass/issues/issue-21891.rs | 1 + src/test/run-pass/issues/issue-2190-1.rs | 1 + src/test/run-pass/issues/issue-2216.rs | 1 + src/test/run-pass/issues/issue-22346.rs | 1 + src/test/run-pass/issues/issue-22471.rs | 1 + src/test/run-pass/issues/issue-22546.rs | 1 + src/test/run-pass/issues/issue-22577.rs | 1 + src/test/run-pass/issues/issue-22629.rs | 1 + src/test/run-pass/issues/issue-22781.rs | 1 + src/test/run-pass/issues/issue-22828.rs | 1 + src/test/run-pass/issues/issue-2284.rs | 1 + src/test/run-pass/issues/issue-2311-2.rs | 1 + src/test/run-pass/issues/issue-2312.rs | 1 + src/test/run-pass/issues/issue-23406.rs | 1 + src/test/run-pass/issues/issue-23442.rs | 1 + src/test/run-pass/issues/issue-23485.rs | 1 + src/test/run-pass/issues/issue-23491.rs | 1 + src/test/run-pass/issues/issue-23699.rs | 1 + src/test/run-pass/issues/issue-23833.rs | 1 + src/test/run-pass/issues/issue-24085.rs | 1 + src/test/run-pass/issues/issue-24086.rs | 3 ++ src/test/run-pass/issues/issue-24161.rs | 1 + src/test/run-pass/issues/issue-24353.rs | 1 + src/test/run-pass/issues/issue-24434.rs | 1 + src/test/run-pass/issues/issue-2445-b.rs | 1 + src/test/run-pass/issues/issue-2445.rs | 1 + src/test/run-pass/issues/issue-24533.rs | 1 + src/test/run-pass/issues/issue-2463.rs | 1 + src/test/run-pass/issues/issue-2487-a.rs | 1 + src/test/run-pass/issues/issue-2502.rs | 1 + src/test/run-pass/issues/issue-25180.rs | 1 + src/test/run-pass/issues/issue-25339.rs | 2 + src/test/run-pass/issues/issue-25394.rs | 1 + src/test/run-pass/issues/issue-25467.rs | 1 + src/test/run-pass/issues/issue-2550.rs | 1 + .../run-pass/issues/issue-25549-multiple-drop.rs | 1 + src/test/run-pass/issues/issue-25693.rs | 1 + src/test/run-pass/issues/issue-25916.rs | 2 + src/test/run-pass/issues/issue-26095.rs | 1 + src/test/run-pass/issues/issue-2611-3.rs | 1 + src/test/run-pass/issues/issue-26205.rs | 1 + src/test/run-pass/issues/issue-2633.rs | 1 + src/test/run-pass/issues/issue-2642.rs | 1 + src/test/run-pass/issues/issue-26873-multifile.rs | 2 + src/test/run-pass/issues/issue-26873-onefile.rs | 2 + src/test/run-pass/issues/issue-26997.rs | 1 + src/test/run-pass/issues/issue-27060.rs | 1 + src/test/run-pass/issues/issue-2708.rs | 1 + src/test/run-pass/issues/issue-2718.rs | 3 ++ src/test/run-pass/issues/issue-27240.rs | 2 + src/test/run-pass/issues/issue-2734.rs | 1 + src/test/run-pass/issues/issue-2735.rs | 1 + src/test/run-pass/issues/issue-2748-a.rs | 1 + src/test/run-pass/issues/issue-27639.rs | 1 + src/test/run-pass/issues/issue-27889.rs | 2 + src/test/run-pass/issues/issue-2804-2.rs | 1 + src/test/run-pass/issues/issue-28279.rs | 1 + src/test/run-pass/issues/issue-28676.rs | 1 + src/test/run-pass/issues/issue-28822.rs | 1 + src/test/run-pass/issues/issue-2895.rs | 1 + src/test/run-pass/issues/issue-29030.rs | 1 + src/test/run-pass/issues/issue-29037.rs | 1 + src/test/run-pass/issues/issue-2904.rs | 3 ++ src/test/run-pass/issues/issue-29071-2.rs | 1 + src/test/run-pass/issues/issue-29071.rs | 1 + src/test/run-pass/issues/issue-29276.rs | 1 + src/test/run-pass/issues/issue-2935.rs | 1 + src/test/run-pass/issues/issue-29466.rs | 1 + src/test/run-pass/issues/issue-29485.rs | 1 + src/test/run-pass/issues/issue-29522.rs | 1 + src/test/run-pass/issues/issue-29740.rs | 1 + src/test/run-pass/issues/issue-29927.rs | 1 + src/test/run-pass/issues/issue-30018-nopanic.rs | 1 + src/test/run-pass/issues/issue-3037.rs | 1 + src/test/run-pass/issues/issue-30371.rs | 1 + src/test/run-pass/issues/issue-3052.rs | 1 + src/test/run-pass/issues/issue-3121.rs | 1 + src/test/run-pass/issues/issue-31260.rs | 1 + src/test/run-pass/issues/issue-3149.rs | 1 + src/test/run-pass/issues/issue-31597.rs | 1 + src/test/run-pass/issues/issue-31776.rs | 2 + src/test/run-pass/issues/issue-32008.rs | 2 + src/test/run-pass/issues/issue-3220.rs | 1 + src/test/run-pass/issues/issue-33287.rs | 2 + src/test/run-pass/issues/issue-33461.rs | 1 + src/test/run-pass/issues/issue-33498.rs | 1 + src/test/run-pass/issues/issue-3389.rs | 1 + src/test/run-pass/issues/issue-33903.rs | 1 + src/test/run-pass/issues/issue-3424.rs | 1 + src/test/run-pass/issues/issue-3447.rs | 1 + src/test/run-pass/issues/issue-34751.rs | 1 + src/test/run-pass/issues/issue-34784.rs | 1 + src/test/run-pass/issues/issue-34796.rs | 1 + src/test/run-pass/issues/issue-35546.rs | 1 + src/test/run-pass/issues/issue-3556.rs | 1 + src/test/run-pass/issues/issue-35600.rs | 1 + src/test/run-pass/issues/issue-3563-3.rs | 1 + src/test/run-pass/issues/issue-35815.rs | 1 + src/test/run-pass/issues/issue-36023.rs | 1 + src/test/run-pass/issues/issue-36075.rs | 1 + src/test/run-pass/issues/issue-3609.rs | 3 ++ src/test/run-pass/issues/issue-3656.rs | 1 + src/test/run-pass/issues/issue-3702.rs | 1 + src/test/run-pass/issues/issue-37222.rs | 1 + src/test/run-pass/issues/issue-37291/main.rs | 1 + src/test/run-pass/issues/issue-37598.rs | 1 + src/test/run-pass/issues/issue-37725.rs | 1 + src/test/run-pass/issues/issue-37733.rs | 1 + src/test/run-pass/issues/issue-38002.rs | 1 + src/test/run-pass/issues/issue-38437.rs | 1 + src/test/run-pass/issues/issue-38556.rs | 1 + src/test/run-pass/issues/issue-38727.rs | 1 + src/test/run-pass/issues/issue-3874.rs | 1 + src/test/run-pass/issues/issue-3888-2.rs | 1 + src/test/run-pass/issues/issue-3895.rs | 1 + src/test/run-pass/issues/issue-39089.rs | 1 + src/test/run-pass/issues/issue-39467.rs | 1 + src/test/run-pass/issues/issue-39709.rs | 1 + src/test/run-pass/issues/issue-3979-generics.rs | 1 + src/test/run-pass/issues/issue-3979-xcrate.rs | 1 + src/test/run-pass/issues/issue-3979.rs | 1 + src/test/run-pass/issues/issue-3991.rs | 1 + src/test/run-pass/issues/issue-39984.rs | 2 + src/test/run-pass/issues/issue-40003.rs | 1 + src/test/run-pass/issues/issue-40136.rs | 1 + src/test/run-pass/issues/issue-40235.rs | 1 + src/test/run-pass/issues/issue-4025.rs | 2 + src/test/run-pass/issues/issue-40770.rs | 1 + src/test/run-pass/issues/issue-40883.rs | 1 + src/test/run-pass/issues/issue-40951.rs | 1 + src/test/run-pass/issues/issue-4107.rs | 1 + src/test/run-pass/issues/issue-41213.rs | 1 + src/test/run-pass/issues/issue-41272.rs | 1 + src/test/run-pass/issues/issue-41298.rs | 1 + src/test/run-pass/issues/issue-41696.rs | 2 + .../run-pass/issues/issue-41849-variance-req.rs | 1 + .../issue-41936-variance-coerce-unsized-cycle.rs | 1 + src/test/run-pass/issues/issue-42007.rs | 1 + src/test/run-pass/issues/issue-4208.rs | 1 + src/test/run-pass/issues/issue-42453.rs | 1 + src/test/run-pass/issues/issue-42467.rs | 1 + src/test/run-pass/issues/issue-42956.rs | 1 + src/test/run-pass/issues/issue-4333.rs | 1 + src/test/run-pass/issues/issue-43357.rs | 1 + src/test/run-pass/issues/issue-43483.rs | 2 + src/test/run-pass/issues/issue-43923.rs | 2 + src/test/run-pass/issues/issue-44247.rs | 1 + src/test/run-pass/issues/issue-44373.rs | 1 + src/test/run-pass/issues/issue-44402.rs | 1 + src/test/run-pass/issues/issue-4464.rs | 1 + src/test/run-pass/issues/issue-45124.rs | 1 + src/test/run-pass/issues/issue-45152.rs | 2 + src/test/run-pass/issues/issue-45425.rs | 1 + src/test/run-pass/issues/issue-46855.rs | 1 + src/test/run-pass/issues/issue-4734.rs | 1 + src/test/run-pass/issues/issue-47364.rs | 1 + src/test/run-pass/issues/issue-47638.rs | 1 + src/test/run-pass/issues/issue-47673.rs | 1 + src/test/run-pass/issues/issue-47703-1.rs | 1 + src/test/run-pass/issues/issue-47703-tuple.rs | 1 + src/test/run-pass/issues/issue-47703.rs | 1 + src/test/run-pass/issues/issue-47722.rs | 1 + src/test/run-pass/issues/issue-47789.rs | 1 + src/test/run-pass/issues/issue-4830.rs | 1 + src/test/run-pass/issues/issue-4865-1.rs | 1 + src/test/run-pass/issues/issue-4865-3.rs | 1 + src/test/run-pass/issues/issue-4875.rs | 1 + src/test/run-pass/issues/issue-48962.rs | 1 + src/test/run-pass/issues/issue-48984.rs | 1 + ...on-shorthand-field-patterns-in-pattern-macro.rs | 1 + src/test/run-pass/issues/issue-50442.rs | 1 + src/test/run-pass/issues/issue-50689.rs | 1 + src/test/run-pass/issues/issue-51345.rs | 1 + src/test/run-pass/issues/issue-5192.rs | 1 + src/test/run-pass/issues/issue-5243.rs | 1 + src/test/run-pass/issues/issue-52557.rs | 1 + src/test/run-pass/issues/issue-52705/main.rs | 1 + src/test/run-pass/issues/issue-5280.rs | 1 + src/test/run-pass/issues/issue-53333.rs | 1 + src/test/run-pass/issues/issue-5353.rs | 1 + src/test/run-pass/issues/issue-5521.rs | 1 + src/test/run-pass/issues/issue-5530.rs | 1 + src/test/run-pass/issues/issue-5550.rs | 1 + src/test/run-pass/issues/issue-5554.rs | 1 + src/test/run-pass/issues/issue-5572.rs | 1 + src/test/run-pass/issues/issue-5708.rs | 1 + src/test/run-pass/issues/issue-5754.rs | 1 + src/test/run-pass/issues/issue-5791.rs | 1 + src/test/run-pass/issues/issue-5884.rs | 1 + src/test/run-pass/issues/issue-5900.rs | 1 + src/test/run-pass/issues/issue-5997.rs | 1 + src/test/run-pass/issues/issue-6117.rs | 1 + src/test/run-pass/issues/issue-6449.rs | 1 + src/test/run-pass/issues/issue-6470.rs | 1 + src/test/run-pass/issues/issue-6557.rs | 1 + src/test/run-pass/issues/issue-6892.rs | 1 + src/test/run-pass/issues/issue-6919.rs | 1 + src/test/run-pass/issues/issue-6991.rs | 1 + src/test/run-pass/issues/issue-7268.rs | 1 + src/test/run-pass/issues/issue-7344.rs | 1 + src/test/run-pass/issues/issue-7563.rs | 1 + src/test/run-pass/issues/issue-7607-2.rs | 1 + src/test/run-pass/issues/issue-7660.rs | 1 + ...ssue-7673-cast-generically-implemented-trait.rs | 1 + src/test/run-pass/issues/issue-7899.rs | 1 + ...71-default-method-self-inherit-builtin-trait.rs | 1 + src/test/run-pass/issues/issue-8249.rs | 1 + src/test/run-pass/issues/issue-8259.rs | 1 + src/test/run-pass/issues/issue-8351-1.rs | 1 + src/test/run-pass/issues/issue-8351-2.rs | 1 + src/test/run-pass/issues/issue-8398.rs | 1 + src/test/run-pass/issues/issue-8460.rs | 1 + src/test/run-pass/issues/issue-8578.rs | 1 + src/test/run-pass/issues/issue-868.rs | 1 + src/test/run-pass/issues/issue-8783.rs | 1 + src/test/run-pass/issues/issue-8851.rs | 1 + src/test/run-pass/issues/issue-8860.rs | 1 + src/test/run-pass/issues/issue-9047.rs | 2 + src/test/run-pass/issues/issue-9110.rs | 1 + src/test/run-pass/issues/issue-9129.rs | 1 + src/test/run-pass/issues/issue-9243.rs | 1 + src/test/run-pass/issues/issue-9249.rs | 1 + src/test/run-pass/issues/issue-9259.rs | 1 + src/test/run-pass/issues/issue-9382.rs | 1 + src/test/run-pass/issues/issue-9396.rs | 1 + src/test/run-pass/issues/issue-9719.rs | 1 + src/test/run-pass/issues/issue-9737.rs | 1 + src/test/run-pass/issues/issue29927-1.rs | 1 + .../into-iterator-type-inference-shift.rs | 4 ++ src/test/run-pass/macros/colorful-write-macros.rs | 1 + src/test/run-pass/macros/die-macro.rs | 1 + src/test/run-pass/macros/macro-at-most-once-rep.rs | 1 + src/test/run-pass/macros/macro-comma-behavior.rs | 1 + src/test/run-pass/macros/macro-follow.rs | 1 + src/test/run-pass/macros/macro-followed-by-seq.rs | 1 + .../macros/macro-lifetime-used-with-bound.rs | 1 + src/test/run-pass/macros/macro-meta-items.rs | 1 + .../macros/macro-stmt_macro_in_expr_macro.rs | 1 + .../macros/macro-with-braces-in-expr-position.rs | 1 + .../macros/parse-complex-macro-invoc-op.rs | 4 ++ .../run-pass/macros/paths-in-macro-invocations.rs | 1 + src/test/run-pass/macros/type-macros-simple.rs | 2 + .../macros/typeck-macro-interaction-issue-8852.rs | 1 + src/test/run-pass/macros/use-macro-self.rs | 1 + src/test/run-pass/methods/method-attributes.rs | 1 + .../methods/method-normalize-bounds-issue-20604.rs | 2 + .../methods/method-recursive-blanket-impl.rs | 2 + .../run-pass/mir/mir-typeck-normalize-fn-sig.rs | 1 + .../run-pass/mir/mir_build_match_comparisons.rs | 1 + src/test/run-pass/mir/mir_codegen_array.rs | 1 + src/test/run-pass/mir/mir_codegen_critical_edge.rs | 1 + src/test/run-pass/mir/mir_early_return_scope.rs | 1 + src/test/run-pass/mir/mir_fat_ptr_drop.rs | 1 + src/test/run-pass/mir/mir_small_agg_arg.rs | 1 + src/test/run-pass/modules/mod_dir_path.rs | 1 + src/test/run-pass/moves/move-1-unique.rs | 1 + src/test/run-pass/moves/move-2-unique.rs | 1 + src/test/run-pass/moves/move-2.rs | 1 + src/test/run-pass/moves/move-3-unique.rs | 1 + src/test/run-pass/moves/move-4-unique.rs | 1 + src/test/run-pass/moves/move-4.rs | 1 + src/test/run-pass/moves/move-scalar.rs | 1 + .../moves/moves-based-on-type-capture-clause.rs | 1 + src/test/run-pass/nll/issue-48623-closure.rs | 2 + src/test/run-pass/nll/issue-48623-generator.rs | 2 + .../run-pass/numbers-arithmetic/num-wrapping.rs | 1 + .../overloaded/overloaded-autoderef-vtable.rs | 1 + .../run-pass/overloaded/overloaded-autoderef.rs | 1 + .../overloaded_deref_with_ref_pattern.rs | 2 + ...overloaded_deref_with_ref_pattern_issue15609.rs | 2 + .../packed/packed-struct-borrow-element.rs | 1 + .../packed/packed-struct-generic-layout.rs | 1 + .../run-pass/packed/packed-struct-generic-size.rs | 1 + .../packed/packed-struct-generic-size.stderr | 12 ++--- src/test/run-pass/packed/packed-struct-layout.rs | 1 + src/test/run-pass/packed/packed-struct-size.rs | 1 + .../run-pass/packed/packed-tuple-struct-size.rs | 1 + .../abort-link-to-unwinding-crates.rs | 2 +- src/test/run-pass/panic-runtime/abort.rs | 2 +- src/test/run-pass/panic-runtime/lto-abort.rs | 2 +- src/test/run-pass/panic-runtime/lto-unwind.rs | 1 + .../run-pass/panics/panic-handler-set-twice.rs | 1 + .../run-pass/panics/panic-in-dtor-drops-fields.rs | 1 + src/test/run-pass/privacy/privacy1.rs | 1 + src/test/run-pass/privacy/private-class-field.rs | 1 + src/test/run-pass/privacy/private-method.rs | 1 + src/test/run-pass/process/process-exit.rs | 1 + .../regions-addr-of-interior-of-unique-box.rs | 1 + .../regions/regions-assoc-type-region-bound.rs | 1 + .../regions/regions-assoc-type-static-bound.rs | 1 + src/test/run-pass/regions/regions-bot.rs | 1 + .../regions/regions-bound-lists-feature-gate-2.rs | 1 + .../regions/regions-bound-lists-feature-gate.rs | 2 + .../run-pass/regions/regions-creating-enums2.rs | 1 + .../run-pass/regions/regions-creating-enums5.rs | 1 + .../run-pass/regions/regions-debruijn-of-object.rs | 2 + .../regions-early-bound-lifetime-in-assoc-fn.rs | 1 + src/test/run-pass/regions/regions-expl-self.rs | 1 + .../run-pass/regions/regions-fn-subtyping-2.rs | 1 + src/test/run-pass/regions/regions-fn-subtyping.rs | 2 + ...-region-outlives-static-outlives-free-region.rs | 1 + .../run-pass/regions/regions-infer-borrow-scope.rs | 1 + .../regions-infer-reborrow-ref-mut-recurse.rs | 1 + .../regions-infer-region-in-fn-but-not-type.rs | 2 + src/test/run-pass/regions/regions-issue-22246.rs | 1 + ...gions-lifetime-static-items-enclosing-scopes.rs | 1 + .../run-pass/regions/regions-lub-ref-ref-rc.rs | 1 + src/test/run-pass/regions/regions-mock-codegen.rs | 1 + .../regions-no-variance-from-fn-generics.rs | 1 + .../run-pass/regions/regions-nullary-variant.rs | 1 + src/test/run-pass/regions/regions-params.rs | 1 + .../regions/regions-reassign-let-bound-pointer.rs | 2 + .../regions-reassign-match-bound-pointer.rs | 2 + ...d-regions-on-closures-to-inference-variables.rs | 1 + .../regions/regions-scope-chain-example.rs | 2 + src/test/run-pass/regions/regions-self-in-enums.rs | 1 + ...ons-variance-contravariant-use-contravariant.rs | 2 + .../regions-variance-covariant-use-covariant.rs | 1 + src/test/run-pass/rfcs/rfc-1014-2.rs | 1 + src/test/run-pass/rfcs/rfc-1014.rs | 1 + .../rfcs/rfc-2005-default-binding-mode/box.rs | 1 + .../rfcs/rfc-2005-default-binding-mode/general.rs | 1 + .../rfcs/rfc-2005-default-binding-mode/lit.rs | 1 + .../rfc-2005-default-binding-mode/tuple-struct.rs | 1 + .../rfcs/rfc-2008-non-exhaustive/structs.rs | 2 + .../rfc-2008-non-exhaustive/structs_same_crate.rs | 1 + .../rfc-2126-crate-paths/crate-path-absolute.rs | 2 +- .../crate-path-visibility-ambiguity.rs | 2 +- .../rfcs/rfc-2126-extern-absolute-paths/basic.rs | 1 + .../rfcs/rfc-2126-extern-absolute-paths/extern.rs | 1 + .../rfcs/rfc-2175-or-if-while-let/basic.rs | 1 + ...-2421-unreserve-pure-offsetof-sizeof-alignof.rs | 2 + src/test/run-pass/rfcs/rfc1623.rs | 1 + src/test/run-pass/self/explicit-self-closures.rs | 1 + src/test/run-pass/self/explicit-self-generic.rs | 1 + src/test/run-pass/self/explicit-self.rs | 1 + .../self/object-safety-sized-self-by-value-self.rs | 1 + .../object-safety-sized-self-generic-method.rs | 1 + src/test/run-pass/self/self-impl.rs | 2 + src/test/run-pass/self/self-type-param.rs | 1 + src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs | 1 + src/test/run-pass/sepcomp/sepcomp-statics.rs | 1 + src/test/run-pass/sepcomp/sepcomp-unwind.rs | 1 + .../run-pass/simd/simd-intrinsic-generic-cast.rs | 1 + src/test/run-pass/simd/simd-type.rs | 1 + .../defaultimpl/allowed-cross-crate.rs | 3 ++ .../specialization/defaultimpl/projection.rs | 1 + .../specialization-allowed-cross-crate.rs | 3 ++ .../specialization/specialization-on-projection.rs | 1 + .../specialization-projection-alias.rs | 2 + .../specialization/specialization-projection.rs | 1 + .../static-method-in-trait-with-tps-intracrate.rs | 1 + src/test/run-pass/structs-enums/align-struct.rs | 1 + .../run-pass/structs-enums/class-attributes-1.rs | 1 + .../run-pass/structs-enums/class-attributes-2.rs | 1 + .../run-pass/structs-enums/class-cast-to-trait.rs | 2 + src/test/run-pass/structs-enums/class-dtor.rs | 1 + src/test/run-pass/structs-enums/class-exports.rs | 1 + .../class-impl-very-parameterized-trait.rs | 1 + .../class-implement-trait-cross-crate.rs | 1 + .../run-pass/structs-enums/class-poly-methods.rs | 1 + .../run-pass/structs-enums/class-separate-impl.rs | 1 + src/test/run-pass/structs-enums/class-str-field.rs | 1 + src/test/run-pass/structs-enums/class-typarams.rs | 1 + .../structs-enums/classes-self-referential.rs | 1 + .../structs-enums/classes-simple-method.rs | 1 + src/test/run-pass/structs-enums/classes-simple.rs | 1 + src/test/run-pass/structs-enums/classes.rs | 1 + .../run-pass/structs-enums/empty-struct-braces.rs | 1 + src/test/run-pass/structs-enums/enum-alignment.rs | 1 + .../structs-enums/enum-clike-ffi-as-int.rs | 1 + src/test/run-pass/structs-enums/enum-discr.rs | 1 + .../structs-enums/enum-discrim-autosizing.rs | 1 + .../structs-enums/enum-discrim-manual-sizing.rs | 1 + .../structs-enums/enum-export-inheritance.rs | 1 + src/test/run-pass/structs-enums/enum-variants.rs | 2 + .../structs-enums/field-destruction-order.rs | 1 + src/test/run-pass/structs-enums/foreign-struct.rs | 1 + src/test/run-pass/structs-enums/ivec-tag.rs | 1 + .../structs-enums/namespaced-enum-emulate-flat.rs | 1 + .../structs-enums/namespaced-enum-glob-import.rs | 1 + .../run-pass/structs-enums/namespaced-enums.rs | 1 + .../structs-enums/nested-enum-same-names.rs | 1 + .../structs-enums/newtype-struct-with-dtor.rs | 2 + src/test/run-pass/structs-enums/nonzero-enum.rs | 1 + src/test/run-pass/structs-enums/rec-align-u32.rs | 2 + src/test/run-pass/structs-enums/rec-align-u64.rs | 2 + .../run-pass/structs-enums/simple-generic-tag.rs | 1 + .../structs-enums/simple-match-generic-tag.rs | 1 + .../structs-enums/struct-aliases-xcrate.rs | 1 + .../structs-enums/struct-like-variant-construct.rs | 1 + .../structs-enums/struct-order-of-eval-1.rs | 1 + .../structs-enums/struct-order-of-eval-2.rs | 1 + .../structs-enums/struct-path-associated-type.rs | 1 + .../struct-variant-field-visibility.rs | 1 + .../run-pass/structs-enums/tag-align-dyn-u64.rs | 1 + .../structs-enums/tag-align-dyn-variants.rs | 1 + src/test/run-pass/structs-enums/tag-align-u64.rs | 1 + .../run-pass/structs-enums/tag-disr-val-shape.rs | 1 + src/test/run-pass/structs-enums/tag-exports.rs | 1 + src/test/run-pass/structs-enums/tag-in-block.rs | 1 + .../tag-variant-disr-type-mismatch.rs | 1 + src/test/run-pass/structs-enums/tag.rs | 1 + .../run-pass/structs-enums/tuple-struct-trivial.rs | 1 + .../structs-enums/variant-structs-trivial.rs | 1 + src/test/run-pass/threads-sendsync/comm.rs | 1 + .../threads-sendsync/send-is-not-static-par-for.rs | 1 + .../run-pass/threads-sendsync/send-resource.rs | 2 + .../threads-sendsync/send-type-inference.rs | 3 ++ .../run-pass/threads-sendsync/sendable-class.rs | 3 ++ src/test/run-pass/threads-sendsync/spawn-fn.rs | 1 + .../threads-sendsync/spawning-with-debug.rs | 2 + src/test/run-pass/threads-sendsync/task-comm-0.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-1.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-10.rs | 2 + src/test/run-pass/threads-sendsync/task-comm-11.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-12.rs | 2 + src/test/run-pass/threads-sendsync/task-comm-13.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-14.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-15.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-16.rs | 2 + src/test/run-pass/threads-sendsync/task-comm-17.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-3.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-4.rs | 1 + src/test/run-pass/threads-sendsync/task-comm-6.rs | 2 + src/test/run-pass/threads-sendsync/task-comm-7.rs | 2 + src/test/run-pass/threads-sendsync/task-comm-9.rs | 1 + src/test/run-pass/threads-sendsync/task-life-0.rs | 1 + .../threads-sendsync/task-spawn-move-and-copy.rs | 1 + src/test/run-pass/threads-sendsync/threads.rs | 1 + src/test/run-pass/traits/auto-traits.rs | 1 + src/test/run-pass/traits/cycle-trait-type-trait.rs | 1 + src/test/run-pass/traits/impl-implicit-trait.rs | 1 + .../traits/infer-from-object-trait-issue-26952.rs | 2 + .../run-pass/traits/object-one-type-two-traits.rs | 2 + .../overlap-permitted-for-marker-traits-neg.rs | 1 + .../run-pass/traits/supertrait-default-generics.rs | 1 + src/test/run-pass/traits/syntax-trait-polarity.rs | 1 + src/test/run-pass/traits/trait-bounds-basic.rs | 1 + src/test/run-pass/traits/trait-bounds-in-arc.rs | 1 + .../traits/trait-bounds-on-structs-and-enums.rs | 2 + src/test/run-pass/traits/trait-bounds.rs | 1 + src/test/run-pass/traits/trait-coercion-generic.rs | 1 + src/test/run-pass/traits/trait-coercion.rs | 3 ++ src/test/run-pass/traits/trait-copy-guessing.rs | 1 + .../traits/trait-default-method-bound-subst4.rs | 1 + .../run-pass/traits/trait-default-method-xc.rs | 1 + src/test/run-pass/traits/trait-impl-2.rs | 1 + .../run-pass/traits/trait-inheritance-auto-xc.rs | 1 + src/test/run-pass/traits/trait-inheritance-auto.rs | 1 + .../trait-inheritance-call-bound-inherited.rs | 1 + .../trait-inheritance-call-bound-inherited2.rs | 1 + ...-inheritance-cast-without-call-to-supertrait.rs | 1 + src/test/run-pass/traits/trait-inheritance-cast.rs | 1 + .../traits/trait-inheritance-cross-trait-call.rs | 1 + .../run-pass/traits/trait-inheritance-diamond.rs | 1 + .../trait-inheritance-multiple-inheritors.rs | 1 + .../traits/trait-inheritance-multiple-params.rs | 1 + src/test/run-pass/traits/trait-inheritance-num.rs | 2 + src/test/run-pass/traits/trait-inheritance-num0.rs | 1 + src/test/run-pass/traits/trait-inheritance-num1.rs | 1 + .../traits/trait-inheritance-overloading-simple.rs | 1 + .../run-pass/traits/trait-inheritance-simple.rs | 1 + src/test/run-pass/traits/trait-inheritance2.rs | 1 + .../run-pass/traits/trait-object-auto-dedup.rs | 1 + .../traits/trait-static-method-overwriting.rs | 1 + .../run-pass/traits/trait-where-clause-vs-impl.rs | 2 + .../run-pass/traits/traits-conditional-model-fn.rs | 1 + .../run-pass/traits/traits-default-method-mut.rs | 1 + src/test/run-pass/traits/traits-issue-22655.rs | 1 + src/test/run-pass/traits/traits-negative-impls.rs | 1 + .../unboxed-closures-blanket-fn-mut.rs | 1 + .../unboxed-closures-blanket-fn.rs | 1 + .../unboxed-closures-call-fn-autoderef.rs | 1 + .../unboxed-closures-counter-not-moved.rs | 1 + .../unboxed-closures-direct-sugary-call.rs | 1 + .../unboxed-closures/unboxed-closures-drop.rs | 2 + .../unboxed-closures/unboxed-closures-simple.rs | 2 + .../unboxed-closures/unboxed-closures-zero-args.rs | 1 + src/test/run-pass/uniform-paths/basic-nested.rs | 1 + src/test/run-pass/uniform-paths/basic.rs | 1 + src/test/run-pass/union/union-align.rs | 1 + src/test/run-pass/union/union-backcomp.rs | 2 + src/test/run-pass/union/union-basic.rs | 1 + src/test/run-pass/union/union-derive.rs | 2 + src/test/run-pass/union/union-drop-assign.rs | 1 + src/test/run-pass/union/union-drop.rs | 2 + src/test/run-pass/union/union-generic.rs | 1 + src/test/run-pass/union/union-macro.rs | 1 + src/test/run-pass/union/union-packed.rs | 1 + src/test/run-pass/union/union-pat-refutability.rs | 1 + src/test/run-pass/unique/unique-assign-drop.rs | 1 + src/test/run-pass/unique/unique-assign.rs | 1 + src/test/run-pass/unique/unique-cmp.rs | 1 + src/test/run-pass/unique/unique-containing-tag.rs | 1 + src/test/run-pass/unique/unique-create.rs | 1 + src/test/run-pass/unique/unique-decl.rs | 1 + src/test/run-pass/unique/unique-generic-assign.rs | 1 + src/test/run-pass/unique/unique-in-tag.rs | 1 + src/test/run-pass/unique/unique-match-discrim.rs | 1 + src/test/run-pass/unique/unique-move-temp.rs | 1 + src/test/run-pass/unique/unique-move.rs | 1 + src/test/run-pass/unique/unique-object-move.rs | 1 + src/test/run-pass/unique/unique-pat-2.rs | 1 + src/test/run-pass/unique/unique-pat-3.rs | 1 + src/test/run-pass/unique/unique-send-2.rs | 1 + .../where-clause-method-substituion.rs | 1 + .../where-clauses/where-clause-region-outlives.rs | 2 + .../where-clauses/where-clauses-lifetimes.rs | 2 + .../where-clauses-unboxed-closures.rs | 1 + .../zero-sized/zero-sized-binary-heap-push.rs | 1 + .../zero-sized/zero-sized-btreemap-insert.rs | 2 + .../run-pass/zero-sized/zero-sized-vec-push.rs | 1 + 822 files changed, 1030 insertions(+), 67 deletions(-) (limited to 'src') diff --git a/src/test/run-pass/array-slice-vec/array_const_index-1.rs b/src/test/run-pass/array-slice-vec/array_const_index-1.rs index c026a47c4f9..2bc8bf9796e 100644 --- a/src/test/run-pass/array-slice-vec/array_const_index-1.rs +++ b/src/test/run-pass/array-slice-vec/array_const_index-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(stable_features)] #![feature(const_indexing)] diff --git a/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs b/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs index 3d2fc8195eb..998a1d9ee27 100644 --- a/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs +++ b/src/test/run-pass/array-slice-vec/check-static-mut-slices.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Checks that mutable static items can have mutable slices diff --git a/src/test/run-pass/array-slice-vec/evec-slice.rs b/src/test/run-pass/array-slice-vec/evec-slice.rs index 7f54801910b..b1a55a04a24 100644 --- a/src/test/run-pass/array-slice-vec/evec-slice.rs +++ b/src/test/run-pass/array-slice-vec/evec-slice.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] pub fn main() { let x : &[isize] = &[1,2,3,4,5]; diff --git a/src/test/run-pass/array-slice-vec/slice.rs b/src/test/run-pass/array-slice-vec/slice.rs index 6c43d883230..b85cb97b6ba 100644 --- a/src/test/run-pass/array-slice-vec/slice.rs +++ b/src/test/run-pass/array-slice-vec/slice.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test slicing sugar. diff --git a/src/test/run-pass/array-slice-vec/vec-late-init.rs b/src/test/run-pass/array-slice-vec/vec-late-init.rs index dc7241a0e05..234d63672d9 100644 --- a/src/test/run-pass/array-slice-vec/vec-late-init.rs +++ b/src/test/run-pass/array-slice-vec/vec-late-init.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] pub fn main() { diff --git a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs index b5d1459300a..aa7d96a5e5a 100644 --- a/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs +++ b/src/test/run-pass/array-slice-vec/vec-macro-with-brackets.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs b/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs index e727e56c0f8..3d4a84aa5c3 100644 --- a/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs +++ b/src/test/run-pass/array-slice-vec/vec-matching-legal-tail-element-borrow.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![feature(slice_patterns)] diff --git a/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs b/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs index eeff2775323..b425d759b03 100644 --- a/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs +++ b/src/test/run-pass/associated-consts/associated-const-range-match-patterns.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Foo; diff --git a/src/test/run-pass/associated-types/associated-types-cc.rs b/src/test/run-pass/associated-types/associated-types-cc.rs index a8c7caa9361..282e44ed42b 100644 --- a/src/test/run-pass/associated-types/associated-types-cc.rs +++ b/src/test/run-pass/associated-types/associated-types-cc.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // aux-build:associated-types-cc-lib.rs // Test that we are able to reference cross-crate traits that employ diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs index e6175dc34ec..53d25b23b48 100644 --- a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env-hrtb.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Check that we do not report ambiguities when equivalent predicates // (modulo bound lifetime names) appears in the environment // twice. Issue #21965. diff --git a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs index 6836d2860b5..b04da14795f 100644 --- a/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs +++ b/src/test/run-pass/associated-types/associated-types-duplicate-binding-in-env.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Check that we do not report ambiguities when the same predicate // appears in the environment twice. Issue #21965. diff --git a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs index aca76748925..fd2fade2f88 100644 --- a/src/test/run-pass/associated-types/associated-types-impl-redirect.rs +++ b/src/test/run-pass/associated-types/associated-types-impl-redirect.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_imports)] // Test how resolving a projection interacts with inference. In this // case, we were eagerly unifying the type variable for the iterator // type with `I` from the where clause, ignoring the in-scope `impl` diff --git a/src/test/run-pass/associated-types/associated-types-issue-21212.rs b/src/test/run-pass/associated-types/associated-types-issue-21212.rs index 259661dc058..c5baec7be00 100644 --- a/src/test/run-pass/associated-types/associated-types-issue-21212.rs +++ b/src/test/run-pass/associated-types/associated-types-issue-21212.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Regression test for #21212: an overflow occurred during trait // checking where normalizing `Self::Input` led to normalizing the // where clauses in the environment which in turn required normalizing diff --git a/src/test/run-pass/associated-types/associated-types-nested-projections.rs b/src/test/run-pass/associated-types/associated-types-nested-projections.rs index a877a3cfa9d..af6f3da195e 100644 --- a/src/test/run-pass/associated-types/associated-types-nested-projections.rs +++ b/src/test/run-pass/associated-types/associated-types-nested-projections.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that we can resolve nested projection types. Issue #20666. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs index d989e08e808..4dd810d1056 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-binding.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that we normalize associated types that appear in a bound that // contains a binding. Issue #21664. diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs index 3d3540bbf72..d534051267d 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds-ufcs.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that we normalize associated types that appear in bounds; if // we didn't, the call to `self.split2()` fails to type check. diff --git a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs index 79d23c3999e..6651a0b53ac 100644 --- a/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs +++ b/src/test/run-pass/associated-types/associated-types-normalize-in-bounds.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that we normalize associated types that appear in bounds; if // we didn't, the call to `self.split2()` fails to type check. diff --git a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs index 57c7f557ffa..2f27cb1cd9e 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-bound-in-supertraits.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that we correctly handle projection bounds appearing in the // supertrait list (and in conjunction with overloaded operators). In // this case, the `Result=Self` binding in the supertrait listing of diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs index 8b98325598c..c0844e9076e 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-object-type.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] // Corrected regression test for #20831. The original did not compile. // When fixed, it revealed another problem concerning projections that // appear in associated type bindings in object types, which were not diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs b/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs index 001faef7f48..23c9fb89f39 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-supertrait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that we are handle to correctly handle a projection type // that appears in a supertrait bound. Issue #20559. diff --git a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs index c2379e0f078..238f98086ce 100644 --- a/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs +++ b/src/test/run-pass/associated-types/associated-types-projection-in-where-clause.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test a where clause that uses a non-normalized projection type. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs index b4038a21828..40864835d2e 100644 --- a/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs +++ b/src/test/run-pass/associated-types/associated-types-region-erasure-issue-20582.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #20582. This test caused an ICE related to // inconsistent region erasure in codegen. diff --git a/src/test/run-pass/associated-types/associated-types-sugar-path.rs b/src/test/run-pass/associated-types/associated-types-sugar-path.rs index 3b148c5e106..c3c76eb1313 100644 --- a/src/test/run-pass/associated-types/associated-types-sugar-path.rs +++ b/src/test/run-pass/associated-types/associated-types-sugar-path.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_imports)] // Test paths to associated types using the type-parameter-only sugar. use std::ops::Deref; diff --git a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs index 5f24a44c14b..5c03a6bbc02 100644 --- a/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs +++ b/src/test/run-pass/associated-types/associated-types-where-clause-impl-ambiguity.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] // Test how resolving a projection interacts with inference. In this // case, we were eagerly unifying the type variable for the iterator // type with `I` from the where clause, ignoring the in-scope `impl` diff --git a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs index 0ce3ef7fd7b..8ab2bf2f9b8 100644 --- a/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs +++ b/src/test/run-pass/autoref-autoderef/autoderef-and-borrow-method-receiver.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct Foo { diff --git a/src/test/run-pass/binding/bind-field-short-with-modifiers.rs b/src/test/run-pass/binding/bind-field-short-with-modifiers.rs index 24f03774270..59fe52f7b59 100644 --- a/src/test/run-pass/binding/bind-field-short-with-modifiers.rs +++ b/src/test/run-pass/binding/bind-field-short-with-modifiers.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] #![allow(non_shorthand_field_patterns)] pub fn main() { diff --git a/src/test/run-pass/binding/fat-arrow-match.rs b/src/test/run-pass/binding/fat-arrow-match.rs index c0e68f99ad0..678485b324d 100644 --- a/src/test/run-pass/binding/fat-arrow-match.rs +++ b/src/test/run-pass/binding/fat-arrow-match.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] enum color { diff --git a/src/test/run-pass/binding/func-arg-incomplete-pattern.rs b/src/test/run-pass/binding/func-arg-incomplete-pattern.rs index d766feeb72c..bc994f0f7fa 100644 --- a/src/test/run-pass/binding/func-arg-incomplete-pattern.rs +++ b/src/test/run-pass/binding/func-arg-incomplete-pattern.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that we do not leak when the arg pattern must drop part of the // argument (in this case, the `y` field). diff --git a/src/test/run-pass/binding/if-let.rs b/src/test/run-pass/binding/if-let.rs index 9147bf14cad..933865342c4 100644 --- a/src/test/run-pass/binding/if-let.rs +++ b/src/test/run-pass/binding/if-let.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub fn main() { let x = Some(3); diff --git a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs index 9e9fc8b4249..fd2764f84d7 100644 --- a/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs +++ b/src/test/run-pass/binding/inconsistent-lifetime-mismatch.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn foo(_: &[&str]) {} diff --git a/src/test/run-pass/binding/match-arm-statics.rs b/src/test/run-pass/binding/match-arm-statics.rs index c5111073ca8..b6f4cb18d9a 100644 --- a/src/test/run-pass/binding/match-arm-statics.rs +++ b/src/test/run-pass/binding/match-arm-statics.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // compile-flags: -g #[derive(PartialEq, Eq)] diff --git a/src/test/run-pass/binding/match-bot-2.rs b/src/test/run-pass/binding/match-bot-2.rs index 8f9a8d2cfcc..f25b423607b 100644 --- a/src/test/run-pass/binding/match-bot-2.rs +++ b/src/test/run-pass/binding/match-bot-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // n.b. This was only ever failing with optimization disabled. fn a() -> isize { match return 1 { 2 => 3, _ => panic!() } } diff --git a/src/test/run-pass/binding/match-enum-struct-0.rs b/src/test/run-pass/binding/match-enum-struct-0.rs index 9ddf3b421d5..bc364b04aec 100644 --- a/src/test/run-pass/binding/match-enum-struct-0.rs +++ b/src/test/run-pass/binding/match-enum-struct-0.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // regression test for issue #5625 diff --git a/src/test/run-pass/binding/match-enum-struct-1.rs b/src/test/run-pass/binding/match-enum-struct-1.rs index 46d9c19bf84..71cacc2f6bf 100644 --- a/src/test/run-pass/binding/match-enum-struct-1.rs +++ b/src/test/run-pass/binding/match-enum-struct-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { Foo{f : isize}, diff --git a/src/test/run-pass/binding/match-join.rs b/src/test/run-pass/binding/match-join.rs index 94ea8edd70f..cd7cc87a40b 100644 --- a/src/test/run-pass/binding/match-join.rs +++ b/src/test/run-pass/binding/match-join.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] fn foo(y: Option) { let mut x: isize; let mut rs: Vec = Vec::new(); diff --git a/src/test/run-pass/binding/match-naked-record.rs b/src/test/run-pass/binding/match-naked-record.rs index 550ace8b649..9c4c36693b9 100644 --- a/src/test/run-pass/binding/match-naked-record.rs +++ b/src/test/run-pass/binding/match-naked-record.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct X { x: isize } diff --git a/src/test/run-pass/binding/match-path.rs b/src/test/run-pass/binding/match-path.rs index 06d7095a924..385713001a3 100644 --- a/src/test/run-pass/binding/match-path.rs +++ b/src/test/run-pass/binding/match-path.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/match-pattern-no-type-params.rs b/src/test/run-pass/binding/match-pattern-no-type-params.rs index 2486fa782e0..e42a24f20b9 100644 --- a/src/test/run-pass/binding/match-pattern-no-type-params.rs +++ b/src/test/run-pass/binding/match-pattern-no-type-params.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] enum maybe { nothing, just(T), } diff --git a/src/test/run-pass/binding/match-pattern-simple.rs b/src/test/run-pass/binding/match-pattern-simple.rs index d1525661269..3522ba71b6a 100644 --- a/src/test/run-pass/binding/match-pattern-simple.rs +++ b/src/test/run-pass/binding/match-pattern-simple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/binding/match-phi.rs b/src/test/run-pass/binding/match-phi.rs index 06a011c0fa2..43a55da573b 100644 --- a/src/test/run-pass/binding/match-phi.rs +++ b/src/test/run-pass/binding/match-phi.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] // pretty-expanded FIXME #23616 #![allow(non_camel_case_types)] #![allow(unused_variables)] diff --git a/src/test/run-pass/binding/match-str.rs b/src/test/run-pass/binding/match-str.rs index 0722a6f0b32..7b051cfa435 100644 --- a/src/test/run-pass/binding/match-str.rs +++ b/src/test/run-pass/binding/match-str.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue #53 #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/match-tag.rs b/src/test/run-pass/binding/match-tag.rs index aeeb7dd4bc9..ca7b7c70afb 100644 --- a/src/test/run-pass/binding/match-tag.rs +++ b/src/test/run-pass/binding/match-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/mut-in-ident-patterns.rs b/src/test/run-pass/binding/mut-in-ident-patterns.rs index 1e28b77f2ce..e9f143cfbc9 100644 --- a/src/test/run-pass/binding/mut-in-ident-patterns.rs +++ b/src/test/run-pass/binding/mut-in-ident-patterns.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] #![allow(non_camel_case_types)] #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/binding/nested-exhaustive-match.rs b/src/test/run-pass/binding/nested-exhaustive-match.rs index 8456e63d4c7..61bb0e8a468 100644 --- a/src/test/run-pass/binding/nested-exhaustive-match.rs +++ b/src/test/run-pass/binding/nested-exhaustive-match.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct Foo { foo: bool, bar: Option, baz: isize } diff --git a/src/test/run-pass/binding/nested-pattern.rs b/src/test/run-pass/binding/nested-pattern.rs index 5bf558a4871..96bdadc0624 100644 --- a/src/test/run-pass/binding/nested-pattern.rs +++ b/src/test/run-pass/binding/nested-pattern.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // a bug was causing this to complain about leaked memory on exit diff --git a/src/test/run-pass/binding/optional_comma_in_match_arm.rs b/src/test/run-pass/binding/optional_comma_in_match_arm.rs index 90ef3c2b7ea..304a0323297 100644 --- a/src/test/run-pass/binding/optional_comma_in_match_arm.rs +++ b/src/test/run-pass/binding/optional_comma_in_match_arm.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_unsafe)] // ignore-pretty issue #37199 #![allow(while_true)] diff --git a/src/test/run-pass/binding/use-uninit-match.rs b/src/test/run-pass/binding/use-uninit-match.rs index 1fc597b636e..472045fcdb3 100644 --- a/src/test/run-pass/binding/use-uninit-match.rs +++ b/src/test/run-pass/binding/use-uninit-match.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/binding/use-uninit-match2.rs b/src/test/run-pass/binding/use-uninit-match2.rs index 8eb44fd76e1..2f8384f9e84 100644 --- a/src/test/run-pass/binding/use-uninit-match2.rs +++ b/src/test/run-pass/binding/use-uninit-match2.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs index fa79ac84c86..ad16027c34d 100644 --- a/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs +++ b/src/test/run-pass/borrowck/borrowck-assignment-to-static-mut.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test taken from #45641 (https://github.com/rust-lang/rust/issues/45641) // revisions: ast mir diff --git a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs index 72634651d95..a3a63482923 100644 --- a/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs +++ b/src/test/run-pass/borrowck/borrowck-borrow-of-mut-base-ptr-safe.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_variables)] // Test that freezing an `&mut` pointer while referent is // frozen is legal. // diff --git a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs index a3d6f129f18..782054bb1b1 100644 --- a/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs +++ b/src/test/run-pass/borrowck/borrowck-field-sensitivity.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/borrowck/borrowck-lend-args.rs b/src/test/run-pass/borrowck/borrowck-lend-args.rs index 4ec7e0a5898..3458ab91f3d 100644 --- a/src/test/run-pass/borrowck/borrowck-lend-args.rs +++ b/src/test/run-pass/borrowck/borrowck-lend-args.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs b/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs index 3f81c2e5619..ea47661a1fa 100644 --- a/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs +++ b/src/test/run-pass/borrowck/borrowck-macro-interaction-issue-6304.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(unconditional_recursion)] // Check that we do not ICE when compiling this diff --git a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs index 4650ce8d2c4..c51a615c963 100644 --- a/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs +++ b/src/test/run-pass/borrowck/borrowck-multiple-borrows-interior-boxes.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test case from #39963. #![feature(nll)] diff --git a/src/test/run-pass/borrowck/borrowck-pat-enum.rs b/src/test/run-pass/borrowck/borrowck-pat-enum.rs index 3b9c4aed03e..5a184fd0179 100644 --- a/src/test/run-pass/borrowck/borrowck-pat-enum.rs +++ b/src/test/run-pass/borrowck/borrowck-pat-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-pretty issue #37199 fn match_ref(v: Option) -> isize { diff --git a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs index 809948d5423..9bc2a64eea6 100644 --- a/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs +++ b/src/test/run-pass/borrowck/borrowck-static-item-in-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for issue #7740 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs index cf7a976628e..78d25117ff2 100644 --- a/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs +++ b/src/test/run-pass/borrowck/borrowck-trait-lifetime.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // This test verifies that casting from the same lifetime on a value // to the same lifetime on a trait succeeds. See issue #10766. diff --git a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs index f9b650e0e82..e9d7f6f3eb3 100644 --- a/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs +++ b/src/test/run-pass/borrowck/borrowck-uniq-via-ref.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/cfg/cfg-match-arm.rs b/src/test/run-pass/cfg/cfg-match-arm.rs index 8443d59e869..8a7271c38ce 100644 --- a/src/test/run-pass/cfg/cfg-match-arm.rs +++ b/src/test/run-pass/cfg/cfg-match-arm.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 enum Foo { diff --git a/src/test/run-pass/cfg/cfg_stmt_expr.rs b/src/test/run-pass/cfg/cfg_stmt_expr.rs index 102ca22f0bd..405cc402e59 100644 --- a/src/test/run-pass/cfg/cfg_stmt_expr.rs +++ b/src/test/run-pass/cfg/cfg_stmt_expr.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_variables)] #![deny(non_snake_case)] #![feature(stmt_expr_attributes)] diff --git a/src/test/run-pass/cfg/conditional-compile.rs b/src/test/run-pass/cfg/conditional-compile.rs index 20362462484..0328a62588c 100644 --- a/src/test/run-pass/cfg/conditional-compile.rs +++ b/src/test/run-pass/cfg/conditional-compile.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(improper_ctypes)] diff --git a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs index c6b9e61dae1..9f3ef90f9d9 100644 --- a/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs +++ b/src/test/run-pass/coerce/coerce-overloaded-autoderef.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 use std::rc::Rc; diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs index be5e55afbc5..4c6510f9b9b 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-ptr-arg.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn negate(x: &isize) -> isize { diff --git a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs index f8849e6af86..3d61db475da 100644 --- a/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs +++ b/src/test/run-pass/coerce/coerce-reborrow-imm-vec-arg.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn sum(x: &[isize]) -> isize { diff --git a/src/test/run-pass/coerce/coerce-unsize-subtype.rs b/src/test/run-pass/coerce/coerce-unsize-subtype.rs index ab571a8b40d..068b010da1e 100644 --- a/src/test/run-pass/coerce/coerce-unsize-subtype.rs +++ b/src/test/run-pass/coerce/coerce-unsize-subtype.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 use std::rc::Rc; diff --git a/src/test/run-pass/coherence/coherence-blanket.rs b/src/test/run-pass/coherence/coherence-blanket.rs index fa09b13bf67..93bfdd2fdd2 100644 --- a/src/test/run-pass/coherence/coherence-blanket.rs +++ b/src/test/run-pass/coherence/coherence-blanket.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // aux-build:coherence_lib.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs index 3ddeb58dddc..8cbafdf7177 100644 --- a/src/test/run-pass/coherence/coherence-covered-type-parameter.rs +++ b/src/test/run-pass/coherence/coherence-covered-type-parameter.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:coherence_lib.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-impl-in-fn.rs b/src/test/run-pass/coherence/coherence-impl-in-fn.rs index de7cb7664b6..b6915919acb 100644 --- a/src/test/run-pass/coherence/coherence-impl-in-fn.rs +++ b/src/test/run-pass/coherence/coherence-impl-in-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] pub fn main() { diff --git a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs index d446f0dca9a..f56c827b55d 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec-any-elem.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:coherence_lib.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-iterator-vec.rs b/src/test/run-pass/coherence/coherence-iterator-vec.rs index 38ad5b8115a..16501553d9f 100644 --- a/src/test/run-pass/coherence/coherence-iterator-vec.rs +++ b/src/test/run-pass/coherence/coherence-iterator-vec.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:coherence_lib.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs index ab04f946fa6..f6d711bd6cd 100644 --- a/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs +++ b/src/test/run-pass/coherence/coherence-multidispatch-tuple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // pretty-expanded FIXME #23616 use std::fmt::Debug; diff --git a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs index 7984193862e..50b3500ad8d 100644 --- a/src/test/run-pass/coherence/coherence-negative-impls-safe.rs +++ b/src/test/run-pass/coherence/coherence-negative-impls-safe.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/coherence/coherence_copy_like.rs b/src/test/run-pass/coherence/coherence_copy_like.rs index c6903d911f9..f637ac64908 100644 --- a/src/test/run-pass/coherence/coherence_copy_like.rs +++ b/src/test/run-pass/coherence/coherence_copy_like.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that we are able to introduce a negative constraint that // `MyType: !MyTrait` along with other "fundamental" wrappers. diff --git a/src/test/run-pass/consts/const-adt-align-mismatch.rs b/src/test/run-pass/consts/const-adt-align-mismatch.rs index 10875d5046c..057da22e270 100644 --- a/src/test/run-pass/consts/const-adt-align-mismatch.rs +++ b/src/test/run-pass/consts/const-adt-align-mismatch.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(deprecated)] use std::mem; diff --git a/src/test/run-pass/consts/const-block-item-macro-codegen.rs b/src/test/run-pass/consts/const-block-item-macro-codegen.rs index ab452e4fe46..7a0d0781a1f 100644 --- a/src/test/run-pass/consts/const-block-item-macro-codegen.rs +++ b/src/test/run-pass/consts/const-block-item-macro-codegen.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // General test that function items in static blocks // can be generated with a macro. diff --git a/src/test/run-pass/consts/const-block-item.rs b/src/test/run-pass/consts/const-block-item.rs index fe3483ae9f0..83e50eba6dc 100644 --- a/src/test/run-pass/consts/const-block-item.rs +++ b/src/test/run-pass/consts/const-block-item.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] mod foo { pub trait Value { diff --git a/src/test/run-pass/consts/const-bound.rs b/src/test/run-pass/consts/const-bound.rs index a4ac766a740..485b87b4604 100644 --- a/src/test/run-pass/consts/const-bound.rs +++ b/src/test/run-pass/consts/const-bound.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Make sure const bounds work on things, and test that a few types // are const. diff --git a/src/test/run-pass/consts/const-enum-byref-self.rs b/src/test/run-pass/consts/const-enum-byref-self.rs index 9656bc54eb2..203ceaddfaa 100644 --- a/src/test/run-pass/consts/const-enum-byref-self.rs +++ b/src/test/run-pass/consts/const-enum-byref-self.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V, VV(isize) } static C: E = E::V; diff --git a/src/test/run-pass/consts/const-enum-byref.rs b/src/test/run-pass/consts/const-enum-byref.rs index 1e418f66c13..29fe20523f5 100644 --- a/src/test/run-pass/consts/const-enum-byref.rs +++ b/src/test/run-pass/consts/const-enum-byref.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V, VV(isize) } static C: E = E::V; diff --git a/src/test/run-pass/consts/const-enum-cast.rs b/src/test/run-pass/consts/const-enum-cast.rs index 39602153c79..ea28ac36587 100644 --- a/src/test/run-pass/consts/const-enum-cast.rs +++ b/src/test/run-pass/consts/const-enum-cast.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] enum A { A1, A2 } diff --git a/src/test/run-pass/consts/const-enum-ptr.rs b/src/test/run-pass/consts/const-enum-ptr.rs index 78c784e4bb3..bc27bff4b9a 100644 --- a/src/test/run-pass/consts/const-enum-ptr.rs +++ b/src/test/run-pass/consts/const-enum-ptr.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V0, V1(isize) } static C: &'static E = &E::V0; diff --git a/src/test/run-pass/consts/const-enum-struct.rs b/src/test/run-pass/consts/const-enum-struct.rs index 4a4ad9d89e6..01ac27b5113 100644 --- a/src/test/run-pass/consts/const-enum-struct.rs +++ b/src/test/run-pass/consts/const-enum-struct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V16(u16), V32(u32) } struct S { a: E, b: u16, c: u16 } diff --git a/src/test/run-pass/consts/const-enum-struct2.rs b/src/test/run-pass/consts/const-enum-struct2.rs index c37b06f8337..d4923238a78 100644 --- a/src/test/run-pass/consts/const-enum-struct2.rs +++ b/src/test/run-pass/consts/const-enum-struct2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V0, V16(u16) } struct S { a: E, b: u16, c: u16 } diff --git a/src/test/run-pass/consts/const-enum-structlike.rs b/src/test/run-pass/consts/const-enum-structlike.rs index a6bac3c9e7d..17fec939116 100644 --- a/src/test/run-pass/consts/const-enum-structlike.rs +++ b/src/test/run-pass/consts/const-enum-structlike.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { S0 { s: String }, diff --git a/src/test/run-pass/consts/const-enum-tuple.rs b/src/test/run-pass/consts/const-enum-tuple.rs index 2f0dcdaf9b2..a318a16c325 100644 --- a/src/test/run-pass/consts/const-enum-tuple.rs +++ b/src/test/run-pass/consts/const-enum-tuple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V16(u16), V32(u32) } static C: (E, u16, u16) = (E::V16(0xDEAD), 0x600D, 0xBAD); diff --git a/src/test/run-pass/consts/const-enum-tuple2.rs b/src/test/run-pass/consts/const-enum-tuple2.rs index 1db56e0e6f2..916e5c3796b 100644 --- a/src/test/run-pass/consts/const-enum-tuple2.rs +++ b/src/test/run-pass/consts/const-enum-tuple2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V0, V16(u16) } static C: (E, u16, u16) = (E::V0, 0x600D, 0xBAD); diff --git a/src/test/run-pass/consts/const-enum-tuplestruct.rs b/src/test/run-pass/consts/const-enum-tuplestruct.rs index f37ff4d9c99..343c6014080 100644 --- a/src/test/run-pass/consts/const-enum-tuplestruct.rs +++ b/src/test/run-pass/consts/const-enum-tuplestruct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V16(u16), V32(u32) } struct S(E, u16, u16); diff --git a/src/test/run-pass/consts/const-enum-tuplestruct2.rs b/src/test/run-pass/consts/const-enum-tuplestruct2.rs index 5d6a77dddb8..68bfdb56942 100644 --- a/src/test/run-pass/consts/const-enum-tuplestruct2.rs +++ b/src/test/run-pass/consts/const-enum-tuplestruct2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { V0, V16(u16) } struct S(E, u16, u16); diff --git a/src/test/run-pass/consts/const-err.rs b/src/test/run-pass/consts/const-err.rs index 2074ee3e908..c23440f991a 100644 --- a/src/test/run-pass/consts/const-err.rs +++ b/src/test/run-pass/consts/const-err.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // check for const_err regressions #![deny(const_err)] diff --git a/src/test/run-pass/consts/const-fields-and-indexing.rs b/src/test/run-pass/consts/const-fields-and-indexing.rs index c0ba4404f00..639f1393114 100644 --- a/src/test/run-pass/consts/const-fields-and-indexing.rs +++ b/src/test/run-pass/consts/const-fields-and-indexing.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] const x : [isize; 4] = [1,2,3,4]; diff --git a/src/test/run-pass/consts/const-fn-const-eval.rs b/src/test/run-pass/consts/const-fn-const-eval.rs index 897073cd623..78276f17e57 100644 --- a/src/test/run-pass/consts/const-fn-const-eval.rs +++ b/src/test/run-pass/consts/const-fn-const-eval.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(min_const_fn)] const fn add(x: usize, y: usize) -> usize { diff --git a/src/test/run-pass/consts/const-fn-stability-calls.rs b/src/test/run-pass/consts/const-fn-stability-calls.rs index b520ebab17c..7c6b2df0cde 100644 --- a/src/test/run-pass/consts/const-fn-stability-calls.rs +++ b/src/test/run-pass/consts/const-fn-stability-calls.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test use of const fn from another crate without a feature gate. // aux-build:const_fn_lib.rs diff --git a/src/test/run-pass/consts/const-index-feature-gate.rs b/src/test/run-pass/consts/const-index-feature-gate.rs index 3e26ea9dcae..83ebaff3249 100644 --- a/src/test/run-pass/consts/const-index-feature-gate.rs +++ b/src/test/run-pass/consts/const-index-feature-gate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] const ARR: [usize; 1] = [2]; const ARR2: [i32; ARR[0]] = [5, 6]; diff --git a/src/test/run-pass/consts/const-nullary-enum.rs b/src/test/run-pass/consts/const-nullary-enum.rs index d1e359eab4e..289717724c9 100644 --- a/src/test/run-pass/consts/const-nullary-enum.rs +++ b/src/test/run-pass/consts/const-nullary-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum Foo { Bar, diff --git a/src/test/run-pass/consts/const-pattern-variant.rs b/src/test/run-pass/consts/const-pattern-variant.rs index 95e0a5a62e3..b0e91e616a0 100644 --- a/src/test/run-pass/consts/const-pattern-variant.rs +++ b/src/test/run-pass/consts/const-pattern-variant.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_patterns)] #![feature(min_const_fn)] #[derive(PartialEq, Eq)] diff --git a/src/test/run-pass/consts/const-rec-and-tup.rs b/src/test/run-pass/consts/const-rec-and-tup.rs index 15f74d23b6d..768aab29c1f 100644 --- a/src/test/run-pass/consts/const-rec-and-tup.rs +++ b/src/test/run-pass/consts/const-rec-and-tup.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] #![allow(overflowing_literals)] diff --git a/src/test/run-pass/consts/const-region-ptrs-noncopy.rs b/src/test/run-pass/consts/const-region-ptrs-noncopy.rs index fdbebc47990..96db2c88431 100644 --- a/src/test/run-pass/consts/const-region-ptrs-noncopy.rs +++ b/src/test/run-pass/consts/const-region-ptrs-noncopy.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] type Big = [u64; 8]; diff --git a/src/test/run-pass/consts/const-size_of-align_of.rs b/src/test/run-pass/consts/const-size_of-align_of.rs index 289c61ea9fa..6732e4f14c8 100644 --- a/src/test/run-pass/consts/const-size_of-align_of.rs +++ b/src/test/run-pass/consts/const-size_of-align_of.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(min_const_fn)] use std::mem; diff --git a/src/test/run-pass/consts/const-str-ptr.rs b/src/test/run-pass/consts/const-str-ptr.rs index 59482811829..91ff3daa94f 100644 --- a/src/test/run-pass/consts/const-str-ptr.rs +++ b/src/test/run-pass/consts/const-str-ptr.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] use std::{str, string}; const A: [u8; 2] = ['h' as u8, 'i' as u8]; diff --git a/src/test/run-pass/consts/const-struct-offsets.rs b/src/test/run-pass/consts/const-struct-offsets.rs index ec77b59e09d..a968e8aa397 100644 --- a/src/test/run-pass/consts/const-struct-offsets.rs +++ b/src/test/run-pass/consts/const-struct-offsets.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/consts/const-trait-to-trait.rs b/src/test/run-pass/consts/const-trait-to-trait.rs index 6b7e4972536..fddfedec393 100644 --- a/src/test/run-pass/consts/const-trait-to-trait.rs +++ b/src/test/run-pass/consts/const-trait-to-trait.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Issue #24644 - block causes a &Trait -> &Trait coercion: trait Trait {} diff --git a/src/test/run-pass/consts/const-unsafe-fn.rs b/src/test/run-pass/consts/const-unsafe-fn.rs index 6e05b0ac4d8..cb60b2fdf07 100644 --- a/src/test/run-pass/consts/const-unsafe-fn.rs +++ b/src/test/run-pass/consts/const-unsafe-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // A quick test of 'unsafe const fn' functionality #![feature(min_const_fn)] diff --git a/src/test/run-pass/cross-crate/static-array-across-crate.rs b/src/test/run-pass/cross-crate/static-array-across-crate.rs index c21be4ce47c..b921ce01cfd 100644 --- a/src/test/run-pass/cross-crate/static-array-across-crate.rs +++ b/src/test/run-pass/cross-crate/static-array-across-crate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:pub_static_array.rs extern crate pub_static_array as array; diff --git a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs index 467ee2cedb9..70a6a052af9 100644 --- a/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs +++ b/src/test/run-pass/cross-crate/xcrate-trait-lifetime-param.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:xcrate-trait-lifetime-param.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/ctfe/assoc-const.rs b/src/test/run-pass/ctfe/assoc-const.rs index cead1743926..835365820d7 100644 --- a/src/test/run-pass/ctfe/assoc-const.rs +++ b/src/test/run-pass/ctfe/assoc-const.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] trait Nat { const VALUE: usize; diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs index 09590d5f197..0fcf9a5acbd 100644 --- a/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs +++ b/src/test/run-pass/ctfe/const-block-non-item-statement-3.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(const_let)] diff --git a/src/test/run-pass/ctfe/const-block-non-item-statement.rs b/src/test/run-pass/ctfe/const-block-non-item-statement.rs index 5490bd4d3ad..b7ed8af35d4 100644 --- a/src/test/run-pass/ctfe/const-block-non-item-statement.rs +++ b/src/test/run-pass/ctfe/const-block-non-item-statement.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(const_let)] diff --git a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs b/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs index 323232acc67..88f0d0714f9 100644 --- a/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs +++ b/src/test/run-pass/ctfe/const-fn-destructuring-arg.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // test that certain things are disallowed in constant functions diff --git a/src/test/run-pass/ctfe/ice-48279.rs b/src/test/run-pass/ctfe/ice-48279.rs index 34b7b56f274..40fdcda355f 100644 --- a/src/test/run-pass/ctfe/ice-48279.rs +++ b/src/test/run-pass/ctfe/ice-48279.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_unsafe)] // https://github.com/rust-lang/rust/issues/48279 diff --git a/src/test/run-pass/ctfe/issue-37550.rs b/src/test/run-pass/ctfe/issue-37550.rs index 21c4ec2c09e..54e0e83efed 100644 --- a/src/test/run-pass/ctfe/issue-37550.rs +++ b/src/test/run-pass/ctfe/issue-37550.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![feature(const_fn, const_let)] diff --git a/src/test/run-pass/ctfe/match-const-fn-structs.rs b/src/test/run-pass/ctfe/match-const-fn-structs.rs index 6c829f142dd..1c6d72d530f 100644 --- a/src/test/run-pass/ctfe/match-const-fn-structs.rs +++ b/src/test/run-pass/ctfe/match-const-fn-structs.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // https://github.com/rust-lang/rust/issues/46114 diff --git a/src/test/run-pass/ctfe/mozjs-error.rs b/src/test/run-pass/ctfe/mozjs-error.rs index ea200ba738f..f79fbe72bdf 100644 --- a/src/test/run-pass/ctfe/mozjs-error.rs +++ b/src/test/run-pass/ctfe/mozjs-error.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] struct CustomAutoRooterVFTable { diff --git a/src/test/run-pass/deriving/deriving-clone-array.rs b/src/test/run-pass/deriving/deriving-clone-array.rs index 2d3be810def..916488fcbe9 100644 --- a/src/test/run-pass/deriving/deriving-clone-array.rs +++ b/src/test/run-pass/deriving/deriving-clone-array.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // test for issue #30244 #[derive(Copy, Clone)] diff --git a/src/test/run-pass/deriving/deriving-clone-enum.rs b/src/test/run-pass/deriving/deriving-clone-enum.rs index cf924e0ff5e..09a0a6fdeae 100644 --- a/src/test/run-pass/deriving/deriving-clone-enum.rs +++ b/src/test/run-pass/deriving/deriving-clone-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #[derive(Clone)] diff --git a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs index 2b1ace396a7..74258411d7f 100644 --- a/src/test/run-pass/deriving/deriving-clone-generic-enum.rs +++ b/src/test/run-pass/deriving/deriving-clone-generic-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #[derive(Clone)] diff --git a/src/test/run-pass/deriving/deriving-hash.rs b/src/test/run-pass/deriving/deriving-hash.rs index aec8a7075a5..e149e0e1e0e 100644 --- a/src/test/run-pass/deriving/deriving-hash.rs +++ b/src/test/run-pass/deriving/deriving-hash.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] #![allow(deprecated)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/deriving/deriving-meta-multiple.rs b/src/test/run-pass/deriving/deriving-meta-multiple.rs index 33f98a74b14..326a95bdf02 100644 --- a/src/test/run-pass/deriving/deriving-meta-multiple.rs +++ b/src/test/run-pass/deriving/deriving-meta-multiple.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(unused_imports)] // pretty-expanded FIXME #23616 #![allow(deprecated)] diff --git a/src/test/run-pass/deriving/deriving-meta.rs b/src/test/run-pass/deriving/deriving-meta.rs index 309cd5aed1d..cf016f3e0c6 100644 --- a/src/test/run-pass/deriving/deriving-meta.rs +++ b/src/test/run-pass/deriving/deriving-meta.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(unused_imports)] // pretty-expanded FIXME #23616 #![allow(deprecated)] diff --git a/src/test/run-pass/deriving/deriving-show-2.rs b/src/test/run-pass/deriving/deriving-show-2.rs index 3a1f40239c8..d5f2535cb70 100644 --- a/src/test/run-pass/deriving/deriving-show-2.rs +++ b/src/test/run-pass/deriving/deriving-show-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::fmt; #[derive(Debug)] diff --git a/src/test/run-pass/deriving/deriving-show.rs b/src/test/run-pass/deriving/deriving-show.rs index f19b014067d..000cbe9fa09 100644 --- a/src/test/run-pass/deriving/deriving-show.rs +++ b/src/test/run-pass/deriving/deriving-show.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Debug)] struct Unit; diff --git a/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs index 445545aaa0f..a3d4e179731 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-c-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] enum Foo { Bar, diff --git a/src/test/run-pass/deriving/deriving-via-extension-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-enum.rs index 5b00f11a901..8afce9a9e47 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-enum.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] enum Foo { Bar(isize, isize), diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs index fe2716396d8..be44fc4d057 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Hash)] enum Foo { Bar(isize, char), diff --git a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs index 2178673cac8..17133f69675 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-hash-struct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #[derive(Hash)] diff --git a/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs b/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs index 67a1472e883..babe99b3c56 100644 --- a/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs +++ b/src/test/run-pass/deriving/deriving-via-extension-struct-like-enum-variant.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(PartialEq, Debug)] enum S { X { x: isize, y: isize }, diff --git a/src/test/run-pass/drop/drop-struct-as-object.rs b/src/test/run-pass/drop/drop-struct-as-object.rs index 97ec423643c..b171c1c3a06 100644 --- a/src/test/run-pass/drop/drop-struct-as-object.rs +++ b/src/test/run-pass/drop/drop-struct-as-object.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(non_upper_case_globals)] // Test that destructor on a struct runs successfully after the struct diff --git a/src/test/run-pass/drop/drop-trait-enum.rs b/src/test/run-pass/drop/drop-trait-enum.rs index 4d3cf2bd053..a34e922a606 100644 --- a/src/test/run-pass/drop/drop-trait-enum.rs +++ b/src/test/run-pass/drop/drop-trait-enum.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] +#![allow(unused_variables)] // ignore-emscripten no threads support #![feature(box_syntax)] diff --git a/src/test/run-pass/drop/drop-trait-generic.rs b/src/test/run-pass/drop/drop-trait-generic.rs index c09482a4540..fc1c0baf4b4 100644 --- a/src/test/run-pass/drop/drop-trait-generic.rs +++ b/src/test/run-pass/drop/drop-trait-generic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct S { x: T } diff --git a/src/test/run-pass/drop/drop-trait.rs b/src/test/run-pass/drop/drop-trait.rs index 2e867ac0fc0..61ce68037ce 100644 --- a/src/test/run-pass/drop/drop-trait.rs +++ b/src/test/run-pass/drop/drop-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Foo { x: isize } diff --git a/src/test/run-pass/drop/drop-uninhabited-enum.rs b/src/test/run-pass/drop/drop-uninhabited-enum.rs index 6fb0abd9643..6ff17a33d4a 100644 --- a/src/test/run-pass/drop/drop-uninhabited-enum.rs +++ b/src/test/run-pass/drop/drop-uninhabited-enum.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 enum Foo { } diff --git a/src/test/run-pass/drop/dynamic-drop.rs b/src/test/run-pass/drop/dynamic-drop.rs index de10c9f2403..8fecaa2a109 100644 --- a/src/test/run-pass/drop/dynamic-drop.rs +++ b/src/test/run-pass/drop/dynamic-drop.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] // revisions:lexical nll #![cfg_attr(nll, feature(nll))] diff --git a/src/test/run-pass/drop/no-drop-flag-size.rs b/src/test/run-pass/drop/no-drop-flag-size.rs index abaaf7d701e..a8fa202e3b5 100644 --- a/src/test/run-pass/drop/no-drop-flag-size.rs +++ b/src/test/run-pass/drop/no-drop-flag-size.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::mem::size_of; struct Test { diff --git a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs index fb7b2bc8bf7..64ec3143356 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coerce-rc.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(stable_features)] // Test a very simple custom DST coercion. diff --git a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs index 21170403d43..10a59599b40 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-coercions.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-coercions.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test coercions involving DST and/or raw pointers // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs index 1537050593c..84f02337110 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-field-align.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-field-align.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Foo { a: u16, b: T diff --git a/src/test/run-pass/dynamically-sized-types/dst-index.rs b/src/test/run-pass/dynamically-sized-types/dst-index.rs index 56323816b4c..7dd5c193795 100644 --- a/src/test/run-pass/dynamically-sized-types/dst-index.rs +++ b/src/test/run-pass/dynamically-sized-types/dst-index.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that overloaded index expressions with DST result types // work and don't ICE. diff --git a/src/test/run-pass/extern/extern-1.rs b/src/test/run-pass/extern/extern-1.rs index c3168aaf869..f468da4a449 100644 --- a/src/test/run-pass/extern/extern-1.rs +++ b/src/test/run-pass/extern/extern-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 extern fn f() { diff --git a/src/test/run-pass/extern/extern-call-deep2.rs b/src/test/run-pass/extern/extern-call-deep2.rs index e11e73a2b0f..28157c5a8d5 100644 --- a/src/test/run-pass/extern/extern-call-deep2.rs +++ b/src/test/run-pass/extern/extern-call-deep2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support #![feature(libc)] diff --git a/src/test/run-pass/extern/extern-call-scrub.rs b/src/test/run-pass/extern/extern-call-scrub.rs index 1e564e66871..ea18069fa32 100644 --- a/src/test/run-pass/extern/extern-call-scrub.rs +++ b/src/test/run-pass/extern/extern-call-scrub.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // This time we're testing repeatedly going up and down both stacks to // make sure the stack pointers are maintained properly in both // directions diff --git a/src/test/run-pass/extern/extern-mod-abi.rs b/src/test/run-pass/extern/extern-mod-abi.rs index fcff3ed251e..51b2498b6c7 100644 --- a/src/test/run-pass/extern/extern-mod-abi.rs +++ b/src/test/run-pass/extern/extern-mod-abi.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 extern "C" { diff --git a/src/test/run-pass/extern/extern-prelude-no-speculative.rs b/src/test/run-pass/extern/extern-prelude-no-speculative.rs index 8d4219ccf44..6ca1815a191 100644 --- a/src/test/run-pass/extern/extern-prelude-no-speculative.rs +++ b/src/test/run-pass/extern/extern-prelude-no-speculative.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // compile-flags: --extern LooksLikeExternCrate=/path/to/nowhere mod m { diff --git a/src/test/run-pass/extern/extern-types-inherent-impl.rs b/src/test/run-pass/extern/extern-types-inherent-impl.rs index efe55442e0b..955a756ebdc 100644 --- a/src/test/run-pass/extern/extern-types-inherent-impl.rs +++ b/src/test/run-pass/extern/extern-types-inherent-impl.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that inherent impls can be defined for extern types. #![feature(extern_types)] diff --git a/src/test/run-pass/extern/extern-types-pointer-cast.rs b/src/test/run-pass/extern/extern-types-pointer-cast.rs index 7905c7ba002..5110bd42690 100644 --- a/src/test/run-pass/extern/extern-types-pointer-cast.rs +++ b/src/test/run-pass/extern/extern-types-pointer-cast.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that pointers to extern types can be cast from/to usize, // despite being !Sized. diff --git a/src/test/run-pass/extern/extern-types-thin-pointer.rs b/src/test/run-pass/extern/extern-types-thin-pointer.rs index 08fbadf3d2b..9a535fd1931 100644 --- a/src/test/run-pass/extern/extern-types-thin-pointer.rs +++ b/src/test/run-pass/extern/extern-types-thin-pointer.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that pointers and references to extern types are thin, ie they have the same size and // alignment as a pointer to (). diff --git a/src/test/run-pass/extern/extern-types-trait-impl.rs b/src/test/run-pass/extern/extern-types-trait-impl.rs index b8eb4b6a98b..d427e667573 100644 --- a/src/test/run-pass/extern/extern-types-trait-impl.rs +++ b/src/test/run-pass/extern/extern-types-trait-impl.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that traits can be implemented for extern types. #![feature(extern_types)] diff --git a/src/test/run-pass/for-loop-while/break-value.rs b/src/test/run-pass/for-loop-while/break-value.rs index c77e9a209dd..8811d313994 100644 --- a/src/test/run-pass/for-loop-while/break-value.rs +++ b/src/test/run-pass/for-loop-while/break-value.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // pretty-expanded FIXME #23616 fn int_id(x: isize) -> isize { return x; } diff --git a/src/test/run-pass/for-loop-while/for-loop-goofiness.rs b/src/test/run-pass/for-loop-while/for-loop-goofiness.rs index ade51c4abbc..bcc5ad7b7ad 100644 --- a/src/test/run-pass/for-loop-while/for-loop-goofiness.rs +++ b/src/test/run-pass/for-loop-while/for-loop-goofiness.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum BogusOption { None, diff --git a/src/test/run-pass/for-loop-while/for-loop-no-std.rs b/src/test/run-pass/for-loop-while/for-loop-no-std.rs index dc03a500f8c..c91cd115dfb 100644 --- a/src/test/run-pass/for-loop-while/for-loop-no-std.rs +++ b/src/test/run-pass/for-loop-while/for-loop-no-std.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![feature(lang_items, start, alloc)] #![no_std] diff --git a/src/test/run-pass/for-loop-while/label_break_value.rs b/src/test/run-pass/for-loop-while/label_break_value.rs index 831b23b03c3..687253baa65 100644 --- a/src/test/run-pass/for-loop-while/label_break_value.rs +++ b/src/test/run-pass/for-loop-while/label_break_value.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] #![feature(label_break_value)] // Test control flow to follow label_break_value semantics diff --git a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs index fd0b234c7b3..57d846d6557 100644 --- a/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs +++ b/src/test/run-pass/for-loop-while/liveness-assign-imm-local-after-loop.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] // pretty-expanded FIXME #23616 #![allow(unreachable_code)] diff --git a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs index b5da1c1e221..4b148eba9d9 100644 --- a/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs +++ b/src/test/run-pass/for-loop-while/liveness-move-in-loop.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/for-loop-while/loop-break-value.rs b/src/test/run-pass/for-loop-while/loop-break-value.rs index 9f23b4e93e6..2038df4e2a4 100644 --- a/src/test/run-pass/for-loop-while/loop-break-value.rs +++ b/src/test/run-pass/for-loop-while/loop-break-value.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] #![feature(never_type)] #[allow(unused)] diff --git a/src/test/run-pass/for-loop-while/loop-diverges.rs b/src/test/run-pass/for-loop-while/loop-diverges.rs index 86ff4c05438..47e5e71c623 100644 --- a/src/test/run-pass/for-loop-while/loop-diverges.rs +++ b/src/test/run-pass/for-loop-while/loop-diverges.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_parens)] // pretty-expanded FIXME #23616 /* Make sure a loop{} can be the tailexpr in the body diff --git a/src/test/run-pass/for-loop-while/while-label.rs b/src/test/run-pass/for-loop-while/while-label.rs index da0cf295ba0..218aea5ee1d 100644 --- a/src/test/run-pass/for-loop-while/while-label.rs +++ b/src/test/run-pass/for-loop-while/while-label.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] pub fn main() { diff --git a/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs b/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs index 802f7be543a..2cdf273f3e3 100644 --- a/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs +++ b/src/test/run-pass/for-loop-while/while-loop-constraints-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] #![allow(unused_variables)] pub fn main() { diff --git a/src/test/run-pass/foreign/foreign-mod-unused-const.rs b/src/test/run-pass/foreign/foreign-mod-unused-const.rs index 61d537c692c..6b7b6d619de 100644 --- a/src/test/run-pass/foreign/foreign-mod-unused-const.rs +++ b/src/test/run-pass/foreign/foreign-mod-unused-const.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 mod foo { diff --git a/src/test/run-pass/foreign/foreign2.rs b/src/test/run-pass/foreign/foreign2.rs index 307e6b182e7..bd6c8e6b53d 100644 --- a/src/test/run-pass/foreign/foreign2.rs +++ b/src/test/run-pass/foreign/foreign2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-wasm32-bare no libc to test ffi with // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs b/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs index a58b9ba567b..af71c95dc67 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/expect-infer-supply-two-infers.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] fn with_closure(_: F) where F: FnOnce(Vec, A) { diff --git a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs index 3304b2e2600..2ed3663bb57 100644 --- a/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs +++ b/src/test/run-pass/functions-closures/closure-expected-type/issue-38714.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] struct UsizeRef<'a> { a: &'a usize } diff --git a/src/test/run-pass/functions-closures/closure-reform.rs b/src/test/run-pass/functions-closures/closure-reform.rs index 52e0e56026b..95a9438300d 100644 --- a/src/test/run-pass/functions-closures/closure-reform.rs +++ b/src/test/run-pass/functions-closures/closure-reform.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] /* Any copyright is dedicated to the Public Domain. * http://creativecommons.org/publicdomain/zero/1.0/ */ diff --git a/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs b/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs index e2e2b325177..747afc13301 100644 --- a/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs +++ b/src/test/run-pass/functions-closures/closure_to_fn_coercion-expected-types.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Ensure that we deduce expected argument types when a `fn()` type is expected (#41755) fn foo(f: fn(Vec) -> usize) { } diff --git a/src/test/run-pass/functions-closures/fn-coerce-field.rs b/src/test/run-pass/functions-closures/fn-coerce-field.rs index 5845af6b60d..166f05368be 100644 --- a/src/test/run-pass/functions-closures/fn-coerce-field.rs +++ b/src/test/run-pass/functions-closures/fn-coerce-field.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/functions-closures/fn-item-type-cast.rs b/src/test/run-pass/functions-closures/fn-item-type-cast.rs index 0c032bd79fd..02b05513ad7 100644 --- a/src/test/run-pass/functions-closures/fn-item-type-cast.rs +++ b/src/test/run-pass/functions-closures/fn-item-type-cast.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test explicit coercions from a fn item type to a fn pointer type. diff --git a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs index 3b0cd1ec1e5..ad931a836b8 100644 --- a/src/test/run-pass/functions-closures/fn-item-type-coerce.rs +++ b/src/test/run-pass/functions-closures/fn-item-type-coerce.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test implicit coercions from a fn item type to a fn pointer type. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/functions-closures/parallel-codegen-closures.rs b/src/test/run-pass/functions-closures/parallel-codegen-closures.rs index 0b8604f66f9..95592993cb6 100644 --- a/src/test/run-pass/functions-closures/parallel-codegen-closures.rs +++ b/src/test/run-pass/functions-closures/parallel-codegen-closures.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(stable_features)] // Tests parallel codegen - this can fail if the symbol for the anonymous diff --git a/src/test/run-pass/generator/issue-52398.rs b/src/test/run-pass/generator/issue-52398.rs index 9ed65a0eee0..ff4d3e881f0 100644 --- a/src/test/run-pass/generator/issue-52398.rs +++ b/src/test/run-pass/generator/issue-52398.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![feature(generators)] diff --git a/src/test/run-pass/generator/match-bindings.rs b/src/test/run-pass/generator/match-bindings.rs index 10d8bb8c9a7..25230df1749 100644 --- a/src/test/run-pass/generator/match-bindings.rs +++ b/src/test/run-pass/generator/match-bindings.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(generators)] diff --git a/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs b/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs index 81a5f571202..655ed20ac1f 100644 --- a/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs +++ b/src/test/run-pass/generator/too-live-local-in-immovable-gen.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_unsafe)] #![feature(generators)] diff --git a/src/test/run-pass/generator/yield-in-args-rev.rs b/src/test/run-pass/generator/yield-in-args-rev.rs index 3048b1225d3..d74885495ab 100644 --- a/src/test/run-pass/generator/yield-in-args-rev.rs +++ b/src/test/run-pass/generator/yield-in-args-rev.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that a borrow that occurs after a yield in the same // argument list is not treated as live across the yield by diff --git a/src/test/run-pass/generator/yield-subtype.rs b/src/test/run-pass/generator/yield-subtype.rs index 62d3a59ab78..82804b253a7 100644 --- a/src/test/run-pass/generator/yield-subtype.rs +++ b/src/test/run-pass/generator/yield-subtype.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(dead_code)] // revisions:lexical nll //[nll]compile-flags: -Z disable-nll-user-type-assert diff --git a/src/test/run-pass/generics/generic-fn.rs b/src/test/run-pass/generics/generic-fn.rs index ae26ea1b155..4cb663bc9ee 100644 --- a/src/test/run-pass/generics/generic-fn.rs +++ b/src/test/run-pass/generics/generic-fn.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] fn id(x: T) -> T { return x; } diff --git a/src/test/run-pass/generics/generic-tag-match.rs b/src/test/run-pass/generics/generic-tag-match.rs index 7f0bfe8ba31..798d5dcee2e 100644 --- a/src/test/run-pass/generics/generic-tag-match.rs +++ b/src/test/run-pass/generics/generic-tag-match.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] #![allow(non_camel_case_types)] enum foo { arm(T), } diff --git a/src/test/run-pass/generics/generic-tag.rs b/src/test/run-pass/generics/generic-tag.rs index 54a006a163e..bc7af903b32 100644 --- a/src/test/run-pass/generics/generic-tag.rs +++ b/src/test/run-pass/generics/generic-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/generics/generic-type-synonym.rs b/src/test/run-pass/generics/generic-type-synonym.rs index 518480301b9..ccea523c69c 100644 --- a/src/test/run-pass/generics/generic-type-synonym.rs +++ b/src/test/run-pass/generics/generic-type-synonym.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/generics/generic-unique.rs b/src/test/run-pass/generics/generic-unique.rs index c21a0be3d39..182f516a3c8 100644 --- a/src/test/run-pass/generics/generic-unique.rs +++ b/src/test/run-pass/generics/generic-unique.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct Triple { x: T, y: T, z: T } diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs index 641912269a1..7d13e64de2f 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-binder-levels-in-object-types.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that we handle binder levels in object types correctly. // Initially, the reference to `'tcx` in the object type // `&Typer<'tcx>` was getting an incorrect binder level, yielding diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs index 19c7c8c489a..8856c08bee7 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-debruijn-object-types-in-closures.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait Typer<'tcx> { diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs index 32abdde39ab..337935ad7f0 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus-where-clause.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 // Test that `F : Fn(isize) -> isize + Send` is interpreted as two diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs index 5d29115d35e..4b85b2b4077 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-precedence-of-plus.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 // Test that `Fn(isize) -> isize + 'static` parses as `(Fn(isize) -> isize) + diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs index 3f940cd4cd7..cbdead794a9 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-resolve-lifetime.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // A basic test of using a higher-ranked trait bound. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs index 2274fdc5684..c9c3dd33136 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-trait-object-passed-to-closure.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that `&PrinterSupport`, which is really short for `&'a // PrinterSupport<'b>`, gets properly expanded when it appears in a // closure type. This used to result in messed up De Bruijn indices. diff --git a/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs b/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs index f36533629cd..1d54594964c 100644 --- a/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs +++ b/src/test/run-pass/higher-rank-trait-bounds/hrtb-type-outlives.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test what happens when a HR obligation is applied to an impl with // "outlives" bounds. Currently we're pretty conservative here; this // will probably improve in time. diff --git a/src/test/run-pass/hygiene/hygiene-dodging-1.rs b/src/test/run-pass/hygiene/hygiene-dodging-1.rs index bbb46d85d18..8c3e8d221f3 100644 --- a/src/test/run-pass/hygiene/hygiene-dodging-1.rs +++ b/src/test/run-pass/hygiene/hygiene-dodging-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] mod x { pub fn g() -> usize {14} diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs index d68809a1c6e..892be9695cc 100644 --- a/src/test/run-pass/hygiene/hygienic-labels-in-let.rs +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] + // Test that labels injected by macros do not break hygiene. This // checks cases where the macros invocations are under the rhs of a // let statement. diff --git a/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr b/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr index d96b99746a7..e31c1484399 100644 --- a/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr +++ b/src/test/run-pass/hygiene/hygienic-labels-in-let.stderr @@ -1,5 +1,5 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 + --> $DIR/hygienic-labels-in-let.rs:25:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:55:9 + --> $DIR/hygienic-labels-in-let.rs:57:9 | LL | 'x: loop { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:55:9 + --> $DIR/hygienic-labels-in-let.rs:57:9 | LL | 'x: loop { $e } | -- first declared here @@ -29,7 +29,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 + --> $DIR/hygienic-labels-in-let.rs:25:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -41,7 +41,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 + --> $DIR/hygienic-labels-in-let.rs:25:9 | LL | 'x: loop { $e } | ^^ @@ -53,7 +53,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:23:9 + --> $DIR/hygienic-labels-in-let.rs:25:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -65,7 +65,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: loop { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:65:9 + --> $DIR/hygienic-labels-in-let.rs:67:9 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 + --> $DIR/hygienic-labels-in-let.rs:32:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 + --> $DIR/hygienic-labels-in-let.rs:32:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 + --> $DIR/hygienic-labels-in-let.rs:32:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 + --> $DIR/hygienic-labels-in-let.rs:32:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,7 +149,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:30:9 + --> $DIR/hygienic-labels-in-let.rs:32:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -161,7 +161,7 @@ LL | while_true!(break 'x); | ---------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:77:9 | LL | 'x: loop { | -- first declared here @@ -170,7 +170,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:77:9 | LL | 'x: loop { $e } | -- first declared here @@ -179,7 +179,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:77:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -188,7 +188,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:77:9 | LL | 'x: loop { $e } | -- first declared here @@ -197,7 +197,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:77:9 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -206,7 +206,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:75:9 + --> $DIR/hygienic-labels-in-let.rs:77:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -215,7 +215,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -227,7 +227,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: loop { $e } | -- first declared here @@ -239,7 +239,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -251,7 +251,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: loop { $e } | -- first declared here @@ -263,7 +263,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -275,7 +275,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -287,7 +287,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels-in-let.rs:37:9 + --> $DIR/hygienic-labels-in-let.rs:39:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope diff --git a/src/test/run-pass/hygiene/hygienic-labels.rs b/src/test/run-pass/hygiene/hygienic-labels.rs index 723ffb30b7f..e69f9cd1a86 100644 --- a/src/test/run-pass/hygiene/hygienic-labels.rs +++ b/src/test/run-pass/hygiene/hygienic-labels.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // Test that labels injected by macros do not break hygiene. // Issue #24278: The label/lifetime shadowing checker from #24162 diff --git a/src/test/run-pass/hygiene/hygienic-labels.stderr b/src/test/run-pass/hygiene/hygienic-labels.stderr index 45c0cacde9a..7bd2886159e 100644 --- a/src/test/run-pass/hygiene/hygienic-labels.stderr +++ b/src/test/run-pass/hygiene/hygienic-labels.stderr @@ -1,5 +1,5 @@ warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 + --> $DIR/hygienic-labels.rs:22:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -11,7 +11,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:46:5 + --> $DIR/hygienic-labels.rs:47:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -20,7 +20,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:46:5 + --> $DIR/hygienic-labels.rs:47:5 | LL | 'x: loop { $e } | -- first declared here @@ -29,7 +29,7 @@ LL | 'x: loop { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 + --> $DIR/hygienic-labels.rs:22:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -41,7 +41,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 + --> $DIR/hygienic-labels.rs:22:9 | LL | 'x: loop { $e } | ^^ @@ -53,7 +53,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:21:9 + --> $DIR/hygienic-labels.rs:22:9 | LL | 'x: loop { $e } | ^^ lifetime 'x already in scope @@ -65,7 +65,7 @@ LL | loop_x!(break 'x); | ------------------ in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 + --> $DIR/hygienic-labels.rs:53:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -74,7 +74,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 + --> $DIR/hygienic-labels.rs:53:5 | LL | 'x: loop { $e } | -- first declared here @@ -83,7 +83,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 + --> $DIR/hygienic-labels.rs:53:5 | LL | 'x: loop { | -- first declared here @@ -92,7 +92,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:52:5 + --> $DIR/hygienic-labels.rs:53:5 | LL | 'x: loop { $e } | -- first declared here @@ -101,7 +101,7 @@ LL | 'x: while 1 + 1 == 2 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 + --> $DIR/hygienic-labels.rs:36:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -113,7 +113,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 + --> $DIR/hygienic-labels.rs:36:9 | LL | 'x: loop { $e } | -- first declared here @@ -125,7 +125,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 + --> $DIR/hygienic-labels.rs:36:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -137,7 +137,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 + --> $DIR/hygienic-labels.rs:36:9 | LL | 'x: loop { $e } | -- first declared here @@ -149,7 +149,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:35:9 + --> $DIR/hygienic-labels.rs:36:9 | LL | 'x: while 1 + 1 == 2 { $e } | ^^ lifetime 'x already in scope @@ -160,7 +160,7 @@ LL | while_x!(break 'x); | ------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 + --> $DIR/hygienic-labels.rs:58:5 | LL | 'x: for _ in 0..1 { | -- first declared here @@ -169,7 +169,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 + --> $DIR/hygienic-labels.rs:58:5 | LL | 'x: loop { $e } | -- first declared here @@ -178,7 +178,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 + --> $DIR/hygienic-labels.rs:58:5 | LL | 'x: loop { | -- first declared here @@ -187,7 +187,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 + --> $DIR/hygienic-labels.rs:58:5 | LL | 'x: loop { $e } | -- first declared here @@ -196,7 +196,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 + --> $DIR/hygienic-labels.rs:58:5 | LL | 'x: while 1 + 1 == 2 { | -- first declared here @@ -205,7 +205,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:57:5 + --> $DIR/hygienic-labels.rs:58:5 | LL | 'x: while 1 + 1 == 2 { $e } | -- first declared here @@ -214,7 +214,7 @@ LL | 'x: for _ in 0..1 { | ^^ lifetime 'x already in scope warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -226,7 +226,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: loop { $e } | -- first declared here @@ -238,7 +238,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -250,7 +250,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: loop { $e } | -- first declared here @@ -262,7 +262,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -274,7 +274,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope @@ -286,7 +286,7 @@ LL | run_once!(continue 'x); | ----------------------- in this macro invocation warning: label name `'x` shadows a label name that is already in scope - --> $DIR/hygienic-labels.rs:28:9 + --> $DIR/hygienic-labels.rs:29:9 | LL | 'x: for _ in 0..1 { $e } | ^^ lifetime 'x already in scope diff --git a/src/test/run-pass/hygiene/issue-44128.rs b/src/test/run-pass/hygiene/issue-44128.rs index 879cd851434..db9e0de2e9a 100644 --- a/src/test/run-pass/hygiene/issue-44128.rs +++ b/src/test/run-pass/hygiene/issue-44128.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] #![feature(decl_macro)] pub macro create_struct($a:ident) { diff --git a/src/test/run-pass/hygiene/legacy_interaction.rs b/src/test/run-pass/hygiene/legacy_interaction.rs index d0845b5802b..72370396ebb 100644 --- a/src/test/run-pass/hygiene/legacy_interaction.rs +++ b/src/test/run-pass/hygiene/legacy_interaction.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-pretty pretty-printing is unhygienic // aux-build:legacy_interaction.rs diff --git a/src/test/run-pass/impl-trait/nesting.rs b/src/test/run-pass/impl-trait/nesting.rs index f721ace0afe..3bb081181ff 100644 --- a/src/test/run-pass/impl-trait/nesting.rs +++ b/src/test/run-pass/impl-trait/nesting.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] fn foo(t: T) -> impl Into<[T; { const FOO: usize = 1; FOO }]> { [t] diff --git a/src/test/run-pass/imports/import-glob-0.rs b/src/test/run-pass/imports/import-glob-0.rs index f72fb1f0b13..731a716d4a5 100644 --- a/src/test/run-pass/imports/import-glob-0.rs +++ b/src/test/run-pass/imports/import-glob-0.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use module_of_many_things::*; use dug::too::greedily::and::too::deep::*; diff --git a/src/test/run-pass/imports/import-glob-1.rs b/src/test/run-pass/imports/import-glob-1.rs index b1f40d74917..c4e50c17264 100644 --- a/src/test/run-pass/imports/import-glob-1.rs +++ b/src/test/run-pass/imports/import-glob-1.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] // This should resolve fine. Prior to fix, the last import // was being tried too early, and marked as unrsolved before // the glob import had a chance to be resolved. diff --git a/src/test/run-pass/imports/import-prefix-macro.rs b/src/test/run-pass/imports/import-prefix-macro.rs index ceb662c6e3d..5768029ef8c 100644 --- a/src/test/run-pass/imports/import-prefix-macro.rs +++ b/src/test/run-pass/imports/import-prefix-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] mod a { pub mod b { pub mod c { diff --git a/src/test/run-pass/imports/import-rename.rs b/src/test/run-pass/imports/import-rename.rs index 8d4757f0a47..082e8321e18 100644 --- a/src/test/run-pass/imports/import-rename.rs +++ b/src/test/run-pass/imports/import-rename.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use foo::{x, y as fooy}; use Maybe::{Yes as MaybeYes}; diff --git a/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs b/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs index 5b04daeb332..0f8088c8969 100644 --- a/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs +++ b/src/test/run-pass/intrinsics/intrinsic-move-val-cleanups.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_unsafe)] +#![allow(unreachable_code)] // ignore-emscripten no threads support #![allow(stable_features)] diff --git a/src/test/run-pass/issues/issue-10025.rs b/src/test/run-pass/issues/issue-10025.rs index bd286bca938..109663ac8ae 100644 --- a/src/test/run-pass/issues/issue-10025.rs +++ b/src/test/run-pass/issues/issue-10025.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 unsafe extern fn foo() {} diff --git a/src/test/run-pass/issues/issue-10028.rs b/src/test/run-pass/issues/issue-10028.rs index b89ecb0b9df..2f7cbcde803 100644 --- a/src/test/run-pass/issues/issue-10028.rs +++ b/src/test/run-pass/issues/issue-10028.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue-10028.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10228.rs b/src/test/run-pass/issues/issue-10228.rs index 7ed8f5be936..940b478c615 100644 --- a/src/test/run-pass/issues/issue-10228.rs +++ b/src/test/run-pass/issues/issue-10228.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 enum StdioContainer { diff --git a/src/test/run-pass/issues/issue-10392.rs b/src/test/run-pass/issues/issue-10392.rs index 65c88f445c2..8042797f778 100644 --- a/src/test/run-pass/issues/issue-10392.rs +++ b/src/test/run-pass/issues/issue-10392.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] struct A { foo: isize } struct B { a: isize, b: isize, c: isize } diff --git a/src/test/run-pass/issues/issue-10396.rs b/src/test/run-pass/issues/issue-10396.rs index f0b3b276fcf..5b7bfe1a02e 100644 --- a/src/test/run-pass/issues/issue-10396.rs +++ b/src/test/run-pass/issues/issue-10396.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Debug)] enum Foo<'s> { V(&'s str) diff --git a/src/test/run-pass/issues/issue-10763.rs b/src/test/run-pass/issues/issue-10763.rs index 9f03cd34114..705cc3fad13 100644 --- a/src/test/run-pass/issues/issue-10763.rs +++ b/src/test/run-pass/issues/issue-10763.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 extern "Rust" fn foo() {} diff --git a/src/test/run-pass/issues/issue-10802.rs b/src/test/run-pass/issues/issue-10802.rs index 3967ee44583..bd5d7059c21 100644 --- a/src/test/run-pass/issues/issue-10802.rs +++ b/src/test/run-pass/issues/issue-10802.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct DroppableStruct; diff --git a/src/test/run-pass/issues/issue-10806.rs b/src/test/run-pass/issues/issue-10806.rs index 3cfbd703954..6dfa0ecc291 100644 --- a/src/test/run-pass/issues/issue-10806.rs +++ b/src/test/run-pass/issues/issue-10806.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-10902.rs b/src/test/run-pass/issues/issue-10902.rs index f27b4576d03..df9dc0b63d9 100644 --- a/src/test/run-pass/issues/issue-10902.rs +++ b/src/test/run-pass/issues/issue-10902.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub mod two_tuple { diff --git a/src/test/run-pass/issues/issue-11085.rs b/src/test/run-pass/issues/issue-11085.rs index 76a047e2a20..50c87575773 100644 --- a/src/test/run-pass/issues/issue-11085.rs +++ b/src/test/run-pass/issues/issue-11085.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // compile-flags: --cfg foo // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-1112.rs b/src/test/run-pass/issues/issue-1112.rs index ee1711b1333..4283ae0fafb 100644 --- a/src/test/run-pass/issues/issue-1112.rs +++ b/src/test/run-pass/issues/issue-1112.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue #1112 // Alignment of interior pointers to dynamic-size types diff --git a/src/test/run-pass/issues/issue-11612.rs b/src/test/run-pass/issues/issue-11612.rs index 763e538fb8f..ba17a02dd38 100644 --- a/src/test/run-pass/issues/issue-11612.rs +++ b/src/test/run-pass/issues/issue-11612.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // #11612 // We weren't updating the auto adjustments with all the resolved // type information after type check. diff --git a/src/test/run-pass/issues/issue-11677.rs b/src/test/run-pass/issues/issue-11677.rs index a4d4feb4f8a..d9bc76f9b03 100644 --- a/src/test/run-pass/issues/issue-11677.rs +++ b/src/test/run-pass/issues/issue-11677.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-11709.rs b/src/test/run-pass/issues/issue-11709.rs index ffd6f1dfb55..7f1669abe1c 100644 --- a/src/test/run-pass/issues/issue-11709.rs +++ b/src/test/run-pass/issues/issue-11709.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-pretty issue #37199 // Don't panic on blocks without results diff --git a/src/test/run-pass/issues/issue-11869.rs b/src/test/run-pass/issues/issue-11869.rs index be20f7a0fec..b3543f726da 100644 --- a/src/test/run-pass/issues/issue-11869.rs +++ b/src/test/run-pass/issues/issue-11869.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct A { diff --git a/src/test/run-pass/issues/issue-1251.rs b/src/test/run-pass/issues/issue-1251.rs index a7bc8718003..f9d48b8c835 100644 --- a/src/test/run-pass/issues/issue-1251.rs +++ b/src/test/run-pass/issues/issue-1251.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] +#![allow(dead_code)] // pretty-expanded FIXME #23616 // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/issues/issue-12612.rs b/src/test/run-pass/issues/issue-12612.rs index dd9c9abaf65..d9b563be2c0 100644 --- a/src/test/run-pass/issues/issue-12612.rs +++ b/src/test/run-pass/issues/issue-12612.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // aux-build:issue_12612_1.rs // aux-build:issue_12612_2.rs diff --git a/src/test/run-pass/issues/issue-12729.rs b/src/test/run-pass/issues/issue-12729.rs index f75090c4223..efcc05cc196 100644 --- a/src/test/run-pass/issues/issue-12729.rs +++ b/src/test/run-pass/issues/issue-12729.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub struct Foo; diff --git a/src/test/run-pass/issues/issue-12909.rs b/src/test/run-pass/issues/issue-12909.rs index d4db01a5e58..4070464ba3a 100644 --- a/src/test/run-pass/issues/issue-12909.rs +++ b/src/test/run-pass/issues/issue-12909.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 use std::collections::HashMap; diff --git a/src/test/run-pass/issues/issue-13204.rs b/src/test/run-pass/issues/issue-13204.rs index 4aa2c49b428..0d5a7e07138 100644 --- a/src/test/run-pass/issues/issue-13204.rs +++ b/src/test/run-pass/issues/issue-13204.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // Test that when instantiating trait default methods, typeck handles // lifetime parameters defined on the method bound correctly. diff --git a/src/test/run-pass/issues/issue-13214.rs b/src/test/run-pass/issues/issue-13214.rs index 634cbbb0417..1c119bb634d 100644 --- a/src/test/run-pass/issues/issue-13214.rs +++ b/src/test/run-pass/issues/issue-13214.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // defining static with struct that contains enum // with &'static str variant used to cause ICE diff --git a/src/test/run-pass/issues/issue-13304.rs b/src/test/run-pass/issues/issue-13304.rs index 117cb0bbe16..a2a30b26d47 100644 --- a/src/test/run-pass/issues/issue-13304.rs +++ b/src/test/run-pass/issues/issue-13304.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/issues/issue-13405.rs b/src/test/run-pass/issues/issue-13405.rs index 3b9fdf84b5d..a8ca38838d1 100644 --- a/src/test/run-pass/issues/issue-13405.rs +++ b/src/test/run-pass/issues/issue-13405.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 struct Foo<'a> { diff --git a/src/test/run-pass/issues/issue-13494.rs b/src/test/run-pass/issues/issue-13494.rs index 553f3a7fec9..0750a4c8959 100644 --- a/src/test/run-pass/issues/issue-13494.rs +++ b/src/test/run-pass/issues/issue-13494.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support // This test may not always fail, but it can be flaky if the race it used to diff --git a/src/test/run-pass/issues/issue-13507-2.rs b/src/test/run-pass/issues/issue-13507-2.rs index 894cd7ac011..a189b8f1688 100644 --- a/src/test/run-pass/issues/issue-13507-2.rs +++ b/src/test/run-pass/issues/issue-13507-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // aux-build:issue13507.rs extern crate issue13507; diff --git a/src/test/run-pass/issues/issue-13763.rs b/src/test/run-pass/issues/issue-13763.rs index 0b27e2fab31..7b335d31238 100644 --- a/src/test/run-pass/issues/issue-13763.rs +++ b/src/test/run-pass/issues/issue-13763.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 mod u8 { diff --git a/src/test/run-pass/issues/issue-13808.rs b/src/test/run-pass/issues/issue-13808.rs index 2d6b78c6b07..e759ef1c5b4 100644 --- a/src/test/run-pass/issues/issue-13808.rs +++ b/src/test/run-pass/issues/issue-13808.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 struct Foo<'a> { diff --git a/src/test/run-pass/issues/issue-13837.rs b/src/test/run-pass/issues/issue-13837.rs index eaa17499850..98a86748851 100644 --- a/src/test/run-pass/issues/issue-13837.rs +++ b/src/test/run-pass/issues/issue-13837.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct TestStruct { diff --git a/src/test/run-pass/issues/issue-13902.rs b/src/test/run-pass/issues/issue-13902.rs index 87413be05e5..4f0ab3c55f2 100644 --- a/src/test/run-pass/issues/issue-13902.rs +++ b/src/test/run-pass/issues/issue-13902.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] const JSVAL_TAG_CLEAR: u32 = 0xFFFFFF80; diff --git a/src/test/run-pass/issues/issue-14330.rs b/src/test/run-pass/issues/issue-14330.rs index d50dc64f437..fe54c1cf05c 100644 --- a/src/test/run-pass/issues/issue-14330.rs +++ b/src/test/run-pass/issues/issue-14330.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // pretty-expanded FIXME #23616 #[macro_use] extern crate std as std2; diff --git a/src/test/run-pass/issues/issue-14456.rs b/src/test/run-pass/issues/issue-14456.rs index 27eb0ebcbfe..cfd037e31f6 100644 --- a/src/test/run-pass/issues/issue-14456.rs +++ b/src/test/run-pass/issues/issue-14456.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/issues/issue-1451.rs b/src/test/run-pass/issues/issue-1451.rs index fb344c3b4b7..7cdc54fa59f 100644 --- a/src/test/run-pass/issues/issue-1451.rs +++ b/src/test/run-pass/issues/issue-1451.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![allow(non_snake_case)] #![allow(unused_variables)] diff --git a/src/test/run-pass/issues/issue-14821.rs b/src/test/run-pass/issues/issue-14821.rs index c01ffb7d6b1..69291afb92f 100644 --- a/src/test/run-pass/issues/issue-14821.rs +++ b/src/test/run-pass/issues/issue-14821.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] trait SomeTrait {} struct Meow; impl SomeTrait for Meow {} diff --git a/src/test/run-pass/issues/issue-14865.rs b/src/test/run-pass/issues/issue-14865.rs index 4e278c66886..94da75cdc05 100644 --- a/src/test/run-pass/issues/issue-14865.rs +++ b/src/test/run-pass/issues/issue-14865.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum X { Foo(usize), diff --git a/src/test/run-pass/issues/issue-14919.rs b/src/test/run-pass/issues/issue-14919.rs index a9768661256..dd02e513287 100644 --- a/src/test/run-pass/issues/issue-14919.rs +++ b/src/test/run-pass/issues/issue-14919.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait Matcher { diff --git a/src/test/run-pass/issues/issue-15063.rs b/src/test/run-pass/issues/issue-15063.rs index 863dde1fc5e..c8cbc120251 100644 --- a/src/test/run-pass/issues/issue-15063.rs +++ b/src/test/run-pass/issues/issue-15063.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] enum Two { A, B} impl Drop for Two { fn drop(&mut self) { diff --git a/src/test/run-pass/issues/issue-15221.rs b/src/test/run-pass/issues/issue-15221.rs index 25e163e3958..375cb5e14e5 100644 --- a/src/test/run-pass/issues/issue-15221.rs +++ b/src/test/run-pass/issues/issue-15221.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(path_statements)] // pretty-expanded FIXME #23616 macro_rules! inner { diff --git a/src/test/run-pass/issues/issue-15261.rs b/src/test/run-pass/issues/issue-15261.rs index b715a388d10..263f9b0bd4b 100644 --- a/src/test/run-pass/issues/issue-15261.rs +++ b/src/test/run-pass/issues/issue-15261.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-15487.rs b/src/test/run-pass/issues/issue-15487.rs index de4de14ca33..48bcf2183f0 100644 --- a/src/test/run-pass/issues/issue-15487.rs +++ b/src/test/run-pass/issues/issue-15487.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] // ignore-windows // ignore-wasm32-bare no libs to link diff --git a/src/test/run-pass/issues/issue-15689-2.rs b/src/test/run-pass/issues/issue-15689-2.rs index 7b4d1e3e3e2..dedc66336e7 100644 --- a/src/test/run-pass/issues/issue-15689-2.rs +++ b/src/test/run-pass/issues/issue-15689-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #[derive(Clone)] diff --git a/src/test/run-pass/issues/issue-15730.rs b/src/test/run-pass/issues/issue-15730.rs index c2f5f9f2e60..b5a0715bae6 100644 --- a/src/test/run-pass/issues/issue-15730.rs +++ b/src/test/run-pass/issues/issue-15730.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/issues/issue-15735.rs b/src/test/run-pass/issues/issue-15735.rs index 9e95b173e89..5ac47bd68bc 100644 --- a/src/test/run-pass/issues/issue-15735.rs +++ b/src/test/run-pass/issues/issue-15735.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct A<'a> { a: &'a i32, b: &'a i32, diff --git a/src/test/run-pass/issues/issue-15763.rs b/src/test/run-pass/issues/issue-15763.rs index f241efa74d3..a8aba30a37f 100644 --- a/src/test/run-pass/issues/issue-15763.rs +++ b/src/test/run-pass/issues/issue-15763.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] #![feature(box_syntax)] #[derive(PartialEq, Debug)] diff --git a/src/test/run-pass/issues/issue-15793.rs b/src/test/run-pass/issues/issue-15793.rs index 97f4c0095ec..9c5bea1a53e 100644 --- a/src/test/run-pass/issues/issue-15793.rs +++ b/src/test/run-pass/issues/issue-15793.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum NestedEnum { First, diff --git a/src/test/run-pass/issues/issue-16441.rs b/src/test/run-pass/issues/issue-16441.rs index 5a0ea2adc63..cabed87edda 100644 --- a/src/test/run-pass/issues/issue-16441.rs +++ b/src/test/run-pass/issues/issue-16441.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct Empty; diff --git a/src/test/run-pass/issues/issue-16452.rs b/src/test/run-pass/issues/issue-16452.rs index 2b78582b577..10c9f316b89 100644 --- a/src/test/run-pass/issues/issue-16452.rs +++ b/src/test/run-pass/issues/issue-16452.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/issues/issue-16560.rs b/src/test/run-pass/issues/issue-16560.rs index 50009f4f6ea..795b1efeeeb 100644 --- a/src/test/run-pass/issues/issue-16560.rs +++ b/src/test/run-pass/issues/issue-16560.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/issues/issue-16596.rs b/src/test/run-pass/issues/issue-16596.rs index cdbc3daf4ab..d9583809a89 100644 --- a/src/test/run-pass/issues/issue-16596.rs +++ b/src/test/run-pass/issues/issue-16596.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait MatrixRow { fn dummy(&self) { }} diff --git a/src/test/run-pass/issues/issue-16597.rs b/src/test/run-pass/issues/issue-16597.rs index 6b437eb65aa..61b82814210 100644 --- a/src/test/run-pass/issues/issue-16597.rs +++ b/src/test/run-pass/issues/issue-16597.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // compile-flags:--test mod tests { diff --git a/src/test/run-pass/issues/issue-16602-3.rs b/src/test/run-pass/issues/issue-16602-3.rs index 5346851f0f2..bc4cbcbd329 100644 --- a/src/test/run-pass/issues/issue-16602-3.rs +++ b/src/test/run-pass/issues/issue-16602-3.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] +#![allow(unused_assignments)] #[derive(Debug)] enum Foo { Bar(u32, u32), diff --git a/src/test/run-pass/issues/issue-16668.rs b/src/test/run-pass/issues/issue-16668.rs index 08f696cfcf4..fdb49c68984 100644 --- a/src/test/run-pass/issues/issue-16668.rs +++ b/src/test/run-pass/issues/issue-16668.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Parser<'a, I, O> { parse: Box Result + 'a> } diff --git a/src/test/run-pass/issues/issue-16783.rs b/src/test/run-pass/issues/issue-16783.rs index bafeb9716c5..3f1d07b88ec 100644 --- a/src/test/run-pass/issues/issue-16783.rs +++ b/src/test/run-pass/issues/issue-16783.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 pub fn main() { diff --git a/src/test/run-pass/issues/issue-16819.rs b/src/test/run-pass/issues/issue-16819.rs index 498abc1c733..dab126ccc42 100644 --- a/src/test/run-pass/issues/issue-16819.rs +++ b/src/test/run-pass/issues/issue-16819.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // `#[cfg]` on struct field permits empty unusable struct struct S { diff --git a/src/test/run-pass/issues/issue-1701.rs b/src/test/run-pass/issues/issue-1701.rs index 433fd4c1af3..90b71d5dfe2 100644 --- a/src/test/run-pass/issues/issue-1701.rs +++ b/src/test/run-pass/issues/issue-1701.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-17074.rs b/src/test/run-pass/issues/issue-17074.rs index 063cf7b0a03..1f45e01203f 100644 --- a/src/test/run-pass/issues/issue-17074.rs +++ b/src/test/run-pass/issues/issue-17074.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] static X2: u64 = !0 as u16 as u64; static Y2: u64 = !0 as u32 as u64; diff --git a/src/test/run-pass/issues/issue-17121.rs b/src/test/run-pass/issues/issue-17121.rs index 8da01966959..fafcdde2bbe 100644 --- a/src/test/run-pass/issues/issue-17121.rs +++ b/src/test/run-pass/issues/issue-17121.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 // ignore-cloudabi no std::fs diff --git a/src/test/run-pass/issues/issue-17216.rs b/src/test/run-pass/issues/issue-17216.rs index dc2848cc190..c27eb74c90f 100644 --- a/src/test/run-pass/issues/issue-17216.rs +++ b/src/test/run-pass/issues/issue-17216.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] struct Leak<'a> { dropped: &'a mut bool } diff --git a/src/test/run-pass/issues/issue-17336.rs b/src/test/run-pass/issues/issue-17336.rs index aea2b67a92f..b1a77d73aa4 100644 --- a/src/test/run-pass/issues/issue-17336.rs +++ b/src/test/run-pass/issues/issue-17336.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] #[allow(dead_code)] fn check(a: &str) { let x = a as *const str; diff --git a/src/test/run-pass/issues/issue-17718-borrow-interior.rs b/src/test/run-pass/issues/issue-17718-borrow-interior.rs index 505aefdd1c7..51f617340da 100644 --- a/src/test/run-pass/issues/issue-17718-borrow-interior.rs +++ b/src/test/run-pass/issues/issue-17718-borrow-interior.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct S { a: usize } static A: S = S { a: 3 }; diff --git a/src/test/run-pass/issues/issue-17718-const-destructors.rs b/src/test/run-pass/issues/issue-17718-const-destructors.rs index 6f8fbbd9f78..16f9cea82fa 100644 --- a/src/test/run-pass/issues/issue-17718-const-destructors.rs +++ b/src/test/run-pass/issues/issue-17718-const-destructors.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct A; impl Drop for A { fn drop(&mut self) {} diff --git a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs index 2ac6a901358..f6a2f099753 100644 --- a/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs +++ b/src/test/run-pass/issues/issue-17718-static-unsafe-interior.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_imports)] // pretty-expanded FIXME #23616 use std::marker; diff --git a/src/test/run-pass/issues/issue-17718.rs b/src/test/run-pass/issues/issue-17718.rs index c332d0b586d..33e69824dfc 100644 --- a/src/test/run-pass/issues/issue-17718.rs +++ b/src/test/run-pass/issues/issue-17718.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue-17718-aux.rs extern crate issue_17718_aux as other; diff --git a/src/test/run-pass/issues/issue-17732.rs b/src/test/run-pass/issues/issue-17732.rs index e69d8fabe86..c0ab42b4264 100644 --- a/src/test/run-pass/issues/issue-17732.rs +++ b/src/test/run-pass/issues/issue-17732.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait Person { diff --git a/src/test/run-pass/issues/issue-17746.rs b/src/test/run-pass/issues/issue-17746.rs index 7e88068419e..0cdefc290a8 100644 --- a/src/test/run-pass/issues/issue-17746.rs +++ b/src/test/run-pass/issues/issue-17746.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #17746 fn main() {} diff --git a/src/test/run-pass/issues/issue-17756.rs b/src/test/run-pass/issues/issue-17756.rs index 8c3f6b93588..7b8fa866fff 100644 --- a/src/test/run-pass/issues/issue-17756.rs +++ b/src/test/run-pass/issues/issue-17756.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(non_upper_case_globals)] const count : usize = 2 as usize; diff --git a/src/test/run-pass/issues/issue-17771.rs b/src/test/run-pass/issues/issue-17771.rs index ccea8846b08..ed5acf5e1bb 100644 --- a/src/test/run-pass/issues/issue-17771.rs +++ b/src/test/run-pass/issues/issue-17771.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait Aaa { fn dummy(&self) { } } diff --git a/src/test/run-pass/issues/issue-17816.rs b/src/test/run-pass/issues/issue-17816.rs index 0f96035b274..ddeac242f78 100644 --- a/src/test/run-pass/issues/issue-17816.rs +++ b/src/test/run-pass/issues/issue-17816.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use std::marker::PhantomData; fn main() { diff --git a/src/test/run-pass/issues/issue-17904.rs b/src/test/run-pass/issues/issue-17904.rs index 2a86611a196..9b76c9fca2a 100644 --- a/src/test/run-pass/issues/issue-17904.rs +++ b/src/test/run-pass/issues/issue-17904.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that we can parse where clauses on various forms of tuple // structs. diff --git a/src/test/run-pass/issues/issue-18083.rs b/src/test/run-pass/issues/issue-18083.rs index 152cba82222..9118ad28493 100644 --- a/src/test/run-pass/issues/issue-18083.rs +++ b/src/test/run-pass/issues/issue-18083.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] // These crossed imports should resolve fine, and not block on // each other and be reported as unresolved. diff --git a/src/test/run-pass/issues/issue-18110.rs b/src/test/run-pass/issues/issue-18110.rs index d6733050216..6d80e2664dc 100644 --- a/src/test/run-pass/issues/issue-18110.rs +++ b/src/test/run-pass/issues/issue-18110.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/issues/issue-1821.rs b/src/test/run-pass/issues/issue-1821.rs index 27c225a1916..d37b6df6e34 100644 --- a/src/test/run-pass/issues/issue-1821.rs +++ b/src/test/run-pass/issues/issue-1821.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // Issue #1821 - Don't recurse trying to typecheck this diff --git a/src/test/run-pass/issues/issue-18353.rs b/src/test/run-pass/issues/issue-18353.rs index 279ee89a492..a3e7552691b 100644 --- a/src/test/run-pass/issues/issue-18353.rs +++ b/src/test/run-pass/issues/issue-18353.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that wrapping an unsized struct in an enum which gets optimised does // not ICE. diff --git a/src/test/run-pass/issues/issue-18446.rs b/src/test/run-pass/issues/issue-18446.rs index 0758ceb0954..09f3e451ad1 100644 --- a/src/test/run-pass/issues/issue-18446.rs +++ b/src/test/run-pass/issues/issue-18446.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that methods in trait impls should override default methods. trait T { diff --git a/src/test/run-pass/issues/issue-1866.rs b/src/test/run-pass/issues/issue-1866.rs index cf4a0ddea98..f27d8032dd6 100644 --- a/src/test/run-pass/issues/issue-1866.rs +++ b/src/test/run-pass/issues/issue-1866.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-18738.rs b/src/test/run-pass/issues/issue-18738.rs index f586552dcb3..8ed663cbbd6 100644 --- a/src/test/run-pass/issues/issue-18738.rs +++ b/src/test/run-pass/issues/issue-18738.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Eq, PartialEq, PartialOrd, Ord)] enum Test<'a> { Int(&'a isize), diff --git a/src/test/run-pass/issues/issue-18906.rs b/src/test/run-pass/issues/issue-18906.rs index 08a39350c57..4f771752c86 100644 --- a/src/test/run-pass/issues/issue-18906.rs +++ b/src/test/run-pass/issues/issue-18906.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub trait Borrow { diff --git a/src/test/run-pass/issues/issue-18988.rs b/src/test/run-pass/issues/issue-18988.rs index 422a0f7d7d6..691d4117430 100644 --- a/src/test/run-pass/issues/issue-18988.rs +++ b/src/test/run-pass/issues/issue-18988.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub trait Foo : Send { } pub struct MyFoo { diff --git a/src/test/run-pass/issues/issue-19001.rs b/src/test/run-pass/issues/issue-19001.rs index 4407cbf501e..e4460d33b9e 100644 --- a/src/test/run-pass/issues/issue-19001.rs +++ b/src/test/run-pass/issues/issue-19001.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // check that we handle recursive arrays correctly in `type_of` struct Loopy { diff --git a/src/test/run-pass/issues/issue-19037.rs b/src/test/run-pass/issues/issue-19037.rs index eb3c265617b..350c17415da 100644 --- a/src/test/run-pass/issues/issue-19037.rs +++ b/src/test/run-pass/issues/issue-19037.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct Str([u8]); diff --git a/src/test/run-pass/issues/issue-19097.rs b/src/test/run-pass/issues/issue-19097.rs index d3415c34791..1ad7f524be4 100644 --- a/src/test/run-pass/issues/issue-19097.rs +++ b/src/test/run-pass/issues/issue-19097.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // regression test for #19097 struct Foo(T); diff --git a/src/test/run-pass/issues/issue-19102.rs b/src/test/run-pass/issues/issue-19102.rs index eecc9db486e..c26dca255b9 100644 --- a/src/test/run-pass/issues/issue-19102.rs +++ b/src/test/run-pass/issues/issue-19102.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![deny(unused_qualifications)] use self::A::B; diff --git a/src/test/run-pass/issues/issue-19127.rs b/src/test/run-pass/issues/issue-19127.rs index 3290b179864..9826b1b08d2 100644 --- a/src/test/run-pass/issues/issue-19127.rs +++ b/src/test/run-pass/issues/issue-19127.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 fn foo T>(f: F) {} diff --git a/src/test/run-pass/issues/issue-19129-2.rs b/src/test/run-pass/issues/issue-19129-2.rs index 4999ee1287c..8d43ece3680 100644 --- a/src/test/run-pass/issues/issue-19129-2.rs +++ b/src/test/run-pass/issues/issue-19129-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 trait Trait { diff --git a/src/test/run-pass/issues/issue-19340-1.rs b/src/test/run-pass/issues/issue-19340-1.rs index 53531fcad87..62c39d0ff3d 100644 --- a/src/test/run-pass/issues/issue-19340-1.rs +++ b/src/test/run-pass/issues/issue-19340-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // aux-build:issue-19340-1.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-19340-2.rs b/src/test/run-pass/issues/issue-19340-2.rs index a1b68e87626..3f86c7c9180 100644 --- a/src/test/run-pass/issues/issue-19340-2.rs +++ b/src/test/run-pass/issues/issue-19340-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 enum Homura { diff --git a/src/test/run-pass/issues/issue-19404.rs b/src/test/run-pass/issues/issue-19404.rs index 3a5ce65aef8..3f8aad4e0b1 100644 --- a/src/test/run-pass/issues/issue-19404.rs +++ b/src/test/run-pass/issues/issue-19404.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] use std::any::TypeId; use std::rc::Rc; diff --git a/src/test/run-pass/issues/issue-19499.rs b/src/test/run-pass/issues/issue-19499.rs index 5fb209b2dfe..efdcce17f5f 100644 --- a/src/test/run-pass/issues/issue-19499.rs +++ b/src/test/run-pass/issues/issue-19499.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(path_statements)] +#![allow(unused_variables)] // Regression test for issue #19499. Due to incorrect caching of trait // results for closures with upvars whose types were not fully // computed, this rather bizarre little program (along with many more diff --git a/src/test/run-pass/issues/issue-19631.rs b/src/test/run-pass/issues/issue-19631.rs index 12804983ee4..604e3d60874 100644 --- a/src/test/run-pass/issues/issue-19631.rs +++ b/src/test/run-pass/issues/issue-19631.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait PoolManager { diff --git a/src/test/run-pass/issues/issue-19632.rs b/src/test/run-pass/issues/issue-19632.rs index 801d5947f92..5784886e94c 100644 --- a/src/test/run-pass/issues/issue-19632.rs +++ b/src/test/run-pass/issues/issue-19632.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait PoolManager { diff --git a/src/test/run-pass/issues/issue-19850.rs b/src/test/run-pass/issues/issue-19850.rs index fa837f57ede..f5b1697528f 100644 --- a/src/test/run-pass/issues/issue-19850.rs +++ b/src/test/run-pass/issues/issue-19850.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that `::Output` and `Self::Output` are accepted as type annotations in let // bindings diff --git a/src/test/run-pass/issues/issue-20186.rs b/src/test/run-pass/issues/issue-20186.rs index 0f42d8b1caa..16ac2babd42 100644 --- a/src/test/run-pass/issues/issue-20186.rs +++ b/src/test/run-pass/issues/issue-20186.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] struct Foo; impl Foo { diff --git a/src/test/run-pass/issues/issue-20313.rs b/src/test/run-pass/issues/issue-20313.rs index 9e6561369b8..bc87372e14f 100644 --- a/src/test/run-pass/issues/issue-20313.rs +++ b/src/test/run-pass/issues/issue-20313.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(link_llvm_intrinsics)] diff --git a/src/test/run-pass/issues/issue-20343.rs b/src/test/run-pass/issues/issue-20343.rs index 62506e1c49d..0173b0b2f9c 100644 --- a/src/test/run-pass/issues/issue-20343.rs +++ b/src/test/run-pass/issues/issue-20343.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Regression test for Issue #20343. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-20389.rs b/src/test/run-pass/issues/issue-20389.rs index 21cd3a55268..02d444f414c 100644 --- a/src/test/run-pass/issues/issue-20389.rs +++ b/src/test/run-pass/issues/issue-20389.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue_20389.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-20414.rs b/src/test/run-pass/issues/issue-20414.rs index 2e2449933c0..f42ba1ff303 100644 --- a/src/test/run-pass/issues/issue-20414.rs +++ b/src/test/run-pass/issues/issue-20414.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait Trait { diff --git a/src/test/run-pass/issues/issue-20427.rs b/src/test/run-pass/issues/issue-20427.rs index b03c489e252..86d94ad85b3 100644 --- a/src/test/run-pass/issues/issue-20427.rs +++ b/src/test/run-pass/issues/issue-20427.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_imports)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-20454.rs b/src/test/run-pass/issues/issue-20454.rs index 41cc94909a0..e00ddf4905f 100644 --- a/src/test/run-pass/issues/issue-20454.rs +++ b/src/test/run-pass/issues/issue-20454.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] use std::thread; fn _foo() { diff --git a/src/test/run-pass/issues/issue-20616.rs b/src/test/run-pass/issues/issue-20616.rs index c28d2123669..fa72cf3e76f 100644 --- a/src/test/run-pass/issues/issue-20616.rs +++ b/src/test/run-pass/issues/issue-20616.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] type MyType<'a, T> = &'a T; // combine lifetime bounds and type arguments in usual way diff --git a/src/test/run-pass/issues/issue-2063-resource.rs b/src/test/run-pass/issues/issue-2063-resource.rs index 12e9b481dc1..6e30c132040 100644 --- a/src/test/run-pass/issues/issue-2063-resource.rs +++ b/src/test/run-pass/issues/issue-2063-resource.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // test that autoderef of a type like this does not // cause compiler to loop. Note that no instances // of such a type could ever be constructed. diff --git a/src/test/run-pass/issues/issue-20644.rs b/src/test/run-pass/issues/issue-20644.rs index 728e2be3d23..c53565262e8 100644 --- a/src/test/run-pass/issues/issue-20644.rs +++ b/src/test/run-pass/issues/issue-20644.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] #![allow(stable_features)] // A reduced version of the rustbook ice. The problem this encountered diff --git a/src/test/run-pass/issues/issue-20763-1.rs b/src/test/run-pass/issues/issue-20763-1.rs index 0afcc1bd966..df85f615cd2 100644 --- a/src/test/run-pass/issues/issue-20763-1.rs +++ b/src/test/run-pass/issues/issue-20763-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait T0 { diff --git a/src/test/run-pass/issues/issue-20763-2.rs b/src/test/run-pass/issues/issue-20763-2.rs index 4b25d4f05de..489b87ce90f 100644 --- a/src/test/run-pass/issues/issue-20763-2.rs +++ b/src/test/run-pass/issues/issue-20763-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait T0 { diff --git a/src/test/run-pass/issues/issue-20953.rs b/src/test/run-pass/issues/issue-20953.rs index e3dc286df34..e2200c0d39b 100644 --- a/src/test/run-pass/issues/issue-20953.rs +++ b/src/test/run-pass/issues/issue-20953.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] fn main() { let mut shrinker: Box> = Box::new(vec![1].into_iter()); println!("{:?}", shrinker.next()); diff --git a/src/test/run-pass/issues/issue-21033.rs b/src/test/run-pass/issues/issue-21033.rs index f96d2db30d3..20357ecd63a 100644 --- a/src/test/run-pass/issues/issue-21033.rs +++ b/src/test/run-pass/issues/issue-21033.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 #![feature(box_patterns)] diff --git a/src/test/run-pass/issues/issue-21058.rs b/src/test/run-pass/issues/issue-21058.rs index 318abfe691e..e2ad0ba5bb2 100644 --- a/src/test/run-pass/issues/issue-21058.rs +++ b/src/test/run-pass/issues/issue-21058.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(core_intrinsics)] struct NT(str); diff --git a/src/test/run-pass/issues/issue-21174.rs b/src/test/run-pass/issues/issue-21174.rs index 3af5e5323a6..f387b93d8f9 100644 --- a/src/test/run-pass/issues/issue-21174.rs +++ b/src/test/run-pass/issues/issue-21174.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] trait Trait<'a> { type A; type B; diff --git a/src/test/run-pass/issues/issue-21245.rs b/src/test/run-pass/issues/issue-21245.rs index 6bc14489d95..234d70e4dd0 100644 --- a/src/test/run-pass/issues/issue-21245.rs +++ b/src/test/run-pass/issues/issue-21245.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for issue #21245. Check that we are able to infer // the types in these examples correctly. It used to be that // insufficient type propagation caused the type of the iterator to be diff --git a/src/test/run-pass/issues/issue-21402.rs b/src/test/run-pass/issues/issue-21402.rs index 210ba0711b4..041547a5728 100644 --- a/src/test/run-pass/issues/issue-21402.rs +++ b/src/test/run-pass/issues/issue-21402.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #[derive(Hash)] diff --git a/src/test/run-pass/issues/issue-21475.rs b/src/test/run-pass/issues/issue-21475.rs index 883d6d215bd..cdfdad3848d 100644 --- a/src/test/run-pass/issues/issue-21475.rs +++ b/src/test/run-pass/issues/issue-21475.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // pretty-expanded FIXME #23616 use m::{START, END}; diff --git a/src/test/run-pass/issues/issue-21486.rs b/src/test/run-pass/issues/issue-21486.rs index faf9b42a0e8..5e576893711 100644 --- a/src/test/run-pass/issues/issue-21486.rs +++ b/src/test/run-pass/issues/issue-21486.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // Issue #21486: Make sure that all structures are dropped, even when // created via FRU and control-flow breaks in the middle of // construction. diff --git a/src/test/run-pass/issues/issue-21520.rs b/src/test/run-pass/issues/issue-21520.rs index 71eb229ef00..33d79b66162 100644 --- a/src/test/run-pass/issues/issue-21520.rs +++ b/src/test/run-pass/issues/issue-21520.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that the requirement (in `Bar`) that `T::Bar : 'static` does // not wind up propagating to `T`. diff --git a/src/test/run-pass/issues/issue-21562.rs b/src/test/run-pass/issues/issue-21562.rs index 6b876df9d04..4e90ed7c447 100644 --- a/src/test/run-pass/issues/issue-21562.rs +++ b/src/test/run-pass/issues/issue-21562.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] extern crate core; diff --git a/src/test/run-pass/issues/issue-21622.rs b/src/test/run-pass/issues/issue-21622.rs index e7289e5d162..16db178452e 100644 --- a/src/test/run-pass/issues/issue-21622.rs +++ b/src/test/run-pass/issues/issue-21622.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] struct Index; diff --git a/src/test/run-pass/issues/issue-21726.rs b/src/test/run-pass/issues/issue-21726.rs index 49369759929..ffdff9aa2ba 100644 --- a/src/test/run-pass/issues/issue-21726.rs +++ b/src/test/run-pass/issues/issue-21726.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #21726: an issue arose around the rules for // subtyping of projection types that resulted in an unconstrained // region, yielding region inference failures. diff --git a/src/test/run-pass/issues/issue-21891.rs b/src/test/run-pass/issues/issue-21891.rs index 1e577ba7303..90a496617b0 100644 --- a/src/test/run-pass/issues/issue-21891.rs +++ b/src/test/run-pass/issues/issue-21891.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2190-1.rs b/src/test/run-pass/issues/issue-2190-1.rs index 2d7a7382f0b..c77407a6bb1 100644 --- a/src/test/run-pass/issues/issue-2190-1.rs +++ b/src/test/run-pass/issues/issue-2190-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] #![allow(non_upper_case_globals)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2216.rs b/src/test/run-pass/issues/issue-2216.rs index 9283cd93fa3..42cd3c0488b 100644 --- a/src/test/run-pass/issues/issue-2216.rs +++ b/src/test/run-pass/issues/issue-2216.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] pub fn main() { let mut x = 0; diff --git a/src/test/run-pass/issues/issue-22346.rs b/src/test/run-pass/issues/issue-22346.rs index 6689b6081ec..0b58591cd62 100644 --- a/src/test/run-pass/issues/issue-22346.rs +++ b/src/test/run-pass/issues/issue-22346.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 // This used to cause an ICE because the retslot for the "return" had the wrong type diff --git a/src/test/run-pass/issues/issue-22471.rs b/src/test/run-pass/issues/issue-22471.rs index 87b4bc1734b..b93f1f354c6 100644 --- a/src/test/run-pass/issues/issue-22471.rs +++ b/src/test/run-pass/issues/issue-22471.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(type_alias_bounds)] type Foo where T: Copy = Box; diff --git a/src/test/run-pass/issues/issue-22546.rs b/src/test/run-pass/issues/issue-22546.rs index 28aaae1d8cc..4f165877afc 100644 --- a/src/test/run-pass/issues/issue-22546.rs +++ b/src/test/run-pass/issues/issue-22546.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Parsing patterns with paths with type parameters (issue #22544) use std::default::Default; diff --git a/src/test/run-pass/issues/issue-22577.rs b/src/test/run-pass/issues/issue-22577.rs index 774416c9251..c78f308f6b8 100644 --- a/src/test/run-pass/issues/issue-22577.rs +++ b/src/test/run-pass/issues/issue-22577.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 // ignore-cloudabi no std::fs diff --git a/src/test/run-pass/issues/issue-22629.rs b/src/test/run-pass/issues/issue-22629.rs index 9254a080794..9b9918d8aad 100644 --- a/src/test/run-pass/issues/issue-22629.rs +++ b/src/test/run-pass/issues/issue-22629.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // Test transitive analysis for associated types. Collected types // should be normalized and new obligations generated. diff --git a/src/test/run-pass/issues/issue-22781.rs b/src/test/run-pass/issues/issue-22781.rs index af95b6e1d1a..8849b505e4b 100644 --- a/src/test/run-pass/issues/issue-22781.rs +++ b/src/test/run-pass/issues/issue-22781.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use std::collections::HashMap; use std::collections::hash_map::Entry::Vacant; diff --git a/src/test/run-pass/issues/issue-22828.rs b/src/test/run-pass/issues/issue-22828.rs index cc92f080936..cdbd1deb001 100644 --- a/src/test/run-pass/issues/issue-22828.rs +++ b/src/test/run-pass/issues/issue-22828.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test transitive analysis for associated types. Collected types // should be normalized and new obligations generated. diff --git a/src/test/run-pass/issues/issue-2284.rs b/src/test/run-pass/issues/issue-2284.rs index 77d1d6e0aa2..feb752411b1 100644 --- a/src/test/run-pass/issues/issue-2284.rs +++ b/src/test/run-pass/issues/issue-2284.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait Send { diff --git a/src/test/run-pass/issues/issue-2311-2.rs b/src/test/run-pass/issues/issue-2311-2.rs index 8cfd941cca8..493ff6f01cb 100644 --- a/src/test/run-pass/issues/issue-2311-2.rs +++ b/src/test/run-pass/issues/issue-2311-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-2312.rs b/src/test/run-pass/issues/issue-2312.rs index 33a033ef37f..9975f8a5aa7 100644 --- a/src/test/run-pass/issues/issue-2312.rs +++ b/src/test/run-pass/issues/issue-2312.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // Testing that the B's are resolved diff --git a/src/test/run-pass/issues/issue-23406.rs b/src/test/run-pass/issues/issue-23406.rs index fb44e2d9270..771f62a6323 100644 --- a/src/test/run-pass/issues/issue-23406.rs +++ b/src/test/run-pass/issues/issue-23406.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Inner { type T; } diff --git a/src/test/run-pass/issues/issue-23442.rs b/src/test/run-pass/issues/issue-23442.rs index 9f39b30f107..1b31516be17 100644 --- a/src/test/run-pass/issues/issue-23442.rs +++ b/src/test/run-pass/issues/issue-23442.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::marker::PhantomData; pub struct UnionedKeys<'a,K> diff --git a/src/test/run-pass/issues/issue-23485.rs b/src/test/run-pass/issues/issue-23485.rs index 42ccf5995ac..0699dc13c15 100644 --- a/src/test/run-pass/issues/issue-23485.rs +++ b/src/test/run-pass/issues/issue-23485.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // Test for an ICE that occurred when a default method implementation // was applied to a type that did not meet the prerequisites. The // problem occurred specifically because normalizing diff --git a/src/test/run-pass/issues/issue-23491.rs b/src/test/run-pass/issues/issue-23491.rs index a6e06050c0e..54f66d34f39 100644 --- a/src/test/run-pass/issues/issue-23491.rs +++ b/src/test/run-pass/issues/issue-23491.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![feature(box_syntax)] struct Node(T); diff --git a/src/test/run-pass/issues/issue-23699.rs b/src/test/run-pass/issues/issue-23699.rs index a33d1039267..747fc172023 100644 --- a/src/test/run-pass/issues/issue-23699.rs +++ b/src/test/run-pass/issues/issue-23699.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] fn gimme_a_raw_pointer(_: *const T) { } fn test(t: T) { } diff --git a/src/test/run-pass/issues/issue-23833.rs b/src/test/run-pass/issues/issue-23833.rs index eeb7db925da..b790f721a3b 100644 --- a/src/test/run-pass/issues/issue-23833.rs +++ b/src/test/run-pass/issues/issue-23833.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] use std::fmt; use std::{i8, i16, i32, i64, isize}; use std::{u8, u16, u32, u64, usize}; diff --git a/src/test/run-pass/issues/issue-24085.rs b/src/test/run-pass/issues/issue-24085.rs index 6d8cacf8b29..06350a80730 100644 --- a/src/test/run-pass/issues/issue-24085.rs +++ b/src/test/run-pass/issues/issue-24085.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #24085. Errors were occurring in region // inference due to the requirement that `'a:b'`, which was getting // incorrectly codegened in connection with the closure below. diff --git a/src/test/run-pass/issues/issue-24086.rs b/src/test/run-pass/issues/issue-24086.rs index 632afc00688..1d86c4201b5 100644 --- a/src/test/run-pass/issues/issue-24086.rs +++ b/src/test/run-pass/issues/issue-24086.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_variables)] pub struct Registry<'a> { listener: &'a mut (), } diff --git a/src/test/run-pass/issues/issue-24161.rs b/src/test/run-pass/issues/issue-24161.rs index 1ac5d1237a7..8bb88be7c56 100644 --- a/src/test/run-pass/issues/issue-24161.rs +++ b/src/test/run-pass/issues/issue-24161.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Copy,Clone)] struct Functions { a: fn(u32) -> u32, diff --git a/src/test/run-pass/issues/issue-24353.rs b/src/test/run-pass/issues/issue-24353.rs index f4b0e6814e8..753905c2b2f 100644 --- a/src/test/run-pass/issues/issue-24353.rs +++ b/src/test/run-pass/issues/issue-24353.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] fn main() { return (); diff --git a/src/test/run-pass/issues/issue-24434.rs b/src/test/run-pass/issues/issue-24434.rs index a4f22e3c79a..7fdd6f8ee8b 100644 --- a/src/test/run-pass/issues/issue-24434.rs +++ b/src/test/run-pass/issues/issue-24434.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] // compile-flags:--cfg set1 #![cfg_attr(set1, feature(custom_attribute))] diff --git a/src/test/run-pass/issues/issue-2445-b.rs b/src/test/run-pass/issues/issue-2445-b.rs index 144861dc94e..b9e773a5d4f 100644 --- a/src/test/run-pass/issues/issue-2445-b.rs +++ b/src/test/run-pass/issues/issue-2445-b.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2445.rs b/src/test/run-pass/issues/issue-2445.rs index 1d368e908ed..95782e83ffb 100644 --- a/src/test/run-pass/issues/issue-2445.rs +++ b/src/test/run-pass/issues/issue-2445.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-24533.rs b/src/test/run-pass/issues/issue-24533.rs index 316773e8915..d2104cacd0c 100644 --- a/src/test/run-pass/issues/issue-24533.rs +++ b/src/test/run-pass/issues/issue-24533.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] use std::slice::Iter; use std::io::{Error, ErrorKind, Result}; use std::vec::*; diff --git a/src/test/run-pass/issues/issue-2463.rs b/src/test/run-pass/issues/issue-2463.rs index 1c655f87435..8a1b6e45e72 100644 --- a/src/test/run-pass/issues/issue-2463.rs +++ b/src/test/run-pass/issues/issue-2463.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct Pair { f: isize, g: isize } diff --git a/src/test/run-pass/issues/issue-2487-a.rs b/src/test/run-pass/issues/issue-2487-a.rs index ee0ee106076..6bd1757f64c 100644 --- a/src/test/run-pass/issues/issue-2487-a.rs +++ b/src/test/run-pass/issues/issue-2487-a.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2502.rs b/src/test/run-pass/issues/issue-2502.rs index d06f99910a0..938a8e29044 100644 --- a/src/test/run-pass/issues/issue-2502.rs +++ b/src/test/run-pass/issues/issue-2502.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-25180.rs b/src/test/run-pass/issues/issue-25180.rs index edfa369ed46..04a28fb8f0a 100644 --- a/src/test/run-pass/issues/issue-25180.rs +++ b/src/test/run-pass/issues/issue-25180.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] const x: &'static Fn() = &|| println!("ICE here"); diff --git a/src/test/run-pass/issues/issue-25339.rs b/src/test/run-pass/issues/issue-25339.rs index 279a8865377..4551b38b5cd 100644 --- a/src/test/run-pass/issues/issue-25339.rs +++ b/src/test/run-pass/issues/issue-25339.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![feature(associated_type_defaults)] use std::marker::PhantomData; diff --git a/src/test/run-pass/issues/issue-25394.rs b/src/test/run-pass/issues/issue-25394.rs index df1fe399a4a..4e7b6242712 100644 --- a/src/test/run-pass/issues/issue-25394.rs +++ b/src/test/run-pass/issues/issue-25394.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Debug)] struct Row([T]); diff --git a/src/test/run-pass/issues/issue-25467.rs b/src/test/run-pass/issues/issue-25467.rs index 37ce124e132..0f078b214ed 100644 --- a/src/test/run-pass/issues/issue-25467.rs +++ b/src/test/run-pass/issues/issue-25467.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // aux-build:issue-25467.rs pub type Issue25467BarT = (); diff --git a/src/test/run-pass/issues/issue-2550.rs b/src/test/run-pass/issues/issue-2550.rs index 0552e97e642..afe837509b9 100644 --- a/src/test/run-pass/issues/issue-2550.rs +++ b/src/test/run-pass/issues/issue-2550.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-25549-multiple-drop.rs b/src/test/run-pass/issues/issue-25549-multiple-drop.rs index 24f44f2ecba..ccb438a8c23 100644 --- a/src/test/run-pass/issues/issue-25549-multiple-drop.rs +++ b/src/test/run-pass/issues/issue-25549-multiple-drop.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] struct Foo<'r>(&'r mut i32); impl<'r> Drop for Foo<'r> { diff --git a/src/test/run-pass/issues/issue-25693.rs b/src/test/run-pass/issues/issue-25693.rs index 86fe6c08147..174fc832598 100644 --- a/src/test/run-pass/issues/issue-25693.rs +++ b/src/test/run-pass/issues/issue-25693.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] pub trait Parameters { type SelfRef; } struct RP<'a> { _marker: std::marker::PhantomData<&'a ()> } diff --git a/src/test/run-pass/issues/issue-25916.rs b/src/test/run-pass/issues/issue-25916.rs index cf8753119bf..c71af4660fb 100644 --- a/src/test/run-pass/issues/issue-25916.rs +++ b/src/test/run-pass/issues/issue-25916.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] + fn main() { macro_rules! f { () => { 0 + 0 } diff --git a/src/test/run-pass/issues/issue-26095.rs b/src/test/run-pass/issues/issue-26095.rs index 0c6bc7c4885..cc7f7cdbab1 100644 --- a/src/test/run-pass/issues/issue-26095.rs +++ b/src/test/run-pass/issues/issue-26095.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-2611-3.rs b/src/test/run-pass/issues/issue-2611-3.rs index 4b66aa48a5b..99fd1a727f5 100644 --- a/src/test/run-pass/issues/issue-2611-3.rs +++ b/src/test/run-pass/issues/issue-2611-3.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Tests that impls are allowed to have looser, more permissive bounds // than the traits require. diff --git a/src/test/run-pass/issues/issue-26205.rs b/src/test/run-pass/issues/issue-26205.rs index e015acfdc2a..ce96c3dd5a2 100644 --- a/src/test/run-pass/issues/issue-26205.rs +++ b/src/test/run-pass/issues/issue-26205.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::ops::{Deref, DerefMut}; struct Foo; diff --git a/src/test/run-pass/issues/issue-2633.rs b/src/test/run-pass/issues/issue-2633.rs index c02c4e7b9d6..410339d37f1 100644 --- a/src/test/run-pass/issues/issue-2633.rs +++ b/src/test/run-pass/issues/issue-2633.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/issues/issue-2642.rs b/src/test/run-pass/issues/issue-2642.rs index c900fa7b42c..94d8adfa323 100644 --- a/src/test/run-pass/issues/issue-2642.rs +++ b/src/test/run-pass/issues/issue-2642.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn f() { diff --git a/src/test/run-pass/issues/issue-26873-multifile.rs b/src/test/run-pass/issues/issue-26873-multifile.rs index c557c0698d5..803ef06eba7 100644 --- a/src/test/run-pass/issues/issue-26873-multifile.rs +++ b/src/test/run-pass/issues/issue-26873-multifile.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] #![allow(non_snake_case)] // ignore-pretty issue #37195 diff --git a/src/test/run-pass/issues/issue-26873-onefile.rs b/src/test/run-pass/issues/issue-26873-onefile.rs index 005491ecc58..c2f1c6cb1bf 100644 --- a/src/test/run-pass/issues/issue-26873-onefile.rs +++ b/src/test/run-pass/issues/issue-26873-onefile.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_imports)] #![allow(non_snake_case)] mod A { diff --git a/src/test/run-pass/issues/issue-26997.rs b/src/test/run-pass/issues/issue-26997.rs index e6d0ef14431..03430e1ac68 100644 --- a/src/test/run-pass/issues/issue-26997.rs +++ b/src/test/run-pass/issues/issue-26997.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub struct Foo { x: isize, y: isize diff --git a/src/test/run-pass/issues/issue-27060.rs b/src/test/run-pass/issues/issue-27060.rs index 594edb3fd71..adf3179da4f 100644 --- a/src/test/run-pass/issues/issue-27060.rs +++ b/src/test/run-pass/issues/issue-27060.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[repr(packed)] pub struct Good { data: &'static u32, diff --git a/src/test/run-pass/issues/issue-2708.rs b/src/test/run-pass/issues/issue-2708.rs index 5fccdb0f137..d760e8eef68 100644 --- a/src/test/run-pass/issues/issue-2708.rs +++ b/src/test/run-pass/issues/issue-2708.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2718.rs b/src/test/run-pass/issues/issue-2718.rs index 1c5e7c7333d..4faf9216fcb 100644 --- a/src/test/run-pass/issues/issue-2718.rs +++ b/src/test/run-pass/issues/issue-2718.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_unsafe)] +#![allow(unused_imports)] #![allow(non_camel_case_types)] pub type Task = isize; diff --git a/src/test/run-pass/issues/issue-27240.rs b/src/test/run-pass/issues/issue-27240.rs index 5e65a8084c3..07eb34e32ce 100644 --- a/src/test/run-pass/issues/issue-27240.rs +++ b/src/test/run-pass/issues/issue-27240.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] use std::fmt; struct NoisyDrop(T); impl Drop for NoisyDrop { diff --git a/src/test/run-pass/issues/issue-2734.rs b/src/test/run-pass/issues/issue-2734.rs index e3b1618c625..68be1556349 100644 --- a/src/test/run-pass/issues/issue-2734.rs +++ b/src/test/run-pass/issues/issue-2734.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2735.rs b/src/test/run-pass/issues/issue-2735.rs index b22051700d8..8e5459ad915 100644 --- a/src/test/run-pass/issues/issue-2735.rs +++ b/src/test/run-pass/issues/issue-2735.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-2748-a.rs b/src/test/run-pass/issues/issue-2748-a.rs index 9d84e2dccbc..db7b46a4dc5 100644 --- a/src/test/run-pass/issues/issue-2748-a.rs +++ b/src/test/run-pass/issues/issue-2748-a.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-27639.rs b/src/test/run-pass/issues/issue-27639.rs index 81b1a2518fc..7dcbe21b7e4 100644 --- a/src/test/run-pass/issues/issue-27639.rs +++ b/src/test/run-pass/issues/issue-27639.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] fn main() { diff --git a/src/test/run-pass/issues/issue-27889.rs b/src/test/run-pass/issues/issue-27889.rs index a16bfeb8daa..82d178835e2 100644 --- a/src/test/run-pass/issues/issue-27889.rs +++ b/src/test/run-pass/issues/issue-27889.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] // Test that a field can have the same name in different variants // of an enum diff --git a/src/test/run-pass/issues/issue-2804-2.rs b/src/test/run-pass/issues/issue-2804-2.rs index a080627c686..3e64d78ba02 100644 --- a/src/test/run-pass/issues/issue-2804-2.rs +++ b/src/test/run-pass/issues/issue-2804-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Minimized version of issue-2804.rs. Both check that callee IDs don't // clobber the previous node ID in a macro expr diff --git a/src/test/run-pass/issues/issue-28279.rs b/src/test/run-pass/issues/issue-28279.rs index bc615c8f7e3..bd5129a8ae4 100644 --- a/src/test/run-pass/issues/issue-28279.rs +++ b/src/test/run-pass/issues/issue-28279.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::rc::Rc; fn test1() -> Rc Fn(&'a usize) + 'static> { diff --git a/src/test/run-pass/issues/issue-28676.rs b/src/test/run-pass/issues/issue-28676.rs index 978d2136334..c571c4e23ce 100644 --- a/src/test/run-pass/issues/issue-28676.rs +++ b/src/test/run-pass/issues/issue-28676.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(improper_ctypes)] // ignore-wasm32-bare no libc to test ffi with diff --git a/src/test/run-pass/issues/issue-28822.rs b/src/test/run-pass/issues/issue-28822.rs index 39e4a23e3cd..1dda7212952 100644 --- a/src/test/run-pass/issues/issue-28822.rs +++ b/src/test/run-pass/issues/issue-28822.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(min_const_fn)] fn main() {} diff --git a/src/test/run-pass/issues/issue-2895.rs b/src/test/run-pass/issues/issue-2895.rs index e52126e16f8..9a1be5fef32 100644 --- a/src/test/run-pass/issues/issue-2895.rs +++ b/src/test/run-pass/issues/issue-2895.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::mem; diff --git a/src/test/run-pass/issues/issue-29030.rs b/src/test/run-pass/issues/issue-29030.rs index 51dbf58a77d..9f4b2cffbbb 100644 --- a/src/test/run-pass/issues/issue-29030.rs +++ b/src/test/run-pass/issues/issue-29030.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Debug)] struct Message<'a, P: 'a = &'a [u8]> { header: &'a [u8], diff --git a/src/test/run-pass/issues/issue-29037.rs b/src/test/run-pass/issues/issue-29037.rs index 2ee4446820b..3148e61827f 100644 --- a/src/test/run-pass/issues/issue-29037.rs +++ b/src/test/run-pass/issues/issue-29037.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // This test ensures that each pointer type `P` is covariant in `X`. use std::rc::Rc; diff --git a/src/test/run-pass/issues/issue-2904.rs b/src/test/run-pass/issues/issue-2904.rs index dcb8515c776..ab40c2e0bbe 100644 --- a/src/test/run-pass/issues/issue-2904.rs +++ b/src/test/run-pass/issues/issue-2904.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_mut)] #![allow(non_camel_case_types)] // Map representation diff --git a/src/test/run-pass/issues/issue-29071-2.rs b/src/test/run-pass/issues/issue-29071-2.rs index f0025f25557..84dbb40ea87 100644 --- a/src/test/run-pass/issues/issue-29071-2.rs +++ b/src/test/run-pass/issues/issue-29071-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] fn t1() -> u32 { let x; x = if true { [1, 2, 3] } else { [2, 3, 4] }[0]; diff --git a/src/test/run-pass/issues/issue-29071.rs b/src/test/run-pass/issues/issue-29071.rs index 06570f41a53..1eab5a7bbda 100644 --- a/src/test/run-pass/issues/issue-29071.rs +++ b/src/test/run-pass/issues/issue-29071.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] fn ret() -> u32 { diff --git a/src/test/run-pass/issues/issue-29276.rs b/src/test/run-pass/issues/issue-29276.rs index 6797dbc31c1..9f2a0d6bc99 100644 --- a/src/test/run-pass/issues/issue-29276.rs +++ b/src/test/run-pass/issues/issue-29276.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct S([u8; { struct Z; 0 }]); fn main() {} diff --git a/src/test/run-pass/issues/issue-2935.rs b/src/test/run-pass/issues/issue-2935.rs index d2af8325181..6656914e419 100644 --- a/src/test/run-pass/issues/issue-2935.rs +++ b/src/test/run-pass/issues/issue-2935.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-29466.rs b/src/test/run-pass/issues/issue-29466.rs index 1c8fc88f8f2..0aa4e6355d1 100644 --- a/src/test/run-pass/issues/issue-29466.rs +++ b/src/test/run-pass/issues/issue-29466.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] macro_rules! m( ($e1:expr => $e2:expr) => ({ $e1 }) ); diff --git a/src/test/run-pass/issues/issue-29485.rs b/src/test/run-pass/issues/issue-29485.rs index 67725b02ded..f3890f8d521 100644 --- a/src/test/run-pass/issues/issue-29485.rs +++ b/src/test/run-pass/issues/issue-29485.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] // aux-build:issue-29485.rs // ignore-emscripten no threads diff --git a/src/test/run-pass/issues/issue-29522.rs b/src/test/run-pass/issues/issue-29522.rs index 9d5a12dadbe..75c01b2589e 100644 --- a/src/test/run-pass/issues/issue-29522.rs +++ b/src/test/run-pass/issues/issue-29522.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // check that we don't accidentally capture upvars just because their name // occurs in a path diff --git a/src/test/run-pass/issues/issue-29740.rs b/src/test/run-pass/issues/issue-29740.rs index b0959e83009..3854ad38bdc 100644 --- a/src/test/run-pass/issues/issue-29740.rs +++ b/src/test/run-pass/issues/issue-29740.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #29740. Inefficient MIR matching algorithms // generated way too much code for this sort of case, leading to OOM. #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-29927.rs b/src/test/run-pass/issues/issue-29927.rs index 4eab938609f..863d9e74abb 100644 --- a/src/test/run-pass/issues/issue-29927.rs +++ b/src/test/run-pass/issues/issue-29927.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(min_const_fn)] struct A { field: usize, diff --git a/src/test/run-pass/issues/issue-30018-nopanic.rs b/src/test/run-pass/issues/issue-30018-nopanic.rs index bb94d4f8517..dfbdf1fdeb4 100644 --- a/src/test/run-pass/issues/issue-30018-nopanic.rs +++ b/src/test/run-pass/issues/issue-30018-nopanic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // More thorough regression test for Issues #30018 and #30822. This // attempts to explore different ways that array element construction // (for both scratch arrays and non-scratch ones) interacts with diff --git a/src/test/run-pass/issues/issue-3037.rs b/src/test/run-pass/issues/issue-3037.rs index ab2d5a5ae88..8ae7b64182d 100644 --- a/src/test/run-pass/issues/issue-3037.rs +++ b/src/test/run-pass/issues/issue-3037.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/issues/issue-30371.rs b/src/test/run-pass/issues/issue-30371.rs index f95d442c1b9..a3140f6ded2 100644 --- a/src/test/run-pass/issues/issue-30371.rs +++ b/src/test/run-pass/issues/issue-30371.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] #![deny(unused_variables)] fn main() { diff --git a/src/test/run-pass/issues/issue-3052.rs b/src/test/run-pass/issues/issue-3052.rs index 6c2d3899bf3..612fd69a499 100644 --- a/src/test/run-pass/issues/issue-3052.rs +++ b/src/test/run-pass/issues/issue-3052.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 type Connection = Box) + 'static>; diff --git a/src/test/run-pass/issues/issue-3121.rs b/src/test/run-pass/issues/issue-3121.rs index 9d70cf90d1c..60b24050092 100644 --- a/src/test/run-pass/issues/issue-3121.rs +++ b/src/test/run-pass/issues/issue-3121.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-31260.rs b/src/test/run-pass/issues/issue-31260.rs index 6b31a1ac996..82d0d5b5ffb 100644 --- a/src/test/run-pass/issues/issue-31260.rs +++ b/src/test/run-pass/issues/issue-31260.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub struct Struct { pub field: K, } diff --git a/src/test/run-pass/issues/issue-3149.rs b/src/test/run-pass/issues/issue-3149.rs index 324aec23ab0..4eb3378a089 100644 --- a/src/test/run-pass/issues/issue-3149.rs +++ b/src/test/run-pass/issues/issue-3149.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-31597.rs b/src/test/run-pass/issues/issue-31597.rs index 50aefb7d870..f3995511b0f 100644 --- a/src/test/run-pass/issues/issue-31597.rs +++ b/src/test/run-pass/issues/issue-31597.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Make { type Out; diff --git a/src/test/run-pass/issues/issue-31776.rs b/src/test/run-pass/issues/issue-31776.rs index db866b86a2a..7386303bef5 100644 --- a/src/test/run-pass/issues/issue-31776.rs +++ b/src/test/run-pass/issues/issue-31776.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Various scenarios in which `pub` is required in blocks struct S; diff --git a/src/test/run-pass/issues/issue-32008.rs b/src/test/run-pass/issues/issue-32008.rs index 7fccf09bdaa..a04b7af813b 100644 --- a/src/test/run-pass/issues/issue-32008.rs +++ b/src/test/run-pass/issues/issue-32008.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Tests that binary operators allow subtyping on both the LHS and RHS, // and as such do not introduce unnecessarily strict lifetime constraints. diff --git a/src/test/run-pass/issues/issue-3220.rs b/src/test/run-pass/issues/issue-3220.rs index 2d32a08e37b..3183df6a4f5 100644 --- a/src/test/run-pass/issues/issue-3220.rs +++ b/src/test/run-pass/issues/issue-3220.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-33287.rs b/src/test/run-pass/issues/issue-33287.rs index e99c53caa87..31f44ffa34d 100644 --- a/src/test/run-pass/issues/issue-33287.rs +++ b/src/test/run-pass/issues/issue-33287.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] const A: [u32; 1] = [0]; fn test() { diff --git a/src/test/run-pass/issues/issue-33461.rs b/src/test/run-pass/issues/issue-33461.rs index 17938a38474..8f1665ba208 100644 --- a/src/test/run-pass/issues/issue-33461.rs +++ b/src/test/run-pass/issues/issue-33461.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use std::marker::PhantomData; struct TheType { diff --git a/src/test/run-pass/issues/issue-33498.rs b/src/test/run-pass/issues/issue-33498.rs index e7e89083032..519db8a05af 100644 --- a/src/test/run-pass/issues/issue-33498.rs +++ b/src/test/run-pass/issues/issue-33498.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] pub fn main() { let x = (0, 2); diff --git a/src/test/run-pass/issues/issue-3389.rs b/src/test/run-pass/issues/issue-3389.rs index 7102bb469e4..500de0f6c26 100644 --- a/src/test/run-pass/issues/issue-3389.rs +++ b/src/test/run-pass/issues/issue-3389.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] struct trie_node { diff --git a/src/test/run-pass/issues/issue-33903.rs b/src/test/run-pass/issues/issue-33903.rs index df2f5e3e7a0..e521b594aa2 100644 --- a/src/test/run-pass/issues/issue-33903.rs +++ b/src/test/run-pass/issues/issue-33903.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue 33903: // Built-in indexing should be used even when the index is not // trivially an integer diff --git a/src/test/run-pass/issues/issue-3424.rs b/src/test/run-pass/issues/issue-3424.rs index 1e914eaee58..cf1b0022661 100644 --- a/src/test/run-pass/issues/issue-3424.rs +++ b/src/test/run-pass/issues/issue-3424.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // rustc --test ignores2.rs && ./ignores2 diff --git a/src/test/run-pass/issues/issue-3447.rs b/src/test/run-pass/issues/issue-3447.rs index ff4642e47eb..374dda09033 100644 --- a/src/test/run-pass/issues/issue-3447.rs +++ b/src/test/run-pass/issues/issue-3447.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-34751.rs b/src/test/run-pass/issues/issue-34751.rs index 382212a1908..d4758b80e97 100644 --- a/src/test/run-pass/issues/issue-34751.rs +++ b/src/test/run-pass/issues/issue-34751.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // #34751 ICE: 'rustc' panicked at 'assertion failed: !substs.has_regions_escaping_depth(0)' #[allow(dead_code)] diff --git a/src/test/run-pass/issues/issue-34784.rs b/src/test/run-pass/issues/issue-34784.rs index 0a6a25c41d5..fe257d57e98 100644 --- a/src/test/run-pass/issues/issue-34784.rs +++ b/src/test/run-pass/issues/issue-34784.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] const C: *const u8 = &0; fn foo(x: *const u8) { diff --git a/src/test/run-pass/issues/issue-34796.rs b/src/test/run-pass/issues/issue-34796.rs index ea9172ae483..8de25508687 100644 --- a/src/test/run-pass/issues/issue-34796.rs +++ b/src/test/run-pass/issues/issue-34796.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // This test case exposes conditions where the encoding of a trait object type // with projection predicates would differ between this crate and the upstream // crate, because the predicates were encoded in different order within each diff --git a/src/test/run-pass/issues/issue-35546.rs b/src/test/run-pass/issues/issue-35546.rs index 9c39941232f..13d099081b0 100644 --- a/src/test/run-pass/issues/issue-35546.rs +++ b/src/test/run-pass/issues/issue-35546.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #35546. Check that we are able to codegen // this. Before we had problems because of the drop glue signature // around dropping a trait object (specifically, when dropping the diff --git a/src/test/run-pass/issues/issue-3556.rs b/src/test/run-pass/issues/issue-3556.rs index b71d94adfeb..8b2cc17796f 100644 --- a/src/test/run-pass/issues/issue-3556.rs +++ b/src/test/run-pass/issues/issue-3556.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Debug)] enum Token { diff --git a/src/test/run-pass/issues/issue-35600.rs b/src/test/run-pass/issues/issue-35600.rs index 1083aa808cb..c9d9f9598f2 100644 --- a/src/test/run-pass/issues/issue-35600.rs +++ b/src/test/run-pass/issues/issue-35600.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] trait Foo { type bar; fn bar(); diff --git a/src/test/run-pass/issues/issue-3563-3.rs b/src/test/run-pass/issues/issue-3563-3.rs index cd31abaca35..13d74be89d8 100644 --- a/src/test/run-pass/issues/issue-3563-3.rs +++ b/src/test/run-pass/issues/issue-3563-3.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![allow(non_snake_case)] // ASCII art shape renderer. Demonstrates traits, impls, operator overloading, diff --git a/src/test/run-pass/issues/issue-35815.rs b/src/test/run-pass/issues/issue-35815.rs index 62bd6aa37fd..32b73de1118 100644 --- a/src/test/run-pass/issues/issue-35815.rs +++ b/src/test/run-pass/issues/issue-35815.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::mem; struct Foo { diff --git a/src/test/run-pass/issues/issue-36023.rs b/src/test/run-pass/issues/issue-36023.rs index a654a813edf..54a36c6f1b3 100644 --- a/src/test/run-pass/issues/issue-36023.rs +++ b/src/test/run-pass/issues/issue-36023.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use std::ops::Deref; fn main() { diff --git a/src/test/run-pass/issues/issue-36075.rs b/src/test/run-pass/issues/issue-36075.rs index e11d35669f5..4042bd19794 100644 --- a/src/test/run-pass/issues/issue-36075.rs +++ b/src/test/run-pass/issues/issue-36075.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait DeclarationParser { type Declaration; } diff --git a/src/test/run-pass/issues/issue-3609.rs b/src/test/run-pass/issues/issue-3609.rs index 384964188db..abbaf630e78 100644 --- a/src/test/run-pass/issues/issue-3609.rs +++ b/src/test/run-pass/issues/issue-3609.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_mut)] use std::thread; use std::sync::mpsc::Sender; diff --git a/src/test/run-pass/issues/issue-3656.rs b/src/test/run-pass/issues/issue-3656.rs index 1e626e2e9c1..63b27406198 100644 --- a/src/test/run-pass/issues/issue-3656.rs +++ b/src/test/run-pass/issues/issue-3656.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(improper_ctypes)] // Issue #3656 diff --git a/src/test/run-pass/issues/issue-3702.rs b/src/test/run-pass/issues/issue-3702.rs index 5ca851f8b77..dfe63913d56 100644 --- a/src/test/run-pass/issues/issue-3702.rs +++ b/src/test/run-pass/issues/issue-3702.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub fn main() { trait Text { diff --git a/src/test/run-pass/issues/issue-37222.rs b/src/test/run-pass/issues/issue-37222.rs index af19a922fae..114177702c5 100644 --- a/src/test/run-pass/issues/issue-37222.rs +++ b/src/test/run-pass/issues/issue-37222.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[derive(Debug, PartialEq)] enum Bar { A(i64), diff --git a/src/test/run-pass/issues/issue-37291/main.rs b/src/test/run-pass/issues/issue-37291/main.rs index c30e87ad785..b9b827d3457 100644 --- a/src/test/run-pass/issues/issue-37291/main.rs +++ b/src/test/run-pass/issues/issue-37291/main.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // aux-build:lib.rs // Regression test for #37291. The problem was that the starting diff --git a/src/test/run-pass/issues/issue-37598.rs b/src/test/run-pass/issues/issue-37598.rs index b5a11f5a0fd..3001591c406 100644 --- a/src/test/run-pass/issues/issue-37598.rs +++ b/src/test/run-pass/issues/issue-37598.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(slice_patterns)] fn check(list: &[u8]) { diff --git a/src/test/run-pass/issues/issue-37725.rs b/src/test/run-pass/issues/issue-37725.rs index ce952a7e520..8b29dad918d 100644 --- a/src/test/run-pass/issues/issue-37725.rs +++ b/src/test/run-pass/issues/issue-37725.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Foo { fn foo(&self); } diff --git a/src/test/run-pass/issues/issue-37733.rs b/src/test/run-pass/issues/issue-37733.rs index 0b1b08d4e7b..a982cae2621 100644 --- a/src/test/run-pass/issues/issue-37733.rs +++ b/src/test/run-pass/issues/issue-37733.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] type A = for<> fn(); type B = for<'a,> fn(); diff --git a/src/test/run-pass/issues/issue-38002.rs b/src/test/run-pass/issues/issue-38002.rs index 70892ba7d62..044d84c06d4 100644 --- a/src/test/run-pass/issues/issue-38002.rs +++ b/src/test/run-pass/issues/issue-38002.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Check that constant ADTs are codegened OK, part k of N. enum Bar { diff --git a/src/test/run-pass/issues/issue-38437.rs b/src/test/run-pass/issues/issue-38437.rs index cea55270aa0..2fec9542e0e 100644 --- a/src/test/run-pass/issues/issue-38437.rs +++ b/src/test/run-pass/issues/issue-38437.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Check that drop elaboration clears the "master" discriminant // drop flag even if it protects no fields. diff --git a/src/test/run-pass/issues/issue-38556.rs b/src/test/run-pass/issues/issue-38556.rs index b1a30f910df..4f1dc22af3c 100644 --- a/src/test/run-pass/issues/issue-38556.rs +++ b/src/test/run-pass/issues/issue-38556.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub struct Foo; macro_rules! reexport { diff --git a/src/test/run-pass/issues/issue-38727.rs b/src/test/run-pass/issues/issue-38727.rs index 81e63476524..ccf0e1c2bdb 100644 --- a/src/test/run-pass/issues/issue-38727.rs +++ b/src/test/run-pass/issues/issue-38727.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #[repr(u64)] enum A { A = 0u64, diff --git a/src/test/run-pass/issues/issue-3874.rs b/src/test/run-pass/issues/issue-3874.rs index 53a57c9943b..2b1e25d2a1a 100644 --- a/src/test/run-pass/issues/issue-3874.rs +++ b/src/test/run-pass/issues/issue-3874.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 enum PureCounter { PureCounterVariant(usize) } diff --git a/src/test/run-pass/issues/issue-3888-2.rs b/src/test/run-pass/issues/issue-3888-2.rs index 707145392c7..2d702dac028 100644 --- a/src/test/run-pass/issues/issue-3888-2.rs +++ b/src/test/run-pass/issues/issue-3888-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn vec_peek<'r, T>(v: &'r [T]) -> &'r [T] { diff --git a/src/test/run-pass/issues/issue-3895.rs b/src/test/run-pass/issues/issue-3895.rs index 3620cb874f5..69207549126 100644 --- a/src/test/run-pass/issues/issue-3895.rs +++ b/src/test/run-pass/issues/issue-3895.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub fn main() { enum State { BadChar, BadSyntax } diff --git a/src/test/run-pass/issues/issue-39089.rs b/src/test/run-pass/issues/issue-39089.rs index e4ace4299bd..6908563a81c 100644 --- a/src/test/run-pass/issues/issue-39089.rs +++ b/src/test/run-pass/issues/issue-39089.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] fn f Sized>() {} fn main() {} diff --git a/src/test/run-pass/issues/issue-39467.rs b/src/test/run-pass/issues/issue-39467.rs index 3fab06d9a68..d54cf3f27c5 100644 --- a/src/test/run-pass/issues/issue-39467.rs +++ b/src/test/run-pass/issues/issue-39467.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] macro_rules! expr { () => { () } } enum A {} diff --git a/src/test/run-pass/issues/issue-39709.rs b/src/test/run-pass/issues/issue-39709.rs index 44caa644edf..25d8a707fe4 100644 --- a/src/test/run-pass/issues/issue-39709.rs +++ b/src/test/run-pass/issues/issue-39709.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_macros)] fn main() { println!("{}", { macro_rules! x { ($(t:tt)*) => {} } 33 }); } diff --git a/src/test/run-pass/issues/issue-3979-generics.rs b/src/test/run-pass/issues/issue-3979-generics.rs index 7766d7d1bdc..8402aac138e 100644 --- a/src/test/run-pass/issues/issue-3979-generics.rs +++ b/src/test/run-pass/issues/issue-3979-generics.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] use std::ops::Add; diff --git a/src/test/run-pass/issues/issue-3979-xcrate.rs b/src/test/run-pass/issues/issue-3979-xcrate.rs index d698e7ac775..a087504c581 100644 --- a/src/test/run-pass/issues/issue-3979-xcrate.rs +++ b/src/test/run-pass/issues/issue-3979-xcrate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue_3979_traits.rs extern crate issue_3979_traits; diff --git a/src/test/run-pass/issues/issue-3979.rs b/src/test/run-pass/issues/issue-3979.rs index 4cc2e882baa..ce7d20b6ef1 100644 --- a/src/test/run-pass/issues/issue-3979.rs +++ b/src/test/run-pass/issues/issue-3979.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] trait Positioned { diff --git a/src/test/run-pass/issues/issue-3991.rs b/src/test/run-pass/issues/issue-3991.rs index d3efcaf636e..9028066cfac 100644 --- a/src/test/run-pass/issues/issue-3991.rs +++ b/src/test/run-pass/issues/issue-3991.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-39984.rs b/src/test/run-pass/issues/issue-39984.rs index 450620da35a..c90585cb734 100644 --- a/src/test/run-pass/issues/issue-39984.rs +++ b/src/test/run-pass/issues/issue-39984.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unreachable_code)] // Regression test for issue #39984. // // The key here is that the error type of the `Ok` call ought to be diff --git a/src/test/run-pass/issues/issue-40003.rs b/src/test/run-pass/issues/issue-40003.rs index cf18ab47c39..d2ed14d1413 100644 --- a/src/test/run-pass/issues/issue-40003.rs +++ b/src/test/run-pass/issues/issue-40003.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] fn main() { if false { test(); } } diff --git a/src/test/run-pass/issues/issue-40136.rs b/src/test/run-pass/issues/issue-40136.rs index 5c1a527dbeb..00d33fae13c 100644 --- a/src/test/run-pass/issues/issue-40136.rs +++ b/src/test/run-pass/issues/issue-40136.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] macro_rules! m { () => { 0 } } diff --git a/src/test/run-pass/issues/issue-40235.rs b/src/test/run-pass/issues/issue-40235.rs index 3c26183f146..b37372c682f 100644 --- a/src/test/run-pass/issues/issue-40235.rs +++ b/src/test/run-pass/issues/issue-40235.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] fn foo() {} fn main() { diff --git a/src/test/run-pass/issues/issue-4025.rs b/src/test/run-pass/issues/issue-4025.rs index f216ba9b9c9..41af0826c00 100644 --- a/src/test/run-pass/issues/issue-4025.rs +++ b/src/test/run-pass/issues/issue-4025.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] /* # if b { x } else { y } requires identical types for x and y */ diff --git a/src/test/run-pass/issues/issue-40770.rs b/src/test/run-pass/issues/issue-40770.rs index d27b13c3a10..566f92519b8 100644 --- a/src/test/run-pass/issues/issue-40770.rs +++ b/src/test/run-pass/issues/issue-40770.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_macros)] macro_rules! m { ($e:expr) => { macro_rules! n { () => { $e } } diff --git a/src/test/run-pass/issues/issue-40883.rs b/src/test/run-pass/issues/issue-40883.rs index 357152b60e5..8de60a64ea4 100644 --- a/src/test/run-pass/issues/issue-40883.rs +++ b/src/test/run-pass/issues/issue-40883.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // check that we don't have linear stack usage with multiple calls to `push` #![feature(test)] diff --git a/src/test/run-pass/issues/issue-40951.rs b/src/test/run-pass/issues/issue-40951.rs index b6f74f4f1cd..693234a1720 100644 --- a/src/test/run-pass/issues/issue-40951.rs +++ b/src/test/run-pass/issues/issue-40951.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Regression test for #40951. const FOO: [&'static str; 1] = ["foo"]; diff --git a/src/test/run-pass/issues/issue-4107.rs b/src/test/run-pass/issues/issue-4107.rs index a05b1ddd9f4..dee393d07c7 100644 --- a/src/test/run-pass/issues/issue-4107.rs +++ b/src/test/run-pass/issues/issue-4107.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub fn main() { let _id: &Mat2 = &Matrix::identity(1.0); diff --git a/src/test/run-pass/issues/issue-41213.rs b/src/test/run-pass/issues/issue-41213.rs index 0f1d8fe7249..66499b0a469 100644 --- a/src/test/run-pass/issues/issue-41213.rs +++ b/src/test/run-pass/issues/issue-41213.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum A { A1, A2, diff --git a/src/test/run-pass/issues/issue-41272.rs b/src/test/run-pass/issues/issue-41272.rs index 3debd77d123..827edd39d2f 100644 --- a/src/test/run-pass/issues/issue-41272.rs +++ b/src/test/run-pass/issues/issue-41272.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Foo; impl Foo { diff --git a/src/test/run-pass/issues/issue-41298.rs b/src/test/run-pass/issues/issue-41298.rs index 62e1afb9230..189c419c5db 100644 --- a/src/test/run-pass/issues/issue-41298.rs +++ b/src/test/run-pass/issues/issue-41298.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Function { t: T, f: F } impl Function R> { fn foo() { } } diff --git a/src/test/run-pass/issues/issue-41696.rs b/src/test/run-pass/issues/issue-41696.rs index 780290dce7f..3937f9c1930 100644 --- a/src/test/run-pass/issues/issue-41696.rs +++ b/src/test/run-pass/issues/issue-41696.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // this used to cause exponential code-size blowup during LLVM passes. #![feature(test)] diff --git a/src/test/run-pass/issues/issue-41849-variance-req.rs b/src/test/run-pass/issues/issue-41849-variance-req.rs index 2f8c108f590..61706f6acab 100644 --- a/src/test/run-pass/issues/issue-41849-variance-req.rs +++ b/src/test/run-pass/issues/issue-41849-variance-req.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #41849. use std::ops::Mul; diff --git a/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs b/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs index f47e69931d5..1a4b283a81b 100644 --- a/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs +++ b/src/test/run-pass/issues/issue-41936-variance-coerce-unsized-cycle.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for #41936. The coerce-unsized trait check in // coherence was using subtyping, which triggered variance // computation, which failed because it required type info for fields diff --git a/src/test/run-pass/issues/issue-42007.rs b/src/test/run-pass/issues/issue-42007.rs index b72343f05c6..1347cb62d0e 100644 --- a/src/test/run-pass/issues/issue-42007.rs +++ b/src/test/run-pass/issues/issue-42007.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue_42007_s.rs extern crate issue_42007_s; diff --git a/src/test/run-pass/issues/issue-4208.rs b/src/test/run-pass/issues/issue-4208.rs index fa6f56bc817..d47e95e9b07 100644 --- a/src/test/run-pass/issues/issue-4208.rs +++ b/src/test/run-pass/issues/issue-4208.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue-4208-cc.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-42453.rs b/src/test/run-pass/issues/issue-42453.rs index 649f52ef82e..6a4780ece6d 100644 --- a/src/test/run-pass/issues/issue-42453.rs +++ b/src/test/run-pass/issues/issue-42453.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #[derive(Debug)] diff --git a/src/test/run-pass/issues/issue-42467.rs b/src/test/run-pass/issues/issue-42467.rs index 0f89d505751..82bab74a49b 100644 --- a/src/test/run-pass/issues/issue-42467.rs +++ b/src/test/run-pass/issues/issue-42467.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct Foo(T); struct IntoIter(T); diff --git a/src/test/run-pass/issues/issue-42956.rs b/src/test/run-pass/issues/issue-42956.rs index cee9d8be98d..2210facf294 100644 --- a/src/test/run-pass/issues/issue-42956.rs +++ b/src/test/run-pass/issues/issue-42956.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(stable_features)] #![feature(associated_consts)] diff --git a/src/test/run-pass/issues/issue-4333.rs b/src/test/run-pass/issues/issue-4333.rs index 193a438fc9c..0886cf0aa68 100644 --- a/src/test/run-pass/issues/issue-4333.rs +++ b/src/test/run-pass/issues/issue-4333.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // pretty-expanded FIXME #23616 use std::io; diff --git a/src/test/run-pass/issues/issue-43357.rs b/src/test/run-pass/issues/issue-43357.rs index 75d05c06428..558b0712bb1 100644 --- a/src/test/run-pass/issues/issue-43357.rs +++ b/src/test/run-pass/issues/issue-43357.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Trait { type Output; } diff --git a/src/test/run-pass/issues/issue-43483.rs b/src/test/run-pass/issues/issue-43483.rs index 52ee080125f..841bc629ce5 100644 --- a/src/test/run-pass/issues/issue-43483.rs +++ b/src/test/run-pass/issues/issue-43483.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] trait VecN { const DIM: usize; } diff --git a/src/test/run-pass/issues/issue-43923.rs b/src/test/run-pass/issues/issue-43923.rs index 220a68e1335..3f72c5d8af0 100644 --- a/src/test/run-pass/issues/issue-43923.rs +++ b/src/test/run-pass/issues/issue-43923.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] struct A { ptr: T } fn foo(x: &A<[T]>) {} diff --git a/src/test/run-pass/issues/issue-44247.rs b/src/test/run-pass/issues/issue-44247.rs index f431e94889c..c1204aa43a2 100644 --- a/src/test/run-pass/issues/issue-44247.rs +++ b/src/test/run-pass/issues/issue-44247.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait T { type X; const X: Self::X; diff --git a/src/test/run-pass/issues/issue-44373.rs b/src/test/run-pass/issues/issue-44373.rs index 4d5bb5449b7..2ed79dd89c8 100644 --- a/src/test/run-pass/issues/issue-44373.rs +++ b/src/test/run-pass/issues/issue-44373.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // compile-flags: -Z borrowck=compare struct Foo(bool); diff --git a/src/test/run-pass/issues/issue-44402.rs b/src/test/run-pass/issues/issue-44402.rs index 427ac016c08..6863fdbb566 100644 --- a/src/test/run-pass/issues/issue-44402.rs +++ b/src/test/run-pass/issues/issue-44402.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(never_type)] #![feature(exhaustive_patterns)] diff --git a/src/test/run-pass/issues/issue-4464.rs b/src/test/run-pass/issues/issue-4464.rs index bb788aaf88d..fda063e8ddd 100644 --- a/src/test/run-pass/issues/issue-4464.rs +++ b/src/test/run-pass/issues/issue-4464.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn broken(v: &[u8], i: usize, j: usize) -> &[u8] { &v[i..j] } diff --git a/src/test/run-pass/issues/issue-45124.rs b/src/test/run-pass/issues/issue-45124.rs index 774ad8ac760..da29d65ae14 100644 --- a/src/test/run-pass/issues/issue-45124.rs +++ b/src/test/run-pass/issues/issue-45124.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] // compile-flags: --edition 2018 #![feature(try_blocks)] diff --git a/src/test/run-pass/issues/issue-45152.rs b/src/test/run-pass/issues/issue-45152.rs index 71c1f92baa7..2bba7fec396 100644 --- a/src/test/run-pass/issues/issue-45152.rs +++ b/src/test/run-pass/issues/issue-45152.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![feature(unsize, coerce_unsized)] #[repr(packed)] diff --git a/src/test/run-pass/issues/issue-45425.rs b/src/test/run-pass/issues/issue-45425.rs index c7523664047..dfc7c8a8795 100644 --- a/src/test/run-pass/issues/issue-45425.rs +++ b/src/test/run-pass/issues/issue-45425.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::ops::Add; fn ref_add(a: &T, b: &T) -> T diff --git a/src/test/run-pass/issues/issue-46855.rs b/src/test/run-pass/issues/issue-46855.rs index 8e6a37083e3..3a099c241b1 100644 --- a/src/test/run-pass/issues/issue-46855.rs +++ b/src/test/run-pass/issues/issue-46855.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // compile-flags: -Zmir-opt-level=1 use std::mem; diff --git a/src/test/run-pass/issues/issue-4734.rs b/src/test/run-pass/issues/issue-4734.rs index 216fd537022..5bc977e1491 100644 --- a/src/test/run-pass/issues/issue-4734.rs +++ b/src/test/run-pass/issues/issue-4734.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Ensures that destructors are run for expressions of the form "e;" where // `e` is a type which requires a destructor. diff --git a/src/test/run-pass/issues/issue-47364.rs b/src/test/run-pass/issues/issue-47364.rs index 61dd0714a1f..58e11ff1035 100644 --- a/src/test/run-pass/issues/issue-47364.rs +++ b/src/test/run-pass/issues/issue-47364.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // compile-flags: -C codegen-units=8 -O #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-47638.rs b/src/test/run-pass/issues/issue-47638.rs index c3c662ea2d4..1a6edd9f498 100644 --- a/src/test/run-pass/issues/issue-47638.rs +++ b/src/test/run-pass/issues/issue-47638.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] fn id<'c, 'b>(f: &'c &'b Fn(&i32)) -> &'c &'b Fn(&'static i32) { f } diff --git a/src/test/run-pass/issues/issue-47673.rs b/src/test/run-pass/issues/issue-47673.rs index 96f38deec4c..1e733a0c4d6 100644 --- a/src/test/run-pass/issues/issue-47673.rs +++ b/src/test/run-pass/issues/issue-47673.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] use {{}, {}}; diff --git a/src/test/run-pass/issues/issue-47703-1.rs b/src/test/run-pass/issues/issue-47703-1.rs index 8fa931abb86..7cf34d3cd42 100644 --- a/src/test/run-pass/issues/issue-47703-1.rs +++ b/src/test/run-pass/issues/issue-47703-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(nll)] struct AtomicRefMut<'a> { diff --git a/src/test/run-pass/issues/issue-47703-tuple.rs b/src/test/run-pass/issues/issue-47703-tuple.rs index 188d4bc5520..ee9d7f38dbe 100644 --- a/src/test/run-pass/issues/issue-47703-tuple.rs +++ b/src/test/run-pass/issues/issue-47703-tuple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(nll)] struct WithDrop; diff --git a/src/test/run-pass/issues/issue-47703.rs b/src/test/run-pass/issues/issue-47703.rs index 0a0388ac48e..17353c8e59f 100644 --- a/src/test/run-pass/issues/issue-47703.rs +++ b/src/test/run-pass/issues/issue-47703.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(nll)] struct MyStruct<'a> { diff --git a/src/test/run-pass/issues/issue-47722.rs b/src/test/run-pass/issues/issue-47722.rs index 92309297356..a8e0faeed06 100644 --- a/src/test/run-pass/issues/issue-47722.rs +++ b/src/test/run-pass/issues/issue-47722.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Tests that automatic coercions from &mut T to *mut T // allow borrows of T to expire immediately - essentially, that diff --git a/src/test/run-pass/issues/issue-47789.rs b/src/test/run-pass/issues/issue-47789.rs index 57aac45e51a..349aa4f73ab 100644 --- a/src/test/run-pass/issues/issue-47789.rs +++ b/src/test/run-pass/issues/issue-47789.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] #![feature(nll)] diff --git a/src/test/run-pass/issues/issue-4830.rs b/src/test/run-pass/issues/issue-4830.rs index 42800255c6b..5140162ae43 100644 --- a/src/test/run-pass/issues/issue-4830.rs +++ b/src/test/run-pass/issues/issue-4830.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-4865-1.rs b/src/test/run-pass/issues/issue-4865-1.rs index 9a22cf08c04..5dd142844f5 100644 --- a/src/test/run-pass/issues/issue-4865-1.rs +++ b/src/test/run-pass/issues/issue-4865-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // This should resolve fine. // Prior to fix, the crossed imports between a and b // would block on the glob import, itself never being resolved diff --git a/src/test/run-pass/issues/issue-4865-3.rs b/src/test/run-pass/issues/issue-4865-3.rs index 4a18539c302..b4126337d05 100644 --- a/src/test/run-pass/issues/issue-4865-3.rs +++ b/src/test/run-pass/issues/issue-4865-3.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // This should resolve fine even with the circular imports as // they are not `pub`. diff --git a/src/test/run-pass/issues/issue-4875.rs b/src/test/run-pass/issues/issue-4875.rs index d33d08ab18c..c1ef78242fb 100644 --- a/src/test/run-pass/issues/issue-4875.rs +++ b/src/test/run-pass/issues/issue-4875.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // regression test for issue 4875 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-48962.rs b/src/test/run-pass/issues/issue-48962.rs index ea309981af1..2fd3ad47f00 100644 --- a/src/test/run-pass/issues/issue-48962.rs +++ b/src/test/run-pass/issues/issue-48962.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // Test that we are able to reinitialize box with moved referent #![feature(nll)] static mut ORDER: [usize; 3] = [0, 0, 0]; diff --git a/src/test/run-pass/issues/issue-48984.rs b/src/test/run-pass/issues/issue-48984.rs index faffc2e4fb0..035c7e7fcc1 100644 --- a/src/test/run-pass/issues/issue-48984.rs +++ b/src/test/run-pass/issues/issue-48984.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue-48984-aux.rs extern crate issue48984aux; use issue48984aux::Bar; diff --git a/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs b/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs index 3a70bdfb2fd..ecda8b7d17e 100644 --- a/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs +++ b/src/test/run-pass/issues/issue-49588-non-shorthand-field-patterns-in-pattern-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![deny(non_shorthand_field_patterns)] pub struct Value { pub value: A } diff --git a/src/test/run-pass/issues/issue-50442.rs b/src/test/run-pass/issues/issue-50442.rs index 6a55f2d633b..b22cd829253 100644 --- a/src/test/run-pass/issues/issue-50442.rs +++ b/src/test/run-pass/issues/issue-50442.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum Void {} enum Foo { diff --git a/src/test/run-pass/issues/issue-50689.rs b/src/test/run-pass/issues/issue-50689.rs index bc94066b041..6b7f4e6e95e 100644 --- a/src/test/run-pass/issues/issue-50689.rs +++ b/src/test/run-pass/issues/issue-50689.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] enum Foo { Bar = (|x: i32| { }, 42).1, } diff --git a/src/test/run-pass/issues/issue-51345.rs b/src/test/run-pass/issues/issue-51345.rs index 887feada3c8..cc97da8b45e 100644 --- a/src/test/run-pass/issues/issue-51345.rs +++ b/src/test/run-pass/issues/issue-51345.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_code)] #![feature(nll)] fn main() { diff --git a/src/test/run-pass/issues/issue-5192.rs b/src/test/run-pass/issues/issue-5192.rs index df9664dc234..0f14b0fb5fc 100644 --- a/src/test/run-pass/issues/issue-5192.rs +++ b/src/test/run-pass/issues/issue-5192.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-5243.rs b/src/test/run-pass/issues/issue-5243.rs index 708187643d8..3c630ceff7a 100644 --- a/src/test/run-pass/issues/issue-5243.rs +++ b/src/test/run-pass/issues/issue-5243.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Check that merely having lifetime parameters is not // enough for codegen to consider this as non-monomorphic, // which led to various assertions and failures in turn. diff --git a/src/test/run-pass/issues/issue-52557.rs b/src/test/run-pass/issues/issue-52557.rs index 3c987d32b90..c3dc404058c 100644 --- a/src/test/run-pass/issues/issue-52557.rs +++ b/src/test/run-pass/issues/issue-52557.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // This test checks for namespace pollution by private tests. // Tests used to marked as public causing name conflicts with normal // functions only in test builds. diff --git a/src/test/run-pass/issues/issue-52705/main.rs b/src/test/run-pass/issues/issue-52705/main.rs index 00cb5ac103a..9a27584c181 100644 --- a/src/test/run-pass/issues/issue-52705/main.rs +++ b/src/test/run-pass/issues/issue-52705/main.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:png2.rs // compile-flags:--extern png2 // edition:2018 diff --git a/src/test/run-pass/issues/issue-5280.rs b/src/test/run-pass/issues/issue-5280.rs index f80b80c72af..c791113bee6 100644 --- a/src/test/run-pass/issues/issue-5280.rs +++ b/src/test/run-pass/issues/issue-5280.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] type FontTableTag = u32; diff --git a/src/test/run-pass/issues/issue-53333.rs b/src/test/run-pass/issues/issue-53333.rs index 8cb0d17cc16..db59f8f7416 100644 --- a/src/test/run-pass/issues/issue-53333.rs +++ b/src/test/run-pass/issues/issue-53333.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // edition:2018 fn main() { diff --git a/src/test/run-pass/issues/issue-5353.rs b/src/test/run-pass/issues/issue-5353.rs index 678a42e7549..d9d07831331 100644 --- a/src/test/run-pass/issues/issue-5353.rs +++ b/src/test/run-pass/issues/issue-5353.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 const INVALID_ENUM : u32 = 0; diff --git a/src/test/run-pass/issues/issue-5521.rs b/src/test/run-pass/issues/issue-5521.rs index 4890156f7b8..c1740430590 100644 --- a/src/test/run-pass/issues/issue-5521.rs +++ b/src/test/run-pass/issues/issue-5521.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:issue-5521.rs diff --git a/src/test/run-pass/issues/issue-5530.rs b/src/test/run-pass/issues/issue-5530.rs index cf0a225290f..417dc6ce3c5 100644 --- a/src/test/run-pass/issues/issue-5530.rs +++ b/src/test/run-pass/issues/issue-5530.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum Enum { Foo { foo: usize }, diff --git a/src/test/run-pass/issues/issue-5550.rs b/src/test/run-pass/issues/issue-5550.rs index 3b0f19b1f8b..aa66737344d 100644 --- a/src/test/run-pass/issues/issue-5550.rs +++ b/src/test/run-pass/issues/issue-5550.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] // pretty-expanded FIXME #23616 pub fn main() { diff --git a/src/test/run-pass/issues/issue-5554.rs b/src/test/run-pass/issues/issue-5554.rs index 8ff48c8600e..ec4a082c0ff 100644 --- a/src/test/run-pass/issues/issue-5554.rs +++ b/src/test/run-pass/issues/issue-5554.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 use std::default::Default; diff --git a/src/test/run-pass/issues/issue-5572.rs b/src/test/run-pass/issues/issue-5572.rs index 418119e2fd6..02f12a0303a 100644 --- a/src/test/run-pass/issues/issue-5572.rs +++ b/src/test/run-pass/issues/issue-5572.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn foo(_t: T) { } diff --git a/src/test/run-pass/issues/issue-5708.rs b/src/test/run-pass/issues/issue-5708.rs index 2fef9bc1973..3d44c39c577 100644 --- a/src/test/run-pass/issues/issue-5708.rs +++ b/src/test/run-pass/issues/issue-5708.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] /* # ICE when returning struct with reference to trait diff --git a/src/test/run-pass/issues/issue-5754.rs b/src/test/run-pass/issues/issue-5754.rs index ba79c32a83d..9b902630459 100644 --- a/src/test/run-pass/issues/issue-5754.rs +++ b/src/test/run-pass/issues/issue-5754.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(improper_ctypes)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-5791.rs b/src/test/run-pass/issues/issue-5791.rs index e6c9106111f..92195169638 100644 --- a/src/test/run-pass/issues/issue-5791.rs +++ b/src/test/run-pass/issues/issue-5791.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 extern { diff --git a/src/test/run-pass/issues/issue-5884.rs b/src/test/run-pass/issues/issue-5884.rs index 26816f235e9..82d87d9d270 100644 --- a/src/test/run-pass/issues/issue-5884.rs +++ b/src/test/run-pass/issues/issue-5884.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/issues/issue-5900.rs b/src/test/run-pass/issues/issue-5900.rs index d75291bf1f3..edb4ead53e4 100644 --- a/src/test/run-pass/issues/issue-5900.rs +++ b/src/test/run-pass/issues/issue-5900.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub mod foo { diff --git a/src/test/run-pass/issues/issue-5997.rs b/src/test/run-pass/issues/issue-5997.rs index d888f691477..84c2d3b8b14 100644 --- a/src/test/run-pass/issues/issue-5997.rs +++ b/src/test/run-pass/issues/issue-5997.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] fn f() -> bool { enum E { V(T) } diff --git a/src/test/run-pass/issues/issue-6117.rs b/src/test/run-pass/issues/issue-6117.rs index fa9ef84746d..68c729ced82 100644 --- a/src/test/run-pass/issues/issue-6117.rs +++ b/src/test/run-pass/issues/issue-6117.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 enum Either { Left(T), Right(U) } diff --git a/src/test/run-pass/issues/issue-6449.rs b/src/test/run-pass/issues/issue-6449.rs index 1987bca9330..9314990b0f3 100644 --- a/src/test/run-pass/issues/issue-6449.rs +++ b/src/test/run-pass/issues/issue-6449.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum Foo { Bar(isize), diff --git a/src/test/run-pass/issues/issue-6470.rs b/src/test/run-pass/issues/issue-6470.rs index 152b4bbedc3..a23a6532b15 100644 --- a/src/test/run-pass/issues/issue-6470.rs +++ b/src/test/run-pass/issues/issue-6470.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(improper_ctypes)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-6557.rs b/src/test/run-pass/issues/issue-6557.rs index 5179ddb472b..886d13c4c6f 100644 --- a/src/test/run-pass/issues/issue-6557.rs +++ b/src/test/run-pass/issues/issue-6557.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(box_patterns)] diff --git a/src/test/run-pass/issues/issue-6892.rs b/src/test/run-pass/issues/issue-6892.rs index 173ad5833e5..b92c5347982 100644 --- a/src/test/run-pass/issues/issue-6892.rs +++ b/src/test/run-pass/issues/issue-6892.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Ensures that destructors are run for expressions of the form "let _ = e;" // where `e` is a type which requires a destructor. diff --git a/src/test/run-pass/issues/issue-6919.rs b/src/test/run-pass/issues/issue-6919.rs index 94c1a1ae00a..1332c863935 100644 --- a/src/test/run-pass/issues/issue-6919.rs +++ b/src/test/run-pass/issues/issue-6919.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] // aux-build:iss.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-6991.rs b/src/test/run-pass/issues/issue-6991.rs index 13b738ac0e6..3d1108e84ad 100644 --- a/src/test/run-pass/issues/issue-6991.rs +++ b/src/test/run-pass/issues/issue-6991.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] static x: &'static usize = &1; diff --git a/src/test/run-pass/issues/issue-7268.rs b/src/test/run-pass/issues/issue-7268.rs index 3a93a144ee8..961f90dfc37 100644 --- a/src/test/run-pass/issues/issue-7268.rs +++ b/src/test/run-pass/issues/issue-7268.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 fn foo(_: T) {} diff --git a/src/test/run-pass/issues/issue-7344.rs b/src/test/run-pass/issues/issue-7344.rs index cc160c79ae9..7402ae1c975 100644 --- a/src/test/run-pass/issues/issue-7344.rs +++ b/src/test/run-pass/issues/issue-7344.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // pretty-expanded FIXME #23616 #![allow(unreachable_code)] diff --git a/src/test/run-pass/issues/issue-7563.rs b/src/test/run-pass/issues/issue-7563.rs index 203c9cdfa49..e8c2a4683a5 100644 --- a/src/test/run-pass/issues/issue-7563.rs +++ b/src/test/run-pass/issues/issue-7563.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait IDummy { fn do_nothing(&self); } diff --git a/src/test/run-pass/issues/issue-7607-2.rs b/src/test/run-pass/issues/issue-7607-2.rs index 7a1f0159df9..fa97eae7cb3 100644 --- a/src/test/run-pass/issues/issue-7607-2.rs +++ b/src/test/run-pass/issues/issue-7607-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub mod a { diff --git a/src/test/run-pass/issues/issue-7660.rs b/src/test/run-pass/issues/issue-7660.rs index 774d9706d90..e584fc79085 100644 --- a/src/test/run-pass/issues/issue-7660.rs +++ b/src/test/run-pass/issues/issue-7660.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Regression test for issue 7660 // rvalue lifetime too short when equivalent `match` works diff --git a/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs b/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs index f9dae8472a8..6e5a6c551eb 100644 --- a/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs +++ b/src/test/run-pass/issues/issue-7673-cast-generically-implemented-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 /* diff --git a/src/test/run-pass/issues/issue-7899.rs b/src/test/run-pass/issues/issue-7899.rs index 74a5b060822..6141eec68fc 100644 --- a/src/test/run-pass/issues/issue-7899.rs +++ b/src/test/run-pass/issues/issue-7899.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // aux-build:issue-7899.rs // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs b/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs index 311fd129ab0..9ddc63a208a 100644 --- a/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs +++ b/src/test/run-pass/issues/issue-8171-default-method-self-inherit-builtin-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 /* diff --git a/src/test/run-pass/issues/issue-8249.rs b/src/test/run-pass/issues/issue-8249.rs index 9afa6f937b5..07916d9cdb8 100644 --- a/src/test/run-pass/issues/issue-8249.rs +++ b/src/test/run-pass/issues/issue-8249.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait A { diff --git a/src/test/run-pass/issues/issue-8259.rs b/src/test/run-pass/issues/issue-8259.rs index a0e2caee40a..b26392b6c72 100644 --- a/src/test/run-pass/issues/issue-8259.rs +++ b/src/test/run-pass/issues/issue-8259.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] // aux-build:issue-8259.rs diff --git a/src/test/run-pass/issues/issue-8351-1.rs b/src/test/run-pass/issues/issue-8351-1.rs index 3caecf9fb93..5d0dc31caa6 100644 --- a/src/test/run-pass/issues/issue-8351-1.rs +++ b/src/test/run-pass/issues/issue-8351-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { Foo{f: isize}, diff --git a/src/test/run-pass/issues/issue-8351-2.rs b/src/test/run-pass/issues/issue-8351-2.rs index da70fc415c0..5a3b1b13a63 100644 --- a/src/test/run-pass/issues/issue-8351-2.rs +++ b/src/test/run-pass/issues/issue-8351-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum E { Foo{f: isize, b: bool}, diff --git a/src/test/run-pass/issues/issue-8398.rs b/src/test/run-pass/issues/issue-8398.rs index e4f5a457f41..2458e91daeb 100644 --- a/src/test/run-pass/issues/issue-8398.rs +++ b/src/test/run-pass/issues/issue-8398.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub trait Writer { diff --git a/src/test/run-pass/issues/issue-8460.rs b/src/test/run-pass/issues/issue-8460.rs index 9f0f7e2fa42..515b0949a71 100644 --- a/src/test/run-pass/issues/issue-8460.rs +++ b/src/test/run-pass/issues/issue-8460.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support #![feature(rustc_attrs)] diff --git a/src/test/run-pass/issues/issue-8578.rs b/src/test/run-pass/issues/issue-8578.rs index 8753ee8370b..4cf39e3e5f0 100644 --- a/src/test/run-pass/issues/issue-8578.rs +++ b/src/test/run-pass/issues/issue-8578.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/issues/issue-868.rs b/src/test/run-pass/issues/issue-868.rs index a545abefb7a..6e9b736cccd 100644 --- a/src/test/run-pass/issues/issue-868.rs +++ b/src/test/run-pass/issues/issue-868.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_parens)] // pretty-expanded FIXME #23616 fn f(g: F) -> T where F: FnOnce() -> T { g() } diff --git a/src/test/run-pass/issues/issue-8783.rs b/src/test/run-pass/issues/issue-8783.rs index 741411aeffb..71915cfb33e 100644 --- a/src/test/run-pass/issues/issue-8783.rs +++ b/src/test/run-pass/issues/issue-8783.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 use std::default::Default; diff --git a/src/test/run-pass/issues/issue-8851.rs b/src/test/run-pass/issues/issue-8851.rs index 19fd51b476d..ff4fbc973e0 100644 --- a/src/test/run-pass/issues/issue-8851.rs +++ b/src/test/run-pass/issues/issue-8851.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // after fixing #9384 and implementing hygiene for match bindings, // this now fails because the insertion of the 'y' into the match // doesn't cause capture. Making this macro hygienic (as I've done) diff --git a/src/test/run-pass/issues/issue-8860.rs b/src/test/run-pass/issues/issue-8860.rs index c4d9cab9ff3..e0b49164281 100644 --- a/src/test/run-pass/issues/issue-8860.rs +++ b/src/test/run-pass/issues/issue-8860.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // compile-flags: -Z borrowck=compare static mut DROP: isize = 0; diff --git a/src/test/run-pass/issues/issue-9047.rs b/src/test/run-pass/issues/issue-9047.rs index 30f886f6784..9e919e7b89c 100644 --- a/src/test/run-pass/issues/issue-9047.rs +++ b/src/test/run-pass/issues/issue-9047.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] fn decode() -> String { 'outer: loop { let mut ch_start: usize; diff --git a/src/test/run-pass/issues/issue-9110.rs b/src/test/run-pass/issues/issue-9110.rs index 906c7a422e7..150df681ea4 100644 --- a/src/test/run-pass/issues/issue-9110.rs +++ b/src/test/run-pass/issues/issue-9110.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![allow(non_snake_case)] diff --git a/src/test/run-pass/issues/issue-9129.rs b/src/test/run-pass/issues/issue-9129.rs index 21e192b23f5..7c9f49c51b5 100644 --- a/src/test/run-pass/issues/issue-9129.rs +++ b/src/test/run-pass/issues/issue-9129.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] // ignore-pretty unreported diff --git a/src/test/run-pass/issues/issue-9243.rs b/src/test/run-pass/issues/issue-9243.rs index 957330a1925..f079268d6e1 100644 --- a/src/test/run-pass/issues/issue-9243.rs +++ b/src/test/run-pass/issues/issue-9243.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for issue 9243 #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/issues/issue-9249.rs b/src/test/run-pass/issues/issue-9249.rs index d11665c531e..eb66c565a78 100644 --- a/src/test/run-pass/issues/issue-9249.rs +++ b/src/test/run-pass/issues/issue-9249.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 static DATA:&'static [&'static str] = &["my string"]; diff --git a/src/test/run-pass/issues/issue-9259.rs b/src/test/run-pass/issues/issue-9259.rs index 481014fe3f3..7f93f5a8ab3 100644 --- a/src/test/run-pass/issues/issue-9259.rs +++ b/src/test/run-pass/issues/issue-9259.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct A<'a> { a: &'a [String], diff --git a/src/test/run-pass/issues/issue-9382.rs b/src/test/run-pass/issues/issue-9382.rs index 6a4f868cdf1..9ae26d638ff 100644 --- a/src/test/run-pass/issues/issue-9382.rs +++ b/src/test/run-pass/issues/issue-9382.rs @@ -11,6 +11,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] // Tests for a previous bug that occurred due to an interaction diff --git a/src/test/run-pass/issues/issue-9396.rs b/src/test/run-pass/issues/issue-9396.rs index 62a38767ddd..db717e3c99a 100644 --- a/src/test/run-pass/issues/issue-9396.rs +++ b/src/test/run-pass/issues/issue-9396.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] #![allow(deprecated)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/issues/issue-9719.rs b/src/test/run-pass/issues/issue-9719.rs index 1e52f326c1f..f98eba1cfdf 100644 --- a/src/test/run-pass/issues/issue-9719.rs +++ b/src/test/run-pass/issues/issue-9719.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 mod a { diff --git a/src/test/run-pass/issues/issue-9737.rs b/src/test/run-pass/issues/issue-9737.rs index 304eb7808a7..b74acf5d816 100644 --- a/src/test/run-pass/issues/issue-9737.rs +++ b/src/test/run-pass/issues/issue-9737.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] macro_rules! f { (v: $x:expr) => ( println!("{}", $x) ) } diff --git a/src/test/run-pass/issues/issue29927-1.rs b/src/test/run-pass/issues/issue29927-1.rs index c613560aff1..e3332909206 100644 --- a/src/test/run-pass/issues/issue29927-1.rs +++ b/src/test/run-pass/issues/issue29927-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(min_const_fn)] const fn f() -> usize { 5 diff --git a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs index 0043c1bc829..bb51b2519d6 100644 --- a/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs +++ b/src/test/run-pass/iterators/into-iterator-type-inference-shift.rs @@ -9,6 +9,10 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_variables)] // Regression test for type inference failure around shifting. In this // case, the iteration yields an isize, but we hadn't run the full type // propagation yet, and so we just saw a type variable, yielding an diff --git a/src/test/run-pass/macros/colorful-write-macros.rs b/src/test/run-pass/macros/colorful-write-macros.rs index 37eaf2e8cde..7c557eb2bd0 100644 --- a/src/test/run-pass/macros/colorful-write-macros.rs +++ b/src/test/run-pass/macros/colorful-write-macros.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::io::Write; use std::fmt; diff --git a/src/test/run-pass/macros/die-macro.rs b/src/test/run-pass/macros/die-macro.rs index 65ba591404b..26b339550cc 100644 --- a/src/test/run-pass/macros/die-macro.rs +++ b/src/test/run-pass/macros/die-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Just testing that panic!() type checks in statement or expr diff --git a/src/test/run-pass/macros/macro-at-most-once-rep.rs b/src/test/run-pass/macros/macro-at-most-once-rep.rs index 3625e0e7efa..c7129423cb6 100644 --- a/src/test/run-pass/macros/macro-at-most-once-rep.rs +++ b/src/test/run-pass/macros/macro-at-most-once-rep.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // The logic for parsing Kleene operators in macros has a special case to disambiguate `?`. // Specifically, `$(pat)?` is the ZeroOrOne operator whereas `$(pat)?+` or `$(pat)?*` are the // ZeroOrMore and OneOrMore operators using `?` as a separator. These tests are intended to diff --git a/src/test/run-pass/macros/macro-comma-behavior.rs b/src/test/run-pass/macros/macro-comma-behavior.rs index bfa32817b10..95774cad229 100644 --- a/src/test/run-pass/macros/macro-comma-behavior.rs +++ b/src/test/run-pass/macros/macro-comma-behavior.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // Ideally, any macro call with a trailing comma should behave // identically to a call without the comma. // diff --git a/src/test/run-pass/macros/macro-follow.rs b/src/test/run-pass/macros/macro-follow.rs index 2cb2e43fd65..89a51827d7e 100644 --- a/src/test/run-pass/macros/macro-follow.rs +++ b/src/test/run-pass/macros/macro-follow.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_macros)] // Check the macro follow sets (see corresponding cfail test). // FOLLOW(pat) = {FatArrow, Comma, Eq, Or, Ident(if), Ident(in)} diff --git a/src/test/run-pass/macros/macro-followed-by-seq.rs b/src/test/run-pass/macros/macro-followed-by-seq.rs index 8b796187664..15738230333 100644 --- a/src/test/run-pass/macros/macro-followed-by-seq.rs +++ b/src/test/run-pass/macros/macro-followed-by-seq.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_macros)] // Regression test for issue #25436: check that things which can be // followed by any token also permit X* to come afterwards. diff --git a/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs b/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs index eadef980377..31170a74164 100644 --- a/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs +++ b/src/test/run-pass/macros/macro-lifetime-used-with-bound.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] macro_rules! foo { ($l:lifetime, $l2:lifetime) => { fn f<$l: $l2, $l2>(arg: &$l str, arg2: &$l2 str) -> &$l str { diff --git a/src/test/run-pass/macros/macro-meta-items.rs b/src/test/run-pass/macros/macro-meta-items.rs index d19c33b2e3a..68f1eae969e 100644 --- a/src/test/run-pass/macros/macro-meta-items.rs +++ b/src/test/run-pass/macros/macro-meta-items.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // compile-flags: --cfg foo macro_rules! compiles_fine { diff --git a/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs b/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs index 22e983dd9ce..9b197eb2902 100644 --- a/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs +++ b/src/test/run-pass/macros/macro-stmt_macro_in_expr_macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] macro_rules! foo { () => { struct Bar; diff --git a/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs b/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs index 830ec620fca..8524f047a0b 100644 --- a/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs +++ b/src/test/run-pass/macros/macro-with-braces-in-expr-position.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs index f0431b92570..4ec21105882 100644 --- a/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs +++ b/src/test/run-pass/macros/parse-complex-macro-invoc-op.rs @@ -9,6 +9,10 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_assignments)] +#![allow(unused_variables)] #![allow(stable_features)] // Test parsing binary operators after macro invocations. diff --git a/src/test/run-pass/macros/paths-in-macro-invocations.rs b/src/test/run-pass/macros/paths-in-macro-invocations.rs index 358c97d468b..121a02226fe 100644 --- a/src/test/run-pass/macros/paths-in-macro-invocations.rs +++ b/src/test/run-pass/macros/paths-in-macro-invocations.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:two_macros.rs extern crate two_macros; diff --git a/src/test/run-pass/macros/type-macros-simple.rs b/src/test/run-pass/macros/type-macros-simple.rs index 8f091ec192b..176e9a635c8 100644 --- a/src/test/run-pass/macros/type-macros-simple.rs +++ b/src/test/run-pass/macros/type-macros-simple.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] macro_rules! Tuple { { $A:ty,$B:ty } => { ($A, $B) } } diff --git a/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs b/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs index 31bf37ec0a9..43d70975a9a 100644 --- a/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs +++ b/src/test/run-pass/macros/typeck-macro-interaction-issue-8852.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum T { A(isize), diff --git a/src/test/run-pass/macros/use-macro-self.rs b/src/test/run-pass/macros/use-macro-self.rs index fb816f9e78f..65db1f1a306 100644 --- a/src/test/run-pass/macros/use-macro-self.rs +++ b/src/test/run-pass/macros/use-macro-self.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // aux-build:use-macro-self.rs #[macro_use] diff --git a/src/test/run-pass/methods/method-attributes.rs b/src/test/run-pass/methods/method-attributes.rs index b1afbd8d11c..cf61714608b 100644 --- a/src/test/run-pass/methods/method-attributes.rs +++ b/src/test/run-pass/methods/method-attributes.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] #![allow(non_camel_case_types)] // pp-exact - Make sure we print all the attributes diff --git a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs index a56e5b5170d..27064c792fe 100644 --- a/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs +++ b/src/test/run-pass/methods/method-normalize-bounds-issue-20604.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(stable_features)] // Test that we handle projection types which wind up important for diff --git a/src/test/run-pass/methods/method-recursive-blanket-impl.rs b/src/test/run-pass/methods/method-recursive-blanket-impl.rs index d1cd974070f..72ce7a1ac56 100644 --- a/src/test/run-pass/methods/method-recursive-blanket-impl.rs +++ b/src/test/run-pass/methods/method-recursive-blanket-impl.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] +#![allow(unused_imports)] // Test that we don't trigger on the blanket impl for all `&'a T` but // rather keep autoderefing and trigger on the underlying impl. To // know not to stop at the blanket, we have to recursively evaluate diff --git a/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs b/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs index 3fc2ce44eaa..8d8c7af724f 100644 --- a/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs +++ b/src/test/run-pass/mir/mir-typeck-normalize-fn-sig.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // This code was creating an ICE in the MIR type checker. The reason // is that we are reifying a reference to a function (`foo::<'x>`), // which involves extracting its signature, but we were not diff --git a/src/test/run-pass/mir/mir_build_match_comparisons.rs b/src/test/run-pass/mir/mir_build_match_comparisons.rs index 45ac6566637..f5a7362e4a9 100644 --- a/src/test/run-pass/mir/mir_build_match_comparisons.rs +++ b/src/test/run-pass/mir/mir_build_match_comparisons.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] fn test1(x: i8) -> i32 { match x { 1...10 => 0, diff --git a/src/test/run-pass/mir/mir_codegen_array.rs b/src/test/run-pass/mir/mir_codegen_array.rs index a0cd3c8dd12..ecbafef8c00 100644 --- a/src/test/run-pass/mir/mir_codegen_array.rs +++ b/src/test/run-pass/mir/mir_codegen_array.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] fn into_inner() -> [u64; 1024] { let mut x = 10 + 20; [x; 1024] diff --git a/src/test/run-pass/mir/mir_codegen_critical_edge.rs b/src/test/run-pass/mir/mir_codegen_critical_edge.rs index 48a5d6ab0f0..e22cead44f5 100644 --- a/src/test/run-pass/mir/mir_codegen_critical_edge.rs +++ b/src/test/run-pass/mir/mir_codegen_critical_edge.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // This code produces a CFG with critical edges that, if we don't // handle properly, will cause invalid codegen. diff --git a/src/test/run-pass/mir/mir_early_return_scope.rs b/src/test/run-pass/mir/mir_early_return_scope.rs index 27b90722328..af2f55ff650 100644 --- a/src/test/run-pass/mir/mir_early_return_scope.rs +++ b/src/test/run-pass/mir/mir_early_return_scope.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] static mut DROP: bool = false; struct ConnWrap(Conn); diff --git a/src/test/run-pass/mir/mir_fat_ptr_drop.rs b/src/test/run-pass/mir/mir_fat_ptr_drop.rs index 84528b3296a..a2063cd2b3a 100644 --- a/src/test/run-pass/mir/mir_fat_ptr_drop.rs +++ b/src/test/run-pass/mir/mir_fat_ptr_drop.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(stable_features)] // test that ordinary fat pointer operations work. diff --git a/src/test/run-pass/mir/mir_small_agg_arg.rs b/src/test/run-pass/mir/mir_small_agg_arg.rs index 48eae959b4e..fd81239daff 100644 --- a/src/test/run-pass/mir/mir_small_agg_arg.rs +++ b/src/test/run-pass/mir/mir_small_agg_arg.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] fn foo((x, y): (i8, i8)) { } diff --git a/src/test/run-pass/modules/mod_dir_path.rs b/src/test/run-pass/modules/mod_dir_path.rs index d614b2fb860..ff958f23f11 100644 --- a/src/test/run-pass/modules/mod_dir_path.rs +++ b/src/test/run-pass/modules/mod_dir_path.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_macros)] // ignore-pretty issue #37195 mod mod_dir_simple { diff --git a/src/test/run-pass/moves/move-1-unique.rs b/src/test/run-pass/moves/move-1-unique.rs index 1557f13b10d..5a0eefc20af 100644 --- a/src/test/run-pass/moves/move-1-unique.rs +++ b/src/test/run-pass/moves/move-1-unique.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![feature(box_syntax)] #[derive(Clone)] diff --git a/src/test/run-pass/moves/move-2-unique.rs b/src/test/run-pass/moves/move-2-unique.rs index 270a5990496..e62c7393551 100644 --- a/src/test/run-pass/moves/move-2-unique.rs +++ b/src/test/run-pass/moves/move-2-unique.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct X { x: isize, y: isize, z: isize } diff --git a/src/test/run-pass/moves/move-2.rs b/src/test/run-pass/moves/move-2.rs index 9207c71e083..caab86e584e 100644 --- a/src/test/run-pass/moves/move-2.rs +++ b/src/test/run-pass/moves/move-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct X { x: isize, y: isize, z: isize } diff --git a/src/test/run-pass/moves/move-3-unique.rs b/src/test/run-pass/moves/move-3-unique.rs index 6f86674104c..9247eac848a 100644 --- a/src/test/run-pass/moves/move-3-unique.rs +++ b/src/test/run-pass/moves/move-3-unique.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![feature(box_syntax)] #[derive(Clone)] diff --git a/src/test/run-pass/moves/move-4-unique.rs b/src/test/run-pass/moves/move-4-unique.rs index 0876f37fd2d..6d69b5ec946 100644 --- a/src/test/run-pass/moves/move-4-unique.rs +++ b/src/test/run-pass/moves/move-4-unique.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct Triple {a: isize, b: isize, c: isize} diff --git a/src/test/run-pass/moves/move-4.rs b/src/test/run-pass/moves/move-4.rs index 61dcc08805b..5edaffeb2c2 100644 --- a/src/test/run-pass/moves/move-4.rs +++ b/src/test/run-pass/moves/move-4.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct Triple { a: isize, b: isize, c: isize } diff --git a/src/test/run-pass/moves/move-scalar.rs b/src/test/run-pass/moves/move-scalar.rs index c72be92654c..f25741f355e 100644 --- a/src/test/run-pass/moves/move-scalar.rs +++ b/src/test/run-pass/moves/move-scalar.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] pub fn main() { diff --git a/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs b/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs index 857bf7ff260..333d6e4fd52 100644 --- a/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs +++ b/src/test/run-pass/moves/moves-based-on-type-capture-clause.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/nll/issue-48623-closure.rs b/src/test/run-pass/nll/issue-48623-closure.rs index 312aa6d577a..68c9c428b06 100644 --- a/src/test/run-pass/nll/issue-48623-closure.rs +++ b/src/test/run-pass/nll/issue-48623-closure.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(path_statements)] +#![allow(dead_code)] #![feature(nll)] diff --git a/src/test/run-pass/nll/issue-48623-generator.rs b/src/test/run-pass/nll/issue-48623-generator.rs index 24b25c4db16..b733545256f 100644 --- a/src/test/run-pass/nll/issue-48623-generator.rs +++ b/src/test/run-pass/nll/issue-48623-generator.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(path_statements)] +#![allow(dead_code)] #![feature(nll)] #![feature(generators, generator_trait)] diff --git a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs index 6d3653e7977..86ca2c8a495 100644 --- a/src/test/run-pass/numbers-arithmetic/num-wrapping.rs +++ b/src/test/run-pass/numbers-arithmetic/num-wrapping.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_macros)] // compile-flags: -C debug-assertions // diff --git a/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs b/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs index 2ed9032f86e..cb987c21a3c 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef-vtable.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::ops::Deref; diff --git a/src/test/run-pass/overloaded/overloaded-autoderef.rs b/src/test/run-pass/overloaded/overloaded-autoderef.rs index 7be57400da0..0c991247eb2 100644 --- a/src/test/run-pass/overloaded/overloaded-autoderef.rs +++ b/src/test/run-pass/overloaded/overloaded-autoderef.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(stable_features)] #![feature(box_syntax, core)] diff --git a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs index d092df32957..b5ed5cc37d9 100644 --- a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs +++ b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] // Test that we choose Deref or DerefMut appropriately based on mutability of ref bindings (#15609). use std::ops::{Deref, DerefMut}; diff --git a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs index 8f0b3356d07..ae405350ad0 100644 --- a/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs +++ b/src/test/run-pass/overloaded/overloaded_deref_with_ref_pattern_issue15609.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that we choose Deref or DerefMut appropriately based on mutability of ref bindings (#15609). fn main() { diff --git a/src/test/run-pass/packed/packed-struct-borrow-element.rs b/src/test/run-pass/packed/packed-struct-borrow-element.rs index 5d5bcbd325d..69969ba640f 100644 --- a/src/test/run-pass/packed/packed-struct-borrow-element.rs +++ b/src/test/run-pass/packed/packed-struct-borrow-element.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-emscripten weird assertion? #![feature(repr_packed)] diff --git a/src/test/run-pass/packed/packed-struct-generic-layout.rs b/src/test/run-pass/packed/packed-struct-generic-layout.rs index 30f7124f243..04544918171 100644 --- a/src/test/run-pass/packed/packed-struct-generic-layout.rs +++ b/src/test/run-pass/packed/packed-struct-generic-layout.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(overflowing_literals)] diff --git a/src/test/run-pass/packed/packed-struct-generic-size.rs b/src/test/run-pass/packed/packed-struct-generic-size.rs index 6df51f45729..58cd5505ffc 100644 --- a/src/test/run-pass/packed/packed-struct-generic-size.rs +++ b/src/test/run-pass/packed/packed-struct-generic-size.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(stable_features)] #![allow(unused_comparisons)] diff --git a/src/test/run-pass/packed/packed-struct-generic-size.stderr b/src/test/run-pass/packed/packed-struct-generic-size.stderr index f9c343b60b0..994ea7c44fb 100644 --- a/src/test/run-pass/packed/packed-struct-generic-size.stderr +++ b/src/test/run-pass/packed/packed-struct-generic-size.stderr @@ -1,35 +1,35 @@ warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:48:14 + --> $DIR/packed-struct-generic-size.rs:49:14 | LL | check!(P1::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:49:14 + --> $DIR/packed-struct-generic-size.rs:50:14 | LL | check!(P1::, 1, 11); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:51:14 + --> $DIR/packed-struct-generic-size.rs:52:14 | LL | check!(P2::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:52:14 + --> $DIR/packed-struct-generic-size.rs:53:14 | LL | check!(P2::, 2, 12); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:54:15 + --> $DIR/packed-struct-generic-size.rs:55:15 | LL | check!(P4C::, 1, 3); | ^^ try removing `::` warning: unnecessary path disambiguator - --> $DIR/packed-struct-generic-size.rs:55:15 + --> $DIR/packed-struct-generic-size.rs:56:15 | LL | check!(P4C::, 4, 12); | ^^ try removing `::` diff --git a/src/test/run-pass/packed/packed-struct-layout.rs b/src/test/run-pass/packed/packed-struct-layout.rs index 2c9216a96c2..6aa8770304a 100644 --- a/src/test/run-pass/packed/packed-struct-layout.rs +++ b/src/test/run-pass/packed/packed-struct-layout.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::mem; #[repr(packed)] diff --git a/src/test/run-pass/packed/packed-struct-size.rs b/src/test/run-pass/packed/packed-struct-size.rs index 85e7f1544a0..27e07b87ff4 100644 --- a/src/test/run-pass/packed/packed-struct-size.rs +++ b/src/test/run-pass/packed/packed-struct-size.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/packed/packed-tuple-struct-size.rs b/src/test/run-pass/packed/packed-tuple-struct-size.rs index b4e24925f75..011ff4c20f4 100644 --- a/src/test/run-pass/packed/packed-tuple-struct-size.rs +++ b/src/test/run-pass/packed/packed-tuple-struct-size.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![feature(repr_packed)] diff --git a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs index 5bff65d0cfa..5de5786d6a5 100644 --- a/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs +++ b/src/test/run-pass/panic-runtime/abort-link-to-unwinding-crates.rs @@ -9,7 +9,7 @@ // except according to those terms. // run-pass - +#![allow(unused_variables)] // compile-flags:-C panic=abort // aux-build:exit-success-if-unwind.rs // no-prefer-dynamic diff --git a/src/test/run-pass/panic-runtime/abort.rs b/src/test/run-pass/panic-runtime/abort.rs index 2275efa188e..621a258dc9d 100644 --- a/src/test/run-pass/panic-runtime/abort.rs +++ b/src/test/run-pass/panic-runtime/abort.rs @@ -9,7 +9,7 @@ // except according to those terms. // run-pass - +#![allow(unused_variables)] // compile-flags:-C panic=abort // no-prefer-dynamic // ignore-cloudabi no processes diff --git a/src/test/run-pass/panic-runtime/lto-abort.rs b/src/test/run-pass/panic-runtime/lto-abort.rs index 6e3dbe1d0f3..dd884b966bc 100644 --- a/src/test/run-pass/panic-runtime/lto-abort.rs +++ b/src/test/run-pass/panic-runtime/lto-abort.rs @@ -9,7 +9,7 @@ // except according to those terms. // run-pass - +#![allow(unused_variables)] // compile-flags:-C lto -C panic=abort // no-prefer-dynamic // ignore-cloudabi no processes diff --git a/src/test/run-pass/panic-runtime/lto-unwind.rs b/src/test/run-pass/panic-runtime/lto-unwind.rs index a0caa4e80c2..3b2a5dd7141 100644 --- a/src/test/run-pass/panic-runtime/lto-unwind.rs +++ b/src/test/run-pass/panic-runtime/lto-unwind.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // compile-flags:-C lto -C panic=unwind // no-prefer-dynamic diff --git a/src/test/run-pass/panics/panic-handler-set-twice.rs b/src/test/run-pass/panics/panic-handler-set-twice.rs index 340333b119e..1e493fc2bb4 100644 --- a/src/test/run-pass/panics/panic-handler-set-twice.rs +++ b/src/test/run-pass/panics/panic-handler-set-twice.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(stable_features)] #![feature(std_panic)] diff --git a/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs b/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs index f5dd2716d2c..bb115f92b90 100644 --- a/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs +++ b/src/test/run-pass/panics/panic-in-dtor-drops-fields.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] // ignore-emscripten no threads support diff --git a/src/test/run-pass/privacy/privacy1.rs b/src/test/run-pass/privacy/privacy1.rs index 7c1dbb500d8..703867713e6 100644 --- a/src/test/run-pass/privacy/privacy1.rs +++ b/src/test/run-pass/privacy/privacy1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub mod test2 { diff --git a/src/test/run-pass/privacy/private-class-field.rs b/src/test/run-pass/privacy/private-class-field.rs index 2910c462c2b..15d83ea4d95 100644 --- a/src/test/run-pass/privacy/private-class-field.rs +++ b/src/test/run-pass/privacy/private-class-field.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/privacy/private-method.rs b/src/test/run-pass/privacy/private-method.rs index a0f012a6059..012616403c6 100644 --- a/src/test/run-pass/privacy/private-method.rs +++ b/src/test/run-pass/privacy/private-method.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/process/process-exit.rs b/src/test/run-pass/process/process-exit.rs index e43631e3189..6314dc2cd64 100644 --- a/src/test/run-pass/process/process-exit.rs +++ b/src/test/run-pass/process/process-exit.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // ignore-cloudabi no processes // ignore-emscripten no processes diff --git a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs index 770733b8939..8bd66b90d58 100644 --- a/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs +++ b/src/test/run-pass/regions/regions-addr-of-interior-of-unique-box.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs index a7801136a84..6a9a2535220 100644 --- a/src/test/run-pass/regions/regions-assoc-type-region-bound.rs +++ b/src/test/run-pass/regions/regions-assoc-type-region-bound.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that the compiler considers the 'a bound declared in the // trait. Issue #20890. diff --git a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs index b81d3056813..e0bb62b8929 100644 --- a/src/test/run-pass/regions/regions-assoc-type-static-bound.rs +++ b/src/test/run-pass/regions/regions-assoc-type-static-bound.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that the compiler considers the 'static bound declared in the // trait. Issue #20890. diff --git a/src/test/run-pass/regions/regions-bot.rs b/src/test/run-pass/regions/regions-bot.rs index d3af66b4162..3d1ac6277f7 100644 --- a/src/test/run-pass/regions/regions-bot.rs +++ b/src/test/run-pass/regions/regions-bot.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // A very limited test of the "bottom" region diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs index d5d2408d5d2..568b8eed4f3 100644 --- a/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(stable_features)] #![feature(issue_5723_bootstrap)] diff --git a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs index 50073f8b9f0..f2785992564 100644 --- a/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs +++ b/src/test/run-pass/regions/regions-bound-lists-feature-gate.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(stable_features)] #![feature(issue_5723_bootstrap)] diff --git a/src/test/run-pass/regions/regions-creating-enums2.rs b/src/test/run-pass/regions/regions-creating-enums2.rs index 84d4a261f1d..51fdc2dc00e 100644 --- a/src/test/run-pass/regions/regions-creating-enums2.rs +++ b/src/test/run-pass/regions/regions-creating-enums2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-creating-enums5.rs b/src/test/run-pass/regions/regions-creating-enums5.rs index 24ba0c17611..637748ebec8 100644 --- a/src/test/run-pass/regions/regions-creating-enums5.rs +++ b/src/test/run-pass/regions/regions-creating-enums5.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-debruijn-of-object.rs b/src/test/run-pass/regions/regions-debruijn-of-object.rs index 71464f30ef0..100fd423cd4 100644 --- a/src/test/run-pass/regions/regions-debruijn-of-object.rs +++ b/src/test/run-pass/regions/regions-debruijn-of-object.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs index 77659c100ff..72c4dc37710 100644 --- a/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs +++ b/src/test/run-pass/regions/regions-early-bound-lifetime-in-assoc-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // Test that we are able to compile calls to associated fns like // `decode()` where the bound on the `Self` parameter references a // lifetime parameter of the trait. This example indicates why trait diff --git a/src/test/run-pass/regions/regions-expl-self.rs b/src/test/run-pass/regions/regions-expl-self.rs index 1af6febb53a..d19e7b6c7b5 100644 --- a/src/test/run-pass/regions/regions-expl-self.rs +++ b/src/test/run-pass/regions/regions-expl-self.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that you can insert an explicit lifetime in explicit self. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-fn-subtyping-2.rs b/src/test/run-pass/regions/regions-fn-subtyping-2.rs index a23c5005f07..1f9f7baf48b 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping-2.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue #2263. // Here, `f` is a function that takes a pointer `x` and a function diff --git a/src/test/run-pass/regions/regions-fn-subtyping.rs b/src/test/run-pass/regions/regions-fn-subtyping.rs index e561fa74346..0192890277b 100644 --- a/src/test/run-pass/regions/regions-fn-subtyping.rs +++ b/src/test/run-pass/regions/regions-fn-subtyping.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] // Issue #2263. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs b/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs index 67a77940742..bc316983f82 100644 --- a/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs +++ b/src/test/run-pass/regions/regions-free-region-outlives-static-outlives-free-region.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that we recognize that if you have // // 'a : 'static diff --git a/src/test/run-pass/regions/regions-infer-borrow-scope.rs b/src/test/run-pass/regions/regions-infer-borrow-scope.rs index f3660d8dd17..6bc2c62c6dc 100644 --- a/src/test/run-pass/regions/regions-infer-borrow-scope.rs +++ b/src/test/run-pass/regions/regions-infer-borrow-scope.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] struct Point {x: isize, y: isize} diff --git a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs index f6ed97195c1..0608802e682 100644 --- a/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs +++ b/src/test/run-pass/regions/regions-infer-reborrow-ref-mut-recurse.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test an edge case in region inference: the lifetime of the borrow // of `*x` must be extended to at least 'a. diff --git a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs index 7af25be1d03..4eeeac1767c 100644 --- a/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs +++ b/src/test/run-pass/regions/regions-infer-region-in-fn-but-not-type.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/regions/regions-issue-22246.rs b/src/test/run-pass/regions/regions-issue-22246.rs index 8a54f30133e..3b7cc8e3775 100644 --- a/src/test/run-pass/regions/regions-issue-22246.rs +++ b/src/test/run-pass/regions/regions-issue-22246.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // Regression test for issue #22246 -- we should be able to deduce // that `&'a B::Owned` implies that `B::Owned : 'a`. diff --git a/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs b/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs index 758473634cb..2f0de4f4784 100644 --- a/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs +++ b/src/test/run-pass/regions/regions-lifetime-static-items-enclosing-scopes.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // This test verifies that temporary lifetime is correctly computed // for static objects in enclosing scopes. diff --git a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs index 907746a65ee..110bc2f1fd3 100644 --- a/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs +++ b/src/test/run-pass/regions/regions-lub-ref-ref-rc.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test a corner case of LUB coercion. In this case, one arm of the // match requires a deref coercion and the other doesn't, and there // is an extra `&` on the `rc`. We want to be sure that the lifetime diff --git a/src/test/run-pass/regions/regions-mock-codegen.rs b/src/test/run-pass/regions/regions-mock-codegen.rs index 6d521432849..2393457409e 100644 --- a/src/test/run-pass/regions/regions-mock-codegen.rs +++ b/src/test/run-pass/regions/regions-mock-codegen.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs b/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs index 3d0d5f2dbcf..e409e43297f 100644 --- a/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs +++ b/src/test/run-pass/regions/regions-no-variance-from-fn-generics.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Issue #12856: a lifetime formal binding introduced by a generic fn // should not upset the variance inference for actual occurrences of // that lifetime in type expressions. diff --git a/src/test/run-pass/regions/regions-nullary-variant.rs b/src/test/run-pass/regions/regions-nullary-variant.rs index b24e2496350..bde2cf1c082 100644 --- a/src/test/run-pass/regions/regions-nullary-variant.rs +++ b/src/test/run-pass/regions/regions-nullary-variant.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/regions/regions-params.rs b/src/test/run-pass/regions/regions-params.rs index b7060cb2b94..81e26e0444e 100644 --- a/src/test/run-pass/regions/regions-params.rs +++ b/src/test/run-pass/regions/regions-params.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_parens)] fn region_identity(x: &usize) -> &usize { x } diff --git a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs index 0a30dcb721f..39dc92cbd7b 100644 --- a/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs +++ b/src/test/run-pass/regions/regions-reassign-let-bound-pointer.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] // Check that the type checker permits us to reassign `z` which // started out with a longer lifetime and was reassigned to a shorter // one (it should infer to be the intersection). diff --git a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs index 28455b1f3cf..329efaf5555 100644 --- a/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs +++ b/src/test/run-pass/regions/regions-reassign-match-bound-pointer.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] +#![allow(unused_variables)] // Check that the type checker permits us to reassign `z` which // started out with a longer lifetime and was reassigned to a shorter // one (it should infer to be the intersection). diff --git a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs index 86d84172629..1b6c025d7fa 100644 --- a/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs +++ b/src/test/run-pass/regions/regions-relate-bound-regions-on-closures-to-inference-variables.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that this fairly specialized, but also reasonable, pattern // typechecks. The pattern involves regions bound in closures that // wind up related to inference variables. diff --git a/src/test/run-pass/regions/regions-scope-chain-example.rs b/src/test/run-pass/regions/regions-scope-chain-example.rs index 973f7bd5319..ccfa080d216 100644 --- a/src/test/run-pass/regions/regions-scope-chain-example.rs +++ b/src/test/run-pass/regions/regions-scope-chain-example.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // This is an example where the older inference algorithm failed. The // specifics of why it failed are somewhat, but not entirely, tailed // to the algorithm. Ultimately the problem is that when computing the diff --git a/src/test/run-pass/regions/regions-self-in-enums.rs b/src/test/run-pass/regions/regions-self-in-enums.rs index 5cb9ad7774c..61160951000 100644 --- a/src/test/run-pass/regions/regions-self-in-enums.rs +++ b/src/test/run-pass/regions/regions-self-in-enums.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![allow(non_camel_case_types)] enum int_wrapper<'a> { diff --git a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs index ffab7dc2e41..de19fbd0e8c 100644 --- a/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs +++ b/src/test/run-pass/regions/regions-variance-contravariant-use-contravariant.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that a type which is contravariant with respect to its region // parameter compiles successfully when used in a contravariant way. // diff --git a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs index ea0051c6b26..fb20324ce97 100644 --- a/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs +++ b/src/test/run-pass/regions/regions-variance-covariant-use-covariant.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test that a type which is covariant with respect to its region // parameter is successful when used in a covariant way. // diff --git a/src/test/run-pass/rfcs/rfc-1014-2.rs b/src/test/run-pass/rfcs/rfc-1014-2.rs index f0ff8561243..7fbc0d1db70 100644 --- a/src/test/run-pass/rfcs/rfc-1014-2.rs +++ b/src/test/run-pass/rfcs/rfc-1014-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(libc)] diff --git a/src/test/run-pass/rfcs/rfc-1014.rs b/src/test/run-pass/rfcs/rfc-1014.rs index 35290ae8e6a..d101c3c9ab1 100644 --- a/src/test/run-pass/rfcs/rfc-1014.rs +++ b/src/test/run-pass/rfcs/rfc-1014.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-cloudabi stdout does not map to file descriptor 1 by default // ignore-wasm32-bare no libc diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs index f0ef9ca37b3..8d67e235a93 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/box.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unreachable_patterns)] #![feature(box_syntax, box_patterns)] struct Foo{} diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs index 2aad9ccd6ef..6244daab1e6 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/general.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] fn some_or_wildcard(r: &Option, b: &i32) { let _: &i32 = match r { Some(a) => a, diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs index ac6f61b32b7..9df250ea399 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/lit.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] fn with_u8() { let s = 5u8; let r = match &s { diff --git a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs index 072332cd9d0..9427482ed9c 100644 --- a/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs +++ b/src/test/run-pass/rfcs/rfc-2005-default-binding-mode/tuple-struct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum Foo { Bar(Option, (), (), Vec), Baz, diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs index 2bfdddc8eb7..34756677636 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // aux-build:structs.rs extern crate structs; diff --git a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs index 6c71c05709c..4bbd9e2b7fa 100644 --- a/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs +++ b/src/test/run-pass/rfcs/rfc-2008-non-exhaustive/structs_same_crate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![feature(non_exhaustive)] #[non_exhaustive] diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs index 71904acae72..612f5bc0cfc 100644 --- a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-absolute.rs @@ -10,7 +10,7 @@ // run-pass #![feature(crate_in_paths)] - +#![allow(dead_code)] use crate::m::f; use crate as root; diff --git a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs index 37821777822..fc77d744a23 100644 --- a/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs +++ b/src/test/run-pass/rfcs/rfc-2126-crate-paths/crate-path-visibility-ambiguity.rs @@ -11,7 +11,7 @@ // run-pass #![feature(crate_in_paths)] #![feature(crate_visibility_modifier)] - +#![allow(dead_code)] mod m { pub struct Z; pub struct S1(crate (::m::Z)); // OK diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs index b13602297a4..61cf6dcf30c 100644 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/basic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:xcrate.rs // compile-flags:--extern xcrate // edition:2018 diff --git a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs index 0d84ccc3d32..e25f76ab48e 100644 --- a/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs +++ b/src/test/run-pass/rfcs/rfc-2126-extern-absolute-paths/extern.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:xcrate.rs // compile-flags:--extern xcrate diff --git a/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs b/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs index 29e8ab8ed1f..f9d1ee0e9e0 100644 --- a/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs +++ b/src/test/run-pass/rfcs/rfc-2175-or-if-while-let/basic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(if_while_or_patterns)] enum E { diff --git a/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs b/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs index 755e3cb8c3b..a6046cdba94 100644 --- a/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs +++ b/src/test/run-pass/rfcs/rfc-2421-unreserve-pure-offsetof-sizeof-alignof.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that removed keywords are allowed as identifiers. fn main () { let offsetof = (); diff --git a/src/test/run-pass/rfcs/rfc1623.rs b/src/test/run-pass/rfcs/rfc1623.rs index ddb83317fd9..cc085a6f367 100644 --- a/src/test/run-pass/rfcs/rfc1623.rs +++ b/src/test/run-pass/rfcs/rfc1623.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(non_upper_case_globals)] #![allow(dead_code)] diff --git a/src/test/run-pass/self/explicit-self-closures.rs b/src/test/run-pass/self/explicit-self-closures.rs index 0144433010f..04e40021a5f 100644 --- a/src/test/run-pass/self/explicit-self-closures.rs +++ b/src/test/run-pass/self/explicit-self-closures.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test to make sure that explicit self params work inside closures // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/self/explicit-self-generic.rs b/src/test/run-pass/self/explicit-self-generic.rs index cf1546810a4..d23ad94f1f5 100644 --- a/src/test/run-pass/self/explicit-self-generic.rs +++ b/src/test/run-pass/self/explicit-self-generic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] #[derive(Copy, Clone)] diff --git a/src/test/run-pass/self/explicit-self.rs b/src/test/run-pass/self/explicit-self.rs index 862d02bda0c..1cf38a384ca 100644 --- a/src/test/run-pass/self/explicit-self.rs +++ b/src/test/run-pass/self/explicit-self.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] diff --git a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs index 2ea1dcb221e..42ed4f91e73 100644 --- a/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs +++ b/src/test/run-pass/self/object-safety-sized-self-by-value-self.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // Check that a trait is still object-safe (and usable) if it has // methods with by-value self so long as they require `Self : Sized`. diff --git a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs index 5f8ae3ce495..218a36f2226 100644 --- a/src/test/run-pass/self/object-safety-sized-self-generic-method.rs +++ b/src/test/run-pass/self/object-safety-sized-self-generic-method.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Check that a trait is still object-safe (and usable) if it has // generic methods so long as they require `Self : Sized`. diff --git a/src/test/run-pass/self/self-impl.rs b/src/test/run-pass/self/self-impl.rs index c0a7eee437c..465ca467859 100644 --- a/src/test/run-pass/self/self-impl.rs +++ b/src/test/run-pass/self/self-impl.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that we can use `Self` types in impls in the expected way. // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/self/self-type-param.rs b/src/test/run-pass/self/self-type-param.rs index 13e28e62e5e..645d61d79c8 100644 --- a/src/test/run-pass/self/self-type-param.rs +++ b/src/test/run-pass/self/self-type-param.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 trait MyTrait { diff --git a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs index 96993d3a7be..8241711bc12 100644 --- a/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs +++ b/src/test/run-pass/sepcomp/sepcomp-fns-backwards.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-bitrig // compile-flags: -C codegen-units=3 diff --git a/src/test/run-pass/sepcomp/sepcomp-statics.rs b/src/test/run-pass/sepcomp/sepcomp-statics.rs index 7022a5eee71..8739b9f52de 100644 --- a/src/test/run-pass/sepcomp/sepcomp-statics.rs +++ b/src/test/run-pass/sepcomp/sepcomp-statics.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-bitrig // compile-flags: -C codegen-units=3 diff --git a/src/test/run-pass/sepcomp/sepcomp-unwind.rs b/src/test/run-pass/sepcomp/sepcomp-unwind.rs index 15b07653224..7a1642bcb29 100644 --- a/src/test/run-pass/sepcomp/sepcomp-unwind.rs +++ b/src/test/run-pass/sepcomp/sepcomp-unwind.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-bitrig // compile-flags: -C codegen-units=3 // ignore-emscripten no threads support diff --git a/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs b/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs index e24a141e6e0..f0fb24b5832 100644 --- a/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs +++ b/src/test/run-pass/simd/simd-intrinsic-generic-cast.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten FIXME(#45351) hits an LLVM assert #![feature(repr_simd, platform_intrinsics, concat_idents, test)] diff --git a/src/test/run-pass/simd/simd-type.rs b/src/test/run-pass/simd/simd-type.rs index a1a655eec86..3be3960e7ce 100644 --- a/src/test/run-pass/simd/simd-type.rs +++ b/src/test/run-pass/simd/simd-type.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs index 4a481beffd2..941bc55a585 100644 --- a/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs +++ b/src/test/run-pass/specialization/defaultimpl/allowed-cross-crate.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_imports)] // aux-build:go_trait.rs diff --git a/src/test/run-pass/specialization/defaultimpl/projection.rs b/src/test/run-pass/specialization/defaultimpl/projection.rs index 989f4f286f2..9d8d99e9ca3 100644 --- a/src/test/run-pass/specialization/defaultimpl/projection.rs +++ b/src/test/run-pass/specialization/defaultimpl/projection.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs b/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs index 4a481beffd2..941bc55a585 100644 --- a/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs +++ b/src/test/run-pass/specialization/specialization-allowed-cross-crate.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] +#![allow(unused_imports)] // aux-build:go_trait.rs diff --git a/src/test/run-pass/specialization/specialization-on-projection.rs b/src/test/run-pass/specialization/specialization-on-projection.rs index 39af761fd48..01ec184d6f5 100644 --- a/src/test/run-pass/specialization/specialization-on-projection.rs +++ b/src/test/run-pass/specialization/specialization-on-projection.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-projection-alias.rs b/src/test/run-pass/specialization/specialization-projection-alias.rs index f2f10765344..8d5e732397f 100644 --- a/src/test/run-pass/specialization/specialization-projection-alias.rs +++ b/src/test/run-pass/specialization/specialization-projection-alias.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![feature(specialization)] diff --git a/src/test/run-pass/specialization/specialization-projection.rs b/src/test/run-pass/specialization/specialization-projection.rs index 2bed94ccbc1..ba9051e0061 100644 --- a/src/test/run-pass/specialization/specialization-projection.rs +++ b/src/test/run-pass/specialization/specialization-projection.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(specialization)] diff --git a/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs b/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs index e70984df37e..2c5b514df6e 100644 --- a/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs +++ b/src/test/run-pass/statics/static-method-in-trait-with-tps-intracrate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Deserializer { fn read_int(&self) -> isize; diff --git a/src/test/run-pass/structs-enums/align-struct.rs b/src/test/run-pass/structs-enums/align-struct.rs index 122734e817a..a0d05a6d0d2 100644 --- a/src/test/run-pass/structs-enums/align-struct.rs +++ b/src/test/run-pass/structs-enums/align-struct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(box_syntax)] #![feature(repr_packed)] diff --git a/src/test/run-pass/structs-enums/class-attributes-1.rs b/src/test/run-pass/structs-enums/class-attributes-1.rs index c5926bc1586..bdacb40911b 100644 --- a/src/test/run-pass/structs-enums/class-attributes-1.rs +++ b/src/test/run-pass/structs-enums/class-attributes-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] #![allow(non_camel_case_types)] // pp-exact - Make sure we actually print the attributes diff --git a/src/test/run-pass/structs-enums/class-attributes-2.rs b/src/test/run-pass/structs-enums/class-attributes-2.rs index f9d88de145a..d17601d44ad 100644 --- a/src/test/run-pass/structs-enums/class-attributes-2.rs +++ b/src/test/run-pass/structs-enums/class-attributes-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_attributes)] #![allow(non_camel_case_types)] #![feature(custom_attribute)] diff --git a/src/test/run-pass/structs-enums/class-cast-to-trait.rs b/src/test/run-pass/structs-enums/class-cast-to-trait.rs index 695318d0ee7..517dad17d1f 100644 --- a/src/test/run-pass/structs-enums/class-cast-to-trait.rs +++ b/src/test/run-pass/structs-enums/class-cast-to-trait.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] #![allow(non_camel_case_types)] // ignore-freebsd FIXME fails on BSD diff --git a/src/test/run-pass/structs-enums/class-dtor.rs b/src/test/run-pass/structs-enums/class-dtor.rs index 13559906795..bd5fd86cefc 100644 --- a/src/test/run-pass/structs-enums/class-dtor.rs +++ b/src/test/run-pass/structs-enums/class-dtor.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/class-exports.rs b/src/test/run-pass/structs-enums/class-exports.rs index b4bce42e647..6f9c609fa45 100644 --- a/src/test/run-pass/structs-enums/class-exports.rs +++ b/src/test/run-pass/structs-enums/class-exports.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] /* Test that exporting a class also exports its diff --git a/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs b/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs index 6ceaab93e79..deb31c9e053 100644 --- a/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs +++ b/src/test/run-pass/structs-enums/class-impl-very-parameterized-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] use std::cmp; diff --git a/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs b/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs index 4f319cf8ea4..3b09ebec256 100644 --- a/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs +++ b/src/test/run-pass/structs-enums/class-implement-trait-cross-crate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // aux-build:cci_class_trait.rs diff --git a/src/test/run-pass/structs-enums/class-poly-methods.rs b/src/test/run-pass/structs-enums/class-poly-methods.rs index e32ba9d0239..693a6e829b6 100644 --- a/src/test/run-pass/structs-enums/class-poly-methods.rs +++ b/src/test/run-pass/structs-enums/class-poly-methods.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/class-separate-impl.rs b/src/test/run-pass/structs-enums/class-separate-impl.rs index a1c9afaa634..c482992f7bd 100644 --- a/src/test/run-pass/structs-enums/class-separate-impl.rs +++ b/src/test/run-pass/structs-enums/class-separate-impl.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/structs-enums/class-str-field.rs b/src/test/run-pass/structs-enums/class-str-field.rs index 5ad60dfd6d9..57ec91c9d33 100644 --- a/src/test/run-pass/structs-enums/class-str-field.rs +++ b/src/test/run-pass/structs-enums/class-str-field.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/class-typarams.rs b/src/test/run-pass/structs-enums/class-typarams.rs index d3b4083f843..3d9dafc6f73 100644 --- a/src/test/run-pass/structs-enums/class-typarams.rs +++ b/src/test/run-pass/structs-enums/class-typarams.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/classes-self-referential.rs b/src/test/run-pass/structs-enums/classes-self-referential.rs index 49016d14b9d..3f0e912e2ad 100644 --- a/src/test/run-pass/structs-enums/classes-self-referential.rs +++ b/src/test/run-pass/structs-enums/classes-self-referential.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/classes-simple-method.rs b/src/test/run-pass/structs-enums/classes-simple-method.rs index 6eaf8939dcc..48a7d58300c 100644 --- a/src/test/run-pass/structs-enums/classes-simple-method.rs +++ b/src/test/run-pass/structs-enums/classes-simple-method.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] struct cat { diff --git a/src/test/run-pass/structs-enums/classes-simple.rs b/src/test/run-pass/structs-enums/classes-simple.rs index 771943802aa..c53f135c0e0 100644 --- a/src/test/run-pass/structs-enums/classes-simple.rs +++ b/src/test/run-pass/structs-enums/classes-simple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] struct cat { diff --git a/src/test/run-pass/structs-enums/classes.rs b/src/test/run-pass/structs-enums/classes.rs index f40fe3e8186..0f9b5b1d7f4 100644 --- a/src/test/run-pass/structs-enums/classes.rs +++ b/src/test/run-pass/structs-enums/classes.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] struct cat { diff --git a/src/test/run-pass/structs-enums/empty-struct-braces.rs b/src/test/run-pass/structs-enums/empty-struct-braces.rs index 7deb90cc3e8..aebd1b70c3c 100644 --- a/src/test/run-pass/structs-enums/empty-struct-braces.rs +++ b/src/test/run-pass/structs-enums/empty-struct-braces.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(non_upper_case_globals)] // Empty struct defined with braces add names into type namespace diff --git a/src/test/run-pass/structs-enums/enum-alignment.rs b/src/test/run-pass/structs-enums/enum-alignment.rs index 862025ea934..60bfe151b7e 100644 --- a/src/test/run-pass/structs-enums/enum-alignment.rs +++ b/src/test/run-pass/structs-enums/enum-alignment.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(deprecated)] use std::mem; diff --git a/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs b/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs index 838db705817..ea63b35e59f 100644 --- a/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs +++ b/src/test/run-pass/structs-enums/enum-clike-ffi-as-int.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] /*! * C-like enums have to be represented as LLVM ints, not wrapped in a diff --git a/src/test/run-pass/structs-enums/enum-discr.rs b/src/test/run-pass/structs-enums/enum-discr.rs index 0962f41f78d..e1e1d6dfeec 100644 --- a/src/test/run-pass/structs-enums/enum-discr.rs +++ b/src/test/run-pass/structs-enums/enum-discr.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] enum Animal { Cat = 0, diff --git a/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs b/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs index 55bf80138b9..f9a375d74e9 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-autosizing.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(overflowing_literals)] use std::mem::size_of; diff --git a/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs b/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs index b4f8b5427e0..54bc6506a4b 100644 --- a/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs +++ b/src/test/run-pass/structs-enums/enum-discrim-manual-sizing.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::mem::{size_of, align_of}; diff --git a/src/test/run-pass/structs-enums/enum-export-inheritance.rs b/src/test/run-pass/structs-enums/enum-export-inheritance.rs index 050479d28dc..d68073711b0 100644 --- a/src/test/run-pass/structs-enums/enum-export-inheritance.rs +++ b/src/test/run-pass/structs-enums/enum-export-inheritance.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 mod a { diff --git a/src/test/run-pass/structs-enums/enum-variants.rs b/src/test/run-pass/structs-enums/enum-variants.rs index 1eff9ad413d..4e9b51fdd0c 100644 --- a/src/test/run-pass/structs-enums/enum-variants.rs +++ b/src/test/run-pass/structs-enums/enum-variants.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_assignments)] // pretty-expanded FIXME #23616 #![allow(unused_variables)] diff --git a/src/test/run-pass/structs-enums/field-destruction-order.rs b/src/test/run-pass/structs-enums/field-destruction-order.rs index 5b9d1530321..5b7b60ff61f 100644 --- a/src/test/run-pass/structs-enums/field-destruction-order.rs +++ b/src/test/run-pass/structs-enums/field-destruction-order.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_upper_case_globals)] // In theory, it doesn't matter what order destructors are run in for rust diff --git a/src/test/run-pass/structs-enums/foreign-struct.rs b/src/test/run-pass/structs-enums/foreign-struct.rs index 1e4955bd5ec..47ad6232152 100644 --- a/src/test/run-pass/structs-enums/foreign-struct.rs +++ b/src/test/run-pass/structs-enums/foreign-struct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // Passing enums by value diff --git a/src/test/run-pass/structs-enums/ivec-tag.rs b/src/test/run-pass/structs-enums/ivec-tag.rs index fb7585f9989..b94260f9128 100644 --- a/src/test/run-pass/structs-enums/ivec-tag.rs +++ b/src/test/run-pass/structs-enums/ivec-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs index 1185519dac6..b98772dcf79 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-emulate-flat.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub use Foo::*; diff --git a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs index 85af2f0d9d6..4d0524e306d 100644 --- a/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs +++ b/src/test/run-pass/structs-enums/namespaced-enum-glob-import.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 mod m2 { diff --git a/src/test/run-pass/structs-enums/namespaced-enums.rs b/src/test/run-pass/structs-enums/namespaced-enums.rs index 05a4c190712..79235525a53 100644 --- a/src/test/run-pass/structs-enums/namespaced-enums.rs +++ b/src/test/run-pass/structs-enums/namespaced-enums.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 enum Foo { diff --git a/src/test/run-pass/structs-enums/nested-enum-same-names.rs b/src/test/run-pass/structs-enums/nested-enum-same-names.rs index 6e294b27abf..8a63b990030 100644 --- a/src/test/run-pass/structs-enums/nested-enum-same-names.rs +++ b/src/test/run-pass/structs-enums/nested-enum-same-names.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 /* diff --git a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs index 6bdf69478ae..c42958aa7e1 100644 --- a/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs +++ b/src/test/run-pass/structs-enums/newtype-struct-with-dtor.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_unsafe)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 pub struct Fd(u32); diff --git a/src/test/run-pass/structs-enums/nonzero-enum.rs b/src/test/run-pass/structs-enums/nonzero-enum.rs index 7a6afec4e6d..83bc5c25de3 100644 --- a/src/test/run-pass/structs-enums/nonzero-enum.rs +++ b/src/test/run-pass/structs-enums/nonzero-enum.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::mem::size_of; enum E { diff --git a/src/test/run-pass/structs-enums/rec-align-u32.rs b/src/test/run-pass/structs-enums/rec-align-u32.rs index e2c960b89cb..c82d449391a 100644 --- a/src/test/run-pass/structs-enums/rec-align-u32.rs +++ b/src/test/run-pass/structs-enums/rec-align-u32.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_unsafe)] // Issue #2303 #![feature(intrinsics)] diff --git a/src/test/run-pass/structs-enums/rec-align-u64.rs b/src/test/run-pass/structs-enums/rec-align-u64.rs index 6fe3aefaef5..3315232ec84 100644 --- a/src/test/run-pass/structs-enums/rec-align-u64.rs +++ b/src/test/run-pass/structs-enums/rec-align-u64.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_unsafe)] // ignore-wasm32-bare seems unimportant to test // Issue #2303 diff --git a/src/test/run-pass/structs-enums/simple-generic-tag.rs b/src/test/run-pass/structs-enums/simple-generic-tag.rs index be73224c7ec..a4ef3b0732f 100644 --- a/src/test/run-pass/structs-enums/simple-generic-tag.rs +++ b/src/test/run-pass/structs-enums/simple-generic-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/simple-match-generic-tag.rs b/src/test/run-pass/structs-enums/simple-match-generic-tag.rs index 7093ba5138d..054f8ce074b 100644 --- a/src/test/run-pass/structs-enums/simple-match-generic-tag.rs +++ b/src/test/run-pass/structs-enums/simple-match-generic-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] enum opt { none, some(T) } diff --git a/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs b/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs index b20173574cc..38a2ebdabc9 100644 --- a/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs +++ b/src/test/run-pass/structs-enums/struct-aliases-xcrate.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![allow(non_shorthand_field_patterns)] // aux-build:xcrate_struct_aliases.rs diff --git a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs index a970c1b0d78..6ed6035caf0 100644 --- a/src/test/run-pass/structs-enums/struct-like-variant-construct.rs +++ b/src/test/run-pass/structs-enums/struct-like-variant-construct.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 enum Foo { diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs index 1e674cb8970..989da3cdd6e 100644 --- a/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct S { f0: String, f1: isize } diff --git a/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs b/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs index c054f31beae..1b0d19db591 100644 --- a/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs +++ b/src/test/run-pass/structs-enums/struct-order-of-eval-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct S { f0: String, diff --git a/src/test/run-pass/structs-enums/struct-path-associated-type.rs b/src/test/run-pass/structs-enums/struct-path-associated-type.rs index 868be134121..89fa79c85e6 100644 --- a/src/test/run-pass/structs-enums/struct-path-associated-type.rs +++ b/src/test/run-pass/structs-enums/struct-path-associated-type.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] struct S { a: T, b: U, diff --git a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs index 4b7854145f0..206ff2ad13d 100644 --- a/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs +++ b/src/test/run-pass/structs-enums/struct-variant-field-visibility.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 mod foo { diff --git a/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs b/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs index a7f7841fac8..39b40695825 100644 --- a/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs +++ b/src/test/run-pass/structs-enums/tag-align-dyn-u64.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(deprecated)] use std::mem; diff --git a/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs b/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs index cbba62d156b..f25321ef7b1 100644 --- a/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs +++ b/src/test/run-pass/structs-enums/tag-align-dyn-variants.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(deprecated)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/structs-enums/tag-align-u64.rs b/src/test/run-pass/structs-enums/tag-align-u64.rs index 9f6349a23ad..e2f7ffe2768 100644 --- a/src/test/run-pass/structs-enums/tag-align-u64.rs +++ b/src/test/run-pass/structs-enums/tag-align-u64.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(deprecated)] use std::mem; diff --git a/src/test/run-pass/structs-enums/tag-disr-val-shape.rs b/src/test/run-pass/structs-enums/tag-disr-val-shape.rs index bfc3213a040..0f6197f14d5 100644 --- a/src/test/run-pass/structs-enums/tag-disr-val-shape.rs +++ b/src/test/run-pass/structs-enums/tag-disr-val-shape.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #[derive(Debug)] diff --git a/src/test/run-pass/structs-enums/tag-exports.rs b/src/test/run-pass/structs-enums/tag-exports.rs index d0eea7bdcd2..c93183cff4d 100644 --- a/src/test/run-pass/structs-enums/tag-exports.rs +++ b/src/test/run-pass/structs-enums/tag-exports.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/tag-in-block.rs b/src/test/run-pass/structs-enums/tag-in-block.rs index db9b2c3b60c..e3a39fe2480 100644 --- a/src/test/run-pass/structs-enums/tag-in-block.rs +++ b/src/test/run-pass/structs-enums/tag-in-block.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs index 085d0bc1fdc..ca3021b2136 100644 --- a/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs +++ b/src/test/run-pass/structs-enums/tag-variant-disr-type-mismatch.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/structs-enums/tag.rs b/src/test/run-pass/structs-enums/tag.rs index bd28320ffb6..d2b0d9dac0a 100644 --- a/src/test/run-pass/structs-enums/tag.rs +++ b/src/test/run-pass/structs-enums/tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_parens)] #![allow(non_camel_case_types)] diff --git a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs index d77d9c7e163..bbf810abb9f 100644 --- a/src/test/run-pass/structs-enums/tuple-struct-trivial.rs +++ b/src/test/run-pass/structs-enums/tuple-struct-trivial.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 struct Foo(isize, isize, isize); diff --git a/src/test/run-pass/structs-enums/variant-structs-trivial.rs b/src/test/run-pass/structs-enums/variant-structs-trivial.rs index 9cef1c83476..7aaaef94347 100644 --- a/src/test/run-pass/structs-enums/variant-structs-trivial.rs +++ b/src/test/run-pass/structs-enums/variant-structs-trivial.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 enum Foo { diff --git a/src/test/run-pass/threads-sendsync/comm.rs b/src/test/run-pass/threads-sendsync/comm.rs index 7a8e27ca20b..b4654b553a4 100644 --- a/src/test/run-pass/threads-sendsync/comm.rs +++ b/src/test/run-pass/threads-sendsync/comm.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs b/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs index 00a7acfa94f..58abd373f0a 100644 --- a/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs +++ b/src/test/run-pass/threads-sendsync/send-is-not-static-par-for.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] use std::thread; use std::sync::Mutex; diff --git a/src/test/run-pass/threads-sendsync/send-resource.rs b/src/test/run-pass/threads-sendsync/send-resource.rs index be671084c84..a03a3f50c51 100644 --- a/src/test/run-pass/threads-sendsync/send-resource.rs +++ b/src/test/run-pass/threads-sendsync/send-resource.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/send-type-inference.rs b/src/test/run-pass/threads-sendsync/send-type-inference.rs index e1aaf6d220e..a855bc51480 100644 --- a/src/test/run-pass/threads-sendsync/send-type-inference.rs +++ b/src/test/run-pass/threads-sendsync/send-type-inference.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_mut)] // pretty-expanded FIXME #23616 use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/threads-sendsync/sendable-class.rs b/src/test/run-pass/threads-sendsync/sendable-class.rs index 2e82a278f3d..1dcd7c94868 100644 --- a/src/test/run-pass/threads-sendsync/sendable-class.rs +++ b/src/test/run-pass/threads-sendsync/sendable-class.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(non_camel_case_types)] // Test that a class with only sendable fields can be sent diff --git a/src/test/run-pass/threads-sendsync/spawn-fn.rs b/src/test/run-pass/threads-sendsync/spawn-fn.rs index 39fbba04361..1e1382df60f 100644 --- a/src/test/run-pass/threads-sendsync/spawn-fn.rs +++ b/src/test/run-pass/threads-sendsync/spawn-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/spawning-with-debug.rs b/src/test/run-pass/threads-sendsync/spawning-with-debug.rs index e582cff43ab..38fc9dec829 100644 --- a/src/test/run-pass/threads-sendsync/spawning-with-debug.rs +++ b/src/test/run-pass/threads-sendsync/spawning-with-debug.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(unused_mut)] // ignore-windows // exec-env:RUST_LOG=debug // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-0.rs b/src/test/run-pass/threads-sendsync/task-comm-0.rs index 1626b23fdc2..955304a5c45 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-0.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-0.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-comm-1.rs b/src/test/run-pass/threads-sendsync/task-comm-1.rs index 975789e8cd2..0059403c3bb 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-1.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-comm-10.rs b/src/test/run-pass/threads-sendsync/task-comm-10.rs index cbb22520093..2fadece739f 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-10.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-10.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(unused_mut)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-comm-11.rs b/src/test/run-pass/threads-sendsync/task-comm-11.rs index 28710116dc3..7ecb62364fb 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-11.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-11.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // pretty-expanded FIXME #23616 // ignore-emscripten no threads support diff --git a/src/test/run-pass/threads-sendsync/task-comm-12.rs b/src/test/run-pass/threads-sendsync/task-comm-12.rs index e6195bf011b..6c8e456bcdf 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-12.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-12.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(unused_mut)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-comm-13.rs b/src/test/run-pass/threads-sendsync/task-comm-13.rs index 2276fd8031f..6afc031ffb1 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-13.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-13.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // ignore-emscripten no threads support use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/threads-sendsync/task-comm-14.rs b/src/test/run-pass/threads-sendsync/task-comm-14.rs index f6a96a84eb6..7b5336a0551 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-14.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-14.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_parens)] // ignore-emscripten no threads support use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/threads-sendsync/task-comm-15.rs b/src/test/run-pass/threads-sendsync/task-comm-15.rs index 0398b55720d..fdf17d3ce6f 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-15.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-15.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/task-comm-16.rs b/src/test/run-pass/threads-sendsync/task-comm-16.rs index d98766f9194..1732411629e 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-16.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-16.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_parens)] #![allow(non_camel_case_types)] use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads-sendsync/task-comm-17.rs b/src/test/run-pass/threads-sendsync/task-comm-17.rs index 53a233da820..8dce1f7e31e 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-17.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-17.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/task-comm-3.rs b/src/test/run-pass/threads-sendsync/task-comm-3.rs index d18ed1c567c..9d3985fcde6 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-3.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-3.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-comm-4.rs b/src/test/run-pass/threads-sendsync/task-comm-4.rs index 47cbf8ec98a..f6101498a05 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-4.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-4.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads-sendsync/task-comm-6.rs b/src/test/run-pass/threads-sendsync/task-comm-6.rs index 83eb36728ef..7564e640371 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-6.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-6.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_assignments)] use std::sync::mpsc::channel; diff --git a/src/test/run-pass/threads-sendsync/task-comm-7.rs b/src/test/run-pass/threads-sendsync/task-comm-7.rs index 6bf1bad07c1..de7efc4159d 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-7.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-7.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] +#![allow(unused_assignments)] // ignore-emscripten no threads support use std::sync::mpsc::{channel, Sender}; diff --git a/src/test/run-pass/threads-sendsync/task-comm-9.rs b/src/test/run-pass/threads-sendsync/task-comm-9.rs index f23a1594507..01d749cba4c 100644 --- a/src/test/run-pass/threads-sendsync/task-comm-9.rs +++ b/src/test/run-pass/threads-sendsync/task-comm-9.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/threads-sendsync/task-life-0.rs b/src/test/run-pass/threads-sendsync/task-life-0.rs index 8ec7c871c68..48d8c8e50b7 100644 --- a/src/test/run-pass/threads-sendsync/task-life-0.rs +++ b/src/test/run-pass/threads-sendsync/task-life-0.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs b/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs index 65e2236f2e1..04adacd689c 100644 --- a/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs +++ b/src/test/run-pass/threads-sendsync/task-spawn-move-and-copy.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support #![feature(box_syntax)] diff --git a/src/test/run-pass/threads-sendsync/threads.rs b/src/test/run-pass/threads-sendsync/threads.rs index 7be239e29fb..51d2d356b00 100644 --- a/src/test/run-pass/threads-sendsync/threads.rs +++ b/src/test/run-pass/threads-sendsync/threads.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support use std::thread; diff --git a/src/test/run-pass/traits/auto-traits.rs b/src/test/run-pass/traits/auto-traits.rs index 79c2108ba83..f4d824557e5 100644 --- a/src/test/run-pass/traits/auto-traits.rs +++ b/src/test/run-pass/traits/auto-traits.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_doc_comments)] #![feature(optin_builtin_traits)] auto trait Auto {} diff --git a/src/test/run-pass/traits/cycle-trait-type-trait.rs b/src/test/run-pass/traits/cycle-trait-type-trait.rs index c1958398005..9328c86bd7e 100644 --- a/src/test/run-pass/traits/cycle-trait-type-trait.rs +++ b/src/test/run-pass/traits/cycle-trait-type-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Test a case where a supertrait references a type that references // the original trait. This poses no problem at the moment. diff --git a/src/test/run-pass/traits/impl-implicit-trait.rs b/src/test/run-pass/traits/impl-implicit-trait.rs index 76cfaf2c68e..f25ce842311 100644 --- a/src/test/run-pass/traits/impl-implicit-trait.rs +++ b/src/test/run-pass/traits/impl-implicit-trait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs index d53619d0c9d..f2956d38331 100644 --- a/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs +++ b/src/test/run-pass/traits/infer-from-object-trait-issue-26952.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that when we match a trait reference like `Foo: Foo<_#0t>`, // we unify with `_#0t` with `A`. In this code, if we failed to do // that, then you get an unconstrained type-variable in `call`. diff --git a/src/test/run-pass/traits/object-one-type-two-traits.rs b/src/test/run-pass/traits/object-one-type-two-traits.rs index 5a468e0d644..ae2f0d31af2 100644 --- a/src/test/run-pass/traits/object-one-type-two-traits.rs +++ b/src/test/run-pass/traits/object-one-type-two-traits.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Testing creating two vtables with the same self type, but different // traits. diff --git a/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs b/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs index d9a051ee02e..991d482c15b 100644 --- a/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs +++ b/src/test/run-pass/traits/overlap-permitted-for-marker-traits-neg.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(overlapping_marker_traits)] #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/traits/supertrait-default-generics.rs b/src/test/run-pass/traits/supertrait-default-generics.rs index c3c37d6b9c0..984089b4d11 100644 --- a/src/test/run-pass/traits/supertrait-default-generics.rs +++ b/src/test/run-pass/traits/supertrait-default-generics.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] // There is some other borrowck bug, so we make the stuff not mut. diff --git a/src/test/run-pass/traits/syntax-trait-polarity.rs b/src/test/run-pass/traits/syntax-trait-polarity.rs index 89b49b11f01..a77099b4257 100644 --- a/src/test/run-pass/traits/syntax-trait-polarity.rs +++ b/src/test/run-pass/traits/syntax-trait-polarity.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(optin_builtin_traits)] diff --git a/src/test/run-pass/traits/trait-bounds-basic.rs b/src/test/run-pass/traits/trait-bounds-basic.rs index 1a2621f7679..81b410b7777 100644 --- a/src/test/run-pass/traits/trait-bounds-basic.rs +++ b/src/test/run-pass/traits/trait-bounds-basic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(unconditional_recursion)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-bounds-in-arc.rs b/src/test/run-pass/traits/trait-bounds-in-arc.rs index 35210be3478..0b67f492d45 100644 --- a/src/test/run-pass/traits/trait-bounds-in-arc.rs +++ b/src/test/run-pass/traits/trait-bounds-in-arc.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // Tests that a heterogeneous list of existential types can be put inside an Arc // and shared between threads as long as all types fulfill Send. diff --git a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs index 1b32c51aa85..aa6b845bb01 100644 --- a/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs +++ b/src/test/run-pass/traits/trait-bounds-on-structs-and-enums.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 trait U {} diff --git a/src/test/run-pass/traits/trait-bounds.rs b/src/test/run-pass/traits/trait-bounds.rs index 3c433b58a3a..20a9bd47d0e 100644 --- a/src/test/run-pass/traits/trait-bounds.rs +++ b/src/test/run-pass/traits/trait-bounds.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] diff --git a/src/test/run-pass/traits/trait-coercion-generic.rs b/src/test/run-pass/traits/trait-coercion-generic.rs index 2b64bb005e9..541c6e19b23 100644 --- a/src/test/run-pass/traits/trait-coercion-generic.rs +++ b/src/test/run-pass/traits/trait-coercion-generic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Trait { fn f(&self, x: T); } diff --git a/src/test/run-pass/traits/trait-coercion.rs b/src/test/run-pass/traits/trait-coercion.rs index 18fc122439b..948f2e7afaf 100644 --- a/src/test/run-pass/traits/trait-coercion.rs +++ b/src/test/run-pass/traits/trait-coercion.rs @@ -9,6 +9,9 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_mut)] +#![allow(unused_variables)] #![feature(box_syntax)] use std::io::{self, Write}; diff --git a/src/test/run-pass/traits/trait-copy-guessing.rs b/src/test/run-pass/traits/trait-copy-guessing.rs index 2d2ea50a1fd..1035c9a1751 100644 --- a/src/test/run-pass/traits/trait-copy-guessing.rs +++ b/src/test/run-pass/traits/trait-copy-guessing.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // "guessing" in trait selection can affect `copy_or_move`. Check that this // is correctly handled. I am not sure what is the "correct" behaviour, // but we should at least not ICE. diff --git a/src/test/run-pass/traits/trait-default-method-bound-subst4.rs b/src/test/run-pass/traits/trait-default-method-bound-subst4.rs index 70c440c7665..6f3e2e1e72b 100644 --- a/src/test/run-pass/traits/trait-default-method-bound-subst4.rs +++ b/src/test/run-pass/traits/trait-default-method-bound-subst4.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] trait A { diff --git a/src/test/run-pass/traits/trait-default-method-xc.rs b/src/test/run-pass/traits/trait-default-method-xc.rs index 426b3e2ad79..da84e8992cd 100644 --- a/src/test/run-pass/traits/trait-default-method-xc.rs +++ b/src/test/run-pass/traits/trait-default-method-xc.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // aux-build:trait_default_method_xc_aux.rs diff --git a/src/test/run-pass/traits/trait-impl-2.rs b/src/test/run-pass/traits/trait-impl-2.rs index 8fadb09377f..52657042dd8 100644 --- a/src/test/run-pass/traits/trait-impl-2.rs +++ b/src/test/run-pass/traits/trait-impl-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-inheritance-auto-xc.rs b/src/test/run-pass/traits/trait-inheritance-auto-xc.rs index d6b3d900a09..17d4d42e0c0 100644 --- a/src/test/run-pass/traits/trait-inheritance-auto-xc.rs +++ b/src/test/run-pass/traits/trait-inheritance-auto-xc.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // aux-build:trait_inheritance_auto_xc_aux.rs diff --git a/src/test/run-pass/traits/trait-inheritance-auto.rs b/src/test/run-pass/traits/trait-inheritance-auto.rs index 698f8ac23dd..4d61e42445d 100644 --- a/src/test/run-pass/traits/trait-inheritance-auto.rs +++ b/src/test/run-pass/traits/trait-inheritance-auto.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Testing that this impl turns A into a Quux, because // A is already a Foo Bar Baz diff --git a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs index 566d59f460e..6a6bd9c7be5 100644 --- a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs +++ b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Foo { fn f(&self) -> isize; } trait Bar : Foo { fn g(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs index a769da5e2cb..c8d8c3d62a2 100644 --- a/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs +++ b/src/test/run-pass/traits/trait-inheritance-call-bound-inherited2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Foo { fn f(&self) -> isize; } trait Bar : Foo { fn g(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs index 00d74ca0781..5410c5c79ad 100644 --- a/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs +++ b/src/test/run-pass/traits/trait-inheritance-cast-without-call-to-supertrait.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Testing that we can cast to a subtrait and call subtrait // methods. Not testing supertrait methods diff --git a/src/test/run-pass/traits/trait-inheritance-cast.rs b/src/test/run-pass/traits/trait-inheritance-cast.rs index f2d1cb0cb3d..084a7d8440d 100644 --- a/src/test/run-pass/traits/trait-inheritance-cast.rs +++ b/src/test/run-pass/traits/trait-inheritance-cast.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Testing that supertrait methods can be called on subtrait object types diff --git a/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs b/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs index 3a57fc525b2..29d54ed697d 100644 --- a/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs +++ b/src/test/run-pass/traits/trait-inheritance-cross-trait-call.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Foo { fn f(&self) -> isize; } trait Bar : Foo { fn g(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-inheritance-diamond.rs b/src/test/run-pass/traits/trait-inheritance-diamond.rs index bf66d50d159..47b3c7446e8 100644 --- a/src/test/run-pass/traits/trait-inheritance-diamond.rs +++ b/src/test/run-pass/traits/trait-inheritance-diamond.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // B and C both require A, so D does as well, twice, but that's just fine diff --git a/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs b/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs index b9a9795c6c0..163914e7462 100644 --- a/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs +++ b/src/test/run-pass/traits/trait-inheritance-multiple-inheritors.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait A { fn a(&self) -> isize; } trait B: A { fn b(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-inheritance-multiple-params.rs b/src/test/run-pass/traits/trait-inheritance-multiple-params.rs index 5e6aa85498c..1a08099aa04 100644 --- a/src/test/run-pass/traits/trait-inheritance-multiple-params.rs +++ b/src/test/run-pass/traits/trait-inheritance-multiple-params.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait A { fn a(&self) -> isize; } trait B: A { fn b(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-inheritance-num.rs b/src/test/run-pass/traits/trait-inheritance-num.rs index 9d4c9f431dd..cd269eac9a4 100644 --- a/src/test/run-pass/traits/trait-inheritance-num.rs +++ b/src/test/run-pass/traits/trait-inheritance-num.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 pub trait NumExt: PartialEq + PartialOrd {} diff --git a/src/test/run-pass/traits/trait-inheritance-num0.rs b/src/test/run-pass/traits/trait-inheritance-num0.rs index 0d57dee49a1..7ff30118c86 100644 --- a/src/test/run-pass/traits/trait-inheritance-num0.rs +++ b/src/test/run-pass/traits/trait-inheritance-num0.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Extending Num and using inherited static methods // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/traits/trait-inheritance-num1.rs b/src/test/run-pass/traits/trait-inheritance-num1.rs index e2a4f4154f9..4b47ab58b1d 100644 --- a/src/test/run-pass/traits/trait-inheritance-num1.rs +++ b/src/test/run-pass/traits/trait-inheritance-num1.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 pub trait NumCast: Sized { diff --git a/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs b/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs index ff2f6b2d825..374246da285 100644 --- a/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs +++ b/src/test/run-pass/traits/trait-inheritance-overloading-simple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] use std::cmp::PartialEq; trait MyNum : PartialEq { } diff --git a/src/test/run-pass/traits/trait-inheritance-simple.rs b/src/test/run-pass/traits/trait-inheritance-simple.rs index 379a98cdebe..7da4647f652 100644 --- a/src/test/run-pass/traits/trait-inheritance-simple.rs +++ b/src/test/run-pass/traits/trait-inheritance-simple.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Foo { fn f(&self) -> isize; } trait Bar : Foo { fn g(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-inheritance2.rs b/src/test/run-pass/traits/trait-inheritance2.rs index 01088d65537..22c3b30c9e4 100644 --- a/src/test/run-pass/traits/trait-inheritance2.rs +++ b/src/test/run-pass/traits/trait-inheritance2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] trait Foo { fn f(&self) -> isize; } trait Bar { fn g(&self) -> isize; } diff --git a/src/test/run-pass/traits/trait-object-auto-dedup.rs b/src/test/run-pass/traits/trait-object-auto-dedup.rs index c33482e8a71..0d9728210f2 100644 --- a/src/test/run-pass/traits/trait-object-auto-dedup.rs +++ b/src/test/run-pass/traits/trait-object-auto-dedup.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] // Test that duplicate auto trait bounds in trait objects don't create new types. #[allow(unused_assignments)] diff --git a/src/test/run-pass/traits/trait-static-method-overwriting.rs b/src/test/run-pass/traits/trait-static-method-overwriting.rs index 25307e822ff..76ec05aba34 100644 --- a/src/test/run-pass/traits/trait-static-method-overwriting.rs +++ b/src/test/run-pass/traits/trait-static-method-overwriting.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] mod base { pub trait HasNew { fn new() -> Self; diff --git a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs index 3a732aabbf7..e811cc7d6e1 100644 --- a/src/test/run-pass/traits/trait-where-clause-vs-impl.rs +++ b/src/test/run-pass/traits/trait-where-clause-vs-impl.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // Test that when there is a conditional (but blanket) impl and a // where clause, we don't get confused in trait resolution. // diff --git a/src/test/run-pass/traits/traits-conditional-model-fn.rs b/src/test/run-pass/traits/traits-conditional-model-fn.rs index cc5ce571a4e..106774bd337 100644 --- a/src/test/run-pass/traits/traits-conditional-model-fn.rs +++ b/src/test/run-pass/traits/traits-conditional-model-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // A model for how the `Fn` traits could work. You can implement at // most one of `Go`, `GoMut`, or `GoOnce`, and then the others follow // automatically. diff --git a/src/test/run-pass/traits/traits-default-method-mut.rs b/src/test/run-pass/traits/traits-default-method-mut.rs index 7cfdae9e652..c83856f0352 100644 --- a/src/test/run-pass/traits/traits-default-method-mut.rs +++ b/src/test/run-pass/traits/traits-default-method-mut.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] // pretty-expanded FIXME #23616 #![allow(unused_variables)] diff --git a/src/test/run-pass/traits/traits-issue-22655.rs b/src/test/run-pass/traits/traits-issue-22655.rs index 0e80d20ad45..6766d661622 100644 --- a/src/test/run-pass/traits/traits-issue-22655.rs +++ b/src/test/run-pass/traits/traits-issue-22655.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Regression test for issue #22655: This test should not lead to // infinite recursion. diff --git a/src/test/run-pass/traits/traits-negative-impls.rs b/src/test/run-pass/traits/traits-negative-impls.rs index 96c86f147ce..0740ab01104 100644 --- a/src/test/run-pass/traits/traits-negative-impls.rs +++ b/src/test/run-pass/traits/traits-negative-impls.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![feature(optin_builtin_traits)] use std::marker::Send; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs index eebd30a01f9..6c134611312 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn-mut.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that you can supply `&F` where `F: FnMut()`. #![feature(lang_items)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs index 52a10869610..966458a45f3 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-blanket-fn.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that you can supply `&F` where `F: Fn()`. #![feature(lang_items)] diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs index b178f0af909..adfdc0d26e9 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-call-fn-autoderef.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // Test that the call operator autoderefs when calling a bounded type parameter. use std::ops::FnMut; diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs index dc6903db326..4ebf6b61cc3 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-counter-not-moved.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // Test that we mutate a counter on the stack only when we expect to. fn call(f: F) where F : FnOnce() { diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs index 1f84db7f720..46a69c4dff2 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-direct-sugary-call.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs index 02edd01ac18..46ea9b29e44 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-drop.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(path_statements)] +#![allow(dead_code)] // A battery of tests to ensure destructors of unboxed closure environments // run at the right times. diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs index b7230ed5d82..3f50c7e7262 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-simple.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_imports)] use std::ops::FnMut; pub fn main() { diff --git a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs index ae9124c9fc1..cf8fe03e3e5 100644 --- a/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs +++ b/src/test/run-pass/unboxed-closures/unboxed-closures-zero-args.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // pretty-expanded FIXME #23616 fn main() { diff --git a/src/test/run-pass/uniform-paths/basic-nested.rs b/src/test/run-pass/uniform-paths/basic-nested.rs index 1aaa1e70726..a0256187dbb 100644 --- a/src/test/run-pass/uniform-paths/basic-nested.rs +++ b/src/test/run-pass/uniform-paths/basic-nested.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![allow(non_camel_case_types)] // edition:2018 diff --git a/src/test/run-pass/uniform-paths/basic.rs b/src/test/run-pass/uniform-paths/basic.rs index 7d997fe493a..b957b24d625 100644 --- a/src/test/run-pass/uniform-paths/basic.rs +++ b/src/test/run-pass/uniform-paths/basic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![allow(non_camel_case_types)] // edition:2018 diff --git a/src/test/run-pass/union/union-align.rs b/src/test/run-pass/union/union-align.rs index 02f447c626f..2ba1b97e4ff 100644 --- a/src/test/run-pass/union/union-align.rs +++ b/src/test/run-pass/union/union-align.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![feature(untagged_unions)] diff --git a/src/test/run-pass/union/union-backcomp.rs b/src/test/run-pass/union/union-backcomp.rs index 23d51d39c2e..b274a101ee9 100644 --- a/src/test/run-pass/union/union-backcomp.rs +++ b/src/test/run-pass/union/union-backcomp.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(path_statements)] +#![allow(dead_code)] macro_rules! union { () => (struct S;) diff --git a/src/test/run-pass/union/union-basic.rs b/src/test/run-pass/union/union-basic.rs index bfbac1a6bf2..9bebe3f265e 100644 --- a/src/test/run-pass/union/union-basic.rs +++ b/src/test/run-pass/union/union-basic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] // aux-build:union.rs diff --git a/src/test/run-pass/union/union-derive.rs b/src/test/run-pass/union/union-derive.rs index 248595ee7ac..60501780816 100644 --- a/src/test/run-pass/union/union-derive.rs +++ b/src/test/run-pass/union/union-derive.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(unions_with_drop_fields)] // Some traits can be derived for unions. diff --git a/src/test/run-pass/union/union-drop-assign.rs b/src/test/run-pass/union/union-drop-assign.rs index 2884cf16b96..d147fcd0f09 100644 --- a/src/test/run-pass/union/union-drop-assign.rs +++ b/src/test/run-pass/union/union-drop-assign.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] #![allow(unions_with_drop_fields)] // Drop works for union itself. diff --git a/src/test/run-pass/union/union-drop.rs b/src/test/run-pass/union/union-drop.rs index ba5c20b6dc3..7d955f7210f 100644 --- a/src/test/run-pass/union/union-drop.rs +++ b/src/test/run-pass/union/union-drop.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] #![allow(unions_with_drop_fields)] // Drop works for union itself. diff --git a/src/test/run-pass/union/union-generic.rs b/src/test/run-pass/union/union-generic.rs index dcea56c288f..efa623841c1 100644 --- a/src/test/run-pass/union/union-generic.rs +++ b/src/test/run-pass/union/union-generic.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(unions_with_drop_fields)] #![feature(untagged_unions)] diff --git a/src/test/run-pass/union/union-macro.rs b/src/test/run-pass/union/union-macro.rs index f4ffa2edbde..ae215dc83ee 100644 --- a/src/test/run-pass/union/union-macro.rs +++ b/src/test/run-pass/union/union-macro.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] macro_rules! duplicate { ($i: item) => { diff --git a/src/test/run-pass/union/union-packed.rs b/src/test/run-pass/union/union-packed.rs index c167a40507a..a6aef9046ee 100644 --- a/src/test/run-pass/union/union-packed.rs +++ b/src/test/run-pass/union/union-packed.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_snake_case)] #![feature(untagged_unions)] diff --git a/src/test/run-pass/union/union-pat-refutability.rs b/src/test/run-pass/union/union-pat-refutability.rs index 2c481160fda..62a02337986 100644 --- a/src/test/run-pass/union/union-pat-refutability.rs +++ b/src/test/run-pass/union/union-pat-refutability.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(illegal_floating_point_literal_pattern)] #[repr(u32)] diff --git a/src/test/run-pass/unique/unique-assign-drop.rs b/src/test/run-pass/unique/unique-assign-drop.rs index dd931480196..fc99a896966 100644 --- a/src/test/run-pass/unique/unique-assign-drop.rs +++ b/src/test/run-pass/unique/unique-assign-drop.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_assignments)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-assign.rs b/src/test/run-pass/unique/unique-assign.rs index 206503f87ce..ee6c084410d 100644 --- a/src/test/run-pass/unique/unique-assign.rs +++ b/src/test/run-pass/unique/unique-assign.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique/unique-cmp.rs b/src/test/run-pass/unique/unique-cmp.rs index b11b1a8cdbc..5c17058dbe4 100644 --- a/src/test/run-pass/unique/unique-cmp.rs +++ b/src/test/run-pass/unique/unique-cmp.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_allocation)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique/unique-containing-tag.rs b/src/test/run-pass/unique/unique-containing-tag.rs index d849c1d3298..f2a7de67183 100644 --- a/src/test/run-pass/unique/unique-containing-tag.rs +++ b/src/test/run-pass/unique/unique-containing-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unique/unique-create.rs b/src/test/run-pass/unique/unique-create.rs index 5c7488b1120..da0ae17a4cd 100644 --- a/src/test/run-pass/unique/unique-create.rs +++ b/src/test/run-pass/unique/unique-create.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // pretty-expanded FIXME #23616 #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-decl.rs b/src/test/run-pass/unique/unique-decl.rs index 37b8b94b15a..9b1425381b6 100644 --- a/src/test/run-pass/unique/unique-decl.rs +++ b/src/test/run-pass/unique/unique-decl.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] pub fn main() { diff --git a/src/test/run-pass/unique/unique-generic-assign.rs b/src/test/run-pass/unique/unique-generic-assign.rs index 571a5620cd8..beb3b2fbb48 100644 --- a/src/test/run-pass/unique/unique-generic-assign.rs +++ b/src/test/run-pass/unique/unique-generic-assign.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue #976 diff --git a/src/test/run-pass/unique/unique-in-tag.rs b/src/test/run-pass/unique/unique-in-tag.rs index 31fe43dae99..52473bd8e89 100644 --- a/src/test/run-pass/unique/unique-in-tag.rs +++ b/src/test/run-pass/unique/unique-in-tag.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-match-discrim.rs b/src/test/run-pass/unique/unique-match-discrim.rs index 43004e8673a..e3ceadee1a5 100644 --- a/src/test/run-pass/unique/unique-match-discrim.rs +++ b/src/test/run-pass/unique/unique-match-discrim.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue #961 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unique/unique-move-temp.rs b/src/test/run-pass/unique/unique-move-temp.rs index a68fe021d09..e006e1e4f23 100644 --- a/src/test/run-pass/unique/unique-move-temp.rs +++ b/src/test/run-pass/unique/unique-move-temp.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique/unique-move.rs b/src/test/run-pass/unique/unique-move.rs index 4dba48a5ea0..0a1b80c33df 100644 --- a/src/test/run-pass/unique/unique-move.rs +++ b/src/test/run-pass/unique/unique-move.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] #![feature(box_syntax)] pub fn main() { diff --git a/src/test/run-pass/unique/unique-object-move.rs b/src/test/run-pass/unique/unique-object-move.rs index d85b22f5dc9..472257b8c79 100644 --- a/src/test/run-pass/unique/unique-object-move.rs +++ b/src/test/run-pass/unique/unique-object-move.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // Issue #5192 // pretty-expanded FIXME #23616 diff --git a/src/test/run-pass/unique/unique-pat-2.rs b/src/test/run-pass/unique/unique-pat-2.rs index 3796be68369..0adf23ceeac 100644 --- a/src/test/run-pass/unique/unique-pat-2.rs +++ b/src/test/run-pass/unique/unique-pat-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_shorthand_field_patterns)] diff --git a/src/test/run-pass/unique/unique-pat-3.rs b/src/test/run-pass/unique/unique-pat-3.rs index 2ed984c3a37..8deda0e3089 100644 --- a/src/test/run-pass/unique/unique-pat-3.rs +++ b/src/test/run-pass/unique/unique-pat-3.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] #![allow(non_camel_case_types)] #![feature(box_syntax)] diff --git a/src/test/run-pass/unique/unique-send-2.rs b/src/test/run-pass/unique/unique-send-2.rs index 285772b9541..f34a7c2cd00 100644 --- a/src/test/run-pass/unique/unique-send-2.rs +++ b/src/test/run-pass/unique/unique-send-2.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_must_use)] // ignore-emscripten no threads support #![feature(box_syntax)] diff --git a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs index 3afccab07b7..bb9d01a57c1 100644 --- a/src/test/run-pass/where-clauses/where-clause-method-substituion.rs +++ b/src/test/run-pass/where-clauses/where-clause-method-substituion.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 trait Foo { fn dummy(&self, arg: T) { } } diff --git a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs index 445a090d601..5a296c17df0 100644 --- a/src/test/run-pass/where-clauses/where-clause-region-outlives.rs +++ b/src/test/run-pass/where-clauses/where-clause-region-outlives.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(dead_code)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 struct A<'a, 'b> where 'a : 'b { x: &'a isize, y: &'b isize } diff --git a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs index 22b1acb2a60..fc511914517 100644 --- a/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs +++ b/src/test/run-pass/where-clauses/where-clauses-lifetimes.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] +#![allow(unused_variables)] // pretty-expanded FIXME #23616 fn foo<'a, I>(mut it: I) where I: Iterator {} diff --git a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs index c3cfbbda4ea..79d1431eca5 100644 --- a/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs +++ b/src/test/run-pass/where-clauses/where-clauses-unboxed-closures.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // pretty-expanded FIXME #23616 struct Bencher; diff --git a/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs b/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs index 4ab329f166a..118e83537ca 100644 --- a/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs +++ b/src/test/run-pass/zero-sized/zero-sized-binary-heap-push.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use std::collections::BinaryHeap; use std::iter::Iterator; diff --git a/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs b/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs index 5e406152d93..a2c0f78850c 100644 --- a/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs +++ b/src/test/run-pass/zero-sized/zero-sized-btreemap-insert.rs @@ -9,6 +9,8 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] +#![allow(unused_imports)] use std::cmp::{Ord, Ordering, PartialOrd}; use std::collections::BTreeMap; use std::iter::Iterator; diff --git a/src/test/run-pass/zero-sized/zero-sized-vec-push.rs b/src/test/run-pass/zero-sized/zero-sized-vec-push.rs index dd8b717761b..d418535bf9f 100644 --- a/src/test/run-pass/zero-sized/zero-sized-vec-push.rs +++ b/src/test/run-pass/zero-sized/zero-sized-vec-push.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] use std::iter::Iterator; use std::vec::Vec; -- cgit 1.4.1-3-g733a5 From 8d868005009d7c24f37d06543f5a372bfdf366c7 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Wed, 26 Sep 2018 13:04:07 +0200 Subject: Add `#[allow(unused_mut)]` for various cases that arise only in compare-mode=nll. --- src/test/run-pass/binding/nested-matchs.rs | 1 + src/test/run-pass/issues/issue-30371.rs | 1 + src/test/run-pass/issues/issue-49298.rs | 1 + 3 files changed, 3 insertions(+) (limited to 'src') diff --git a/src/test/run-pass/binding/nested-matchs.rs b/src/test/run-pass/binding/nested-matchs.rs index e1012f3b384..0b37c495074 100644 --- a/src/test/run-pass/binding/nested-matchs.rs +++ b/src/test/run-pass/binding/nested-matchs.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_mut)] // under NLL we get warning about `bar` below fn baz() -> ! { panic!(); } fn foo() { diff --git a/src/test/run-pass/issues/issue-30371.rs b/src/test/run-pass/issues/issue-30371.rs index a3140f6ded2..3877e231527 100644 --- a/src/test/run-pass/issues/issue-30371.rs +++ b/src/test/run-pass/issues/issue-30371.rs @@ -10,6 +10,7 @@ // run-pass #![allow(unreachable_code)] +#![allow(unused_mut)] // rust-lang/rust#54586 #![deny(unused_variables)] fn main() { diff --git a/src/test/run-pass/issues/issue-49298.rs b/src/test/run-pass/issues/issue-49298.rs index 22a34f334cb..6463adc48a8 100644 --- a/src/test/run-pass/issues/issue-49298.rs +++ b/src/test/run-pass/issues/issue-49298.rs @@ -10,6 +10,7 @@ // run-pass #![feature(test)] +#![allow(unused_mut)] // under NLL we get warning about `x` below: rust-lang/rust#54499 extern crate test; -- cgit 1.4.1-3-g733a5 From 3eaa5e3467177efe969b92ae53636d6dd7c29947 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 27 Sep 2018 10:14:57 +0200 Subject: Allow some lints that only fired on 32-bit and/or Windows. --- src/test/run-pass/process/process-sigpipe.rs | 1 + src/test/run-pass/structs-enums/struct-return.rs | 1 + 2 files changed, 2 insertions(+) (limited to 'src') diff --git a/src/test/run-pass/process/process-sigpipe.rs b/src/test/run-pass/process/process-sigpipe.rs index d1e3fba14cf..715da1514f3 100644 --- a/src/test/run-pass/process/process-sigpipe.rs +++ b/src/test/run-pass/process/process-sigpipe.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_imports)] #![allow(deprecated)] // ignore-android since the dynamic linker sets a SIGPIPE handler (to do diff --git a/src/test/run-pass/structs-enums/struct-return.rs b/src/test/run-pass/structs-enums/struct-return.rs index a2b380c7e18..5f85954f6b1 100644 --- a/src/test/run-pass/structs-enums/struct-return.rs +++ b/src/test/run-pass/structs-enums/struct-return.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(dead_code)] // ignore-wasm32-bare no libc to test ffi with #[repr(C)] -- cgit 1.4.1-3-g733a5 From fe4d8d82116e6595a83ba557a9cc1047d303c406 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 27 Sep 2018 13:06:16 +0200 Subject: Allow more lints that signalled on the arm-android test run. --- src/test/run-pass/issues/issue-14936.rs | 3 ++- src/test/run-pass/simd/simd-target-feature-mixup.rs | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/test/run-pass/issues/issue-14936.rs b/src/test/run-pass/issues/issue-14936.rs index 3786b0408ad..4249a83e3c2 100644 --- a/src/test/run-pass/issues/issue-14936.rs +++ b/src/test/run-pass/issues/issue-14936.rs @@ -9,7 +9,8 @@ // except according to those terms. // run-pass - +#![allow(unused_macros)] +#![allow(dead_code)] #![feature(asm)] type History = Vec<&'static str>; diff --git a/src/test/run-pass/simd/simd-target-feature-mixup.rs b/src/test/run-pass/simd/simd-target-feature-mixup.rs index 7ac91592d81..5c845031ee4 100644 --- a/src/test/run-pass/simd/simd-target-feature-mixup.rs +++ b/src/test/run-pass/simd/simd-target-feature-mixup.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] #![allow(stable_features)] #![allow(overflowing_literals)] -- cgit 1.4.1-3-g733a5 From 649b20eca9a5d2860eb46f6b9e1d99753d4515b7 Mon Sep 17 00:00:00 2001 From: "Felix S. Klock II" Date: Thu, 27 Sep 2018 21:00:21 +0200 Subject: Allow `unused_variables` lint to placate test failure exposed by macos builders. --- src/test/run-pass/issues/issue-45731.rs | 1 + 1 file changed, 1 insertion(+) (limited to 'src') diff --git a/src/test/run-pass/issues/issue-45731.rs b/src/test/run-pass/issues/issue-45731.rs index 568d6674c3a..27ecc566233 100644 --- a/src/test/run-pass/issues/issue-45731.rs +++ b/src/test/run-pass/issues/issue-45731.rs @@ -9,6 +9,7 @@ // except according to those terms. // run-pass +#![allow(unused_variables)] // compile-flags:--test -g #[cfg(target_os = "macos")] -- cgit 1.4.1-3-g733a5